Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Metz
oceanbase
提交
e7f1eb7a
O
oceanbase
项目概览
Metz
/
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,发现更多精彩内容 >>
提交
e7f1eb7a
编写于
3月 04, 2022
作者:
G
gjw2284740
提交者:
LINGuanRen
3月 04, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[opensource] refine ob_admin to print clog without user data
上级
60a0eee9
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
49 addition
and
18 deletion
+49
-18
tools/ob_admin/clog_tool/ob_admin_clog_v2_executor.cpp
tools/ob_admin/clog_tool/ob_admin_clog_v2_executor.cpp
+35
-12
tools/ob_admin/clog_tool/ob_admin_clog_v2_executor.h
tools/ob_admin/clog_tool/ob_admin_clog_v2_executor.h
+3
-2
tools/ob_admin/clog_tool/ob_log_entry_parser.cpp
tools/ob_admin/clog_tool/ob_log_entry_parser.cpp
+8
-3
tools/ob_admin/clog_tool/ob_log_entry_parser.h
tools/ob_admin/clog_tool/ob_log_entry_parser.h
+3
-1
未找到文件。
tools/ob_admin/clog_tool/ob_admin_clog_v2_executor.cpp
浏览文件 @
e7f1eb7a
...
...
@@ -65,9 +65,17 @@ int ObAdminClogV2Executor::execute(int argc, char* argv[])
LOG_INFO
(
"finish encode"
,
K
(
ret
));
}
else
if
(
OB_NEED_RETRY
!=
(
ret
=
CmdCallSimple
(
new_argc
,
new_argv
,
dump_ilog
)
:
OB_NEED_RETRY
))
{
LOG_INFO
(
"finish encode"
,
K
(
ret
));
}
else
if
(
OB_NEED_RETRY
!=
(
ret
=
CmdCallSimple
(
new_argc
,
new_argv
,
dump_meta
)
:
OB_NEED_RETRY
))
{
LOG_INFO
(
"finish encode"
,
K
(
ret
));
}
else
{
fprintf
(
stderr
,
"failed %d"
,
ret
);
print_usage
();
if
(
OB_NEED_RETRY
==
ret
)
{
LOG_WARN
(
"unrecognized command"
);
fprintf
(
stdout
,
"unrecognized command
\n
"
);
print_usage
();
}
else
{
LOG_WARN
(
"failed to execute clog tool"
,
K
(
ret
));
fprintf
(
stderr
,
"failed %d
\n
"
,
ret
);
}
}
}
return
ret
;
...
...
@@ -107,29 +115,43 @@ void ObAdminClogV2Executor::print_usage()
"$ob_admin clog_tool dump_filter filter_str log_files ## ./ob_admin clog_tool dump_filter "
"'table_id=123;partition_id=123;log_id=123' 1 2 3
\n
"
"$ob_admin clog_tool dump_hex log_files ## ./ob_admin clog_tool dump_hex 1 2 3
\n
"
"$ob_admin clog_tool dump_format log_files ## ./ob_admin clog_tool dump_format 1 2 3
\n
"
);
"$ob_admin clog_tool dump_format log_files ## ./ob_admin clog_tool dump_format 1 2 3
\n
"
"$ob_admin clog_tool dump_meta log_files ## ./ob_admin clog_tool dump_meta 1 2 3
\n
"
);
}
int
ObAdminClogV2Executor
::
dump_all
(
int
argc
,
char
*
argv
[])
{
int
ret
=
OB_SUCCESS
;
const
bool
is_hex
=
false
;
if
(
OB_FAIL
(
dump_inner
(
argc
,
argv
,
is_hex
)))
{
const
bool
without_data
=
false
;
if
(
OB_FAIL
(
dump_inner
(
argc
,
argv
,
is_hex
,
without_data
)))
{
LOG_WARN
(
"failed to dump all"
,
K
(
ret
));
}
return
ret
;
}
int
ObAdminClogV2Executor
::
dump_meta
(
int
argc
,
char
*
argv
[])
{
int
ret
=
OB_SUCCESS
;
const
bool
is_hex
=
false
;
const
bool
without_data
=
true
;
if
(
OB_FAIL
(
dump_inner
(
argc
,
argv
,
is_hex
,
without_data
)))
{
LOG_WARN
(
"failed to dump meta"
,
K
(
ret
));
}
return
ret
;
}
int
ObAdminClogV2Executor
::
dump_filter
(
int
argc
,
char
*
argv
[])
{
int
ret
=
OB_SUCCESS
;
const
bool
is_hex
=
false
;
const
bool
without_data
=
false
;
if
(
OB_FAIL
(
filter_
.
parse
(
argv
[
0
])))
{
LOG_WARN
(
"parse filter failed"
,
K
(
ret
),
K
(
argv
[
0
]));
}
else
{
LOG_INFO
(
"dump with filter"
,
K_
(
filter
),
K
(
argv
[
0
]));
if
(
OB_FAIL
(
dump_inner
(
argc
-
1
,
argv
+
1
,
is_hex
)))
{
LOG_WARN
(
"failed to dump
all
"
,
K
(
ret
));
if
(
OB_FAIL
(
dump_inner
(
argc
-
1
,
argv
+
1
,
is_hex
,
without_data
)))
{
LOG_WARN
(
"failed to dump
filter
"
,
K
(
ret
));
}
}
return
ret
;
...
...
@@ -139,22 +161,23 @@ int ObAdminClogV2Executor::dump_hex(int argc, char* argv[])
{
int
ret
=
OB_SUCCESS
;
const
bool
is_hex
=
true
;
if
(
OB_FAIL
(
dump_inner
(
argc
,
argv
,
is_hex
)))
{
const
bool
without_data
=
false
;
if
(
OB_FAIL
(
dump_inner
(
argc
,
argv
,
is_hex
,
without_data
)))
{
LOG_WARN
(
"failed to dump hex"
,
K
(
ret
));
}
return
ret
;
}
int
ObAdminClogV2Executor
::
dump_inner
(
int
argc
,
char
*
argv
[],
bool
is_hex
)
int
ObAdminClogV2Executor
::
dump_inner
(
int
argc
,
char
*
argv
[],
bool
is_hex
,
bool
without_data
)
{
int
ret
=
OB_SUCCESS
;
if
(
OB_UNLIKELY
(
argc
<
1
)
||
OB_ISNULL
(
argv
))
{
ret
=
OB_INVALID_ARGUMENT
;
LOG_WARN
(
"invalid arguments"
,
K
(
argc
),
K
(
ret
));
}
else
{
LOG_INFO
(
"begin to dump all "
,
K
(
is_hex
),
K
(
ret
));
LOG_INFO
(
"begin to dump all "
,
K
(
is_hex
),
K
(
without_data
),
K
(
ret
));
for
(
int64_t
i
=
0
;
i
<
argc
;
++
i
)
{
if
(
OB_FAIL
(
dump_single_clog
(
argv
[
i
],
is_hex
))
&&
OB_ITER_END
!=
ret
)
{
if
(
OB_FAIL
(
dump_single_clog
(
argv
[
i
],
is_hex
,
without_data
))
&&
OB_ITER_END
!=
ret
)
{
LOG_WARN
(
"failed to dump log "
,
K
(
argv
[
i
]),
K
(
ret
));
}
else
if
(
OB_ITER_END
==
ret
)
{
ret
=
OB_SUCCESS
;
...
...
@@ -382,7 +405,7 @@ int ObAdminClogV2Executor::encode_int(
return
ret
;
}
int
ObAdminClogV2Executor
::
dump_single_clog
(
const
char
*
path
,
bool
is_hex
)
int
ObAdminClogV2Executor
::
dump_single_clog
(
const
char
*
path
,
bool
is_hex
,
bool
without_data
)
{
int
ret
=
OB_SUCCESS
;
int
fd
=
-
1
;
...
...
@@ -398,7 +421,7 @@ int ObAdminClogV2Executor::dump_single_clog(const char* path, bool is_hex)
ObLogEntryParser
entry_parser
;
if
(
OB_FAIL
(
entry_parser
.
init
(
file_id
,
buf
,
buf_len
,
filter_
,
DB_host_
,
DB_port_
,
config_file_
,
is_ofs
)))
{
LOG_WARN
(
"failed to init entry parser"
,
K
(
path
),
K
(
ret
));
}
else
if
(
OB_FAIL
(
entry_parser
.
dump_all_entry
(
is_hex
)))
{
}
else
if
(
OB_FAIL
(
entry_parser
.
dump_all_entry
(
is_hex
,
without_data
)))
{
if
(
OB_ITER_END
==
ret
)
{
LOG_INFO
(
"succ to dump_all_entry"
,
K
(
path
));
}
else
{
...
...
tools/ob_admin/clog_tool/ob_admin_clog_v2_executor.h
浏览文件 @
e7f1eb7a
...
...
@@ -31,10 +31,11 @@ private:
int
dump_all
(
int
argc
,
char
*
argv
[]);
int
dump_filter
(
int
argc
,
char
*
argv
[]);
int
dump_hex
(
int
argc
,
char
*
argv
[]);
int
dump_inner
(
int
argc
,
char
*
argv
[],
bool
is_hex
);
int
dump_inner
(
int
argc
,
char
*
argv
[],
bool
is_hex
,
bool
without_data
);
int
dump_format
(
int
argc
,
char
*
argv
[]);
int
stat_clog
(
int
argc
,
char
*
argv
[]);
int
dump_ilog
(
int
argc
,
char
*
argv
[]);
int
dump_meta
(
int
argc
,
char
*
argv
[]);
void
print_usage
();
int
parse_options
(
int
argc
,
char
*
argv
[]);
...
...
@@ -42,7 +43,7 @@ private:
int
grep
(
int
argc
,
char
*
argv
[]);
int
encode_int
(
char
*
buf
,
int64_t
&
pos
,
int64_t
buf_len
,
const
char
*
encode_type
,
int64_t
int_value
);
int
dump_single_clog
(
const
char
*
path
,
bool
is_hex
);
int
dump_single_clog
(
const
char
*
path
,
bool
is_hex
,
bool
without_data
);
int
dump_single_ilog
(
const
char
*
path
);
int
dump_format_single_file
(
const
char
*
path
);
int
stat_single_log
(
const
char
*
path
);
...
...
tools/ob_admin/clog_tool/ob_log_entry_parser.cpp
浏览文件 @
e7f1eb7a
...
...
@@ -220,7 +220,7 @@ int ObLogEntryParser::get_type_(ObCLogItemType& type)
return
ret
;
}
int
ObLogEntryParser
::
dump_all_entry
(
bool
is_hex
)
int
ObLogEntryParser
::
dump_all_entry
(
bool
is_hex
,
bool
without_data
)
{
int
ret
=
OB_SUCCESS
;
if
(
OB_UNLIKELY
(
!
is_inited_
))
{
...
...
@@ -228,6 +228,7 @@ int ObLogEntryParser::dump_all_entry(bool is_hex)
CLOG_LOG
(
ERROR
,
"log entry parser is not inited"
,
K
(
is_inited_
),
K
(
ret
));
}
else
{
dump_hex_
=
is_hex
;
without_data_
=
without_data
;
while
(
OB_SUCC
(
ret
))
{
if
(
OB_FAIL
(
parse_next_entry
()))
{
if
(
OB_ITER_END
!=
ret
)
{
...
...
@@ -690,7 +691,9 @@ int ObLogEntryParserImpl::dump_memtable_mutator(const char* buf, int64_t len)
ret
=
OB_SUCCESS
;
break
;
}
else
{
if
(
dump_hex_
)
{
if
(
without_data_
)
{
fprintf
(
stdout
,
" MutatorRow={*} | OLD_ROW={"
);
}
else
if
(
dump_hex_
)
{
int64_t
pos
=
row
.
rowkey_
.
to_smart_string
(
print_buf_
,
PRINT_BUF_SIZE
-
1
);
print_buf_
[
pos
]
=
'\0'
;
fprintf
(
stdout
,
" MutatorRow={%s} HexedRowkey={%s} | OLD_ROW={"
,
to_cstring
(
row
),
print_buf_
);
...
...
@@ -1444,7 +1447,9 @@ int ObLogEntryParserImpl::dump_freeze_log(const char* buf, const int64_t buf_len
int
ObLogEntryParserImpl
::
dump_obj
(
const
common
::
ObObj
&
obj
,
uint64_t
column_id
)
{
int
ret
=
OB_SUCCESS
;
if
(
dump_hex_
)
{
if
(
without_data_
)
{
fprintf
(
stdout
,
"*"
);
}
else
if
(
dump_hex_
)
{
int64_t
buf_len
=
PRINT_BUF_SIZE
-
1
;
// reserver one character for '\0'
int64_t
pos
=
0
;
if
(
OB_UNLIKELY
(
!
is_inited_
))
{
...
...
tools/ob_admin/clog_tool/ob_log_entry_parser.h
浏览文件 @
e7f1eb7a
...
...
@@ -107,6 +107,7 @@ public:
ObLogEntryParserImpl
()
:
is_inited_
(
false
),
dump_hex_
(
false
),
without_data_
(
false
),
file_id_
(
-
1
),
cur_offset_
(
OB_INVALID_OFFSET
),
print_buf_
(
NULL
),
...
...
@@ -178,6 +179,7 @@ protected:
static
const
int64_t
PRINT_BUF_SIZE
=
5
*
1024
*
1024
;
bool
is_inited_
;
bool
dump_hex_
;
bool
without_data_
;
uint64_t
file_id_
;
int64_t
cur_offset_
;
ObTransID
cur_trans_id_
;
...
...
@@ -199,7 +201,7 @@ public:
int
init
(
uint64_t
file_id
,
char
*
buf
,
int64_t
buf_len
,
const
ObLogEntryFilter
&
filter
,
const
common
::
ObString
&
host
,
const
int32_t
port
,
const
char
*
config_file
,
const
bool
is_ofs
);
int
dump_all_entry
(
bool
is_hex
);
int
dump_all_entry
(
bool
is_hex
,
bool
without_data
);
int
format_dump_entry
();
int
stat_log
();
const
ObLogStat
&
get_log_stat
()
const
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录