From 528f205709bc4417290751085a3c534e3fb97f61 Mon Sep 17 00:00:00 2001 From: handora Date: Thu, 18 Nov 2021 17:12:42 +0800 Subject: [PATCH] [BUG] fix report error msg from sql recheck --- src/storage/ob_partition_storage.cpp | 29 ++++++++++++++++++++-------- src/storage/ob_partition_storage.h | 1 + 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/storage/ob_partition_storage.cpp b/src/storage/ob_partition_storage.cpp index 1c7e61563e..f72bdb77c3 100644 --- a/src/storage/ob_partition_storage.cpp +++ b/src/storage/ob_partition_storage.cpp @@ -2922,14 +2922,27 @@ int ObPartitionStorage::process_old_row(ObDMLRunningCtx& run_ctx, const bool dat relative_tables.index_tables_[i], store_ctx, idx_col_descs, idx_row->row_val_, exists))) { STORAGE_LOG(WARN, "failed to check rowkey existing", K(*idx_row), K(ret)); } else if (!exists) { - ret = OB_ERR_UNEXPECTED; - STORAGE_LOG(ERROR, - "DEBUG ATTENTION!!!! update or delete a non exist index row", - K(ret), - KPC(idx_row), - K(relative_tables.data_table_.tables_handle_), - K(relative_tables.index_tables_[i]), - K(relative_tables.index_tables_[i].tables_handle_)); + if (run_ctx.store_ctx_.mem_ctx_ != NULL) { + ObMemtableCtx *curr_mt_ctx = static_cast(run_ctx.store_ctx_.mem_ctx_); + transaction::ObTransCtx *trans_ctx = curr_mt_ctx->get_trans_ctx(); + if (NULL != trans_ctx) { + if (!trans_ctx->is_bounded_staleness_read() && curr_mt_ctx->is_for_replay()) { + TRANS_LOG(WARN, "strong consistent read follower when sql check", + K(trans_ctx->get_trans_id())); + ret = OB_NOT_MASTER; + } + } + } + if (OB_NOT_MASTER != ret) { + ret = OB_ERR_UNEXPECTED; + STORAGE_LOG(ERROR, + "DEBUG ATTENTION!!!! update or delete a non exist index row", + K(ret), + KPC(idx_row), + K(relative_tables.data_table_.tables_handle_), + K(relative_tables.index_tables_[i]), + K(relative_tables.index_tables_[i].tables_handle_)); + } } else { // STORAGE_LOG(INFO, "build index row", K(*idx_row), K(null_idx_val), K(type)); if (ND_ROWKEY_CHANGE == type && !null_idx_val) { diff --git a/src/storage/ob_partition_storage.h b/src/storage/ob_partition_storage.h index 71fb4f4730..58cc02770c 100644 --- a/src/storage/ob_partition_storage.h +++ b/src/storage/ob_partition_storage.h @@ -692,6 +692,7 @@ private: const ObStoreCtx& ctx, const ObTableScanParam& scan_param, const common::ObNewRow& row, RowReshape*& row_reshape); int check_useless_index_mini_merge(const storage::ObSSTableMergeCtx &ctx); int dump_error_info(ObSSTable& main_sstable, ObSSTable& index_sstable); + void check_leader_changed_for_sql_recheck_(ObDMLRunningCtx &run_ctx, int &ret); // disallow copy; DISALLOW_COPY_AND_ASSIGN(ObPartitionStorage); -- GitLab