Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7bb2d4c7
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
7bb2d4c7
编写于
11月 23, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
11月 23, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #18376 from taosdata/feature/3.0_mhli
refactor(sync): fix coverity scan error
上级
e6b2de7b
fd9a612d
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
11 addition
and
8 deletion
+11
-8
source/libs/sync/src/syncCommit.c
source/libs/sync/src/syncCommit.c
+1
-1
source/libs/sync/src/syncRaftEntry.c
source/libs/sync/src/syncRaftEntry.c
+5
-5
source/libs/sync/src/syncReplication.c
source/libs/sync/src/syncReplication.c
+1
-1
source/libs/sync/src/syncUtil.c
source/libs/sync/src/syncUtil.c
+4
-1
未找到文件。
source/libs/sync/src/syncCommit.c
浏览文件 @
7bb2d4c7
...
@@ -171,7 +171,7 @@ void syncMaybeAdvanceCommitIndex(SSyncNode* pSyncNode) {
...
@@ -171,7 +171,7 @@ void syncMaybeAdvanceCommitIndex(SSyncNode* pSyncNode) {
pSyncNode
->
pLogStore
->
syncLogUpdateCommitIndex
(
pSyncNode
->
pLogStore
,
pSyncNode
->
commitIndex
);
pSyncNode
->
pLogStore
->
syncLogUpdateCommitIndex
(
pSyncNode
->
pLogStore
,
pSyncNode
->
commitIndex
);
// execute fsm
// execute fsm
if
(
pSyncNode
->
pFsm
!=
NULL
)
{
if
(
pSyncNode
!=
NULL
&&
pSyncNode
->
pFsm
!=
NULL
)
{
int32_t
code
=
syncNodeDoCommit
(
pSyncNode
,
beginIndex
,
endIndex
,
pSyncNode
->
state
);
int32_t
code
=
syncNodeDoCommit
(
pSyncNode
,
beginIndex
,
endIndex
,
pSyncNode
->
state
);
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
sNError
(
pSyncNode
,
"advance commit index error, do commit begin:%"
PRId64
", end:%"
PRId64
,
beginIndex
,
sNError
(
pSyncNode
,
"advance commit index error, do commit begin:%"
PRId64
", end:%"
PRId64
,
beginIndex
,
...
...
source/libs/sync/src/syncRaftEntry.c
浏览文件 @
7bb2d4c7
...
@@ -64,7 +64,7 @@ SSyncRaftEntry* syncEntryBuildFromRpcMsg(const SRpcMsg* pMsg, SyncTerm term, Syn
...
@@ -64,7 +64,7 @@ SSyncRaftEntry* syncEntryBuildFromRpcMsg(const SRpcMsg* pMsg, SyncTerm term, Syn
}
}
SSyncRaftEntry
*
syncEntryBuildFromAppendEntries
(
const
SyncAppendEntries
*
pMsg
)
{
SSyncRaftEntry
*
syncEntryBuildFromAppendEntries
(
const
SyncAppendEntries
*
pMsg
)
{
SSyncRaftEntry
*
pEntry
=
syncEntryBuild
(
pMsg
->
dataLen
);
SSyncRaftEntry
*
pEntry
=
syncEntryBuild
(
(
int32_t
)(
pMsg
->
dataLen
)
);
if
(
pEntry
==
NULL
)
return
NULL
;
if
(
pEntry
==
NULL
)
return
NULL
;
memcpy
(
pEntry
,
pMsg
->
data
,
pMsg
->
dataLen
);
memcpy
(
pEntry
,
pMsg
->
data
,
pMsg
->
dataLen
);
...
@@ -91,15 +91,14 @@ SSyncRaftEntry* syncEntryBuildNoop(SyncTerm term, SyncIndex index, int32_t vgId)
...
@@ -91,15 +91,14 @@ SSyncRaftEntry* syncEntryBuildNoop(SyncTerm term, SyncIndex index, int32_t vgId)
void
syncEntryDestory
(
SSyncRaftEntry
*
pEntry
)
{
void
syncEntryDestory
(
SSyncRaftEntry
*
pEntry
)
{
if
(
pEntry
!=
NULL
)
{
if
(
pEntry
!=
NULL
)
{
taosMemoryFree
(
pEntry
);
sTrace
(
"free entry: %p"
,
pEntry
);
sTrace
(
"free entry: %p"
,
pEntry
);
taosMemoryFree
(
pEntry
);
}
}
}
}
void
syncEntry2OriginalRpc
(
const
SSyncRaftEntry
*
pEntry
,
SRpcMsg
*
pRpcMsg
)
{
void
syncEntry2OriginalRpc
(
const
SSyncRaftEntry
*
pEntry
,
SRpcMsg
*
pRpcMsg
)
{
pRpcMsg
->
msgType
=
pEntry
->
originalRpcType
;
pRpcMsg
->
msgType
=
pEntry
->
originalRpcType
;
pRpcMsg
->
contLen
=
pEntry
->
dataLen
;
pRpcMsg
->
contLen
=
(
int32_t
)(
pEntry
->
dataLen
)
;
pRpcMsg
->
pCont
=
rpcMallocCont
(
pRpcMsg
->
contLen
);
pRpcMsg
->
pCont
=
rpcMallocCont
(
pRpcMsg
->
contLen
);
memcpy
(
pRpcMsg
->
pCont
,
pEntry
->
data
,
pRpcMsg
->
contLen
);
memcpy
(
pRpcMsg
->
pCont
,
pEntry
->
data
,
pRpcMsg
->
contLen
);
}
}
...
@@ -339,7 +338,8 @@ int32_t raftEntryCacheGetEntry(struct SRaftEntryCache* pCache, SyncIndex index,
...
@@ -339,7 +338,8 @@ int32_t raftEntryCacheGetEntry(struct SRaftEntryCache* pCache, SyncIndex index,
SSyncRaftEntry
*
pEntry
=
NULL
;
SSyncRaftEntry
*
pEntry
=
NULL
;
int32_t
code
=
raftEntryCacheGetEntryP
(
pCache
,
index
,
&
pEntry
);
int32_t
code
=
raftEntryCacheGetEntryP
(
pCache
,
index
,
&
pEntry
);
if
(
code
==
1
)
{
if
(
code
==
1
)
{
*
ppEntry
=
taosMemoryMalloc
((
int64_t
)(
pEntry
->
bytes
));
int32_t
bytes
=
(
int32_t
)
pEntry
->
bytes
;
*
ppEntry
=
taosMemoryMalloc
((
int64_t
)
bytes
);
memcpy
(
*
ppEntry
,
pEntry
,
pEntry
->
bytes
);
memcpy
(
*
ppEntry
,
pEntry
,
pEntry
->
bytes
);
(
*
ppEntry
)
->
rid
=
-
1
;
(
*
ppEntry
)
->
rid
=
-
1
;
}
else
{
}
else
{
...
...
source/libs/sync/src/syncReplication.c
浏览文件 @
7bb2d4c7
...
@@ -91,7 +91,7 @@ int32_t syncNodeReplicateOne(SSyncNode* pSyncNode, SRaftId* pDestId, bool snapsh
...
@@ -91,7 +91,7 @@ int32_t syncNodeReplicateOne(SSyncNode* pSyncNode, SRaftId* pDestId, bool snapsh
if
(
code
==
0
)
{
if
(
code
==
0
)
{
ASSERT
(
pEntry
!=
NULL
);
ASSERT
(
pEntry
!=
NULL
);
code
=
syncBuildAppendEntries
(
&
rpcMsg
,
pEntry
->
bytes
,
pSyncNode
->
vgId
);
code
=
syncBuildAppendEntries
(
&
rpcMsg
,
(
int32_t
)(
pEntry
->
bytes
)
,
pSyncNode
->
vgId
);
ASSERT
(
code
==
0
);
ASSERT
(
code
==
0
);
pMsg
=
rpcMsg
.
pCont
;
pMsg
=
rpcMsg
.
pCont
;
...
...
source/libs/sync/src/syncUtil.c
浏览文件 @
7bb2d4c7
...
@@ -229,7 +229,10 @@ void syncPrintNodeLog(const char* flags, ELogLevel level, int32_t dflag, SSyncNo
...
@@ -229,7 +229,10 @@ void syncPrintNodeLog(const char* flags, ELogLevel level, int32_t dflag, SSyncNo
int32_t
writeLen
=
vsnprintf
(
eventLog
,
sizeof
(
eventLog
),
format
,
argpointer
);
int32_t
writeLen
=
vsnprintf
(
eventLog
,
sizeof
(
eventLog
),
format
,
argpointer
);
va_end
(
argpointer
);
va_end
(
argpointer
);
int32_t
aqItems
=
pNode
->
pFsm
->
FpApplyQueueItems
(
pNode
->
pFsm
);
int32_t
aqItems
=
0
;
if
(
pNode
!=
NULL
&&
pNode
->
pFsm
!=
NULL
&&
pNode
->
pFsm
->
FpApplyQueueItems
!=
NULL
)
{
aqItems
=
pNode
->
pFsm
->
FpApplyQueueItems
(
pNode
->
pFsm
);
}
// restore error code
// restore error code
terrno
=
errCode
;
terrno
=
errCode
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录