Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b809fd48
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
b809fd48
编写于
9月 02, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
9月 02, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #16607 from taosdata/fix/dnode
enh: let show vnodes works
上级
8528abf9
ae54c4a5
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
61 addition
and
17 deletion
+61
-17
source/common/src/systable.c
source/common/src/systable.c
+5
-3
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+25
-14
tests/script/tsim/db/basic1.sim
tests/script/tsim/db/basic1.sim
+31
-0
未找到文件。
source/common/src/systable.c
浏览文件 @
b809fd48
...
...
@@ -257,10 +257,12 @@ static const SSysDbTableSchema subscriptionSchema[] = {
};
static
const
SSysDbTableSchema
vnodesSchema
[]
=
{
{.
name
=
"dnode_id"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
,
.
sysInfo
=
true
},
{.
name
=
"dnode_endpoint"
,
.
bytes
=
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
,
.
sysInfo
=
true
},
{.
name
=
"vgroup_id"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
,
.
sysInfo
=
true
},
{.
name
=
"status"
,
.
bytes
=
20
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_BINARY
,
.
sysInfo
=
true
},
{.
name
=
"replica"
,
.
bytes
=
1
,
.
type
=
TSDB_DATA_TYPE_TINYINT
,
.
sysInfo
=
true
},
{.
name
=
"status"
,
.
bytes
=
9
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
,
.
sysInfo
=
true
},
{.
name
=
"db_name"
,
.
bytes
=
SYSTABLE_SCH_DB_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
,
.
sysInfo
=
true
},
{.
name
=
"dnode_id"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
,
.
sysInfo
=
true
},
{.
name
=
"dnode_ep"
,
.
bytes
=
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
,
.
sysInfo
=
true
},
};
static
const
SSysTableMeta
infosMeta
[]
=
{
...
...
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
b809fd48
...
...
@@ -791,32 +791,43 @@ static int32_t mndRetrieveVnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
if
(
pShow
->
pIter
==
NULL
)
break
;
for
(
int32_t
i
=
0
;
i
<
pVgroup
->
replica
&&
numOfRows
<
rows
;
++
i
)
{
SVnodeGid
*
pVgid
=
&
pVgroup
->
vnodeGid
[
i
];
SVnodeGid
*
pVgid
=
&
pVgroup
->
vnodeGid
[
i
];
SColumnInfoData
*
pColInfo
=
NULL
;
cols
=
0
;
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pVgroup
->
vgId
,
false
);
SName
name
=
{
0
};
char
db
[
TSDB_DB_NAME_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
tNameFromString
(
&
name
,
pVgroup
->
dbName
,
T_NAME_ACCT
|
T_NAME_DB
);
tNameGetDbName
(
&
name
,
varDataVal
(
db
));
varDataSetLen
(
db
,
strlen
(
varDataVal
(
db
)));
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
db
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pVgroup
->
vgId
,
false
);
uint32_t
val
=
0
;
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
val
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pVgroup
->
replica
,
false
);
char
buf
[
20
]
=
{
0
};
STR_TO_VARSTR
(
buf
,
syncStr
(
pVgid
->
role
));
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
buf
,
false
);
const
char
*
dbname
=
mndGetDbStr
(
pVgroup
->
dbName
);
char
b1
[
TSDB_DB_NAME_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
if
(
dbname
!=
NULL
)
{
STR_WITH_MAXSIZE_TO_VARSTR
(
b1
,
dbname
,
TSDB_DB_NAME_LEN
+
VARSTR_HEADER_SIZE
);
}
else
{
STR_WITH_MAXSIZE_TO_VARSTR
(
b1
,
"NULL"
,
TSDB_DB_NAME_LEN
+
VARSTR_HEADER_SIZE
);
}
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
b1
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pVgid
->
dnodeId
,
false
);
SDnodeObj
*
pDnode
=
mndAcquireDnode
(
pMnode
,
pVgid
->
dnodeId
);
char
b2
[
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
if
(
pDnode
!=
NULL
)
{
STR_WITH_MAXSIZE_TO_VARSTR
(
b2
,
pDnode
->
ep
,
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
);
}
else
{
STR_WITH_MAXSIZE_TO_VARSTR
(
b2
,
"NULL"
,
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
);
}
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pVgroup
->
replica
,
false
);
// onlines
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
b2
,
false
);
numOfRows
++
;
}
...
...
tests/script/tsim/db/basic1.sim
浏览文件 @
b809fd48
...
...
@@ -107,6 +107,37 @@ if $data30 != 12 then
return -1
endi
print =============== show vnodes
sql show vnodes 1
if $rows != 9 then
return -1
endi
if $data(4)[1] != 1 then
return -1
endi
if $data(4)[2] != leader then
return -1
endi
if $data(4)[3] != d2 then
return -1
endi
if $data(4)[4] != 1 then
return -1
endi
if $data(4)[5] != localhost:7100 then
return -1
endi
#sql show vnodes 'localhost:7100'
#if $rows != 9 then
# return -1
#endi
print =============== drop database
sql drop database d2
sql drop database d3
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录