Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correct validation for second init tx received #13773

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ydb/core/tx/columnshard/columnshard_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,8 @@ class TColumnShard: public TActor<TColumnShard>, public NTabletFlatExecutor::TTa
std::shared_ptr<TAtomicCounter> TabletActivityImpl = std::make_shared<TAtomicCounter>(0);

public:
TAtomicCounter InitShardCounter;

ui64 BuildEphemeralTxId() {
static TAtomicCounter Counter = 0;
static constexpr ui64 shift = (ui64)1 << 47;
Expand Down
4 changes: 4 additions & 0 deletions ydb/core/tx/columnshard/transactions/operators/schema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ TTxController::TProposeResult TSchemaTransactionOperator::DoStartProposeOnExecut
switch (SchemaTxBody.TxBody_case()) {
case NKikimrTxColumnShard::TSchemaTxBody::kInitShard:
{
if (owner.InitShardCounter.Add(1) != 1) {
AFL_WARN(NKikimrServices::TX_COLUMNSHARD)("event", "repeated_initialization")("tx_id", GetTxId())(
"counter", owner.InitShardCounter.Val());
}
auto validationStatus = ValidateTables(SchemaTxBody.GetInitShard().GetTables());
if (validationStatus.IsFail()) {
return TProposeResult(NKikimrTxColumnShard::EResultStatus::SCHEMA_ERROR, "Invalid schema: " + validationStatus.GetErrorMessage());
Expand Down
1 change: 0 additions & 1 deletion ydb/core/tx/columnshard/transactions/operators/schema.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class TSchemaTransactionOperator: public IProposeTxOperator, public TMonitoringO
THashSet<ui64> GetNotErasedTableIds(const TColumnShard& owner, const TInfoProto& tables) const {
THashSet<ui64> result;
for (auto&& i : tables) {
AFL_VERIFY(!owner.TablesManager.HasTable(i.GetPathId()));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Предлагаю тут различать состояние таблиц в TableManager. Напр: Creating, Created, Deleting. Тогда можно будет делать более строгие проверки

if (owner.TablesManager.HasTable(i.GetPathId(), true)) {
result.emplace(i.GetPathId());
}
Expand Down
Loading