Skip to content

Commit 8317b4f

Browse files
committed
always request all pages
1 parent 179f128 commit 8317b4f

File tree

3 files changed

+20
-64
lines changed

3 files changed

+20
-64
lines changed

ydb/core/tablet_flat/flat_executor.cpp

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -659,8 +659,6 @@ void TExecutor::ActivateWaitingTransactions(const TVector<TIntrusivePtr<NPageCol
659659
} else {
660660
EnqueueActivation(seat, activate);
661661
}
662-
} else {
663-
Y_Fail("Unexpected wait pad triggered");
664662
}
665663
}
666664
if (cancelled && activate) {
@@ -2033,7 +2031,6 @@ void TExecutor::PostponeTransaction(TSeat* seat, TPageCollectionTxEnv &env,
20332031

20342032
ui32 touchedPages = 0;
20352033
ui32 newPinnedPages = 0;
2036-
ui32 loadPages = 0;
20372034
ui64 prevTouched = seat->MemoryTouched;
20382035

20392036
PrivatePageCache->PinTouches(seat->Pinned, touchedPages, newPinnedPages, seat->MemoryTouched);
@@ -2044,6 +2041,7 @@ void TExecutor::PostponeTransaction(TSeat* seat, TPageCollectionTxEnv &env,
20442041
prevTouched = seat->MemoryTouched;
20452042

20462043
PrivatePageCache->PinToLoad(seat->Pinned, newPinnedPages, seat->MemoryTouched);
2044+
ui64 loadBytes = seat->MemoryTouched - prevTouched;
20472045
TransactionPagesMemory += seat->MemoryTouched - prevTouched;
20482046

20492047
if (seat->AttachedMemory)
@@ -2122,42 +2120,34 @@ void TExecutor::PostponeTransaction(TSeat* seat, TPageCollectionTxEnv &env,
21222120
auto waitPad = MakeIntrusive<TTransactionWaitPad>(seat);
21232121
TransactionWaitPads[waitPad.Get()] = waitPad;
21242122

2125-
ui32 waitPages = 0;
2126-
ui64 loadBytes = 0;
2123+
ui32 loadPages = 0;
21272124
auto toLoad = PrivatePageCache->GetToLoad();
2128-
for (auto &xpair : toLoad) {
2129-
TPrivatePageCache::TInfo *pageCollectionInfo = xpair.first;
2130-
TVector<NTable::TPageId> &pages = xpair.second;
2131-
waitPages += pages.size();
2132-
2133-
const std::pair<ui32, ui64> toLoad = PrivatePageCache->Request(pages, pageCollectionInfo);
2134-
if (toLoad.first) {
2135-
if (auto logl = Logger->Log(ELnLev::Dbg03)) {
2136-
logl
2137-
<< NFmt::Do(*this) << " requests PageCollection " << pageCollectionInfo->PageCollection->Label()
2138-
<< " " << toLoad.second << " bytes, " << toLoad.first << " pages: [";
2139-
for (auto i : xrange(pages.size())) {
2140-
if (i != 0) logl << ", ";
2141-
logl << pages[i] << " " << ui32(pageCollectionInfo->GetPageType(pages[i]));
2142-
}
2143-
logl << "]";
2125+
for (auto &[pageCollectionInfo, pages] : toLoad) {
2126+
Y_DEBUG_ABORT_UNLESS(pages);
2127+
loadPages += pages.size();
2128+
2129+
if (auto logl = Logger->Log(ELnLev::Dbg03)) {
2130+
logl
2131+
<< NFmt::Do(*this) << " requests PageCollection " << pageCollectionInfo->PageCollection->Label()
2132+
<< " " << pages.size() << " pages: [";
2133+
for (auto i : xrange(pages.size())) {
2134+
if (i != 0) logl << ", ";
2135+
logl << pages[i] << " " << ui32(pageCollectionInfo->GetPageType(pages[i]));
21442136
}
2137+
logl << "]";
2138+
}
21452139

2146-
auto *req = new NPageCollection::TFetch(0, pageCollectionInfo->PageCollection, std::move(pages));
2147-
req->TraceId = waitPad->GetWaitingTraceId();
2148-
req->WaitPad = waitPad; // TODO: deal with one tx multiple fetches
2140+
auto *req = new NPageCollection::TFetch(0, pageCollectionInfo->PageCollection, std::move(pages));
2141+
req->TraceId = waitPad->GetWaitingTraceId();
2142+
req->WaitPad = waitPad; // TODO: deal with one tx multiple fetches
21492143

2150-
loadPages += toLoad.first;
2151-
loadBytes += toLoad.second;
2152-
RequestFromSharedCache(req, NBlockIO::EPriority::Fast, EPageCollectionRequest::Cache);
2153-
}
2144+
RequestFromSharedCache(req, NBlockIO::EPriority::Fast, EPageCollectionRequest::Cache);
21542145
}
21552146

21562147
if (auto logl = Logger->Log(ELnLev::Debug)) {
21572148
logl
21582149
<< NFmt::Do(*this) << " " << NFmt::Do(*seat) << " postponed"
2159-
<< ", " << loadBytes << "b, pages "
2160-
<< "{" << waitPages << " wait, " << loadPages << " load}"
2150+
<< ", loading " << loadPages << " pages, " << loadBytes << " bytes"
21612151
<< ", freshly touched " << newPinnedPages << " pages";
21622152
}
21632153

ydb/core/tablet_flat/flat_sausagecache.cpp

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -174,37 +174,6 @@ void TPrivatePageCache::Unpin(TPage *page, TPrivatePageCachePinPad *pad) {
174174
}
175175
}
176176

177-
std::pair<ui32, ui64> TPrivatePageCache::Request(TVector<TPageId> &pages, TInfo *info) {
178-
ui32 blocksToRequest = 0;
179-
ui64 bytesToRequest = 0;
180-
181-
auto it = pages.begin();
182-
auto end = pages.end();
183-
184-
while (it != end) {
185-
TPage *page = info->EnsurePage(*it);
186-
switch (page->LoadState) {
187-
case TPage::LoadStateNo:
188-
page->LoadState = TPage::LoadStateRequested;
189-
bytesToRequest += page->Size;
190-
191-
++blocksToRequest;
192-
++it;
193-
break;
194-
case TPage::LoadStateLoaded:
195-
Y_ABORT("must not request already loaded pages");
196-
case TPage::LoadStateRequested:
197-
// TODO: request always
198-
--end;
199-
if (end != it)
200-
*it = *end;
201-
break;
202-
}
203-
}
204-
pages.erase(end, pages.end());
205-
return std::make_pair(blocksToRequest, bytesToRequest);
206-
}
207-
208177
void TPrivatePageCache::TryLoad(TPage *page) {
209178
if (page->LoadState == TPage::LoadStateLoaded) {
210179
return;

ydb/core/tablet_flat/flat_sausagecache.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ class TPrivatePageCache {
3939
enum ELoadState {
4040
LoadStateNo,
4141
LoadStateLoaded,
42-
LoadStateRequested,
4342
};
4443

4544
ui32 LoadState : 2;
@@ -164,8 +163,6 @@ class TPrivatePageCache {
164163

165164
const TStats& GetStats() const { return Stats; }
166165

167-
std::pair<ui32, ui64> Request(TVector<ui32> &pages, TInfo *info); // blocks to load, bytes to load
168-
169166
const TSharedData* Lookup(TPageId pageId, TInfo *collection);
170167

171168
void CountTouches(TPinned &pinned, ui32 &newPages, ui64 &newMemory, ui64 &pinnedMemory);

0 commit comments

Comments
 (0)