diff --git a/src/share/ob_i_tablet_scan.h b/src/share/ob_i_tablet_scan.h index a94792b926..dc53afe664 100644 --- a/src/share/ob_i_tablet_scan.h +++ b/src/share/ob_i_tablet_scan.h @@ -391,23 +391,25 @@ public: virtual int get_multi_ranges_cost( const share::ObLSID &ls_id, - const ObTabletID &tablet_id, - const ObIArray &ranges, + const common::ObTabletID &tablet_id, + const int64_t timeout_us, + const common::ObIArray &ranges, int64_t &total_size) { - UNUSEDx(ls_id, tablet_id, ranges, total_size); + UNUSEDx(ls_id, tablet_id, timeout_us, ranges, total_size); return OB_SUCCESS; } virtual int split_multi_ranges( const share::ObLSID &ls_id, - const ObTabletID &tablet_id, - const ObIArray &ranges, + const common::ObTabletID &tablet_id, + const int64_t timeout_us, + const common::ObIArray &ranges, const int64_t expected_task_count, ObIAllocator &allocator, ObArrayArray &multi_range_split_array) { - UNUSEDx(ls_id, tablet_id, ranges, expected_task_count, allocator, multi_range_split_array); + UNUSEDx(ls_id, tablet_id, timeout_us, ranges, expected_task_count, allocator, multi_range_split_array); return OB_SUCCESS; } }; diff --git a/src/sql/das/ob_das_simple_op.cpp b/src/sql/das/ob_das_simple_op.cpp index 77e1f8f5b7..5c6a5e7735 100644 --- a/src/sql/das/ob_das_simple_op.cpp +++ b/src/sql/das/ob_das_simple_op.cpp @@ -49,7 +49,7 @@ OB_SERIALIZE_MEMBER(ObDASEmptyCtDef); OB_SERIALIZE_MEMBER(ObDASEmptyRtDef); ObDASSplitRangesOp::ObDASSplitRangesOp(ObIAllocator &op_alloc) - : ObDASSimpleOp(op_alloc), expected_task_count_(0) {} + : ObDASSimpleOp(op_alloc), expected_task_count_(0), timeout_us_(0) {} int ObDASSplitRangesOp::open_op() { @@ -57,6 +57,7 @@ int ObDASSplitRangesOp::open_op() ObAccessService *access_service = MTL(ObAccessService *); if (OB_FAIL(access_service->split_multi_ranges(ls_id_, tablet_id_, + timeout_us_, ranges_, expected_task_count_, op_alloc_, @@ -97,10 +98,11 @@ int ObDASSplitRangesOp::decode_task_result(ObIDASTaskResult *task_result) return ret; } -int ObDASSplitRangesOp::init(const common::ObIArray &ranges, int64_t expected_task_count) +int ObDASSplitRangesOp::init(const common::ObIArray &ranges, int64_t expected_task_count, const int64_t timeout_us) { int ret = OB_SUCCESS; expected_task_count_ = expected_task_count; + timeout_us_ = timeout_us; if (OB_FAIL(ranges_.assign(ranges))) { LOG_WARN("failed to assign ranges array", K(ret)); } @@ -109,7 +111,8 @@ int ObDASSplitRangesOp::init(const common::ObIArray &ranges, int64 OB_SERIALIZE_MEMBER((ObDASSplitRangesOp, ObIDASTaskOp), ranges_, - expected_task_count_); + expected_task_count_, + timeout_us_); ObDASSplitRangesResult::ObDASSplitRangesResult() : ObIDASTaskResult(), result_alloc_(nullptr) {} @@ -196,7 +199,7 @@ OB_DEF_DESERIALIZE(ObDASSplitRangesResult) } ObDASRangesCostOp::ObDASRangesCostOp(common::ObIAllocator &op_alloc) - : ObDASSimpleOp(op_alloc), total_size_(0) {} + : ObDASSimpleOp(op_alloc), total_size_(0), timeout_us_(0) {} int ObDASRangesCostOp::open_op() { @@ -204,6 +207,7 @@ int ObDASRangesCostOp::open_op() ObAccessService *access_service = MTL(ObAccessService *); if (OB_FAIL(access_service->get_multi_ranges_cost(ls_id_, tablet_id_, + timeout_us_, ranges_, total_size_))) { LOG_WARN("failed to get multi ranges cost", K(ret), K_(ls_id), K_(tablet_id)); @@ -240,18 +244,20 @@ int ObDASRangesCostOp::decode_task_result(ObIDASTaskResult *task_result) return ret; } -int ObDASRangesCostOp::init(const common::ObIArray &ranges) +int ObDASRangesCostOp::init(const common::ObIArray &ranges, const int64_t timeout_us) { int ret = OB_SUCCESS; if (OB_FAIL(ranges_.assign(ranges))) { LOG_WARN("failed to assign ranges array", K(ret)); } + timeout_us_ = timeout_us; return ret; } OB_SERIALIZE_MEMBER((ObDASRangesCostOp, ObIDASTaskOp), ranges_, - total_size_); + total_size_, + timeout_us_); ObDASRangesCostResult::ObDASRangesCostResult() : ObIDASTaskResult(), total_size_(0) {} @@ -291,7 +297,13 @@ int ObDASSimpleUtils::split_multi_ranges(ObExecContext &exec_ctx, } else { split_ranges_op = static_cast(task_op); split_ranges_op->set_can_part_retry(GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_4_2_1_0); - if (OB_FAIL(split_ranges_op->init(ranges, expected_task_count))) { + ObPhysicalPlanCtx *plan_ctx = nullptr; + if (OB_ISNULL(plan_ctx = exec_ctx.get_physical_plan_ctx())) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("unexpected nullptr", K(ret)); + } else if (OB_FAIL(split_ranges_op->init(ranges, + expected_task_count, + plan_ctx->get_timeout_timestamp() - ObTimeUtility::current_time()))) { LOG_WARN("failed to init das split ranges op", K(ret)); } else if (OB_FAIL(das_ref.execute_all_task())) { LOG_WARN("execute das split_multi_ranges task failed", K(ret)); @@ -340,7 +352,11 @@ int ObDASSimpleUtils::get_multi_ranges_cost(ObExecContext &exec_ctx, } else { ranges_cost_op = static_cast(task_op); ranges_cost_op->set_can_part_retry(GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_4_2_1_0); - if (OB_FAIL(ranges_cost_op->init(ranges))) { + ObPhysicalPlanCtx *plan_ctx = nullptr; + if (OB_ISNULL(plan_ctx = exec_ctx.get_physical_plan_ctx())) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("unexpected nullptr", K(ret)); + } else if (OB_FAIL(ranges_cost_op->init(ranges, plan_ctx->get_timeout_timestamp() - ObTimeUtility::current_time()))) { LOG_WARN("failed to init das ranges cost op", K(ret)); } else if (OB_FAIL(das_ref.execute_all_task())) { LOG_WARN("execute das get_multi_ranges_cost task failed", K(ret)); diff --git a/src/sql/das/ob_das_simple_op.h b/src/sql/das/ob_das_simple_op.h index 00f055ee4f..95e5727b3a 100644 --- a/src/sql/das/ob_das_simple_op.h +++ b/src/sql/das/ob_das_simple_op.h @@ -63,7 +63,7 @@ public: virtual int open_op() override; virtual int fill_task_result(ObIDASTaskResult &task_result, bool &has_more, int64_t &memory_limit) override; virtual int decode_task_result(ObIDASTaskResult *task_result) override; - int init(const common::ObIArray &ranges, int64_t expected_task_count); + int init(const common::ObIArray &ranges, int64_t expected_task_count, const int64_t timeout_us); const ObArrayArray &get_split_array() { return multi_range_split_array_; } INHERIT_TO_STRING_KV("parent", ObDASSimpleOp, K_(ranges), @@ -73,6 +73,7 @@ private: common::ObSEArray ranges_; int64_t expected_task_count_; ObArrayArray multi_range_split_array_; + int64_t timeout_us_; }; class ObDASSplitRangesResult : public ObIDASTaskResult @@ -102,7 +103,7 @@ public: virtual int open_op() override; virtual int fill_task_result(ObIDASTaskResult &task_result, bool &has_more, int64_t &memory_limit) override; virtual int decode_task_result(ObIDASTaskResult *task_result) override; - int init(const common::ObIArray &ranges); + int init(const common::ObIArray &ranges, const int64_t timeout_us); int64_t get_total_size() const { return total_size_; } INHERIT_TO_STRING_KV("parent", ObDASSimpleOp, K_(ranges), @@ -110,6 +111,7 @@ public: private: common::ObSEArray ranges_; int64_t total_size_; + int64_t timeout_us_; }; class ObDASRangesCostResult : public ObIDASTaskResult diff --git a/src/sql/optimizer/ob_storage_estimator.cpp b/src/sql/optimizer/ob_storage_estimator.cpp index 1ba3ff1298..299c3d11ed 100644 --- a/src/sql/optimizer/ob_storage_estimator.cpp +++ b/src/sql/optimizer/ob_storage_estimator.cpp @@ -12,6 +12,7 @@ #define USING_LOG_PREFIX SQL_OPT #include "ob_storage_estimator.h" +#include "lib/worker.h" #include "storage/tx_storage/ob_access_service.h" #include "storage/access/ob_table_scan_range.h" #include "share/ob_simple_batch.h" @@ -126,6 +127,7 @@ int ObStorageEstimator::storage_estimate_partition_batch_rowcount( int64_t rc_logical = 0; int64_t rc_physical = 0; ObArenaAllocator allocator; + const int64_t timeout_us = THIS_WORKER.get_timeout_remain(); ObAccessService *access_service = NULL; storage::ObTableScanRange table_scan_range; if (OB_ISNULL(access_service = MTL(ObAccessService *))) { @@ -135,13 +137,14 @@ int ObStorageEstimator::storage_estimate_partition_batch_rowcount( STORAGE_LOG(WARN, "Failed to init table scan range", K(ret), K(batch)); } else if (OB_FAIL(access_service->estimate_row_count(table_scan_param, table_scan_range, + timeout_us, est_records, rc_logical, rc_physical))) { LOG_TRACE("OPT:[STORAGE EST FAILED, USE STAT EST]", "storage_ret", ret); } else { LOG_TRACE("storage estimate row count result", K(rc_logical), K(rc_physical), - K(table_scan_param), K(table_scan_range), K(ret)); + K(table_scan_param), K(table_scan_range), K(timeout_us), K(ret)); logical_row_count = rc_logical < 0 ? 1.0 : static_cast(rc_logical); physical_row_count = rc_physical < 0 ? 1.0 : static_cast(rc_physical); } @@ -172,18 +175,20 @@ int ObStorageEstimator::storage_estimate_block_count_and_row_count( } else { const uint64_t tenant_id = arg.tenant_id_; MTL_SWITCH(tenant_id) { + const int64_t timeout_us = THIS_WORKER.get_timeout_remain(); ObAccessService *access_service = NULL; if (OB_ISNULL(access_service = MTL(ObAccessService *))) { ret = OB_ERR_UNEXPECTED; LOG_WARN("get unexpected null", K(ret), K(access_service)); } else if (OB_FAIL(access_service->estimate_block_count_and_row_count(arg.ls_id_, - arg.tablet_id_, - macro_block_count, - micro_block_count, - sstable_row_count, - memtable_row_count, - cg_macro_cnt_arr, - cg_micro_cnt_arr))) { + arg.tablet_id_, + timeout_us, + macro_block_count, + micro_block_count, + sstable_row_count, + memtable_row_count, + cg_macro_cnt_arr, + cg_micro_cnt_arr))) { LOG_WARN("OPT:[STORAGE EST BLOCK COUNT FAILED]", "storage_ret", ret); } else if (OB_UNLIKELY(cg_count != 0 && (cg_macro_cnt_arr.count() > cg_count diff --git a/src/storage/access/ob_multiple_merge.cpp b/src/storage/access/ob_multiple_merge.cpp index c9667fa31c..6573321736 100644 --- a/src/storage/access/ob_multiple_merge.cpp +++ b/src/storage/access/ob_multiple_merge.cpp @@ -1245,6 +1245,7 @@ int ObMultipleMerge::refresh_tablet_iter() LOG_WARN("ls is null", K(ret), K(ls_handle)); } else if (OB_FAIL(ls_handle.get_ls()->get_tablet_svr()->get_read_tables( tablet_id, + ObTabletCommon::DEFAULT_GET_TABLET_DURATION_US, get_table_param_->sample_info_.is_no_sample() ? access_ctx_->store_ctx_->mvcc_acc_ctx_.get_snapshot_version().get_val_for_tx() : INT64_MAX, diff --git a/src/storage/ddl/ob_build_index_task.cpp b/src/storage/ddl/ob_build_index_task.cpp index a2a9ccdebb..aea38a9d54 100644 --- a/src/storage/ddl/ob_build_index_task.cpp +++ b/src/storage/ddl/ob_build_index_task.cpp @@ -172,6 +172,7 @@ int ObUniqueIndexChecker::scan_table_with_column_checksum( ret = OB_ERR_UNEXPECTED; LOG_WARN("error unexpected, ls must not be nullptr", K(ret)); } else if (OB_FAIL(ls_handle.get_ls()->get_tablet_svr()->get_read_tables(tablet_id_, + ObTabletCommon::DEFAULT_GET_TABLET_DURATION_US, param.snapshot_version_, iterator, allow_not_ready))) { if (OB_REPLICA_NOT_READABLE == ret) { diff --git a/src/storage/ddl/ob_complement_data_task.cpp b/src/storage/ddl/ob_complement_data_task.cpp index a2da142ec1..65dbe4dfa8 100644 --- a/src/storage/ddl/ob_complement_data_task.cpp +++ b/src/storage/ddl/ob_complement_data_task.cpp @@ -197,6 +197,7 @@ int ObComplementDataParam::split_task_ranges( if (OB_FAIL(ranges.push_back(range))) { LOG_WARN("push back range failed", K(ret)); } else if (OB_FAIL(tablet_service->get_multi_ranges_cost(tablet_id, + ObTabletCommon::DEFAULT_GET_TABLET_DURATION_US, ranges, total_size))) { LOG_WARN("get multi ranges cost failed", K(ret)); @@ -209,6 +210,7 @@ int ObComplementDataParam::split_task_ranges( expected_task_count))) { LOG_WARN("compute total task count failed", K(ret)); } else if (OB_FAIL(tablet_service->split_multi_ranges(tablet_id, + ObTabletCommon::DEFAULT_GET_TABLET_DURATION_US, ranges, min(min(max(expected_task_count, 1), hint_parallelism), ObMacroDataSeq::MAX_PARALLEL_IDX + 1), allocator_, @@ -955,7 +957,8 @@ int ObComplementWriteTask::do_local_scan() ret = OB_ERR_UNEXPECTED; LOG_WARN("ls is null", K(ret), K(ls_handle)); } else if (OB_FAIL(ls_handle.get_ls()->get_tablet_svr()->get_read_tables(param_->orig_tablet_id_, - param_->snapshot_version_, iterator, allow_not_ready))) { + ObTabletCommon::DEFAULT_GET_TABLET_DURATION_US, + param_->snapshot_version_, iterator, allow_not_ready))) { if (OB_REPLICA_NOT_READABLE == ret) { ret = OB_EAGAIN; } else { diff --git a/src/storage/ls/ob_ls_tablet_service.cpp b/src/storage/ls/ob_ls_tablet_service.cpp index f39818fe3b..581202e51b 100644 --- a/src/storage/ls/ob_ls_tablet_service.cpp +++ b/src/storage/ls/ob_ls_tablet_service.cpp @@ -2262,6 +2262,7 @@ int ObLSTabletService::check_read_info_same(const AllowToReadMgr::AllowToReadInf int ObLSTabletService::get_read_tables( const common::ObTabletID &tablet_id, + const int64_t timeout_us, const int64_t snapshot_version, ObTabletTableIterator &iter, const bool allow_no_ready_read) @@ -2285,17 +2286,16 @@ int ObLSTabletService::get_read_tables( LOG_WARN("ls is not allow to read", K(ret), KPC(ls_)); } else if (FALSE_IT(key.ls_id_ = ls_->get_ls_id())) { } else if (OB_FAIL(ObTabletCreateDeleteHelper::check_and_get_tablet(key, handle, - ObTabletCommon::DEFAULT_GET_TABLET_DURATION_US, + timeout_us, ObMDSGetTabletMode::READ_READABLE_COMMITED, snapshot_version))) { if (OB_TABLET_NOT_EXIST != ret) { - LOG_WARN("fail to check and get tablet", K(ret), K(key), K(snapshot_version)); + LOG_WARN("fail to check and get tablet", K(ret), K(key), K(timeout_us), K(snapshot_version)); } } else if (OB_UNLIKELY(!handle.is_valid())) { ret = OB_ERR_UNEXPECTED; LOG_WARN("unexpected error, invalid tablet handle", K(ret), K(handle)); - } else if (OB_FAIL(handle.get_obj()->get_read_tables(snapshot_version, iter, - allow_no_ready_read))) { + } else if (OB_FAIL(handle.get_obj()->get_read_tables(snapshot_version, iter, allow_no_ready_read))) { LOG_WARN("fail to get read tables", K(ret), K(handle), K(tablet_id), K(snapshot_version), K(iter), K(allow_no_ready_read)); } else { @@ -5609,7 +5609,8 @@ int ObLSTabletService::get_ls_min_end_scn( } int ObLSTabletService::get_multi_ranges_cost( - const ObTabletID &tablet_id, + const common::ObTabletID &tablet_id, + const int64_t timeout_us, const common::ObIArray &ranges, int64_t &total_size) { @@ -5620,7 +5621,7 @@ int ObLSTabletService::get_multi_ranges_cost( if (IS_NOT_INIT) { ret = OB_NOT_INIT; LOG_WARN("not inited", K(ret)); - } else if (OB_FAIL(get_read_tables(tablet_id, max_snapshot_version, iter))) { + } else if (OB_FAIL(get_read_tables(tablet_id, timeout_us, max_snapshot_version, iter))) { LOG_WARN("fail to get all read tables", K(ret), K(tablet_id), K(max_snapshot_version)); } else { ObPartitionMultiRangeSpliter spliter; @@ -5636,7 +5637,8 @@ int ObLSTabletService::get_multi_ranges_cost( } int ObLSTabletService::split_multi_ranges( - const ObTabletID &tablet_id, + const common::ObTabletID &tablet_id, + const int64_t timeout_us, const ObIArray &ranges, const int64_t expected_task_count, common::ObIAllocator &allocator, @@ -5649,7 +5651,7 @@ int ObLSTabletService::split_multi_ranges( if (IS_NOT_INIT) { ret = OB_NOT_INIT; LOG_WARN("not inited", K(ret)); - } else if (OB_FAIL(get_read_tables(tablet_id, max_snapshot_version, iter))) { + } else if (OB_FAIL(get_read_tables(tablet_id, timeout_us, max_snapshot_version, iter))) { LOG_WARN("fail to get all read tables", K(ret), K(tablet_id), K(max_snapshot_version)); } else { ObPartitionMultiRangeSpliter spliter; @@ -5670,7 +5672,8 @@ int ObLSTabletService::split_multi_ranges( int ObLSTabletService::estimate_row_count( const ObTableScanParam ¶m, const ObTableScanRange &scan_range, - ObIArray &est_records, + const int64_t timeout_us, + common::ObIArray &est_records, int64_t &logical_row_count, int64_t &physical_row_count) { @@ -5689,7 +5692,7 @@ int ObLSTabletService::estimate_row_count( } else { const int64_t snapshot_version = -1 == param.frozen_version_ ? GET_BATCH_ROWS_READ_SNAPSHOT_VERSION : param.frozen_version_; - if (OB_FAIL(get_read_tables(param.tablet_id_, snapshot_version, tablet_iter, false))) { + if (OB_FAIL(get_read_tables(param.tablet_id_, timeout_us, snapshot_version, tablet_iter, false))) { if (OB_TABLET_NOT_EXIST != ret) { LOG_WARN("failed to get tablet_iter", K(ret), K(snapshot_version), K(param)); } @@ -5736,6 +5739,7 @@ int ObLSTabletService::estimate_row_count( int ObLSTabletService::estimate_block_count_and_row_count( const common::ObTabletID &tablet_id, + const int64_t timeout_us, int64_t ¯o_block_count, int64_t µ_block_count, int64_t &sstable_row_count, @@ -5753,7 +5757,7 @@ int ObLSTabletService::estimate_block_count_and_row_count( if (IS_NOT_INIT) { ret = OB_NOT_INIT; LOG_WARN("not inited", K(ret), K_(is_inited)); - } else if (OB_FAIL(get_read_tables(tablet_id, INT64_MAX, tablet_iter, false/*allow_no_ready_read*/))) { + } else if (OB_FAIL(get_read_tables(tablet_id, timeout_us, INT64_MAX, tablet_iter, false/*allow_no_ready_read*/))) { LOG_WARN("failed to get read tables", K(ret)); } diff --git a/src/storage/ls/ob_ls_tablet_service.h b/src/storage/ls/ob_ls_tablet_service.h index 2c2e96e6ea..75c8fad0a9 100644 --- a/src/storage/ls/ob_ls_tablet_service.h +++ b/src/storage/ls/ob_ls_tablet_service.h @@ -282,6 +282,7 @@ public: const share::SCN clog_checkpoint_scn = share::SCN::min_scn()); int get_read_tables( const common::ObTabletID &tablet_id, + const int64_t timeout_us, const int64_t snapshot_version, ObTabletTableIterator &iter, const bool allow_no_ready_read = false); @@ -373,11 +374,13 @@ public: const ObLockFlag lock_flag, const bool is_sfu); int get_multi_ranges_cost( - const ObTabletID &tablet_id, + const common::ObTabletID &tablet_id, + const int64_t timeout_us, const common::ObIArray &ranges, int64_t &total_size); int split_multi_ranges( - const ObTabletID &tablet_id, + const common::ObTabletID &tablet_id, + const int64_t timeout_us, const ObIArray &ranges, const int64_t expected_task_count, common::ObIAllocator &allocator, @@ -385,11 +388,13 @@ public: int estimate_row_count( const ObTableScanParam ¶m, const ObTableScanRange &scan_range, - ObIArray &est_records, + const int64_t timeout_us, + common::ObIArray &est_records, int64_t &logical_row_count, int64_t &physical_row_count); int estimate_block_count_and_row_count( const common::ObTabletID &tablet_id, + const int64_t timeout_us, int64_t ¯o_block_count, int64_t µ_block_count, int64_t &sstable_row_count, diff --git a/src/storage/ob_storage_table_guard.cpp b/src/storage/ob_storage_table_guard.cpp index d0ee435557..19d18f59d7 100644 --- a/src/storage/ob_storage_table_guard.cpp +++ b/src/storage/ob_storage_table_guard.cpp @@ -171,6 +171,7 @@ int ObStorageTableGuard::refresh_and_protect_table(ObRelativeTable &relative_tab while (OB_SUCC(ret) && need_to_refresh_table(*iter.table_iter())) { if (OB_FAIL(store_ctx_.ls_->get_tablet_svr()->get_read_tables( tablet_id, + ObTabletCommon::DEFAULT_GET_TABLET_DURATION_US, store_ctx_.mvcc_acc_ctx_.get_snapshot_version().get_val_for_tx(), iter, relative_table.allow_not_ready()))) { diff --git a/src/storage/tablet/ob_tablet_common.h b/src/storage/tablet/ob_tablet_common.h index 73dce53162..b0379b6bdd 100644 --- a/src/storage/tablet/ob_tablet_common.h +++ b/src/storage/tablet/ob_tablet_common.h @@ -14,6 +14,7 @@ #define OCEANBASE_STORAGE_OB_TABLET_COMMON #include +#include "lib/literals/ob_literals.h" namespace oceanbase { @@ -55,8 +56,8 @@ public: static const int64_t BUCKET_LOCK_BUCKET_CNT = 10243L; static const int64_t TABLET_ID_SET_BUCKET_CNT = 10243L; static const int64_t DEFAULT_GET_TABLET_NO_WAIT = 0; // 0s - static const int64_t DEFAULT_GET_TABLET_DURATION_US = 1 * 1000 * 1000; // 1s - static const int64_t DEFAULT_GET_TABLET_DURATION_10_S = 10 * 1000 * 1000; // 10s + static const int64_t DEFAULT_GET_TABLET_DURATION_US = 1_s; + static const int64_t DEFAULT_GET_TABLET_DURATION_10_S = 10_s; static const int64_t FINAL_TX_ID = 0; }; } // namespace storage diff --git a/src/storage/tx_storage/ob_access_service.cpp b/src/storage/tx_storage/ob_access_service.cpp index 46bcf1b5a6..253f4e9819 100644 --- a/src/storage/tx_storage/ob_access_service.cpp +++ b/src/storage/tx_storage/ob_access_service.cpp @@ -1043,7 +1043,8 @@ int ObAccessService::lock_row( int ObAccessService::estimate_row_count( const ObTableScanParam ¶m, const ObTableScanRange &scan_range, - ObIArray &est_records, + const int64_t timeout_us, + common::ObIArray &est_records, int64_t &logical_row_count, int64_t &physical_row_count) const { @@ -1062,10 +1063,10 @@ int ObAccessService::estimate_row_count( ret = OB_ERR_UNEXPECTED; LOG_WARN("ls is unexpected null", K(ret)); } else if (OB_FAIL(ls->get_tablet_svr()->estimate_row_count( - param, scan_range, est_records, - logical_row_count, physical_row_count))) { + param, scan_range, timeout_us, est_records, + logical_row_count, physical_row_count))) { if (OB_TABLET_NOT_EXIST != ret) { - LOG_WARN("failed to estimate row count", K(ret), K(param)); + LOG_WARN("failed to estimate row count", K(ret), K(param), K(scan_range), K(timeout_us)); } } return ret; @@ -1074,6 +1075,7 @@ int ObAccessService::estimate_row_count( int ObAccessService::estimate_block_count_and_row_count( const share::ObLSID &ls_id, const common::ObTabletID &tablet_id, + const int64_t timeout_us, int64_t ¯o_block_count, int64_t µ_block_count, int64_t &sstable_row_count, @@ -1096,9 +1098,11 @@ int ObAccessService::estimate_block_count_and_row_count( ret = OB_ERR_UNEXPECTED; LOG_WARN("ls is unexpected null", K(ret)); } else if (OB_FAIL(ls->get_tablet_svr()->estimate_block_count_and_row_count( - tablet_id, macro_block_count, micro_block_count, sstable_row_count, - memtable_row_count, cg_macro_cnt_arr, cg_micro_cnt_arr))) { - LOG_WARN("failed to estimate block count and row count", K(ret), K(ls_id), K(tablet_id)); + tablet_id, timeout_us, + macro_block_count, micro_block_count, + sstable_row_count, memtable_row_count, + cg_macro_cnt_arr, cg_micro_cnt_arr))) { + LOG_WARN("failed to estimate block count and row count", K(ret), K(ls_id), K(tablet_id), K(timeout_us)); } return ret; } @@ -1106,6 +1110,7 @@ int ObAccessService::estimate_block_count_and_row_count( int ObAccessService::get_multi_ranges_cost( const share::ObLSID &ls_id, const common::ObTabletID &tablet_id, + const int64_t timeout_us, const common::ObIArray &ranges, int64_t &total_size) { @@ -1129,7 +1134,7 @@ int ObAccessService::get_multi_ranges_cost( } else if (OB_ISNULL(tablet_service = ls->get_tablet_svr())) { ret = OB_ERR_UNEXPECTED; LOG_ERROR("tablet service should not be null", K(ret), K(ls_id)); - } else if (OB_FAIL(tablet_service->get_multi_ranges_cost(tablet_id, ranges, total_size))) { + } else if (OB_FAIL(tablet_service->get_multi_ranges_cost(tablet_id, timeout_us, ranges, total_size))) { LOG_WARN("Fail to get multi ranges cost", K(ret), K(ls_id), K(tablet_id)); } return ret; @@ -1186,9 +1191,10 @@ int ObAccessService::revert_scan_iter(ObNewRowIterator *iter) int ObAccessService::split_multi_ranges( const share::ObLSID &ls_id, const common::ObTabletID &tablet_id, + const int64_t timeout_us, const ObIArray &ranges, const int64_t expected_task_count, - ObIAllocator &allocator, + common::ObIAllocator &allocator, ObArrayArray &multi_range_split_array) { int ret = OB_SUCCESS; @@ -1212,7 +1218,8 @@ int ObAccessService::split_multi_ranges( ret = OB_ERR_UNEXPECTED; LOG_ERROR("tablet service should not be null", K(ret), K(ls_id)); } else if (OB_FAIL(tablet_service->split_multi_ranges( - tablet_id, ranges, expected_task_count, allocator, multi_range_split_array))) { + tablet_id, timeout_us, ranges, + expected_task_count, allocator, multi_range_split_array))) { LOG_WARN("Fail to split multi ranges", K(ret), K(ls_id), K(tablet_id)); } return ret; diff --git a/src/storage/tx_storage/ob_access_service.h b/src/storage/tx_storage/ob_access_service.h index 45a78ef4de..af60d3de7d 100644 --- a/src/storage/tx_storage/ob_access_service.h +++ b/src/storage/tx_storage/ob_access_service.h @@ -108,15 +108,17 @@ public: virtual int get_multi_ranges_cost( const share::ObLSID &ls_id, const common::ObTabletID &tablet_id, + const int64_t timeout_us, const common::ObIArray &ranges, int64_t &total_size) override; virtual int split_multi_ranges( const share::ObLSID &ls_id, const common::ObTabletID &tablet_id, - const ObIArray &ranges, + const int64_t timeout_us, + const common::ObIArray &ranges, const int64_t expected_task_count, - ObIAllocator &allocator, - ObArrayArray &multi_range_split_array) override; + common::ObIAllocator &allocator, + common::ObArrayArray &multi_range_split_array) override; // DML interface int delete_rows( @@ -184,12 +186,14 @@ public: int estimate_row_count( const ObTableScanParam ¶m, const ObTableScanRange &scan_range, + const int64_t timeout_us, ObIArray &est_records, int64_t &logical_row_count, int64_t &physical_row_count) const; int estimate_block_count_and_row_count( const share::ObLSID &ls_id, const common::ObTabletID &tablet_id, + const int64_t timeout_us, int64_t ¯o_block_count, int64_t µ_block_count, int64_t &sstable_row_count,