提交 81e7ff45 编写于 作者: S Shengliang Guan

minor changes

上级 efb3d812
...@@ -54,7 +54,7 @@ static int32_t mndRestoreWal(SMnode *pMnode) { ...@@ -54,7 +54,7 @@ static int32_t mndRestoreWal(SMnode *pMnode) {
int64_t start = walGetFirstVer(pWal); int64_t start = walGetFirstVer(pWal);
int64_t end = walGetLastVer(pWal); int64_t end = walGetLastVer(pWal);
start = MAX(lastSdbVer, start); start = MAX(lastSdbVer + 1, start);
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) {
...@@ -79,19 +79,19 @@ static int32_t mndRestoreWal(SMnode *pMnode) { ...@@ -79,19 +79,19 @@ static int32_t mndRestoreWal(SMnode *pMnode) {
} }
int64_t sdbVer = sdbUpdateVer(pSdb, 0); int64_t sdbVer = sdbUpdateVer(pSdb, 0);
if (sdbVer != lastSdbVer) { if (walBeginSnapshot(pWal, sdbVer) < 0) {
if (walBeginSnapshot(pWal, sdbVer) < 0) { 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) {
goto WAL_RESTORE_OVER; goto WAL_RESTORE_OVER;
}
} }
code = 0; code = 0;
......
...@@ -81,7 +81,7 @@ static int32_t sdbReadFileHead(SSdb *pSdb, FileFd fd) { ...@@ -81,7 +81,7 @@ static int32_t sdbReadFileHead(SSdb *pSdb, FileFd fd) {
} }
char reserve[SDB_RESERVE_SIZE] = {0}; char reserve[SDB_RESERVE_SIZE] = {0};
ret = taosWriteFile(fd, reserve, sizeof(reserve)); ret = taosReadFile(fd, reserve, sizeof(reserve));
if (ret < 0) { if (ret < 0) {
terrno = TAOS_SYSTEM_ERROR(errno); terrno = TAOS_SYSTEM_ERROR(errno);
return -1; return -1;
...@@ -122,7 +122,7 @@ static int32_t sdbWriteFileHead(SSdb *pSdb, FileFd fd) { ...@@ -122,7 +122,7 @@ static int32_t sdbWriteFileHead(SSdb *pSdb, FileFd fd) {
} }
} }
char reserve[512] = {0}; char reserve[SDB_RESERVE_SIZE] = {0};
if (taosWriteFile(fd, reserve, sizeof(reserve)) != sizeof(reserve)) { if (taosWriteFile(fd, reserve, sizeof(reserve)) != sizeof(reserve)) {
terrno = TAOS_SYSTEM_ERROR(errno); terrno = TAOS_SYSTEM_ERROR(errno);
return -1; return -1;
...@@ -210,7 +210,7 @@ int32_t sdbReadFile(SSdb *pSdb) { ...@@ -210,7 +210,7 @@ int32_t sdbReadFile(SSdb *pSdb) {
code = 0; code = 0;
pSdb->lastCommitVer = pSdb->curVer; pSdb->lastCommitVer = pSdb->curVer;
mError("read file:%s successfully, ver:%" PRId64, file, pSdb->lastCommitVer); mDebug("read file:%s successfully, ver:%" PRId64, file, pSdb->lastCommitVer);
PARSE_SDB_DATA_ERROR: PARSE_SDB_DATA_ERROR:
taosCloseFile(fd); taosCloseFile(fd);
......
...@@ -148,7 +148,7 @@ int32_t walBeginSnapshot(SWal *pWal, int64_t ver) { ...@@ -148,7 +148,7 @@ int32_t walBeginSnapshot(SWal *pWal, int64_t ver) {
int32_t walEndSnapshot(SWal *pWal) { int32_t walEndSnapshot(SWal *pWal) {
int64_t ver = pWal->vers.verInSnapshotting; int64_t ver = pWal->vers.verInSnapshotting;
if (ver == -1) return -1; if (ver == -1) return 0;
pWal->vers.snapshotVer = ver; pWal->vers.snapshotVer = ver;
int ts = taosGetTimestampSec(); int ts = taosGetTimestampSec();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册