提交 3427f970 编写于 作者: L LINxiansheng 提交者: LINGuanRen

Fix bug 39784090: Its no effect when decrease the datafile_size

上级 a4d3ae7d
......@@ -106,3 +106,7 @@ cmake-build-release
###### OSX dir files
.DS_Store
###### Debug bin and configuration
tools/deploy/bin
tools/deploy/config2.py
......@@ -2299,6 +2299,12 @@ int ObSetConfigResolver::check_param_valid(int64_t tenant_id, const ObString& na
}
#endif
}
else if (0 == name.case_compare("datafile_size")) {
if(OB_FAIL(OB_STORE_FILE.validate_datafile_size(value.ptr()))){
ret = OB_INVALID_CONFIG;
LOG_WARN("datafile_size is not valid", K(ret));
}
}
}
return ret;
}
......
......@@ -1349,6 +1349,30 @@ int ObStoreFile::resize_file(const int64_t new_data_file_size, const int64_t new
return ret;
}
int ObStoreFile::validate_datafile_size(const char* config_data_file_size)
{
int ret = OB_SUCCESS;
if (OB_ISNULL(store_file_system_)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("The OB store file instance is not exist", K(ret));
} else {
bool valid = false;
int64_t new_data_file_size = ObConfigCapacityParser::get(config_data_file_size, valid);
if(!valid){
ret = OB_ERR_PARSE_SQL;
LOG_USER_ERROR(OB_INVALID_CONFIG, "datafile_size can not be parsed");
} else {
const int64_t original_file_size = store_file_system_->get_total_data_size();
if (new_data_file_size < original_file_size) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("datafile_size is smaller than the original configuration", K(ret));
LOG_USER_ERROR(OB_INVALID_CONFIG, "datafile_size can not be smaller than the original configuration");
}
}
}
return ret;
}
int ObStoreFile::alloc_memory(const int64_t total_macro_block_cnt, uint32_t*& free_block_array,
uint64_t*& macro_block_bitmap, ObSegmentArray<ObMacroBlockInfo>& macro_block_info_array)
{
......
......@@ -361,6 +361,7 @@ public:
int drop_disk(const common::ObString& diskgroup_name, const common::ObString& alias_name);
int is_free_block(const int64_t block_index, bool& is_free);
int resize_file(const int64_t new_data_file_size, const int64_t new_data_file_disk_percentage);
int validate_datafile_size(const char* config_data_file_size);
private:
friend class ObStoreFileGCTask;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册