Merge branch 'pr_1652'

This commit is contained in:
ob-robot
2023-11-16 09:08:09 +00:00
12 changed files with 538 additions and 35 deletions

View File

@ -592,9 +592,10 @@ int ObServerLogBlockMgr::do_load_(const char *log_disk_path)
CLOG_LOG(WARN, "try_continous_do_resize_ failed", K(ret), KPC(this),
K(log_disk_path), K(has_allocated_block_cnt));
} else if (FALSE_IT(time_guard.click("try_continous_to_resize_"))
|| false
|| (false
== check_log_pool_whehter_is_integrity_(has_allocated_block_cnt
* BLOCK_SIZE)) {
* BLOCK_SIZE) &&
OB_FAIL(recover_(has_allocated_block_cnt * BLOCK_SIZE)))) {
ret = OB_ERR_UNEXPECTED;
CLOG_LOG(ERROR, "check_log_pool_whehter_is_integrity_ failed, unexpected error",
K(ret), KPC(this), K(log_disk_path), K(has_allocated_block_cnt));
@ -605,6 +606,32 @@ int ObServerLogBlockMgr::do_load_(const char *log_disk_path)
return ret;
}
int ObServerLogBlockMgr::recover_(const int64_t has_allocated_block_byte_size)
{
int ret = OB_SUCCESS;
if (IS_NOT_INIT) {
ret = OB_NOT_INIT;
CLOG_LOG(WARN, "ObServerLogBlockMGR is not inited", K(ret), KPC(this));
} else {
const int64_t meta_curr_total_size_byte = log_pool_meta_.curr_total_size_;
const int64_t free_size_byte = get_free_size_guarded_by_lock_();
if (meta_curr_total_size_byte == free_size_byte + has_allocated_block_byte_size) {
// do nothing
} else if (meta_curr_total_size_byte > free_size_byte + has_allocated_block_byte_size) {
LogPoolMeta new_log_pool_meta = log_pool_meta_;
new_log_pool_meta.curr_total_size_ = free_size_byte + has_allocated_block_byte_size;
new_log_pool_meta.status_ = EXPANDING_STATUS;
return do_resize_(log_pool_meta_,
calc_block_cnt_by_size_(meta_curr_total_size_byte) -
calc_block_cnt_by_size_(free_size_byte + has_allocated_block_byte_size),
new_log_pool_meta);
} else {
ret = OB_ERR_UNEXPECTED;
}
}
return ret;
}
int ObServerLogBlockMgr::scan_log_disk_dir_(const char *log_disk_path,
int64_t &has_allocated_block_cnt)
{

View File

@ -224,6 +224,7 @@ private:
int prepare_dir_and_create_meta_(const char *log_pool_path,
const char *log_pool_tmp_path);
int do_load_(const char *log_disk_path);
int recover_(const int64_t has_allocated_block_byte_size);
int scan_log_disk_dir_(const char *log_disk_path, int64_t &has_allocated_block_cnt);
int scan_log_pool_dir_and_do_trim_();
int trim_log_pool_dir_and_init_block_id_range_(const BlockIdArray &block_id_array,