diff options
author | kungasc <kungasc@yandex-team.com> | 2023-09-25 13:15:07 +0300 |
---|---|---|
committer | kungasc <kungasc@yandex-team.com> | 2023-09-25 14:06:00 +0300 |
commit | 098e5d3e20a3d8b3d81ab95b56a27a0bcc0d6cdc (patch) | |
tree | 670938a4a7ae76427516803fa3f1777612420b79 | |
parent | 10fe9530d0a2328e2b7bd4c081dfaf58fc2ee525 (diff) | |
download | ydb-098e5d3e20a3d8b3d81ab95b56a27a0bcc0d6cdc.tar.gz |
KIKIMR-19139 Introduce TPart.HistoricGroupsCount field
-rw-r--r-- | ydb/core/tablet_flat/flat_fwd_env.h | 14 | ||||
-rw-r--r-- | ydb/core/tablet_flat/flat_part_charge.h | 2 | ||||
-rw-r--r-- | ydb/core/tablet_flat/flat_part_store.h | 4 | ||||
-rw-r--r-- | ydb/core/tablet_flat/flat_stat_part.h | 10 | ||||
-rw-r--r-- | ydb/core/tablet_flat/flat_table_part.h | 21 | ||||
-rw-r--r-- | ydb/core/tablet_flat/test/libs/table/test_envs.h | 4 | ||||
-rw-r--r-- | ydb/core/tablet_flat/ut/ut_part.cpp | 6 |
7 files changed, 34 insertions, 27 deletions
diff --git a/ydb/core/tablet_flat/flat_fwd_env.h b/ydb/core/tablet_flat/flat_fwd_env.h index 9e500619189..feda10d75a3 100644 --- a/ydb/core/tablet_flat/flat_fwd_env.h +++ b/ydb/core/tablet_flat/flat_fwd_env.h @@ -110,7 +110,7 @@ namespace NFwd { const TSharedData* TryGetPage(const TPart* part, TPageId ref, TGroupId groupId) override { - ui16 room = (groupId.Historic ? part->Groups + 2 : 0) + groupId.Index; + ui16 room = (groupId.Historic ? part->GroupsCount + 2 : 0) + groupId.Index; TSlot slot = GetQueueSlot(part, room); if (part->GetPageType(ref, groupId) == EPage::Index) { @@ -131,7 +131,7 @@ namespace NFwd { Y_Fail("Invalid ref ELargeObj{" << int(lob) << ", " << ref << "}"); } - ui32 room = part->Groups + (lob == ELargeObj::Extern ? 1 : 0); + ui32 room = part->GroupsCount + (lob == ELargeObj::Extern ? 1 : 0); return Handle(GetQueue(part, room), ref); } @@ -239,7 +239,7 @@ namespace NFwd { continue; // we don't trace cold parts } if (auto &blobs = part->Blobs) { - auto &q = GetQueue(part, part->Groups + 1); + auto &q = GetQueue(part, part->GroupsCount + 1); auto &line = dynamic_cast<TBlobs&>(*q.PageLoadingLogic); Y_VERIFY(q.Slot < (sieves.size() - 1)); @@ -299,14 +299,14 @@ namespace NFwd { ui32 partSlot = Parts.size(); auto& slots = Parts[part]; - slots.reserve(part->Groups + 2 + part->HistoricIndexes.size()); + slots.reserve(part->GroupsCount + 2 + part->HistoricGroupsCount); - for (ui32 group : xrange(ui32(part->Groups))) { + for (ui32 group : xrange(ui32(part->GroupsCount))) { slots.push_back(Settle(MakeCache(part, NPage::TGroupId(group), partView.Slices), partSlot)); } slots.push_back(Settle(MakeOuter(part, partView.Slices), partSlot)); slots.push_back(Settle(MakeExtern(part, partView.Slices), partSlot)); - for (ui32 group : xrange(ui32(part->HistoricIndexes.size()))) { + for (ui32 group : xrange(ui32(part->HistoricGroupsCount))) { slots.push_back(Settle(MakeCache(part, NPage::TGroupId(group, true), nullptr), partSlot)); } @@ -399,7 +399,7 @@ namespace NFwd { TVector<ui32> edge(small->Stats().Tags.size(), Max<ui32>()); - auto pageCollection = partStore->PageCollections.at(partStore->Groups)->PageCollection; + auto pageCollection = partStore->PageCollections.at(partStore->GroupsCount)->PageCollection; return { new NFwd::TBlobs(small, std::move(bounds), edge, false), pageCollection }; diff --git a/ydb/core/tablet_flat/flat_part_charge.h b/ydb/core/tablet_flat/flat_part_charge.h index b8aa25e8bff..4ed618db6e0 100644 --- a/ydb/core/tablet_flat/flat_part_charge.h +++ b/ydb/core/tablet_flat/flat_part_charge.h @@ -29,7 +29,7 @@ namespace NTable { , Scheme(*Part->Scheme) , Index(Part, Env, TGroupId()) { - if (includeHistory && Part->IndexPages.Historic) { + if (includeHistory && Part->HistoricGroupsCount) { HistoryIndex.emplace(Part, Env, TGroupId(0, true)); } diff --git a/ydb/core/tablet_flat/flat_part_store.h b/ydb/core/tablet_flat/flat_part_store.h index 03daee24a33..b9a6c73d4a8 100644 --- a/ydb/core/tablet_flat/flat_part_store.h +++ b/ydb/core/tablet_flat/flat_part_store.h @@ -103,7 +103,7 @@ public: auto glob = Pseudo.Get()->PageCollection->Glob(bounds.Lo.Blob); return glob.Logo.Channel(); } else { - return PageCollections.at(Groups).Get()->Id.Channel(); + return PageCollections.at(GroupsCount).Get()->Id.Channel(); } } @@ -125,7 +125,7 @@ public: Y_Fail("Invalid ref ELargeObj{" << int(lob) << ", " << ref << "}"); } - return (lob == ELargeObj::Extern ? Pseudo : PageCollections.at(Groups)).Get(); + return (lob == ELargeObj::Extern ? Pseudo : PageCollections.at(GroupsCount)).Get(); } TAutoPtr<NPageCollection::TFetch> DataPages() const noexcept diff --git a/ydb/core/tablet_flat/flat_stat_part.h b/ydb/core/tablet_flat/flat_stat_part.h index dd00180a28a..5461528db5d 100644 --- a/ydb/core/tablet_flat/flat_stat_part.h +++ b/ydb/core/tablet_flat/flat_stat_part.h @@ -93,8 +93,8 @@ public: : PartEndRowId(part->Index.GetEndRowId()) , SmallHelper(part) { - GroupHelpers.reserve(part->Scheme->Groups.size()); - for (ui32 group : xrange(part->Scheme->Groups.size())) { + GroupHelpers.reserve(part->GroupsCount); + for (ui32 group : xrange(part->GroupsCount)) { GroupHelpers.emplace_back(part, NPage::TGroupId(group)); } } @@ -129,11 +129,11 @@ public: { Pos = Part->Index->Begin(); End = Part->Index->End(); - AltGroups.reserve(Part->Scheme->Groups.size() - 1); - for (ui32 group : xrange(size_t(1), Part->Scheme->Groups.size())) { + AltGroups.reserve(Part->GroupsCount - 1); + for (ui32 group : xrange(size_t(1), Part->GroupsCount)) { AltGroups.emplace_back(Part.Get(), NPage::TGroupId(group)); } - for (ui32 group : xrange(Part->HistoricIndexes.size())) { + for (ui32 group : xrange(Part->HistoricGroupsCount)) { HistoryGroups.emplace_back(Part.Get(), NPage::TGroupId(group, true)); } FillKey(); diff --git a/ydb/core/tablet_flat/flat_table_part.h b/ydb/core/tablet_flat/flat_table_part.h index 356e3161477..6aeb6f15a55 100644 --- a/ydb/core/tablet_flat/flat_table_part.h +++ b/ydb/core/tablet_flat/flat_table_part.h @@ -97,17 +97,22 @@ namespace NTable { , GarbageStats(std::move(params.GarbageStats)) , TxIdStats(std::move(params.TxIdStats)) , Stat(stat) - , Groups(1 + GroupIndexes.size()) + , GroupsCount(IndexPages.Groups.size()) + , HistoricGroupsCount(IndexPages.Historic.size()) , IndexesRawSize(Index.RawSize() + SumRawSize(GroupIndexes)) , MinRowVersion(params.MinRowVersion) , MaxRowVersion(params.MaxRowVersion) { - Y_VERIFY(Scheme->Groups.size() == Groups, + Y_VERIFY(Scheme->Groups.size() == GroupsCount, "Part has scheme with %" PRISZT " groups, but %" PRISZT " indexes", - Scheme->Groups.size(), Groups); - Y_VERIFY(HistoricIndexes.empty() || HistoricIndexes.size() == Groups, + Scheme->Groups.size(), GroupsCount); + Y_VERIFY(HistoricIndexes.empty() || HistoricIndexes.size() == GroupsCount, "Part has %" PRISZT " indexes, but %" PRISZT " historic indexes", - Groups, HistoricIndexes.size()); + GroupsCount, HistoricIndexes.size()); + + Y_VERIFY(!HistoricGroupsCount || HistoricGroupsCount == GroupsCount, + "Part has %" PRISZT " indexes, but %" PRISZT " historic indexes", + GroupsCount, HistoricGroupsCount); } virtual ~TPart() = default; @@ -170,7 +175,8 @@ namespace NTable { , ByKey(src.ByKey) , GarbageStats(src.GarbageStats) , Stat(src.Stat) - , Groups(src.Groups) + , GroupsCount(src.GroupsCount) + , HistoricGroupsCount(src.HistoricGroupsCount) , IndexesRawSize(src.IndexesRawSize) , MinRowVersion(src.MinRowVersion) , MaxRowVersion(src.MaxRowVersion) @@ -200,7 +206,8 @@ namespace NTable { const TIntrusiveConstPtr<NPage::TGarbageStats> GarbageStats; const TIntrusiveConstPtr<NPage::TTxIdStatsPage> TxIdStats; const TStat Stat; - const size_t Groups; + const size_t GroupsCount; + const size_t HistoricGroupsCount; const size_t IndexesRawSize; const TRowVersion MinRowVersion; const TRowVersion MaxRowVersion; diff --git a/ydb/core/tablet_flat/test/libs/table/test_envs.h b/ydb/core/tablet_flat/test/libs/table/test_envs.h index fa37f700525..b5c64079bce 100644 --- a/ydb/core/tablet_flat/test/libs/table/test_envs.h +++ b/ydb/core/tablet_flat/test/libs/table/test_envs.h @@ -270,7 +270,7 @@ namespace NTest { auto& slots = Parts[part]; if (slots.empty()) { - slots.reserve(partStore->Store->GetRoomCount() + part->HistoricIndexes.size()); + slots.reserve(partStore->Store->GetRoomCount() + part->HistoricGroupsCount); for (ui32 room : xrange(partStore->Store->GetRoomCount())) { if (room < partStore->Store->GetGroupCount()) { NPage::TGroupId groupId(room); @@ -283,7 +283,7 @@ namespace NTest { Y_FAIL("Don't know how to work with room %" PRIu32, room); } } - for (ui32 group : xrange(part->HistoricIndexes.size())) { + for (ui32 group : xrange(part->HistoricGroupsCount)) { NPage::TGroupId groupId(group, true); slots.push_back(Settle(partStore, group, new NFwd::TCache(partStore->GetGroupIndex(groupId)))); } diff --git a/ydb/core/tablet_flat/ut/ut_part.cpp b/ydb/core/tablet_flat/ut/ut_part.cpp index 83d8eb8f43f..7eaac59bf97 100644 --- a/ydb/core/tablet_flat/ut/ut_part.cpp +++ b/ydb/core/tablet_flat/ut/ut_part.cpp @@ -209,7 +209,7 @@ Y_UNIT_TEST_SUITE(TPart) { auto eggs = TPartCook(lay, PageConf(/* groups = */ 3)).Add(foo).Add(bar).Finish(); auto part = eggs.Lone(); - UNIT_ASSERT_VALUES_EQUAL(part->Groups, 3u); + UNIT_ASSERT_VALUES_EQUAL(part->GroupsCount, 3u); TCheckIt wrap(eggs, { }); @@ -507,7 +507,7 @@ Y_UNIT_TEST_SUITE(TPart) { .Finish(); auto part = eggs.Lone(); - UNIT_ASSERT_VALUES_EQUAL(part->Groups, 3u); + UNIT_ASSERT_VALUES_EQUAL(part->GroupsCount, 3u); UNIT_ASSERT_VALUES_EQUAL(part->MinRowVersion, TRowVersion(0, 99)); UNIT_ASSERT_VALUES_EQUAL(part->MaxRowVersion, TRowVersion(5, 50)); @@ -598,7 +598,7 @@ Y_UNIT_TEST_SUITE(TPart) { auto eggs = cook.Finish(); auto part = eggs.Lone(); - UNIT_ASSERT_VALUES_EQUAL(part->Groups, 3u); + UNIT_ASSERT_VALUES_EQUAL(part->GroupsCount, 3u); UNIT_ASSERT_VALUES_EQUAL(part->MinRowVersion, TRowVersion(0, 42)); UNIT_ASSERT_VALUES_EQUAL(part->MaxRowVersion, TRowVersion(2, 1000)); |