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

TD-1652

上级 57eed2cb
......@@ -51,6 +51,7 @@ int walWrite(twalh, SWalHead *);
void walFsync(twalh);
int walRestore(twalh, void *pVnode, FWalWrite writeFp);
int walGetWalFile(twalh, char *name, uint32_t *index);
void walResetVersion(void *handle, uint64_t version);
extern int wDebugFlag;
......
......@@ -98,7 +98,8 @@ int32_t vnodeProcessWrite(void *param1, int qtype, void *param2, void *item) {
syncCode = syncForwardToPeer(pVnode->sync, pHead, item, qtype);
if (syncCode < 0) {
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);
return syncCode;
}
......
......@@ -233,6 +233,14 @@ int walRenew(void *handle) {
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) {
SWal *pWal = handle;
if (pWal == NULL) return -1;
......@@ -241,7 +249,10 @@ int walWrite(void *handle, SWalHead *pHead) {
// no wal
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;
taosCalcChecksumAppend(0, (uint8_t *)pHead, sizeof(SWalHead));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册