Merge remote-tracking branch 'origin/3.0' into feature/config
This commit is contained in:
commit
3548b4d77a
|
@ -356,7 +356,7 @@ int tsdbCreateDFile(STsdb *pRepo, SDFile *pDFile, bool updateHeader) {
|
|||
ASSERT(pDFile->info.size == 0 && pDFile->info.magic == TSDB_FILE_INIT_MAGIC);
|
||||
|
||||
pDFile->pFile = taosOpenFile(TSDB_FILE_FULL_NAME(pDFile), TD_FILE_CTEATE | TD_FILE_WRITE | TD_FILE_TRUNC);
|
||||
if (pDFile->pFile < 0) {
|
||||
if (pDFile->pFile == NULL) {
|
||||
if (errno == ENOENT) {
|
||||
// Try to create directory recursively
|
||||
char *s = strdup(TSDB_FILE_REL_NAME(pDFile));
|
||||
|
@ -367,7 +367,7 @@ int tsdbCreateDFile(STsdb *pRepo, SDFile *pDFile, bool updateHeader) {
|
|||
tfree(s);
|
||||
|
||||
pDFile->pFile = taosOpenFile(TSDB_FILE_FULL_NAME(pDFile), TD_FILE_CTEATE | TD_FILE_WRITE | TD_FILE_TRUNC);
|
||||
if (pDFile->pFile < 0) {
|
||||
if (pDFile->pFile == NULL) {
|
||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ WriterCtx* writerCtxCreate(WriterType type, const char* path, bool readOnly, int
|
|||
#endif
|
||||
}
|
||||
memcpy(ctx->file.buf, path, strlen(path));
|
||||
if (ctx->file.pFile < 0) {
|
||||
if (ctx->file.pFile == NULL) {
|
||||
indexError("failed to open file, error %d", errno);
|
||||
goto END;
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ static int tdbEnvDestroy(TENV *pEnv) {
|
|||
|
||||
int tdbEnvBeginTxn(TENV *pEnv) {
|
||||
pEnv->jpFile = taosOpenFile(pEnv->jname, TD_FILE_CTEATE | TD_FILE_WRITE | TD_FILE_READ);
|
||||
if (pEnv->jpFile < 0) {
|
||||
if (pEnv->jpFile == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ int pgFileOpen(SPgFile **ppPgFile, const char *fname, TENV *pEnv) {
|
|||
|
||||
int pgFileClose(SPgFile *pPgFile) {
|
||||
if (pPgFile) {
|
||||
if (pPgFile->pFile >= 0) {
|
||||
if (pPgFile->pFile != NULL) {
|
||||
taosCloseFile(&pPgFile->pFile);
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ void processShellMsg() {
|
|||
for (int i = 0; i < numOfMsgs; ++i) {
|
||||
taosGetQitem(qall, (void **)&pRpcMsg);
|
||||
|
||||
if (pDataFile >= 0) {
|
||||
if (pDataFile != NULL) {
|
||||
if (taosWriteFile(pDataFile, pRpcMsg->pCont, pRpcMsg->contLen) < 0) {
|
||||
tInfo("failed to write data file, reason:%s", strerror(errno));
|
||||
}
|
||||
|
|
|
@ -58,13 +58,13 @@ int walSetWrite(SWal* pWal) {
|
|||
char fnameStr[WAL_FILE_LEN];
|
||||
walBuildIdxName(pWal, fileFirstVer, fnameStr);
|
||||
pIdxTFile = taosOpenFile(fnameStr, TD_FILE_CTEATE | TD_FILE_WRITE | TD_FILE_APPEND);
|
||||
if (pIdxTFile < 0) {
|
||||
if (pIdxTFile == NULL) {
|
||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||
return -1;
|
||||
}
|
||||
walBuildLogName(pWal, fileFirstVer, fnameStr);
|
||||
pLogTFile = taosOpenFile(fnameStr, TD_FILE_CTEATE | TD_FILE_WRITE | TD_FILE_APPEND);
|
||||
if (pLogTFile < 0) {
|
||||
if (pLogTFile == NULL) {
|
||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||
return -1;
|
||||
}
|
||||
|
@ -104,14 +104,14 @@ int walChangeWrite(SWal* pWal, int64_t ver) {
|
|||
int64_t fileFirstVer = pFileInfo->firstVer;
|
||||
walBuildIdxName(pWal, fileFirstVer, fnameStr);
|
||||
pIdxTFile = taosOpenFile(fnameStr, TD_FILE_CTEATE | TD_FILE_WRITE | TD_FILE_APPEND);
|
||||
if (pIdxTFile < 0) {
|
||||
if (pIdxTFile == NULL) {
|
||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||
pWal->pWriteIdxTFile = NULL;
|
||||
return -1;
|
||||
}
|
||||
walBuildLogName(pWal, fileFirstVer, fnameStr);
|
||||
pLogTFile = taosOpenFile(fnameStr, TD_FILE_CTEATE | TD_FILE_WRITE | TD_FILE_APPEND);
|
||||
if (pLogTFile < 0) {
|
||||
if (pLogTFile == NULL) {
|
||||
taosCloseFile(&pIdxTFile);
|
||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||
pWal->pWriteLogTFile = NULL;
|
||||
|
|
|
@ -89,7 +89,7 @@ int32_t walRollback(SWal *pWal, int64_t ver) {
|
|||
|
||||
walBuildLogName(pWal, walGetCurFileFirstVer(pWal), fnameStr);
|
||||
TdFilePtr pLogTFile = taosOpenFile(fnameStr, TD_FILE_WRITE | TD_FILE_READ);
|
||||
if (pLogTFile < 0) {
|
||||
if (pLogTFile == NULL) {
|
||||
// TODO
|
||||
pthread_mutex_unlock(&pWal->mutex);
|
||||
return -1;
|
||||
|
@ -221,13 +221,13 @@ int walRoll(SWal *pWal) {
|
|||
char fnameStr[WAL_FILE_LEN];
|
||||
walBuildIdxName(pWal, newFileFirstVersion, fnameStr);
|
||||
pIdxTFile = taosOpenFile(fnameStr, TD_FILE_CTEATE | TD_FILE_WRITE | TD_FILE_APPEND);
|
||||
if (pIdxTFile < 0) {
|
||||
if (pIdxTFile == NULL) {
|
||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||
return -1;
|
||||
}
|
||||
walBuildLogName(pWal, newFileFirstVersion, fnameStr);
|
||||
pLogTFile = taosOpenFile(fnameStr, TD_FILE_CTEATE | TD_FILE_WRITE | TD_FILE_APPEND);
|
||||
if (pLogTFile < 0) {
|
||||
if (pLogTFile == NULL) {
|
||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -416,7 +416,7 @@ void taosPrintLog(const char *flags, int32_t dflag, const char *format, ...) {
|
|||
buffer[len++] = '\n';
|
||||
buffer[len] = 0;
|
||||
|
||||
if ((dflag & DEBUG_FILE) && tsLogObj.logHandle && tsLogObj.logHandle->pFile >= 0) {
|
||||
if ((dflag & DEBUG_FILE) && tsLogObj.logHandle && tsLogObj.logHandle->pFile != NULL) {
|
||||
if (tsAsyncLog) {
|
||||
taosPushLogBuffer(tsLogObj.logHandle, buffer, len);
|
||||
} else {
|
||||
|
@ -483,7 +483,7 @@ void taosPrintLongString(const char *flags, int32_t dflag, const char *format, .
|
|||
buffer[len++] = '\n';
|
||||
buffer[len] = 0;
|
||||
|
||||
if ((dflag & DEBUG_FILE) && tsLogObj.logHandle && tsLogObj.logHandle->pFile >= 0) {
|
||||
if ((dflag & DEBUG_FILE) && tsLogObj.logHandle && tsLogObj.logHandle->pFile != NULL) {
|
||||
if (tsAsyncLog) {
|
||||
taosPushLogBuffer(tsLogObj.logHandle, buffer, len);
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue