TD-2500
This commit is contained in:
parent
e58c470fa3
commit
a32fcd3f19
|
@ -686,7 +686,7 @@ static void syncCheckRole(SSyncPeer *pPeer, SPeerStatus* peersStatus, int8_t new
|
||||||
if (pMaster) {
|
if (pMaster) {
|
||||||
// master is there
|
// master is there
|
||||||
pNode->pMaster = pMaster;
|
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;
|
if (syncValidateMaster(pPeer) < 0) return;
|
||||||
|
|
||||||
|
|
|
@ -90,15 +90,18 @@ static int32_t syncRestoreFile(SSyncPeer *pPeer, uint64_t *fversion) {
|
||||||
break;
|
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
|
// remove extra files on slave between the current and last index
|
||||||
syncRemoveExtraFile(pPeer, pindex + 1, minfo.index - 1);
|
syncRemoveExtraFile(pPeer, pindex + 1, minfo.index - 1);
|
||||||
pindex = minfo.index;
|
pindex = minfo.index;
|
||||||
|
|
||||||
// check the file info
|
// check the file info
|
||||||
sinfo = minfo;
|
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,
|
sDebug("%s, local file:%s info, index:%d size:%" PRId64 " fver:%" PRIu64 " magic:%d", pPeer->id, sinfo.name,
|
||||||
&sinfo.fversion);
|
sinfo.index, sinfo.size, sinfo.fversion, sinfo.magic);
|
||||||
|
|
||||||
// if file not there or magic is not the same, file shall be synced
|
// if file not there or magic is not the same, file shall be synced
|
||||||
memset(&fileAck, 0, sizeof(SFileAck));
|
memset(&fileAck, 0, sizeof(SFileAck));
|
||||||
|
@ -116,6 +119,8 @@ static int32_t syncRestoreFile(SSyncPeer *pPeer, uint64_t *fversion) {
|
||||||
if (fileAck.sync == 0) {
|
if (fileAck.sync == 0) {
|
||||||
sDebug("%s, %s is the same", pPeer->id, minfo.name);
|
sDebug("%s, %s is the same", pPeer->id, minfo.name);
|
||||||
continue;
|
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
|
// if sync is required, open file, receive from master, and write to file
|
||||||
|
|
|
@ -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.magic = (*pNode->getFileInfo)(pNode->vgId, fileInfo.name, &fileInfo.index, TAOS_SYNC_MAX_INDEX,
|
||||||
&fileInfo.size, &fileInfo.fversion);
|
&fileInfo.size, &fileInfo.fversion);
|
||||||
syncBuildFileInfo(&fileInfo, pNode->vgId);
|
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
|
// send the file info
|
||||||
int32_t ret = taosWriteMsg(pPeer->syncFd, &(fileInfo), sizeof(SFileInfo));
|
int32_t ret = taosWriteMsg(pPeer->syncFd, &(fileInfo), sizeof(SFileInfo));
|
||||||
|
@ -144,6 +145,8 @@ static int32_t syncRetrieveFile(SSyncPeer *pPeer) {
|
||||||
fileInfo.index++;
|
fileInfo.index++;
|
||||||
sDebug("%s, %s is the same", pPeer->id, fileInfo.name);
|
sDebug("%s, %s is the same", pPeer->id, fileInfo.name);
|
||||||
continue;
|
continue;
|
||||||
|
} else {
|
||||||
|
sDebug("%s, %s will be sent", pPeer->id, fileInfo.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the full path to file
|
// get the full path to file
|
||||||
|
|
|
@ -230,6 +230,7 @@ print online vnodes $data03
|
||||||
if $data03 != 2 then
|
if $data03 != 2 then
|
||||||
goto step6
|
goto step6
|
||||||
endi
|
endi
|
||||||
|
sleep 1000
|
||||||
|
|
||||||
sql insert into d1.t1 values(now, 3)
|
sql insert into d1.t1 values(now, 3)
|
||||||
sql insert into d2.t2 values(now, 3)
|
sql insert into d2.t2 values(now, 3)
|
||||||
|
@ -307,6 +308,7 @@ print online vnodes $data03
|
||||||
if $data03 != 2 then
|
if $data03 != 2 then
|
||||||
goto step7
|
goto step7
|
||||||
endi
|
endi
|
||||||
|
sleep 1000
|
||||||
|
|
||||||
sql insert into d1.t1 values(now, 5)
|
sql insert into d1.t1 values(now, 5)
|
||||||
sql insert into d2.t2 values(now, 5)
|
sql insert into d2.t2 values(now, 5)
|
||||||
|
|
|
@ -238,6 +238,7 @@ print online vnodes $data03
|
||||||
if $data03 != 3 then
|
if $data03 != 3 then
|
||||||
goto step6
|
goto step6
|
||||||
endi
|
endi
|
||||||
|
sleep 1000
|
||||||
|
|
||||||
system sh/exec.sh -n dnode3 -s stop -x SIGINT
|
system sh/exec.sh -n dnode3 -s stop -x SIGINT
|
||||||
sleep 5000
|
sleep 5000
|
||||||
|
@ -307,6 +308,7 @@ print online vnodes $data03
|
||||||
if $data03 != 3 then
|
if $data03 != 3 then
|
||||||
goto step7
|
goto step7
|
||||||
endi
|
endi
|
||||||
|
sleep 1000
|
||||||
|
|
||||||
system sh/exec.sh -n dnode4 -s stop -x SIGINT
|
system sh/exec.sh -n dnode4 -s stop -x SIGINT
|
||||||
sleep 5000
|
sleep 5000
|
||||||
|
@ -372,6 +374,7 @@ print online vnodes $data03
|
||||||
if $data03 != 3 then
|
if $data03 != 3 then
|
||||||
goto step8
|
goto step8
|
||||||
endi
|
endi
|
||||||
|
sleep 1000
|
||||||
|
|
||||||
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
||||||
sleep 5000
|
sleep 5000
|
||||||
|
|
|
@ -239,6 +239,7 @@ print online vnodes $data03
|
||||||
if $data03 != 3 then
|
if $data03 != 3 then
|
||||||
goto step6
|
goto step6
|
||||||
endi
|
endi
|
||||||
|
sleep 1000
|
||||||
|
|
||||||
system sh/exec.sh -n dnode3 -s stop -x SIGINT
|
system sh/exec.sh -n dnode3 -s stop -x SIGINT
|
||||||
sleep 5000
|
sleep 5000
|
||||||
|
@ -304,6 +305,7 @@ print online vnodes $data03
|
||||||
if $data03 != 3 then
|
if $data03 != 3 then
|
||||||
goto step7
|
goto step7
|
||||||
endi
|
endi
|
||||||
|
sleep 1000
|
||||||
|
|
||||||
system sh/exec.sh -n dnode4 -s stop -x SIGINT
|
system sh/exec.sh -n dnode4 -s stop -x SIGINT
|
||||||
sleep 5000
|
sleep 5000
|
||||||
|
@ -369,6 +371,7 @@ print online vnodes $data03
|
||||||
if $data03 != 3 then
|
if $data03 != 3 then
|
||||||
goto step8
|
goto step8
|
||||||
endi
|
endi
|
||||||
|
sleep 1000
|
||||||
|
|
||||||
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
||||||
sleep 5000
|
sleep 5000
|
||||||
|
|
|
@ -141,6 +141,7 @@ print online vnodes $data03
|
||||||
if $data03 != 2 then
|
if $data03 != 2 then
|
||||||
goto step3
|
goto step3
|
||||||
endi
|
endi
|
||||||
|
sleep 1000
|
||||||
|
|
||||||
print ========= step4
|
print ========= step4
|
||||||
sql insert into d1.t1 values(now, 2)
|
sql insert into d1.t1 values(now, 2)
|
||||||
|
@ -220,6 +221,7 @@ print online vnodes $data03
|
||||||
if $data03 != 2 then
|
if $data03 != 2 then
|
||||||
goto step6
|
goto step6
|
||||||
endi
|
endi
|
||||||
|
sleep 1000
|
||||||
|
|
||||||
system sh/exec.sh -n dnode3 -s stop -x SIGINT
|
system sh/exec.sh -n dnode3 -s stop -x SIGINT
|
||||||
sleep 5000
|
sleep 5000
|
||||||
|
@ -268,6 +270,7 @@ print online vnodes $data03
|
||||||
if $data03 != 2 then
|
if $data03 != 2 then
|
||||||
goto step7
|
goto step7
|
||||||
endi
|
endi
|
||||||
|
sleep 1000
|
||||||
|
|
||||||
sql insert into d1.t1 values(now, 5)
|
sql insert into d1.t1 values(now, 5)
|
||||||
sql insert into d2.t2 values(now, 5)
|
sql insert into d2.t2 values(now, 5)
|
||||||
|
|
Loading…
Reference in New Issue