|
4 | 4 | #include "columnshard_schema.h"
|
5 | 5 | #include "hooks/abstract/abstract.h"
|
6 | 6 | #include <ydb/core/tx/columnshard/blobs_action/blob_manager_db.h>
|
| 7 | +#include <ydb/core/tx/columnshard/transactions/locks_db.h> |
7 | 8 |
|
8 | 9 | #include <ydb/core/tablet/tablet_exception.h>
|
9 | 10 | #include <ydb/core/tx/columnshard/operations/write.h>
|
@@ -36,6 +37,7 @@ void TTxInit::SetDefaults() {
|
36 | 37 | Self->LastWriteId = TWriteId{0};
|
37 | 38 | Self->LastPlannedStep = 0;
|
38 | 39 | Self->LastPlannedTxId = 0;
|
| 40 | + Self->LastCompletedTx = NOlap::TSnapshot::Zero(); |
39 | 41 | Self->OwnerPathId = 0;
|
40 | 42 | Self->OwnerPath.clear();
|
41 | 43 | Self->LongTxWrites.clear();
|
@@ -71,6 +73,14 @@ bool TTxInit::Precharge(TTransactionContext& txc) {
|
71 | 73 | ready = ready && Schema::GetSpecialValue(db, Schema::EValueIds::OwnerPathId, Self->OwnerPathId);
|
72 | 74 | ready = ready && Schema::GetSpecialValue(db, Schema::EValueIds::OwnerPath, Self->OwnerPath);
|
73 | 75 |
|
| 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 | + |
74 | 84 | if (!ready) {
|
75 | 85 | return false;
|
76 | 86 | }
|
@@ -177,6 +187,15 @@ bool TTxInit::ReadEverything(TTransactionContext& txc, const TActorContext& ctx)
|
177 | 187 | }
|
178 | 188 | }
|
179 | 189 | }
|
| 190 | + { |
| 191 | + TMemoryProfileGuard g("TTxInit/LocksDB"); |
| 192 | + if (txc.DB.GetScheme().GetTableInfo(Schema::Locks::TableId)) { |
| 193 | + TColumnShardLocksDb locksDb(*Self, txc); |
| 194 | + if (!Self->SysLocks.Load(locksDb)) { |
| 195 | + return false; |
| 196 | + } |
| 197 | + } |
| 198 | + } |
180 | 199 |
|
181 | 200 | Self->UpdateInsertTableCounters();
|
182 | 201 | Self->UpdateIndexCounters();
|
|
0 commit comments