diff --git a/src/sync/src/syncMain.c b/src/sync/src/syncMain.c index 2cbc65c03d..26b6586587 100644 --- a/src/sync/src/syncMain.c +++ b/src/sync/src/syncMain.c @@ -686,7 +686,7 @@ static void syncCheckRole(SSyncPeer *pPeer, SPeerStatus* peersStatus, int8_t new if (pMaster) { // master is there pNode->pMaster = pMaster; - sDebug("%s, it is the master, replica:^%d sver:%" PRIu64, pMaster->id, pNode->replica, pMaster->version); + sDebug("%s, it is the master, replica:%d sver:%" PRIu64, pMaster->id, pNode->replica, pMaster->version); if (syncValidateMaster(pPeer) < 0) return; diff --git a/src/sync/src/syncRestore.c b/src/sync/src/syncRestore.c index 8651879eb6..df504eca60 100644 --- a/src/sync/src/syncRestore.c +++ b/src/sync/src/syncRestore.c @@ -90,15 +90,18 @@ static int32_t syncRestoreFile(SSyncPeer *pPeer, uint64_t *fversion) { break; } + sDebug("%s, file:%s info is received from master, index:%d size:%" PRId64 " fver:%" PRIu64 " magic:%d", pPeer->id, + minfo.name, minfo.index, minfo.size, minfo.fversion, minfo.magic); + // remove extra files on slave between the current and last index syncRemoveExtraFile(pPeer, pindex + 1, minfo.index - 1); pindex = minfo.index; // check the file info sinfo = minfo; - sDebug("%s, get file:%s info size:%" PRId64, pPeer->id, minfo.name, minfo.size); - sinfo.magic = (*pNode->getFileInfo)(pNode->vgId, sinfo.name, &sinfo.index, TAOS_SYNC_MAX_INDEX, &sinfo.size, - &sinfo.fversion); + sinfo.magic = (*pNode->getFileInfo)(pNode->vgId, sinfo.name, &sinfo.index, TAOS_SYNC_MAX_INDEX, &sinfo.size, &sinfo.fversion); + sDebug("%s, local file:%s info, index:%d size:%" PRId64 " fver:%" PRIu64 " magic:%d", pPeer->id, sinfo.name, + sinfo.index, sinfo.size, sinfo.fversion, sinfo.magic); // if file not there or magic is not the same, file shall be synced memset(&fileAck, 0, sizeof(SFileAck)); @@ -116,6 +119,8 @@ static int32_t syncRestoreFile(SSyncPeer *pPeer, uint64_t *fversion) { if (fileAck.sync == 0) { sDebug("%s, %s is the same", pPeer->id, minfo.name); continue; + } else { + sDebug("%s, %s will be received, size:%" PRId64, pPeer->id, minfo.name, minfo.size); } // if sync is required, open file, receive from master, and write to file diff --git a/src/sync/src/syncRetrieve.c b/src/sync/src/syncRetrieve.c index 02d990313e..6a70835c31 100644 --- a/src/sync/src/syncRetrieve.c +++ b/src/sync/src/syncRetrieve.c @@ -104,7 +104,8 @@ static int32_t syncRetrieveFile(SSyncPeer *pPeer) { fileInfo.magic = (*pNode->getFileInfo)(pNode->vgId, fileInfo.name, &fileInfo.index, TAOS_SYNC_MAX_INDEX, &fileInfo.size, &fileInfo.fversion); syncBuildFileInfo(&fileInfo, pNode->vgId); - sDebug("%s, file:%s info is sent, size:%" PRId64, pPeer->id, fileInfo.name, fileInfo.size); + sDebug("%s, file:%s info is sent, index:%d size:%" PRId64 " fver:%" PRIu64 " magic:%d", pPeer->id, fileInfo.name, + fileInfo.index, fileInfo.size, fileInfo.fversion, fileInfo.magic); // send the file info int32_t ret = taosWriteMsg(pPeer->syncFd, &(fileInfo), sizeof(SFileInfo)); @@ -144,6 +145,8 @@ static int32_t syncRetrieveFile(SSyncPeer *pPeer) { fileInfo.index++; sDebug("%s, %s is the same", pPeer->id, fileInfo.name); continue; + } else { + sDebug("%s, %s will be sent", pPeer->id, fileInfo.name); } // get the full path to file diff --git a/tests/script/unique/db/replica_add12.sim b/tests/script/unique/db/replica_add12.sim index 751dca855e..9ad03a9b15 100644 --- a/tests/script/unique/db/replica_add12.sim +++ b/tests/script/unique/db/replica_add12.sim @@ -230,6 +230,7 @@ print online vnodes $data03 if $data03 != 2 then goto step6 endi +sleep 1000 sql insert into d1.t1 values(now, 3) sql insert into d2.t2 values(now, 3) @@ -307,6 +308,7 @@ print online vnodes $data03 if $data03 != 2 then goto step7 endi +sleep 1000 sql insert into d1.t1 values(now, 5) sql insert into d2.t2 values(now, 5) diff --git a/tests/script/unique/db/replica_add13.sim b/tests/script/unique/db/replica_add13.sim index f1158aad80..6bf2521197 100644 --- a/tests/script/unique/db/replica_add13.sim +++ b/tests/script/unique/db/replica_add13.sim @@ -238,6 +238,7 @@ print online vnodes $data03 if $data03 != 3 then goto step6 endi +sleep 1000 system sh/exec.sh -n dnode3 -s stop -x SIGINT sleep 5000 @@ -307,6 +308,7 @@ print online vnodes $data03 if $data03 != 3 then goto step7 endi +sleep 1000 system sh/exec.sh -n dnode4 -s stop -x SIGINT sleep 5000 @@ -372,6 +374,7 @@ print online vnodes $data03 if $data03 != 3 then goto step8 endi +sleep 1000 system sh/exec.sh -n dnode2 -s stop -x SIGINT sleep 5000 diff --git a/tests/script/unique/db/replica_add23.sim b/tests/script/unique/db/replica_add23.sim index 529bf4628c..698973802d 100644 --- a/tests/script/unique/db/replica_add23.sim +++ b/tests/script/unique/db/replica_add23.sim @@ -239,6 +239,7 @@ print online vnodes $data03 if $data03 != 3 then goto step6 endi +sleep 1000 system sh/exec.sh -n dnode3 -s stop -x SIGINT sleep 5000 @@ -304,6 +305,7 @@ print online vnodes $data03 if $data03 != 3 then goto step7 endi +sleep 1000 system sh/exec.sh -n dnode4 -s stop -x SIGINT sleep 5000 @@ -369,6 +371,7 @@ print online vnodes $data03 if $data03 != 3 then goto step8 endi +sleep 1000 system sh/exec.sh -n dnode2 -s stop -x SIGINT sleep 5000 diff --git a/tests/script/unique/db/replica_part.sim b/tests/script/unique/db/replica_part.sim index b2dd3756bd..376f1bc37b 100644 --- a/tests/script/unique/db/replica_part.sim +++ b/tests/script/unique/db/replica_part.sim @@ -141,6 +141,7 @@ print online vnodes $data03 if $data03 != 2 then goto step3 endi +sleep 1000 print ========= step4 sql insert into d1.t1 values(now, 2) @@ -220,6 +221,7 @@ print online vnodes $data03 if $data03 != 2 then goto step6 endi +sleep 1000 system sh/exec.sh -n dnode3 -s stop -x SIGINT sleep 5000 @@ -268,6 +270,7 @@ print online vnodes $data03 if $data03 != 2 then goto step7 endi +sleep 1000 sql insert into d1.t1 values(now, 5) sql insert into d2.t2 values(now, 5)