aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornsofya <nsofya@yandex-team.com>2023-09-15 12:14:05 +0300
committernsofya <nsofya@yandex-team.com>2023-09-15 12:46:53 +0300
commit257ebfb6c1b5f00c7e81bcc50ad8fa742f127df8 (patch)
tree386d300bad46b3d970836cc95762f4a305a0f334
parent301635ad281a2c4ade4994c08fe4e67ea020f9ed (diff)
downloadydb-257ebfb6c1b5f00c7e81bcc50ad8fa742f127df8.tar.gz
KIKIMR-19364: Fix errors checks
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_create_olap_table.cpp6
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_drop_olap_table.cpp8
2 files changed, 9 insertions, 5 deletions
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_olap_table.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_olap_table.cpp
index b953d1db7cc..be184dbb035 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_create_olap_table.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_olap_table.cpp
@@ -720,11 +720,11 @@ public:
dstPath.Base()->PathState = TPathElement::EPathState::EPathStateCreate;
dstPath.Base()->PathType = TPathElement::EPathType::EPathTypeColumnTable;
- NIceDb::TNiceDb db(context.GetDB());
-
TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxCreateColumnTable, pathId);
if (storeInfo) {
+ NIceDb::TNiceDb db(context.GetDB());
+
auto olapStorePath = parentPath.FindOlapStore();
txState.State = TTxState::ConfigureParts;
@@ -798,6 +798,7 @@ public:
context.SS->SetPartitioning(pathId, tableInfo);
+ NIceDb::TNiceDb db(context.GetDB());
for (auto shard : txState.Shards) {
context.SS->PersistShardMapping(db, shard.Idx, InvalidTabletId, pathId, opTxId, shard.TabletType);
context.SS->PersistChannelsBinding(db, shard.Idx, channelsBindings);
@@ -818,6 +819,7 @@ public:
}
}
+ NIceDb::TNiceDb db(context.GetDB());
context.SS->PersistTxState(db, OperationId);
context.SS->PersistPath(db, dstPath.Base()->PathId);
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_drop_olap_table.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_drop_olap_table.cpp
index 03aeb2c0020..ec321dcb5af 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_drop_olap_table.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_drop_olap_table.cpp
@@ -407,12 +407,11 @@ public:
// Dirty hack: drop step must not be zero because 0 is treated as "hasn't been dropped"
txState.MinStep = TStepId(1);
- NIceDb::TNiceDb db(context.GetDB());
Y_VERIFY(context.SS->ColumnTables.contains(path.Base()->PathId));
auto tableInfo = context.SS->ColumnTables.GetVerified(path.Base()->PathId);
-
if (tableInfo->IsStandalone()) {
+ NIceDb::TNiceDb db(context.GetDB());
for (auto shardIdx : tableInfo->OwnedColumnShards) {
Y_VERIFY_S(context.SS->ShardInfos.contains(shardIdx), "Unknown shardIdx " << shardIdx);
txState.Shards.emplace_back(shardIdx, context.SS->ShardInfos[shardIdx].TabletType, TTxState::DropParts);
@@ -448,6 +447,8 @@ public:
context.OnComplete.Dependence(storePath.Base()->LastTxId, opTxId);
}
storePath.Base()->LastTxId = opTxId;
+
+ NIceDb::TNiceDb db(context.GetDB());
context.SS->PersistLastTxId(db, storePath.Base());
// TODO: we need to know all shards where this table has ever been created
@@ -468,8 +469,9 @@ public:
path.Base()->PathState = TPathElement::EPathState::EPathStateDrop;
path.Base()->DropTxId = opTxId;
path.Base()->LastTxId = opTxId;
- context.SS->PersistLastTxId(db, path.Base());
+ NIceDb::TNiceDb db(context.GetDB());
+ context.SS->PersistLastTxId(db, path.Base());
context.SS->PersistTxState(db, OperationId);
context.SS->TabletCounters->Simple()[COUNTER_COLUMN_TABLE_COUNT].Sub(1);