提交 6718bd64 编写于 作者: Y yht0 提交者: wangzelin.wzl

Fix estimating row incorrectly after several minor freeze

上级 dde5e025
......@@ -334,7 +334,6 @@ int ObMicroBlockIndexMgr::cal_border_row_count(const ObStoreRange& range, const
logical_row_count += (row_count_delta_ * count) / micro_count_;
physical_row_count += (row_count_ * count) / micro_count_;
if (row_count_delta_ <= 0) {
const int64_t gap_ratio = 1 + (row_count_delta_ < 0);
const int32_t avg_micro_row_count = row_count_ / micro_count_;
int64_t index = start - index_array_;
const int64_t end_index = end - index_array_;
......@@ -344,14 +343,15 @@ int ObMicroBlockIndexMgr::cal_border_row_count(const ObStoreRange& range, const
gap_size += avg_micro_row_count;
} else {
if (gap_size >= common::OB_SKIP_RANGE_LIMIT) {
physical_row_count -= gap_size * gap_ratio;
physical_row_count -= gap_size;
}
gap_size = 0;
}
}
if (gap_size >= common::OB_SKIP_RANGE_LIMIT) {
physical_row_count -= gap_size * gap_ratio;
physical_row_count -= gap_size;
}
physical_row_count += row_count_delta_;
}
}
return ret;
......@@ -366,7 +366,6 @@ int ObMicroBlockIndexMgr::cal_macro_purged_row_count(int64_t& purged_row_count)
} else if (NULL == mark_deletion_array_) {
} else {
const int64_t avg_micro_row_count = row_count_ / micro_count_;
const int64_t gap_ratio = 1 + (row_count_delta_ < 0);
int64_t gap_size = 0;
purged_row_count = 0;
for (int i = 0; OB_SUCC(ret) && i < micro_count_; ++i) {
......@@ -374,14 +373,15 @@ int ObMicroBlockIndexMgr::cal_macro_purged_row_count(int64_t& purged_row_count)
gap_size += avg_micro_row_count;
} else {
if (gap_size >= common::OB_SKIP_RANGE_LIMIT) {
purged_row_count += gap_size * gap_ratio;
purged_row_count += gap_size;
}
gap_size = 0;
}
}
if (gap_size >= common::OB_SKIP_RANGE_LIMIT) {
purged_row_count += gap_size * gap_ratio;
purged_row_count += gap_size;
}
purged_row_count -= (row_count_delta_ < 0 ? row_count_delta_ : 0);
}
return ret;
}
......
......@@ -589,9 +589,8 @@ int ObMultiVersionSingleScanEstimator::estimate_macro_row_count(const blocksstab
} else {
const int64_t delta = meta.meta_->row_count_delta_;
// if delta < 0, it means this macro block really delete rows already exist in older table
// so we should minus gap_size * 2 from physical row count since rows from older table can
// be skipped
const int64_t gap_ratio = 1 + (delta < 0);
// so if this delta is believable, we should minus gap_size+delta from physical row count
// since rows from older table can be skipped
int64_t macro_purged_row_count = 0;
bool need_reset_gap = false;
if (!(is_left_border || is_right_border)) {
......@@ -599,7 +598,7 @@ int ObMultiVersionSingleScanEstimator::estimate_macro_row_count(const blocksstab
part_est.physical_row_count_ += meta.meta_->row_count_;
if (meta.meta_->macro_block_deletion_flag_) {
gap_size += meta.meta_->row_count_;
purged_phy_row_count += meta.meta_->row_count_ * gap_ratio;
purged_phy_row_count += meta.meta_->row_count_ - (delta < 0 ? delta : 0);
} else {
need_reset_gap = true;
if (delta <= 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册