Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
adminstrot
TDengine
提交
750650c7
TDengine
项目概览
adminstrot
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
750650c7
编写于
1月 11, 2021
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-2680
上级
a56e677f
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
64 addition
and
6 deletion
+64
-6
src/common/inc/tglobal.h
src/common/inc/tglobal.h
+1
-0
src/common/src/tglobal.c
src/common/src/tglobal.c
+1
-0
src/mnode/src/mnodeDnode.c
src/mnode/src/mnodeDnode.c
+45
-2
src/sync/inc/syncInt.h
src/sync/inc/syncInt.h
+1
-0
src/sync/src/syncMain.c
src/sync/src/syncMain.c
+16
-4
未找到文件。
src/common/inc/tglobal.h
浏览文件 @
750650c7
...
...
@@ -36,6 +36,7 @@ extern int8_t tsEnableVnodeBak;
extern
int8_t
tsEnableTelemetryReporting
;
extern
char
tsEmail
[];
extern
char
tsArbitrator
[];
extern
int8_t
tsArbOnline
;
// common
extern
int
tsRpcTimer
;
...
...
src/common/src/tglobal.c
浏览文件 @
750650c7
...
...
@@ -41,6 +41,7 @@ int32_t tsStatusInterval = 1; // second
int32_t
tsNumOfMnodes
=
3
;
int8_t
tsEnableVnodeBak
=
1
;
int8_t
tsEnableTelemetryReporting
=
1
;
int8_t
tsArbOnline
=
0
;
char
tsEmail
[
TSDB_FQDN_LEN
]
=
{
0
};
// common
...
...
src/mnode/src/mnodeDnode.c
浏览文件 @
750650c7
...
...
@@ -810,6 +810,10 @@ static int32_t mnodeGetDnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pC
}
pShow
->
numOfRows
=
mnodeGetDnodesNum
();
if
(
tsArbitrator
[
0
]
!=
0
)
{
pShow
->
numOfRows
++
;
}
pShow
->
rowSize
=
pShow
->
offset
[
cols
-
1
]
+
pShow
->
bytes
[
cols
-
1
];
pShow
->
pIter
=
NULL
;
...
...
@@ -821,7 +825,7 @@ static int32_t mnodeGetDnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pC
static
int32_t
mnodeRetrieveDnodes
(
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
,
void
*
pConn
)
{
int32_t
numOfRows
=
0
;
int32_t
cols
=
0
;
SDnodeObj
*
pDnode
=
NULL
;
SDnodeObj
*
pDnode
=
NULL
;
char
*
pWrite
;
while
(
numOfRows
<
rows
)
{
...
...
@@ -864,10 +868,49 @@ static int32_t mnodeRetrieveDnodes(SShowObj *pShow, char *data, int32_t rows, vo
STR_TO_VARSTR
(
pWrite
,
offlineReason
[
pDnode
->
offlineReason
]);
cols
++
;
numOfRows
++
;
numOfRows
++
;
mnodeDecDnodeRef
(
pDnode
);
}
if
(
tsArbitrator
[
0
]
!=
0
)
{
cols
=
0
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
int16_t
*
)
pWrite
=
0
;
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
tsArbitrator
,
pShow
->
bytes
[
cols
]);
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
int16_t
*
)
pWrite
=
0
;
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
int16_t
*
)
pWrite
=
0
;
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
char
*
status
=
dnodeStatus
[
tsArbOnline
>
0
?
TAOS_DN_STATUS_READY
:
TAOS_DN_STATUS_OFFLINE
];
STR_TO_VARSTR
(
pWrite
,
status
);
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
STR_TO_VARSTR
(
pWrite
,
"arb"
);
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
int64_t
*
)
pWrite
=
0
;
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
STR_TO_VARSTR
(
pWrite
,
"-"
);
cols
++
;
numOfRows
++
;
}
mnodeVacuumResult
(
data
,
pShow
->
numOfColumns
,
numOfRows
,
rows
,
pShow
);
pShow
->
numOfReads
+=
numOfRows
;
return
numOfRows
;
...
...
src/sync/inc/syncInt.h
浏览文件 @
750650c7
...
...
@@ -87,6 +87,7 @@ typedef struct SsyncPeer {
int32_t
numOfRetrieves
;
// number of retrieves tried
int32_t
fileChanged
;
// a flag to indicate file is changed during retrieving process
int32_t
refCount
;
int8_t
isArb
;
int64_t
rid
;
void
*
timer
;
void
*
pConn
;
...
...
src/sync/src/syncMain.c
浏览文件 @
750650c7
...
...
@@ -475,7 +475,13 @@ static void syncAddArbitrator(SSyncNode *pNode) {
}
}
pNode
->
peerInfo
[
TAOS_SYNC_MAX_REPLICA
]
=
syncAddPeer
(
pNode
,
&
nodeInfo
);
pPeer
=
syncAddPeer
(
pNode
,
&
nodeInfo
);
if
(
pPeer
!=
NULL
)
{
pPeer
->
isArb
=
1
;
sInfo
(
"%s, is added as arbitrator"
,
pPeer
->
id
);
}
pNode
->
peerInfo
[
TAOS_SYNC_MAX_REPLICA
]
=
pPeer
;
}
static
void
syncFreeNode
(
void
*
param
)
{
...
...
@@ -651,9 +657,14 @@ static void syncChooseMaster(SSyncNode *pNode) {
// add arbitrator connection
SSyncPeer
*
pArb
=
pNode
->
peerInfo
[
TAOS_SYNC_MAX_REPLICA
];
if
(
pArb
&&
pArb
->
role
!=
TAOS_SYNC_ROLE_OFFLINE
)
{
onlineNum
++
;
replica
=
pNode
->
replica
+
1
;
if
(
pArb
)
{
if
(
pArb
->
role
!=
TAOS_SYNC_ROLE_OFFLINE
)
{
onlineNum
++
;
replica
=
pNode
->
replica
+
1
;
sDebug
(
"vgId:%d, arb:%s is used while choose master"
,
pNode
->
vgId
,
pArb
->
id
);
}
else
{
sError
(
"vgId:%d, arb:%s is not used while choose master for its offline"
,
pNode
->
vgId
,
pArb
->
id
);
}
}
if
(
index
<
0
&&
onlineNum
>
replica
/
2
.
0
)
{
...
...
@@ -1118,6 +1129,7 @@ static void syncSetupPeerConnection(SSyncPeer *pPeer) {
pPeer
->
peerFd
=
connFd
;
pPeer
->
role
=
TAOS_SYNC_ROLE_UNSYNCED
;
pPeer
->
pConn
=
syncAllocateTcpConn
(
tsTcpPool
,
pPeer
->
rid
,
connFd
);
if
(
pPeer
->
isArb
)
tsArbOnline
=
1
;
}
else
{
sDebug
(
"%s, failed to setup peer connection to server since %s, try later"
,
pPeer
->
id
,
strerror
(
errno
));
taosClose
(
connFd
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录