fix async gather table stats overflow collect window

This commit is contained in:
ChangerR 2024-11-21 21:45:25 +00:00 committed by ob-robot
parent e3c3452b9a
commit ffc34e8fd7
4 changed files with 16 additions and 4 deletions

View File

@ -687,7 +687,8 @@ int ObDbmsStatsExecutor::check_need_split_gather(const ObTableStatParam &param,
GatherHelper &gather_helper)
{
int ret = OB_SUCCESS;
int64_t column_cnt = param.get_need_gather_column();
int64_t origin_column_cnt = param.get_need_gather_column();
int64_t column_cnt = origin_column_cnt > MAX_GATHER_COLUMN_COUNT_PER_QUERY ? MAX_GATHER_COLUMN_COUNT_PER_QUERY : origin_column_cnt;
int64_t partition_cnt = param.subpart_stat_param_.need_modify_ ? param.subpart_infos_.count() :
(param.part_stat_param_.need_modify_ ? param.part_infos_.count() + param.approx_part_infos_.count() : 1);
bool need_histgoram = param.subpart_stat_param_.need_modify_ ? param.subpart_stat_param_.gather_histogram_ :
@ -715,7 +716,7 @@ int ObDbmsStatsExecutor::check_need_split_gather(const ObTableStatParam &param,
} else if (max_memory_used <= max_wa_memory_size && (!gather_helper.use_split_part_ || partition_cnt<=1)) {
gather_helper.maximum_gather_col_cnt_ = column_cnt;
gather_helper.maximum_gather_part_cnt_ = partition_cnt;
gather_helper.is_split_gather_ = false;
gather_helper.is_split_gather_ = column_cnt != origin_column_cnt;
gather_helper.gather_vectorize_ = gather_vectorize;
} else {
//firstly, split according the partition
@ -736,7 +737,8 @@ int ObDbmsStatsExecutor::check_need_split_gather(const ObTableStatParam &param,
if (max_memory_used <= max_wa_memory_size) {
gather_helper.maximum_gather_col_cnt_ = column_cnt;
gather_helper.maximum_gather_part_cnt_ = partition_cnt;
gather_helper.is_split_gather_ = origin_partition_cnt != partition_cnt;
gather_helper.is_split_gather_ = origin_partition_cnt != partition_cnt ||
column_cnt != origin_column_cnt;
gather_helper.gather_vectorize_ = gather_vectorize;
} else {
const int64_t MINIMUM_OF_VECTOR_SIZE = 8;
@ -749,7 +751,8 @@ int ObDbmsStatsExecutor::check_need_split_gather(const ObTableStatParam &param,
if (max_memory_used <= max_wa_memory_size) {
gather_helper.maximum_gather_col_cnt_ = column_cnt;
gather_helper.maximum_gather_part_cnt_ = partition_cnt;
gather_helper.is_split_gather_ = origin_partition_cnt != partition_cnt;
gather_helper.is_split_gather_ = origin_partition_cnt != partition_cnt ||
column_cnt != origin_column_cnt;
gather_helper.gather_vectorize_ = gather_vectorize;
} else {
//lastly, split according the column

View File

@ -82,6 +82,7 @@ const int64_t MAXIMUM_BLOCK_CNT_OF_ROW_SAMPLE_GATHER_HYBRID_HIST = 100000;
const int64_t MAXIMUM_ROWS_OF_ROW_SAMPLE_GATHER_HYBRID_HIST = 10000000;
const int64_t MINIMUM_BLOCK_CNT_OF_BLOCK_SAMPLE_HYBRID_HIST = 16;
const static int64_t DEFAULT_AUTO_SAMPLE_ROW_COUNT = 0;
const static int64_t MAX_GATHER_COLUMN_COUNT_PER_QUERY = 128;
enum StatLevel
{

View File

@ -2201,9 +2201,13 @@ int ObLogicalOperator::find_consumer_id_for_shared_expr(const ObIArray<ExprProdu
LOG_WARN("get unexpected null", K(ret));
} else {
for (int64_t i = 0; OB_SUCC(ret) && i < ctx->count(); i++) {
bool need_check_status = (i + 1) % 1000 == 0;
if (OB_ISNULL(ctx->at(i).expr_)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("get unexpected null", K(ret));
} else if (need_check_status &&
OB_FAIL(THIS_WORKER.check_status())) {
LOG_WARN("check status fail", K(ret));
} else if (ObOptimizerUtil::is_point_based_sub_expr(expr, ctx->at(i).expr_)) {
if (OB_INVALID_ID == consumer_id) {
consumer_id = ctx->at(i).consumer_id_;

View File

@ -812,9 +812,13 @@ int ObSelectStmt::check_and_get_same_aggr_item(ObRawExpr *expr,
} else {
bool is_existed = false;
for (int64_t i = 0; OB_SUCC(ret) && !is_existed && i < agg_items_.count(); ++i) {
bool need_check_status = (i + 1) % 1000 == 0;
if (OB_ISNULL(agg_items_.at(i))) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("expr is null", K(ret));
} else if (need_check_status &&
OB_FAIL(THIS_WORKER.check_status())) {
LOG_WARN("failed to check status", K(ret));
} else if (agg_items_.at(i)->same_as(*expr)) {
is_existed = true;
same_aggr = agg_items_.at(i);