diff options
author | ivanmorozov <ivanmorozov@yandex-team.com> | 2023-10-22 17:25:37 +0300 |
---|---|---|
committer | ivanmorozov <ivanmorozov@yandex-team.com> | 2023-10-22 17:41:33 +0300 |
commit | 9d59960b8484ffc24d6f31ed2525ff49c18fe4e9 (patch) | |
tree | 306f393a7f955adef41c9906261ab70c2d564dd9 | |
parent | d40a08d163c0ec4b3cf546ce187466c8fc8af0b7 (diff) | |
download | ydb-9d59960b8484ffc24d6f31ed2525ff49c18fe4e9.tar.gz |
KIKIMR-19808: special method for finalize dropped table
-rw-r--r-- | ydb/core/tx/columnshard/engines/changes/cleanup.cpp | 9 | ||||
-rw-r--r-- | ydb/core/tx/columnshard/tables_manager.cpp | 15 | ||||
-rw-r--r-- | ydb/core/tx/columnshard/tables_manager.h | 2 |
3 files changed, 18 insertions, 8 deletions
diff --git a/ydb/core/tx/columnshard/engines/changes/cleanup.cpp b/ydb/core/tx/columnshard/engines/changes/cleanup.cpp index 542943c9ca4..f0172442ddb 100644 --- a/ydb/core/tx/columnshard/engines/changes/cleanup.cpp +++ b/ydb/core/tx/columnshard/engines/changes/cleanup.cpp @@ -28,14 +28,7 @@ void TCleanupColumnEngineChanges::DoWriteIndex(NColumnShard::TColumnShard& self, self.IncCounter(NColumnShard::COUNTER_RAW_BYTES_ERASED, p.RawBytesSum()); } for (auto&& p: pathIds) { - auto itDrop = self.TablesManager.GetPathsToDrop().find(p); - if (itDrop != self.TablesManager.GetPathsToDrop().end()) { - if (!self.TablesManager.GetPrimaryIndexSafe().HasDataInPathId(p)) { - self.TablesManager.MutablePathsToDrop().erase(itDrop); - NIceDb::TNiceDb db(context.Txc.DB); - NColumnShard::Schema::EraseTableInfo(db, p); - } - } + self.TablesManager.TryFinalizeDropPath(context.Txc, p); } } diff --git a/ydb/core/tx/columnshard/tables_manager.cpp b/ydb/core/tx/columnshard/tables_manager.cpp index f1fb371120f..e5fa43997d0 100644 --- a/ydb/core/tx/columnshard/tables_manager.cpp +++ b/ydb/core/tx/columnshard/tables_manager.cpp @@ -4,6 +4,7 @@ #include <ydb/core/tx/columnshard/blobs_action/blob_manager_db.h> #include <ydb/core/scheme/scheme_types_proto.h> #include <ydb/core/tx/tiering/manager.h> +#include <ydb/core/tablet_flat/tablet_flat_executor.h> namespace NKikimr::NColumnShard { @@ -305,4 +306,18 @@ TTablesManager::TTablesManager(const std::shared_ptr<NOlap::IStoragesManager>& s { } +bool TTablesManager::TryFinalizeDropPath(NTabletFlatExecutor::TTransactionContext& txc, const ui64 pathId) { + auto itDrop = PathsToDrop.find(pathId); + if (itDrop == PathsToDrop.end()) { + return false; + } + if (GetPrimaryIndexSafe().HasDataInPathId(pathId)) { + return false; + } + PathsToDrop.erase(itDrop); + NIceDb::TNiceDb db(txc.DB); + NColumnShard::Schema::EraseTableInfo(db, pathId); + return true; +} + } diff --git a/ydb/core/tx/columnshard/tables_manager.h b/ydb/core/tx/columnshard/tables_manager.h index 99db7751835..420bbb6a297 100644 --- a/ydb/core/tx/columnshard/tables_manager.h +++ b/ydb/core/tx/columnshard/tables_manager.h @@ -143,6 +143,8 @@ private: public: TTablesManager(const std::shared_ptr<NOlap::IStoragesManager>& storagesManager, const ui64 tabletId); + bool TryFinalizeDropPath(NTabletFlatExecutor::TTransactionContext& txc, const ui64 pathId); + const TTtl& GetTtl() const { return Ttl; } |