Skip to content

Commit f54668a

Browse files
authored
Simply request all pages in Scan from Shared Cache (#12055)
1 parent 0cbe1e0 commit f54668a

File tree

3 files changed

+2
-75
lines changed

3 files changed

+2
-75
lines changed

ydb/core/tablet_flat/flat_executor.cpp

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2670,58 +2670,6 @@ void TExecutor::Handle(TEvents::TEvFlushLog::TPtr &ev) {
26702670
CompactionLogic->UpdateLogUsage(LogicRedo->GrabLogUsage());
26712671
}
26722672

2673-
void TExecutor::Handle(NSharedCache::TEvRequest::TPtr &ev) {
2674-
const auto priority = ev->Get()->Priority;
2675-
TAutoPtr<NPageCollection::TFetch> msg = ev->Get()->Fetch;
2676-
2677-
Y_ABORT_UNLESS(msg->Pages, "empty page collection request, do not do it");
2678-
2679-
const TLogoBlobID &metaId = msg->PageCollection->Label();
2680-
TPrivatePageCache::TInfo *collectionInfo = PrivatePageCache->Info(metaId);
2681-
if (!collectionInfo) {
2682-
auto *reply = new NSharedCache::TEvResult(std::move(msg->PageCollection), msg->Cookie, NKikimrProto::RACE);
2683-
Send(ev->Sender, reply, 0, ev->Cookie);
2684-
return;
2685-
}
2686-
2687-
TVector<NSharedCache::TEvResult::TLoaded> cached;
2688-
TVector<NTable::TPageId> left;
2689-
2690-
for (auto &x : msg->Pages) {
2691-
if (TSharedPageRef body = PrivatePageCache->LookupShared(x, collectionInfo)) {
2692-
cached.emplace_back(x, body);
2693-
} else {
2694-
left.push_back(x);
2695-
}
2696-
}
2697-
2698-
if (cached) {
2699-
if (auto logl = Logger->Log(ELnLev::Debug)) {
2700-
logl
2701-
<< NFmt::Do(*this) << " cache hit for data request from: "
2702-
<< ev->Sender << ", pageCollection " << msg->PageCollection->Label();
2703-
}
2704-
2705-
auto *reply = new NSharedCache::TEvResult(msg->PageCollection, msg->Cookie, NKikimrProto::OK);
2706-
reply->Loaded.swap(cached);
2707-
Send(ev->Sender, reply, 0, ev->Cookie);
2708-
}
2709-
2710-
if (left) {
2711-
DoSwap(msg->Pages, left);
2712-
2713-
if (auto logl = Logger->Log(ELnLev::Debug)) {
2714-
logl
2715-
<< NFmt::Do(*this) << " cache miss for data request from: "
2716-
<< ev->Sender << ", pageCollection " << msg->PageCollection->Label();
2717-
}
2718-
2719-
auto *req = new NSharedCache::TEvRequest(priority, msg, SelfId());
2720-
2721-
TActorIdentity(ev->Sender).Send(MakeSharedPageCacheId(), req, 0, ev->Cookie);
2722-
}
2723-
}
2724-
27252673
void TExecutor::Handle(NSharedCache::TEvResult::TPtr &ev) {
27262674
const bool failed = (ev->Get()->Status != NKikimrProto::OK);
27272675

@@ -3950,7 +3898,6 @@ STFUNC(TExecutor::StateWork) {
39503898
HFunc(TEvPrivate::TEvLeaseExtend, Handle);
39513899
HFunc(TEvents::TEvWakeup, Wakeup);
39523900
hFunc(TEvents::TEvFlushLog, Handle);
3953-
hFunc(NSharedCache::TEvRequest, Handle);
39543901
hFunc(NSharedCache::TEvResult, Handle);
39553902
hFunc(NSharedCache::TEvUpdated, Handle);
39563903
HFunc(TEvTablet::TEvDropLease, Handle);

ydb/core/tablet_flat/flat_executor.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,6 @@ class TExecutor
558558
void Handle(TEvents::TEvFlushLog::TPtr &ev);
559559
void Handle(TEvBlobStorage::TEvCollectGarbageResult::TPtr&);
560560
void Handle(NSharedCache::TEvResult::TPtr &ev);
561-
void Handle(NSharedCache::TEvRequest::TPtr &ev);
562561
void Handle(NSharedCache::TEvUpdated::TPtr &ev);
563562
void Handle(NResourceBroker::TEvResourceBroker::TEvResourceAllocated::TPtr&);
564563
void Handle(NOps::TEvScanStat::TPtr &ev, const TActorContext &ctx);

ydb/core/tablet_flat/flat_scan_actor.h

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -484,13 +484,7 @@ namespace NOps {
484484
if (auto logl = Logger->Log(ELnLev::Debug))
485485
logl << NFmt::Do(*this) << " " << NFmt::Do(*req);
486486

487-
const auto label = req->PageCollection->Label();
488-
if (PrivateCollections.contains(label)) {
489-
Send(MakeSharedPageCacheId(), new NSharedCache::TEvRequest(Args.ReadPrio, req, SelfId()));
490-
ForwardedSharedRequests = true;
491-
} else {
492-
SendToOwner(new NSharedCache::TEvRequest(Args.ReadPrio, req, Owner), true);
493-
}
487+
Send(MakeSharedPageCacheId(), new NSharedCache::TEvRequest(Args.ReadPrio, req, SelfId()));
494488
}
495489

496490
if (ready == NTable::EReady::Page)
@@ -574,7 +568,6 @@ namespace NOps {
574568
MakeSharedPageCacheId(),
575569
new NSharedCache::TEvRequest(Args.ReadPrio, std::move(msg->Request), SelfId()),
576570
ev->Flags, ev->Cookie);
577-
ForwardedSharedRequests = true;
578571
}
579572

580573
void Handle(NBlockIO::TEvStat::TPtr& ev) noexcept
@@ -596,13 +589,6 @@ namespace NOps {
596589
auto* partStore = partView.As<TPartStore>();
597590
Y_ABORT_UNLESS(partStore);
598591

599-
for (auto& cache : partStore->PageCollections) {
600-
PrivateCollections.insert(cache->Id);
601-
}
602-
if (auto& cache = partStore->Pseudo) {
603-
PrivateCollections.insert(cache->Id);
604-
}
605-
606592
Cache->AddCold(partView);
607593

608594
if (MayProgress()) {
@@ -699,10 +685,7 @@ namespace NOps {
699685
Send(pr.second, new TEvents::TEvPoison);
700686
}
701687

702-
if (ForwardedSharedRequests) {
703-
Send(MakeSharedPageCacheId(), new NSharedCache::TEvUnregister);
704-
}
705-
688+
Send(MakeSharedPageCacheId(), new NSharedCache::TEvUnregister);
706689
PassAway();
707690
}
708691

@@ -738,13 +721,11 @@ namespace NOps {
738721

739722
THashMap<TLogoBlobID, TActorId> ColdPartLoaders;
740723
THashMap<TLogoBlobID, TPartView> ColdPartLoaded;
741-
THashSet<TLogoBlobID> PrivateCollections;
742724

743725
TLoadBlobQueue BlobQueue;
744726
TDeque<TBlobQueueRequest> BlobQueueRequests;
745727
ui64 BlobQueueRequestsOffset = 0;
746728

747-
bool ForwardedSharedRequests = false;
748729
bool ContinueInFly = false;
749730

750731
const NHPTimer::STime MaxCyclesPerIteration;

0 commit comments

Comments
 (0)