add checker for system_memory and memory_limit
This commit is contained in:
parent
d73a417102
commit
0621c4812e
@ -108,7 +108,7 @@ int ObHeartBeatProcess::init_lease_request(ObLeaseRequest &lease_request)
|
||||
lease_request.resource_info_.report_cpu_max_assigned_ = svr_res_assigned.max_cpu_;
|
||||
lease_request.resource_info_.report_mem_assigned_ = svr_res_assigned.memory_size_;
|
||||
lease_request.resource_info_.mem_in_use_ = 0;
|
||||
lease_request.resource_info_.mem_total_ = GCONF.get_server_memory_avail();
|
||||
lease_request.resource_info_.mem_total_ = GMEMCONF.get_server_memory_avail();
|
||||
lease_request.resource_info_.disk_total_
|
||||
= OB_SERVER_BLOCK_MGR.get_total_macro_block_count() * OB_SERVER_BLOCK_MGR.get_macro_block_size();
|
||||
lease_request.resource_info_.disk_in_use_
|
||||
|
@ -1312,6 +1312,8 @@ int ObServer::init_config()
|
||||
// nop
|
||||
} else if (OB_FAIL(config_.strict_check_special())) {
|
||||
LOG_ERROR("some config setting is not valid", KR(ret));
|
||||
} else if (OB_FAIL(GMEMCONF.reload_config(config_))) {
|
||||
LOG_ERROR("reload memory config failed", KR(ret));
|
||||
} else if (OB_FAIL(set_running_mode())) {
|
||||
LOG_ERROR("set running mode failed", KR(ret));
|
||||
} else {
|
||||
@ -1369,7 +1371,7 @@ int ObServer::init_config()
|
||||
int ObServer::set_running_mode()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
const int64_t memory_limit = GCONF.get_server_memory_limit();
|
||||
const int64_t memory_limit = GMEMCONF.get_server_memory_limit();
|
||||
if (memory_limit < lib::ObRunningModeConfig::MINI_MEM_LOWER) {
|
||||
ret = OB_MACHINE_RESOURCE_NOT_ENOUGH;
|
||||
LOG_ERROR("memory limit too small", KR(ret), K(memory_limit));
|
||||
@ -1422,7 +1424,7 @@ int ObServer::init_pre_setting()
|
||||
|
||||
// total memory limit
|
||||
if (OB_SUCC(ret)) {
|
||||
const int64_t limit_memory = config_.get_server_memory_limit();
|
||||
const int64_t limit_memory = GMEMCONF.get_server_memory_limit();
|
||||
const int64_t reserved_memory = std::min(config_.cache_wash_threshold.get_value(),
|
||||
static_cast<int64_t>(static_cast<double>(limit_memory) * KVCACHE_FACTOR));
|
||||
const int64_t reserved_urgent_memory = config_.memory_reserved;
|
||||
@ -1497,7 +1499,7 @@ int ObServer::init_io()
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
static const double IO_MEMORY_RATIO = 0.2;
|
||||
if (OB_FAIL(ObIOManager::get_instance().init(GCONF.get_reserved_server_memory() * IO_MEMORY_RATIO))) {
|
||||
if (OB_FAIL(ObIOManager::get_instance().init(GMEMCONF.get_reserved_server_memory() * IO_MEMORY_RATIO))) {
|
||||
LOG_ERROR("init io manager fail, ", KR(ret));
|
||||
} else {
|
||||
ObIOConfig io_config;
|
||||
|
@ -126,7 +126,8 @@ int ObServerReloadConfig::operator()()
|
||||
}
|
||||
}
|
||||
{
|
||||
const int64_t limit_memory = GCONF.get_server_memory_limit();
|
||||
GMEMCONF.reload_config(GCONF);
|
||||
const int64_t limit_memory = GMEMCONF.get_server_memory_limit();
|
||||
const int64_t reserved_memory = GCONF.cache_wash_threshold;
|
||||
const int64_t reserved_urgent_memory = GCONF.memory_reserved;
|
||||
LOG_INFO("set limit memory", K(limit_memory));
|
||||
@ -172,7 +173,7 @@ int ObServerReloadConfig::operator()()
|
||||
|
||||
|
||||
const int64_t cache_size = GCONF.memory_chunk_cache_size;
|
||||
const int cache_cnt = (cache_size > 0 ? cache_size : GCONF.get_server_memory_limit()) / INTACT_ACHUNK_SIZE;
|
||||
const int cache_cnt = (cache_size > 0 ? cache_size : GMEMCONF.get_server_memory_limit()) / INTACT_ACHUNK_SIZE;
|
||||
lib::AChunkMgr::instance().set_max_chunk_cache_cnt(cache_cnt);
|
||||
if (GCONF.cluster_id.get_value() >= 0) {
|
||||
obrpc::ObRpcNetHandler::CLUSTER_ID = GCONF.cluster_id.get_value();
|
||||
|
@ -83,7 +83,7 @@ int ObAllVirtualServer::inner_get_next_row(ObNewRow *&row)
|
||||
const double cpu_capacity_max = (cpu_capacity * hard_limit) / 100;
|
||||
const double cpu_assigned = svr_res_assigned.min_cpu_;
|
||||
const double cpu_assigned_max = svr_res_assigned.max_cpu_;
|
||||
const int64_t mem_capacity = GCONF.get_server_memory_avail();
|
||||
const int64_t mem_capacity = GMEMCONF.get_server_memory_avail();
|
||||
const int64_t mem_assigned = svr_res_assigned.memory_size_;
|
||||
const int64_t data_disk_capacity =
|
||||
OB_SERVER_BLOCK_MGR.get_total_macro_block_count() * OB_SERVER_BLOCK_MGR.get_macro_block_size();
|
||||
@ -162,7 +162,7 @@ int ObAllVirtualServer::inner_get_next_row(ObNewRow *&row)
|
||||
cur_row_.cells_[i].set_int(ssl_cert_expired_time);
|
||||
break;
|
||||
case MEMORY_LIMIT:
|
||||
cur_row_.cells_[i].set_int(GCONF.get_server_memory_limit());
|
||||
cur_row_.cells_[i].set_int(GMEMCONF.get_server_memory_limit());
|
||||
break;
|
||||
default: {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
|
4
src/share/cache/ob_kv_storecache.cpp
vendored
4
src/share/cache/ob_kv_storecache.cpp
vendored
@ -167,8 +167,8 @@ ObKVGlobalCache &ObKVGlobalCache::get_instance()
|
||||
|
||||
int64_t ObKVGlobalCache::get_suitable_bucket_num()
|
||||
{
|
||||
int64_t server_memory_factor = upper_align(GCONF.get_server_memory_limit(), BASE_SERVER_MEMORY_FACTOR) / BASE_SERVER_MEMORY_FACTOR;
|
||||
int64_t reserved_memory = GCONF.get_reserved_server_memory() * MAX_RESERVED_MEMORY_RATIO;
|
||||
int64_t server_memory_factor = upper_align(GMEMCONF.get_server_memory_limit(), BASE_SERVER_MEMORY_FACTOR) / BASE_SERVER_MEMORY_FACTOR;
|
||||
int64_t reserved_memory = GMEMCONF.get_reserved_server_memory() * MAX_RESERVED_MEMORY_RATIO;
|
||||
int64_t bucket_num = DEFAULT_BUCKET_NUM;
|
||||
for (int64_t bucket_level = MAX_BUCKET_NUM_LEVEL -1; bucket_level > 0; bucket_level--) {
|
||||
if ((1 << bucket_level) > server_memory_factor) {
|
||||
|
@ -31,6 +31,7 @@ namespace oceanbase
|
||||
{
|
||||
namespace common
|
||||
{
|
||||
|
||||
int64_t get_cpu_count()
|
||||
{
|
||||
int64_t cpu_cnt = GCONF.cpu_count;
|
||||
@ -77,46 +78,6 @@ bool ObServerConfig::in_upgrade_mode() const
|
||||
return bret;
|
||||
}
|
||||
|
||||
int64_t ObServerConfig::get_server_memory_limit()
|
||||
{
|
||||
int64_t memory = 0;
|
||||
if (0 != memory_limit.get()) {
|
||||
memory = memory_limit;
|
||||
} else {
|
||||
memory = get_phy_mem_size() * memory_limit_percentage / 100;
|
||||
}
|
||||
return memory;
|
||||
}
|
||||
|
||||
int64_t ObServerConfig::get_server_memory_avail()
|
||||
{
|
||||
return get_server_memory_limit() - get_reserved_server_memory();
|
||||
}
|
||||
|
||||
int64_t ObServerConfig::get_reserved_server_memory()
|
||||
{
|
||||
int64_t system_memory_b = system_memory;
|
||||
if (0 == system_memory_b) {
|
||||
int64_t memory_limit_g = get_server_memory_limit() >> 30;
|
||||
if (memory_limit_g < 4) {
|
||||
OB_LOG(ERROR, "memory_limit with unexpected value", K(memory_limit_g));
|
||||
} else if (memory_limit_g <= 8) {
|
||||
system_memory_b = 2LL << 30;
|
||||
} else if (memory_limit_g <= 16) {
|
||||
system_memory_b = 3LL << 30;
|
||||
} else if (memory_limit_g <= 32) {
|
||||
system_memory_b = 5LL << 30;
|
||||
} else if (memory_limit_g <= 48) {
|
||||
system_memory_b = 7LL << 30;
|
||||
} else if (memory_limit_g <= 64) {
|
||||
system_memory_b = 10LL << 30;
|
||||
} else {
|
||||
system_memory_b = int64_t(15 + 3 * (sqrt(memory_limit_g) - 8)) << 30;
|
||||
}
|
||||
}
|
||||
return system_memory_b;
|
||||
}
|
||||
|
||||
int ObServerConfig::read_config()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
@ -237,6 +198,64 @@ int ObServerConfig::deserialize_with_compat(const char *buf, const int64_t data_
|
||||
return ret;
|
||||
}
|
||||
|
||||
ObServerMemoryConfig::ObServerMemoryConfig()
|
||||
: memory_limit_(0), system_memory_(0)
|
||||
{}
|
||||
|
||||
ObServerMemoryConfig &ObServerMemoryConfig::get_instance()
|
||||
{
|
||||
static ObServerMemoryConfig memory_config;
|
||||
return memory_config;
|
||||
}
|
||||
|
||||
int ObServerMemoryConfig::reload_config(const ObServerConfig& server_config)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
int64_t memory_limit = server_config.memory_limit;
|
||||
if (0 == memory_limit) {
|
||||
memory_limit = get_phy_mem_size() * server_config.memory_limit_percentage / 100;
|
||||
}
|
||||
int64_t system_memory = server_config.system_memory;
|
||||
if (0 == system_memory) {
|
||||
int64_t memory_limit_g = memory_limit >> 30;
|
||||
if (memory_limit_g < 4) {
|
||||
LOG_ERROR("memory_limit with unexpected value", K(memory_limit));
|
||||
} else if (memory_limit_g <= 8) {
|
||||
system_memory = 2LL << 30;
|
||||
} else if (memory_limit_g <= 16) {
|
||||
system_memory = 3LL << 30;
|
||||
} else if (memory_limit_g <= 32) {
|
||||
system_memory = 5LL << 30;
|
||||
} else if (memory_limit_g <= 48) {
|
||||
system_memory = 7LL << 30;
|
||||
} else if (memory_limit_g <= 64) {
|
||||
system_memory = 10LL << 30;
|
||||
} else {
|
||||
system_memory = int64_t(15 + 3 * (sqrt(memory_limit_g) - 8)) << 30;
|
||||
}
|
||||
}
|
||||
if (memory_limit > system_memory) {
|
||||
memory_limit_ = memory_limit;
|
||||
system_memory_ = system_memory;
|
||||
LOG_INFO("update memory_limit or system_memory success",
|
||||
K(memory_limit_), K(system_memory_));
|
||||
} else {
|
||||
ret = OB_INVALID_CONFIG;
|
||||
LOG_ERROR("update memory_limit or system_memory failed",
|
||||
K(memory_limit), K(system_memory));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ObServerMemoryConfig::set_server_memory_limit(int64_t memory_limit)
|
||||
{
|
||||
if (memory_limit > system_memory_) {
|
||||
LOG_INFO("update memory_limit success", K(memory_limit), K(system_memory_));
|
||||
} else {
|
||||
LOG_ERROR("update memory_limit failed", K(memory_limit), K(system_memory_));
|
||||
}
|
||||
}
|
||||
|
||||
OB_DEF_SERIALIZE(ObServerConfig)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
@ -18,6 +18,10 @@
|
||||
|
||||
namespace oceanbase
|
||||
{
|
||||
namespace unittest
|
||||
{
|
||||
class ObSimpleClusterTestBase;
|
||||
}
|
||||
namespace common
|
||||
{
|
||||
class ObISQLClient;
|
||||
@ -46,10 +50,12 @@ const char* const EXTERNAL_KMS_INFO = "external_kms_info";
|
||||
const char* const SSL_EXTERNAL_KMS_INFO = "ssl_external_kms_info";
|
||||
const char* const CLUSTER_ID = "cluster_id";
|
||||
const char* const CLUSTER_NAME = "cluster";
|
||||
class ObServerMemoryConfig;
|
||||
|
||||
class ObServerConfig : public ObCommonConfig
|
||||
{
|
||||
public:
|
||||
friend class ObServerMemoryConfig;
|
||||
int init(const ObSystemConfig &config);
|
||||
static ObServerConfig &get_instance();
|
||||
|
||||
@ -63,13 +69,6 @@ public:
|
||||
// print all config to log file
|
||||
void print() const;
|
||||
|
||||
// server memory limit
|
||||
int64_t get_server_memory_limit();
|
||||
// server memory available for normal tenants
|
||||
int64_t get_server_memory_avail();
|
||||
// server momory reserved for internal usage.
|
||||
int64_t get_reserved_server_memory();
|
||||
|
||||
double get_sys_tenant_default_min_cpu() { return server_cpu_quota_min; }
|
||||
double get_sys_tenant_default_max_cpu() { return server_cpu_quota_max; }
|
||||
|
||||
@ -134,9 +133,29 @@ protected:
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObServerConfig);
|
||||
};
|
||||
|
||||
class ObServerMemoryConfig
|
||||
{
|
||||
public:
|
||||
friend class unittest::ObSimpleClusterTestBase;
|
||||
ObServerMemoryConfig();
|
||||
static ObServerMemoryConfig &get_instance();
|
||||
int reload_config(const ObServerConfig& server_config);
|
||||
int64_t get_server_memory_limit() { return memory_limit_; }
|
||||
int64_t get_reserved_server_memory() { return system_memory_; }
|
||||
int64_t get_server_memory_avail() { return memory_limit_ - system_memory_; }
|
||||
private:
|
||||
// set_server_memory_limit just for mittest
|
||||
void set_server_memory_limit(int64_t memory_limit);
|
||||
private:
|
||||
int64_t memory_limit_;
|
||||
int64_t system_memory_;
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObServerMemoryConfig);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#define GCONF (::oceanbase::common::ObServerConfig::get_instance())
|
||||
|
||||
#define GMEMCONF (::oceanbase::common::ObServerMemoryConfig::get_instance())
|
||||
#endif // OCEANBASE_SHARE_CONFIG_OB_SERVER_CONFIG_H_
|
||||
|
@ -430,7 +430,7 @@ int ObVirtualTenantManager::print_tenant_usage_(
|
||||
}
|
||||
if (OB_SERVER_TENANT_ID == node.tenant_id_) {
|
||||
int64_t observer_tenant_hold = lib::get_tenant_memory_hold(node.tenant_id_);
|
||||
int64_t system_memory = GCONF.get_reserved_server_memory();
|
||||
int64_t system_memory = GMEMCONF.get_reserved_server_memory();
|
||||
if (observer_tenant_hold > system_memory) {
|
||||
if (GCONF._ignore_system_memory_over_limit_error) {
|
||||
COMMON_LOG(WARN, "the hold of observer tenant is over the system_memory", K(observer_tenant_hold), K(system_memory));
|
||||
|
@ -20,26 +20,27 @@
|
||||
#define _OB_CLUSTER_PARAMETER common::Scope::CLUSTER
|
||||
#define _OB_TENANT_PARAMETER common::Scope::TENANT
|
||||
|
||||
#define _DEF_PARAMETER_SCOPE_EASY(param, name, SCOPE, args...) \
|
||||
SCOPE(_DEF_PARAMETER_EASY(param, _ ## SCOPE, name, args))
|
||||
#define _DEF_PARAMETER_SCOPE_RANGE_EASY(param, name, SCOPE, args...) \
|
||||
SCOPE(_DEF_PARAMETER_RANGE_EASY(param, _ ## SCOPE, name, args))
|
||||
#define _DEF_PARAMETER_SCOPE_CHECKER_EASY(param, name, SCOPE, args...) \
|
||||
SCOPE(_DEF_PARAMETER_CHECKER_EASY(param, _ ## SCOPE, name, args))
|
||||
#define _DEF_PARAMETER_SCOPE_EASY(access_specifier, param, name, SCOPE, args...) \
|
||||
SCOPE(_DEF_PARAMETER_EASY(access_specifier, param, _ ## SCOPE, name, args))
|
||||
#define _DEF_PARAMETER_SCOPE_RANGE_EASY(access_specifier, param, name, SCOPE, args...) \
|
||||
SCOPE(_DEF_PARAMETER_RANGE_EASY(access_specifier, param, _ ## SCOPE, name, args))
|
||||
#define _DEF_PARAMETER_SCOPE_CHECKER_EASY(access_specifier, param, name, SCOPE, args...) \
|
||||
SCOPE(_DEF_PARAMETER_CHECKER_EASY(access_specifier, param, _ ## SCOPE, name, args))
|
||||
|
||||
#define _DEF_PARAMETER_SCOPE_IP_EASY(param, name, SCOPE, def, args...) \
|
||||
SCOPE(_DEF_PARAMETER_CHECKER_EASY(param, _ ## SCOPE, name, def, \
|
||||
#define _DEF_PARAMETER_SCOPE_IP_EASY(access_specifier, param, name, SCOPE, def, args...) \
|
||||
SCOPE(_DEF_PARAMETER_CHECKER_EASY(access_specifier, param, _ ## SCOPE, name, def, \
|
||||
common::ObConfigIpChecker, args))
|
||||
#define _DEF_PARAMETER_SCOPE_LOG_LEVEL_EASY(param, name, SCOPE, def, args...) \
|
||||
SCOPE(_DEF_PARAMETER_CHECKER_EASY(param, _ ## SCOPE, name, def, \
|
||||
#define _DEF_PARAMETER_SCOPE_LOG_LEVEL_EASY(access_specifier, param, name, SCOPE, def, args...) \
|
||||
SCOPE(_DEF_PARAMETER_CHECKER_EASY(access_specifier, param, _ ## SCOPE, name, def, \
|
||||
common::ObConfigLogLevelChecker, args))
|
||||
|
||||
#define _DEF_PARAMETER_SCOPE_WORK_AREA_POLICY_EASY(param, name, SCOPE, def, args...) \
|
||||
SCOPE(_DEF_PARAMETER_CHECKER_EASY(param, _ ## SCOPE, name, def, \
|
||||
#define _DEF_PARAMETER_SCOPE_WORK_AREA_POLICY_EASY(access_specifier, param, name, SCOPE, def, args...) \
|
||||
SCOPE(_DEF_PARAMETER_CHECKER_EASY(access_specifier, param, _ ## SCOPE, name, def, \
|
||||
common::ObConfigWorkAreaPolicyChecker, args))
|
||||
|
||||
// TODO: use parameter instead of config
|
||||
#define _DEF_PARAMETER_EASY(param, scope, name, args...) \
|
||||
#define _DEF_PARAMETER_EASY(access_specifier, param, scope, name, args...) \
|
||||
access_specifier: \
|
||||
class ObConfig ## param ## Item ## _ ## name \
|
||||
: public common::ObConfig ## param ## Item \
|
||||
{ \
|
||||
@ -56,7 +57,8 @@
|
||||
TO_STRING_KV(K_(value_str)) \
|
||||
} name;
|
||||
|
||||
#define _DEF_PARAMETER_RANGE_EASY(param, scope, name, args...) \
|
||||
#define _DEF_PARAMETER_RANGE_EASY(access_specifier, param, scope, name, args...) \
|
||||
access_specifier: \
|
||||
class ObConfig ## param ## Item ## _ ## name \
|
||||
: public common::ObConfig ## param ## Item \
|
||||
{ \
|
||||
@ -72,7 +74,8 @@
|
||||
} \
|
||||
} name;
|
||||
|
||||
#define _DEF_PARAMETER_CHECKER_EASY(param, scope, name, def, checker, args...) \
|
||||
#define _DEF_PARAMETER_CHECKER_EASY(access_specifier, param, scope, name, def, checker, args...) \
|
||||
access_specifier: \
|
||||
class ObConfig ## param ## Item ## _ ## name \
|
||||
: public common::ObConfig ## param ## Item \
|
||||
{ \
|
||||
@ -93,54 +96,54 @@
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#define DEF_INT(args...) \
|
||||
_DEF_PARAMETER_SCOPE_RANGE_EASY(Int, args)
|
||||
_DEF_PARAMETER_SCOPE_RANGE_EASY(public, Int, args)
|
||||
|
||||
#define DEF_INT_WITH_CHECKER(args...) \
|
||||
_DEF_PARAMETER_SCOPE_CHECKER_EASY(Int, args)
|
||||
_DEF_PARAMETER_SCOPE_CHECKER_EASY(public, Int, args)
|
||||
|
||||
#define DEF_DBL(args...) \
|
||||
_DEF_PARAMETER_SCOPE_RANGE_EASY(Double, args)
|
||||
_DEF_PARAMETER_SCOPE_RANGE_EASY(public, Double, args)
|
||||
|
||||
#define DEF_CAP(args...) \
|
||||
_DEF_PARAMETER_SCOPE_RANGE_EASY(Capacity, args)
|
||||
_DEF_PARAMETER_SCOPE_RANGE_EASY(public, Capacity, args)
|
||||
|
||||
#define DEF_CAP_WITH_CHECKER(args...) \
|
||||
_DEF_PARAMETER_SCOPE_CHECKER_EASY(Capacity, args)
|
||||
_DEF_PARAMETER_SCOPE_CHECKER_EASY(public, Capacity, args)
|
||||
|
||||
#define DEF_TIME(args...) \
|
||||
_DEF_PARAMETER_SCOPE_RANGE_EASY(Time, args)
|
||||
_DEF_PARAMETER_SCOPE_RANGE_EASY(public, Time, args)
|
||||
|
||||
#define DEF_TIME_WITH_CHECKER(args...) \
|
||||
_DEF_PARAMETER_SCOPE_CHECKER_EASY(Time, args)
|
||||
_DEF_PARAMETER_SCOPE_CHECKER_EASY(public, Time, args)
|
||||
|
||||
#define DEF_BOOL(args...) \
|
||||
_DEF_PARAMETER_SCOPE_EASY(Bool, args)
|
||||
_DEF_PARAMETER_SCOPE_EASY(public, Bool, args)
|
||||
|
||||
#define DEF_STR(args...) \
|
||||
_DEF_PARAMETER_SCOPE_EASY(String, args)
|
||||
_DEF_PARAMETER_SCOPE_EASY(public, String, args)
|
||||
|
||||
#define DEF_STR_WITH_CHECKER(args...) \
|
||||
_DEF_PARAMETER_SCOPE_CHECKER_EASY(String, args)
|
||||
_DEF_PARAMETER_SCOPE_CHECKER_EASY(public, String, args)
|
||||
|
||||
#define DEF_IP(args...) \
|
||||
_DEF_PARAMETER_SCOPE_IP_EASY(String, args)
|
||||
_DEF_PARAMETER_SCOPE_IP_EASY(public, String, args)
|
||||
|
||||
#define DEF_MOMENT(args...) \
|
||||
_DEF_PARAMETER_SCOPE_EASY(Moment, args)
|
||||
_DEF_PARAMETER_SCOPE_EASY(public, Moment, args)
|
||||
|
||||
#define DEF_INT_LIST(args...) \
|
||||
_DEF_PARAMETER_SCOPE_EASY(IntList, args)
|
||||
_DEF_PARAMETER_SCOPE_EASY(public, IntList, args)
|
||||
|
||||
#define DEF_STR_LIST(args...) \
|
||||
_DEF_PARAMETER_SCOPE_EASY(StrList, args)
|
||||
_DEF_PARAMETER_SCOPE_EASY(public, StrList, args)
|
||||
|
||||
#define DEF_LOG_ARCHIVE_OPTIONS_WITH_CHECKER(args...) \
|
||||
_DEF_PARAMETER_SCOPE_CHECKER_EASY(LogArchiveOptions, args)
|
||||
_DEF_PARAMETER_SCOPE_CHECKER_EASY(public, LogArchiveOptions, args)
|
||||
#define DEF_LOG_LEVEL(args...) \
|
||||
_DEF_PARAMETER_SCOPE_LOG_LEVEL_EASY(String, args)
|
||||
_DEF_PARAMETER_SCOPE_LOG_LEVEL_EASY(public, String, args)
|
||||
|
||||
#define DEF_WORK_AREA_POLICY(args...) \
|
||||
_DEF_PARAMETER_SCOPE_WORK_AREA_POLICY_EASY(String, args)
|
||||
_DEF_PARAMETER_SCOPE_WORK_AREA_POLICY_EASY(public, String, args)
|
||||
|
||||
|
||||
|
||||
@ -149,55 +152,55 @@
|
||||
#ifdef ERRSIM
|
||||
|
||||
#define ERRSIM_DEF_INT(args...) \
|
||||
_DEF_PARAMETER_SCOPE_RANGE_EASY(Int, args)
|
||||
_DEF_PARAMETER_SCOPE_RANGE_EASY(public, Int, args)
|
||||
|
||||
#define ERRSIM_DEF_INT_WITH_CHECKER(args...) \
|
||||
_DEF_PARAMETER_SCOPE_CHECKER_EASY(Int, args)
|
||||
_DEF_PARAMETER_SCOPE_CHECKER_EASY(public, Int, args)
|
||||
|
||||
#define ERRSIM_DEF_DBL(args...) \
|
||||
_DEF_PARAMETER_SCOPE_RANGE_EASY(Double, args)
|
||||
_DEF_PARAMETER_SCOPE_RANGE_EASY(public, Double, args)
|
||||
|
||||
#define ERRSIM_DEF_CAP(args...) \
|
||||
_DEF_PARAMETER_SCOPE_RANGE_EASY(Capacity, args)
|
||||
_DEF_PARAMETER_SCOPE_RANGE_EASY(public, Capacity, args)
|
||||
|
||||
#define ERRSIM_DEF_CAP_WITH_CHECKER(args...) \
|
||||
_DEF_PARAMETER_SCOPE_CHECKER_EASY(Capacity, args)
|
||||
_DEF_PARAMETER_SCOPE_CHECKER_EASY(public, Capacity, args)
|
||||
|
||||
#define ERRSIM_DEF_TIME(args...) \
|
||||
_DEF_PARAMETER_SCOPE_RANGE_EASY(Time, args)
|
||||
_DEF_PARAMETER_SCOPE_RANGE_EASY(public, Time, args)
|
||||
|
||||
#define ERRSIM_DEF_TIME_WITH_CHECKER(args...) \
|
||||
_DEF_PARAMETER_SCOPE_CHECKER_EASY(Time, args)
|
||||
_DEF_PARAMETER_SCOPE_CHECKER_EASY(public, Time, args)
|
||||
|
||||
#define ERRSIM_DEF_BOOL(args...) \
|
||||
_DEF_PARAMETER_SCOPE_EASY(Bool, args)
|
||||
_DEF_PARAMETER_SCOPE_EASY(public, Bool, args)
|
||||
|
||||
#define ERRSIM_DEF_STR(args...) \
|
||||
_DEF_PARAMETER_SCOPE_EASY(String, args)
|
||||
_DEF_PARAMETER_SCOPE_EASY(public, String, args)
|
||||
|
||||
#define ERRSIM_DEF_STR_WITH_CHECKER(args...) \
|
||||
_DEF_PARAMETER_SCOPE_CHECKER_EASY(String, args)
|
||||
_DEF_PARAMETER_SCOPE_CHECKER_EASY(public, String, args)
|
||||
|
||||
#define ERRSIM_DEF_IP(args...) \
|
||||
_DEF_PARAMETER_SCOPE_IP_EASY(String, args)
|
||||
_DEF_PARAMETER_SCOPE_IP_EASY(public, String, args)
|
||||
|
||||
#define ERRSIM_DEF_MOMENT(args...) \
|
||||
_DEF_PARAMETER_SCOPE_EASY(Moment, args)
|
||||
_DEF_PARAMETER_SCOPE_EASY(public, Moment, args)
|
||||
|
||||
#define ERRSIM_DEF_INT_LIST(args...) \
|
||||
_DEF_PARAMETER_SCOPE_EASY(IntList, args)
|
||||
_DEF_PARAMETER_SCOPE_EASY(public, IntList, args)
|
||||
|
||||
#define ERRSIM_DEF_STR_LIST(args...) \
|
||||
_DEF_PARAMETER_SCOPE_EASY(StrList, args)
|
||||
_DEF_PARAMETER_SCOPE_EASY(public, StrList, args)
|
||||
|
||||
#define ERRSIM_DEF_LOG_ARCHIVE_OPTIONS_WITH_CHECKER(args...) \
|
||||
_DEF_PARAMETER_SCOPE_CHECKER_EASY(LogArchiveOptions, args)
|
||||
_DEF_PARAMETER_SCOPE_CHECKER_EASY(public, LogArchiveOptions, args)
|
||||
|
||||
#define ERRSIM_DEF_LOG_LEVEL(args...) \
|
||||
_DEF_PARAMETER_SCOPE_LOG_LEVEL_EASY(String, args)
|
||||
_DEF_PARAMETER_SCOPE_LOG_LEVEL_EASY(public, String, args)
|
||||
|
||||
#define ERRSIM_DEF_WORK_AREA_POLICY(args...) \
|
||||
_DEF_PARAMETER_SCOPE_WORK_AREA_POLICY_EASY(String, args)
|
||||
_DEF_PARAMETER_SCOPE_WORK_AREA_POLICY_EASY(public, String, args)
|
||||
|
||||
#else
|
||||
#define ERRSIM_DEF_INT(args...)
|
||||
|
@ -73,14 +73,14 @@ DEF_INT(rdma_io_thread_count, OB_CLUSTER_PARAMETER, "0", "[0,8]",
|
||||
DEF_INT(tenant_task_queue_size, OB_CLUSTER_PARAMETER, "65536", "[1024,]",
|
||||
"the size of the task queue for each tenant. Range: [1024,+∞)",
|
||||
ObParameterAttr(Section::OBSERVER, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
|
||||
DEF_CAP_WITH_CHECKER(memory_limit, OB_CLUSTER_PARAMETER, "0",
|
||||
_DEF_PARAMETER_SCOPE_CHECKER_EASY(private, Capacity, memory_limit, OB_CLUSTER_PARAMETER, "0",
|
||||
common::ObConfigMemoryLimitChecker, "[0M,)",
|
||||
"the size of the memory reserved for internal use(for testing purpose), 0 means follow memory_limit_percentage. Range: 0, [4G,).",
|
||||
ObParameterAttr(Section::OBSERVER, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
|
||||
DEF_CAP(rootservice_memory_limit, OB_CLUSTER_PARAMETER, "2G", "[2G,)",
|
||||
"max memory size which can be used by rs tenant The default value is 2G. Range: [2G,)",
|
||||
ObParameterAttr(Section::OBSERVER, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
|
||||
DEF_CAP(system_memory, OB_CLUSTER_PARAMETER, "0M", "[0M,)",
|
||||
_DEF_PARAMETER_SCOPE_RANGE_EASY(private, Capacity, system_memory, OB_CLUSTER_PARAMETER, "0M", "[0M,)",
|
||||
"the memory reserved for internal use which cannot be allocated to any outer-tenant, "
|
||||
"and should be determined to guarantee every server functions normally. Range: [0M,)",
|
||||
ObParameterAttr(Section::OBSERVER, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
|
||||
|
@ -685,13 +685,13 @@ int ObUnitResource::gen_sys_tenant_default_unit_resource()
|
||||
int ObUnitResource::get_sys_tenant_default_memory(int64_t &memory_size)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
const int64_t server_avail_memory = GCONF.get_server_memory_avail();
|
||||
const int64_t sys_tenant_default_memory_percentage = SYS_TENANT_DEFAULT_MEMORY_PERCENTAGE;
|
||||
const int64_t sys_tenant_default_memory_max = SYS_TENANT_DEFAULT_MEMORY_MAX;
|
||||
const int64_t unit_min_memory = UNIT_MIN_MEMORY;
|
||||
const int64_t __min_full_resource_pool_memory = GCONF.__min_full_resource_pool_memory;
|
||||
const int64_t system_memory = GCONF.get_reserved_server_memory();
|
||||
const int64_t server_memory_limit = GCONF.get_server_memory_limit();
|
||||
const int64_t system_memory = GMEMCONF.get_reserved_server_memory();
|
||||
const int64_t server_memory_limit = GMEMCONF.get_server_memory_limit();
|
||||
const int64_t server_avail_memory = server_memory_limit - system_memory;
|
||||
|
||||
memory_size = 0;
|
||||
|
||||
|
@ -25,7 +25,7 @@ ObMonitorInfoManager::ObMonitorInfoManager()
|
||||
{
|
||||
memory_limit_ = min(
|
||||
MAX_MEMORY_SIZE,
|
||||
static_cast<int64_t>(static_cast<double>(GCONF.get_server_memory_avail()) * MONITOR_MEM_FACTOR));
|
||||
static_cast<int64_t>(static_cast<double>(GMEMCONF.get_server_memory_avail()) * MONITOR_MEM_FACTOR));
|
||||
}
|
||||
|
||||
ObMonitorInfoManager::~ObMonitorInfoManager()
|
||||
|
@ -177,7 +177,7 @@ int ObTenantSSTableMergeInfoMgr::init(const int64_t memory_limit)
|
||||
STORAGE_LOG(WARN, "Invalid argument", K(ret), K(memory_limit));
|
||||
} else {
|
||||
void *buf = NULL;
|
||||
int64_t max_info_cnt = min(GCONF.get_server_memory_limit(), memory_limit) / (sizeof(ObSSTableMergeInfo));
|
||||
int64_t max_info_cnt = min(GMEMCONF.get_server_memory_limit(), memory_limit) / (sizeof(ObSSTableMergeInfo));
|
||||
if (max_info_cnt < 2) {
|
||||
max_info_cnt = 2;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user