[Feature] Auto extend disk space

This commit is contained in:
obdev
2022-05-25 20:49:58 +08:00
committed by wangzelin.wzl
parent f8f72a41bc
commit d22cee91c3
18 changed files with 511 additions and 160 deletions

View File

@ -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 {

View File

@ -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_;