7
7
#include < ydb/core/tx/columnshard/blobs_action/abstract/storages_manager.h>
8
8
#include < ydb/core/tx/columnshard/common/blob.h>
9
9
#include < ydb/core/tx/columnshard/common/path_id.h>
10
+ #include < ydb/core/tx/columnshard/common/thread_safe_optional.h>
10
11
#include < ydb/core/tx/columnshard/engines/scheme/versions/abstract_scheme.h>
11
12
12
13
#include < ydb/library/accessor/accessor.h>
13
14
#include < ydb/library/formats/arrow/replace_key.h>
14
15
15
16
#include < util/generic/hash_set.h>
16
17
18
+
17
19
namespace NKikimrColumnShardDataSharingProto {
18
20
class TPortionInfo ;
19
21
}
@@ -89,7 +91,7 @@ class TPortionInfo {
89
91
90
92
TInternalPathId PathId;
91
93
ui64 PortionId = 0 ; // Id of independent (overlayed by PK) portion of data in pathId
92
- TSnapshot RemoveSnapshot = TSnapshot::Zero() ;
94
+ TThreadSafeOptional< TSnapshot> RemoveSnapshot;
93
95
ui64 SchemaVersion = 0 ;
94
96
std::optional<ui64> ShardingVersion;
95
97
@@ -213,8 +215,8 @@ class TPortionInfo {
213
215
}
214
216
215
217
void SetRemoveSnapshot (const TSnapshot& snap) {
216
- AFL_VERIFY (!RemoveSnapshot. Valid ());
217
- RemoveSnapshot = snap;
218
+ AFL_VERIFY (!HasRemoveSnapshot ());
219
+ RemoveSnapshot. Set ( snap) ;
218
220
}
219
221
220
222
void SetRemoveSnapshot (const ui64 planStep, const ui64 txId) {
@@ -339,7 +341,7 @@ class TPortionInfo {
339
341
TString DebugString (const bool withDetails = false ) const ;
340
342
341
343
bool HasRemoveSnapshot () const {
342
- return RemoveSnapshot.Valid ();
344
+ return RemoveSnapshot.Has ();
343
345
}
344
346
345
347
bool IsRemovedFor (const TSnapshot& snapshot) const {
@@ -376,12 +378,12 @@ class TPortionInfo {
376
378
377
379
const TSnapshot& GetRemoveSnapshotVerified () const {
378
380
AFL_VERIFY (HasRemoveSnapshot ());
379
- return RemoveSnapshot;
381
+ return RemoveSnapshot. Get () ;
380
382
}
381
383
382
384
std::optional<TSnapshot> GetRemoveSnapshotOptional () const {
383
- if (RemoveSnapshot. Valid ()) {
384
- return RemoveSnapshot;
385
+ if (HasRemoveSnapshot ()) {
386
+ return RemoveSnapshot. Get () ;
385
387
} else {
386
388
return {};
387
389
}
@@ -393,7 +395,7 @@ class TPortionInfo {
393
395
}
394
396
395
397
bool IsVisible (const TSnapshot& snapshot, const bool checkCommitSnapshot = true ) const {
396
- const bool visible = (!RemoveSnapshot. Valid () || snapshot < RemoveSnapshot ) && DoIsVisible (snapshot, checkCommitSnapshot);
398
+ const bool visible = (!HasRemoveSnapshot () || snapshot < GetRemoveSnapshotVerified () ) && DoIsVisible (snapshot, checkCommitSnapshot);
397
399
398
400
AFL_TRACE (NKikimrServices::TX_COLUMNSHARD)(" event" , " IsVisible" )(" analyze_portion" , DebugString ())(" visible" , visible)(
399
401
" snapshot" , snapshot.DebugString ());
0 commit comments