Merge pull request #2816 from taosdata/feature/quorum

return code:1 only when packet is forwarded
This commit is contained in:
Shengliang Guan 2020-07-30 18:31:32 +08:00 committed by GitHub
commit 8134cedd57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -311,16 +311,16 @@ int32_t syncForwardToPeer(void *param, void *data, void *mhandle, int qtype)
pthread_mutex_lock(&(pNode->mutex));
if (pNode->quorum > 1) {
syncSaveFwdInfo(pNode, pWalHead->version, mhandle);
code = 1;
}
for (int i = 0; i < pNode->replica; ++i) {
pPeer = pNode->peerInfo[i];
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) {
syncSaveFwdInfo(pNode, pWalHead->version, mhandle);
code = 1;
}
int retLen = write(pPeer->peerFd, pSyncHead, fwdLen);
if (retLen == fwdLen) {
sDebug("%s, forward is sent, ver:%" PRIu64 " contLen:%d", pPeer->id, pWalHead->version, pWalHead->len);