提交 8edc164c 编写于 作者: S Shengliang Guan

TD-1652

上级 5d8be741
...@@ -333,11 +333,26 @@ int32_t syncForwardToPeer(void *param, void *data, void *mhandle, int qtype) { ...@@ -333,11 +333,26 @@ int32_t syncForwardToPeer(void *param, void *data, void *mhandle, int qtype) {
if (pNode == NULL) return 0; if (pNode == NULL) return 0;
// always update version if (pNode->replica == 1 || nodeRole != TAOS_SYNC_ROLE_MASTER) {
nodeVersion = pWalHead->version; if (pWalHead->version != nodeVersion + 1) {
sDebug("replica:%d nodeRole:%d qtype:%d", pNode->replica, nodeRole, qtype); sError("vgId:%d, received ver:%" PRIu64 ", inconsistent with last ver:%" PRIu64 ", restart connection",
pNode->vgId, pWalHead->version, nodeVersion);
for (int i = 0; i < pNode->replica; ++i) {
pPeer = pNode->peerInfo[i];
syncRestartConnection(pPeer);
}
} else {
// always update version
nodeVersion = pWalHead->version;
sDebug("vgId:%d, update version, replica:%d nodeRole:%d qtype:%d ver:%" PRIu64, pNode->vgId, pNode->replica,
nodeRole, qtype, pWalHead->version);
}
return 0;
}
if (pNode->replica == 1 || nodeRole != TAOS_SYNC_ROLE_MASTER) return 0; nodeVersion = pWalHead->version;
sDebug("vgId:%d, forward will send, replica:%d nodeRole:%d qtype:%d ver:%" PRIu64, pNode->vgId, pNode->replica,
nodeRole, qtype, pWalHead->version);
// only pkt from RPC or CQ can be forwarded // only pkt from RPC or CQ can be forwarded
if (qtype != TAOS_QTYPE_RPC && qtype != TAOS_QTYPE_CQ) return 0; if (qtype != TAOS_QTYPE_RPC && qtype != TAOS_QTYPE_CQ) return 0;
...@@ -888,12 +903,14 @@ static void syncProcessForwardFromPeer(char *cont, SSyncPeer *pPeer) { ...@@ -888,12 +903,14 @@ static void syncProcessForwardFromPeer(char *cont, SSyncPeer *pPeer) {
SWalHead * pHead = (SWalHead *)cont; SWalHead * pHead = (SWalHead *)cont;
sDebug("%s, forward is received, ver:%" PRIu64, pPeer->id, pHead->version); sDebug("%s, forward is received, ver:%" PRIu64, pPeer->id, pHead->version);
#if 0
if (pHead->version != nodeVersion + 1) { if (pHead->version != nodeVersion + 1) {
sError("%s, forward is received, ver:%" PRIu64 ", inconsistent with last ver:%" PRIu64, pPeer->id, pHead->version, sError("%s, forward is received, ver:%" PRIu64 ", inconsistent with last ver:%" PRIu64, pPeer->id, pHead->version,
nodeVersion); nodeVersion);
syncRestartConnection(pPeer); syncRestartConnection(pPeer);
return; return;
} }
#endif
if (nodeRole == TAOS_SYNC_ROLE_SLAVE) { if (nodeRole == TAOS_SYNC_ROLE_SLAVE) {
// nodeVersion = pHead->version; // nodeVersion = pHead->version;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册