From 60adfa2246ac755c0e97fa76b96c0d809ba9f5e7 Mon Sep 17 00:00:00 2001 From: Handora Date: Mon, 22 Jan 2024 08:47:26 +0000 Subject: [PATCH] [BUG]maintain ls reference for transfer read --- src/storage/memtable/mvcc/ob_mvcc_acc_ctx.h | 4 +++- src/storage/tx_storage/ob_access_service.cpp | 2 +- src/storage/tx_table/ob_tx_table_guards.h | 10 +++++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/storage/memtable/mvcc/ob_mvcc_acc_ctx.h b/src/storage/memtable/mvcc/ob_mvcc_acc_ctx.h index 95856ac86f..67b130ed28 100644 --- a/src/storage/memtable/mvcc/ob_mvcc_acc_ctx.h +++ b/src/storage/memtable/mvcc/ob_mvcc_acc_ctx.h @@ -169,9 +169,11 @@ public: write_flag_ = write_flag; } - void set_src_tx_table_guard(const storage::ObTxTableGuard &tx_table_guard) + void set_src_tx_table_guard(const storage::ObTxTableGuard &tx_table_guard, + storage::ObLSHandle &src_ls_handle) { tx_table_guards_.src_tx_table_guard_ = tx_table_guard; + tx_table_guards_.src_ls_handle_ = src_ls_handle; } void init_replay(transaction::ObPartTransCtx &tx_ctx, ObMemtableCtx &mem_ctx, diff --git a/src/storage/tx_storage/ob_access_service.cpp b/src/storage/tx_storage/ob_access_service.cpp index b15e84055f..3239d419ea 100644 --- a/src/storage/tx_storage/ob_access_service.cpp +++ b/src/storage/tx_storage/ob_access_service.cpp @@ -418,7 +418,7 @@ int ObAccessService::get_source_ls_tx_table_guard_( LOG_WARN("start request for transfer failed", KR(ret), K(user_data)); } else { ObStoreCtx &ctx = ctx_guard.get_store_ctx(); - ctx.mvcc_acc_ctx_.set_src_tx_table_guard(src_tx_table_guard); + ctx.mvcc_acc_ctx_.set_src_tx_table_guard(src_tx_table_guard, ls_handle); LOG_DEBUG("succ get src tx table guard", K(ret), K(src_ls->get_ls_id()), K(src_tx_table_guard), K(user_data)); } } diff --git a/src/storage/tx_table/ob_tx_table_guards.h b/src/storage/tx_table/ob_tx_table_guards.h index f621839f1a..12fd72f0f5 100644 --- a/src/storage/tx_table/ob_tx_table_guards.h +++ b/src/storage/tx_table/ob_tx_table_guards.h @@ -47,7 +47,8 @@ class ObTxTableGuards public: ObTxTableGuards() : tx_table_guard_(), - src_tx_table_guard_() {} + src_tx_table_guard_(), + src_ls_handle_() {} ~ObTxTableGuards() { reset(); } @@ -55,6 +56,7 @@ public: { tx_table_guard_.reset(); src_tx_table_guard_.reset(); + src_ls_handle_.reset(); } void reuse() @@ -149,13 +151,15 @@ public: bool check_ls_offline(); - TO_STRING_KV(K_(tx_table_guard), K_(src_tx_table_guard)); + TO_STRING_KV(K_(tx_table_guard), K_(src_tx_table_guard), K_(src_ls_handle)); public: storage::ObTxTableGuard tx_table_guard_; - // dml executed during transfer, src_tx_table_guard_ will be valid. + // when dml is executing during transfer, src_tx_table_guard_ and + // src_ls_handle_ will be valid. storage::ObTxTableGuard src_tx_table_guard_; + storage::ObLSHandle src_ls_handle_; }; } // namespace storage