[CP] fix prefix index copy statistics to not text column
This commit is contained in:
parent
45dc20eead
commit
95776db7b0
@ -7429,6 +7429,7 @@ int ObDbmsStats::adjust_text_column_basic_stats(ObExecContext &ctx,
|
||||
ObSEArray<PrefixColumnPair, 4> pairs;
|
||||
ObSEArray<int64_t, 4> text_column_ids;
|
||||
ObSEArray<ObColumnStatParam*, 4> auto_columns;
|
||||
ObSEArray<uint64_t, 1> filter_cols;
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < param.column_params_.count(); ++i) {
|
||||
if (param.column_params_.at(i).is_text_column()) {
|
||||
if (OB_FAIL(auto_columns.push_back(¶m.column_params_.at(i)))) {
|
||||
@ -7438,6 +7439,7 @@ int ObDbmsStats::adjust_text_column_basic_stats(ObExecContext &ctx,
|
||||
}
|
||||
if (OB_SUCC(ret) && !auto_columns.empty()) {
|
||||
if (OB_FAIL(ObDbmsStatsUtils::get_all_prefix_index_text_pairs(schema,
|
||||
filter_cols,
|
||||
pairs))) {
|
||||
LOG_WARN("failed to get all prefix index text pairs", K(ret));
|
||||
} else if (OB_FAIL(ObOptStatMonitorManager::flush_database_monitoring_info(ctx, true, false))) {
|
||||
|
@ -1655,8 +1655,6 @@ int ObDbmsStatsUtils::get_prefix_index_text_pairs(share::schema::ObSchemaGetterG
|
||||
if (OB_ISNULL(schema_guard)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("get unexpected null", K(ret));
|
||||
} else if (OB_FAIL(ObOptimizerUtil::remove_item(func_idxs, ignore_cols))) {
|
||||
LOG_WARN("failed to remove item", K(ret));
|
||||
} else if (func_idxs.empty()) {
|
||||
// do nothing
|
||||
} else if (OB_FAIL(schema_guard->get_table_schema(tenant_id,
|
||||
@ -1667,6 +1665,7 @@ int ObDbmsStatsUtils::get_prefix_index_text_pairs(share::schema::ObSchemaGetterG
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("get unexpected null", K(ret));
|
||||
} else if (OB_FAIL(get_all_prefix_index_text_pairs(*table_schema,
|
||||
ignore_cols,
|
||||
all_text_pairs))) {
|
||||
LOG_WARN("failed to get all prefix index text pairs", K(ret));
|
||||
} else if (all_text_pairs.empty()) {
|
||||
@ -1743,6 +1742,7 @@ int ObDbmsStatsUtils::fetch_need_cancel_async_gather_stats_task(ObIAllocator &al
|
||||
return ret;
|
||||
}
|
||||
int ObDbmsStatsUtils::get_all_prefix_index_text_pairs(const share::schema::ObTableSchema &table_schema,
|
||||
ObIArray<uint64_t> &filter_cols,
|
||||
ObIArray<PrefixColumnPair> &pairs)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
@ -1765,6 +1765,8 @@ int ObDbmsStatsUtils::get_all_prefix_index_text_pairs(const share::schema::ObTab
|
||||
LOG_WARN("failed to get cascaded column ids", K(ret));
|
||||
} else if (ref_column_ids.count() != 1) {
|
||||
// do nothing
|
||||
} else if (ObOptimizerUtil::find_item(filter_cols, ref_column_ids.at(0))) {
|
||||
// do nothing
|
||||
} else if (OB_ISNULL(ref_col = table_schema.get_column_schema(ref_column_ids.at(0)))) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("get unexpected null", K(ret));
|
||||
|
@ -222,6 +222,7 @@ public:
|
||||
ObIArray<uint64_t> &ignore_cols,
|
||||
ObIArray<PrefixColumnPair> &pairs);
|
||||
static int get_all_prefix_index_text_pairs(const share::schema::ObTableSchema &table_schema,
|
||||
ObIArray<uint64_t> &filter_cols,
|
||||
ObIArray<PrefixColumnPair> &filter_pairs);
|
||||
|
||||
static int copy_local_index_prefix_stats_to_text(ObIAllocator &allocator,
|
||||
|
@ -185,7 +185,8 @@ int ObDynamicSampling::add_ds_stat_items_by_dml_info(const ObDSTableParam ¶m
|
||||
if (!need_add) {
|
||||
int64_t origin_modified_count = ds_result_items.at(i).stat_handle_.stat_->get_dml_cnt();
|
||||
int64_t inc_modified_cnt = cur_modified_dml_cnt - origin_modified_count;
|
||||
double inc_ratio = origin_modified_count == 0 ? 0 : inc_modified_cnt * 1.0 / origin_modified_count;
|
||||
origin_modified_count = origin_modified_count < 1 ? 1 : origin_modified_count;
|
||||
double inc_ratio = inc_modified_cnt * 1.0 / origin_modified_count;
|
||||
bool use_col_stat_cache = false;
|
||||
if (inc_ratio <= stale_percent_threshold && need_process_col) {
|
||||
use_col_stat_cache = all_ds_col_stats_are_gathered(param,
|
||||
|
Loading…
x
Reference in New Issue
Block a user