Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
760c39da
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
Star
22015
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
760c39da
编写于
5月 20, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: dump sdbdata to file
上级
9d600dfa
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
172 addition
and
7 deletion
+172
-7
tests/test/c/CMakeLists.txt
tests/test/c/CMakeLists.txt
+1
-1
tests/test/c/sdbDump.c
tests/test/c/sdbDump.c
+171
-6
未找到文件。
tests/test/c/CMakeLists.txt
浏览文件 @
760c39da
...
...
@@ -24,7 +24,7 @@ target_link_libraries(
PUBLIC os
)
IF
(
TD_LINUX
)
IF
(
${
TD_WINDOWS
}
)
target_link_libraries
(
sdbDump
PUBLIC dnode
...
...
tests/test/c/sdbDump.c
浏览文件 @
760c39da
...
...
@@ -42,9 +42,87 @@ char *i642str(int64_t val) {
void
dumpFunc
(
SSdb
*
pSdb
,
SJson
*
json
)
{}
void
dumpDb
(
SSdb
*
pSdb
,
SJson
*
json
)
{}
void
dumpDb
(
SSdb
*
pSdb
,
SJson
*
json
)
{
void
*
pIter
=
NULL
;
SJson
*
items
=
tjsonCreateObject
();
tjsonAddItemToObject
(
json
,
"dbs"
,
items
);
while
(
1
)
{
SDbObj
*
pObj
=
NULL
;
pIter
=
sdbFetch
(
pSdb
,
SDB_DB
,
pIter
,
(
void
**
)
&
pObj
);
if
(
pIter
==
NULL
)
break
;
SJson
*
item
=
tjsonCreateObject
();
tjsonAddItemToObject
(
items
,
"db"
,
item
);
tjsonAddStringToObject
(
item
,
"name"
,
pObj
->
name
);
tjsonAddStringToObject
(
item
,
"acct"
,
pObj
->
acct
);
tjsonAddStringToObject
(
item
,
"createUser"
,
pObj
->
createUser
);
tjsonAddStringToObject
(
item
,
"createdTime"
,
i642str
(
pObj
->
createdTime
));
tjsonAddStringToObject
(
item
,
"updateTime"
,
i642str
(
pObj
->
updateTime
));
tjsonAddStringToObject
(
item
,
"uid"
,
i642str
(
pObj
->
uid
));
tjsonAddIntegerToObject
(
item
,
"cfgVersion"
,
pObj
->
cfgVersion
);
tjsonAddIntegerToObject
(
item
,
"vgVersion"
,
pObj
->
vgVersion
);
tjsonAddIntegerToObject
(
item
,
"numOfVgroups"
,
pObj
->
cfg
.
numOfVgroups
);
tjsonAddIntegerToObject
(
item
,
"numOfStables"
,
pObj
->
cfg
.
numOfStables
);
tjsonAddIntegerToObject
(
item
,
"buffer"
,
pObj
->
cfg
.
buffer
);
tjsonAddIntegerToObject
(
item
,
"pageSize"
,
pObj
->
cfg
.
pageSize
);
tjsonAddIntegerToObject
(
item
,
"pages"
,
pObj
->
cfg
.
pages
);
tjsonAddIntegerToObject
(
item
,
"daysPerFile"
,
pObj
->
cfg
.
daysPerFile
);
tjsonAddIntegerToObject
(
item
,
"daysToKeep0"
,
pObj
->
cfg
.
daysToKeep0
);
tjsonAddIntegerToObject
(
item
,
"daysToKeep1"
,
pObj
->
cfg
.
daysToKeep1
);
tjsonAddIntegerToObject
(
item
,
"daysToKeep2"
,
pObj
->
cfg
.
daysToKeep2
);
tjsonAddIntegerToObject
(
item
,
"minRows"
,
pObj
->
cfg
.
minRows
);
tjsonAddIntegerToObject
(
item
,
"maxRows"
,
pObj
->
cfg
.
maxRows
);
tjsonAddIntegerToObject
(
item
,
"fsyncPeriod"
,
pObj
->
cfg
.
fsyncPeriod
);
tjsonAddIntegerToObject
(
item
,
"walLevel"
,
pObj
->
cfg
.
walLevel
);
tjsonAddIntegerToObject
(
item
,
"precision"
,
pObj
->
cfg
.
precision
);
tjsonAddIntegerToObject
(
item
,
"compression"
,
pObj
->
cfg
.
compression
);
tjsonAddIntegerToObject
(
item
,
"replications"
,
pObj
->
cfg
.
replications
);
tjsonAddIntegerToObject
(
item
,
"strict"
,
pObj
->
cfg
.
strict
);
tjsonAddIntegerToObject
(
item
,
"cacheLastRow"
,
pObj
->
cfg
.
cacheLastRow
);
tjsonAddIntegerToObject
(
item
,
"hashMethod"
,
pObj
->
cfg
.
hashMethod
);
tjsonAddIntegerToObject
(
item
,
"numOfRetensions"
,
pObj
->
cfg
.
numOfRetensions
);
sdbRelease
(
pSdb
,
pObj
);
}
}
void
dumpStb
(
SSdb
*
pSdb
,
SJson
*
json
)
{
void
*
pIter
=
NULL
;
SJson
*
items
=
tjsonCreateObject
();
tjsonAddItemToObject
(
json
,
"stbs"
,
items
);
while
(
1
)
{
SStbObj
*
pObj
=
NULL
;
pIter
=
sdbFetch
(
pSdb
,
SDB_STB
,
pIter
,
(
void
**
)
&
pObj
);
if
(
pIter
==
NULL
)
break
;
SJson
*
item
=
tjsonCreateObject
();
tjsonAddItemToObject
(
items
,
"stb"
,
item
);
void
dumpStb
(
SSdb
*
pSdb
,
SJson
*
json
)
{}
tjsonAddStringToObject
(
item
,
"name"
,
pObj
->
name
);
tjsonAddStringToObject
(
item
,
"db"
,
pObj
->
db
);
tjsonAddStringToObject
(
item
,
"createdTime"
,
i642str
(
pObj
->
createdTime
));
tjsonAddStringToObject
(
item
,
"updateTime"
,
i642str
(
pObj
->
updateTime
));
tjsonAddStringToObject
(
item
,
"uid"
,
i642str
(
pObj
->
uid
));
tjsonAddStringToObject
(
item
,
"dbUid"
,
i642str
(
pObj
->
dbUid
));
tjsonAddIntegerToObject
(
item
,
"version"
,
pObj
->
version
);
tjsonAddIntegerToObject
(
item
,
"tagVer"
,
pObj
->
tagVer
);
tjsonAddIntegerToObject
(
item
,
"colVer"
,
pObj
->
colVer
);
tjsonAddIntegerToObject
(
item
,
"nextColId"
,
pObj
->
nextColId
);
tjsonAddIntegerToObject
(
item
,
"xFilesFactor"
,
pObj
->
xFilesFactor
*
10000
);
tjsonAddIntegerToObject
(
item
,
"delay"
,
pObj
->
delay
);
tjsonAddIntegerToObject
(
item
,
"ttl"
,
pObj
->
ttl
);
tjsonAddIntegerToObject
(
item
,
"numOfColumns"
,
pObj
->
numOfColumns
);
tjsonAddIntegerToObject
(
item
,
"numOfTags"
,
pObj
->
numOfTags
);
tjsonAddIntegerToObject
(
item
,
"commentLen"
,
pObj
->
commentLen
);
tjsonAddIntegerToObject
(
item
,
"ast1Len"
,
pObj
->
ast1Len
);
tjsonAddIntegerToObject
(
item
,
"ast2Len"
,
pObj
->
ast2Len
);
sdbRelease
(
pSdb
,
pObj
);
}
}
void
dumpSma
(
SSdb
*
pSdb
,
SJson
*
json
)
{}
...
...
@@ -60,7 +138,27 @@ void dumpOffset(SSdb *pSdb, SJson *json) {}
void
dumpStream
(
SSdb
*
pSdb
,
SJson
*
json
)
{}
void
dumpAcct
(
SSdb
*
pSdb
,
SJson
*
json
)
{}
void
dumpAcct
(
SSdb
*
pSdb
,
SJson
*
json
)
{
void
*
pIter
=
NULL
;
SJson
*
items
=
tjsonCreateObject
();
tjsonAddItemToObject
(
json
,
"accts"
,
items
);
while
(
1
)
{
SAcctObj
*
pObj
=
NULL
;
pIter
=
sdbFetch
(
pSdb
,
SDB_ACCT
,
pIter
,
(
void
**
)
&
pObj
);
if
(
pIter
==
NULL
)
break
;
SJson
*
item
=
tjsonCreateObject
();
tjsonAddItemToObject
(
items
,
"acct"
,
item
);
tjsonAddStringToObject
(
item
,
"acct"
,
pObj
->
acct
);
tjsonAddStringToObject
(
item
,
"createdTime"
,
i642str
(
pObj
->
createdTime
));
tjsonAddStringToObject
(
item
,
"updateTime"
,
i642str
(
pObj
->
updateTime
));
tjsonAddIntegerToObject
(
item
,
"acctId"
,
pObj
->
acctId
);
sdbRelease
(
pSdb
,
pObj
);
}
}
void
dumpAuth
(
SSdb
*
pSdb
,
SJson
*
json
)
{}
...
...
@@ -120,11 +218,78 @@ void dumpSnode(SSdb *pSdb, SJson *json) {}
void
dumpQnode
(
SSdb
*
pSdb
,
SJson
*
json
)
{}
void
dumpMnode
(
SSdb
*
pSdb
,
SJson
*
json
)
{}
void
dumpMnode
(
SSdb
*
pSdb
,
SJson
*
json
)
{
void
*
pIter
=
NULL
;
SJson
*
items
=
tjsonCreateObject
();
tjsonAddItemToObject
(
json
,
"mnodes"
,
items
);
while
(
1
)
{
SMnodeObj
*
pObj
=
NULL
;
pIter
=
sdbFetch
(
pSdb
,
SDB_MNODE
,
pIter
,
(
void
**
)
&
pObj
);
if
(
pIter
==
NULL
)
break
;
SJson
*
item
=
tjsonCreateObject
();
tjsonAddItemToObject
(
items
,
"mnode"
,
item
);
tjsonAddIntegerToObject
(
item
,
"id"
,
pObj
->
id
);
tjsonAddStringToObject
(
item
,
"createdTime"
,
i642str
(
pObj
->
createdTime
));
tjsonAddStringToObject
(
item
,
"updateTime"
,
i642str
(
pObj
->
updateTime
));
void
dumpCluster
(
SSdb
*
pSdb
,
SJson
*
json
)
{}
sdbRelease
(
pSdb
,
pObj
);
}
}
void
dumpCluster
(
SSdb
*
pSdb
,
SJson
*
json
)
{
void
*
pIter
=
NULL
;
SJson
*
items
=
tjsonCreateObject
();
tjsonAddItemToObject
(
json
,
"clusters"
,
items
);
while
(
1
)
{
SClusterObj
*
pObj
=
NULL
;
pIter
=
sdbFetch
(
pSdb
,
SDB_CLUSTER
,
pIter
,
(
void
**
)
&
pObj
);
if
(
pIter
==
NULL
)
break
;
SJson
*
item
=
tjsonCreateObject
();
tjsonAddItemToObject
(
items
,
"cluster"
,
item
);
void
dumpTrans
(
SSdb
*
pSdb
,
SJson
*
json
)
{}
tjsonAddStringToObject
(
item
,
"id"
,
i642str
(
pObj
->
id
));
tjsonAddStringToObject
(
item
,
"createdTime"
,
i642str
(
pObj
->
createdTime
));
tjsonAddStringToObject
(
item
,
"updateTime"
,
i642str
(
pObj
->
updateTime
));
tjsonAddStringToObject
(
item
,
"name"
,
pObj
->
name
);
sdbRelease
(
pSdb
,
pObj
);
}
}
void
dumpTrans
(
SSdb
*
pSdb
,
SJson
*
json
)
{
void
*
pIter
=
NULL
;
SJson
*
items
=
tjsonCreateObject
();
tjsonAddItemToObject
(
json
,
"transactions"
,
items
);
while
(
1
)
{
STrans
*
pObj
=
NULL
;
pIter
=
sdbFetch
(
pSdb
,
SDB_TRANS
,
pIter
,
(
void
**
)
&
pObj
);
if
(
pIter
==
NULL
)
break
;
SJson
*
item
=
tjsonCreateObject
();
tjsonAddItemToObject
(
items
,
"trans"
,
item
);
tjsonAddIntegerToObject
(
item
,
"id"
,
pObj
->
id
);
tjsonAddIntegerToObject
(
item
,
"stage"
,
pObj
->
stage
);
tjsonAddIntegerToObject
(
item
,
"policy"
,
pObj
->
policy
);
tjsonAddIntegerToObject
(
item
,
"type"
,
pObj
->
type
);
tjsonAddStringToObject
(
item
,
"createdTime"
,
i642str
(
pObj
->
createdTime
));
tjsonAddStringToObject
(
item
,
"dbUid"
,
i642str
(
pObj
->
dbUid
));
tjsonAddStringToObject
(
item
,
"dbname"
,
pObj
->
dbname
);
tjsonAddIntegerToObject
(
item
,
"redoLogNum"
,
taosArrayGetSize
(
pObj
->
redoLogs
));
tjsonAddIntegerToObject
(
item
,
"undoLogNum"
,
taosArrayGetSize
(
pObj
->
undoLogs
));
tjsonAddIntegerToObject
(
item
,
"commitLogNum"
,
taosArrayGetSize
(
pObj
->
commitLogs
));
tjsonAddIntegerToObject
(
item
,
"redoActionNum"
,
taosArrayGetSize
(
pObj
->
redoActions
));
tjsonAddIntegerToObject
(
item
,
"undoActionNum"
,
taosArrayGetSize
(
pObj
->
undoActions
));
sdbRelease
(
pSdb
,
pObj
);
}
}
void
dumpHeader
(
SSdb
*
pSdb
,
SJson
*
json
)
{
tjsonAddIntegerToObject
(
json
,
"sver"
,
1
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录