fix can't generate parallel rowkey range for empty major

This commit is contained in:
yangqise7en
2024-03-01 03:45:02 +00:00
committed by ob-robot
parent 34adce1719
commit d1a1522962
5 changed files with 14 additions and 4 deletions

View File

@ -64,8 +64,12 @@ int ObLocalIOEvents::get_ith_ret_code(const int64_t i) const
int ObLocalIOEvents::get_ith_ret_bytes(const int64_t i) const int ObLocalIOEvents::get_ith_ret_bytes(const int64_t i) const
{ {
const int64_t res = static_cast<int64_t>(io_events_[i].res); int ret_val = 0;
return (nullptr != io_events_ && i < complete_io_cnt_ && res >= 0) ? static_cast<int32_t>(res) : 0; if (nullptr != io_events_ && i < complete_io_cnt_) {
const int64_t res = static_cast<int64_t>(io_events_[i].res);
ret_val = res >= 0 ? static_cast<int32_t>(res) : 0;
}
return ret_val;
} }
void *ObLocalIOEvents::get_ith_data(const int64_t i) const void *ObLocalIOEvents::get_ith_data(const int64_t i) const

View File

@ -161,7 +161,7 @@ private:
if (__pos < buf_size) { \ if (__pos < buf_size) { \
buf[__pos-1] = '\0'; \ buf[__pos-1] = '\0'; \
} else { \ } else { \
buf[__pos] = '\0'; \ buf[buf_size - 1] = '\0'; \
} \ } \
out_param = info_param; \ out_param = info_param; \
} \ } \

View File

@ -693,15 +693,18 @@ int ObMediumCompactionScheduleFunc::init_parallel_range_and_schema_changed(
} else { } else {
const int64_t macro_block_cnt = first_sstable->get_data_macro_block_count(); const int64_t macro_block_cnt = first_sstable->get_data_macro_block_count();
int64_t inc_row_cnt = 0; int64_t inc_row_cnt = 0;
int64_t inc_macro_cnt = 0;
for (int64_t i = 0; OB_SUCC(ret) && i < result.handle_.get_count(); ++i) { for (int64_t i = 0; OB_SUCC(ret) && i < result.handle_.get_count(); ++i) {
inc_row_cnt += static_cast<const ObSSTable*>(result.handle_.get_table(i))->get_row_count(); inc_row_cnt += static_cast<const ObSSTable*>(result.handle_.get_table(i))->get_row_count();
inc_macro_cnt += static_cast<const ObSSTable*>(result.handle_.get_table(i))->get_data_macro_block_count();
} }
if (OB_FAIL(ret)) { if (OB_FAIL(ret)) {
} else if ((0 == macro_block_cnt && inc_row_cnt > SCHEDULE_RANGE_ROW_COUNT_THRESHOLD) } else if ((0 == macro_block_cnt && inc_row_cnt > SCHEDULE_RANGE_ROW_COUNT_THRESHOLD)
|| (first_sstable->get_row_count() >= SCHEDULE_RANGE_ROW_COUNT_THRESHOLD || (first_sstable->get_row_count() >= SCHEDULE_RANGE_ROW_COUNT_THRESHOLD
&& inc_row_cnt >= first_sstable->get_row_count() * SCHEDULE_RANGE_INC_ROW_COUNT_PERCENRAGE_THRESHOLD)) { && inc_row_cnt >= first_sstable->get_row_count() * SCHEDULE_RANGE_INC_ROW_COUNT_PERCENRAGE_THRESHOLD)) {
if (OB_FAIL(ObParallelMergeCtx::get_concurrent_cnt(tablet_size, macro_block_cnt, expected_task_count))) { const int64_t estimate_macro_cnt = macro_block_cnt + inc_macro_cnt / 5;
if (OB_FAIL(ObParallelMergeCtx::get_concurrent_cnt(tablet_size, estimate_macro_cnt, expected_task_count))) {
STORAGE_LOG(WARN, "failed to get concurrent cnt", K(ret), K(tablet_size), K(expected_task_count), STORAGE_LOG(WARN, "failed to get concurrent cnt", K(ret), K(tablet_size), K(expected_task_count),
KPC(first_sstable)); KPC(first_sstable));
} }

View File

@ -249,6 +249,7 @@ int ObTabletMediumCompactionInfoRecorder::inner_replay_clog(
} else if (OB_FAIL(replay_executor.execute(scn, ls_id_, tablet_id_))) { } else if (OB_FAIL(replay_executor.execute(scn, ls_id_, tablet_id_))) {
if (OB_TABLET_NOT_EXIST == ret || OB_NO_NEED_UPDATE == ret) { if (OB_TABLET_NOT_EXIST == ret || OB_NO_NEED_UPDATE == ret) {
ret = OB_SUCCESS; ret = OB_SUCCESS;
LOG_INFO("skip reply medium info", KR(ret), K(replay_medium_info));
} else { } else {
LOG_WARN("failed to replay medium info", K(ret), K(replay_medium_info)); LOG_WARN("failed to replay medium info", K(ret), K(replay_medium_info));
} }

View File

@ -1101,6 +1101,8 @@ int ObTablet::init_with_update_medium_info(
} else if (FALSE_IT(set_initial_addr())) { } else if (FALSE_IT(set_initial_addr())) {
} else if (OB_FAIL(inner_inc_macro_ref_cnt())) { } else if (OB_FAIL(inner_inc_macro_ref_cnt())) {
LOG_WARN("failed to increase macro ref cnt", K(ret)); LOG_WARN("failed to increase macro ref cnt", K(ret));
} else if (OB_FAIL(check_medium_list())) {
LOG_WARN("failed to check medium list", K(ret), KPC(this));
} else { } else {
ALLOC_AND_INIT(allocator, storage_schema_addr_, *old_storage_schema); ALLOC_AND_INIT(allocator, storage_schema_addr_, *old_storage_schema);
if (OB_FAIL(ret)) { if (OB_FAIL(ret)) {