Skip to content

Commit 56b8a54

Browse files
speed up scan pk-growing checker (#13866)
1 parent a7151c4 commit 56b8a54

File tree

1 file changed

+13
-11
lines changed
  • ydb/core/tx/columnshard/engines/reader/actor

1 file changed

+13
-11
lines changed

ydb/core/tx/columnshard/engines/reader/actor/actor.cpp

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ TColumnShardScan::TColumnShardScan(const TActorId& columnShardActorId, const TAc
7373
}
7474

7575
void TColumnShardScan::Bootstrap(const TActorContext& ctx) {
76-
// TLogContextGuard gLogging(NActors::TLogContextBuilder::Build(NKikimrServices::TX_COLUMNSHARD_SCAN) ("SelfId", SelfId())(
77-
// "TabletId", TabletId)("ScanId", ScanId)("TxId", TxId)("ScanGen", ScanGen));
76+
// TLogContextGuard gLogging(NActors::TLogContextBuilder::Build(NKikimrServices::TX_COLUMNSHARD_SCAN) ("SelfId", SelfId())(
77+
// "TabletId", TabletId)("ScanId", ScanId)("TxId", TxId)("ScanGen", ScanGen));
7878
auto g = Stats->MakeGuard("bootstrap");
7979
ScanActorId = ctx.SelfID;
8080

@@ -263,16 +263,18 @@ bool TColumnShardScan::ProduceResults() noexcept {
263263
"batch_columns", JoinSeq(",", batch->schema()->field_names()));
264264
}
265265
if (CurrentLastReadKey) {
266-
NArrow::NMerger::TSortableBatchPosition pNew(result.GetScanCursor()->GetPKCursor(), 0,
267-
result.GetScanCursor()->GetPKCursor()->schema()->field_names(), {}, ReadMetadataRange->IsDescSorted());
268-
NArrow::NMerger::TSortableBatchPosition pOld(CurrentLastReadKey->GetPKCursor(), 0,
269-
CurrentLastReadKey->GetPKCursor()->schema()->field_names(), {}, ReadMetadataRange->IsDescSorted());
270-
AFL_VERIFY(!(pNew < pOld))("old", pOld.DebugJson().GetStringRobust())("new", pNew.DebugJson().GetStringRobust());
266+
auto pNew = NArrow::TReplaceKey::FromBatch(result.GetScanCursor()->GetPKCursor(), 0);
267+
auto pOld = NArrow::TReplaceKey::FromBatch(CurrentLastReadKey->GetPKCursor(), 0);
268+
if (!ReadMetadataRange->IsDescSorted()) {
269+
AFL_VERIFY(!(pNew < pOld))("old", pOld.DebugJson().GetStringRobust())("new", pNew.DebugJson().GetStringRobust());
270+
} else {
271+
AFL_VERIFY(!(pOld < pNew))("old", pOld.DebugJson().GetStringRobust())("new", pNew.DebugJson().GetStringRobust());
272+
}
271273
}
272274
CurrentLastReadKey = result.GetScanCursor();
273275

274-
Result->LastKey = ConvertLastKey(result.GetScanCursor()->GetPKCursor());
275-
Result->LastCursorProto = result.GetScanCursor()->SerializeToProto();
276+
Result->LastKey = ConvertLastKey(CurrentLastReadKey->GetPKCursor());
277+
Result->LastCursorProto = CurrentLastReadKey->SerializeToProto();
276278
SendResult(false, false);
277279
ScanIterator->OnSentDataFromInterval(result.GetNotFinishedIntervalIdx());
278280
ACFL_DEBUG("stage", "finished")("iterator", ScanIterator->DebugString());
@@ -313,8 +315,8 @@ void TColumnShardScan::ContinueProcessing() {
313315
}
314316
}
315317
AFL_VERIFY(!ScanIterator || !ChunksLimiter.HasMore() || ScanCountersPool.InWaiting())("scan_actor_id", ScanActorId)("tx_id", TxId)(
316-
"scan_id", ScanId)("gen", ScanGen)("tablet", TabletId)("debug",
317-
ScanIterator->DebugString())("counters", ScanCountersPool.DebugString());
318+
"scan_id", ScanId)("gen", ScanGen)("tablet", TabletId)(
319+
"debug", ScanIterator->DebugString())("counters", ScanCountersPool.DebugString());
318320
}
319321

320322
void TColumnShardScan::MakeResult(size_t reserveRows /*= 0*/) {

0 commit comments

Comments
 (0)