fix(wal): int overflow
This commit is contained in:
parent
af2d2db5d3
commit
a8831af513
|
@ -54,7 +54,7 @@ int32_t walRegisterRead(SWalReadHandle *pRead, int64_t ver) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t walReadSeekFilePos(SWalReadHandle *pRead, int64_t fileFirstVer, int64_t ver) {
|
static int64_t walReadSeekFilePos(SWalReadHandle *pRead, int64_t fileFirstVer, int64_t ver) {
|
||||||
int64_t ret = 0;
|
int64_t ret = 0;
|
||||||
|
|
||||||
TdFilePtr pIdxTFile = pRead->pReadIdxTFile;
|
TdFilePtr pIdxTFile = pRead->pReadIdxTFile;
|
||||||
|
@ -156,7 +156,7 @@ static int32_t walReadSeekVer(SWalReadHandle *pRead, int64_t ver) {
|
||||||
void walSetReaderCapacity(SWalReadHandle *pRead, int32_t capacity) { pRead->capacity = capacity; }
|
void walSetReaderCapacity(SWalReadHandle *pRead, int32_t capacity) { pRead->capacity = capacity; }
|
||||||
|
|
||||||
int32_t walFetchHead(SWalReadHandle *pRead, int64_t ver, SWalHead *pHead) {
|
int32_t walFetchHead(SWalReadHandle *pRead, int64_t ver, SWalHead *pHead) {
|
||||||
int32_t code;
|
int64_t code;
|
||||||
|
|
||||||
// TODO: valid ver
|
// TODO: valid ver
|
||||||
if (ver > pRead->pWal->vers.commitVer) {
|
if (ver > pRead->pWal->vers.commitVer) {
|
||||||
|
@ -257,7 +257,7 @@ int32_t walReadWithHandle_s(SWalReadHandle *pRead, int64_t ver, SWalReadHead **p
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t walReadWithHandle(SWalReadHandle *pRead, int64_t ver) {
|
int32_t walReadWithHandle(SWalReadHandle *pRead, int64_t ver) {
|
||||||
int code;
|
int64_t code;
|
||||||
// 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) {
|
||||||
|
|
|
@ -19,8 +19,8 @@
|
||||||
#include "tref.h"
|
#include "tref.h"
|
||||||
#include "walInt.h"
|
#include "walInt.h"
|
||||||
|
|
||||||
static int walSeekWritePos(SWal* pWal, int64_t ver) {
|
static int64_t walSeekWritePos(SWal* pWal, int64_t ver) {
|
||||||
int code = 0;
|
int64_t code = 0;
|
||||||
|
|
||||||
TdFilePtr pIdxTFile = pWal->pWriteIdxTFile;
|
TdFilePtr pIdxTFile = pWal->pWriteIdxTFile;
|
||||||
TdFilePtr pLogTFile = pWal->pWriteLogTFile;
|
TdFilePtr pLogTFile = pWal->pWriteLogTFile;
|
||||||
|
@ -45,7 +45,7 @@ static int walSeekWritePos(SWal* pWal, int64_t ver) {
|
||||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return code;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int walSetWrite(SWal* pWal) {
|
int walSetWrite(SWal* pWal) {
|
||||||
|
@ -124,7 +124,7 @@ int walChangeWrite(SWal* pWal, int64_t ver) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int walSeekWriteVer(SWal* pWal, int64_t ver) {
|
int walSeekWriteVer(SWal* pWal, int64_t ver) {
|
||||||
int code;
|
int64_t code;
|
||||||
if (ver == pWal->vers.lastVer) {
|
if (ver == pWal->vers.lastVer) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue