From 09484e8c142f8c0876b065522b1d88f8c93e3767 Mon Sep 17 00:00:00 2001 From: 2149 <260391947@qq.com> Date: Wed, 20 Dec 2023 05:53:44 +0000 Subject: [PATCH] [CP] Fix copy_table_stats out of range bug --- src/share/stat/ob_dbms_stats_copy_table_stats.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/share/stat/ob_dbms_stats_copy_table_stats.cpp b/src/share/stat/ob_dbms_stats_copy_table_stats.cpp index 677ce978b2..b44670fa83 100644 --- a/src/share/stat/ob_dbms_stats_copy_table_stats.cpp +++ b/src/share/stat/ob_dbms_stats_copy_table_stats.cpp @@ -47,7 +47,14 @@ int CopyTableStatHelper::copy_part_stat(ObIArray &table_stats) dst_part_stat->set_tablet_id(src_part_stat_->get_tablet_id()); dst_part_stat->set_stat_expired_time(src_part_stat_->get_stat_expired_time()); //TODO:set stale_stats to true for hash/list partitions - if (OB_FAIL(table_stats.push_back(dst_part_stat))) { + if (dst_part_stat->get_row_count() < 0 + || dst_part_stat->get_sstable_row_count() < 0 + || dst_part_stat->get_memtable_row_count() < 0 + || dst_part_stat->get_macro_block_num() < 0 + || dst_part_stat->get_micro_block_num() < 0) { + ret = OB_DATA_OUT_OF_RANGE; + LOG_WARN("data of dst_part_stat out of range", K(ret), K(scale_factor_), KPC(dst_part_stat)); + } else if (OB_FAIL(table_stats.push_back(dst_part_stat))) { LOG_WARN("failed to push back table stats", K(ret)); } else { LOG_TRACE("succeed to copy part stat", KPC(dst_part_stat), K(scale_factor_));