提交 1dbe0650 编写于 作者: L Liu Jicong

enh(wal): set errno code

上级 7ab2e76c
...@@ -130,6 +130,7 @@ static int32_t walReadSeekVer(SWalReadHandle *pRead, int64_t ver) { ...@@ -130,6 +130,7 @@ static int32_t walReadSeekVer(SWalReadHandle *pRead, int64_t ver) {
} }
} }
// code set inner
if (walReadSeekFilePos(pRead, pRet->firstVer, ver) < 0) { if (walReadSeekFilePos(pRead, pRet->firstVer, ver) < 0) {
return -1; return -1;
} }
...@@ -249,16 +250,22 @@ int32_t walReadWithHandle(SWalReadHandle *pRead, int64_t ver) { ...@@ -249,16 +250,22 @@ int32_t walReadWithHandle(SWalReadHandle *pRead, int64_t ver) {
// TODO: check wal life // TODO: check wal life
if (pRead->curVersion != ver) { if (pRead->curVersion != ver) {
if (walReadSeekVer(pRead, ver) < 0) { if (walReadSeekVer(pRead, ver) < 0) {
terrno = TSDB_CODE_WAL_INVALID_VER;
wError("unexpected wal log version: % " PRId64 ", since seek error", ver);
return -1; return -1;
} }
} }
if (!taosValidFile(pRead->pReadLogTFile)) { /*if (!taosValidFile(pRead->pReadLogTFile)) {*/
return -1; /*return -1;*/
} /*}*/
code = taosReadFile(pRead->pReadLogTFile, pRead->pHead, sizeof(SWalHead)); code = taosReadFile(pRead->pReadLogTFile, pRead->pHead, sizeof(SWalHead));
if (code != sizeof(SWalHead)) { if (code != sizeof(SWalHead)) {
if (code < 0)
terrno = TAOS_SYSTEM_ERROR(errno);
else
terrno = TSDB_CODE_WAL_FILE_CORRUPTED;
return -1; return -1;
} }
......
...@@ -225,6 +225,7 @@ int walRoll(SWal *pWal) { ...@@ -225,6 +225,7 @@ int walRoll(SWal *pWal) {
terrno = TAOS_SYSTEM_ERROR(errno); terrno = TAOS_SYSTEM_ERROR(errno);
return -1; return -1;
} }
// terrno set inner
code = walRollFileInfo(pWal); code = walRollFileInfo(pWal);
if (code != 0) { if (code != 0) {
return -1; return -1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册