Skip to content

Commit a8416a5

Browse files
committed
Remove range_avl_tree
1 parent 93fb563 commit a8416a5

17 files changed

+30
-1583
lines changed

ydb/core/tx/columnshard/columnshard__init.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ void TTxInit::SetDefaults() {
3737
Self->LastWriteId = TWriteId{0};
3838
Self->LastPlannedStep = 0;
3939
Self->LastPlannedTxId = 0;
40+
Self->LastCompletedTx = NOlap::TSnapshot::Zero();
4041
Self->OwnerPathId = 0;
4142
Self->OwnerPath.clear();
4243
Self->LongTxWrites.clear();
@@ -72,6 +73,14 @@ bool TTxInit::Precharge(TTransactionContext& txc) {
7273
ready = ready && Schema::GetSpecialValue(db, Schema::EValueIds::OwnerPathId, Self->OwnerPathId);
7374
ready = ready && Schema::GetSpecialValue(db, Schema::EValueIds::OwnerPath, Self->OwnerPath);
7475

76+
{
77+
ui64 lastCompletedStep = 0;
78+
ui64 lastCompletedTx = 0;
79+
ready = ready && Schema::GetSpecialValue(db, Schema::EValueIds::LastCompletedStep, lastCompletedStep);
80+
ready = ready && Schema::GetSpecialValue(db, Schema::EValueIds::LastCompletedTxId, lastCompletedTx);
81+
Self->LastCompletedTx = NOlap::TSnapshot(lastCompletedStep, lastCompletedTx);
82+
}
83+
7584
if (!ready) {
7685
return false;
7786
}

ydb/core/tx/columnshard/columnshard__progress_tx.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ class TColumnShard::TTxProgressTx : public TTransactionBase<TColumnShard> {
3131
if (!!plannedItem) {
3232
ui64 step = plannedItem->PlanStep;
3333
ui64 txId = plannedItem->TxId;
34+
LastCompletedTx = NOlap::TSnapshot(step, txId);
35+
if (LastCompletedTx > Self->LastCompletedTx) {
36+
NIceDb::TNiceDb db(txc.DB);
37+
Schema::SaveSpecialValue(db, Schema::EValueIds::LastCompletedStep, LastCompletedTx->GetPlanStep());
38+
Schema::SaveSpecialValue(db, Schema::EValueIds::LastCompletedTxId, LastCompletedTx->GetTxId());
39+
}
3440

3541
TxOperator = Self->ProgressTxController->GetVerifiedTxOperator(txId);
3642
AFL_VERIFY(TxOperator->Progress(*Self, NOlap::TSnapshot(step, txId), txc));
@@ -50,12 +56,16 @@ class TColumnShard::TTxProgressTx : public TTransactionBase<TColumnShard> {
5056
if (TxOperator) {
5157
TxOperator->Complete(*Self, ctx);
5258
}
59+
if (LastCompletedTx) {
60+
Self->LastCompletedTx = std::max(*LastCompletedTx, Self->LastCompletedTx);
61+
}
5362
Self->SetupIndexation();
5463
}
5564

5665
private:
5766
TTxController::ITransactionOperatior::TPtr TxOperator;
5867
const ui32 TabletTxNo;
68+
std::optional<NOlap::TSnapshot> LastCompletedTx;
5969
};
6070

6171
void TColumnShard::EnqueueProgressTx(const TActorContext& ctx) {

ydb/core/tx/columnshard/columnshard_impl.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ class TColumnShard
239239
}
240240

241241
inline TRowVersion LastCompleteTxVersion() const {
242-
return TRowVersion(LastCompletedStep, LastCompletedTxId);
242+
return TRowVersion(LastCompletedTx.GetPlanStep(), LastCompletedTx.GetTxId());
243243
}
244244

245245
ui32 Generation() const { return Executor()->Generation(); }
@@ -309,9 +309,6 @@ class TColumnShard
309309
}
310310
}
311311

312-
public:
313-
TTabletCountersBase* TabletCounters;
314-
315312
private:
316313
std::unique_ptr<TTxController> ProgressTxController;
317314
std::unique_ptr<TOperationsManager> OperationsManager;
@@ -391,8 +388,7 @@ class TColumnShard
391388
TWriteId LastWriteId = TWriteId{0};
392389
ui64 LastPlannedStep = 0;
393390
ui64 LastPlannedTxId = 0;
394-
ui64 LastCompletedStep = 0;
395-
ui64 LastCompletedTxId = 0;
391+
NOlap::TSnapshot LastCompletedTx = NOlap::TSnapshot::Zero();
396392
ui64 LastExportNo = 0;
397393

398394
ui64 OwnerPathId = 0;
@@ -419,6 +415,7 @@ class TColumnShard
419415
TTablesManager TablesManager;
420416
std::shared_ptr<TTiersManager> Tiers;
421417
std::unique_ptr<TTabletCountersBase> TabletCountersPtr;
418+
TTabletCountersBase* TabletCounters;
422419
std::unique_ptr<NTabletPipe::IClientCache> PipeClientCache;
423420
std::unique_ptr<NOlap::TInsertTable> InsertTable;
424421
std::shared_ptr<NOlap::NResourceBroker::NSubscribe::TSubscriberCounters> SubscribeCounters;

ydb/core/tx/columnshard/columnshard_schema.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ struct Schema : NIceDb::Schema {
6464
LastExportNumber = 10,
6565
OwnerPathId = 11,
6666
OwnerPath = 12,
67+
LastCompletedStep = 13,
68+
LastCompletedTxId = 14,
6769
};
6870

6971
enum class EInsertTableIds : ui8 {

ydb/core/tx/datashard/range_avl_tree.cpp

Whitespace-only changes.

0 commit comments

Comments
 (0)