Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Incubator Pegasus
提交
2e0afc75
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 搜索 >>
提交
2e0afc75
编写于
3月 02, 2020
作者:
W
Wu Tao
提交者:
neverchanje
3月 31, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(shell): mlog_dump support parsing check_and_set (#485)
上级
c5e98eb9
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
51 addition
and
23 deletion
+51
-23
src/base/idl_utils.h
src/base/idl_utils.h
+24
-0
src/idl/recompile_thrift.sh
src/idl/recompile_thrift.sh
+1
-1
src/idl/rrdb.thrift.annotations
src/idl/rrdb.thrift.annotations
+0
-20
src/shell/commands/data_operations.cpp
src/shell/commands/data_operations.cpp
+2
-2
src/shell/commands/debugger.cpp
src/shell/commands/debugger.cpp
+24
-0
未找到文件。
src/base/idl_utils.h
0 → 100644
浏览文件 @
2e0afc75
// Copyright (c) 2017, Xiaomi, Inc. All rights reserved.
// This source code is licensed under the Apache License Version 2.0, which
// can be found in the LICENSE file in the root directory of this source tree.
#pragma once
namespace
pegasus
{
inline
std
::
string
cas_check_type_to_string
(
dsn
::
apps
::
cas_check_type
::
type
type
)
{
using
namespace
dsn
::
apps
;
auto
it
=
_cas_check_type_VALUES_TO_NAMES
.
find
(
type
);
if
(
it
==
_cas_check_type_VALUES_TO_NAMES
.
end
())
{
return
std
::
string
(
"INVALID="
)
+
std
::
to_string
(
int
(
type
));
}
return
it
->
second
;
}
inline
bool
cas_is_check_operand_needed
(
dsn
::
apps
::
cas_check_type
::
type
type
)
{
return
type
>=
dsn
::
apps
::
cas_check_type
::
CT_VALUE_MATCH_ANYWHERE
;
}
}
// namespace pegasus
src/idl/recompile_thrift.sh
浏览文件 @
2e0afc75
...
...
@@ -13,7 +13,7 @@ TMP_DIR=./tmp
rm
-rf
$TMP_DIR
mkdir
-p
$TMP_DIR
$DSN_ROOT
/
bin/Linux
/thrift
--gen
cpp:moveable_types
-out
$TMP_DIR
rrdb.thrift
$DSN_ROOT
/
thirdparty/output/bin
/thrift
--gen
cpp:moveable_types
-out
$TMP_DIR
rrdb.thrift
sed
's/#include "dsn_types.h"/#include <dsn\/service_api_cpp.h>/'
$TMP_DIR
/rrdb_types.h
>
../include/rrdb/rrdb_types.h
sed
's/#include "rrdb_types.h"/#include <rrdb\/rrdb_types.h>/'
$TMP_DIR
/rrdb_types.cpp
>
../base/rrdb_types.cpp
...
...
src/idl/rrdb.thrift.annotations
已删除
100644 → 0
浏览文件 @
c5e98eb9
[service.rrdb]
stateful = true
[function.rrdb.put]
write = true
[function.rrdb.remove]
write = true
[function.rrdb.get]
write = false
[function.rrdb.get_scanner]
write = false
[function.rrdb.scan]
write = false
[function.rrdb.clear_scanner]
write = false
src/shell/commands/data_operations.cpp
浏览文件 @
2e0afc75
...
...
@@ -3,6 +3,7 @@
// can be found in the LICENSE file in the root directory of this source tree.
#include "shell/commands.h"
#include "idl_utils.h"
static
void
print_current_scan_state
(
const
std
::
vector
<
std
::
unique_ptr
<
scan_data_context
>>
&
contexts
,
...
...
@@ -737,8 +738,7 @@ bool check_and_set(command_executor *e, shell_context *sc, arguments args)
fprintf
(
stderr
,
"ERROR: check_type not provided
\n
"
);
return
false
;
}
if
(
!
check_operand_provided
&&
check_type
>=
::
dsn
::
apps
::
cas_check_type
::
CT_VALUE_MATCH_ANYWHERE
)
{
if
(
!
check_operand_provided
&&
pegasus
::
cas_is_check_operand_needed
(
check_type
))
{
fprintf
(
stderr
,
"ERROR: check_operand not provided
\n
"
);
return
false
;
}
...
...
src/shell/commands/debugger.cpp
浏览文件 @
2e0afc75
...
...
@@ -3,6 +3,7 @@
// can be found in the LICENSE file in the root directory of this source tree.
#include "shell/commands.h"
#include "base/idl_utils.h"
#include <rocksdb/sst_dump_tool.h>
#include <rocksdb/utilities/ldb_cmd.h>
#include <fmt/time.h>
...
...
@@ -129,6 +130,29 @@ bool mlog_dump(command_executor *e, shell_context *sc, arguments args)
<<
pegasus
::
utils
::
c_escape_string
(
hash_key
,
sc
->
escape_all
)
<<
"
\"
:
\"
"
<<
pegasus
::
utils
::
c_escape_string
(
sort_key
,
sc
->
escape_all
)
<<
"
\"
=> "
<<
update
.
increment
<<
std
::
endl
;
}
else
if
(
msg
->
local_rpc_code
==
::
dsn
::
apps
::
RPC_RRDB_RRDB_CHECK_AND_SET
)
{
dsn
::
apps
::
check_and_set_request
update
;
dsn
::
unmarshall
(
request
,
update
);
auto
set_sort_key
=
update
.
set_diff_sort_key
?
update
.
set_sort_key
:
update
.
check_sort_key
;
std
::
string
check_operand
;
if
(
pegasus
::
cas_is_check_operand_needed
(
update
.
check_type
))
{
check_operand
=
fmt
::
format
(
"
\"
{}
\"
"
,
pegasus
::
utils
::
c_escape_string
(
update
.
check_operand
,
sc
->
escape_all
));
}
os
<<
INDENT
<<
fmt
::
format
(
"[CHECK_AND_SET]
\"
{}
\"
: IF SORT_KEY({}) {} {}"
"THEN SET SORT_KEY({}) => VALUE({}) [expire={}]
\n
"
,
pegasus
::
utils
::
c_escape_string
(
update
.
hash_key
,
sc
->
escape_all
),
pegasus
::
utils
::
c_escape_string
(
update
.
check_sort_key
,
sc
->
escape_all
),
pegasus
::
cas_check_type_to_string
(
update
.
check_type
),
check_operand
,
pegasus
::
utils
::
c_escape_string
(
set_sort_key
,
sc
->
escape_all
),
pegasus
::
utils
::
c_escape_string
(
update
.
set_value
,
sc
->
escape_all
),
update
.
set_expire_ts_seconds
);
}
else
{
os
<<
INDENT
<<
"ERROR: unsupported code "
<<
::
dsn
::
task_code
(
msg
->
local_rpc_code
).
to_string
()
<<
"("
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录