Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
239a79d4
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1193
Star
22018
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看板
提交
239a79d4
编写于
8月 15, 2023
作者:
B
Benguang Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh: add some vnode info in SStatusReq
上级
8438309a
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
37 addition
and
7 deletion
+37
-7
include/common/tmsg.h
include/common/tmsg.h
+5
-2
include/libs/sync/sync.h
include/libs/sync/sync.h
+1
-0
source/common/src/tmsg.c
source/common/src/tmsg.c
+27
-5
source/dnode/vnode/src/vnd/vnodeQuery.c
source/dnode/vnode/src/vnd/vnodeQuery.c
+3
-0
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+1
-0
未找到文件。
include/common/tmsg.h
浏览文件 @
239a79d4
...
@@ -1163,6 +1163,9 @@ typedef struct {
...
@@ -1163,6 +1163,9 @@ typedef struct {
int32_t
vgId
;
int32_t
vgId
;
int8_t
syncState
;
int8_t
syncState
;
int8_t
syncRestore
;
int8_t
syncRestore
;
int64_t
syncTerm
;
int64_t
roleTimeMs
;
int64_t
startTimeMs
;
int8_t
syncCanRead
;
int8_t
syncCanRead
;
int64_t
cacheUsage
;
int64_t
cacheUsage
;
int64_t
numOfTables
;
int64_t
numOfTables
;
...
@@ -1179,9 +1182,9 @@ typedef struct {
...
@@ -1179,9 +1182,9 @@ typedef struct {
}
SVnodeLoad
;
}
SVnodeLoad
;
typedef
struct
{
typedef
struct
{
int8_t
syncState
;
int8_t
syncState
;
int8_t
syncRestore
;
int64_t
syncTerm
;
int64_t
syncTerm
;
int8_t
syncRestore
;
int64_t
roleTimeMs
;
int64_t
roleTimeMs
;
}
SMnodeLoad
;
}
SMnodeLoad
;
...
...
include/libs/sync/sync.h
浏览文件 @
239a79d4
...
@@ -241,6 +241,7 @@ typedef struct SSyncState {
...
@@ -241,6 +241,7 @@ typedef struct SSyncState {
bool
canRead
;
bool
canRead
;
SyncTerm
term
;
SyncTerm
term
;
int64_t
roleTimeMs
;
int64_t
roleTimeMs
;
int64_t
startTimeMs
;
}
SSyncState
;
}
SSyncState
;
int32_t
syncInit
();
int32_t
syncInit
();
...
...
source/common/src/tmsg.c
浏览文件 @
239a79d4
...
@@ -1079,8 +1079,8 @@ int32_t tSerializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
...
@@ -1079,8 +1079,8 @@ int32_t tSerializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
if
(
tEncodeI64
(
&
encoder
,
pload
->
pointsWritten
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pload
->
pointsWritten
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pload
->
numOfCachedTables
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pload
->
numOfCachedTables
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
reserved
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
reserved
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
reserved
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pload
->
roleTimeMs
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
reserved
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pload
->
startTimeMs
)
<
0
)
return
-
1
;
}
}
// mnode loads
// mnode loads
...
@@ -1104,6 +1104,16 @@ int32_t tSerializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
...
@@ -1104,6 +1104,16 @@ int32_t tSerializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
if
(
tEncodeI64
(
&
encoder
,
pReq
->
mload
.
syncTerm
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
mload
.
syncTerm
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
mload
.
roleTimeMs
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
mload
.
roleTimeMs
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
clusterCfg
.
ttlChangeOnWrite
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
clusterCfg
.
ttlChangeOnWrite
)
<
0
)
return
-
1
;
// vnode extra
for
(
int32_t
i
=
0
;
i
<
vlen
;
++
i
)
{
SVnodeLoad
*
pload
=
taosArrayGet
(
pReq
->
pVloads
,
i
);
int64_t
reserved
=
0
;
if
(
tEncodeI64
(
&
encoder
,
pload
->
syncTerm
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
reserved
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
reserved
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
reserved
)
<
0
)
return
-
1
;
}
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
...
@@ -1148,7 +1158,7 @@ int32_t tDeserializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
...
@@ -1148,7 +1158,7 @@ int32_t tDeserializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
for
(
int32_t
i
=
0
;
i
<
vlen
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
vlen
;
++
i
)
{
SVnodeLoad
vload
=
{
0
};
SVnodeLoad
vload
=
{
0
};
int64_t
reserved64
=
0
;
vload
.
syncTerm
=
-
1
;
int32_t
reserved32
=
0
;
int32_t
reserved32
=
0
;
if
(
tDecodeI32
(
&
decoder
,
&
vload
.
vgId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
vload
.
vgId
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
vload
.
syncState
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
vload
.
syncState
)
<
0
)
return
-
1
;
...
@@ -1162,14 +1172,15 @@ int32_t tDeserializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
...
@@ -1162,14 +1172,15 @@ int32_t tDeserializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
if
(
tDecodeI64
(
&
decoder
,
&
vload
.
pointsWritten
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
vload
.
pointsWritten
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
vload
.
numOfCachedTables
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
vload
.
numOfCachedTables
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
(
int32_t
*
)
&
reserved32
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
(
int32_t
*
)
&
reserved32
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
reserved64
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
vload
.
roleTimeMs
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
reserved64
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
vload
.
startTimeMs
)
<
0
)
return
-
1
;
if
(
taosArrayPush
(
pReq
->
pVloads
,
&
vload
)
==
NULL
)
{
if
(
taosArrayPush
(
pReq
->
pVloads
,
&
vload
)
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
return
-
1
;
}
}
}
}
// mnode loads
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
mload
.
syncState
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
mload
.
syncState
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
mload
.
syncRestore
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
mload
.
syncRestore
)
<
0
)
return
-
1
;
...
@@ -1200,6 +1211,17 @@ int32_t tDeserializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
...
@@ -1200,6 +1211,17 @@ int32_t tDeserializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
clusterCfg
.
ttlChangeOnWrite
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
clusterCfg
.
ttlChangeOnWrite
)
<
0
)
return
-
1
;
}
}
// vnode extra
if
(
!
tDecodeIsEnd
(
&
decoder
))
{
for
(
int32_t
i
=
0
;
i
<
vlen
;
++
i
)
{
SVnodeLoad
*
pLoad
=
taosArrayGet
(
pReq
->
pVloads
,
i
);
int64_t
reserved
=
0
;
if
(
tDecodeI64
(
&
decoder
,
&
pLoad
->
syncTerm
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
reserved
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
reserved
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
reserved
)
<
0
)
return
-
1
;
}
}
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
tDecoderClear
(
&
decoder
);
return
0
;
return
0
;
...
...
source/dnode/vnode/src/vnd/vnodeQuery.c
浏览文件 @
239a79d4
...
@@ -380,6 +380,9 @@ int32_t vnodeGetLoad(SVnode *pVnode, SVnodeLoad *pLoad) {
...
@@ -380,6 +380,9 @@ int32_t vnodeGetLoad(SVnode *pVnode, SVnodeLoad *pLoad) {
pLoad
->
vgId
=
TD_VID
(
pVnode
);
pLoad
->
vgId
=
TD_VID
(
pVnode
);
pLoad
->
syncState
=
state
.
state
;
pLoad
->
syncState
=
state
.
state
;
pLoad
->
syncRestore
=
state
.
restored
;
pLoad
->
syncRestore
=
state
.
restored
;
pLoad
->
syncTerm
=
state
.
term
;
pLoad
->
roleTimeMs
=
state
.
roleTimeMs
;
pLoad
->
startTimeMs
=
state
.
startTimeMs
;
pLoad
->
syncCanRead
=
state
.
canRead
;
pLoad
->
syncCanRead
=
state
.
canRead
;
pLoad
->
cacheUsage
=
tsdbCacheGetUsage
(
pVnode
);
pLoad
->
cacheUsage
=
tsdbCacheGetUsage
(
pVnode
);
pLoad
->
numOfCachedTables
=
tsdbCacheGetElems
(
pVnode
);
pLoad
->
numOfCachedTables
=
tsdbCacheGetElems
(
pVnode
);
...
...
source/libs/sync/src/syncMain.c
浏览文件 @
239a79d4
...
@@ -509,6 +509,7 @@ SSyncState syncGetState(int64_t rid) {
...
@@ -509,6 +509,7 @@ SSyncState syncGetState(int64_t rid) {
if
(
pSyncNode
!=
NULL
)
{
if
(
pSyncNode
!=
NULL
)
{
state
.
state
=
pSyncNode
->
state
;
state
.
state
=
pSyncNode
->
state
;
state
.
roleTimeMs
=
pSyncNode
->
roleTimeMs
;
state
.
roleTimeMs
=
pSyncNode
->
roleTimeMs
;
state
.
startTimeMs
=
pSyncNode
->
startTime
;
state
.
restored
=
pSyncNode
->
restoreFinish
;
state
.
restored
=
pSyncNode
->
restoreFinish
;
if
(
pSyncNode
->
vgId
!=
1
)
{
if
(
pSyncNode
->
vgId
!=
1
)
{
state
.
canRead
=
syncNodeIsReadyForRead
(
pSyncNode
);
state
.
canRead
=
syncNodeIsReadyForRead
(
pSyncNode
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录