Merge pull request #1736 from taosdata/feature/alter
[TD-184] handle bugs during wal synchronization
This commit is contained in:
commit
52efc8029d
|
@ -197,7 +197,7 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) {
|
||||||
syncInfo.vgId = pVnode->vgId;
|
syncInfo.vgId = pVnode->vgId;
|
||||||
syncInfo.version = pVnode->version;
|
syncInfo.version = pVnode->version;
|
||||||
syncInfo.syncCfg = pVnode->syncCfg;
|
syncInfo.syncCfg = pVnode->syncCfg;
|
||||||
sprintf(syncInfo.path, "%s/tsdb/", rootDir);
|
sprintf(syncInfo.path, "%s", rootDir);
|
||||||
syncInfo.ahandle = pVnode;
|
syncInfo.ahandle = pVnode;
|
||||||
syncInfo.getWalInfo = vnodeGetWalInfo;
|
syncInfo.getWalInfo = vnodeGetWalInfo;
|
||||||
syncInfo.getFileInfo = vnodeGetFileInfo;
|
syncInfo.getFileInfo = vnodeGetFileInfo;
|
||||||
|
|
|
@ -58,7 +58,7 @@ int32_t vnodeProcessWrite(void *param1, int qtype, void *param2, void *item) {
|
||||||
return TSDB_CODE_NOT_ACTIVE_VNODE;
|
return TSDB_CODE_NOT_ACTIVE_VNODE;
|
||||||
|
|
||||||
if (pVnode->syncCfg.replica > 1 && pVnode->role != TAOS_SYNC_ROLE_MASTER)
|
if (pVnode->syncCfg.replica > 1 && pVnode->role != TAOS_SYNC_ROLE_MASTER)
|
||||||
return TSDB_CODE_NO_MASTER;
|
return TSDB_CODE_NOT_READY;
|
||||||
|
|
||||||
// assign version
|
// assign version
|
||||||
pVnode->version++;
|
pVnode->version++;
|
||||||
|
@ -76,13 +76,13 @@ int32_t vnodeProcessWrite(void *param1, int qtype, void *param2, void *item) {
|
||||||
code = walWrite(pVnode->wal, pHead);
|
code = walWrite(pVnode->wal, pHead);
|
||||||
if (code < 0) return code;
|
if (code < 0) return code;
|
||||||
|
|
||||||
|
int32_t syncCode = syncForwardToPeer(pVnode->sync, pHead, item);
|
||||||
|
if (syncCode < 0) return syncCode;
|
||||||
|
|
||||||
code = (*vnodeProcessWriteMsgFp[pHead->msgType])(pVnode, pHead->cont, item);
|
code = (*vnodeProcessWriteMsgFp[pHead->msgType])(pVnode, pHead->cont, item);
|
||||||
if (code < 0) return code;
|
if (code < 0) return code;
|
||||||
|
|
||||||
if (pVnode->syncCfg.replica > 1)
|
return syncCode;
|
||||||
code = syncForwardToPeer(pVnode->sync, pHead, item);
|
|
||||||
|
|
||||||
return code;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t vnodeProcessSubmitMsg(SVnodeObj *pVnode, void *pCont, SRspRet *pRet) {
|
static int32_t vnodeProcessSubmitMsg(SVnodeObj *pVnode, void *pCont, SRspRet *pRet) {
|
||||||
|
|
|
@ -269,7 +269,7 @@ int walGetWalFile(void *handle, char *name, uint32_t *index) {
|
||||||
if (*index < first && *index > pWal->id) {
|
if (*index < first && *index > pWal->id) {
|
||||||
code = -1; // index out of range
|
code = -1; // index out of range
|
||||||
} else {
|
} else {
|
||||||
sprintf(name, "%s/%s%d", pWal->path, walPrefix, *index);
|
sprintf(name, "wal/%s%d", walPrefix, *index);
|
||||||
code = (*index == pWal->id) ? 0:1;
|
code = (*index == pWal->id) ? 0:1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue