提交 d22cee91 编写于 作者: O obdev 提交者: wangzelin.wzl

[Feature] Auto extend disk space

上级 f8f72a41
......@@ -257,6 +257,9 @@ constexpr int OB_INVALID_BACKUP_DEST = -9026;
constexpr int OB_IO_LIMIT = -9061;
constexpr int OB_BACKUP_BACKUP_REACH_COPY_LIMIT = -9062;
constexpr int OB_BACKUP_IO_PROHIBITED = -9063;
constexpr int OB_ERR_RESIZE_FILE_TO_SMALLER = -9100;
constexpr int OB_MARK_BLOCK_INFO_TIMEOUT = -9101;
constexpr int OB_MAX_RAISE_APPLICATION_ERROR = -20000;
constexpr int OB_MIN_RAISE_APPLICATION_ERROR = -20999;
} // namespace common
......
......@@ -99,8 +99,11 @@ int ObHeartBeatProcess::init_lease_request(ObLeaseRequest& lease_request)
lease_request.resource_info_.report_mem_max_assigned_ = cpu_mem_assigned.max_memory_;
lease_request.resource_info_.mem_in_use_ = 0;
lease_request.resource_info_.mem_total_ = GCONF.get_server_memory_avail();
lease_request.resource_info_.disk_total_ =
OB_FILE_SYSTEM.get_total_macro_block_count() * OB_FILE_SYSTEM.get_macro_block_size();
lease_request.resource_info_.disk_actual_ =
OB_FILE_SYSTEM.get_total_macro_block_count() * OB_FILE_SYSTEM.get_macro_block_size();
lease_request.resource_info_.disk_total_ =
OB_FILE_SYSTEM.get_total_macro_block_max_count() * OB_FILE_SYSTEM.get_macro_block_size();
// OB_FILE_SYSTEM.get_total_macro_block_count() * OB_FILE_SYSTEM.get_macro_block_size(); // for auto extend disk size
lease_request.resource_info_.disk_in_use_ =
OB_FILE_SYSTEM.get_used_macro_block_count() * OB_FILE_SYSTEM.get_macro_block_size();
lease_request.resource_info_.partition_cnt_ = partition_cnt;
......
......@@ -560,13 +560,14 @@ private:
};
struct ServerDiskStatistic {
ServerDiskStatistic() : server_(), disk_in_use_(0), disk_total_(0), wild_server_(false)
ServerDiskStatistic() : server_(), disk_in_use_(0), disk_total_(0), wild_server_(false), disk_actual_(0)
{}
void reset()
{
server_.reset();
disk_in_use_ = 0;
disk_total_ = 0;
disk_actual_ = 0;
wild_server_ = false;
}
......@@ -597,13 +598,14 @@ private:
return percent;
}
TO_STRING_KV(K(server_), K(disk_in_use_), K(disk_total_), K(wild_server_));
TO_STRING_KV(K(server_), K(disk_in_use_), K(disk_total_), K(wild_server_), K(disk_actual_));
common::ObAddr server_;
int64_t disk_in_use_;
int64_t disk_total_;
// The permanently offline server and the deleted server are called wild_server_
bool wild_server_;
int64_t disk_actual_;
};
struct ServerDiskStatisticCmp {
......
......@@ -251,7 +251,13 @@ int ObAllServerStat::calc_server_usage(ServerStat& server_stat)
disk_assigned_percent = 100.0 * static_cast<double>(server_stat.get_disk_assigned()) /
static_cast<double>(server_stat.get_disk_total());
}
if (INVALID_TOTAL_RESOURCE == server_stat.get_disk_actual()) {
// do nothing
} else {
server_stat.server_load_.status_.resource_info_.disk_actual_ = static_cast<int64_t>(
static_cast<double>(server_stat.server_load_.status_.resource_info_.disk_actual_) * hard_limit);
}
server_stat.set_cpu_assigned_percent(static_cast<int64_t>(cpu_assigned_percent));
server_stat.set_mem_assigned_percent(static_cast<int64_t>(mem_assigned_percent));
server_stat.set_disk_assigned_percent(static_cast<int64_t>(disk_assigned_percent));
......@@ -356,6 +362,11 @@ int ObAllServerStat::get_full_row(const ObTableSchema* table, ServerStat& server
} else {
ADD_COLUMN(set_int, table, "mem_assigned_percent", server_stat.get_mem_assigned_percent(), columns);
}
if (INVALID_TOTAL_RESOURCE == server_stat.get_disk_actual()) {
ADD_NULL_COLUMN(table, "disk_actual", columns);
} else {
ADD_COLUMN(set_int, table, "disk_actual", server_stat.get_disk_actual(), columns);
}
if (INVALID_TOTAL_RESOURCE == server_stat.get_disk_total()) {
ADD_NULL_COLUMN(table, "disk_total", columns);
} else {
......
......@@ -74,6 +74,10 @@ private:
{
return server_load_.status_.resource_info_.disk_total_;
}
inline int64_t get_disk_actual() const
{
return server_load_.status_.resource_info_.disk_actual_;
}
inline double get_cpu_assigned() const
{
return server_load_.sum_load_.min_cpu_;
......
......@@ -3723,7 +3723,6 @@ int ObInnerTableSchema::all_virtual_server_stat_schema(ObTableSchema &table_sche
false, //is_nullable
false); //is_autoincrement
}
if (OB_SUCC(ret)) {
ADD_COLUMN_SCHEMA("disk_total", //column_name
++column_id, //column_id
......@@ -4252,6 +4251,20 @@ int ObInnerTableSchema::all_virtual_server_stat_schema(ObTableSchema &table_sche
false, //is_nullable
false); //is_autoincrement
}
if (OB_SUCC(ret)) {
ADD_COLUMN_SCHEMA("disk_actual", //column_name
++column_id, //column_id
0, //rowkey_id
0, //index_id
0, //part_key_pos
ObIntType, //column_type
CS_TYPE_INVALID, //column_collation_type
sizeof(int64_t), //column_length
-1, //column_precision
-1, //column_scale
false, //is_nullable
false); //is_autoincrement
}
table_schema.set_index_using_type(USING_HASH);
table_schema.set_row_store_type(FLAT_ROW_STORE);
table_schema.set_store_format(OB_STORE_FORMAT_COMPACT_MYSQL);
......
......@@ -5593,7 +5593,8 @@ def_table_schema(
('cpu_max_assigned', 'double'),
('mem_capacity', 'int'),
('mem_max_assigned', 'int'),
('ssl_key_expired_time', 'int')
('ssl_key_expired_time', 'int'),
('disk_actual', 'int')
],
)
......
......@@ -59,6 +59,7 @@ void ObServerResourceInfo::reset()
mem_total_ = 0;
disk_in_use_ = 0;
disk_total_ = 0;
disk_actual_ = 0;
partition_cnt_ = -1; // compatible with old server
report_cpu_assigned_ = 0;
report_cpu_max_assigned_ = 0;
......@@ -69,7 +70,7 @@ void ObServerResourceInfo::reset()
bool ObServerResourceInfo::is_valid() const
{
return cpu_ > 0 && mem_in_use_ >= 0 && mem_total_ > 0 && disk_in_use_ >= 0 && disk_total_ > 0 &&
partition_cnt_ >= -1 && report_cpu_assigned_ >= 0 && report_cpu_max_assigned_ >= 0 &&
disk_actual_ >= 0 && partition_cnt_ >= -1 && report_cpu_assigned_ >= 0 && report_cpu_max_assigned_ >= 0 &&
report_mem_assigned_ >= 0 && report_mem_max_assigned_ >= 0;
}
......@@ -77,6 +78,7 @@ bool ObServerResourceInfo::operator==(const ObServerResourceInfo& other) const
{
return std::fabs(cpu_ - other.cpu_) < OB_DOUBLE_EPSINON && mem_in_use_ == other.mem_in_use_ &&
mem_total_ == other.mem_total_ && disk_in_use_ == other.disk_in_use_ && disk_total_ == other.disk_total_ &&
disk_actual_ == other.disk_actual_ &&
partition_cnt_ == other.partition_cnt_ &&
std::fabs(report_cpu_assigned_ - other.report_cpu_assigned_) < OB_DOUBLE_EPSINON &&
std::fabs(report_cpu_max_assigned_ - other.report_cpu_max_assigned_) < OB_DOUBLE_EPSINON &&
......@@ -88,6 +90,7 @@ bool ObServerResourceInfo::operator!=(const ObServerResourceInfo& other) const
{
return std::fabs(cpu_ - other.cpu_) > OB_DOUBLE_EPSINON || mem_in_use_ != other.mem_in_use_ ||
mem_total_ != other.mem_total_ || disk_in_use_ != other.disk_in_use_ || disk_total_ != other.disk_total_ ||
disk_actual_ != other.disk_actual_ ||
partition_cnt_ != other.partition_cnt_ ||
std::fabs(report_cpu_assigned_ - other.report_cpu_assigned_) > OB_DOUBLE_EPSINON ||
std::fabs(report_cpu_max_assigned_ - other.report_cpu_max_assigned_) > OB_DOUBLE_EPSINON ||
......@@ -95,8 +98,25 @@ bool ObServerResourceInfo::operator!=(const ObServerResourceInfo& other) const
report_mem_max_assigned_ != other.report_mem_max_assigned_;
}
int ObServerResourceInfo::assign(const ObServerResourceInfo& other)
{
int ret = OB_SUCCESS;
cpu_ = other.cpu_;
mem_in_use_ = other.mem_in_use_;
mem_total_ = other.mem_total_;
disk_in_use_ = other.disk_in_use_;
disk_total_ = other.disk_total_;
partition_cnt_ = other.partition_cnt_;
report_cpu_assigned_ = other.report_cpu_assigned_;
report_cpu_max_assigned_ = other.report_cpu_max_assigned_;
report_mem_assigned_ = other.report_mem_assigned_;
report_mem_max_assigned_ = other.report_mem_max_assigned_;
disk_actual_ = other.disk_actual_;
return ret;
}
OB_SERIALIZE_MEMBER(ObServerResourceInfo, cpu_, mem_in_use_, mem_total_, disk_in_use_, disk_total_, partition_cnt_,
report_cpu_assigned_, report_cpu_max_assigned_, report_mem_assigned_, report_mem_max_assigned_);
report_cpu_assigned_, report_cpu_max_assigned_, report_mem_assigned_, report_mem_max_assigned_, disk_actual_);
ObLeaseRequest::ObLeaseRequest()
{
......
......@@ -78,6 +78,7 @@ public:
double report_cpu_max_assigned_;
int64_t report_mem_assigned_;
int64_t report_mem_max_assigned_;
int64_t disk_actual_; // actual disk use if datafile_maxsize set
ObServerResourceInfo();
void reset();
......@@ -86,7 +87,8 @@ public:
bool operator!=(const ObServerResourceInfo& other) const;
TO_STRING_KV(K_(cpu), K_(mem_in_use), K_(mem_total), K_(disk_in_use), K_(disk_total), K_(partition_cnt),
K_(report_cpu_assigned), K_(report_cpu_max_assigned), K_(report_mem_assigned), K_(report_mem_max_assigned));
K_(report_cpu_assigned), K_(report_cpu_max_assigned), K_(report_mem_assigned), K_(report_mem_max_assigned), K_(disk_actual));
int assign(const ObServerResourceInfo& other);
};
struct ObLeaseRequest {
......
......@@ -141,4 +141,6 @@ TG_DEF(TblCliSqlPool, TblCliSqlPool, "", TG_STATIC, TIMER)
TG_DEF(QueryExecCtxGC, QueryExecCtxGC, "", TG_STATIC, OB_THREAD_POOL, ThreadCountPair(1, 1))
TG_DEF(DtlDfc, DtlDfc, "", TG_STATIC, TIMER)
TG_DEF(DDLRetryGhostIndex, DDLRetryGhostIndex, "", TG_STATIC, TIMER)
TG_DEF(StoreFileAutoExtend, StoreFileAutoExtend, "", TG_STATIC, TIMER)
#endif
......@@ -32,6 +32,16 @@ DEF_STR(redundancy_level, OB_CLUSTER_PARAMETER, "NORMAL",
ObParameterAttr(Section::SSTABLE, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE))
DEF_CAP(datafile_size, OB_CLUSTER_PARAMETER, "0", "[0M,)", "size of the data file. Range: [0, +∞)",
ObParameterAttr(Section::SSTABLE, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
DEF_CAP(datafile_next, OB_CLUSTER_PARAMETER, "0", "[0M,)", "the auto extend step. Range: [0, +∞)",
ObParameterAttr(Section::SSTABLE, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
DEF_CAP(datafile_maxsize, OB_CLUSTER_PARAMETER, "0", "[0M,)", "the auto extend max size. Range: [0, +∞)",
ObParameterAttr(Section::SSTABLE, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
DEF_INT(_datafile_usage_upper_bound_percentage, OB_CLUSTER_PARAMETER, "90", "[5,99]",
"the percentage of disk space usage upper bound to trigger datafile extend. Range: [5,99] in integer",
ObParameterAttr(Section::SSTABLE, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
DEF_INT(_datafile_usage_lower_bound_percentage, OB_CLUSTER_PARAMETER, "10", "[5,99]",
"the percentage of disk space usage lower bound to trigger datafile shrink. Range: [5,99] in integer",
ObParameterAttr(Section::SSTABLE, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
DEF_INT(datafile_disk_percentage, OB_CLUSTER_PARAMETER, "90", "[5,99]",
"the percentage of disk space used by the data files. Range: [5,99] in integer",
ObParameterAttr(Section::SSTABLE, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
......
......@@ -2489,11 +2489,9 @@ 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));
}
else if (OB_FAIL(OB_STORE_FILE.validate_datafile_param(name, value.ptr()))) {
ret = OB_INVALID_CONFIG;
LOG_WARN("datafile_size is not valid", K(ret));
}
}
return ret;
......
......@@ -805,6 +805,35 @@ int64_t ObLocalFileSystem::get_free_macro_block_count() const
return store_file_.get_free_macro_block_count();
}
int64_t ObLocalFileSystem::get_total_macro_block_max_count() const
{
int ret = OB_SUCCESS;
int64_t total_space = 0;
int64_t free_space = 0;
int64_t max_block_count = 0;
int64_t max_block_size;
int64_t datafile_size = GCONF.datafile_size;
int64_t datafile_maxsize = GCONF.datafile_maxsize;
if (OB_FAIL(FileDirectoryUtils::get_disk_space(sstable_dir_, total_space, free_space))) {
STORAGE_LOG(WARN, "Failed to get disk space ", K(ret));
} else if (datafile_size > 0 && data_file_size_ < datafile_maxsize ) {
// get total block count of ssblock file. Further more, if auto extend mode is on,
// and the disk is shared, the volume of disk will not fixed
int64_t actual_disk_max_size = data_file_size_ + free_space;
actual_disk_max_size = actual_disk_max_size < datafile_maxsize ?
actual_disk_max_size : datafile_maxsize;
max_block_size = lower_align(actual_disk_max_size, macro_block_size_);
} else {
max_block_size = lower_align(data_file_size_, macro_block_size_); // cur total block cnt
}
if (OB_SUCC(ret)) {
max_block_count = max_block_size / macro_block_size_;
}
return max_block_count;
}
int ObLocalFileSystem::get_marker_status(ObMacroBlockMarkerStatus& status)
{
return store_file_.get_store_status(status);
......@@ -883,7 +912,8 @@ int ObLocalFileSystem::inner_get_super_block_version(const int64_t offset, int64
return ret;
}
int ObLocalFileSystem::resize_file(const int64_t new_data_file_size, const int64_t new_data_file_disk_percentage)
int ObLocalFileSystem::resize_file(
const int64_t new_data_file_size, const int64_t new_data_file_disk_percentage, const int64_t extend_size)
{
int ret = OB_SUCCESS;
int64_t new_cal_data_file_size = new_data_file_size;
......@@ -891,9 +921,13 @@ int ObLocalFileSystem::resize_file(const int64_t new_data_file_size, const int64
int64_t free_space = 0;
if (OB_FAIL(FileDirectoryUtils::get_disk_space(sstable_dir_, total_space, free_space))) {
STORAGE_LOG(WARN, "Failed to get disk space ", K(ret));
} else if (extend_size > 0) { // auto extend disk size, extend_size default 0
int64_t max_extend_size = free_space;
max_extend_size = extend_size < max_extend_size ? extend_size : max_extend_size;
new_cal_data_file_size = data_file_size_ + max_extend_size;
} else if (new_cal_data_file_size <= 0) {
new_cal_data_file_size = total_space * new_data_file_disk_percentage / 100;
}
}
#ifdef ERRSIM
if (OB_SUCC(ret)) {
ret = E(EventTable::EN_RESIZE_PHYSICAL_FILE_FAILED) OB_SUCCESS;
......@@ -906,8 +940,11 @@ int ObLocalFileSystem::resize_file(const int64_t new_data_file_size, const int64
const int64_t curr_aligned_file_size = lower_align(data_file_size_, macro_block_size_);
const int64_t new_aligned_file_size = lower_align(new_cal_data_file_size, macro_block_size_);
if (curr_aligned_file_size > new_aligned_file_size) {
ret = OB_NOT_SUPPORTED;
LOG_WARN("can not resize file to smaller", K(ret), K(curr_aligned_file_size), K(new_aligned_file_size));
ret = OB_ERR_RESIZE_FILE_TO_SMALLER;
LOG_WARN("can not resize file to smaller",
K(ret),
K(curr_aligned_file_size),
K(new_aligned_file_size));
} else if (curr_aligned_file_size == new_aligned_file_size) {
LOG_INFO("new file size is equal to current file size, do not need to resize file",
K(curr_aligned_file_size),
......@@ -917,11 +954,16 @@ int ObLocalFileSystem::resize_file(const int64_t new_data_file_size, const int64
const int64_t offset = curr_aligned_file_size;
const int64_t delta_size = new_aligned_file_size - curr_aligned_file_size;
if (0 != (sys_ret = ::fallocate(fd_.fd_, 0, offset, delta_size))) {
LOG_WARN("fail to expand file size", K(ret), K(sys_ret), K(offset), K(delta_size), K(errno), KERRMSG);
LOG_WARN("fail to expand file size",
K(ret), K(sys_ret), K(offset), K(delta_size), K(free_space), K(errno), KERRMSG);
} else {
data_file_size_ = new_cal_data_file_size;
datafile_disk_percentage_ = new_data_file_disk_percentage;
LOG_INFO("succeed to resize file", K(data_file_size_), K(datafile_disk_percentage_));
data_file_size_ = new_cal_data_file_size;
datafile_disk_percentage_ = new_data_file_disk_percentage;
LOG_INFO("succeed to resize file",
K(extend_size),
K(delta_size),
K(data_file_size_),
K(datafile_disk_percentage_));
}
}
}
......
......@@ -111,7 +111,8 @@ public:
virtual int get_marker_status(ObMacroBlockMarkerStatus& status) override;
virtual int read_old_super_block(ObSuperBlockV2& super_block) override;
virtual int get_super_block_version(int64_t& super_block_version) override;
virtual int resize_file(const int64_t new_data_file_size, const int64_t new_data_file_disk_percentage) override;
virtual int resize_file(const int64_t new_data_file_size, const int64_t new_data_file_disk_percentage, const int64_t extend_size = 0) override;
virtual int64_t get_total_macro_block_max_count() const override;
OB_INLINE int get_block_file_fd() const { return fd_.fd_; }
......
......@@ -209,6 +209,13 @@ private:
common::ObIOHandle io_handle_;
};
class ObStoreFileAutoExtendTask : public common::ObTimerTask {
public:
ObStoreFileAutoExtendTask();
virtual ~ObStoreFileAutoExtendTask();
virtual void runTimerTask();
};
class ObStoreFileGCTask : public common::ObTimerTask {
public:
ObStoreFileGCTask();
......@@ -348,61 +355,62 @@ public:
int get_macro_block_info(const int64_t block_index, ObMacroBlockInfo& macro_block_info);
int report_bad_block(const MacroBlockId& macro_block_id, const int64_t error_type, const char* error_msg);
int get_bad_block_infos(common::ObArray<ObBadBlockInfo>& bad_block_infos);
OB_INLINE const char* get_store_file_path()
{
return sstable_dir_;
}
OB_INLINE int64_t get_free_macro_block_count() const
{
return free_block_cnt_;
}
OB_INLINE const char* get_store_file_path() { return sstable_dir_; }
OB_INLINE int64_t get_free_macro_block_count() const { return free_block_cnt_; }
int add_disk(
const common::ObString& diskgroup_name, const common::ObString& disk_path, const common::ObString& alias_name);
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);
int validate_datafile_param(const ObString& name, const char* config_data_file_param);
int refresh_block_meta();
private:
friend class ObStoreFileGCTask;
friend class ObFileSystemInspectBadBlockTask;
friend class ObAllMacroIdIterator;
friend class ObStoreFileAutoExtendTask;
ObStoreFile();
virtual ~ObStoreFile();
int alloc_block(ObMacroBlockHandle& macro_handle);
int alloc_block(ObMacroBlockHandle& macro_handle);
int mark_macro_blocks();
int extend_file_size_task();
int auto_extend_file_size();
void free_block(const uint32_t block_idx, bool& is_freed);
int mark_macro_blocks();
void mark_and_sweep();
void ssblock_check_and_extend();
OB_INLINE bool is_valid(const MacroBlockId macro_id);
OB_INLINE void bitmap_set(const int64_t block_idx);
OB_INLINE bool bitmap_test(const int64_t block_idx);
bool is_bad_block(const MacroBlockId& macro_block_id);
int read_checkpoint_and_replay_log(bool& is_replay_old);
void disable_mark_sweep()
{
ATOMIC_SET(&is_mark_sweep_enabled_, false);
}
void enable_mark_sweep()
{
ATOMIC_SET(&is_mark_sweep_enabled_, true);
}
bool is_mark_sweep_enabled()
{
return ATOMIC_LOAD(&is_mark_sweep_enabled_);
}
void disable_mark_sweep() { ATOMIC_SET(&is_mark_sweep_enabled_, false);}
void enable_mark_sweep() { ATOMIC_SET(&is_mark_sweep_enabled_, true);}
bool is_mark_sweep_enabled() { return ATOMIC_LOAD(&is_mark_sweep_enabled_);}
void finish_doing_disk_extend() { ATOMIC_SET(&is_doing_disk_extend_, false);}
void start_doing_disk_extend() { ATOMIC_SET(&is_doing_disk_extend_, true);}
bool is_doing_disk_extend() { return ATOMIC_LOAD(&is_doing_disk_extend_);}
int64_t get_macro_bitmap_array_cnt(const int64_t macro_block_cnt) { return macro_block_cnt / 64 + 1; }
int wait_mark_sweep_finish();
void set_mark_sweep_doing();
void set_mark_sweep_done();
int 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);
int64_t get_macro_bitmap_array_cnt(const int64_t macro_block_cnt)
{
return macro_block_cnt / 64 + 1;
}
private:
static const int64_t RECYCLE_DELAY_US = 5 * 1000 * 1000; // 5s
static const int64_t INSPECT_DELAY_US = 1 * 1000 * 1000; // 1s
static const int64_t RECYCLE_DELAY_US = 5 * 1000 * 1000; // 5s
static const int64_t INSPECT_DELAY_US = 1 * 1000 * 1000; // 1s
static const int64_t AUTOEXTEND_DELAY_US = 1 * 1000 * 1000; // 1s
static const int64_t DATAFILE_NEXT_MIN = 1 * 1024 * 1024 * 1024; // 1G
static const int64_t FREE_BLOCK_LEFT_PERCENTAGE = 5;
static const int64_t AUTO_EXTEND_LEAST_FREE_BLOCK_CNT = 512; // 1G
static const int64_t MARK_BLOCK_INFO_TIMEOUT = RECYCLE_DELAY_US;
bool is_inited_;
bool is_opened_;
char sstable_dir_[common::OB_MAX_FILE_NAME_LENGTH];
......@@ -419,6 +427,7 @@ private:
int64_t cur_meta_array_pos_;
common::ObArray<MacroBlockId> meta_block_ids_[2];
ObStoreFileGCTask gc_task_;
ObStoreFileAutoExtendTask ssblock_auto_extend_task_;
ObFileSystemInspectBadBlockTask inspect_bad_block_task_;
char* print_buffer_;
int64_t print_buffer_size_;
......@@ -431,9 +440,11 @@ private:
ObStoreFileSystem* store_file_system_;
bool is_mark_sweep_enabled_;
bool is_doing_mark_sweep_;
bool is_doing_disk_extend_;
ObThreadCond cond_; // for mark sweep
bool is_fs_support_punch_hole_;
int block_file_fd_;
lib::ObMutex alloc_lock_;
};
OB_INLINE bool ObStoreFile::is_valid(const MacroBlockId macro_id)
......
......@@ -736,6 +736,11 @@ int64_t ObStoreFileSystem::get_total_macro_block_count() const
return super_block_.get_total_macro_block_count();
}
int64_t ObStoreFileSystem::get_total_macro_block_max_count() const
{
return -1;
}
int64_t ObStoreFileSystem::get_free_macro_block_count() const
{
return -1;
......@@ -777,10 +782,11 @@ int ObStoreFileSystem::get_bad_block_infos(common::ObArray<ObBadBlockInfo>& bad_
return OB_SUCCESS;
}
int ObStoreFileSystem::resize_file(const int64_t new_data_file_size, const int64_t new_data_file_disk_percentage)
int ObStoreFileSystem::resize_file(
const int64_t new_data_file_size, const int64_t new_data_file_disk_percentage, const int64_t extend_size)
{
int ret = OB_NOT_SUPPORTED;
UNUSEDx(new_data_file_size, new_data_file_disk_percentage);
UNUSEDx(new_data_file_size, new_data_file_disk_percentage, extend_size);
LOG_WARN("resize file is not supported in current file system", K(ret));
return ret;
}
......
......@@ -399,7 +399,9 @@ public:
{
return super_block_;
}
virtual int resize_file(const int64_t new_data_file_size, const int64_t new_data_file_disk_percentage);
virtual int resize_file(const int64_t new_data_file_size, const int64_t new_data_file_disk_percentage, const int64_t extend_size = 0);
virtual int64_t get_total_macro_block_max_count() const;
VIRTUAL_TO_STRING_KV("ObStoreFileSystem", "empty");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册