aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorivanmorozov <ivanmorozov@yandex-team.com>2023-11-07 14:41:43 +0300
committerivanmorozov <ivanmorozov@yandex-team.com>2023-11-07 15:24:37 +0300
commit5c97584dc3e79afb716d13b038e915334761661d (patch)
tree18170675d9ca1f12cbfc496f961cb70fac6fe0d8
parent101488fba600ce798837e5b26dd0ce1c75d82b88 (diff)
downloadydb-5c97584dc3e79afb716d13b038e915334761661d.tar.gz
KIKIMR-19679: correct races and locks
-rw-r--r--ydb/core/kqp/ut/olap/kqp_olap_ut.cpp4
-rw-r--r--ydb/services/bg_tasks/ut/task_emulator.cpp15
2 files changed, 11 insertions, 8 deletions
diff --git a/ydb/core/kqp/ut/olap/kqp_olap_ut.cpp b/ydb/core/kqp/ut/olap/kqp_olap_ut.cpp
index 73d7389b7a..bf88da1954 100644
--- a/ydb/core/kqp/ut/olap/kqp_olap_ut.cpp
+++ b/ydb/core/kqp/ut/olap/kqp_olap_ut.cpp
@@ -1377,6 +1377,7 @@ Y_UNIT_TEST_SUITE(KqpOlap) {
TKikimrRunner kikimr(settings);
TLocalHelper(kikimr).CreateTestOlapTable();
+ auto csController = NYDBTest::TControllers::RegisterCSControllerGuard<NYDBTest::NColumnShard::TController>();
WriteTestData(kikimr, "/Root/olapStore/olapTable", 0, 1000000, 2000);
// EnableDebugLogging(kikimr);
@@ -1391,7 +1392,6 @@ Y_UNIT_TEST_SUITE(KqpOlap) {
LIMIT 1000;
)");
- auto csController = NYDBTest::TControllers::RegisterCSControllerGuard<NYDBTest::NColumnShard::TController>();
auto rows = ExecuteScanQuery(tableClient, selectQuery);
TInstant tsPrev = TInstant::MicroSeconds(1000000);
@@ -1412,6 +1412,7 @@ Y_UNIT_TEST_SUITE(KqpOlap) {
TKikimrRunner kikimr(settings);
TLocalHelper(kikimr).CreateTestOlapTable();
+ auto csController = NYDBTest::TControllers::RegisterCSControllerGuard<NYDBTest::NColumnShard::TController>();
WriteTestData(kikimr, "/Root/olapStore/olapTable", 0, 1000000, 2000);
Tests::NCommon::TLoggerInit(kikimr).Initialize();
@@ -1434,7 +1435,6 @@ Y_UNIT_TEST_SUITE(KqpOlap) {
LIMIT 1000;
)");
- auto csController = NYDBTest::TControllers::RegisterCSControllerGuard<NYDBTest::NColumnShard::TController>();
auto rows = ExecuteScanQuery(tableClient, selectQuery);
TInstant tsPrev = TInstant::MicroSeconds(2000000);
diff --git a/ydb/services/bg_tasks/ut/task_emulator.cpp b/ydb/services/bg_tasks/ut/task_emulator.cpp
index ccf05e7f5a..adda9ae392 100644
--- a/ydb/services/bg_tasks/ut/task_emulator.cpp
+++ b/ydb/services/bg_tasks/ut/task_emulator.cpp
@@ -18,12 +18,15 @@ void TTestInsertTaskActivity::DoFinished(const NBackgroundTasks::TTaskStateConta
}
void TTestInsertTaskActivity::DoExecute(NBackgroundTasks::ITaskExecutorController::TPtr controller, const NBackgroundTasks::TTaskStateContainer& currentState) {
- TGuard<TMutex> g(Mutex);
- const ui32 c = currentState.HasObject() ?
- currentState.GetAsSafe<TTestInsertTaskState>().GetCounter() :
- 0;
- Cerr << "TASK EXECUTED: " << c << Endl;
- CounterSumByActivityId[ActivityTaskId] += c;
+ ui32 c = 0;
+ {
+ TGuard<TMutex> g(Mutex);
+ c = currentState.HasObject() ?
+ currentState.GetAsSafe<TTestInsertTaskState>().GetCounter() :
+ 0;
+ Cerr << "TASK EXECUTED: " << c << Endl;
+ CounterSumByActivityId[ActivityTaskId] += c;
+ }
controller->TaskInterrupted(std::make_shared<TTestInsertTaskState>(c + 1));
}