提交 99e53317 编写于 作者: S Shengliang Guan

minor changes

上级 5ac3398f
...@@ -37,7 +37,6 @@ static int32_t mndInitWal(SMnode *pMnode) { ...@@ -37,7 +37,6 @@ static int32_t mndInitWal(SMnode *pMnode) {
static void mndCloseWal(SMnode *pMnode) { static void mndCloseWal(SMnode *pMnode) {
SSyncMgmt *pMgmt = &pMnode->syncMgmt; SSyncMgmt *pMgmt = &pMnode->syncMgmt;
if (pMgmt->pWal != NULL) { if (pMgmt->pWal != NULL) {
walClose(pMgmt->pWal); walClose(pMgmt->pWal);
pMgmt->pWal = NULL; pMgmt->pWal = NULL;
...@@ -59,7 +58,7 @@ static int32_t mndRestoreWal(SMnode *pMnode) { ...@@ -59,7 +58,7 @@ static int32_t mndRestoreWal(SMnode *pMnode) {
for (int64_t ver = start; ver >= 0 && ver <= end; ++ver) { for (int64_t ver = start; ver >= 0 && ver <= end; ++ver) {
if (walReadWithHandle(pHandle, ver) < 0) { if (walReadWithHandle(pHandle, ver) < 0) {
mError("failed to read with wal handle since %s, ver:%" PRId64, terrstr(), ver); mError("failed to read by wal handle since %s, ver:%" PRId64, terrstr(), ver);
goto WAL_RESTORE_OVER; goto WAL_RESTORE_OVER;
} }
...@@ -67,12 +66,12 @@ static int32_t mndRestoreWal(SMnode *pMnode) { ...@@ -67,12 +66,12 @@ static int32_t mndRestoreWal(SMnode *pMnode) {
int64_t sdbVer = sdbUpdateVer(pSdb, 0); int64_t sdbVer = sdbUpdateVer(pSdb, 0);
if (sdbVer + 1 != ver) { if (sdbVer + 1 != ver) {
terrno = TSDB_CODE_SDB_INVALID_WAl_VER; terrno = TSDB_CODE_SDB_INVALID_WAl_VER;
mError("failed to write wal to sdb, sdbVer:%" PRId64 " inconsistent with ver:%" PRId64, sdbVer, ver); mError("failed to read wal from sdb, sdbVer:%" PRId64 " inconsistent with ver:%" PRId64, sdbVer, ver);
goto WAL_RESTORE_OVER; goto WAL_RESTORE_OVER;
} }
if (sdbWriteNotFree(pSdb, (void *)pHead->head.body) < 0) { if (sdbWriteNotFree(pSdb, (void *)pHead->head.body) < 0) {
mError("failed to write wal to sdb since %s, ver:%" PRId64, terrstr(), ver); mError("failed to read wal from sdb since %s, ver:%" PRId64, terrstr(), ver);
goto WAL_RESTORE_OVER; goto WAL_RESTORE_OVER;
} }
...@@ -85,11 +84,9 @@ static int32_t mndRestoreWal(SMnode *pMnode) { ...@@ -85,11 +84,9 @@ static int32_t mndRestoreWal(SMnode *pMnode) {
goto WAL_RESTORE_OVER; goto WAL_RESTORE_OVER;
} }
if (sdbVer != lastSdbVer) { mInfo("sdb restore wal from %" PRId64 " to %" PRId64, lastSdbVer, sdbVer);
mInfo("sdb restore wal from %" PRId64 " to %" PRId64, lastSdbVer, sdbVer); if (sdbWriteFile(pSdb) != 0) {
if (sdbWriteFile(pSdb) != 0) { goto WAL_RESTORE_OVER;
goto WAL_RESTORE_OVER;
}
} }
if (walEndSnapshot(pWal) < 0) { if (walEndSnapshot(pWal) < 0) {
...@@ -101,7 +98,7 @@ static int32_t mndRestoreWal(SMnode *pMnode) { ...@@ -101,7 +98,7 @@ static int32_t mndRestoreWal(SMnode *pMnode) {
WAL_RESTORE_OVER: WAL_RESTORE_OVER:
walCloseReadHandle(pHandle); walCloseReadHandle(pHandle);
return 0; return code;
} }
int32_t mndInitSync(SMnode *pMnode) { int32_t mndInitSync(SMnode *pMnode) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册