osFile
This commit is contained in:
parent
520336e129
commit
2a3917029f
|
@ -143,7 +143,7 @@ int32_t taosWriteMsg(TdSocketPtr pSocket, void *ptr, int32_t nbytes);
|
||||||
int32_t taosReadMsg(TdSocketPtr pSocket, void *ptr, int32_t nbytes);
|
int32_t taosReadMsg(TdSocketPtr pSocket, void *ptr, int32_t nbytes);
|
||||||
int32_t taosNonblockwrite(TdSocketPtr pSocket, char *ptr, int32_t nbytes);
|
int32_t taosNonblockwrite(TdSocketPtr pSocket, char *ptr, int32_t nbytes);
|
||||||
int64_t taosCopyFds(TdSocketPtr pSrcSocket, TdSocketPtr pDestSocket, int64_t len);
|
int64_t taosCopyFds(TdSocketPtr pSrcSocket, TdSocketPtr pDestSocket, int64_t len);
|
||||||
void taosWinSocketInit();
|
int32_t taosWinSocketInit();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* set timeout(ms)
|
* set timeout(ms)
|
||||||
|
|
|
@ -35,6 +35,8 @@ extern STaosError errors[];
|
||||||
#define TAOS_DEF_ERROR_CODE(mod, code) ((int32_t)((0x80000000 | ((mod)<<16) | (code))))
|
#define TAOS_DEF_ERROR_CODE(mod, code) ((int32_t)((0x80000000 | ((mod)<<16) | (code))))
|
||||||
|
|
||||||
#define TAOS_SYSTEM_ERROR(code) (0x80ff0000 | (code))
|
#define TAOS_SYSTEM_ERROR(code) (0x80ff0000 | (code))
|
||||||
|
#define TAOS_SYSTEM_WINAPI_ERROR(code) (0x81ff0000 | (code))
|
||||||
|
#define TAOS_SYSTEM_WINSOCKET_ERROR(code) (0x82ff0000 | (code))
|
||||||
#define TAOS_SUCCEEDED(err) ((err) >= 0)
|
#define TAOS_SUCCEEDED(err) ((err) >= 0)
|
||||||
#define TAOS_FAILED(err) ((err) < 0)
|
#define TAOS_FAILED(err) ((err) < 0)
|
||||||
|
|
||||||
|
@ -153,6 +155,7 @@ int32_t taosGetErrSize();
|
||||||
#define TSDB_CODE_MSG_PREPROCESSED TAOS_DEF_ERROR_CODE(0, 0x0136) // internal
|
#define TSDB_CODE_MSG_PREPROCESSED TAOS_DEF_ERROR_CODE(0, 0x0136) // internal
|
||||||
#define TSDB_CODE_OUT_OF_BUFFER TAOS_DEF_ERROR_CODE(0, 0x0137)
|
#define TSDB_CODE_OUT_OF_BUFFER TAOS_DEF_ERROR_CODE(0, 0x0137)
|
||||||
#define TSDB_CODE_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x0138)
|
#define TSDB_CODE_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x0138)
|
||||||
|
#define TSDB_CODE_SOCKET_ERROR TAOS_DEF_ERROR_CODE(0, 0x0139)
|
||||||
|
|
||||||
//client
|
//client
|
||||||
#define TSDB_CODE_TSC_INVALID_OPERATION TAOS_DEF_ERROR_CODE(0, 0x0200)
|
#define TSDB_CODE_TSC_INVALID_OPERATION TAOS_DEF_ERROR_CODE(0, 0x0200)
|
||||||
|
|
|
@ -175,7 +175,7 @@ int32_t cos_cp_load(char const* filepath, SCheckpoint* checkpoint) {
|
||||||
|
|
||||||
int64_t n = taosReadFile(fd, cp_body, size);
|
int64_t n = taosReadFile(fd, cp_body, size);
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(errno), &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
} else if (n != size) {
|
} else if (n != size) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_FILE_CORRUPTED, &lino, _exit);
|
TAOS_CHECK_GOTO(TSDB_CODE_FILE_CORRUPTED, &lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ int32_t mmReadFile(const char *path, SMnodeOpt *pOption) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosReadFile(pFile, pData, size) != size) {
|
if (taosReadFile(pFile, pData, size) != size) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
code = terrno;
|
||||||
dError("failed to read mnode file:%s since %s", file, tstrerror(code));
|
dError("failed to read mnode file:%s since %s", file, tstrerror(code));
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
@ -215,10 +215,7 @@ int32_t mmWriteFile(const char *path, const SMnodeOpt *pOption) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
code = TAOS_SYSTEM_ERROR(errno);
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
if (taosRenameFile(file, realfile) != 0) {
|
TAOS_CHECK_GOTO(taosRenameFile(file, realfile), NULL, _OVER);
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
|
||||||
goto _OVER;
|
|
||||||
}
|
|
||||||
|
|
||||||
dInfo("succeed to write mnode file:%s, deloyed:%d", realfile, pOption->deploy);
|
dInfo("succeed to write mnode file:%s, deloyed:%d", realfile, pOption->deploy);
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ int32_t vmGetVnodeListFromFile(SVnodeMgmt *pMgmt, SWrapperCfg **ppCfgs, int32_t
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosReadFile(pFile, pData, size) != size) {
|
if (taosReadFile(pFile, pData, size) != size) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
code = terrno;
|
||||||
dError("failed to read vnode file:%s since %s", file, tstrerror(code));
|
dError("failed to read vnode file:%s since %s", file, tstrerror(code));
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
@ -253,12 +253,8 @@ int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
code = TAOS_SYSTEM_ERROR(errno);
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
if (taosRenameFile(file, realfile) != 0) {
|
TAOS_CHECK_GOTO(taosRenameFile(file, realfile), NULL, _OVER);
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
|
||||||
goto _OVER;
|
|
||||||
}
|
|
||||||
|
|
||||||
code = 0;
|
|
||||||
dInfo("succeed to write vnodes file:%s, vnodes:%d", realfile, numOfVnodes);
|
dInfo("succeed to write vnodes file:%s, vnodes:%d", realfile, numOfVnodes);
|
||||||
|
|
||||||
_OVER:
|
_OVER:
|
||||||
|
|
|
@ -222,7 +222,7 @@ int32_t dmReadEps(SDnodeData *pData) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosReadFile(pFile, content, size) != size) {
|
if (taosReadFile(pFile, content, size) != size) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
code = terrno;
|
||||||
dError("failed to read dnode file:%s since %s", file, terrstr());
|
dError("failed to read dnode file:%s since %s", file, terrstr());
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
@ -340,9 +340,8 @@ int32_t dmWriteEps(SDnodeData *pData) {
|
||||||
if (taosFsyncFile(pFile) < 0) TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(errno), NULL, _OVER);
|
if (taosFsyncFile(pFile) < 0) TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(errno), NULL, _OVER);
|
||||||
|
|
||||||
(void)taosCloseFile(&pFile);
|
(void)taosCloseFile(&pFile);
|
||||||
if (taosRenameFile(file, realfile) != 0) TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(errno), NULL, _OVER);
|
TAOS_CHECK_GOTO(taosRenameFile(file, realfile), NULL, _OVER);
|
||||||
|
|
||||||
code = 0;
|
|
||||||
pData->updateTime = taosGetTimestampMs();
|
pData->updateTime = taosGetTimestampMs();
|
||||||
dInfo("succeed to write dnode file:%s, num:%d ver:%" PRId64, realfile, (int32_t)taosArrayGetSize(pData->dnodeEps),
|
dInfo("succeed to write dnode file:%s, num:%d ver:%" PRId64, realfile, (int32_t)taosArrayGetSize(pData->dnodeEps),
|
||||||
pData->dnodeVer);
|
pData->dnodeVer);
|
||||||
|
@ -626,7 +625,7 @@ static int32_t dmReadDnodePairs(SDnodeData *pData) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosReadFile(pFile, content, size) != size) {
|
if (taosReadFile(pFile, content, size) != size) {
|
||||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
terrno = terrno;
|
||||||
dError("failed to read dnode file:%s since %s", file, terrstr());
|
dError("failed to read dnode file:%s since %s", file, terrstr());
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ int32_t dmReadFile(const char *path, const char *name, bool *pDeployed) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosReadFile(pFile, content, size) != size) {
|
if (taosReadFile(pFile, content, size) != size) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
code = terrno;
|
||||||
dError("failed to read file:%s since %s", file, tstrerror(code));
|
dError("failed to read file:%s since %s", file, tstrerror(code));
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
@ -166,12 +166,8 @@ int32_t dmWriteFile(const char *path, const char *name, bool deployed) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
code = TAOS_SYSTEM_ERROR(errno);
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
if (taosRenameFile(file, realfile) != 0) {
|
TAOS_CHECK_GOTO(taosRenameFile(file, realfile), NULL, _OVER);
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
|
||||||
goto _OVER;
|
|
||||||
}
|
|
||||||
|
|
||||||
code = 0;
|
|
||||||
dInfo("succeed to write file:%s, deloyed:%d", realfile, deployed);
|
dInfo("succeed to write file:%s, deloyed:%d", realfile, deployed);
|
||||||
|
|
||||||
_OVER:
|
_OVER:
|
||||||
|
@ -262,10 +258,7 @@ static int32_t dmWriteCheckCodeFile(char *file, char *realfile, char *key, bool
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosRenameFile(file, realfile) != 0) {
|
TAOS_CHECK_GOTO(taosRenameFile(file, realfile), NULL, _OVER);
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
|
||||||
goto _OVER;
|
|
||||||
}
|
|
||||||
|
|
||||||
encryptDebug("succeed to write checkCode file:%s", realfile);
|
encryptDebug("succeed to write checkCode file:%s", realfile);
|
||||||
|
|
||||||
|
@ -302,10 +295,7 @@ static int32_t dmWriteEncryptCodeFile(char *file, char *realfile, char *encryptC
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosRenameFile(file, realfile) != 0) {
|
TAOS_CHECK_GOTO(taosRenameFile(file, realfile), NULL, _OVER);
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
|
||||||
goto _OVER;
|
|
||||||
}
|
|
||||||
|
|
||||||
encryptDebug("succeed to write encryptCode file:%s", realfile);
|
encryptDebug("succeed to write encryptCode file:%s", realfile);
|
||||||
|
|
||||||
|
@ -338,12 +328,12 @@ static int32_t dmCompareEncryptKey(char *file, char *key, bool toLogFile) {
|
||||||
|
|
||||||
content = taosMemoryMalloc(size);
|
content = taosMemoryMalloc(size);
|
||||||
if (content == NULL) {
|
if (content == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosReadFile(pFile, content, size) != size) {
|
if (taosReadFile(pFile, content, size) != size) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
code = terrno;
|
||||||
encryptError("failed to read dnode file:%s since %s", file, tstrerror(code));
|
encryptError("failed to read dnode file:%s since %s", file, tstrerror(code));
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
@ -484,7 +474,7 @@ static int32_t dmReadEncryptCodeFile(char *file, char **output) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosReadFile(pFile, content, size) != size) {
|
if (taosReadFile(pFile, content, size) != size) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
code = terrno;
|
||||||
dError("failed to read dnode file:%s since %s", file, tstrerror(code));
|
dError("failed to read dnode file:%s since %s", file, tstrerror(code));
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,8 +86,7 @@ static int32_t sdbReadFileHead(SSdb *pSdb, TdFilePtr pFile) {
|
||||||
int64_t sver = 0;
|
int64_t sver = 0;
|
||||||
int32_t ret = taosReadFile(pFile, &sver, sizeof(int64_t));
|
int32_t ret = taosReadFile(pFile, &sver, sizeof(int64_t));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
return terrno;
|
||||||
TAOS_RETURN(code);
|
|
||||||
}
|
}
|
||||||
if (ret != sizeof(int64_t)) {
|
if (ret != sizeof(int64_t)) {
|
||||||
code = TSDB_CODE_FILE_CORRUPTED;
|
code = TSDB_CODE_FILE_CORRUPTED;
|
||||||
|
@ -100,8 +99,7 @@ static int32_t sdbReadFileHead(SSdb *pSdb, TdFilePtr pFile) {
|
||||||
|
|
||||||
ret = taosReadFile(pFile, &pSdb->applyIndex, sizeof(int64_t));
|
ret = taosReadFile(pFile, &pSdb->applyIndex, sizeof(int64_t));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
return terrno;
|
||||||
TAOS_RETURN(code);
|
|
||||||
}
|
}
|
||||||
if (ret != sizeof(int64_t)) {
|
if (ret != sizeof(int64_t)) {
|
||||||
code = TSDB_CODE_FILE_CORRUPTED;
|
code = TSDB_CODE_FILE_CORRUPTED;
|
||||||
|
@ -110,8 +108,7 @@ static int32_t sdbReadFileHead(SSdb *pSdb, TdFilePtr pFile) {
|
||||||
|
|
||||||
ret = taosReadFile(pFile, &pSdb->applyTerm, sizeof(int64_t));
|
ret = taosReadFile(pFile, &pSdb->applyTerm, sizeof(int64_t));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
return terrno;
|
||||||
TAOS_RETURN(code);
|
|
||||||
}
|
}
|
||||||
if (ret != sizeof(int64_t)) {
|
if (ret != sizeof(int64_t)) {
|
||||||
code = TSDB_CODE_FILE_CORRUPTED;
|
code = TSDB_CODE_FILE_CORRUPTED;
|
||||||
|
@ -120,8 +117,7 @@ static int32_t sdbReadFileHead(SSdb *pSdb, TdFilePtr pFile) {
|
||||||
|
|
||||||
ret = taosReadFile(pFile, &pSdb->applyConfig, sizeof(int64_t));
|
ret = taosReadFile(pFile, &pSdb->applyConfig, sizeof(int64_t));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
return terrno;
|
||||||
TAOS_RETURN(code);
|
|
||||||
}
|
}
|
||||||
if (ret != sizeof(int64_t)) {
|
if (ret != sizeof(int64_t)) {
|
||||||
code = TSDB_CODE_FILE_CORRUPTED;
|
code = TSDB_CODE_FILE_CORRUPTED;
|
||||||
|
@ -132,8 +128,7 @@ static int32_t sdbReadFileHead(SSdb *pSdb, TdFilePtr pFile) {
|
||||||
int64_t maxId = 0;
|
int64_t maxId = 0;
|
||||||
ret = taosReadFile(pFile, &maxId, sizeof(int64_t));
|
ret = taosReadFile(pFile, &maxId, sizeof(int64_t));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
return terrno;
|
||||||
TAOS_RETURN(code);
|
|
||||||
}
|
}
|
||||||
if (ret != sizeof(int64_t)) {
|
if (ret != sizeof(int64_t)) {
|
||||||
code = TSDB_CODE_FILE_CORRUPTED;
|
code = TSDB_CODE_FILE_CORRUPTED;
|
||||||
|
@ -148,8 +143,7 @@ static int32_t sdbReadFileHead(SSdb *pSdb, TdFilePtr pFile) {
|
||||||
int64_t ver = 0;
|
int64_t ver = 0;
|
||||||
ret = taosReadFile(pFile, &ver, sizeof(int64_t));
|
ret = taosReadFile(pFile, &ver, sizeof(int64_t));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
return terrno;
|
||||||
TAOS_RETURN(code);
|
|
||||||
}
|
}
|
||||||
if (ret != sizeof(int64_t)) {
|
if (ret != sizeof(int64_t)) {
|
||||||
code = TSDB_CODE_FILE_CORRUPTED;
|
code = TSDB_CODE_FILE_CORRUPTED;
|
||||||
|
@ -163,8 +157,7 @@ static int32_t sdbReadFileHead(SSdb *pSdb, TdFilePtr pFile) {
|
||||||
char reserve[SDB_RESERVE_SIZE] = {0};
|
char reserve[SDB_RESERVE_SIZE] = {0};
|
||||||
ret = taosReadFile(pFile, reserve, sizeof(reserve));
|
ret = taosReadFile(pFile, reserve, sizeof(reserve));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
return terrno;
|
||||||
TAOS_RETURN(code);
|
|
||||||
}
|
}
|
||||||
if (ret != sizeof(reserve)) {
|
if (ret != sizeof(reserve)) {
|
||||||
code = TSDB_CODE_FILE_CORRUPTED;
|
code = TSDB_CODE_FILE_CORRUPTED;
|
||||||
|
@ -274,7 +267,7 @@ static int32_t sdbReadFileImp(SSdb *pSdb) {
|
||||||
if (ret == 0) break;
|
if (ret == 0) break;
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
code = terrno;
|
||||||
mError("failed to read sdb file:%s since %s", file, tstrerror(code));
|
mError("failed to read sdb file:%s since %s", file, tstrerror(code));
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
@ -305,7 +298,7 @@ static int32_t sdbReadFileImp(SSdb *pSdb) {
|
||||||
|
|
||||||
ret = taosReadFile(pFile, pRaw->pData, readLen);
|
ret = taosReadFile(pFile, pRaw->pData, readLen);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
code = terrno;
|
||||||
mError("failed to read sdb file:%s since %s, ret:%" PRId64 " readLen:%d", file, tstrerror(code), ret, readLen);
|
mError("failed to read sdb file:%s since %s, ret:%" PRId64 " readLen:%d", file, tstrerror(code), ret, readLen);
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
@ -523,7 +516,6 @@ static int32_t sdbWriteFileImp(SSdb *pSdb, int32_t skip_type) {
|
||||||
if (code == 0) {
|
if (code == 0) {
|
||||||
code = taosRenameFile(tmpfile, curfile);
|
code = taosRenameFile(tmpfile, curfile);
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
|
||||||
mError("failed to write sdb file:%s since %s", curfile, tstrerror(code));
|
mError("failed to write sdb file:%s since %s", curfile, tstrerror(code));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -693,7 +685,7 @@ int32_t sdbDoRead(SSdb *pSdb, SSdbIter *pIter, void **ppBuf, int32_t *len) {
|
||||||
|
|
||||||
int32_t readlen = taosReadFile(pIter->file, pBuf, maxlen);
|
int32_t readlen = taosReadFile(pIter->file, pBuf, maxlen);
|
||||||
if (readlen < 0 || readlen > maxlen) {
|
if (readlen < 0 || readlen > maxlen) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
code = terrno;
|
||||||
mError("sdbiter:%p, failed to read snapshot since %s, total:%" PRId64, pIter, tstrerror(code), pIter->total);
|
mError("sdbiter:%p, failed to read snapshot since %s, total:%" PRId64, pIter, tstrerror(code), pIter->total);
|
||||||
*ppBuf = NULL;
|
*ppBuf = NULL;
|
||||||
*len = 0;
|
*len = 0;
|
||||||
|
@ -758,8 +750,8 @@ int32_t sdbStopWrite(SSdb *pSdb, SSdbIter *pIter, bool isApply, int64_t index, i
|
||||||
|
|
||||||
char datafile[PATH_MAX] = {0};
|
char datafile[PATH_MAX] = {0};
|
||||||
snprintf(datafile, sizeof(datafile), "%s%ssdb.data", pSdb->currDir, TD_DIRSEP);
|
snprintf(datafile, sizeof(datafile), "%s%ssdb.data", pSdb->currDir, TD_DIRSEP);
|
||||||
if (taosRenameFile(pIter->name, datafile) != 0) {
|
code = taosRenameFile(pIter->name, datafile);
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
if (code != 0) {
|
||||||
mError("sdbiter:%p, failed to rename file %s to %s since %s", pIter, pIter->name, datafile, tstrerror(code));
|
mError("sdbiter:%p, failed to rename file %s to %s since %s", pIter, pIter->name, datafile, tstrerror(code));
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
|
@ -310,7 +310,7 @@ static int32_t load_fs(const char *fname, STsdbFS *pFS) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosReadFile(pFD, pData, size) < 0) {
|
if (taosReadFile(pFD, pData, size) < 0) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
code = terrno;
|
||||||
(void)taosCloseFile(&pFD);
|
(void)taosCloseFile(&pFD);
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
|
@ -711,10 +711,7 @@ static int32_t tsdbFSCommit(STsdb *pTsdb) {
|
||||||
if (!taosCheckExistFile(current_t)) goto _exit;
|
if (!taosCheckExistFile(current_t)) goto _exit;
|
||||||
|
|
||||||
// rename the file
|
// rename the file
|
||||||
if (taosRenameFile(current_t, current) < 0) {
|
TSDB_CHECK_CODE(taosRenameFile(current_t, current), lino, _exit);
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load the new FS
|
// Load the new FS
|
||||||
code = tsdbFSCreate(&fs);
|
code = tsdbFSCreate(&fs);
|
||||||
|
|
|
@ -130,7 +130,7 @@ static int32_t load_json(const char *fname, cJSON **json) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosReadFile(fp, data, size) < 0) {
|
if (taosReadFile(fp, data, size) < 0) {
|
||||||
TSDB_CHECK_CODE(code = TAOS_SYSTEM_ERROR(code), lino, _exit);
|
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||||
}
|
}
|
||||||
data[size] = '\0';
|
data[size] = '\0';
|
||||||
|
|
||||||
|
@ -309,10 +309,7 @@ static int32_t commit_edit(STFileSystem *fs) {
|
||||||
|
|
||||||
int32_t code;
|
int32_t code;
|
||||||
int32_t lino;
|
int32_t lino;
|
||||||
if ((code = taosRenameFile(current_t, current))) {
|
TSDB_CHECK_CODE(taosRenameFile(current_t, current), lino, _exit);
|
||||||
code = TAOS_SYSTEM_ERROR(code);
|
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
|
||||||
}
|
|
||||||
|
|
||||||
code = apply_commit(fs);
|
code = apply_commit(fs);
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
|
|
|
@ -226,7 +226,7 @@ static int32_t tsdbReadFilePage(STsdbFD *pFD, int64_t pgno, int32_t encryptAlgor
|
||||||
// read
|
// read
|
||||||
n = taosReadFile(pFD->pFD, pFD->pBuf, pFD->szPage);
|
n = taosReadFile(pFD->pFD, pFD->pBuf, pFD->szPage);
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
TSDB_CHECK_CODE(code = TAOS_SYSTEM_ERROR(errno), lino, _exit);
|
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||||
} else if (n < pFD->szPage) {
|
} else if (n < pFD->szPage) {
|
||||||
TSDB_CHECK_CODE(code = TSDB_CODE_FILE_CORRUPTED, lino, _exit);
|
TSDB_CHECK_CODE(code = TSDB_CODE_FILE_CORRUPTED, lino, _exit);
|
||||||
}
|
}
|
||||||
|
@ -378,7 +378,7 @@ static int32_t tsdbReadFileBlock(STsdbFD *pFD, int64_t offset, int64_t size, boo
|
||||||
|
|
||||||
ret = taosReadFile(pFD->pFD, buf + n, nRead);
|
ret = taosReadFile(pFD->pFD, buf + n, nRead);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
TSDB_CHECK_CODE(code = TAOS_SYSTEM_ERROR(errno), lino, _exit);
|
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||||
} else if (ret < nRead) {
|
} else if (ret < nRead) {
|
||||||
TSDB_CHECK_CODE(code = TSDB_CODE_FILE_CORRUPTED, lino, _exit);
|
TSDB_CHECK_CODE(code = TSDB_CODE_FILE_CORRUPTED, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,8 +211,9 @@ int vnodeCommitInfo(const char *dir) {
|
||||||
snprintf(fname, TSDB_FILENAME_LEN, "%s%s%s", dir, TD_DIRSEP, VND_INFO_FNAME);
|
snprintf(fname, TSDB_FILENAME_LEN, "%s%s%s", dir, TD_DIRSEP, VND_INFO_FNAME);
|
||||||
snprintf(tfname, TSDB_FILENAME_LEN, "%s%s%s", dir, TD_DIRSEP, VND_INFO_FNAME_TMP);
|
snprintf(tfname, TSDB_FILENAME_LEN, "%s%s%s", dir, TD_DIRSEP, VND_INFO_FNAME_TMP);
|
||||||
|
|
||||||
if (taosRenameFile(tfname, fname) < 0) {
|
int32_t code = taosRenameFile(tfname, fname);
|
||||||
return terrno = TAOS_SYSTEM_ERROR(errno);
|
if (code < 0) {
|
||||||
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
vInfo("vnode info is committed, dir:%s", dir);
|
vInfo("vnode info is committed, dir:%s", dir);
|
||||||
|
@ -245,7 +246,7 @@ int vnodeLoadInfo(const char *dir, SVnodeInfo *pInfo) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosReadFile(pFile, pData, size) < 0) {
|
if (taosReadFile(pFile, pData, size) < 0) {
|
||||||
TSDB_CHECK_CODE(code = TAOS_SYSTEM_ERROR(errno), lino, _exit);
|
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
pData[size] = '\0';
|
pData[size] = '\0';
|
||||||
|
|
|
@ -289,7 +289,7 @@ int32_t vnodeSnapRead(SVSnapReader *pReader, uint8_t **ppData, uint32_t *nData)
|
||||||
if (taosReadFile(pFile, ((SSnapDataHdr *)(*ppData))->data, size) < 0) {
|
if (taosReadFile(pFile, ((SSnapDataHdr *)(*ppData))->data, size) < 0) {
|
||||||
taosMemoryFree(*ppData);
|
taosMemoryFree(*ppData);
|
||||||
(void)taosCloseFile(&pFile);
|
(void)taosCloseFile(&pFile);
|
||||||
TSDB_CHECK_CODE(code = TAOS_SYSTEM_ERROR(errno), lino, _exit);
|
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)taosCloseFile(&pFile);
|
(void)taosCloseFile(&pFile);
|
||||||
|
|
|
@ -562,7 +562,7 @@ static int32_t readBlockFromDisk(SGroupCacheOperatorInfo* pGCache, SGroupCacheDa
|
||||||
ret = (int32_t)taosReadFile(pFileFd->fd, *ppBuf, pBasic->bufSize);
|
ret = (int32_t)taosReadFile(pFileFd->fd, *ppBuf, pBasic->bufSize);
|
||||||
if (ret != pBasic->bufSize) {
|
if (ret != pBasic->bufSize) {
|
||||||
taosMemoryFreeClear(*ppBuf);
|
taosMemoryFreeClear(*ppBuf);
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
code = terrno;
|
||||||
goto _return;
|
goto _return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -296,7 +296,7 @@ int32_t remoteChkp_readMetaData(char* path, SSChkpMetaOnS3** pMeta) {
|
||||||
|
|
||||||
char buf[256] = {0};
|
char buf[256] = {0};
|
||||||
if (taosReadFile(pFile, buf, sizeof(buf)) <= 0) {
|
if (taosReadFile(pFile, buf, sizeof(buf)) <= 0) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
code = terrno;
|
||||||
goto _EXIT;
|
goto _EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,8 +367,8 @@ int32_t remoteChkp_validAndCvtMeta(char* path, SSChkpMetaOnS3* pMeta, int64_t ch
|
||||||
goto _EXIT;
|
goto _EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosRenameFile(src, dst) != 0) {
|
code = taosRenameFile(src, dst);
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
if (code != 0) {
|
||||||
goto _EXIT;
|
goto _EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -507,7 +507,6 @@ int32_t rebuildFromRemoteChkp_s3(const char* key, char* chkpPath, int64_t chkpId
|
||||||
if (taosIsDir(defaultPath)) {
|
if (taosIsDir(defaultPath)) {
|
||||||
code = taosRenameFile(defaultPath, defaultTmp);
|
code = taosRenameFile(defaultPath, defaultTmp);
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
|
||||||
goto _EXIT;
|
goto _EXIT;
|
||||||
} else {
|
} else {
|
||||||
rename = 1;
|
rename = 1;
|
||||||
|
@ -1609,7 +1608,7 @@ int32_t chkpLoadExtraInfo(char* pChkpIdDir, int64_t* chkpId, int64_t* processId)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosReadFile(pFile, buf, sizeof(buf)) <= 0) {
|
if (taosReadFile(pFile, buf, sizeof(buf)) <= 0) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
code = terrno;
|
||||||
stError("failed to read file to load extra info, file:%s, reason:%s", pDst, tstrerror(code));
|
stError("failed to read file to load extra info, file:%s, reason:%s", pDst, tstrerror(code));
|
||||||
goto _EXIT;
|
goto _EXIT;
|
||||||
}
|
}
|
||||||
|
|
|
@ -696,7 +696,7 @@ int32_t streamSnapWriteImpl(SStreamSnapWriter* pWriter, uint8_t* pData, uint32_t
|
||||||
if (strlen(pHdr->name) == strlen(pItem->name) && strcmp(pHdr->name, pItem->name) == 0) {
|
if (strlen(pHdr->name) == strlen(pItem->name) && strcmp(pHdr->name, pItem->name) == 0) {
|
||||||
int64_t bytes = taosPWriteFile(pSnapFile->fd, pHdr->data, pHdr->size, pSnapFile->offset);
|
int64_t bytes = taosPWriteFile(pSnapFile->fd, pHdr->data, pHdr->size, pSnapFile->offset);
|
||||||
if (bytes != pHdr->size) {
|
if (bytes != pHdr->size) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
code = terrno;
|
||||||
stError("%s failed to write snap, file name:%s, reason:%s", STREAM_STATE_TRANSFER, pHdr->name, tstrerror(code));
|
stError("%s failed to write snap, file name:%s, reason:%s", STREAM_STATE_TRANSFER, pHdr->name, tstrerror(code));
|
||||||
goto _err;
|
goto _err;
|
||||||
} else {
|
} else {
|
||||||
|
@ -735,7 +735,7 @@ int32_t streamSnapWriteImpl(SStreamSnapWriter* pWriter, uint8_t* pData, uint32_t
|
||||||
|
|
||||||
// open fd again, let's close fd during handle errors.
|
// open fd again, let's close fd during handle errors.
|
||||||
if (taosPWriteFile(pSnapFile->fd, pHdr->data, pHdr->size, pSnapFile->offset) != pHdr->size) {
|
if (taosPWriteFile(pSnapFile->fd, pHdr->data, pHdr->size, pSnapFile->offset) != pHdr->size) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
code = terrno;
|
||||||
stError("%s failed to write snap, file name:%s, reason:%s", STREAM_STATE_TRANSFER, pHdr->name, tstrerror(code));
|
stError("%s failed to write snap, file name:%s, reason:%s", STREAM_STATE_TRANSFER, pHdr->name, tstrerror(code));
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,9 +164,7 @@ int32_t syncWriteCfgFile(SSyncNode *pNode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)taosCloseFile(&pFile);
|
(void)taosCloseFile(&pFile);
|
||||||
if (taosRenameFile(file, realfile) != 0) {
|
TAOS_CHECK_EXIT(taosRenameFile(file, realfile));
|
||||||
TAOS_CHECK_EXIT(TAOS_SYSTEM_ERROR(errno));
|
|
||||||
}
|
|
||||||
|
|
||||||
sInfo("vgId:%d, succeed to write sync cfg file:%s, len:%d, lastConfigIndex:%" PRId64 ", changeVersion:%d",
|
sInfo("vgId:%d, succeed to write sync cfg file:%s, len:%d, lastConfigIndex:%" PRId64 ", changeVersion:%d",
|
||||||
pNode->vgId, realfile, len, pNode->raftCfg.lastConfigIndex, pNode->raftCfg.cfg.changeVersion);
|
pNode->vgId, realfile, len, pNode->raftCfg.lastConfigIndex, pNode->raftCfg.cfg.changeVersion);
|
||||||
|
@ -280,7 +278,7 @@ int32_t syncReadCfgFile(SSyncNode *pNode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosReadFile(pFile, pData, size) != size) {
|
if (taosReadFile(pFile, pData, size) != size) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
code = terrno;
|
||||||
sError("vgId:%d, failed to read sync cfg file:%s since %s", pNode->vgId, file, tstrerror(code));
|
sError("vgId:%d, failed to read sync cfg file:%s since %s", pNode->vgId, file, tstrerror(code));
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ int32_t raftStoreReadFile(SSyncNode *pNode) {
|
||||||
if (taosReadFile(pFile, pData, size) != size) {
|
if (taosReadFile(pFile, pData, size) != size) {
|
||||||
sError("vgId:%d, failed to read raft store file:%s since %s", pNode->vgId, file, terrstr());
|
sError("vgId:%d, failed to read raft store file:%s since %s", pNode->vgId, file, terrstr());
|
||||||
|
|
||||||
TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(errno), &lino, _OVER);
|
TAOS_CHECK_GOTO(terrno, &lino, _OVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
pData[size] = '\0';
|
pData[size] = '\0';
|
||||||
|
|
|
@ -39,7 +39,9 @@ int tdbGnrtFileID(tdb_fd_t fd, uint8_t *fileid, bool unique) {
|
||||||
int64_t stDev = 0, stIno = 0;
|
int64_t stDev = 0, stIno = 0;
|
||||||
|
|
||||||
int32_t code = taosDevInoFile(fd, &stDev, &stIno);
|
int32_t code = taosDevInoFile(fd, &stDev, &stIno);
|
||||||
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
return code;
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
memset(fileid, 0, TDB_FILE_ID_LEN);
|
memset(fileid, 0, TDB_FILE_ID_LEN);
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,7 @@ static FORCE_INLINE int32_t walScanLogGetLastVer(SWal* pWal, int32_t fileIdx, in
|
||||||
if (readSize != taosReadFile(pFile, buf, readSize)) {
|
if (readSize != taosReadFile(pFile, buf, readSize)) {
|
||||||
wError("vgId:%d, failed to read file due to %s. readSize:%" PRId64 ", file:%s", pWal->cfg.vgId, strerror(errno),
|
wError("vgId:%d, failed to read file due to %s. readSize:%" PRId64 ", file:%s", pWal->cfg.vgId, strerror(errno),
|
||||||
readSize, fnameStr);
|
readSize, fnameStr);
|
||||||
TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(errno), &lino, _err);
|
TAOS_CHECK_GOTO(terrno, &lino, _err);
|
||||||
}
|
}
|
||||||
|
|
||||||
char* candidate = NULL;
|
char* candidate = NULL;
|
||||||
|
@ -177,7 +177,7 @@ static FORCE_INLINE int32_t walScanLogGetLastVer(SWal* pWal, int32_t fileIdx, in
|
||||||
if (extraSize != taosReadFile(pFile, buf + readSize, extraSize)) {
|
if (extraSize != taosReadFile(pFile, buf + readSize, extraSize)) {
|
||||||
wError("vgId:%d, failed to read file due to %s. offset:%" PRId64 ", extraSize:%" PRId64 ", file:%s",
|
wError("vgId:%d, failed to read file due to %s. offset:%" PRId64 ", extraSize:%" PRId64 ", file:%s",
|
||||||
pWal->cfg.vgId, strerror(errno), offset + readSize, extraSize, fnameStr);
|
pWal->cfg.vgId, strerror(errno), offset + readSize, extraSize, fnameStr);
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
code = terrno;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -522,7 +522,7 @@ static int32_t walReadLogHead(TdFilePtr pLogFile, int64_t offset, SWalCkHead* pC
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosReadFile(pLogFile, pCkHead, sizeof(SWalCkHead)) != sizeof(SWalCkHead)) {
|
if (taosReadFile(pLogFile, pCkHead, sizeof(SWalCkHead)) != sizeof(SWalCkHead)) {
|
||||||
TAOS_RETURN(TAOS_SYSTEM_ERROR(errno));
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (walValidHeadCksum(pCkHead) != 0) {
|
if (walValidHeadCksum(pCkHead) != 0) {
|
||||||
|
@ -588,7 +588,7 @@ static int32_t walCheckAndRepairIdxFile(SWal* pWal, int32_t fileIdx) {
|
||||||
wError("vgId:%d, failed to read file due to %s. offset:%" PRId64 ", file:%s", pWal->cfg.vgId, strerror(errno),
|
wError("vgId:%d, failed to read file due to %s. offset:%" PRId64 ", file:%s", pWal->cfg.vgId, strerror(errno),
|
||||||
offset, fnameStr);
|
offset, fnameStr);
|
||||||
|
|
||||||
TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(errno), &lino, _err);
|
TAOS_CHECK_GOTO(terrno, &lino, _err);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (idxEntry.ver > pFileInfo->lastVer) {
|
if (idxEntry.ver > pFileInfo->lastVer) {
|
||||||
|
@ -1028,7 +1028,7 @@ int32_t walLoadMeta(SWal* pWal) {
|
||||||
(void)taosCloseFile(&pFile);
|
(void)taosCloseFile(&pFile);
|
||||||
taosMemoryFree(buf);
|
taosMemoryFree(buf);
|
||||||
|
|
||||||
TAOS_RETURN(TAOS_SYSTEM_ERROR(errno));
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
// load into fileInfoSet
|
// load into fileInfoSet
|
||||||
code = walMetaDeserialize(pWal, buf);
|
code = walMetaDeserialize(pWal, buf);
|
||||||
|
|
|
@ -144,7 +144,7 @@ static int32_t walReadSeekFilePos(SWalReader *pReader, int64_t fileFirstVer, int
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
wError("vgId:%d, failed to read idx file, since %s", pReader->pWal->cfg.vgId, terrstr());
|
wError("vgId:%d, failed to read idx file, since %s", pReader->pWal->cfg.vgId, terrstr());
|
||||||
|
|
||||||
TAOS_RETURN(TAOS_SYSTEM_ERROR(errno));
|
TAOS_RETURN(terrno);
|
||||||
} else {
|
} else {
|
||||||
wError("vgId:%d, read idx file incompletely, read bytes %" PRId64 ", bytes should be %ld",
|
wError("vgId:%d, read idx file incompletely, read bytes %" PRId64 ", bytes should be %ld",
|
||||||
pReader->pWal->cfg.vgId, ret, sizeof(SWalIdxEntry));
|
pReader->pWal->cfg.vgId, ret, sizeof(SWalIdxEntry));
|
||||||
|
@ -270,7 +270,7 @@ int32_t walFetchHead(SWalReader *pRead, int64_t ver) {
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
if (contLen < 0) {
|
if (contLen < 0) {
|
||||||
TAOS_RETURN(TAOS_SYSTEM_ERROR(errno));
|
TAOS_RETURN(terrno);
|
||||||
} else {
|
} else {
|
||||||
TAOS_RETURN(TSDB_CODE_WAL_FILE_CORRUPTED);
|
TAOS_RETURN(TSDB_CODE_WAL_FILE_CORRUPTED);
|
||||||
}
|
}
|
||||||
|
@ -345,7 +345,7 @@ int32_t walFetchBody(SWalReader *pRead) {
|
||||||
wError("vgId:%d, wal fetch body error:%" PRId64 ", read request index:%" PRId64 ", since %s, 0x%" PRIx64, vgId,
|
wError("vgId:%d, wal fetch body error:%" PRId64 ", read request index:%" PRId64 ", since %s, 0x%" PRIx64, vgId,
|
||||||
pReadHead->version, ver, tstrerror(terrno), id);
|
pReadHead->version, ver, tstrerror(terrno), id);
|
||||||
|
|
||||||
TAOS_RETURN(TAOS_SYSTEM_ERROR(errno));
|
TAOS_RETURN(terrno);
|
||||||
} else {
|
} else {
|
||||||
wError("vgId:%d, wal fetch body error:%" PRId64 ", read request index:%" PRId64
|
wError("vgId:%d, wal fetch body error:%" PRId64 ", read request index:%" PRId64
|
||||||
", since file corrupted, 0x%" PRIx64,
|
", since file corrupted, 0x%" PRIx64,
|
||||||
|
@ -426,7 +426,7 @@ int32_t walReadVer(SWalReader *pReader, int64_t ver) {
|
||||||
TAOS_UNUSED(taosThreadMutexUnlock(&pReader->mutex));
|
TAOS_UNUSED(taosThreadMutexUnlock(&pReader->mutex));
|
||||||
|
|
||||||
if (contLen < 0) {
|
if (contLen < 0) {
|
||||||
TAOS_RETURN(TAOS_SYSTEM_ERROR(errno));
|
TAOS_RETURN(terrno);
|
||||||
} else {
|
} else {
|
||||||
TAOS_RETURN(TSDB_CODE_WAL_FILE_CORRUPTED);
|
TAOS_RETURN(TSDB_CODE_WAL_FILE_CORRUPTED);
|
||||||
}
|
}
|
||||||
|
@ -467,7 +467,7 @@ int32_t walReadVer(SWalReader *pReader, int64_t ver) {
|
||||||
TAOS_UNUSED(taosThreadMutexUnlock(&pReader->mutex));
|
TAOS_UNUSED(taosThreadMutexUnlock(&pReader->mutex));
|
||||||
|
|
||||||
if (contLen < 0) {
|
if (contLen < 0) {
|
||||||
TAOS_RETURN(TAOS_SYSTEM_ERROR(errno));
|
TAOS_RETURN(terrno);
|
||||||
} else {
|
} else {
|
||||||
TAOS_RETURN(TSDB_CODE_WAL_FILE_CORRUPTED);
|
TAOS_RETURN(TSDB_CODE_WAL_FILE_CORRUPTED);
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,7 +214,7 @@ int32_t walRollback(SWal *pWal, int64_t ver) {
|
||||||
if (taosReadFile(pIdxFile, &entry, sizeof(SWalIdxEntry)) != sizeof(SWalIdxEntry)) {
|
if (taosReadFile(pIdxFile, &entry, sizeof(SWalIdxEntry)) != sizeof(SWalIdxEntry)) {
|
||||||
TAOS_UNUSED(taosThreadMutexUnlock(&pWal->mutex));
|
TAOS_UNUSED(taosThreadMutexUnlock(&pWal->mutex));
|
||||||
|
|
||||||
TAOS_RETURN(TAOS_SYSTEM_ERROR(errno));
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
walBuildLogName(pWal, walGetCurFileFirstVer(pWal), fnameStr);
|
walBuildLogName(pWal, walGetCurFileFirstVer(pWal), fnameStr);
|
||||||
|
@ -240,7 +240,7 @@ int32_t walRollback(SWal *pWal, int64_t ver) {
|
||||||
if (size != sizeof(SWalCkHead)) {
|
if (size != sizeof(SWalCkHead)) {
|
||||||
TAOS_UNUSED(taosThreadMutexUnlock(&pWal->mutex));
|
TAOS_UNUSED(taosThreadMutexUnlock(&pWal->mutex));
|
||||||
|
|
||||||
TAOS_RETURN(TAOS_SYSTEM_ERROR(errno));
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
code = walValidHeadCksum(&head);
|
code = walValidHeadCksum(&head);
|
||||||
|
|
||||||
|
|
|
@ -447,7 +447,7 @@ TdDirPtr taosOpenDir(const char *dirname) {
|
||||||
if (INVALID_HANDLE_VALUE == pDir->hFind) {
|
if (INVALID_HANDLE_VALUE == pDir->hFind) {
|
||||||
taosMemoryFree(pDir);
|
taosMemoryFree(pDir);
|
||||||
DWORD errorCode = GetLastError();
|
DWORD errorCode = GetLastError();
|
||||||
terrno = TAOS_SYSTEM_ERROR(errorCode);
|
terrno = TAOS_SYSTEM_WINAPI_ERROR(errorCode);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return pDir;
|
return pDir;
|
||||||
|
@ -529,7 +529,7 @@ int32_t taosCloseDir(TdDirPtr *ppDir) {
|
||||||
}
|
}
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
if(!FindClose((*ppDir)->hFind)) {
|
if(!FindClose((*ppDir)->hFind)) {
|
||||||
terrno = TAOS_SYSTEM_ERROR(GetLastError());
|
terrno = TAOS_SYSTEM_WINAPI_ERROR(GetLastError());
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
taosMemoryFree(*ppDir);
|
taosMemoryFree(*ppDir);
|
||||||
|
|
|
@ -64,7 +64,10 @@ int32_t osDefaultInit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
taosWinSocketInit();
|
code = taosWinSocketInit();
|
||||||
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
const char *tmpDir = getenv("tmp");
|
const char *tmpDir = getenv("tmp");
|
||||||
if (tmpDir == NULL) {
|
if (tmpDir == NULL) {
|
||||||
|
|
|
@ -132,6 +132,7 @@ int64_t taosCopyFile(const char *from, const char *to) {
|
||||||
if (CopyFile(from, to, 0)) {
|
if (CopyFile(from, to, 0)) {
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
|
terrno = TAOS_SYSTEM_WINAPI_ERROR(GetLastError());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -231,8 +232,9 @@ int32_t taosRenameFile(const char *oldName, const char *newName) {
|
||||||
|
|
||||||
HANDLE transactionHandle = CreateTransaction(NULL, NULL, 0, 0, 0, INFINITE, NULL);
|
HANDLE transactionHandle = CreateTransaction(NULL, NULL, 0, 0, 0, INFINITE, NULL);
|
||||||
if (transactionHandle == INVALID_HANDLE_VALUE) {
|
if (transactionHandle == INVALID_HANDLE_VALUE) {
|
||||||
printf("failed to rename file %s to %s, reason: CreateTransaction failed.\n", oldName, newName);
|
DWORD error = GetLastError();
|
||||||
return -1;
|
terrno = TAOS_SYSTEM_WINAPI_ERROR(error);
|
||||||
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL result = MoveFileTransacted(oldName, newName, NULL, NULL, MOVEFILE_REPLACE_EXISTING, transactionHandle);
|
BOOL result = MoveFileTransacted(oldName, newName, NULL, NULL, MOVEFILE_REPLACE_EXISTING, transactionHandle);
|
||||||
|
@ -241,18 +243,18 @@ int32_t taosRenameFile(const char *oldName, const char *newName) {
|
||||||
finished = CommitTransaction(transactionHandle);
|
finished = CommitTransaction(transactionHandle);
|
||||||
if (!finished) {
|
if (!finished) {
|
||||||
DWORD error = GetLastError();
|
DWORD error = GetLastError();
|
||||||
printf("failed to rename file %s to %s, reason: CommitTransaction errcode %d.\n", oldName, newName, error);
|
terrno = TAOS_SYSTEM_WINAPI_ERROR(error);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
RollbackTransaction(transactionHandle);
|
RollbackTransaction(transactionHandle);
|
||||||
DWORD error = GetLastError();
|
DWORD error = GetLastError();
|
||||||
|
terrno = TAOS_SYSTEM_WINAPI_ERROR(error);
|
||||||
finished = false;
|
finished = false;
|
||||||
printf("failed to rename file %s to %s, reason: MoveFileTransacted errcode %d.\n", oldName, newName, error);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CloseHandle(transactionHandle);
|
CloseHandle(transactionHandle);
|
||||||
|
|
||||||
return finished ? 0 : -1;
|
return finished ? 0 : terrno;
|
||||||
#else
|
#else
|
||||||
int32_t code = rename(oldName, newName);
|
int32_t code = rename(oldName, newName);
|
||||||
if (-1 == code) {
|
if (-1 == code) {
|
||||||
|
@ -260,7 +262,7 @@ int32_t taosRenameFile(const char *oldName, const char *newName) {
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
return code;
|
return TSDB_CODE_SUCCESS;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -294,12 +296,14 @@ int32_t taosStatFile(const char *path, int64_t *size, int32_t *mtime, int32_t *a
|
||||||
int32_t taosDevInoFile(TdFilePtr pFile, int64_t *stDev, int64_t *stIno) {
|
int32_t taosDevInoFile(TdFilePtr pFile, int64_t *stDev, int64_t *stIno) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
if (pFile == NULL || pFile->hFile == NULL) {
|
if (pFile == NULL || pFile->hFile == NULL) {
|
||||||
return -1;
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
|
return terrno;
|
||||||
}
|
}
|
||||||
BY_HANDLE_FILE_INFORMATION bhfi;
|
BY_HANDLE_FILE_INFORMATION bhfi;
|
||||||
if (GetFileInformationByHandle(pFile->hFile, &bhfi) == FALSE) {
|
if (GetFileInformationByHandle(pFile->hFile, &bhfi) == FALSE) {
|
||||||
printf("taosFStatFile get file info fail.");
|
DWORD error = GetLastError();
|
||||||
return -1;
|
terrno = TAOS_SYSTEM_WINAPI_ERROR(error);
|
||||||
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stDev != NULL) {
|
if (stDev != NULL) {
|
||||||
|
@ -395,35 +399,38 @@ HANDLE taosOpenFileNotStream(const char *path, int32_t tdFileOptions) {
|
||||||
if (h != INVALID_HANDLE_VALUE && (tdFileOptions & TD_FILE_APPEND) && (tdFileOptions & TD_FILE_WRITE)) {
|
if (h != INVALID_HANDLE_VALUE && (tdFileOptions & TD_FILE_APPEND) && (tdFileOptions & TD_FILE_WRITE)) {
|
||||||
SetFilePointer(h, 0, NULL, FILE_END);
|
SetFilePointer(h, 0, NULL, FILE_END);
|
||||||
}
|
}
|
||||||
// if (h == INVALID_HANDLE_VALUE) {
|
if (h == INVALID_HANDLE_VALUE) {
|
||||||
// DWORD dwError = GetLastError();
|
DWORD dwError = GetLastError();
|
||||||
|
terrno = TAOS_SYSTEM_WINAPI_ERROR(error);
|
||||||
// LPVOID lpMsgBuf;
|
// LPVOID lpMsgBuf;
|
||||||
// FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwError,
|
// FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwError, 0, (LPTSTR)&lpMsgBuf, 0,
|
||||||
// 0,
|
// NULL);
|
||||||
// (LPTSTR)&lpMsgBuf, 0, NULL);
|
// printf("CreateFile failed with error %d: %s", dwError, (char *)lpMsgBuf);
|
||||||
// printf("CreateFile failed with error %d: %s", dwError, (char*)lpMsgBuf);
|
|
||||||
// LocalFree(lpMsgBuf);
|
// LocalFree(lpMsgBuf);
|
||||||
// }
|
}
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t taosReadFile(TdFilePtr pFile, void *buf, int64_t count) {
|
int64_t taosReadFile(TdFilePtr pFile, void *buf, int64_t count) {
|
||||||
#if FILE_WITH_LOCK
|
#if FILE_WITH_LOCK
|
||||||
taosThreadRwlockRdlock(&(pFile->rwlock));
|
(void)taosThreadRwlockRdlock(&(pFile->rwlock));
|
||||||
#endif
|
#endif
|
||||||
if (pFile->hFile == NULL) {
|
if (pFile->hFile == NULL) {
|
||||||
#if FILE_WITH_LOCK
|
#if FILE_WITH_LOCK
|
||||||
taosThreadRwlockUnlock(&(pFile->rwlock));
|
(void)taosThreadRwlockUnlock(&(pFile->rwlock));
|
||||||
#endif
|
#endif
|
||||||
return -1;
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD bytesRead;
|
DWORD bytesRead;
|
||||||
if (!ReadFile(pFile->hFile, buf, count, &bytesRead, NULL)) {
|
if (!ReadFile(pFile->hFile, buf, count, &bytesRead, NULL)) {
|
||||||
|
DWORD errCode = GetLastError();
|
||||||
|
terrno = TAOS_SYSTEM_WINAPI_ERROR(errCode);
|
||||||
bytesRead = -1;
|
bytesRead = -1;
|
||||||
}
|
}
|
||||||
#if FILE_WITH_LOCK
|
#if FILE_WITH_LOCK
|
||||||
taosThreadRwlockUnlock(&(pFile->rwlock));
|
(void)taosThreadRwlockUnlock(&(pFile->rwlock));
|
||||||
#endif
|
#endif
|
||||||
return bytesRead;
|
return bytesRead;
|
||||||
}
|
}
|
||||||
|
@ -449,14 +456,15 @@ int64_t taosWriteFile(TdFilePtr pFile, const void *buf, int64_t count) {
|
||||||
|
|
||||||
int64_t taosPWriteFile(TdFilePtr pFile, const void *buf, int64_t count, int64_t offset) {
|
int64_t taosPWriteFile(TdFilePtr pFile, const void *buf, int64_t count, int64_t offset) {
|
||||||
if (pFile == NULL) {
|
if (pFile == NULL) {
|
||||||
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#if FILE_WITH_LOCK
|
#if FILE_WITH_LOCK
|
||||||
taosThreadRwlockWrlock(&(pFile->rwlock));
|
(void)taosThreadRwlockWrlock(&(pFile->rwlock));
|
||||||
#endif
|
#endif
|
||||||
if (pFile->hFile == NULL) {
|
if (pFile->hFile == NULL) {
|
||||||
#if FILE_WITH_LOCK
|
#if FILE_WITH_LOCK
|
||||||
taosThreadRwlockUnlock(&(pFile->rwlock));
|
(void)taosThreadRwlockUnlock(&(pFile->rwlock));
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -470,11 +478,12 @@ int64_t taosPWriteFile(TdFilePtr pFile, const void *buf, int64_t count, int64_t
|
||||||
BOOL result = WriteFile(pFile->hFile, buf, count, &ret, &ol);
|
BOOL result = WriteFile(pFile->hFile, buf, count, &ret, &ol);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
errno = GetLastError();
|
errno = GetLastError();
|
||||||
|
terrno = TAOS_SYSTEM_WINAPI_ERROR(errno);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if FILE_WITH_LOCK
|
#if FILE_WITH_LOCK
|
||||||
taosThreadRwlockUnlock(&(pFile->rwlock));
|
(void)taosThreadRwlockUnlock(&(pFile->rwlock));
|
||||||
#endif
|
#endif
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -484,7 +493,7 @@ int64_t taosLSeekFile(TdFilePtr pFile, int64_t offset, int32_t whence) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#if FILE_WITH_LOCK
|
#if FILE_WITH_LOCK
|
||||||
taosThreadRwlockRdlock(&(pFile->rwlock));
|
(void)taosThreadRwlockRdlock(&(pFile->rwlock));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LARGE_INTEGER liOffset;
|
LARGE_INTEGER liOffset;
|
||||||
|
@ -498,7 +507,7 @@ int64_t taosLSeekFile(TdFilePtr pFile, int64_t offset, int32_t whence) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#if FILE_WITH_LOCK
|
#if FILE_WITH_LOCK
|
||||||
taosThreadRwlockUnlock(&(pFile->rwlock));
|
(void)taosThreadRwlockUnlock(&(pFile->rwlock));
|
||||||
#endif
|
#endif
|
||||||
return liOffset.QuadPart;
|
return liOffset.QuadPart;
|
||||||
}
|
}
|
||||||
|
@ -826,25 +835,11 @@ int64_t taosPWriteFile(TdFilePtr pFile, const void *buf, int64_t count, int64_t
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WINDOWS
|
|
||||||
DWORD ret = 0;
|
|
||||||
OVERLAPPED ol = {0};
|
|
||||||
ol.OffsetHigh = (uint32_t)((offset & 0xFFFFFFFF00000000LL) >> 0x20);
|
|
||||||
ol.Offset = (uint32_t)(offset & 0xFFFFFFFFLL);
|
|
||||||
|
|
||||||
HANDLE handle = (HANDLE)_get_osfhandle(pFile->fd);
|
|
||||||
SetLastError(0);
|
|
||||||
BOOL result = WriteFile(handle, buf, count, &ret, &ol);
|
|
||||||
if (!result) {
|
|
||||||
errno = GetLastError();
|
|
||||||
ret = -1;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
int64_t ret = pwrite(pFile->fd, buf, count, offset);
|
int64_t ret = pwrite(pFile->fd, buf, count, offset);
|
||||||
if (-1 == ret) {
|
if (-1 == ret) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
code = TAOS_SYSTEM_ERROR(errno);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if FILE_WITH_LOCK
|
#if FILE_WITH_LOCK
|
||||||
(void)taosThreadRwlockUnlock(&(pFile->rwlock));
|
(void)taosThreadRwlockUnlock(&(pFile->rwlock));
|
||||||
#endif
|
#endif
|
||||||
|
@ -867,14 +862,10 @@ int64_t taosLSeekFile(TdFilePtr pFile, int64_t offset, int32_t whence) {
|
||||||
|
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
|
||||||
#ifdef WINDOWS
|
|
||||||
int64_t ret = _lseeki64(pFile->fd, offset, whence);
|
|
||||||
#else
|
|
||||||
int64_t ret = lseek(pFile->fd, offset, whence);
|
int64_t ret = lseek(pFile->fd, offset, whence);
|
||||||
if (-1 == ret) {
|
if (-1 == ret) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
code = TAOS_SYSTEM_ERROR(errno);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if FILE_WITH_LOCK
|
#if FILE_WITH_LOCK
|
||||||
(void)taosThreadRwlockUnlock(&(pFile->rwlock));
|
(void)taosThreadRwlockUnlock(&(pFile->rwlock));
|
||||||
|
|
|
@ -1170,19 +1170,23 @@ int32_t taosCreateSocketWithTimeout(uint32_t timeout) {
|
||||||
return (int)fd;
|
return (int)fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
void taosWinSocketInit() {
|
int32_t taosWinSocketInit() {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
static char flag = 0;
|
static int8_t flag = 0;
|
||||||
if (flag == 0) {
|
if (atomic_val_compare_exchange_8(&flag, 0, 1) == 0) {
|
||||||
WORD wVersionRequested;
|
WORD wVersionRequested;
|
||||||
WSADATA wsaData;
|
WSADATA wsaData;
|
||||||
wVersionRequested = MAKEWORD(1, 1);
|
wVersionRequested = MAKEWORD(1, 1);
|
||||||
if (WSAStartup(wVersionRequested, &wsaData) == 0) {
|
if (WSAStartup(wVersionRequested, &wsaData) != 0) {
|
||||||
flag = 1;
|
atomic_store_8(&flag, 0)
|
||||||
|
int errorCode = WSAGetLastError();
|
||||||
|
return terrno = TAOS_SYSTEM_WINSOCKET_ERROR(errorCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
#else
|
#else
|
||||||
#endif
|
#endif
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t taosHton64(uint64_t val) {
|
uint64_t taosHton64(uint64_t val) {
|
||||||
|
|
|
@ -300,7 +300,7 @@ int32_t taosGetEmail(char *email, int32_t maxLen) {
|
||||||
|
|
||||||
if (taosReadFile(pFile, (void *)email, maxLen) < 0) {
|
if (taosReadFile(pFile, (void *)email, maxLen) < 0) {
|
||||||
taosCloseFile(&pFile);
|
taosCloseFile(&pFile);
|
||||||
return -1;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
taosCloseFile(&pFile);
|
taosCloseFile(&pFile);
|
||||||
|
|
|
@ -850,6 +850,7 @@ static void tsSortError(void) {
|
||||||
taosSort(errors, sizeof(errors) / sizeof(errors[0]), sizeof(errors[0]), taosCompareTaosError);
|
taosSort(errors, sizeof(errors) / sizeof(errors[0]), sizeof(errors[0]), taosCompareTaosError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char WinAPIErrDesc[256] = {0};
|
||||||
const char* tstrerror(int32_t err) {
|
const char* tstrerror(int32_t err) {
|
||||||
(void)taosThreadOnce(&tsErrorInit, tsSortError);
|
(void)taosThreadOnce(&tsErrorInit, tsSortError);
|
||||||
|
|
||||||
|
@ -860,6 +861,15 @@ const char* tstrerror(int32_t err) {
|
||||||
// invalid code return Unknown error
|
// invalid code return Unknown error
|
||||||
return strerror(code);
|
return strerror(code);
|
||||||
}
|
}
|
||||||
|
#ifdef WINDOWS
|
||||||
|
if ((err & 0x01ff0000) == 0x01ff0000) {
|
||||||
|
snprintf(WinAPIErrDesc, 256, "windows api error, code: 0x%08x", err & 0x0000ffff);
|
||||||
|
return WinAPIErrDesc;
|
||||||
|
} else if ((err & 0x02ff0000) == 0x02ff0000) {
|
||||||
|
snprintf(WinAPIErrDesc, 256, "windows socket error, code: 0x%08x", err & 0x0000ffff);
|
||||||
|
return WinAPIErrDesc;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
int32_t s = 0;
|
int32_t s = 0;
|
||||||
int32_t e = sizeof(errors) / sizeof(errors[0]);
|
int32_t e = sizeof(errors) / sizeof(errors[0]);
|
||||||
|
|
||||||
|
|
|
@ -256,7 +256,7 @@ static int32_t loadPageFromDisk(SDiskbasedBuf* pBuf, SPageInfo* pg) {
|
||||||
void* pPage = (void*)GET_PAYLOAD_DATA(pg);
|
void* pPage = (void*)GET_PAYLOAD_DATA(pg);
|
||||||
ret = (int32_t)taosReadFile(pBuf->pFile, pPage, pg->length);
|
ret = (int32_t)taosReadFile(pBuf->pFile, pPage, pg->length);
|
||||||
if (ret != pg->length) {
|
if (ret != pg->length) {
|
||||||
ret = TAOS_SYSTEM_ERROR(errno);
|
ret = terrno;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue