Skip to content

Commit

Permalink
validations for prevent incorrect data in local db (ydb-platform#8477)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanmorozov333 authored and zverevgeny committed Sep 11, 2024
1 parent d5f90e3 commit d8d3204
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions ydb/core/tx/columnshard/columnshard_schema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ bool Schema::InsertTable_Load(NIceDb::TNiceDb& db, const IBlobGroupSelector* dsG
}

void Schema::SaveTxInfo(NIceDb::TNiceDb& db, const TFullTxInfo& txInfo, const TString& txBody) {
AFL_VERIFY(txInfo.TxKind != NKikimrTxColumnShard::TX_KIND_NONE);
db.Table<TxInfo>().Key(txInfo.TxId).Update(
NIceDb::TUpdate<TxInfo::TxKind>(txInfo.TxKind),
NIceDb::TUpdate<TxInfo::TxBody>(txBody),
Expand Down
4 changes: 2 additions & 2 deletions ydb/core/tx/columnshard/transactions/tx_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ bool TTxController::Load(NTabletFlatExecutor::TTransactionContext& txc) {
const ui64 txId = rowset.GetValue<Schema::TxInfo::TxId>();
const NKikimrTxColumnShard::ETransactionKind txKind = rowset.GetValue<Schema::TxInfo::TxKind>();
ITransactionOperator::TPtr txOperator(ITransactionOperator::TFactory::Construct(txKind, TTxInfo(txKind, txId)));
Y_ABORT_UNLESS(!!txOperator);
AFL_VERIFY(!!txOperator)("kind", txKind);
const TString txBody = rowset.GetValue<Schema::TxInfo::TxBody>();
Y_ABORT_UNLESS(txOperator->Parse(Owner, txBody, true));
AFL_VERIFY(txOperator->Parse(Owner, txBody, true));

auto& txInfo = txOperator->MutableTxInfo();
txInfo.MaxStep = rowset.GetValue<Schema::TxInfo::MaxStep>();
Expand Down
1 change: 1 addition & 0 deletions ydb/core/tx/columnshard/transactions/tx_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ struct TBasicTxInfo {
TBasicTxInfo(const NKikimrTxColumnShard::ETransactionKind& txKind, const ui64 txId)
: TxKind(txKind)
, TxId(txId) {
AFL_VERIFY(txKind != NKikimrTxColumnShard::TX_KIND_NONE);
}

bool operator==(const TBasicTxInfo& item) const = default;
Expand Down

0 comments on commit d8d3204

Please sign in to comment.