Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
大炮V587
oceanbase
提交
323d256e
O
oceanbase
项目概览
大炮V587
/
oceanbase
与 Fork 源项目一致
Fork自
oceanbase / oceanbase
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
oceanbase
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
323d256e
编写于
3月 06, 2023
作者:
O
obdev
提交者:
ob-robot
3月 06, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support tenant config compatible dump to file before effective in memory
上级
a4019517
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
103 addition
and
20 deletion
+103
-20
src/observer/omt/ob_tenant_config.cpp
src/observer/omt/ob_tenant_config.cpp
+41
-12
src/observer/omt/ob_tenant_config.h
src/observer/omt/ob_tenant_config.h
+1
-0
src/observer/omt/ob_tenant_config_mgr.cpp
src/observer/omt/ob_tenant_config_mgr.cpp
+21
-4
src/observer/omt/ob_tenant_config_mgr.h
src/observer/omt/ob_tenant_config_mgr.h
+2
-1
src/share/config/ob_config.cpp
src/share/config/ob_config.cpp
+2
-1
src/share/config/ob_config.h
src/share/config/ob_config.h
+20
-1
src/share/config/ob_server_config.h
src/share/config/ob_server_config.h
+1
-0
src/share/config/ob_system_config.cpp
src/share/config/ob_system_config.cpp
+15
-1
未找到文件。
src/observer/omt/ob_tenant_config.cpp
浏览文件 @
323d256e
...
...
@@ -347,7 +347,7 @@ int ObTenantConfig::update_local(int64_t expected_version, ObMySQLProxy::MySQLRe
if
(
OB_SUCC
(
ret
))
{
if
(
OB_FAIL
(
read_config
()))
{
LOG_ERROR
(
"Read tenant config failed"
,
K_
(
tenant_id
),
K
(
ret
));
}
else
if
(
save2file
&&
OB_FAIL
(
config_mgr_
->
dump2file
()))
{
}
else
if
(
save2file
&&
OB_FAIL
(
config_mgr_
->
dump2file
(
tenant_id_
)))
{
LOG_WARN
(
"Dump to file failed"
,
K
(
ret
));
}
print
();
...
...
@@ -357,6 +357,23 @@ int ObTenantConfig::update_local(int64_t expected_version, ObMySQLProxy::MySQLRe
return
ret
;
}
int
ObTenantConfig
::
read_dump_config
(
int64_t
tenant_id
)
{
int
ret
=
OB_SUCCESS
;
ObConfigItem
*
const
*
pp_item
=
NULL
;
DRWLock
::
WRLockGuardRetryTimeout
guard
(
lock_
,
LOCK_TIMEOUT
);
if
(
OB_ISNULL
(
pp_item
=
container_
.
get
(
ObConfigStringKey
(
COMPATIBLE
))))
{
ret
=
OB_INVALID_CONFIG
;
LOG_WARN
(
"Invalid config string"
,
K
(
tenant_id
),
K
(
ret
));
}
else
if
(
!
(
*
pp_item
)
->
set_value
((
*
pp_item
)
->
spfile_str
()))
{
ret
=
OB_INVALID_CONFIG
;
LOG_WARN
(
"Invalid config value"
,
K
(
tenant_id
),
K
((
*
pp_item
)
->
spfile_str
()),
K
(
ret
));
}
else
{
LOG_INFO
(
"read dump config succ"
,
K
(
tenant_id
),
K
((
*
pp_item
)
->
spfile_str
()),
K
((
*
pp_item
)
->
str
()));
}
return
ret
;
}
int
ObTenantConfig
::
add_extra_config
(
const
char
*
config_str
,
int64_t
version
/* = 0 */
,
bool
check_name
/* = false */
)
...
...
@@ -381,6 +398,7 @@ int ObTenantConfig::add_extra_config(const char *config_str,
buf
[
config_str_length
]
=
'\0'
;
DRWLock
::
WRLockGuardRetryTimeout
guard
(
lock_
,
LOCK_TIMEOUT
);
token
=
STRTOK_R
(
buf
,
",
\n
"
,
&
saveptr
);
const
ObString
compatible_cfg
(
COMPATIBLE
);
while
(
OB_SUCC
(
ret
)
&&
OB_LIKELY
(
NULL
!=
token
))
{
char
*
saveptr_one
=
NULL
;
const
char
*
name
=
NULL
;
...
...
@@ -411,20 +429,31 @@ int ObTenantConfig::add_extra_config(const char *config_str,
LOG_WARN
(
"Invalid config string, no such config item"
,
K
(
name
),
K
(
value
),
K
(
ret
));
}
if
(
OB_FAIL
(
ret
)
||
OB_ISNULL
(
pp_item
))
{
}
else
if
(
!
(
*
pp_item
)
->
set_value
(
value
))
{
ret
=
OB_INVALID_CONFIG
;
LOG_WARN
(
"Invalid config value"
,
K
(
name
),
K
(
value
),
K
(
ret
));
}
else
if
(
!
(
*
pp_item
)
->
check
())
{
ret
=
OB_INVALID_CONFIG
;
const
char
*
range
=
(
*
pp_item
)
->
range
();
if
(
OB_ISNULL
(
range
)
||
strlen
(
range
)
==
0
)
{
LOG_ERROR
(
"Invalid config, value out of range"
,
K
(
name
),
K
(
value
),
K
(
ret
));
}
else
if
(
compatible_cfg
.
case_compare
(
name
)
==
0
)
{
if
(
!
(
*
pp_item
)
->
set_dump_value
(
value
))
{
ret
=
OB_INVALID_CONFIG
;
LOG_WARN
(
"Invalid config value"
,
K
(
name
),
K
(
value
),
K
(
ret
));
}
else
{
_LOG_ERROR
(
"Invalid config, value out of %s (for reference only). name=%s, value=%s, ret=%d"
,
range
,
name
,
value
,
ret
);
(
*
pp_item
)
->
set_dump_value_updated
();
(
*
pp_item
)
->
set_version
(
version
);
LOG_INFO
(
"Load tenant config dump value succ"
,
K
(
name
),
K
((
*
pp_item
)
->
spfile_str
()),
K
((
*
pp_item
)
->
str
()));
}
}
else
{
(
*
pp_item
)
->
set_version
(
version
);
LOG_INFO
(
"Load tenant config succ"
,
K
(
name
),
K
(
value
));
if
(
!
(
*
pp_item
)
->
set_value
(
value
))
{
ret
=
OB_INVALID_CONFIG
;
LOG_WARN
(
"Invalid config value"
,
K
(
name
),
K
(
value
),
K
(
ret
));
}
else
if
(
!
(
*
pp_item
)
->
check
())
{
ret
=
OB_INVALID_CONFIG
;
const
char
*
range
=
(
*
pp_item
)
->
range
();
if
(
OB_ISNULL
(
range
)
||
strlen
(
range
)
==
0
)
{
LOG_ERROR
(
"Invalid config, value out of range"
,
K
(
name
),
K
(
value
),
K
(
ret
));
}
else
{
_LOG_ERROR
(
"Invalid config, value out of %s (for reference only). name=%s, value=%s, ret=%d"
,
range
,
name
,
value
,
ret
);
}
}
else
{
(
*
pp_item
)
->
set_version
(
version
);
LOG_INFO
(
"Load tenant config succ"
,
K
(
name
),
K
(
value
));
}
}
token
=
STRTOK_R
(
NULL
,
",
\n
"
,
&
saveptr
);
}
...
...
src/observer/omt/ob_tenant_config.h
浏览文件 @
323d256e
...
...
@@ -85,6 +85,7 @@ public:
int
wrunlock
();
int
read_config
();
int
read_dump_config
(
int64_t
tenant_id
);
uint64_t
get_tenant_id
()
const
{
return
tenant_id_
;
}
int64_t
get_current_version
()
const
{
return
current_version_
;
}
const
TenantConfigUpdateTask
&
get_update_task
()
const
{
return
update_task_
;
}
...
...
src/observer/omt/ob_tenant_config_mgr.cpp
浏览文件 @
323d256e
...
...
@@ -256,7 +256,7 @@ int ObTenantConfigMgr::init_tenant_config(const obrpc::ObTenantConfigArg &arg)
LOG_WARN
(
"fail to add tenant config"
,
KR
(
ret
),
K
(
arg
));
}
else
if
(
OB_FAIL
(
add_extra_config
(
arg
)))
{
LOG_WARN
(
"fail to add extra config"
,
KR
(
ret
),
K
(
arg
));
}
else
if
(
OB_FAIL
(
dump2file
()))
{
}
else
if
(
OB_FAIL
(
dump2file
(
arg
.
tenant_id_
)))
{
LOG_WARN
(
"fail to dump config to file"
,
KR
(
ret
),
K
(
arg
));
}
return
ret
;
...
...
@@ -418,11 +418,28 @@ void ObTenantConfigMgr::print() const
}
// for
}
int
ObTenantConfigMgr
::
dump2file
(
const
char
*
path
)
const
int
ObTenantConfigMgr
::
dump2file
(
const
int64_t
tenant_id
)
{
int
ret
=
OB_SUCCESS
;
if
(
OB_SUCC
(
sys_config_mgr_
->
dump2file
(
path
)))
{
ret
=
sys_config_mgr_
->
config_backup
();
if
(
OB_FAIL
(
sys_config_mgr_
->
dump2file
()))
{
LOG_WARN
(
"failed to dump2file"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
sys_config_mgr_
->
config_backup
()))
{
LOG_WARN
(
"failed to dump2file backup"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
read_dump_config
(
tenant_id
)))
{
LOG_WARN
(
"failed to read_dump_config"
,
K
(
ret
));
}
return
ret
;
}
int
ObTenantConfigMgr
::
read_dump_config
(
int64_t
tenant_id
)
{
int
ret
=
OB_SUCCESS
;
DRWLock
::
RDLockGuard
guard
(
rwlock_
);
ObTenantConfig
*
config
=
nullptr
;
if
(
OB_FAIL
(
config_map_
.
get_refactored
(
ObTenantID
(
tenant_id
),
config
)))
{
LOG_WARN
(
"No tenant config found"
,
K
(
tenant_id
),
K
(
ret
));
}
else
{
ret
=
config
->
read_dump_config
(
tenant_id
);
}
return
ret
;
}
...
...
src/observer/omt/ob_tenant_config_mgr.h
浏览文件 @
323d256e
...
...
@@ -131,7 +131,8 @@ public:
int64_t
get_tenant_newest_version
(
uint64_t
tenant_id
)
const
;
int64_t
get_tenant_current_version
(
uint64_t
tenant_id
)
const
;
void
print
()
const
;
int
dump2file
(
const
char
*
path
=
nullptr
)
const
;
int
dump2file
(
const
int64_t
tenant_id
=
0
);
int
read_dump_config
(
const
int64_t
tenant_id
);
void
refresh_config_version_map
(
const
common
::
ObIArray
<
uint64_t
>
&
tenants
);
void
reset_version_has_refreshed
()
{
version_has_refreshed_
=
false
;
}
...
...
src/share/config/ob_config.cpp
浏览文件 @
323d256e
...
...
@@ -56,11 +56,12 @@ const char *log_archive_encryption_algorithm_values[] =
// ObConfigItem
ObConfigItem
::
ObConfigItem
()
:
ck_
(
NULL
),
version_
(
0
),
dumped_version_
(
0
),
inited_
(
false
),
initial_value_set_
(
false
),
value_updated_
(
false
),
value_valid_
(
false
),
name_str_
(
nullptr
),
info_str_
(
nullptr
),
value_updated_
(
false
),
dump_value_updated_
(
false
),
value_valid_
(
false
),
name_str_
(
nullptr
),
info_str_
(
nullptr
),
range_str_
(
nullptr
),
lock_
()
{
MEMSET
(
value_str_
,
0
,
sizeof
(
value_str_
));
MEMSET
(
value_reboot_str_
,
0
,
sizeof
(
value_reboot_str_
));
MEMSET
(
value_dump_str_
,
0
,
sizeof
(
value_dump_str_
));
}
ObConfigItem
::~
ObConfigItem
()
...
...
src/share/config/ob_config.h
浏览文件 @
323d256e
...
...
@@ -106,6 +106,21 @@ public:
ret
=
databuff_printf
(
value_reboot_str_
,
sizeof
(
value_reboot_str_
),
pos
,
"%s"
,
str
);
return
ret
==
OB_SUCCESS
;
}
bool
set_dump_value
(
const
char
*
str
)
{
int64_t
pos
=
0
;
int
ret
=
OB_SUCCESS
;
ret
=
databuff_printf
(
value_dump_str_
,
sizeof
(
value_dump_str_
),
pos
,
"%s"
,
str
);
return
ret
==
OB_SUCCESS
;
}
void
set_dump_value_updated
()
{
dump_value_updated_
=
true
;
}
bool
dump_value_updated
()
const
{
return
dump_value_updated_
;
}
void
set_value_updated
()
{
value_updated_
=
true
;
...
...
@@ -138,7 +153,9 @@ public:
{
const
char
*
ret
=
nullptr
;
ObLatchRGuard
rd_guard
(
const_cast
<
ObLatch
&>
(
lock_
),
ObLatchIds
::
CONFIG_LOCK
);
if
(
reboot_effective
()
&&
is_initial_value_set
())
{
if
(
dump_value_updated
())
{
ret
=
value_dump_str_
;
}
else
if
(
reboot_effective
()
&&
is_initial_value_set
())
{
ret
=
value_reboot_str_
;
}
else
{
ret
=
value_str_
;
...
...
@@ -191,9 +208,11 @@ protected:
bool
inited_
;
bool
initial_value_set_
;
bool
value_updated_
;
bool
dump_value_updated_
;
bool
value_valid_
;
char
value_str_
[
OB_MAX_CONFIG_VALUE_LEN
];
char
value_reboot_str_
[
OB_MAX_CONFIG_VALUE_LEN
];
char
value_dump_str_
[
OB_MAX_CONFIG_VALUE_LEN
];
const
char
*
name_str_
;
const
char
*
info_str_
;
const
char
*
range_str_
;
...
...
src/share/config/ob_server_config.h
浏览文件 @
323d256e
...
...
@@ -52,6 +52,7 @@ const char* const CLUSTER_ID = "cluster_id";
const
char
*
const
CLUSTER_NAME
=
"cluster"
;
const
char
*
const
FREEZE_TRIGGER_PERCENTAGE
=
"freeze_trigger_percentage"
;
const
char
*
const
WRITING_THROTTLEIUNG_TRIGGER_PERCENTAGE
=
"writing_throttling_trigger_percentage"
;
const
char
*
const
COMPATIBLE
=
"compatible"
;
class
ObServerMemoryConfig
;
class
ObServerConfig
:
public
ObCommonConfig
...
...
src/share/config/ob_system_config.cpp
浏览文件 @
323d256e
...
...
@@ -12,6 +12,7 @@
#include "share/config/ob_system_config.h"
#include "share/config/ob_config.h"
#include "share/config/ob_server_config.h"
namespace
oceanbase
{
...
...
@@ -342,7 +343,20 @@ int ObSystemConfig::read_config(const ObSystemConfigKey &key,
}
}
if
(
item
.
reboot_effective
())
{
const
ObString
compatible_cfg
(
COMPATIBLE
);
if
(
compatible_cfg
.
case_compare
(
key
.
name
())
==
0
)
{
if
(
!
item
.
set_dump_value
(
pvalue
->
value
()))
{
ret
=
OB_ERR_UNEXPECTED
;
SHARE_LOG
(
WARN
,
"set config item dump value failed"
,
K
(
ret
),
K
(
key
.
name
()),
K
(
pvalue
->
value
()),
K
(
version
));
}
else
{
item
.
set_value_updated
();
item
.
set_dump_value_updated
();
item
.
set_version
(
version
);
SHARE_LOG
(
INFO
,
"set config item dump value success"
,
K
(
ret
),
K
(
key
.
name
()),
K
(
item
.
spfile_str
()),
K
(
item
.
str
()),
K
(
version
));
}
}
else
if
(
item
.
reboot_effective
())
{
// 以 STATIC_EFFECTIVE 的 stack_size 举例说明:
// > show parameters like 'stack_size'
// stack_size = 4M
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录