diff --git a/src/observer/table_load/control/ob_table_load_control_rpc_executor.cpp b/src/observer/table_load/control/ob_table_load_control_rpc_executor.cpp index 3e966a4af4..0ea1f456e3 100644 --- a/src/observer/table_load/control/ob_table_load_control_rpc_executor.cpp +++ b/src/observer/table_load/control/ob_table_load_control_rpc_executor.cpp @@ -69,6 +69,7 @@ int ObDirectLoadControlPreBeginExecutor::process() param.insert_mode_ = arg_.insert_mode_; param.load_mode_ = arg_.load_mode_; param.compressor_type_ = arg_.compressor_type_; + param.online_sample_percent_ = arg_.online_sample_percent_; if (OB_FAIL(create_table_ctx(param, arg_.ddl_param_, table_ctx))) { LOG_WARN("fail to create table ctx", KR(ret)); } diff --git a/src/observer/table_load/control/ob_table_load_control_rpc_struct.cpp b/src/observer/table_load/control/ob_table_load_control_rpc_struct.cpp index 7c3a554154..7d4d0484a0 100644 --- a/src/observer/table_load/control/ob_table_load_control_rpc_struct.cpp +++ b/src/observer/table_load/control/ob_table_load_control_rpc_struct.cpp @@ -68,7 +68,8 @@ ObDirectLoadControlPreBeginArg::ObDirectLoadControlPreBeginArg() method_(ObDirectLoadMethod::INVALID_METHOD), insert_mode_(ObDirectLoadInsertMode::INVALID_INSERT_MODE), load_mode_(ObDirectLoadMode::INVALID_MODE), - compressor_type_(ObCompressorType::INVALID_COMPRESSOR) + compressor_type_(ObCompressorType::INVALID_COMPRESSOR), + online_sample_percent_(1.) { free_session_ctx_.sessid_ = ObSQLSessionInfo::INVALID_SESSID; } @@ -111,7 +112,8 @@ OB_DEF_SERIALIZE(ObDirectLoadControlPreBeginArg) method_, insert_mode_, load_mode_, - compressor_type_); + compressor_type_, + online_sample_percent_); return ret; } @@ -142,7 +144,8 @@ OB_DEF_DESERIALIZE(ObDirectLoadControlPreBeginArg) method_, insert_mode_, load_mode_, - compressor_type_); + compressor_type_, + online_sample_percent_); return ret; } @@ -175,7 +178,8 @@ OB_DEF_SERIALIZE_SIZE(ObDirectLoadControlPreBeginArg) method_, insert_mode_, load_mode_, - compressor_type_); + compressor_type_, + online_sample_percent_); return len; } diff --git a/src/observer/table_load/control/ob_table_load_control_rpc_struct.h b/src/observer/table_load/control/ob_table_load_control_rpc_struct.h index 48d8849a07..515d64b8c5 100644 --- a/src/observer/table_load/control/ob_table_load_control_rpc_struct.h +++ b/src/observer/table_load/control/ob_table_load_control_rpc_struct.h @@ -172,7 +172,8 @@ public: "method", storage::ObDirectLoadMethod::get_type_string(method_), "insert_mode", storage::ObDirectLoadInsertMode::get_type_string(insert_mode_), "load_mode", storage::ObDirectLoadMode::get_type_string(load_mode_), - K_(compressor_type)); + K_(compressor_type), + K_(online_sample_percent)); public: uint64_t table_id_; @@ -194,6 +195,7 @@ public: storage::ObDirectLoadInsertMode::Type insert_mode_; storage::ObDirectLoadMode::Type load_mode_; ObCompressorType compressor_type_; + double online_sample_percent_; }; class ObDirectLoadControlConfirmBeginArg final diff --git a/src/observer/table_load/ob_table_load_coordinator.cpp b/src/observer/table_load/ob_table_load_coordinator.cpp index 7b5368869e..fd7a0d3648 100644 --- a/src/observer/table_load/ob_table_load_coordinator.cpp +++ b/src/observer/table_load/ob_table_load_coordinator.cpp @@ -445,6 +445,7 @@ int ObTableLoadCoordinator::pre_begin_peers(ObDirectLoadResourceApplyArg &apply_ arg.insert_mode_ = param_.insert_mode_; arg.load_mode_ = param_.load_mode_; arg.compressor_type_ = param_.compressor_type_; + arg.online_sample_percent_ = param_.online_sample_percent_; for (int64_t i = 0; OB_SUCC(ret) && i < all_leader_info_array.count(); ++i) { const ObTableLoadPartitionLocation::LeaderInfo &leader_info = all_leader_info_array.at(i); const ObTableLoadPartitionLocation::LeaderInfo &target_leader_info = diff --git a/src/share/stat/ob_opt_table_stat.cpp b/src/share/stat/ob_opt_table_stat.cpp index 3ddd7bb9de..3f7bb1debe 100644 --- a/src/share/stat/ob_opt_table_stat.cpp +++ b/src/share/stat/ob_opt_table_stat.cpp @@ -25,7 +25,8 @@ OB_DEF_SERIALIZE(ObOptTableStat) { partition_id_, object_type_, row_count_, - avg_row_size_ + avg_row_size_, + sample_size_ ); return ret; } @@ -37,7 +38,8 @@ OB_DEF_SERIALIZE_SIZE(ObOptTableStat) { partition_id_, object_type_, row_count_, - avg_row_size_ + avg_row_size_, + sample_size_ ); return len; } @@ -49,7 +51,8 @@ OB_DEF_DESERIALIZE(ObOptTableStat) { partition_id_, object_type_, row_count_, - avg_row_size_ + avg_row_size_, + sample_size_ ); return ret; } diff --git a/src/sql/engine/cmd/ob_load_data_direct_impl.cpp b/src/sql/engine/cmd/ob_load_data_direct_impl.cpp index 1fd53e1799..6c7a21616c 100644 --- a/src/sql/engine/cmd/ob_load_data_direct_impl.cpp +++ b/src/sql/engine/cmd/ob_load_data_direct_impl.cpp @@ -24,6 +24,7 @@ #include "share/ob_device_manager.h" #include "share/backup/ob_backup_io_adapter.h" #include "observer/table_load/backup/ob_table_load_backup_table.h" +#include "share/stat/ob_dbms_stats_utils.h" namespace oceanbase { @@ -2478,6 +2479,9 @@ int ObLoadDataDirectImpl::init_execute_context() } else if (OB_FAIL(ObDDLUtil::get_temp_store_compress_type( table_compressor_type, execute_param_.parallel_, load_param.compressor_type_))) { LOG_WARN("fail to get tmp store compressor type", KR(ret)); + } else if (OB_FAIL(ObDbmsStatsUtils::get_sys_online_estimate_percent(*ctx_, + load_param.online_sample_percent_))) { + LOG_WARN("fail to get sys online estimate percent", KR(ret)); } else if (OB_FAIL(direct_loader_.init(load_param, execute_param_.column_ids_, &execute_ctx_.exec_ctx_))) { LOG_WARN("fail to init direct loader", KR(ret));