diff --git a/src/sync/src/syncMain.c b/src/sync/src/syncMain.c index 2cbc65c03d45c6f0694c8643a69b134885b522a2..26b65865879219a7774e581bcc325b1dff877ef3 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 8651879eb6cb06ff629c694f128b6107bf8f19a2..df504eca603530234b752fac4883bcd80f3ed92b 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 02d990313e8c95518e22939c8ab0d41ad05604c2..6a70835c31c1317077ae4c13b77ef7b0f6deb9cc 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 751dca855eaf558a842790e71c71c3354f8b703c..9ad03a9b152b124a8d1583556553d66ac552cb81 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 f1158aad80857604f9d050cfc2e36e9b3517ac28..6bf252119754629ade4da9c3622497105d853c2f 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 529bf4628cf6143347947a948d1a88a44cf057d6..698973802da0ad14763b66b1947ea9ea89dbcdf3 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 b2dd3756bd67b484989ed3efa07b8be6a7605e1e..376f1bc37b0f393caa471755a2fe848c8e9494fe 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)