Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2854d610
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看板
提交
2854d610
编写于
3月 16, 2021
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-3308
上级
851975db
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
20 addition
and
19 deletion
+20
-19
src/dnode/src/dnodeVWrite.c
src/dnode/src/dnodeVWrite.c
+1
-1
src/inc/tsync.h
src/inc/tsync.h
+2
-2
src/inc/vnode.h
src/inc/vnode.h
+1
-1
src/mnode/src/mnodeSdb.c
src/mnode/src/mnodeSdb.c
+3
-3
src/sync/src/syncMain.c
src/sync/src/syncMain.c
+7
-7
src/vnode/inc/vnodeSync.h
src/vnode/inc/vnodeSync.h
+1
-1
src/vnode/src/vnodeSync.c
src/vnode/src/vnodeSync.c
+3
-3
src/vnode/src/vnodeWrite.c
src/vnode/src/vnodeWrite.c
+2
-1
未找到文件。
src/dnode/src/dnodeVWrite.c
浏览文件 @
2854d610
...
...
@@ -222,7 +222,7 @@ static void *dnodeProcessVWriteQueue(void *wparam) {
dnodeSendRpcVWriteRsp
(
pVnode
,
pWrite
,
pWrite
->
code
);
}
else
{
if
(
qtype
==
TAOS_QTYPE_FWD
)
{
vnodeConfirmForward
(
pVnode
,
pWrite
->
pHead
.
version
,
0
);
vnodeConfirmForward
(
pVnode
,
pWrite
->
pHead
.
version
,
0
,
pWrite
->
pHead
.
msgType
!=
TSDB_MSG_TYPE_SUBMIT
);
}
if
(
pWrite
->
rspRet
.
rsp
)
{
rpcFreeCont
(
pWrite
->
rspRet
.
rsp
);
...
...
src/inc/tsync.h
浏览文件 @
2854d610
...
...
@@ -112,8 +112,8 @@ void syncCleanUp();
int64_t
syncStart
(
const
SSyncInfo
*
);
void
syncStop
(
int64_t
rid
);
int32_t
syncReconfig
(
int64_t
rid
,
const
SSyncCfg
*
);
int32_t
syncForwardToPeer
(
int64_t
rid
,
void
*
pHead
,
void
*
mhandle
,
int32_t
qtype
);
void
syncConfirmForward
(
int64_t
rid
,
uint64_t
version
,
int32_t
code
);
int32_t
syncForwardToPeer
(
int64_t
rid
,
void
*
pHead
,
void
*
mhandle
,
int32_t
qtype
,
bool
force
);
void
syncConfirmForward
(
int64_t
rid
,
uint64_t
version
,
int32_t
code
,
bool
force
);
void
syncRecover
(
int64_t
rid
);
// recover from other nodes:
int32_t
syncGetNodesRole
(
int64_t
rid
,
SNodesRole
*
);
...
...
src/inc/vnode.h
浏览文件 @
2854d610
...
...
@@ -78,7 +78,7 @@ void vnodeFreeFromWQueue(void *pVnode, SVWriteMsg *pWrite);
int32_t
vnodeProcessWrite
(
void
*
pVnode
,
void
*
pHead
,
int32_t
qtype
,
void
*
pRspRet
);
// vnodeSync
void
vnodeConfirmForward
(
void
*
pVnode
,
uint64_t
version
,
int32_t
code
);
void
vnodeConfirmForward
(
void
*
pVnode
,
uint64_t
version
,
int32_t
code
,
bool
force
);
// vnodeRead
int32_t
vnodeWriteToRQueue
(
void
*
pVnode
,
void
*
pCont
,
int32_t
contLen
,
int8_t
qtype
,
void
*
rparam
);
...
...
src/mnode/src/mnodeSdb.c
浏览文件 @
2854d610
...
...
@@ -680,7 +680,7 @@ static int32_t sdbProcessWrite(void *wparam, void *hparam, int32_t qtype, void *
if
(
pRow
!=
NULL
)
{
// forward to peers
pRow
->
processedCount
=
0
;
int32_t
syncCode
=
syncForwardToPeer
(
tsSdbMgmt
.
sync
,
pHead
,
pRow
,
TAOS_QTYPE_RPC
);
int32_t
syncCode
=
syncForwardToPeer
(
tsSdbMgmt
.
sync
,
pHead
,
pRow
,
TAOS_QTYPE_RPC
,
false
);
if
(
syncCode
<=
0
)
pRow
->
processedCount
=
1
;
if
(
syncCode
<
0
)
{
...
...
@@ -700,7 +700,7 @@ static int32_t sdbProcessWrite(void *wparam, void *hparam, int32_t qtype, void *
actStr
[
action
],
sdbGetKeyStr
(
pTable
,
pHead
->
cont
),
pHead
->
version
);
// even it is WAL/FWD, it shall be called to update version in sync
syncForwardToPeer
(
tsSdbMgmt
.
sync
,
pHead
,
pRow
,
TAOS_QTYPE_RPC
);
syncForwardToPeer
(
tsSdbMgmt
.
sync
,
pHead
,
pRow
,
TAOS_QTYPE_RPC
,
false
);
// from wal or forward msg, row not created, should add into hash
if
(
action
==
SDB_ACTION_INSERT
)
{
...
...
@@ -1119,7 +1119,7 @@ static void *sdbWorkerFp(void *pWorker) {
sdbConfirmForward
(
1
,
pRow
,
pRow
->
code
);
}
else
{
if
(
qtype
==
TAOS_QTYPE_FWD
)
{
syncConfirmForward
(
tsSdbMgmt
.
sync
,
pRow
->
pHead
.
version
,
pRow
->
code
);
syncConfirmForward
(
tsSdbMgmt
.
sync
,
pRow
->
pHead
.
version
,
pRow
->
code
,
false
);
}
sdbFreeFromQueue
(
pRow
);
}
...
...
src/sync/src/syncMain.c
浏览文件 @
2854d610
...
...
@@ -56,7 +56,7 @@ static void syncMonitorNodeRole(void *param, void *tmrId);
static
void
syncProcessFwdAck
(
SSyncNode
*
pNode
,
SFwdInfo
*
pFwdInfo
,
int32_t
code
);
static
int32_t
syncSaveFwdInfo
(
SSyncNode
*
pNode
,
uint64_t
version
,
void
*
mhandle
);
static
void
syncRestartPeer
(
SSyncPeer
*
pPeer
);
static
int32_t
syncForwardToPeerImpl
(
SSyncNode
*
pNode
,
void
*
data
,
void
*
mhandle
,
int32_t
qtyp
);
static
int32_t
syncForwardToPeerImpl
(
SSyncNode
*
pNode
,
void
*
data
,
void
*
mhandle
,
int32_t
qtyp
e
,
bool
force
);
static
SSyncPeer
*
syncAddPeer
(
SSyncNode
*
pNode
,
const
SNodeInfo
*
pInfo
);
static
void
syncStartCheckPeerConn
(
SSyncPeer
*
pPeer
);
...
...
@@ -378,24 +378,24 @@ int32_t syncReconfig(int64_t rid, const SSyncCfg *pNewCfg) {
return
0
;
}
int32_t
syncForwardToPeer
(
int64_t
rid
,
void
*
data
,
void
*
mhandle
,
int32_t
qtype
)
{
int32_t
syncForwardToPeer
(
int64_t
rid
,
void
*
data
,
void
*
mhandle
,
int32_t
qtype
,
bool
force
)
{
if
(
rid
<=
0
)
return
0
;
SSyncNode
*
pNode
=
syncAcquireNode
(
rid
);
if
(
pNode
==
NULL
)
return
0
;
int32_t
code
=
syncForwardToPeerImpl
(
pNode
,
data
,
mhandle
,
qtype
);
int32_t
code
=
syncForwardToPeerImpl
(
pNode
,
data
,
mhandle
,
qtype
,
force
);
syncReleaseNode
(
pNode
);
return
code
;
}
void
syncConfirmForward
(
int64_t
rid
,
uint64_t
version
,
int32_t
code
)
{
void
syncConfirmForward
(
int64_t
rid
,
uint64_t
version
,
int32_t
code
,
bool
force
)
{
SSyncNode
*
pNode
=
syncAcquireNode
(
rid
);
if
(
pNode
==
NULL
)
return
;
SSyncPeer
*
pPeer
=
pNode
->
pMaster
;
if
(
pPeer
&&
pNode
->
quorum
>
1
)
{
if
(
pPeer
&&
(
pNode
->
quorum
>
1
||
force
)
)
{
SFwdRsp
rsp
;
syncBuildSyncFwdRsp
(
&
rsp
,
pNode
->
vgId
,
version
,
code
);
...
...
@@ -1414,7 +1414,7 @@ static void syncMonitorFwdInfos(void *param, void *tmrId) {
syncReleaseNode
(
pNode
);
}
static
int32_t
syncForwardToPeerImpl
(
SSyncNode
*
pNode
,
void
*
data
,
void
*
mhandle
,
int32_t
qtype
)
{
static
int32_t
syncForwardToPeerImpl
(
SSyncNode
*
pNode
,
void
*
data
,
void
*
mhandle
,
int32_t
qtype
,
bool
force
)
{
SSyncPeer
*
pPeer
;
SSyncHead
*
pSyncHead
;
SWalHead
*
pWalHead
=
data
;
...
...
@@ -1458,7 +1458,7 @@ static int32_t syncForwardToPeerImpl(SSyncNode *pNode, void *data, void *mhandle
if
(
pPeer
==
NULL
||
pPeer
->
peerFd
<
0
)
continue
;
if
(
pPeer
->
role
!=
TAOS_SYNC_ROLE_SLAVE
&&
pPeer
->
sstatus
!=
TAOS_SYNC_STATUS_CACHE
)
continue
;
if
(
pNode
->
quorum
>
1
&&
code
==
0
)
{
if
(
(
pNode
->
quorum
>
1
||
force
)
&&
code
==
0
)
{
code
=
syncSaveFwdInfo
(
pNode
,
pWalHead
->
version
,
mhandle
);
if
(
code
>=
0
)
code
=
1
;
}
...
...
src/vnode/inc/vnodeSync.h
浏览文件 @
2854d610
...
...
@@ -32,7 +32,7 @@ int32_t vnodeWriteToCache(int32_t vgId, void *wparam, int32_t qtype, void *rpar
int32_t
vnodeGetVersion
(
int32_t
vgId
,
uint64_t
*
fver
,
uint64_t
*
wver
);
int32_t
vnodeResetVersion
(
int32_t
vgId
,
uint64_t
fver
);
void
vnodeConfirmForward
(
void
*
pVnode
,
uint64_t
version
,
int32_t
code
);
void
vnodeConfirmForward
(
void
*
pVnode
,
uint64_t
version
,
int32_t
code
,
bool
force
);
#ifdef __cplusplus
}
...
...
src/vnode/src/vnodeSync.c
浏览文件 @
2854d610
...
...
@@ -174,7 +174,7 @@ int32_t vnodeResetVersion(int32_t vgId, uint64_t fver) {
return
0
;
}
void
vnodeConfirmForward
(
void
*
vparam
,
uint64_t
version
,
int32_t
code
)
{
void
vnodeConfirmForward
(
void
*
vparam
,
uint64_t
version
,
int32_t
code
,
bool
force
)
{
SVnodeObj
*
pVnode
=
vparam
;
syncConfirmForward
(
pVnode
->
sync
,
version
,
code
);
}
syncConfirmForward
(
pVnode
->
sync
,
version
,
code
,
force
);
}
\ No newline at end of file
src/vnode/src/vnodeWrite.c
浏览文件 @
2854d610
...
...
@@ -88,7 +88,8 @@ int32_t vnodeProcessWrite(void *vparam, void *wparam, int32_t qtype, void *rpara
// forward to peers, even it is WAL/FWD, it shall be called to update version in sync
int32_t
syncCode
=
0
;
syncCode
=
syncForwardToPeer
(
pVnode
->
sync
,
pHead
,
pWrite
,
qtype
);
bool
force
=
(
pWrite
==
NULL
?
false
:
pWrite
->
pHead
.
msgType
!=
TSDB_MSG_TYPE_SUBMIT
);
syncCode
=
syncForwardToPeer
(
pVnode
->
sync
,
pHead
,
pWrite
,
qtype
,
force
);
if
(
syncCode
<
0
)
return
syncCode
;
// write into WAL
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录