Skip to content

Commit

Permalink
fix tx usage after restart - restore prepare result (ydb-platform#4632)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanmorozov333 authored and MrLolthe1st committed May 28, 2024
1 parent ae99d20 commit 7f4013d
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 22 deletions.
4 changes: 0 additions & 4 deletions ydb/core/tx/columnshard/transactions/operators/backup.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ class TBackupTransactionOperator: public IProposeTxOperator {
public:
using TBase::TBase;

virtual bool AllowTxDups() const override {
return true;
}

virtual bool ExecuteOnProgress(TColumnShard& owner, const NOlap::TSnapshot& version, NTabletFlatExecutor::TTransactionContext& txc) override;

virtual bool CompleteOnProgress(TColumnShard& owner, const TActorContext& ctx) override;
Expand Down
4 changes: 0 additions & 4 deletions ydb/core/tx/columnshard/transactions/operators/schema.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ namespace NKikimr::NColumnShard {
public:
using TBase::TBase;

virtual bool AllowTxDups() const override {
return true;
}

bool TxWithDeadline() const override {
return false;
}
Expand Down
5 changes: 0 additions & 5 deletions ydb/core/tx/columnshard/transactions/operators/sharing.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ class TSharingTransactionOperator: public IProposeTxOperator {
NotifySubscribers.insert(actorId);
}

virtual bool AllowTxDups() const override {
return true;
}


virtual bool ExecuteOnProgress(TColumnShard& owner, const NOlap::TSnapshot& version, NTabletFlatExecutor::TTransactionContext& txc) override;

virtual bool CompleteOnProgress(TColumnShard& owner, const TActorContext& ctx) override;
Expand Down
2 changes: 1 addition & 1 deletion ydb/core/tx/columnshard/transactions/tx_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ TTxController::ITransactionOperator::TPtr TTxController::GetVerifiedTxOperator(c

std::shared_ptr<TTxController::ITransactionOperator> TTxController::UpdateTxSourceInfo(const TFullTxInfo& tx, NTabletFlatExecutor::TTransactionContext& txc) {
auto op = GetVerifiedTxOperator(tx.GetTxId());
op->ResetStatus();
op->ResetStatusOnUpdate();
auto& txInfo = op->MutableTxInfo();
txInfo.Source = tx.Source;
txInfo.Cookie = tx.Cookie;
Expand Down
14 changes: 6 additions & 8 deletions ydb/core/tx/columnshard/transactions/tx_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ class TTxController {
return TxInfo;
}

void ResetStatusOnUpdate() {
Status = {};
}

public:
using TPtr = std::shared_ptr<ITransactionOperator>;
using TFactory = NObjectFactory::TParametrizedObjectFactory<ITransactionOperator, NKikimrTxColumnShard::ETransactionKind, TTxInfo>;
Expand All @@ -191,10 +195,6 @@ class TTxController {
return DoCheckAllowUpdate(currentTxInfo);
}

void ResetStatus() {
Status = {};
}

bool IsFail() const {
return ProposeStartInfo && ProposeStartInfo->IsFail();
}
Expand All @@ -221,10 +221,6 @@ class TTxController {
return TxInfo.TxId;
}

virtual bool AllowTxDups() const {
return false;
}

bool IsAsync() const {
return DoIsAsync() && Status != EStatus::Failed && Status != EStatus::ReplySent;
}
Expand All @@ -238,13 +234,15 @@ class TTxController {
bool Parse(TColumnShard& owner, const TString& data, const bool onLoad = false) {
const bool result = DoParse(owner, data);
if (!result) {
AFL_VERIFY(!onLoad);
ProposeStartInfo = TTxController::TProposeResult(NKikimrTxColumnShard::EResultStatus::ERROR, TStringBuilder() << "Error processing commit TxId# " << TxInfo.TxId
<< ". Parsing error");
AFL_VERIFY(SwitchState(EStatus::Created, EStatus::Failed));
} else {
AFL_VERIFY(SwitchState(EStatus::Created, EStatus::Parsed));
}
if (onLoad) {
ProposeStartInfo = TTxController::TProposeResult(NKikimrTxColumnShard::EResultStatus::PREPARED, "success on iteration before restart");
Status = {};
}
return result;
Expand Down

0 comments on commit 7f4013d

Please sign in to comment.