aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkungurtsev <kungasc@ydb.tech>2024-11-27 16:58:49 +0100
committerGitHub <noreply@github.com>2024-11-27 16:58:49 +0100
commitf54668a9abbbd44118bfa5e792f3da0e8337f351 (patch)
tree6d8ef8fe0f48ce23afc766d3cb9eebac474beb2c
parent0cbe1e098e7ac0063571ce8e3bc9a8fbd4ed170d (diff)
downloadydb-f54668a9abbbd44118bfa5e792f3da0e8337f351.tar.gz
Simply request all pages in Scan from Shared Cache (#12055)
-rw-r--r--ydb/core/tablet_flat/flat_executor.cpp53
-rw-r--r--ydb/core/tablet_flat/flat_executor.h1
-rw-r--r--ydb/core/tablet_flat/flat_scan_actor.h23
3 files changed, 2 insertions, 75 deletions
diff --git a/ydb/core/tablet_flat/flat_executor.cpp b/ydb/core/tablet_flat/flat_executor.cpp
index 45137ce01f..c783797470 100644
--- a/ydb/core/tablet_flat/flat_executor.cpp
+++ b/ydb/core/tablet_flat/flat_executor.cpp
@@ -2670,58 +2670,6 @@ void TExecutor::Handle(TEvents::TEvFlushLog::TPtr &ev) {
CompactionLogic->UpdateLogUsage(LogicRedo->GrabLogUsage());
}
-void TExecutor::Handle(NSharedCache::TEvRequest::TPtr &ev) {
- const auto priority = ev->Get()->Priority;
- TAutoPtr<NPageCollection::TFetch> msg = ev->Get()->Fetch;
-
- Y_ABORT_UNLESS(msg->Pages, "empty page collection request, do not do it");
-
- const TLogoBlobID &metaId = msg->PageCollection->Label();
- TPrivatePageCache::TInfo *collectionInfo = PrivatePageCache->Info(metaId);
- if (!collectionInfo) {
- auto *reply = new NSharedCache::TEvResult(std::move(msg->PageCollection), msg->Cookie, NKikimrProto::RACE);
- Send(ev->Sender, reply, 0, ev->Cookie);
- return;
- }
-
- TVector<NSharedCache::TEvResult::TLoaded> cached;
- TVector<NTable::TPageId> left;
-
- for (auto &x : msg->Pages) {
- if (TSharedPageRef body = PrivatePageCache->LookupShared(x, collectionInfo)) {
- cached.emplace_back(x, body);
- } else {
- left.push_back(x);
- }
- }
-
- if (cached) {
- if (auto logl = Logger->Log(ELnLev::Debug)) {
- logl
- << NFmt::Do(*this) << " cache hit for data request from: "
- << ev->Sender << ", pageCollection " << msg->PageCollection->Label();
- }
-
- auto *reply = new NSharedCache::TEvResult(msg->PageCollection, msg->Cookie, NKikimrProto::OK);
- reply->Loaded.swap(cached);
- Send(ev->Sender, reply, 0, ev->Cookie);
- }
-
- if (left) {
- DoSwap(msg->Pages, left);
-
- if (auto logl = Logger->Log(ELnLev::Debug)) {
- logl
- << NFmt::Do(*this) << " cache miss for data request from: "
- << ev->Sender << ", pageCollection " << msg->PageCollection->Label();
- }
-
- auto *req = new NSharedCache::TEvRequest(priority, msg, SelfId());
-
- TActorIdentity(ev->Sender).Send(MakeSharedPageCacheId(), req, 0, ev->Cookie);
- }
-}
-
void TExecutor::Handle(NSharedCache::TEvResult::TPtr &ev) {
const bool failed = (ev->Get()->Status != NKikimrProto::OK);
@@ -3950,7 +3898,6 @@ STFUNC(TExecutor::StateWork) {
HFunc(TEvPrivate::TEvLeaseExtend, Handle);
HFunc(TEvents::TEvWakeup, Wakeup);
hFunc(TEvents::TEvFlushLog, Handle);
- hFunc(NSharedCache::TEvRequest, Handle);
hFunc(NSharedCache::TEvResult, Handle);
hFunc(NSharedCache::TEvUpdated, Handle);
HFunc(TEvTablet::TEvDropLease, Handle);
diff --git a/ydb/core/tablet_flat/flat_executor.h b/ydb/core/tablet_flat/flat_executor.h
index 5369017fe3..728176f24e 100644
--- a/ydb/core/tablet_flat/flat_executor.h
+++ b/ydb/core/tablet_flat/flat_executor.h
@@ -558,7 +558,6 @@ class TExecutor
void Handle(TEvents::TEvFlushLog::TPtr &ev);
void Handle(TEvBlobStorage::TEvCollectGarbageResult::TPtr&);
void Handle(NSharedCache::TEvResult::TPtr &ev);
- void Handle(NSharedCache::TEvRequest::TPtr &ev);
void Handle(NSharedCache::TEvUpdated::TPtr &ev);
void Handle(NResourceBroker::TEvResourceBroker::TEvResourceAllocated::TPtr&);
void Handle(NOps::TEvScanStat::TPtr &ev, const TActorContext &ctx);
diff --git a/ydb/core/tablet_flat/flat_scan_actor.h b/ydb/core/tablet_flat/flat_scan_actor.h
index 380bf817ec..5aab5da29f 100644
--- a/ydb/core/tablet_flat/flat_scan_actor.h
+++ b/ydb/core/tablet_flat/flat_scan_actor.h
@@ -484,13 +484,7 @@ namespace NOps {
if (auto logl = Logger->Log(ELnLev::Debug))
logl << NFmt::Do(*this) << " " << NFmt::Do(*req);
- const auto label = req->PageCollection->Label();
- if (PrivateCollections.contains(label)) {
- Send(MakeSharedPageCacheId(), new NSharedCache::TEvRequest(Args.ReadPrio, req, SelfId()));
- ForwardedSharedRequests = true;
- } else {
- SendToOwner(new NSharedCache::TEvRequest(Args.ReadPrio, req, Owner), true);
- }
+ Send(MakeSharedPageCacheId(), new NSharedCache::TEvRequest(Args.ReadPrio, req, SelfId()));
}
if (ready == NTable::EReady::Page)
@@ -574,7 +568,6 @@ namespace NOps {
MakeSharedPageCacheId(),
new NSharedCache::TEvRequest(Args.ReadPrio, std::move(msg->Request), SelfId()),
ev->Flags, ev->Cookie);
- ForwardedSharedRequests = true;
}
void Handle(NBlockIO::TEvStat::TPtr& ev) noexcept
@@ -596,13 +589,6 @@ namespace NOps {
auto* partStore = partView.As<TPartStore>();
Y_ABORT_UNLESS(partStore);
- for (auto& cache : partStore->PageCollections) {
- PrivateCollections.insert(cache->Id);
- }
- if (auto& cache = partStore->Pseudo) {
- PrivateCollections.insert(cache->Id);
- }
-
Cache->AddCold(partView);
if (MayProgress()) {
@@ -699,10 +685,7 @@ namespace NOps {
Send(pr.second, new TEvents::TEvPoison);
}
- if (ForwardedSharedRequests) {
- Send(MakeSharedPageCacheId(), new NSharedCache::TEvUnregister);
- }
-
+ Send(MakeSharedPageCacheId(), new NSharedCache::TEvUnregister);
PassAway();
}
@@ -738,13 +721,11 @@ namespace NOps {
THashMap<TLogoBlobID, TActorId> ColdPartLoaders;
THashMap<TLogoBlobID, TPartView> ColdPartLoaded;
- THashSet<TLogoBlobID> PrivateCollections;
TLoadBlobQueue BlobQueue;
TDeque<TBlobQueueRequest> BlobQueueRequests;
ui64 BlobQueueRequestsOffset = 0;
- bool ForwardedSharedRequests = false;
bool ContinueInFly = false;
const NHPTimer::STime MaxCyclesPerIteration;