Skip to content

Commit 50d5375

Browse files
authored
Require snapshot in internal scans (#14304)
1 parent 0021053 commit 50d5375

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

ydb/core/tx/columnshard/columnshard.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,13 @@ namespace TEvColumnShard {
9898
struct TEvInternalScan: public TEventLocal<TEvInternalScan, EvInternalScan> {
9999
private:
100100
YDB_READONLY(ui64, PathId, 0);
101+
YDB_READONLY(NOlap::TSnapshot, Snapshot, NOlap::TSnapshot::Zero());
101102
YDB_READONLY_DEF(std::optional<ui64>, LockId);
102103
YDB_ACCESSOR(bool, Reverse, false);
103104
YDB_ACCESSOR(ui32, ItemsLimit, 0);
104105
YDB_READONLY_DEF(std::vector<ui32>, ColumnIds);
105106
std::set<ui32> ColumnIdsSet;
106107
public:
107-
std::optional<NOlap::TSnapshot> ReadFromSnapshot;
108-
std::optional<NOlap::TSnapshot> ReadToSnapshot;
109108
TString TaskIdentifier;
110109
std::shared_ptr<NOlap::TPKRangesFilter> RangesFilter;
111110
public:
@@ -114,11 +113,12 @@ namespace TEvColumnShard {
114113
ColumnIds.emplace_back(id);
115114
}
116115

117-
TEvInternalScan(const ui64 pathId, const std::optional<ui64> lockId)
116+
TEvInternalScan(const ui64 pathId, const NOlap::TSnapshot& snapshot, const std::optional<ui64> lockId)
118117
: PathId(pathId)
118+
, Snapshot(snapshot)
119119
, LockId(lockId)
120120
{
121-
121+
AFL_VERIFY(Snapshot.Valid());
122122
}
123123
};
124124

ydb/core/tx/columnshard/engines/reader/transaction/tx_internal_scan.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ void TTxInternalScan::Complete(const TActorContext& ctx) {
3434

3535
auto& request = *InternalScanEvent->Get();
3636
auto scanComputeActor = InternalScanEvent->Sender;
37-
const TSnapshot snapshot = request.ReadToSnapshot.value_or(NOlap::TSnapshot(Self->LastPlannedStep, Self->LastPlannedTxId));
37+
const TSnapshot snapshot = request.GetSnapshot();
3838
const NActors::TLogContextGuard gLogging =
3939
NActors::TLogContextBuilder::Build()("tablet", Self->TabletID())("snapshot", snapshot.DebugString())("task_id", request.TaskIdentifier);
4040
TReadMetadataPtr readMetadataRange;

ydb/core/tx/columnshard/operations/batch_builder/restore.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
namespace NKikimr::NOlap {
99

1010
std::unique_ptr<TEvColumnShard::TEvInternalScan> TModificationRestoreTask::DoBuildRequestInitiator() const {
11-
auto request = std::make_unique<TEvColumnShard::TEvInternalScan>(LocalPathId, WriteData.GetWriteMeta().GetLockIdOptional());
11+
auto request = std::make_unique<TEvColumnShard::TEvInternalScan>(LocalPathId, Snapshot, WriteData.GetWriteMeta().GetLockIdOptional());
1212
request->TaskIdentifier = GetTaskId();
13-
request->ReadToSnapshot = Snapshot;
1413
AFL_DEBUG(NKikimrServices::TX_COLUMNSHARD_RESTORE)("event", "restore_start")("count", IncomingData.HasContainer() ? IncomingData->num_rows() : 0)(
1514
"task_id", WriteData.GetWriteMeta().GetId());
1615
auto pkData = NArrow::TColumnOperator().VerifyIfAbsent().Extract(IncomingData.GetContainer(), Context.GetActualSchema()->GetPKColumnNames());
@@ -70,6 +69,7 @@ TModificationRestoreTask::TModificationRestoreTask(NEvWrite::TWriteData&& writeD
7069
, Snapshot(actualSnapshot)
7170
, IncomingData(incomingData)
7271
, Context(context) {
72+
AFL_VERIFY(actualSnapshot.Valid());
7373
}
7474

7575
void TModificationRestoreTask::SendErrorMessage(

0 commit comments

Comments
 (0)