提交 1da7d9b5 编写于 作者: S Shengliang Guan

TD-1652

上级 57eed2cb
...@@ -51,6 +51,7 @@ int walWrite(twalh, SWalHead *); ...@@ -51,6 +51,7 @@ int walWrite(twalh, SWalHead *);
void walFsync(twalh); void walFsync(twalh);
int walRestore(twalh, void *pVnode, FWalWrite writeFp); int walRestore(twalh, void *pVnode, FWalWrite writeFp);
int walGetWalFile(twalh, char *name, uint32_t *index); int walGetWalFile(twalh, char *name, uint32_t *index);
void walResetVersion(void *handle, uint64_t version);
extern int wDebugFlag; extern int wDebugFlag;
......
...@@ -98,7 +98,8 @@ int32_t vnodeProcessWrite(void *param1, int qtype, void *param2, void *item) { ...@@ -98,7 +98,8 @@ int32_t vnodeProcessWrite(void *param1, int qtype, void *param2, void *item) {
syncCode = syncForwardToPeer(pVnode->sync, pHead, item, qtype); syncCode = syncForwardToPeer(pVnode->sync, pHead, item, qtype);
if (syncCode < 0) { if (syncCode < 0) {
pVnode->version = lastVersion; pVnode->version = lastVersion;
vError("vgId:%d, msgType:%s not processed, reason:%s, wal ver:%" PRIu64 " restore to last ver:%" PRIu64, walResetVersion(pVnode->wal, lastVersion);
vError("vgId:%d, msgType:%s not processed, reason:%s, wal ver:%" PRIu64 " set to last ver:%" PRIu64,
pVnode->vgId, taosMsg[pHead->msgType], tstrerror(syncCode), pHead->version, pVnode->version); pVnode->vgId, taosMsg[pHead->msgType], tstrerror(syncCode), pHead->version, pVnode->version);
return syncCode; return syncCode;
} }
......
...@@ -233,15 +233,26 @@ int walRenew(void *handle) { ...@@ -233,15 +233,26 @@ int walRenew(void *handle) {
return terrno; return terrno;
} }
void walResetVersion(void *handle, uint64_t version) {
SWal *pWal = handle;
if (pWal == NULL) return;
pWal->version = version;
wInfo("wal:%s, reset ver to %" PRIu64, pWal->name, version);
}
int walWrite(void *handle, SWalHead *pHead) { int walWrite(void *handle, SWalHead *pHead) {
SWal *pWal = handle; SWal *pWal = handle;
if (pWal == NULL) return -1; if (pWal == NULL) return -1;
terrno = 0; terrno = 0;
// no wal // no wal
if (pWal->level == TAOS_WAL_NOLOG) return 0; if (pWal->level == TAOS_WAL_NOLOG) return 0;
if (pHead->version <= pWal->version) return 0; if (pHead->version <= pWal->version) {
wError("wal:%s, failed to write ver:%" PRIu64 ", last ver:%" PRIu64, pWal->name, pHead->version, pWal->version);
return 0;
}
pHead->signature = walSignature; pHead->signature = walSignature;
taosCalcChecksumAppend(0, (uint8_t *)pHead, sizeof(SWalHead)); taosCalcChecksumAppend(0, (uint8_t *)pHead, sizeof(SWalHead));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册