@@ -29,7 +29,13 @@ namespace NTabletFlatExecutor {
2929 {
3030 auto *partStore = CheckedCast<const NTable::TPartStore*>(part);
3131
32- return { true , Lookup (partStore->Locate (lob, ref), ref) };
32+ const TSharedData* page = Lookup (partStore->Locate (lob, ref), ref);
33+
34+ if (!page && ReadMissingReferences) {
35+ MissingReferencesSize_ += Max<ui64>(1 , part->GetPageSize (lob, ref));
36+ }
37+
38+ return { !ReadMissingReferences, page };
3339 }
3440
3541 const TSharedData* TryGetPage (const TPart* part, TPageId page, TGroupId groupId) override
@@ -39,6 +45,20 @@ namespace NTabletFlatExecutor {
3945 return Lookup (partStore->PageCollections .at (groupId.Index ).Get (), page);
4046 }
4147
48+ void EnableReadMissingReferences () noexcept {
49+ ReadMissingReferences = true ;
50+ }
51+
52+ void DisableReadMissingReferences () noexcept {
53+ ReadMissingReferences = false ;
54+ MissingReferencesSize_ = 0 ;
55+ }
56+
57+ ui64 MissingReferencesSize () const noexcept
58+ {
59+ return MissingReferencesSize_;
60+ }
61+
4262 private:
4363 const TSharedData* Lookup (TPrivatePageCache::TInfo *info, TPageId pageId) noexcept
4464 {
@@ -47,6 +67,11 @@ namespace NTabletFlatExecutor {
4767
4868 public:
4969 TPrivatePageCache& Cache;
70+
71+ private:
72+ bool ReadMissingReferences = false ;
73+
74+ ui64 MissingReferencesSize_ = 0 ;
5075 };
5176
5277 struct TPageCollectionTxEnv : public TPageCollectionReadEnv , public IExecuting {
@@ -187,6 +212,20 @@ namespace NTabletFlatExecutor {
187212 LoanConfirmation.insert (std::make_pair (bundle, TLoanConfirmation{borrow}));
188213 }
189214
215+ void EnableReadMissingReferences () noexcept override
216+ {
217+ TPageCollectionReadEnv::EnableReadMissingReferences ();
218+ }
219+
220+ void DisableReadMissingReferences () noexcept override
221+ {
222+ TPageCollectionReadEnv::DisableReadMissingReferences ();
223+ }
224+
225+ ui64 MissingReferencesSize () const noexcept override
226+ {
227+ return TPageCollectionReadEnv::MissingReferencesSize ();
228+ }
190229 protected:
191230 NTable::TDatabase& DB;
192231
0 commit comments