From c3c60dd20c9b35848589b9b25fe5b3bcc9228368 Mon Sep 17 00:00:00 2001 From: chinaxing Date: Tue, 27 Aug 2024 16:17:07 +0000 Subject: [PATCH] [master][tx-route] keep tx-state and op_sn will not go backward --- src/storage/tx/ob_tx_free_route_state.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/storage/tx/ob_tx_free_route_state.cpp b/src/storage/tx/ob_tx_free_route_state.cpp index 4e0e65aff..c7d8f2321 100644 --- a/src/storage/tx/ob_tx_free_route_state.cpp +++ b/src/storage/tx/ob_tx_free_route_state.cpp @@ -36,11 +36,21 @@ namespace transaction { // recover flags which should not be overwriten #define PRE_DYNAMIC_DECODE \ FLAG save_flags = flags_; \ - int save_abort_cause = abort_cause_; + int save_abort_cause = abort_cause_; \ + State save_state = state_; \ + uint64_t save_op_sn = op_sn_; + // for txn start node, if current abort_cause was set, use current +// keep the state and op_sn will not go backwards #define POST_DYNAMIC_DECODE \ flags_ = save_flags.update_with(flags_); \ - abort_cause_ = save_abort_cause ?: abort_cause_; + abort_cause_ = save_abort_cause ?: abort_cause_; \ + if (save_state > state_) { \ + state_ = save_state; \ + } \ + if (save_op_sn > op_sn_) { \ + op_sn_ = save_op_sn; \ + } #define PRE_EXTRA_DECODE #define POST_EXTRA_DECODE \