未验证 提交 52efc802 编写于 作者: S slguan 提交者: GitHub

Merge pull request #1736 from taosdata/feature/alter

[TD-184] handle bugs during wal synchronization
......@@ -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;
......
......@@ -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) {
......
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册