fixed problems when shrink log disk size
This commit is contained in:
@ -158,7 +158,7 @@ int ObServerLogBlockMgr::start(const int64_t new_size_byte)
|
||||
ret = OB_NOT_INIT;
|
||||
CLOG_LOG(WARN, "ObServerLogBlockMGR is not inited", K(ret), KPC(this));
|
||||
} else if (!check_space_is_enough_(new_size_byte)) {
|
||||
ret = OB_LOG_OUTOF_DISK_SPACE;
|
||||
ret = OB_MACHINE_RESOURCE_NOT_ENOUGH;
|
||||
CLOG_LOG(WARN, "server log disk is too small to hold all tenants or the count of tenants"
|
||||
", log disk space is not enough!!!",
|
||||
K(ret), KPC(this), K(min_log_disk_size_for_all_tenants_), K(new_size_byte));
|
||||
@ -189,27 +189,25 @@ int ObServerLogBlockMgr::resize_(const int64_t new_size_byte)
|
||||
ret = OB_NOT_INIT;
|
||||
CLOG_LOG(ERROR, "ObServerLogBlockMgr has not inited", K(ret), KPC(this),
|
||||
K(new_size_byte), K(aligned_new_size_byte));
|
||||
} else if (new_size_byte < share::ObUnitResource::UNIT_MIN_LOG_DISK_SIZE) {
|
||||
ret = OB_NOT_SUPPORTED;
|
||||
CLOG_LOG(ERROR, "The size of reserved disp space need greater than 1GB!!!", K(ret),
|
||||
KPC(this), K(new_size_byte), K(aligned_new_size_byte));
|
||||
} else if (curr_total_size == aligned_new_size_byte) {
|
||||
CLOG_LOG(TRACE, "no need do resize", K(ret), KPC(this), K(new_size_byte), K(aligned_new_size_byte));
|
||||
} else if (FALSE_IT(new_log_pool_meta.status_ =
|
||||
(aligned_new_size_byte > curr_total_size ? EXPANDING_STATUS
|
||||
: SHRINKING_STATUS))) {
|
||||
} else if (SHRINKING_STATUS == new_log_pool_meta.status_
|
||||
&& free_size_byte < resize_block_cnt * BLOCK_SIZE) {
|
||||
} else if (aligned_new_size_byte < min_log_disk_size_for_all_tenants_) {
|
||||
ret = OB_NOT_SUPPORTED;
|
||||
CLOG_LOG(ERROR, "shrink_block_cnt is greater than free_block_cnt", K(ret), KPC(this),
|
||||
K(resize_block_cnt), "free_block_cnt:", free_size_byte / BLOCK_SIZE);
|
||||
LOG_DBA_ERROR(OB_NOT_SUPPORTED,
|
||||
"possible reason",
|
||||
"new log_disk_size is not enough to hold all tenants, please check the configuration about log disk",
|
||||
"new log disk size(MB)", (new_size_byte+1024*1024-1)/1024/1024,
|
||||
"min log disk size(MB)", (min_log_disk_size_for_all_tenants_+1024*1024-1)/1024/1024);
|
||||
} else if (OB_FAIL(
|
||||
do_resize_(old_log_pool_meta, resize_block_cnt, new_log_pool_meta))) {
|
||||
if (OB_ALLOCATE_DISK_SPACE_FAILED == ret) {
|
||||
LOG_DBA_ERROR(OB_ALLOCATE_DISK_SPACE_FAILED,
|
||||
"possible reason",
|
||||
"may be diskspace is not enough, please check the configuration about log disk",
|
||||
"expected log disk size(MB)", (new_size_byte+1024*1024-1)/1024/1024);
|
||||
"new log disk size(MB)", (new_size_byte+1024*1024-1)/1024/1024);
|
||||
} else {
|
||||
CLOG_LOG(ERROR, "do_resize_ failed", K(ret), KPC(this), K(old_log_pool_meta),
|
||||
K(new_log_pool_meta));
|
||||
@ -343,40 +341,113 @@ void ObServerLogBlockMgr::abort_create_tenant(const int64_t log_disk_size)
|
||||
}
|
||||
}
|
||||
|
||||
int ObServerLogBlockMgr::update_tenant(const int64_t old_log_disk_size, const int64_t new_log_disk_size)
|
||||
int ObServerLogBlockMgr::update_tenant(const int64_t old_log_disk_size,
|
||||
const int64_t new_log_disk_size,
|
||||
int64_t &allowed_new_log_disk_size,
|
||||
logservice::ObLogService *log_service)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObSpinLockGuard guard(resize_lock_);
|
||||
int64_t used_log_disk_size = 0, palf_log_disk_size = 0;
|
||||
bool can_update_log_disk_size_with_expected_log_disk = false;
|
||||
int64_t tmp_log_disk_size = min_log_disk_size_for_all_tenants_;
|
||||
tmp_log_disk_size -= old_log_disk_size;
|
||||
// 'old_log_disk_size' is current log disk size in ObTenant.
|
||||
// 'new_log_disk_size' is the latest log disk size record in __all_unit_config.
|
||||
// 'allowed_new_log_disk_size' is current allowed log disk size when update log disk.
|
||||
//
|
||||
// To avoid overselling, we can not use 'new_log_disk_size' to update unit config which will save in slog.
|
||||
// therefore, we need constuct a virtual log disk size which named with 'allowed_new_log_disk_size'.
|
||||
if (IS_NOT_INIT) {
|
||||
ret = OB_NOT_INIT;
|
||||
CLOG_LOG(WARN, "ObServerLogBlockMGR is not inited", K(old_log_disk_size), K(new_log_disk_size), KPC(this));
|
||||
} else if (old_log_disk_size <= 0 || new_log_disk_size <= 0 || OB_ISNULL(log_service)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
CLOG_LOG(WARN, "invalid argument", K(old_log_disk_size), K(new_log_disk_size), KP(log_service), KPC(this));
|
||||
} else if (OB_FAIL(log_service->get_palf_stable_disk_usage(used_log_disk_size, palf_log_disk_size))) {
|
||||
CLOG_LOG(WARN, "fail to get_palf_stable_disk_usage", K(old_log_disk_size), K(new_log_disk_size));
|
||||
// The standard for determing whether it's in shrinking or expanding status:
|
||||
// 1. If 'palf_log_disk_size' is smaller than or equal to 'new_log_disk_size', it's in expanding status.
|
||||
// 2. If 'palf_log_disk_size' is greater than 'new_log_disk_size', it's in shrinking status.
|
||||
//
|
||||
// For shrinking log disk, we don't update ObTenantConfig of ObTenant to new ObTenantConfig until shrinking successfully.
|
||||
//
|
||||
// NB: All fields of new ObTenantConfig except log_disk_size has been updated in case of shrinking log disk.
|
||||
//
|
||||
// For example:
|
||||
// 1. before shrinkg log disk successfully, and then expand log disk.
|
||||
// - At T1 timestamp, the original log disk is 100G, and update it to 50G, we will construct 'new_unit' with
|
||||
// 100G, but update palf with 50G because original log disk size is greater than new log disk size.
|
||||
// - At T2 timestamp, the log disk size in current ObTenantConfig is 100G, and we update it to 80G, there are
|
||||
// two scenarios:
|
||||
// 1. if 'palf_log_disk_size' which get from palf is 100G, we think palf is still in shrinking status. and we will
|
||||
// construct 'new_unit' with 100G because 'palf_log_disk_size' is greater than new log disk size(80G). but udpate
|
||||
// palf with 80G
|
||||
// 2. if 'palf_log_disk_size' which get from palf is 50G, we think palf has been in normal status. and we will
|
||||
// construct 'new_unit' with 80G because 'palf_log_disk_size' is smaller than new log disk size(80G), but udpate
|
||||
// palf with 80G.
|
||||
} else if (FALSE_IT(can_update_log_disk_size_with_expected_log_disk = (new_log_disk_size >= palf_log_disk_size))) {
|
||||
// For expanding log disk, we can update 'allowed_new_log_disk_size' to 'new_log_disk_size' directlly.
|
||||
} else if (can_update_log_disk_size_with_expected_log_disk && FALSE_IT(allowed_new_log_disk_size = new_log_disk_size)) {
|
||||
// For shrinking log disk, we still update log disk size of 'new_unit' to 'old_log_disk_size'.
|
||||
} else if (!can_update_log_disk_size_with_expected_log_disk && FALSE_IT(allowed_new_log_disk_size = old_log_disk_size)) {
|
||||
} else if ((tmp_log_disk_size += allowed_new_log_disk_size) > get_total_size_guarded_by_lock_()) {
|
||||
ret = OB_MACHINE_RESOURCE_NOT_ENOUGH;
|
||||
CLOG_LOG(WARN, "ObServerLogBlockMGR can not hold any new tenants", KPC(this), K(old_log_disk_size),
|
||||
K(new_log_disk_size), K(allowed_new_log_disk_size), K(tmp_log_disk_size));
|
||||
// case 1: for shrinking log disk, shrinking log disk from 100G to 50G.
|
||||
// - At T1 timestamp, 'new_log_disk_size' is 50G, 'old_log_disk_size' is 100G, 'allowed_new_log_disk_size' is 100G.
|
||||
// the log disk size record in slog is 100G, and we will update log disk size used for palf to 50G, but not update log
|
||||
// disk which has assigned in ObServerLogBlockMGR.
|
||||
// - At T2 timestamp, 'new_log_disk_size' is still 50G, 'old_log_disk_size' is still 100G, however, 'allowed_new_log_disk_size'
|
||||
// is 50G because of shrinking log disk has been successfully, the log disk record in slog is 50G, and then we will update log disk
|
||||
// size used for palf to 50G again but has no effect, log disk assigned in ObServerLogBlockMGR update to 50G(assume there is only one tenant).
|
||||
//
|
||||
// case 2: for expanding log disk, expanding log disk from 100G to 150G.
|
||||
// - At T1 timestamp, 'new_log_disk_size' is 150G, 'old_log_disk_size' is 100G, 'allowed_new_log_disk_size' is 150G.
|
||||
// the log disk size record in slog is 150G, and then, we will update log disk size used for palf to 150G, the log disk
|
||||
// which has assigned in ObServerLogBlockMGR updaet to 150G(assume there is only one tenant).
|
||||
//
|
||||
// case 3: for shrinking log disk, shrinking log disk from 100G to 50G, and then shrinking log disk from 50G to 25G.
|
||||
// - At T1 timestamp, 'new_log_disk_size' is 50G, 'old_log_disk_size' is 100G, 'allowed_new_log_disk_size' is 100G.
|
||||
// the log disk size record in slog is 100G, and we will update log disk size used for palf to 50G, but not update log
|
||||
// disk which has assigned in ObServerLogBlockMGR.
|
||||
// - At T2 timestamp, 'new_log_disk_size' is 25G, 'old_log_disk_size' is still 100G, however, there are two possibility value for
|
||||
// 'allowed_new_log_disk_size':
|
||||
// 1. the value is 100G because of last shrinking log disk has not been successfully, the log disk record in slog is still 100G
|
||||
// and then we will update log disk size used for palf to 25G, but not update log disk assigned in ObServerLogBlockMGR.
|
||||
// At T3 timestamp, 'new_log_disk_size' is 25G, 'old_log_disk_size' is 100G, 'allowed_new_log_disk_size' is 25G,
|
||||
// the log disk record in slog is 25G, the log disk assigned in ObServerLogBlockMGR is 25G.
|
||||
// 2. the value is 50G because of last shrinking log disk has been successfully, the log disk record in slog is 50G
|
||||
// and then we will update log disk size used for palf to 25G, update log disk assigned in ObServerLogBlockMGR to 50G(assume there is only one tenant).
|
||||
// At T3 timestamp, 'new_log_disk_size' is 25G, 'old_log_disk_size' is 100G, 'allowed_new_log_disk_size' is 25G,
|
||||
// the log disk record in slog is 25G, the log disk assigned in ObServerLogBlockMGR is 25G.
|
||||
//
|
||||
// case 4: for shrinking log disk, shrinking log disk from 100G to 50G, and then expanding log disk from 50G to 80G.
|
||||
// - At T1 timestamp, 'new_log_disk_size' is 50G, 'old_log_disk_size' is 100G, 'allowed_new_log_disk_size' is 100G.
|
||||
// the log disk size record in slog is 100G, and we will update log disk size used for palf to 50G, but not update log
|
||||
// disk which has assigned in ObServerLogBlockMGR.
|
||||
// - At T2 timestamp, 'new_log_disk_size' is 80G, 'old_log_disk_size' is still 100G, however, there are two possibility value for
|
||||
// 'allowed_new_log_disk_size':
|
||||
// 1. the value is 100G because of last shrinking log disk has not been successfully, the log disk record in slog is still 100G
|
||||
// and then we will update log disk size used for palf to 80G, but not update log disk assigned in ObServerLogBlockMGR.
|
||||
// At T3 timestamp, 'new_log_disk_size' is 80G, 'old_log_disk_size' is 100G, 'allowed_new_log_disk_size' is 80G,
|
||||
// the log disk record in slog is 80G, the log disk assigned in ObServerLogBlockMGR is 80G.
|
||||
// 2. the value is 80G because of last shrinking log disk has been successfully, the log disk record in slog is 80G
|
||||
// and then we will update log disk size used for palf to 80G, update log disk assigned in ObServerLogBlockMGR to 80G(assume there is only one tenant).
|
||||
// At T3 timestamp, 'new_log_disk_size' is 25G, 'old_log_disk_size' is 100G, 'allowed_new_log_disk_size' is 25G,
|
||||
// the log disk record in slog is 25G, the log disk assigned in ObServerLogBlockMGR is 25G.
|
||||
//
|
||||
} else if (OB_FAIL(log_service->update_log_disk_usage_limit_size(new_log_disk_size))) {
|
||||
CLOG_LOG(WARN, "failed to update_log_disk_usage_limit_size", K(new_log_disk_size), K(old_log_disk_size),
|
||||
K(allowed_new_log_disk_size));
|
||||
} else {
|
||||
ObSpinLockGuard guard(resize_lock_);
|
||||
int64_t tmp_log_disk_size = min_log_disk_size_for_all_tenants_;
|
||||
tmp_log_disk_size -= old_log_disk_size;
|
||||
if ((tmp_log_disk_size +=new_log_disk_size) > get_total_size_guarded_by_lock_()) {
|
||||
ret = OB_MACHINE_RESOURCE_NOT_ENOUGH;
|
||||
CLOG_LOG(ERROR, "ObServerLogBlockMGR can not hold any new tenants",
|
||||
K(ret), KPC(this), K(old_log_disk_size), K(new_log_disk_size));
|
||||
} else {
|
||||
min_log_disk_size_for_all_tenants_ = tmp_log_disk_size;
|
||||
CLOG_LOG(INFO, "ObServerLogBlockMGR update_tenant success", KPC(this), K(old_log_disk_size), K(new_log_disk_size));
|
||||
}
|
||||
min_log_disk_size_for_all_tenants_ = tmp_log_disk_size;
|
||||
CLOG_LOG(INFO, "update_tenant success", KPC(this), K(new_log_disk_size), K(old_log_disk_size),
|
||||
K(allowed_new_log_disk_size));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ObServerLogBlockMgr::abort_update_tenant(const int64_t old_log_disk_size, const int64_t new_log_disk_size)
|
||||
{
|
||||
if (IS_NOT_INIT) {
|
||||
CLOG_LOG_RET(WARN, OB_NOT_INIT, "ObServerLogBlockMGR is not inited", K(old_log_disk_size), K(new_log_disk_size), KPC(this));
|
||||
} else {
|
||||
ObSpinLockGuard guard(resize_lock_);
|
||||
min_log_disk_size_for_all_tenants_ -= old_log_disk_size;
|
||||
min_log_disk_size_for_all_tenants_ += new_log_disk_size;
|
||||
OB_ASSERT(min_log_disk_size_for_all_tenants_ >= 0
|
||||
&& min_log_disk_size_for_all_tenants_ <= get_total_size_guarded_by_lock_());
|
||||
CLOG_LOG(INFO, "ObServerLogBlockMGR abort_update_tenant success", KPC(this), K(old_log_disk_size), K(new_log_disk_size));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObServerLogBlockMgr::remove_tenant(const int64_t log_disk_size)
|
||||
@ -695,17 +766,13 @@ int ObServerLogBlockMgr::try_resize()
|
||||
ret = OB_NOT_RUNNING;
|
||||
CLOG_LOG(WARN, "ObServerLogBlockMgr not running, can not support resize", KPC(this));
|
||||
} else if (OB_FAIL(observer::ObServerUtils::get_log_disk_info_in_config(log_disk_size,
|
||||
log_disk_percentage))) {
|
||||
if (OB_LOG_OUTOF_DISK_SPACE == ret) {
|
||||
CLOG_LOG(ERROR, "log disk size is too large", K(ret), KPC(this),
|
||||
K(log_disk_size), K(log_disk_percentage));
|
||||
log_disk_percentage))) {
|
||||
if (OB_SERVER_OUTOF_DISK_SPACE == ret) {
|
||||
ret = OB_MACHINE_RESOURCE_NOT_ENOUGH;
|
||||
CLOG_LOG(ERROR, "try_resize failed, log disk space is not enough", K(log_disk_size), KPC(this));
|
||||
} else {
|
||||
CLOG_LOG(ERROR, "get_log_disk_info_in_config failed", K(ret), KPC(this),
|
||||
K(log_disk_size), K(log_disk_percentage));
|
||||
CLOG_LOG(ERROR, "get_log_disk_info_in_config failed", K(log_disk_size), KPC(this));
|
||||
}
|
||||
} else if (log_disk_size == get_total_size_guarded_by_lock_()) {
|
||||
} else if (false == check_space_is_enough_(log_disk_size)) {
|
||||
CLOG_LOG(ERROR, "log disk size is not enough to hold all tenants", KPC(this), K(log_disk_size));
|
||||
} else if (OB_FAIL(resize_(log_disk_size))) {
|
||||
CLOG_LOG(ERROR, "ObServerLogBlockMGR resize failed", K(ret), KPC(this));
|
||||
} else {
|
||||
|
||||
@ -29,7 +29,7 @@ namespace oceanbase
|
||||
{
|
||||
namespace logservice
|
||||
{
|
||||
|
||||
class ObLogService;
|
||||
class ObServerLogBlockMgr : public palf::ILogBlockPool
|
||||
{
|
||||
public:
|
||||
@ -187,14 +187,14 @@ public:
|
||||
// @brief before 'update_tenant_log_disk_size' in ObMultiTenant, need update it.
|
||||
// @param[in] the log disk size used by tenant.
|
||||
// @param[in] the log disk size need by tenant.
|
||||
// @param[in] the log disk size allowed by tenant
|
||||
// @param[in] ObLogService*
|
||||
// OB_SUCCESS
|
||||
// OB_MACHINE_RESOURCE_NOT_ENOUGH
|
||||
int update_tenant(const int64_t old_log_disk_size, const int64_t new_log_disk_size);
|
||||
|
||||
// @brief after 'update_tenant_log_disk_size' in ObMultiTenant failed, need rollbakc it.
|
||||
// @param[in] the log disk size need by tenant.
|
||||
// @param[in] the log disk size used by tenant.
|
||||
void abort_update_tenant(const int64_t old_log_disk_size, const int64_t new_log_disk_size);
|
||||
int update_tenant(const int64_t old_log_disk_size,
|
||||
const int64_t new_log_disk_size,
|
||||
int64_t &allowed_log_disk_size,
|
||||
ObLogService *log_service);
|
||||
|
||||
// @brief after 'del_tenant' in ObMultiTenant success, need remove it from ObServerLogBlockMgr
|
||||
// NB: accurately, when tenant not exist in 'omt_', we can remove it from ObServerLogBlockMgr
|
||||
|
||||
@ -169,7 +169,6 @@ int PalfDiskOptionsWrapper::update_disk_options_not_guarded_by_lock_(const PalfD
|
||||
disk_opts_for_stopping_writing_.log_disk_throttling_percentage_ = new_trigger_percentage;
|
||||
disk_opts_for_recycling_blocks_.log_disk_throttling_maximum_duration_ = new_maximum_duration;
|
||||
disk_opts_for_stopping_writing_.log_disk_throttling_maximum_duration_ = new_maximum_duration;
|
||||
|
||||
sequence_++;
|
||||
}
|
||||
return ret;
|
||||
@ -404,7 +403,7 @@ int PalfEnvImpl::create_palf_handle_impl_(const int64_t palf_id,
|
||||
PALF_LOG(WARN, "palf_handle has exist, ignore this request", K(ret), K(palf_id));
|
||||
} else if (false == check_can_create_palf_handle_impl_()) {
|
||||
ret = OB_LOG_OUTOF_DISK_SPACE;
|
||||
PALF_LOG(ERROR, "PalfEnv can not hold more instance", K(ret), KPC(this), K(palf_id));
|
||||
PALF_LOG(WARN, "PalfEnv can not hold more instance", K(ret), KPC(this), K(palf_id));
|
||||
} else if (0 > (pret = snprintf(base_dir, MAX_PATH_SIZE, "%s/%ld", log_dir_, palf_id))) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
PALF_LOG(ERROR, "snprinf failed", K(pret), K(palf_id));
|
||||
@ -709,6 +708,11 @@ int PalfEnvImpl::try_recycle_blocks()
|
||||
const bool curr_diskspace_enough =
|
||||
usable_disk_limit_size_to_stop_writing > total_used_size_byte ? true : false;
|
||||
constexpr int64_t MB = 1024 * 1024LL;
|
||||
const int64_t print_error_log_disk_size =
|
||||
disk_opts_for_stopping_writing.log_disk_usage_limit_size_
|
||||
* disk_opts_for_stopping_writing.log_disk_utilization_threshold_;
|
||||
const bool need_print_error_log =
|
||||
print_error_log_disk_size > total_used_size_byte ? false : true;
|
||||
|
||||
// step1. change SHRINKING_STATUS to normal
|
||||
// 1. when there is no possibility to stop writing,
|
||||
@ -736,23 +740,27 @@ int PalfEnvImpl::try_recycle_blocks()
|
||||
if (diskspace_enough_ != curr_diskspace_enough) {
|
||||
ATOMIC_STORE(&diskspace_enough_, curr_diskspace_enough);
|
||||
}
|
||||
if ((true == need_recycle && false == has_recycled && false == is_shrinking) || false == diskspace_enough_) {
|
||||
|
||||
// NB: print error log when:
|
||||
// 1. write-stop.
|
||||
// 2. the used log disk space exceeded the log disk recycle threshold(stop-write PalfDiskOptions) and there is no recycable block.
|
||||
if ((false == diskspace_enough_) || (true == need_print_error_log && false == has_recycled)) {
|
||||
constexpr int64_t INTERVAL = 1*1000*1000;
|
||||
if (palf_reach_time_interval(INTERVAL, disk_not_enough_print_interval_)) {
|
||||
int tmp_ret = OB_LOG_OUTOF_DISK_SPACE;
|
||||
LOG_DBA_ERROR(OB_LOG_OUTOF_DISK_SPACE, "msg", "log disk space is almost full", "ret", tmp_ret,
|
||||
"total_size(MB)", disk_opts_for_recycling_blocks.log_disk_usage_limit_size_/MB,
|
||||
"used_size(MB)", total_used_size_byte/MB,
|
||||
"used_percent(%)", (total_used_size_byte* 100) / (disk_opts_for_stopping_writing.log_disk_usage_limit_size_ + 1),
|
||||
"warn_size(MB)", (total_size_to_recycle_blocks*disk_opts_for_recycling_blocks.log_disk_utilization_threshold_)/100/MB,
|
||||
"warn_percent(%)", disk_opts_for_recycling_blocks.log_disk_utilization_threshold_,
|
||||
"limit_size(MB)", (total_size_to_recycle_blocks*disk_opts_for_recycling_blocks.log_disk_utilization_limit_threshold_)/100/MB,
|
||||
"limit_percent(%)", disk_opts_for_recycling_blocks.log_disk_utilization_limit_threshold_,
|
||||
"total_unrecyclable_size_byte(MB)", total_unrecyclable_size_byte/MB,
|
||||
"maximum_used_size(MB)", maximum_used_size/MB,
|
||||
"maximum_log_stream", palf_id,
|
||||
"oldest_log_stream", oldest_palf_id,
|
||||
"oldest_scn", oldest_scn);
|
||||
int tmp_ret = OB_LOG_OUTOF_DISK_SPACE;
|
||||
LOG_DBA_ERROR(OB_LOG_OUTOF_DISK_SPACE, "msg", "log disk space is almost full", "ret", tmp_ret,
|
||||
"total_size(MB)", disk_opts_for_recycling_blocks.log_disk_usage_limit_size_/MB,
|
||||
"used_size(MB)", total_used_size_byte/MB,
|
||||
"used_percent(%)", (total_used_size_byte* 100) / (disk_opts_for_stopping_writing.log_disk_usage_limit_size_ + 1),
|
||||
"warn_size(MB)", (total_size_to_recycle_blocks*disk_opts_for_recycling_blocks.log_disk_utilization_threshold_)/100/MB,
|
||||
"warn_percent(%)", disk_opts_for_recycling_blocks.log_disk_utilization_threshold_,
|
||||
"limit_size(MB)", (total_size_to_recycle_blocks*disk_opts_for_recycling_blocks.log_disk_utilization_limit_threshold_)/100/MB,
|
||||
"limit_percent(%)", disk_opts_for_recycling_blocks.log_disk_utilization_limit_threshold_,
|
||||
"total_unrecyclable_size_byte(MB)", total_unrecyclable_size_byte/MB,
|
||||
"maximum_used_size(MB)", maximum_used_size/MB,
|
||||
"maximum_log_stream", palf_id,
|
||||
"oldest_log_stream", oldest_palf_id,
|
||||
"oldest_scn", oldest_scn);
|
||||
}
|
||||
} else {
|
||||
if (REACH_TIME_INTERVAL(2 * 1000 * 1000L)) {
|
||||
@ -886,13 +894,15 @@ int PalfEnvImpl::update_options(const PalfOptions &options)
|
||||
} else if (false == options.is_valid()) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
PALF_LOG(WARN, "invalid argument", K(options));
|
||||
} else if (OB_FAIL(disk_options_wrapper_.update_disk_options(options.disk_options_))) {
|
||||
PALF_LOG(WARN, "update_disk_options failed", K(ret), K(options));
|
||||
} else if (OB_FAIL(log_rpc_.update_transport_compress_options(options.compress_options_))) {
|
||||
PALF_LOG(WARN, "update_transport_compress_options failed", K(ret), K(options));
|
||||
} else if (FALSE_IT(rebuild_replica_log_lag_threshold_ = options.rebuild_replica_log_lag_threshold_)) {
|
||||
} else if (OB_FAIL(check_can_update_log_disk_options_(options.disk_options_))) {
|
||||
PALF_LOG(WARN, "check_can_update_log_disk_options_ failed", K(options));
|
||||
} else if (OB_FAIL(disk_options_wrapper_.update_disk_options(options.disk_options_))) {
|
||||
PALF_LOG(WARN, "update_disk_options failed", K(ret), K(options));
|
||||
} else {
|
||||
rebuild_replica_log_lag_threshold_ = options.rebuild_replica_log_lag_threshold_;
|
||||
PALF_LOG(INFO, "update_palf_options success", K(options));
|
||||
PALF_LOG(INFO, "update_options successs", K(options), KPC(this));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -1315,5 +1325,18 @@ int PalfEnvImpl::init_log_io_worker_config_(const int log_writer_parallelism,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int PalfEnvImpl::check_can_update_log_disk_options_(const PalfDiskOptions &disk_opts)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
const int64_t curr_palf_instance_num = palf_handle_impl_map_.count();
|
||||
const int64_t curr_min_log_disk_size = curr_palf_instance_num * MIN_DISK_SIZE_PER_PALF_INSTANCE;
|
||||
if (disk_opts.log_disk_usage_limit_size_ < curr_min_log_disk_size) {
|
||||
ret = OB_NOT_SUPPORTED;
|
||||
PALF_LOG(WARN, "can not hold current palf instance", K(curr_palf_instance_num),
|
||||
K(curr_min_log_disk_size), K(disk_opts));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // end namespace palf
|
||||
} // end namespace oceanbase
|
||||
|
||||
@ -346,6 +346,8 @@ private:
|
||||
const int64_t tenant_id,
|
||||
LogIOWorkerConfig &config);
|
||||
|
||||
int check_can_update_log_disk_options_(const PalfDiskOptions &disk_options);
|
||||
|
||||
private:
|
||||
typedef common::RWLock RWLock;
|
||||
typedef RWLock::RLockGuard RLockGuard;
|
||||
|
||||
Reference in New Issue
Block a user