diff options
author | nsofya <nsofya@ydb.tech> | 2023-10-05 10:57:24 +0300 |
---|---|---|
committer | nsofya <nsofya@ydb.tech> | 2023-10-05 11:20:33 +0300 |
commit | 091e463483e80d2444e7d0af35025a32a58eab22 (patch) | |
tree | 88568e1d5d23d1a4d997b02b41d2709e40ca2e32 | |
parent | 7a0f35d2179ef3cc81f12299d2333aae0035ca10 (diff) | |
download | ydb-091e463483e80d2444e7d0af35025a32a58eab22.tar.gz |
KIKIMR-19214: Additional logs on tablet Init
-rw-r--r-- | ydb/core/tx/columnshard/blobs_action/transaction/tx_write.cpp | 6 | ||||
-rw-r--r-- | ydb/core/tx/columnshard/columnshard.cpp | 15 | ||||
-rw-r--r-- | ydb/core/tx/columnshard/columnshard__init.cpp | 58 | ||||
-rw-r--r-- | ydb/core/tx/columnshard/columnshard__plan_step.cpp | 4 | ||||
-rw-r--r-- | ydb/core/tx/columnshard/columnshard__progress_tx.cpp | 14 | ||||
-rw-r--r-- | ydb/core/tx/columnshard/columnshard__propose_cancel.cpp | 2 | ||||
-rw-r--r-- | ydb/core/tx/columnshard/columnshard__propose_transaction.cpp | 6 | ||||
-rw-r--r-- | ydb/core/tx/columnshard/columnshard__write.cpp | 4 | ||||
-rw-r--r-- | ydb/core/tx/columnshard/columnshard_impl.cpp | 19 | ||||
-rw-r--r-- | ydb/core/tx/columnshard/columnshard_impl.h | 4 | ||||
-rw-r--r-- | ydb/core/tx/columnshard/operations/write.cpp | 2 | ||||
-rw-r--r-- | ydb/core/tx/columnshard/operations/write.h | 2 | ||||
-rw-r--r-- | ydb/core/tx/columnshard/tx_controller.cpp | 6 | ||||
-rw-r--r-- | ydb/core/tx/columnshard/tx_controller.h | 2 |
14 files changed, 83 insertions, 61 deletions
diff --git a/ydb/core/tx/columnshard/blobs_action/transaction/tx_write.cpp b/ydb/core/tx/columnshard/blobs_action/transaction/tx_write.cpp index 1c6db661dc..25e5fc7454 100644 --- a/ydb/core/tx/columnshard/blobs_action/transaction/tx_write.cpp +++ b/ydb/core/tx/columnshard/blobs_action/transaction/tx_write.cpp @@ -39,7 +39,7 @@ bool TTxWrite::Execute(TTransactionContext& txc, const TActorContext&) { if (writeMeta.HasLongTxId()) { AFL_VERIFY(PutBlobResult->Get()->GetBlobData().size() == 1)("count", PutBlobResult->Get()->GetBlobData().size()); } else { - operation = Self->OperationsManager.GetOperation((TWriteId)writeMeta.GetWriteId()); + operation = Self->OperationsManager->GetOperation((TWriteId)writeMeta.GetWriteId()); Y_VERIFY(operation); Y_VERIFY(operation->GetStatus() == EOperationStatus::Started); } @@ -70,9 +70,9 @@ bool TTxWrite::Execute(TTransactionContext& txc, const TActorContext&) { if (operation) { operation->OnWriteFinish(txc, writeIds); - auto txInfo = Self->ProgressTxController.RegisterTxWithDeadline(operation->GetTxId(), NKikimrTxColumnShard::TX_KIND_COMMIT_WRITE, "", writeMeta.GetSource(), 0, txc); + auto txInfo = Self->ProgressTxController->RegisterTxWithDeadline(operation->GetTxId(), NKikimrTxColumnShard::TX_KIND_COMMIT_WRITE, "", writeMeta.GetSource(), 0, txc); Y_UNUSED(txInfo); - NEvents::TDataEvents::TCoordinatorInfo tInfo = Self->ProgressTxController.GetCoordinatorInfo(operation->GetTxId()); + NEvents::TDataEvents::TCoordinatorInfo tInfo = Self->ProgressTxController->GetCoordinatorInfo(operation->GetTxId()); Result = NEvents::TDataEvents::TEvWriteResult::BuildPrepared(operation->GetTxId(), tInfo); } else { Y_VERIFY(writeIds.size() == 1); diff --git a/ydb/core/tx/columnshard/columnshard.cpp b/ydb/core/tx/columnshard/columnshard.cpp index b588bff6e1..cd30c5469c 100644 --- a/ydb/core/tx/columnshard/columnshard.cpp +++ b/ydb/core/tx/columnshard/columnshard.cpp @@ -30,8 +30,8 @@ void TColumnShard::BecomeBroken(const TActorContext& ctx) } void TColumnShard::SwitchToWork(const TActorContext& ctx) { - Become(&TThis::StateWork); - LOG_S_INFO("Switched to work at " << TabletID() << " actor " << ctx.SelfID); + const TLogContextGuard gLogging = NActors::TLogContextBuilder::Build(NKikimrServices::TX_COLUMNSHARD)("tablet_id", TabletID())("self_id", SelfId()); + AFL_INFO(NKikimrServices::TX_COLUMNSHARD)("event", "initialize_shard")("step", "SwitchToWork"); BlobsReadActor = ctx.Register(new NOlap::NBlobOperations::NRead::TActor(TabletID(), SelfId())); ResourceSubscribeActor = ctx.Register(new NOlap::NResourceBroker::NSubscribe::TActor(TabletID(), SelfId())); @@ -39,11 +39,15 @@ void TColumnShard::SwitchToWork(const TActorContext& ctx) { for (auto&& i : TablesManager.GetTables()) { ActivateTiering(i.first, i.second.GetTieringUsage()); } + + Become(&TThis::StateWork); SignalTabletActive(ctx); } -void TColumnShard::OnActivateExecutor(const TActorContext& ctx) { - LOG_S_DEBUG("OnActivateExecutor at " << TabletID() << " actor " << ctx.SelfID); +void TColumnShard::OnActivateExecutor(const TActorContext&) { + const TLogContextGuard gLogging = NActors::TLogContextBuilder::Build(NKikimrServices::TX_COLUMNSHARD)("tablet_id", TabletID())("self_id", SelfId()); + AFL_INFO(NKikimrServices::TX_COLUMNSHARD)("event", "initialize_shard")("step", "OnActivateExecutor"); + Executor()->RegisterExternalTabletCounters(TabletCountersPtr.release()); const auto selfActorId = SelfId(); @@ -60,6 +64,7 @@ void TColumnShard::OnActivateExecutor(const TActorContext& ctx) { void TColumnShard::Handle(TEvPrivate::TEvTieringModified::TPtr& /*ev*/, const TActorContext& ctx) { OnTieringModified(); if (!TiersInitializedFlag) { + AFL_INFO(NKikimrServices::TX_COLUMNSHARD)("event", "initialize_shard")("step", "initialize_tiring_finished"); TiersInitializedFlag = true; auto& icb = *AppData(ctx)->Icb; Limits.RegisterControls(icb); @@ -244,7 +249,7 @@ void TColumnShard::UpdateIndexCounters() { ui64 TColumnShard::MemoryUsage() const { ui64 memory = - ProgressTxController.GetMemoryUsage() + + ProgressTxController->GetMemoryUsage() + ScanTxInFlight.size() * (sizeof(ui64) + sizeof(TInstant)) + AltersInFlight.size() * sizeof(TAlterMeta) + CommitsInFlight.size() * sizeof(TCommitMeta) + diff --git a/ydb/core/tx/columnshard/columnshard__init.cpp b/ydb/core/tx/columnshard/columnshard__init.cpp index de7a0a213d..94c58c29fc 100644 --- a/ydb/core/tx/columnshard/columnshard__init.cpp +++ b/ydb/core/tx/columnshard/columnshard__init.cpp @@ -24,6 +24,8 @@ public: void Complete(const TActorContext& ctx) override; TTxType GetTxType() const override { return TXTYPE_INIT; } +private: + bool Precharge(TTransactionContext& txc); void SetDefaults(); bool ReadEverything(TTransactionContext& txc, const TActorContext& ctx); }; @@ -37,7 +39,6 @@ void TTxInit::SetDefaults() { Self->LastPlannedTxId = 0; Self->OwnerPathId = 0; Self->OwnerPath.clear(); - Self->ProgressTxController.Clear(); Self->AltersInFlight.clear(); Self->CommitsInFlight.clear(); Self->TablesManager.Clear(); @@ -45,8 +46,7 @@ void TTxInit::SetDefaults() { Self->LongTxWritesByUniqueId.clear(); } -bool TTxInit::ReadEverything(TTransactionContext& txc, const TActorContext& ctx) -{ +bool TTxInit::Precharge(TTransactionContext& txc) { NIceDb::TNiceDb db(txc.DB); bool ready = true; @@ -76,30 +76,52 @@ bool TTxInit::ReadEverything(TTransactionContext& txc, const TActorContext& ctx) if (!ready) { return false; } + return true; +} + +bool TTxInit::ReadEverything(TTransactionContext& txc, const TActorContext& ctx) { + if (!Precharge(txc)) { + return false; + } + NIceDb::TNiceDb db(txc.DB); TBlobGroupSelector dsGroupSelector(Self->Info()); NOlap::TDbWrapper dbTable(txc.DB, &dsGroupSelector); { - std::unique_ptr<NOlap::TInsertTable> localInsertTable = std::make_unique<NOlap::TInsertTable>(); + ACFL_INFO("step", "TInsertTable::Load_Start"); + auto localInsertTable = std::make_unique<NOlap::TInsertTable>(); if (!localInsertTable->Load(dbTable, TAppData::TimeProvider->Now())) { - ACFL_ERROR("event", "cannot load insert table"); + ACFL_ERROR("step", "TInsertTable::Load_Fails"); return false; } - Self->InsertTable = std::move(localInsertTable); + ACFL_INFO("step", "TInsertTable::Load_Finish"); + Self->InsertTable.swap(localInsertTable); } - if (!Self->ProgressTxController.Load(txc)) { - ACFL_ERROR("event", "ProgressTxController"); - return false; + { + ACFL_INFO("step", "TTxController::Load_Start"); + auto localTxController = std::make_unique<TTxController>(*Self); + if (!localTxController->Load(txc)) { + ACFL_ERROR("step", "TTxController::Load_Fails"); + return false; + } + ACFL_INFO("step", "TTxController::Load_Finish"); + Self->ProgressTxController.swap(localTxController); } - if (!Self->OperationsManager.Init(txc)) { - ACFL_ERROR("event", "OperationsManager::Init"); - return false; + { + ACFL_INFO("step", "TOperationsManager::Load_Start"); + auto localOperationsManager = std::make_unique<TOperationsManager>(); + if (!localOperationsManager->Load(txc)) { + ACFL_ERROR("step", "TOperationsManager::Load_Fails"); + return false; + } + ACFL_INFO("step", "TOperationsManager::Load_Finish"); + Self->OperationsManager.swap(localOperationsManager); } + { TBlobManagerDb blobManagerDb(txc.DB); - for (auto&& i : Self->StoragesManager->GetStorages()) { if (!i.second->Load(blobManagerDb)) { ACFL_ERROR("event", "storages manager load")("storage", i.first); @@ -108,20 +130,23 @@ bool TTxInit::ReadEverything(TTransactionContext& txc, const TActorContext& ctx) } } { + ACFL_INFO("step", "TTablesManager::Load_Start"); TTablesManager tManagerLocal(Self->StoragesManager); THashSet<TUnifiedBlobId> lostEvictions; if (!tManagerLocal.InitFromDB(db, Self->TabletID())) { - ACFL_ERROR("event", "InitFromDB"); + ACFL_ERROR("step", "TTablesManager::InitFromDB_Fails"); return false; } if (!tManagerLocal.LoadIndex(dbTable, lostEvictions)) { - ACFL_ERROR("event", "load index"); + ACFL_ERROR("step", "TTablesManager::Load_Fails"); return false; } Self->TablesManager = std::move(tManagerLocal); + Self->SetCounter(COUNTER_TABLES, Self->TablesManager.GetTables().size()); Self->SetCounter(COUNTER_TABLE_PRESETS, Self->TablesManager.GetSchemaPresets().size()); Self->SetCounter(COUNTER_TABLE_TTLS, Self->TablesManager.GetTtl().PathsCount()); + ACFL_INFO("step", "TTablesManager::Load_Finish"); } { // Load long tx writes @@ -161,8 +186,7 @@ bool TTxInit::ReadEverything(TTransactionContext& txc, const TActorContext& ctx) } bool TTxInit::Execute(TTransactionContext& txc, const TActorContext& ctx) { - NActors::TLogContextGuard gLogging = NActors::TLogContextBuilder::Build(NKikimrServices::TX_COLUMNSHARD)("tablet_id", Self->TabletID()); - Y_UNUSED(txc); + NActors::TLogContextGuard gLogging = NActors::TLogContextBuilder::Build(NKikimrServices::TX_COLUMNSHARD)("tablet_id", Self->TabletID())("event", "initialize_shard"); LOG_S_DEBUG("TTxInit.Execute at tablet " << Self->TabletID()); try { diff --git a/ydb/core/tx/columnshard/columnshard__plan_step.cpp b/ydb/core/tx/columnshard/columnshard__plan_step.cpp index 6ba25f6c0a..a45911ec34 100644 --- a/ydb/core/tx/columnshard/columnshard__plan_step.cpp +++ b/ydb/core/tx/columnshard/columnshard__plan_step.cpp @@ -62,7 +62,7 @@ bool TTxPlanStep::Execute(TTransactionContext& txc, const TActorContext& ctx) { ui64 lastTxId = 0; for (ui64 txId : txIds) { Y_VERIFY(lastTxId < txId, "Transactions must be sorted and unique"); - auto planResult = Self->ProgressTxController.PlanTx(step, txId, txc); + auto planResult = Self->ProgressTxController->PlanTx(step, txId, txc); switch (planResult) { case TTxController::EPlanResult::Skipped: { @@ -104,7 +104,7 @@ bool TTxPlanStep::Execute(TTransactionContext& txc, const TActorContext& ctx) { Self->IncCounter(COUNTER_PLAN_STEP_ACCEPTED); - if (plannedCount > 0 || Self->ProgressTxController.HaveOutdatedTxs()) { + if (plannedCount > 0 || Self->ProgressTxController->HaveOutdatedTxs()) { Self->EnqueueProgressTx(ctx); } return true; diff --git a/ydb/core/tx/columnshard/columnshard__progress_tx.cpp b/ydb/core/tx/columnshard/columnshard__progress_tx.cpp index 4c86113e2b..37c4e2d2b8 100644 --- a/ydb/core/tx/columnshard/columnshard__progress_tx.cpp +++ b/ydb/core/tx/columnshard/columnshard__progress_tx.cpp @@ -68,7 +68,7 @@ public: LOG_S_DEBUG(TxPrefix() << "execute" << TxSuffix()); Y_VERIFY(Self->ProgressTxInFlight); - size_t removedCount = Self->ProgressTxController.CleanExpiredTxs(txc); + size_t removedCount = Self->ProgressTxController->CleanExpiredTxs(txc); if (removedCount > 0) { // We cannot continue with this transaction, start a new transaction Self->Execute(new TTxProgressTx(Self), ctx); @@ -76,7 +76,7 @@ public: } // Process a single transaction at the front of the queue - auto plannedItem = Self->ProgressTxController.StartPlannedTx(); + auto plannedItem = Self->ProgressTxController->StartPlannedTx(); if (!!plannedItem) { ui64 step = plannedItem->PlanStep; ui64 txId = plannedItem->TxId; @@ -123,7 +123,7 @@ public: } case NKikimrTxColumnShard::TX_KIND_COMMIT_WRITE: { NOlap::TSnapshot snapshot(step, txId); - Y_VERIFY(Self->OperationsManager.CommitTransaction(*Self, txId, txc, snapshot)); + Y_VERIFY(Self->OperationsManager->CommitTransaction(*Self, txId, txc, snapshot)); Trigger = ETriggerActivities::POST_INSERT; break; } @@ -135,12 +135,12 @@ public: // Currently transactions never fail and there are no dependencies between them TxResults.emplace_back(TResultEvent(std::move(txInfo), NKikimrTxColumnShard::SUCCESS)); - Self->ProgressTxController.FinishPlannedTx(txId, txc); + Self->ProgressTxController->FinishPlannedTx(txId, txc); Self->RescheduleWaitingReads(); } Self->ProgressTxInFlight = false; - if (!!Self->ProgressTxController.GetPlannedTx()) { + if (!!Self->ProgressTxController->GetPlannedTx()) { Self->EnqueueProgressTx(ctx); } return true; @@ -154,7 +154,7 @@ public: } for (auto& res : TxResults) { - Self->ProgressTxController.CompleteRunningTx(TTxController::TPlanQueueItem(res.TxInfo.PlanStep, res.TxInfo.TxId)); + Self->ProgressTxController->CompleteRunningTx(TTxController::TPlanQueueItem(res.TxInfo.PlanStep, res.TxInfo.TxId)); auto event = res.MakeEvent(Self->TabletID()); ctx.Send(res.TxInfo.Source, event.release(), 0, res.TxInfo.Cookie); @@ -184,7 +184,7 @@ void TColumnShard::Handle(TEvColumnShard::TEvCheckPlannedTransaction::TPtr& ev, ui64 txId = record.GetTxId(); LOG_S_DEBUG("CheckTransaction planStep " << step << " txId " << txId << " at tablet " << TabletID()); - auto frontTx = ProgressTxController.GetFrontTx(); + auto frontTx = ProgressTxController->GetFrontTx(); bool finished = step < frontTx.Step || (step == frontTx.Step && txId < frontTx.TxId); if (finished) { auto txKind = NKikimrTxColumnShard::ETransactionKind::TX_KIND_COMMIT; diff --git a/ydb/core/tx/columnshard/columnshard__propose_cancel.cpp b/ydb/core/tx/columnshard/columnshard__propose_cancel.cpp index 83c53ae079..9b9ed721cc 100644 --- a/ydb/core/tx/columnshard/columnshard__propose_cancel.cpp +++ b/ydb/core/tx/columnshard/columnshard__propose_cancel.cpp @@ -19,7 +19,7 @@ public: const auto* msg = Ev->Get(); const ui64 txId = msg->Record.GetTxId(); - Self->ProgressTxController.CancelTx(txId, txc); + Self->ProgressTxController->CancelTx(txId, txc); return true; } diff --git a/ydb/core/tx/columnshard/columnshard__propose_transaction.cpp b/ydb/core/tx/columnshard/columnshard__propose_transaction.cpp index 0cc18373f8..73cb74c634 100644 --- a/ydb/core/tx/columnshard/columnshard__propose_transaction.cpp +++ b/ydb/core/tx/columnshard/columnshard__propose_transaction.cpp @@ -113,7 +113,7 @@ bool TTxProposeTransaction::Execute(TTransactionContext& txc, const TActorContex } // Always persist the latest metadata, this may include an updated seqno - Self->ProgressTxController.RegisterTx(txId, txKind, txBody, Ev->Get()->GetSource(), Ev->Cookie, txc); + Self->ProgressTxController->RegisterTx(txId, txKind, txBody, Ev->Get()->GetSource(), Ev->Cookie, txc); if (!Self->AltersInFlight.contains(txId)) { Self->AltersInFlight.emplace(txId, std::move(meta)); @@ -131,7 +131,7 @@ bool TTxProposeTransaction::Execute(TTransactionContext& txc, const TActorContex if (Self->CommitsInFlight.contains(txId)) { LOG_S_DEBUG(TxPrefix() << "CommitTx (retry) TxId " << txId << TxSuffix()); - auto txInfoPtr = Self->ProgressTxController.GetTxInfo(txId); + auto txInfoPtr = Self->ProgressTxController->GetTxInfo(txId); Y_VERIFY(txInfoPtr); if (txInfoPtr->Source != Ev->Get()->GetSource() || txInfoPtr->Cookie != Ev->Cookie) { @@ -192,7 +192,7 @@ bool TTxProposeTransaction::Execute(TTransactionContext& txc, const TActorContex Self->AddLongTxWrite(writeId, txId); } - const auto& txInfo = Self->ProgressTxController.RegisterTxWithDeadline(txId, txKind, txBody, Ev->Get()->GetSource(), Ev->Cookie, txc); + const auto& txInfo = Self->ProgressTxController->RegisterTxWithDeadline(txId, txKind, txBody, Ev->Get()->GetSource(), Ev->Cookie, txc); minStep = txInfo.MinStep; maxStep = txInfo.MaxStep; diff --git a/ydb/core/tx/columnshard/columnshard__write.cpp b/ydb/core/tx/columnshard/columnshard__write.cpp index ac69050f9a..1154139ff1 100644 --- a/ydb/core/tx/columnshard/columnshard__write.cpp +++ b/ydb/core/tx/columnshard/columnshard__write.cpp @@ -75,7 +75,7 @@ void TColumnShard::Handle(TEvPrivate::TEvWriteBlobsResult::TPtr& ev, const TActo auto result = std::make_unique<TEvColumnShard::TEvWriteResult>(TabletID(), writeMeta, errCode); ctx.Send(writeMeta.GetSource(), result.release()); } else { - auto operation = OperationsManager.GetOperation((TWriteId)writeMeta.GetWriteId()); + auto operation = OperationsManager->GetOperation((TWriteId)writeMeta.GetWriteId()); Y_VERIFY(operation); auto result = NEvents::TDataEvents::TEvWriteResult::BuildError(operation->GetTxId(), NKikimrDataEvents::TEvWriteResult::ERROR, "put data fails"); ctx.Send(writeMeta.GetSource(), result.release()); @@ -216,7 +216,7 @@ void TColumnShard::Handle(NEvents::TDataEvents::TEvWrite::TPtr& ev, const TActor } auto wg = WritesMonitor.RegisterWrite(arrowData->GetSize()); - auto operation = OperationsManager.RegisterOperation(txId); + auto operation = OperationsManager->RegisterOperation(txId); Y_VERIFY(operation); operation->Start(*this, tableId, arrowData, source, ctx); } diff --git a/ydb/core/tx/columnshard/columnshard_impl.cpp b/ydb/core/tx/columnshard/columnshard_impl.cpp index 47885f367b..d8df79027e 100644 --- a/ydb/core/tx/columnshard/columnshard_impl.cpp +++ b/ydb/core/tx/columnshard/columnshard_impl.cpp @@ -144,23 +144,23 @@ bool TColumnShard::TAlterMeta::Validate(const NOlap::ISnapshotSchema::TPtr& sche class TColumnShard::TStoragesManager: public NOlap::IStoragesManager { private: using TBase = NOlap::IStoragesManager; - TColumnShard* Shard; + TColumnShard& Shard; protected: virtual std::shared_ptr<NOlap::IBlobsStorageOperator> DoBuildOperator(const TString& storageId) override { if (storageId == TBase::DefaultStorageId) { - return std::make_shared<NOlap::NBlobOperations::NBlobStorage::TOperator>(storageId, Shard->SelfId(), Shard->Info(), Shard->Executor()->Generation()); - } else if (!Shard->Tiers) { + return std::make_shared<NOlap::NBlobOperations::NBlobStorage::TOperator>(storageId, Shard.SelfId(), Shard.Info(), Shard.Executor()->Generation()); + } else if (!Shard.Tiers) { return nullptr; } else { #ifndef KIKIMR_DISABLE_S3_OPS - return std::make_shared<NOlap::NBlobOperations::NTier::TOperator>(storageId, *Shard); + return std::make_shared<NOlap::NBlobOperations::NTier::TOperator>(storageId, Shard); #else return nullptr; #endif } } public: - TStoragesManager(TColumnShard* shard) + TStoragesManager(TColumnShard& shard) : Shard(shard) { } @@ -169,8 +169,8 @@ public: TColumnShard::TColumnShard(TTabletStorageInfo* info, const TActorId& tablet) : TActor(&TThis::StateInit) , TTabletExecutedFlat(info, tablet, nullptr) - , ProgressTxController(*this) - , StoragesManager(std::make_shared<TStoragesManager>(this)) + , ProgressTxController(std::make_unique<TTxController>(*this)) + , StoragesManager(std::make_shared<TStoragesManager>(*this)) , InFlightReadsTracker(StoragesManager) , TablesManager(StoragesManager) , PipeClientCache(NTabletPipe::CreateBoundedClientCache(new NTabletPipe::TBoundedClientCacheConfig(), GetPipeClientConfig())) @@ -276,7 +276,7 @@ void TColumnShard::RescheduleWaitingReads() { } TRowVersion TColumnShard::GetMaxReadVersion() const { - auto plannedTx = ProgressTxController.GetPlannedTx(); + auto plannedTx = ProgressTxController->GetPlannedTx(); if (plannedTx) { // We may only read just before the first transaction in the queue return TRowVersion(plannedTx->Step, plannedTx->TxId).Prev(); @@ -402,7 +402,7 @@ bool TColumnShard::AbortTx(const ui64 txId, const NKikimrTxColumnShard::ETransac break; } case NKikimrTxColumnShard::TX_KIND_COMMIT_WRITE: { - if (!OperationsManager.AbortTransaction(*this, txId, txc)) { + if (!OperationsManager->AbortTransaction(*this, txId, txc)) { return false; } break; @@ -943,6 +943,7 @@ void TColumnShard::ActivateTiering(const ui64 pathId, const TString& useTiering) } void TColumnShard::Enqueue(STFUNC_SIG) { + const TLogContextGuard gLogging = NActors::TLogContextBuilder::Build(NKikimrServices::TX_COLUMNSHARD)("tablet_id", TabletID())("self_id", SelfId()); switch (ev->GetTypeRewrite()) { HFunc(TEvPrivate::TEvTieringModified, Handle); default: diff --git a/ydb/core/tx/columnshard/columnshard_impl.h b/ydb/core/tx/columnshard/columnshard_impl.h index 0597d4fedb..5edf199fb6 100644 --- a/ydb/core/tx/columnshard/columnshard_impl.h +++ b/ydb/core/tx/columnshard/columnshard_impl.h @@ -278,8 +278,8 @@ protected: } private: - TTxController ProgressTxController; - TOperationsManager OperationsManager; + std::unique_ptr<TTxController> ProgressTxController; + std::unique_ptr<TOperationsManager> OperationsManager; struct TAlterMeta { NKikimrTxColumnShard::TSchemaTxBody Body; diff --git a/ydb/core/tx/columnshard/operations/write.cpp b/ydb/core/tx/columnshard/operations/write.cpp index 7d1d1abcb6..2890466608 100644 --- a/ydb/core/tx/columnshard/operations/write.cpp +++ b/ydb/core/tx/columnshard/operations/write.cpp @@ -84,7 +84,7 @@ namespace NKikimr::NColumnShard { owner.InsertTable->Abort(dbTable, writeIds); } - bool TOperationsManager::Init(NTabletFlatExecutor::TTransactionContext& txc) { + bool TOperationsManager::Load(NTabletFlatExecutor::TTransactionContext& txc) { NIceDb::TNiceDb db(txc.DB); auto rowset = db.Table<Schema::Operations>().Select(); if (!rowset.IsReady()) { diff --git a/ydb/core/tx/columnshard/operations/write.h b/ydb/core/tx/columnshard/operations/write.h index cb90eaaa23..7d0dd9ade2 100644 --- a/ydb/core/tx/columnshard/operations/write.h +++ b/ydb/core/tx/columnshard/operations/write.h @@ -59,7 +59,7 @@ namespace NKikimr::NColumnShard { TWriteId LastWriteId = TWriteId(0); public: - bool Init(NTabletFlatExecutor::TTransactionContext& txc); + bool Load(NTabletFlatExecutor::TTransactionContext& txc); TWriteOperation::TPtr GetOperation(const TWriteId writeId) const; bool CommitTransaction(TColumnShard& owner, const ui64 txId, NTabletFlatExecutor::TTransactionContext& txc, const NOlap::TSnapshot& snapshot); diff --git a/ydb/core/tx/columnshard/tx_controller.cpp b/ydb/core/tx/columnshard/tx_controller.cpp index 76c0a68ce2..dff8a87672 100644 --- a/ydb/core/tx/columnshard/tx_controller.cpp +++ b/ydb/core/tx/columnshard/tx_controller.cpp @@ -22,12 +22,6 @@ ui64 TTxController::GetAllowedStep() const { return Max(Owner.GetOutdatedStep() + 1, TAppData::TimeProvider->Now().MilliSeconds()); } -void TTxController::Clear() { - BasicTxInfo.clear(); - DeadlineQueue.clear(); - PlanQueue.clear(); -} - ui64 TTxController::GetMemoryUsage() const { return BasicTxInfo.size() * sizeof(TBasicTxInfo) + DeadlineQueue.size() * sizeof(TPlanQueueItem) + diff --git a/ydb/core/tx/columnshard/tx_controller.h b/ydb/core/tx/columnshard/tx_controller.h index 563f1f364e..1f2da419ac 100644 --- a/ydb/core/tx/columnshard/tx_controller.h +++ b/ydb/core/tx/columnshard/tx_controller.h @@ -51,8 +51,6 @@ private: public: TTxController(TColumnShard& owner); - void Clear(); - ui64 GetMemoryUsage() const; bool HaveOutdatedTxs() const; |