Skip to content

Commit 0cbe1e0

Browse files
authored
Remove passing part pages on part switch (#11952)
1 parent 8a37438 commit 0cbe1e0

8 files changed

+16
-68
lines changed

ydb/core/tablet_flat/flat_executor.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2362,7 +2362,7 @@ void TExecutor::CommitTransactionLog(TAutoPtr<TSeat> seat, TPageCollectionTxEnv
23622362
auto *bySwitchAux = aux.AddBySwitchAux();
23632363

23642364
TPageCollectionProtoHelper::Snap(snap, loaned->PartComponents, partSwitch.TableId, CompactionLogic->BorrowedPartLevel());
2365-
TPageCollectionProtoHelper(true, false).Do(bySwitchAux->AddHotBundles(), loaned->PartComponents);
2365+
TPageCollectionProtoHelper(true).Do(bySwitchAux->AddHotBundles(), loaned->PartComponents);
23662366

23672367
auto body = proto.SerializeAsString();
23682368
auto glob = CommitManager->Turns.One(commit->Refs, std::move(body), true);
@@ -3474,7 +3474,7 @@ void TExecutor::Handle(NOps::TEvResult *ops, TProdCompact *msg, bool cancelled)
34743474
const auto &newPart = result.Part;
34753475

34763476
TPageCollectionProtoHelper::Snap(snap, newPart, tableId, logicResult.Changes.NewPartsLevel);
3477-
TPageCollectionProtoHelper(true, false).Do(bySwitchAux->AddHotBundles(), newPart);
3477+
TPageCollectionProtoHelper(true).Do(bySwitchAux->AddHotBundles(), newPart);
34783478
}
34793479
}
34803480

