Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5556fd0c
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
5556fd0c
编写于
11月 30, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh: add sync offline state
上级
3850b58a
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
14 addition
and
9 deletion
+14
-9
include/libs/sync/sync.h
include/libs/sync/sync.h
+1
-0
source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
+2
-2
source/dnode/mnode/impl/src/mndMain.c
source/dnode/mnode/impl/src/mndMain.c
+3
-3
source/dnode/mnode/impl/src/mndMnode.c
source/dnode/mnode/impl/src/mndMnode.c
+1
-1
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+2
-2
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+5
-1
未找到文件。
include/libs/sync/sync.h
浏览文件 @
5556fd0c
...
...
@@ -67,6 +67,7 @@ typedef struct SWal SWal;
typedef
struct
SSyncRaftEntry
SSyncRaftEntry
;
typedef
enum
{
TAOS_SYNC_STATE_OFFLINE
=
0
,
TAOS_SYNC_STATE_FOLLOWER
=
100
,
TAOS_SYNC_STATE_CANDIDATE
=
101
,
TAOS_SYNC_STATE_LEADER
=
102
,
...
...
source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
浏览文件 @
5556fd0c
...
...
@@ -150,7 +150,7 @@ static void dmGetServerRunStatus(SDnodeMgmt *pMgmt, SServerStatusRsp *pStatus) {
SServerStatusRsp
statusRsp
=
{
0
};
SMonMloadInfo
minfo
=
{
0
};
(
*
pMgmt
->
getMnodeLoadsFp
)(
&
minfo
);
if
(
minfo
.
isMnode
&&
minfo
.
load
.
syncState
==
TAOS_SYNC_STATE_ERROR
)
{
if
(
minfo
.
isMnode
&&
(
minfo
.
load
.
syncState
==
TAOS_SYNC_STATE_ERROR
||
minfo
.
load
.
syncState
==
TAOS_SYNC_STATE_OFFLINE
)
)
{
pStatus
->
statusCode
=
TSDB_SRV_STATUS_SERVICE_DEGRADED
;
snprintf
(
pStatus
->
details
,
sizeof
(
pStatus
->
details
),
"mnode sync state is %s"
,
syncStr
(
minfo
.
load
.
syncState
));
return
;
...
...
@@ -160,7 +160,7 @@ static void dmGetServerRunStatus(SDnodeMgmt *pMgmt, SServerStatusRsp *pStatus) {
(
*
pMgmt
->
getVnodeLoadsFp
)(
&
vinfo
);
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
vinfo
.
pVloads
);
++
i
)
{
SVnodeLoad
*
pLoad
=
taosArrayGet
(
vinfo
.
pVloads
,
i
);
if
(
pLoad
->
syncState
==
TAOS_SYNC_STATE_ERROR
)
{
if
(
pLoad
->
syncState
==
TAOS_SYNC_STATE_ERROR
||
pLoad
->
syncState
==
TAOS_SYNC_STATE_OFFLINE
)
{
pStatus
->
statusCode
=
TSDB_SRV_STATUS_SERVICE_DEGRADED
;
snprintf
(
pStatus
->
details
,
sizeof
(
pStatus
->
details
),
"vnode:%d sync state is %s"
,
pLoad
->
vgId
,
syncStr
(
pLoad
->
syncState
));
...
...
source/dnode/mnode/impl/src/mndMain.c
浏览文件 @
5556fd0c
...
...
@@ -151,10 +151,10 @@ static void mndSetVgroupOffline(SMnode *pMnode, int32_t dnodeId, int64_t curMs)
bool
roleChanged
=
false
;
for
(
int32_t
vg
=
0
;
vg
<
pVgroup
->
replica
;
++
vg
)
{
if
(
pVgroup
->
vnodeGid
[
vg
].
dnodeId
==
dnodeId
)
{
if
(
pVgroup
->
vnodeGid
[
vg
].
syncState
!=
TAOS_SYNC_STATE_
ERROR
)
{
if
(
pVgroup
->
vnodeGid
[
vg
].
syncState
!=
TAOS_SYNC_STATE_
OFFLINE
)
{
mInfo
(
"vgId:%d, state changed by offline check, old state:%s restored:%d new state:error restored:0"
,
pVgroup
->
vgId
,
syncStr
(
pVgroup
->
vnodeGid
[
vg
].
syncState
),
pVgroup
->
vnodeGid
[
vg
].
syncRestore
);
pVgroup
->
vnodeGid
[
vg
].
syncState
=
TAOS_SYNC_STATE_
ERROR
;
pVgroup
->
vnodeGid
[
vg
].
syncState
=
TAOS_SYNC_STATE_
OFFLINE
;
pVgroup
->
vnodeGid
[
vg
].
syncRestore
=
0
;
roleChanged
=
true
;
}
...
...
@@ -756,7 +756,7 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
tstrncpy
(
desc
.
status
,
"ready"
,
sizeof
(
desc
.
status
));
pClusterInfo
->
vgroups_alive
++
;
}
if
(
pVgid
->
syncState
!=
TAOS_SYNC_STATE_ERROR
)
{
if
(
pVgid
->
syncState
!=
TAOS_SYNC_STATE_ERROR
&&
pVgid
->
syncState
!=
TAOS_SYNC_STATE_OFFLINE
)
{
pClusterInfo
->
vnodes_alive
++
;
}
pClusterInfo
->
vnodes_total
++
;
...
...
source/dnode/mnode/impl/src/mndMnode.c
浏览文件 @
5556fd0c
...
...
@@ -185,7 +185,7 @@ static int32_t mndMnodeActionInsert(SSdb *pSdb, SMnodeObj *pObj) {
return
-
1
;
}
pObj
->
syncState
=
TAOS_SYNC_STATE_
ERROR
;
pObj
->
syncState
=
TAOS_SYNC_STATE_
OFFLINE
;
mndReloadSyncConfig
(
pSdb
->
pMnode
);
return
0
;
}
...
...
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
5556fd0c
...
...
@@ -887,7 +887,7 @@ int32_t mndAddVnodeToVgroup(SMnode *pMnode, SVgObj *pVgroup, SArray *pArray) {
}
pVgid
->
dnodeId
=
pDnode
->
id
;
pVgid
->
syncState
=
TAOS_SYNC_STATE_
ERROR
;
pVgid
->
syncState
=
TAOS_SYNC_STATE_
OFFLINE
;
mInfo
(
"db:%s, vgId:%d, vn:%d is added, memory:%"
PRId64
", dnode:%d avail:%"
PRId64
" used:%"
PRId64
,
pVgroup
->
dbName
,
pVgroup
->
vgId
,
pVgroup
->
replica
,
vgMem
,
pVgid
->
dnodeId
,
pDnode
->
memAvail
,
pDnode
->
memUsed
);
...
...
@@ -1193,7 +1193,7 @@ static int32_t mndAddIncVgroupReplicaToTrans(SMnode *pMnode, STrans *pTrans, SDb
SVnodeGid
*
pGid
=
&
pVgroup
->
vnodeGid
[
pVgroup
->
replica
];
pVgroup
->
replica
++
;
pGid
->
dnodeId
=
newDnodeId
;
pGid
->
syncState
=
TAOS_SYNC_STATE_
ERROR
;
pGid
->
syncState
=
TAOS_SYNC_STATE_
OFFLINE
;
for
(
int32_t
i
=
0
;
i
<
pVgroup
->
replica
-
1
;
++
i
)
{
if
(
mndAddAlterVnodeReplicaAction
(
pMnode
,
pTrans
,
pDb
,
pVgroup
,
pVgroup
->
vnodeGid
[
i
].
dnodeId
)
!=
0
)
return
-
1
;
...
...
source/libs/sync/src/syncMain.c
浏览文件 @
5556fd0c
...
...
@@ -2457,8 +2457,12 @@ const char* syncStr(ESyncState state) {
return
"candidate"
;
case
TAOS_SYNC_STATE_LEADER
:
return
"leader"
;
default
:
case
TAOS_SYNC_STATE_ERROR
:
return
"error"
;
case
TAOS_SYNC_STATE_OFFLINE
:
return
"offline"
;
default:
return
"unknown"
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录