Skip to content

Commit

Permalink
Distinguish outdated schema from invalid schema in repl apply (#6710)
Browse files Browse the repository at this point in the history
  • Loading branch information
Enjection authored Jul 16, 2024
1 parent 57b1d08 commit 26f1eef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions ydb/core/protos/tx_datashard.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1829,6 +1829,7 @@ message TEvApplyReplicationChangesResult {
REASON_SCHEME_ERROR = 2;
REASON_BAD_REQUEST = 3;
REASON_UNEXPECTED_ROW_OPERATION = 4;
REASON_OUTDATED_SCHEME = 6;
}

optional EStatus Status = 1;
Expand Down
4 changes: 3 additions & 1 deletion ydb/core/tx/datashard/datashard_repl_apply.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ class TDataShard::TTxApplyReplicationChanges : public TTransactionBase<TDataShar
<< " and cannot apply changes for schema version " << tableId.GetSchemaVersion();
Result = MakeHolder<TEvDataShard::TEvApplyReplicationChangesResult>(
NKikimrTxDataShard::TEvApplyReplicationChangesResult::STATUS_REJECTED,
NKikimrTxDataShard::TEvApplyReplicationChangesResult::REASON_SCHEME_ERROR,
tableId.GetSchemaVersion() < userTable.GetTableSchemaVersion()
? NKikimrTxDataShard::TEvApplyReplicationChangesResult::REASON_OUTDATED_SCHEME
: NKikimrTxDataShard::TEvApplyReplicationChangesResult::REASON_SCHEME_ERROR,
std::move(error));
return true;
}
Expand Down

0 comments on commit 26f1eef

Please sign in to comment.