@@ -3772,14 +3772,14 @@ TString TExecutor::BorrowSnapshot(ui32 table, const TTableSnapshotContext &snap,
37723772
for (const auto &partView : subset->Flatten) {
37733773
auto *x = proto.AddParts();
37743774

3775-
TPageCollectionProtoHelper(false, false).Do(x->MutableBundle(), partView);
3775+
TPageCollectionProtoHelper(false).Do(x->MutableBundle(), partView);
37763776
snap.Impl->Borrowed(Step(), table, partView->Label, loaner);
37773777
}
37783778

37793779
for (const auto &part : subset->ColdParts) {
37803780
auto *x = proto.AddParts();
37813781

3782-
TPageCollectionProtoHelper(false, false).Do(x->MutableBundle(), part);
3782+
TPageCollectionProtoHelper(false).Do(x->MutableBundle(), part);
37833783
snap.Impl->Borrowed(Step(), table, part->Label, loaner);
37843784
}
37853785

ydb/core/tablet_flat/flat_executor.proto

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@ message TLargeGlobId {
1515
}
1616

1717
message TPageCollection {
18-
message TPage {
19-
required uint32 Id = 1;
20-
required bytes Body = 2;
21-
}
22-
2318
repeated NKikimrProto.TLogoBlobID MetaId = 1; // Replaced by TLargeGlobId
2419

2520
optional TLargeGlobId LargeGlobId = 6;
@@ -30,7 +25,7 @@ message TPageCollection {
3025
// packed page collection is called HotBundle.
3126

3227
optional bytes Meta = 2;
33-
repeated TPage Pages = 5;
28+
reserved 5; // Pages
3429
}
3530

3631
message TBundle {

ydb/core/tablet_flat/flat_part_loader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ namespace NTable {
8989
if (type != EPage::FlatIndex) {
9090
// hack: saving flat index to private cache will break sticky logic
9191
// keep it in shared cache only for now
92-
Cache->Fill(std::move(loaded), NeedIn(type));
92+
Cache->Fill(loaded.PageId, std::move(loaded.Page), NeedIn(type));
9393
}
9494
}
9595
}

ydb/core/tablet_flat/flat_part_outset.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
#include "defs.h"
44
#include "flat_sausage_packet.h"
5-
#include "flat_sausage_fetch.h"
65

76
namespace NKikimr {
87
namespace NTable {
@@ -12,7 +11,6 @@ namespace NTable {
1211
NPageCollection::TLargeGlobId LargeGlobId;
1312
// loaded meta page
1413
TIntrusiveConstPtr<NPageCollection::TPageCollection> Packet;
15-
TVector<NPageCollection::TLoadedPage> Sticky;
1614

1715
void ParsePacket(TSharedData meta);
1816
};

ydb/core/tablet_flat/flat_part_store.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,6 @@ class TPartStore : public TPart, public IBundle {
154154

155155
for (auto &one: components) {
156156
caches.emplace_back(new TCache(std::move(one.Packet)));
157-
158-
for (auto &page: one.Sticky)
159-
caches.back()->Fill(page, true);
160157
}
161158

162159
return caches;

ydb/core/tablet_flat/flat_sausagecache.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,6 @@ class TPrivatePageCache {
130130
return page;
131131
}
132132

133-
void Fill(const NPageCollection::TLoadedPage &paged, bool sticky = false) noexcept {
134-
EnsurePage(paged.PageId)->Fill(paged.Data, sticky);
135-
}
136-
137-
void Fill(NSharedCache::TEvResult::TLoaded&& loaded, bool sticky = false) noexcept {
138-
EnsurePage(loaded.PageId)->Fill(std::move(loaded.Page), sticky);
139-
}
140-
141133
void Fill(ui32 pageId, TSharedPageRef page, bool sticky) noexcept {
142134
EnsurePage(pageId)->Fill(std::move(page), sticky);
143135
}

ydb/core/tablet_flat/flat_store_hotdog.cpp

Lines changed: 8 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include "flat_store_hotdog.h"
22
#include "flat_store_solid.h"
33
#include "flat_part_store.h"
4-
#include "flat_part_loader.h"
54
#include "flat_part_overlay.h"
65

76
#include <ydb/core/base/tablet.h>
@@ -17,31 +16,31 @@ void TPageCollectionProtoHelper::Snap(NKikimrExecutorFlat::TLogTableSnap *snap,
1716
snap->SetTable(table);
1817
snap->SetCompactionLevel(level);
1918

20-
TPageCollectionProtoHelper(false, false).Do(snap->AddBundles(), partView);
19+
TPageCollectionProtoHelper(false).Do(snap->AddBundles(), partView);
2120
}
2221

2322
void TPageCollectionProtoHelper::Snap(NKikimrExecutorFlat::TLogTableSnap *snap, const TIntrusiveConstPtr<TColdPart> &part, ui32 table, ui32 level)
2423
{
2524
snap->SetTable(table);
2625
snap->SetCompactionLevel(level);
2726

28-
TPageCollectionProtoHelper(false, false).Do(snap->AddBundles(), part);
27+
TPageCollectionProtoHelper(false).Do(snap->AddBundles(), part);
2928
}
3029

3130
void TPageCollectionProtoHelper::Snap(NKikimrExecutorFlat::TLogTableSnap *snap, const TPartComponents &pc, ui32 table, ui32 level)
3231
{
3332
snap->SetTable(table);
3433
snap->SetCompactionLevel(level);
3534

36-
TPageCollectionProtoHelper(false, false).Do(snap->AddBundles(), pc);
35+
TPageCollectionProtoHelper(false).Do(snap->AddBundles(), pc);
3736
}
3837

3938
void TPageCollectionProtoHelper::Do(TBundle *bundle, const TPartComponents &pc)
4039
{
4140
bundle->MutablePageCollections()->Reserve(pc.PageCollectionComponents.size());
4241

4342
for (auto &one : pc.PageCollectionComponents)
44-
Bundle(bundle->AddPageCollections(), one.LargeGlobId, one.Packet.Get(), one.Sticky);
43+
Bundle(bundle->AddPageCollections(), one.LargeGlobId, one.Packet.Get());
4544

4645
if (auto &legacy = pc.Legacy)
4746
bundle->SetLegacy(legacy);
@@ -89,7 +88,7 @@ void TPageCollectionProtoHelper::Do(TBundle *bundle, const TIntrusiveConstPtr<NT
8988
bundle->MutablePageCollections()->Reserve(partStore->LargeGlobIds.size());
9089

9190
for (const auto &largeGlobId : partStore->LargeGlobIds) {
92-
Bundle(bundle->AddPageCollections(), largeGlobId, nullptr, { });
91+
Bundle(bundle->AddPageCollections(), largeGlobId, nullptr);
9392
}
9493

9594
if (partStore->Legacy) {
@@ -105,44 +104,21 @@ void TPageCollectionProtoHelper::Do(TBundle *bundle, const TIntrusiveConstPtr<NT
105104

106105
void TPageCollectionProtoHelper::Bundle(NKikimrExecutorFlat::TPageCollection *pageCollectionProto, const TPrivatePageCache::TInfo &cache)
107106
{
108-
TVector<NPageCollection::TLoadedPage> pages;
109-
110107
auto *pack = CheckedCast<const NPageCollection::TPageCollection*>(cache.PageCollection.Get());
111108

112-
if (PutPages) {
113-
for (ui32 pageId : xrange(pack->Meta.TotalPages())) {
114-
auto type = NTable::EPage(pack->Meta.GetPageType(pageId));
115-
116-
if (!NTable::TLoader::NeedIn(type)) {
117-
118-
} else if (auto* body = cache.Lookup(pageId)) {
119-
pages.emplace_back(pageId, *body);
120-
} else {
121-
Y_ABORT("index and page collection pages must be kept inmemory");
122-
}
123-
}
124-
}
125-
126-
return Bundle(pageCollectionProto, pack->LargeGlobId, pack, pages);
109+
return Bundle(pageCollectionProto, pack->LargeGlobId, pack);
127110
}
128111

129112

130113
void TPageCollectionProtoHelper::Bundle(
131114
NKikimrExecutorFlat::TPageCollection *pageCollectionProto,
132115
const TLargeGlobId &largeGlobId,
133-
const NPageCollection::TPageCollection *pack,
134-
TPages pages)
116+
const NPageCollection::TPageCollection *pack)
135117
{
136118
TLargeGlobIdProto::Put(*pageCollectionProto->MutableLargeGlobId(), largeGlobId);
137119

138-
if (PutMeta && pack)
120+
if (PutMeta && pack) {
139121
pageCollectionProto->SetMeta(pack->Meta.Raw.ToString());
140-
141-
for (auto &paged: pages) {
142-
auto *page = pageCollectionProto->AddPages();
143-
144-
page->SetId(paged.PageId);
145-
page->SetBody(paged.Data.ToString());
146122
}
147123
}
148124

@@ -154,14 +130,8 @@ NTable::TPartComponents TPageCollectionProtoHelper::MakePageCollectionComponents
154130
for (auto &pageCollection: proto.GetPageCollections()) {
155131
Y_ABORT_UNLESS(pageCollection.HasLargeGlobId(), "Got page collection without TLargeGlobId");
156132

157-
TVector<NPageCollection::TLoadedPage> pages;
158-
159-
for (auto &page: pageCollection.GetPages())
160-
pages.emplace_back(page.GetId(), TSharedData::Copy(page.GetBody()));
161-
162133
auto& item = components.emplace_back();
163134
item.LargeGlobId = TLargeGlobIdProto::Get(pageCollection.GetLargeGlobId());
164-
item.Sticky = std::move(pages);
165135
if (pageCollection.HasMeta()) {
166136
item.ParsePacket(TSharedData::Copy(pageCollection.GetMeta()));
167137
}

ydb/core/tablet_flat/flat_store_hotdog.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,13 @@ namespace NTabletFlatExecutor {
2323
using TColdPart = NTable::TColdPart;
2424
using TPartComponents = NTable::TPartComponents;
2525
using TBundle = NKikimrExecutorFlat::TBundle;
26-
using TPages = TArrayRef<const NPageCollection::TLoadedPage>;
2726
using TScreen = NTable::TScreen;
2827
using TSlices = NTable::TSlices;
2928

3029
TPageCollectionProtoHelper() = delete;
3130

32-
TPageCollectionProtoHelper(bool meta, bool pages)
31+
TPageCollectionProtoHelper(bool meta)
3332
: PutMeta(meta)
34-
, PutPages(pages)
3533
{
3634

3735
}
@@ -51,12 +49,10 @@ namespace NTabletFlatExecutor {
5149
void Bundle(
5250
NKikimrExecutorFlat::TPageCollection *pageCollectionProto,
5351
const TLargeGlobId &largeGlobId,
54-
const NPageCollection::TPageCollection *pack,
55-
TPages pages);
52+
const NPageCollection::TPageCollection *pack);
5653

5754
private:
5855
const bool PutMeta = false; /* Save page collection metablob in bundle */
59-
const bool PutPages = false; /* Save special pages within bundle */
6056
};
6157
}
6258
}

0 commit comments

Comments
 (0)