diff options
author | ivanmorozov333 <[email protected]> | 2025-06-27 17:53:12 +0300 |
---|---|---|
committer | GitHub <[email protected]> | 2025-06-27 17:53:12 +0300 |
commit | c309b0c59f874c3197416c431581966fab61eb61 (patch) | |
tree | 0442ee0d275f583d19240a001873785ba99079c0 | |
parent | 8c006b7875e5653eb78af3e218b3f3d37b6fd277 (diff) |
fix problem portions processing (#20297)
Co-authored-by: ivanmorozov333 <[email protected]>
-rw-r--r-- | ydb/core/kqp/ut/olap/optimizer_ut.cpp | 16 | ||||
-rw-r--r-- | ydb/core/tx/columnshard/engines/storage/optimizer/lcbuckets/planner/optimizer.h | 5 |
2 files changed, 18 insertions, 3 deletions
diff --git a/ydb/core/kqp/ut/olap/optimizer_ut.cpp b/ydb/core/kqp/ut/olap/optimizer_ut.cpp index a1d1682a5c7..e5dd74ef84c 100644 --- a/ydb/core/kqp/ut/olap/optimizer_ut.cpp +++ b/ydb/core/kqp/ut/olap/optimizer_ut.cpp @@ -147,7 +147,8 @@ Y_UNIT_TEST_SUITE(KqpOlapOptimizer) { UNIT_ASSERT_C(it.IsSuccess(), it.GetIssues().ToString()); auto rows = CollectRows(it); for (auto&& i : rows) { - Cerr << GetUint64(i.at("LEVEL")) << "/" << GetUint64(i.at("RECORDS_COUNT_DEFAULT")) << "/" << GetUint64(i.at("RECORDS_COUNT_SLICE")) << Endl; + Cerr << GetUint64(i.at("LEVEL")) << "/" << GetUint64(i.at("RECORDS_COUNT_DEFAULT")) << "/" + << GetUint64(i.at("RECORDS_COUNT_SLICE")) << Endl; } AFL_VERIFY(0 == GetUint64(rows[0].at("LEVEL"))); AFL_VERIFY(GetUint64(rows[0].at("RECORDS_COUNT_DEFAULT")) == 0); @@ -227,7 +228,20 @@ Y_UNIT_TEST_SUITE(KqpOlapOptimizer) { ++levelIdx; } } + + { + auto alterQuery = + TStringBuilder() << + R"(ALTER OBJECT `/Root/olapStore` (TYPE TABLESTORE) SET (ACTION=UPSERT_OPTIONS, `COMPACTION_PLANNER.CLASS_NAME`=`lc-buckets`, `COMPACTION_PLANNER.FEATURES`=` + {"levels" : [{"class_name" : "Zero", "expected_blobs_size" : 20000, "portions_size_limit" : 100000, "portions_count_available" : 1}, + {"class_name" : "Zero"}]}`); + )"; + auto session = tableClient.CreateSession().GetValueSync().GetSession(); + auto alterResult = session.ExecuteSchemeQuery(alterQuery).GetValueSync(); + UNIT_ASSERT_VALUES_EQUAL_C(alterResult.GetStatus(), NYdb::EStatus::SUCCESS, alterResult.GetIssues().ToString()); + } } + Y_UNIT_TEST(OptimizationByTime) { auto settings = TKikimrSettings().SetWithSampleTables(false); TKikimrRunner kikimr(settings); diff --git a/ydb/core/tx/columnshard/engines/storage/optimizer/lcbuckets/planner/optimizer.h b/ydb/core/tx/columnshard/engines/storage/optimizer/lcbuckets/planner/optimizer.h index 4dd80a0e148..8f9986096dd 100644 --- a/ydb/core/tx/columnshard/engines/storage/optimizer/lcbuckets/planner/optimizer.h +++ b/ydb/core/tx/columnshard/engines/storage/optimizer/lcbuckets/planner/optimizer.h @@ -86,9 +86,10 @@ protected: continue; } PortionsInfo->AddPortion(i); - addPortionsByLevels[i->GetMeta().GetCompactionLevel()].emplace_back(i); - if (i->GetCompactionLevel() && i->GetCompactionLevel() >= Levels.size()) { + if (i->GetCompactionLevel() >= Levels.size()) { problemPortions.emplace_back(i); + } else { + addPortionsByLevels[i->GetMeta().GetCompactionLevel()].emplace_back(i); } } for (ui32 i = 0; i < Levels.size(); ++i) { |