Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
4baafd34
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
4baafd34
编写于
11月 07, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refact: adjust sync log
上级
a1c8db0f
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
6 addition
and
84 deletion
+6
-84
source/libs/sync/inc/syncRaftCfg.h
source/libs/sync/inc/syncRaftCfg.h
+0
-3
source/libs/sync/inc/syncVoteMgr.h
source/libs/sync/inc/syncVoteMgr.h
+0
-20
source/libs/sync/src/syncElection.c
source/libs/sync/src/syncElection.c
+2
-0
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+1
-1
source/libs/sync/src/syncUtil.c
source/libs/sync/src/syncUtil.c
+2
-4
source/libs/sync/src/syncVoteMgr.c
source/libs/sync/src/syncVoteMgr.c
+1
-56
未找到文件。
source/libs/sync/inc/syncRaftCfg.h
浏览文件 @
4baafd34
...
...
@@ -93,9 +93,6 @@ typedef struct SRaftCfgMeta {
int32_t
raftCfgCreateFile
(
SSyncCfg
*
pCfg
,
SRaftCfgMeta
meta
,
const
char
*
path
);
// for debug -------------------
void
raftCfgIndexLog2
(
char
*
s
,
SRaftCfgIndex
*
pCfg
);
#ifdef __cplusplus
}
#endif
...
...
source/libs/sync/inc/syncVoteMgr.h
浏览文件 @
4baafd34
...
...
@@ -20,15 +20,8 @@
extern
"C"
{
#endif
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include "syncInt.h"
#include "syncMessage.h"
#include "syncUtil.h"
#include "taosdef.h"
// SVotesGranted -----------------------------
typedef
struct
SVotesGranted
{
SRaftId
(
*
replicas
)[
TSDB_MAX_REPLICA
];
bool
isGranted
[
TSDB_MAX_REPLICA
];
...
...
@@ -49,13 +42,6 @@ void voteGrantedReset(SVotesGranted *pVotesGranted, SyncTerm term);
cJSON
*
voteGranted2Json
(
SVotesGranted
*
pVotesGranted
);
char
*
voteGranted2Str
(
SVotesGranted
*
pVotesGranted
);
// for debug -------------------
void
voteGrantedPrint
(
SVotesGranted
*
pObj
);
void
voteGrantedPrint2
(
char
*
s
,
SVotesGranted
*
pObj
);
void
voteGrantedLog
(
SVotesGranted
*
pObj
);
void
voteGrantedLog2
(
char
*
s
,
SVotesGranted
*
pObj
);
// SVotesRespond -----------------------------
typedef
struct
SVotesRespond
{
SRaftId
(
*
replicas
)[
TSDB_MAX_REPLICA
];
bool
isRespond
[
TSDB_MAX_REPLICA
];
...
...
@@ -73,12 +59,6 @@ void votesRespondReset(SVotesRespond *pVotesRespond, SyncTerm term);
cJSON
*
votesRespond2Json
(
SVotesRespond
*
pVotesRespond
);
char
*
votesRespond2Str
(
SVotesRespond
*
pVotesRespond
);
// for debug -------------------
void
votesRespondPrint
(
SVotesRespond
*
pObj
);
void
votesRespondPrint2
(
char
*
s
,
SVotesRespond
*
pObj
);
void
votesRespondLog
(
SVotesRespond
*
pObj
);
void
votesRespondLog2
(
char
*
s
,
SVotesRespond
*
pObj
);
#ifdef __cplusplus
}
#endif
...
...
source/libs/sync/src/syncElection.c
浏览文件 @
4baafd34
...
...
@@ -13,11 +13,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define _DEFAULT_SOURCE
#include "syncElection.h"
#include "syncMessage.h"
#include "syncRaftCfg.h"
#include "syncRaftStore.h"
#include "syncVoteMgr.h"
#include "syncUtil.h"
// TLA+ Spec
// RequestVote(i, j) ==
...
...
source/libs/sync/src/syncMain.c
浏览文件 @
4baafd34
...
...
@@ -349,7 +349,7 @@ _DEL_WAL:
sNTrace
(
pSyncNode
,
"wal snapshot begin, index:%"
PRId64
", last apply index:%"
PRId64
,
pSyncNode
->
snapshottingIndex
,
lastApplyIndex
);
}
else
{
sN
Trace
(
pSyncNode
,
"wal snapshot begin error since:%s, index:%"
PRId64
", last apply index:%"
PRId64
,
sN
Error
(
pSyncNode
,
"wal snapshot begin error since:%s, index:%"
PRId64
", last apply index:%"
PRId64
,
terrstr
(
terrno
),
pSyncNode
->
snapshottingIndex
,
lastApplyIndex
);
atomic_store_64
(
&
pSyncNode
->
snapshottingIndex
,
SYNC_INDEX_INVALID
);
}
...
...
source/libs/sync/src/syncUtil.c
浏览文件 @
4baafd34
...
...
@@ -15,8 +15,6 @@
#define _DEFAULT_SOURCE
#include "syncUtil.h"
#include "syncEnv.h"
#include "syncInt.h"
#include "syncRaftCfg.h"
#include "syncRaftStore.h"
#include "syncSnapshot.h"
...
...
@@ -26,7 +24,7 @@ extern void addEpIntoEpSet(SEpSet* pEpSet, const char* fqdn, uint16_t port);
uint64_t
syncUtilAddr2U64
(
const
char
*
host
,
uint16_t
port
)
{
uint32_t
hostU32
=
taosGetIpv4FromFqdn
(
host
);
if
(
hostU32
==
(
uint32_t
)
-
1
)
{
sError
(
"failed to resolve ipv4 addr
.
host:%s"
,
host
);
sError
(
"failed to resolve ipv4 addr
,
host:%s"
,
host
);
terrno
=
TSDB_CODE_TSC_INVALID_FQDN
;
return
-
1
;
}
...
...
@@ -62,7 +60,7 @@ void syncUtilraftId2EpSet(const SRaftId* raftId, SEpSet* pEpSet) {
bool
syncUtilnodeInfo2raftId
(
const
SNodeInfo
*
pInfo
,
SyncGroupId
vgId
,
SRaftId
*
raftId
)
{
uint32_t
ipv4
=
taosGetIpv4FromFqdn
(
pInfo
->
nodeFqdn
);
if
(
ipv4
==
0xFFFFFFFF
||
ipv4
==
1
)
{
sError
(
"failed to resolve ipv4 addr
.
fqdn: %s"
,
pInfo
->
nodeFqdn
);
sError
(
"failed to resolve ipv4 addr
,
fqdn: %s"
,
pInfo
->
nodeFqdn
);
terrno
=
TSDB_CODE_TSC_INVALID_FQDN
;
return
false
;
}
...
...
source/libs/sync/src/syncVoteMgr.c
浏览文件 @
4baafd34
...
...
@@ -13,10 +13,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define _DEFAULT_SOURCE
#include "syncVoteMgr.h"
#include "syncUtil.h"
// SVotesGranted -----------------------------
static
void
voteGrantedClearVotes
(
SVotesGranted
*
pVotesGranted
)
{
memset
(
pVotesGranted
->
isGranted
,
0
,
sizeof
(
pVotesGranted
->
isGranted
));
pVotesGranted
->
votes
=
0
;
...
...
@@ -140,34 +140,6 @@ char *voteGranted2Str(SVotesGranted *pVotesGranted) {
return
serialized
;
}
// for debug -------------------
void
voteGrantedPrint
(
SVotesGranted
*
pObj
)
{
char
*
serialized
=
voteGranted2Str
(
pObj
);
printf
(
"voteGrantedPrint | len:%d | %s
\n
"
,
(
int32_t
)
strlen
(
serialized
),
serialized
);
fflush
(
NULL
);
taosMemoryFree
(
serialized
);
}
void
voteGrantedPrint2
(
char
*
s
,
SVotesGranted
*
pObj
)
{
char
*
serialized
=
voteGranted2Str
(
pObj
);
printf
(
"voteGrantedPrint2 | len:%d | %s | %s
\n
"
,
(
int32_t
)
strlen
(
serialized
),
s
,
serialized
);
fflush
(
NULL
);
taosMemoryFree
(
serialized
);
}
void
voteGrantedLog
(
SVotesGranted
*
pObj
)
{
char
*
serialized
=
voteGranted2Str
(
pObj
);
sTrace
(
"voteGrantedLog | len:%d | %s"
,
(
int32_t
)
strlen
(
serialized
),
serialized
);
taosMemoryFree
(
serialized
);
}
void
voteGrantedLog2
(
char
*
s
,
SVotesGranted
*
pObj
)
{
char
*
serialized
=
voteGranted2Str
(
pObj
);
sTrace
(
"voteGrantedLog2 | len:%d | %s | %s"
,
(
int32_t
)
strlen
(
serialized
),
s
,
serialized
);
taosMemoryFree
(
serialized
);
}
// SVotesRespond -----------------------------
SVotesRespond
*
votesRespondCreate
(
SSyncNode
*
pSyncNode
)
{
SVotesRespond
*
pVotesRespond
=
taosMemoryMalloc
(
sizeof
(
SVotesRespond
));
ASSERT
(
pVotesRespond
!=
NULL
);
...
...
@@ -272,30 +244,3 @@ char *votesRespond2Str(SVotesRespond *pVotesRespond) {
cJSON_Delete
(
pJson
);
return
serialized
;
}
// for debug -------------------
void
votesRespondPrint
(
SVotesRespond
*
pObj
)
{
char
*
serialized
=
votesRespond2Str
(
pObj
);
printf
(
"votesRespondPrint | len:%d | %s
\n
"
,
(
int32_t
)
strlen
(
serialized
),
serialized
);
fflush
(
NULL
);
taosMemoryFree
(
serialized
);
}
void
votesRespondPrint2
(
char
*
s
,
SVotesRespond
*
pObj
)
{
char
*
serialized
=
votesRespond2Str
(
pObj
);
printf
(
"votesRespondPrint2 | len:%d | %s | %s
\n
"
,
(
int32_t
)
strlen
(
serialized
),
s
,
serialized
);
fflush
(
NULL
);
taosMemoryFree
(
serialized
);
}
void
votesRespondLog
(
SVotesRespond
*
pObj
)
{
char
*
serialized
=
votesRespond2Str
(
pObj
);
sTrace
(
"votesRespondLog | len:%d | %s"
,
(
int32_t
)
strlen
(
serialized
),
serialized
);
taosMemoryFree
(
serialized
);
}
void
votesRespondLog2
(
char
*
s
,
SVotesRespond
*
pObj
)
{
char
*
serialized
=
votesRespond2Str
(
pObj
);
sTrace
(
"votesRespondLog2 | len:%d | %s | %s"
,
(
int32_t
)
strlen
(
serialized
),
s
,
serialized
);
taosMemoryFree
(
serialized
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录