Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Incubator Pegasus
提交
8fb00997
Incubator Pegasus
项目概览
apache
/
Incubator Pegasus
通知
9
Star
5
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Incubator Pegasus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
8fb00997
编写于
9月 24, 2019
作者:
Z
zhao liwei
提交者:
Wu Tao
9月 24, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: change the way to call replication_ddl_client::set_app_envs (#398)
上级
e5fcffd5
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
26 addition
and
15 deletion
+26
-15
rdsn
rdsn
+1
-1
src/shell/commands/table_management.cpp
src/shell/commands/table_management.cpp
+12
-4
src/test/function_test/test_ttl.cpp
src/test/function_test/test_ttl.cpp
+13
-10
未找到文件。
rdsn
@
4928fa56
比较
43478e29
...
4928fa56
Subproject commit 4
3478e298442a810f2bb9be4a5a81db2839c92f1
Subproject commit 4
928fa5668308ce5657709ea1da683b94a2191e5
src/shell/commands/table_management.cpp
浏览文件 @
8fb00997
...
@@ -744,11 +744,19 @@ bool set_app_envs(command_executor *e, shell_context *sc, arguments args)
...
@@ -744,11 +744,19 @@ bool set_app_envs(command_executor *e, shell_context *sc, arguments args)
values
.
emplace_back
(
args
.
argv
[
idx
++
]);
values
.
emplace_back
(
args
.
argv
[
idx
++
]);
}
}
::
dsn
::
error_code
ret
=
sc
->
ddl_client
->
set_app_envs
(
sc
->
current_app_name
,
keys
,
values
);
auto
err_resp
=
sc
->
ddl_client
->
set_app_envs
(
sc
->
current_app_name
,
keys
,
values
);
dsn
::
error_s
err
=
err_resp
.
get_error
();
if
(
ret
!=
::
dsn
::
ERR_OK
)
{
std
::
string
hint_msg
;
fprintf
(
stderr
,
"set app env failed with err = %s
\n
"
,
ret
.
to_string
());
if
(
err
.
is_ok
())
{
err
=
dsn
::
error_s
::
make
(
err_resp
.
get_value
().
err
);
hint_msg
=
err_resp
.
get_value
().
hint_message
;
}
if
(
!
err
.
is_ok
())
{
fmt
::
print
(
stderr
,
"set app envs failed with error {} [hint:
\"
{}
\"
]!
\n
"
,
err
,
hint_msg
);
}
else
{
fmt
::
print
(
stdout
,
"set app envs succeed
\n
"
);
}
}
return
true
;
return
true
;
}
}
...
...
src/test/function_test/test_ttl.cpp
浏览文件 @
8fb00997
...
@@ -37,9 +37,10 @@ void set_default_ttl(int ttl)
...
@@ -37,9 +37,10 @@ void set_default_ttl(int ttl)
std
::
string
env
=
envs
[
TABLE_LEVEL_DEFAULT_TTL
];
std
::
string
env
=
envs
[
TABLE_LEVEL_DEFAULT_TTL
];
if
((
env
.
empty
()
&&
ttl
!=
0
)
||
env
!=
std
::
to_string
(
ttl
))
{
if
((
env
.
empty
()
&&
ttl
!=
0
)
||
env
!=
std
::
to_string
(
ttl
))
{
dsn
::
error_code
ec
=
ddl_client
->
set_app_envs
(
auto
response
=
ddl_client
->
set_app_envs
(
client
->
get_app_name
(),
{
TABLE_LEVEL_DEFAULT_TTL
},
{
std
::
to_string
(
ttl
)});
client
->
get_app_name
(),
{
TABLE_LEVEL_DEFAULT_TTL
},
{
std
::
to_string
(
ttl
)});
ASSERT_EQ
(
ERR_OK
,
ec
);
ASSERT_EQ
(
true
,
response
.
is_ok
());
ASSERT_EQ
(
ERR_OK
,
response
.
get_value
().
err
);
// wait envs to be synced.
// wait envs to be synced.
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
seconds
(
sleep_for_envs_effect
));
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
seconds
(
sleep_for_envs_effect
));
...
@@ -99,10 +100,11 @@ TEST(ttl, set_without_default_ttl)
...
@@ -99,10 +100,11 @@ TEST(ttl, set_without_default_ttl)
ASSERT_EQ
(
ttl_test_value_2
,
value
);
ASSERT_EQ
(
ttl_test_value_2
,
value
);
// trigger a manual compaction
// trigger a manual compaction
dsn
::
error_code
ec
=
ddl_client
->
set_app_envs
(
client
->
get_app_name
(),
auto
response
=
ddl_client
->
set_app_envs
(
client
->
get_app_name
(),
{
MANUAL_COMPACT_ONCE_TRIGGER_TIME_KEY
},
{
MANUAL_COMPACT_ONCE_TRIGGER_TIME_KEY
},
{
std
::
to_string
(
time
(
nullptr
))});
{
std
::
to_string
(
time
(
nullptr
))});
ASSERT_EQ
(
ERR_OK
,
ec
);
ASSERT_EQ
(
true
,
response
.
is_ok
());
ASSERT_EQ
(
ERR_OK
,
response
.
get_value
().
err
);
// wait envs to be synced, and manual lcompaction has been finished.
// wait envs to be synced, and manual lcompaction has been finished.
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
seconds
(
sleep_for_envs_effect
));
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
seconds
(
sleep_for_envs_effect
));
...
@@ -191,10 +193,11 @@ TEST(ttl, set_with_default_ttl)
...
@@ -191,10 +193,11 @@ TEST(ttl, set_with_default_ttl)
ASSERT_EQ
(
ttl_test_value_2
,
value
);
ASSERT_EQ
(
ttl_test_value_2
,
value
);
// trigger a manual compaction
// trigger a manual compaction
dsn
::
error_code
ec
=
ddl_client
->
set_app_envs
(
client
->
get_app_name
(),
auto
response
=
ddl_client
->
set_app_envs
(
client
->
get_app_name
(),
{
MANUAL_COMPACT_ONCE_TRIGGER_TIME_KEY
},
{
MANUAL_COMPACT_ONCE_TRIGGER_TIME_KEY
},
{
std
::
to_string
(
time
(
nullptr
))});
{
std
::
to_string
(
time
(
nullptr
))});
ASSERT_EQ
(
ERR_OK
,
ec
);
ASSERT_EQ
(
true
,
response
.
is_ok
());
ASSERT_EQ
(
ERR_OK
,
response
.
get_value
().
err
);
// wait envs to be synced, and manual compaction has been finished.
// wait envs to be synced, and manual compaction has been finished.
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
seconds
(
sleep_for_envs_effect
));
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
seconds
(
sleep_for_envs_effect
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录