diff --git a/src/vnode/src/vnodeMain.c b/src/vnode/src/vnodeMain.c index cac1030a93..9ae0588771 100644 --- a/src/vnode/src/vnodeMain.c +++ b/src/vnode/src/vnodeMain.c @@ -197,7 +197,7 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) { syncInfo.vgId = pVnode->vgId; syncInfo.version = pVnode->version; syncInfo.syncCfg = pVnode->syncCfg; - sprintf(syncInfo.path, "%s/tsdb/", rootDir); + sprintf(syncInfo.path, "%s", rootDir); syncInfo.ahandle = pVnode; syncInfo.getWalInfo = vnodeGetWalInfo; syncInfo.getFileInfo = vnodeGetFileInfo; diff --git a/src/vnode/src/vnodeWrite.c b/src/vnode/src/vnodeWrite.c index 26808f2e4e..cfcc9cd847 100644 --- a/src/vnode/src/vnodeWrite.c +++ b/src/vnode/src/vnodeWrite.c @@ -58,7 +58,7 @@ int32_t vnodeProcessWrite(void *param1, int qtype, void *param2, void *item) { return TSDB_CODE_NOT_ACTIVE_VNODE; if (pVnode->syncCfg.replica > 1 && pVnode->role != TAOS_SYNC_ROLE_MASTER) - return TSDB_CODE_NO_MASTER; + return TSDB_CODE_NOT_READY; // assign version pVnode->version++; @@ -74,15 +74,15 @@ int32_t vnodeProcessWrite(void *param1, int qtype, void *param2, void *item) { // write into WAL 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); if (code < 0) return code; - if (pVnode->syncCfg.replica > 1) - code = syncForwardToPeer(pVnode->sync, pHead, item); - - return code; + return syncCode; } static int32_t vnodeProcessSubmitMsg(SVnodeObj *pVnode, void *pCont, SRspRet *pRet) { diff --git a/src/wal/src/walMain.c b/src/wal/src/walMain.c index 6a4ecee1c3..ad33391b98 100644 --- a/src/wal/src/walMain.c +++ b/src/wal/src/walMain.c @@ -269,7 +269,7 @@ int walGetWalFile(void *handle, char *name, uint32_t *index) { if (*index < first && *index > pWal->id) { code = -1; // index out of range } else { - sprintf(name, "%s/%s%d", pWal->path, walPrefix, *index); + sprintf(name, "wal/%s%d", walPrefix, *index); code = (*index == pWal->id) ? 0:1; }