diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a2600785c35a80d040b9f91137c630d7761cef7e..3fde9ab87e519ffe47470be7599e184846044bde 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,6 +5,7 @@ PROJECT(TDengine) ADD_SUBDIRECTORY(os) ADD_SUBDIRECTORY(common) ADD_SUBDIRECTORY(util) +ADD_SUBDIRECTORY(tfs) ADD_SUBDIRECTORY(rpc) ADD_SUBDIRECTORY(client) ADD_SUBDIRECTORY(query) diff --git a/src/inc/taoserror.h b/src/inc/taoserror.h index b99bf2df2a2a6d2d8daa1b7043ff2863976bfcee..082d3a7c4850b8d2f8670f0950df24b4b6100d29 100644 --- a/src/inc/taoserror.h +++ b/src/inc/taoserror.h @@ -391,11 +391,11 @@ TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_CONV_SRC_GENERAL, 0, 0x2115, "src genera // tfs TAOS_DEFINE_ERROR(TSDB_CODE_FS_OUT_OF_MEMORY, 0, 0x2200, "tfs out of memory") -TAOS_DEFINE_ERROR(TSDB_CODE_FS_INVLD_CFG 0, 0x2201, "tfs invalid mount config") -TAOS_DEFINE_ERROR(TSDB_CODE_FS_TOO_MANY_MOUNT 0, 0x2202, "tfs too many mount") -TAOS_DEFINE_ERROR(TSDB_CODE_FS_DUP_PRIMARY 0, 0x2203, "tfs duplicate primary mount") -TAOS_DEFINE_ERROR(TSDB_CODE_FS_NO_PRIMARY_DISK 0, 0x2204, "tfs no primary mount") -TAOS_DEFINE_ERROR(TSDB_CODE_FS_NO_MOUNT_AT_TIER 0, 0x2205, "tfs no mount at tier") +TAOS_DEFINE_ERROR(TSDB_CODE_FS_INVLD_CFG, 0, 0x2201, "tfs invalid mount config") +TAOS_DEFINE_ERROR(TSDB_CODE_FS_TOO_MANY_MOUNT, 0, 0x2202, "tfs too many mount") +TAOS_DEFINE_ERROR(TSDB_CODE_FS_DUP_PRIMARY, 0, 0x2203, "tfs duplicate primary mount") +TAOS_DEFINE_ERROR(TSDB_CODE_FS_NO_PRIMARY_DISK, 0, 0x2204, "tfs no primary mount") +TAOS_DEFINE_ERROR(TSDB_CODE_FS_NO_MOUNT_AT_TIER, 0, 0x2205, "tfs no mount at tier") #ifdef TAOS_ERROR_C diff --git a/src/inc/tfs.h b/src/inc/tfs.h index 94ec143a8c43d1fb9da794f6074b12eb032be682..40b38b32d59ae45778d157542ae6083f81c27601 100644 --- a/src/inc/tfs.h +++ b/src/inc/tfs.h @@ -44,13 +44,13 @@ TFSDIR * tfsOpenDir(char *dir); void tfsCloseDir(TFSDIR *tdir); const TFSFILE *tfsReadDir(TFSDIR *tdir); -const char *tfsAbsName(TFSFILE *pfile, char dest[]); -const char *tfsRelName(TFSFILE *pfile, char dest[]); +const char *tfsAbsName(TFSFILE *pfile); +const char *tfsRelName(TFSFILE *pfile); void tfsDirName(TFSFILE *pfile, char dest[]); void tfsBaseName(TFSFILE *pfile, char dest[]); int tfsopen(TFSFILE *pfile); -int tfsclose(int, fd); +int tfsclose(int fd); TFSFILE *tfsCreateFiles(int level, int nfile, ...); int tfsRemoveFiles(int nfile, ...); diff --git a/src/tfs/CMakeLists.txt b/src/tfs/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..b435c84366fb47bd137b1c13bc98eab625bbcc66 --- /dev/null +++ b/src/tfs/CMakeLists.txt @@ -0,0 +1,12 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8) +PROJECT(TDengine) + +INCLUDE_DIRECTORIES(inc) +AUX_SOURCE_DIRECTORY(src SRC) +ADD_LIBRARY(tfs ${SRC}) +TARGET_LINK_LIBRARIES(tfs tutil) + +IF (TD_LINUX) + # Someone has no gtest directory, so comment it + # ADD_SUBDIRECTORY(tests) +ENDIF () diff --git a/src/tfs/src/tfcntl.c b/src/tfs/src/tfcntl.c index e15f49ba8f621132d34afe4c39270156704ddf66..ee85ed4dc87bac6094cc72e8a2126feacc04652e 100644 --- a/src/tfs/src/tfcntl.c +++ b/src/tfs/src/tfcntl.c @@ -91,8 +91,8 @@ const TFSFILE *tfsReadDir(TFSDIR *tdir) { } } -const char *tfsAbsName(TFSFILE *pfile, char dest[]) { return pfile->aname; } -const char *tfsRelName(TFSFILE *pfile, char dest[]) { return pfile->rname; } +const char *tfsAbsName(TFSFILE *pfile) { return pfile->aname; } +const char *tfsRelName(TFSFILE *pfile) { return pfile->rname; } void tfsDirName(TFSFILE *pfile, char dest[]) { char fname[TSDB_FILENAME_LEN] = "\0"; diff --git a/src/tsdb/CMakeLists.txt b/src/tsdb/CMakeLists.txt index d86b104f234a7e39bd67f728370e188c965cf42a..31d52aae7d4a809044ab01a7b561801d1ad0c2eb 100644 --- a/src/tsdb/CMakeLists.txt +++ b/src/tsdb/CMakeLists.txt @@ -4,7 +4,7 @@ PROJECT(TDengine) INCLUDE_DIRECTORIES(inc) AUX_SOURCE_DIRECTORY(src SRC) ADD_LIBRARY(tsdb ${SRC}) -TARGET_LINK_LIBRARIES(tsdb common tutil) +TARGET_LINK_LIBRARIES(tsdb tfs common tutil) IF (TD_LINUX) # Someone has no gtest directory, so comment it diff --git a/src/tsdb/inc/tsdbMain.h b/src/tsdb/inc/tsdbMain.h index 78e269c046cd0a2d053f3bba43c4fe262b2106a4..bc6b3a2517a2e69702f8789a730b72e632989e95 100644 --- a/src/tsdb/inc/tsdbMain.h +++ b/src/tsdb/inc/tsdbMain.h @@ -189,9 +189,9 @@ typedef struct { } STsdbFileInfo; typedef struct { - int fd; - TFSFILE file; + TFSFILE* file; STsdbFileInfo info; + int fd; } SFile; typedef struct { @@ -215,6 +215,8 @@ typedef struct { int index; } SFileGroupIter; +#define TSDB_FILE_NAME(pFile) (tfsAbsName(pFile->file)) + // ------------------ tsdbMain.c typedef struct { int32_t totalLen; @@ -592,7 +594,7 @@ static FORCE_INLINE int compTSKEY(const void* key1, const void* key2) { #define TSDB_SUBMIT_MSG_HEAD_SIZE sizeof(SSubmitMsg) char* tsdbGetMetaFileName(char* rootDir); -void tsdbGetDataFileName(char* rootDir, int vid, int fid, int type, char* fname); +void tsdbGetDataFileName(char* rootDir, int vid, int fid, int type, const char* fname); int tsdbLockRepo(STsdbRepo* pRepo); int tsdbUnlockRepo(STsdbRepo* pRepo); char* tsdbGetDataDirName(char* rootDir); diff --git a/src/tsdb/src/tsdbFile.c b/src/tsdb/src/tsdbFile.c index c81a178acc4c8703f63ca64dfbc10dcbc2276325..922d0d93ed6706b5e5ea70d816e8566bd5c7e5bb 100644 --- a/src/tsdb/src/tsdbFile.c +++ b/src/tsdb/src/tsdbFile.c @@ -242,21 +242,21 @@ SFileGroup *tsdbGetFileGroupNext(SFileGroupIter *pIter) { int tsdbOpenFile(SFile *pFile, int oflag) { ASSERT(!TSDB_IS_FILE_OPENED(pFile)); - pFile->fd = open(pFile->fname, oflag, 0755); + pFile->fd = open(TSDB_FILE_NAME(pFile), oflag, 0755); if (pFile->fd < 0) { - tsdbError("failed to open file %s since %s", pFile->fname, strerror(errno)); + tsdbError("failed to open file %s since %s", TSDB_FILE_NAME(pFile), strerror(errno)); terrno = TAOS_SYSTEM_ERROR(errno); return -1; } - tsdbTrace("open file %s, fd %d", pFile->fname, pFile->fd); + tsdbTrace("open file %s, fd %d", TSDB_FILE_NAME(pFile), pFile->fd); return 0; } void tsdbCloseFile(SFile *pFile) { if (TSDB_IS_FILE_OPENED(pFile)) { - tsdbTrace("close file %s, fd %d", pFile->fname, pFile->fd); + tsdbTrace("close file %s, fd %d", TSDB_FILE_NAME(pFile), pFile->fd); close(pFile->fd); pFile->fd = -1; } @@ -266,10 +266,10 @@ int tsdbCreateFile(SFile *pFile, STsdbRepo *pRepo, int fid, int type, SDisk *pDi memset((void *)pFile, 0, sizeof(SFile)); pFile->fd = -1; - tsdbGetDataFileName(pRepo->rootDir, REPO_ID(pRepo), fid, type, pFile->fname); + tsdbGetDataFileName(pRepo->rootDir, REPO_ID(pRepo), fid, type, TSDB_FILE_NAME(pFile)); - if (access(pFile->fname, F_OK) == 0) { - tsdbError("vgId:%d file %s already exists", REPO_ID(pRepo), pFile->fname); + if (access(TSDB_FILE_NAME(pFile), F_OK) == 0) { + tsdbError("vgId:%d file %s already exists", REPO_ID(pRepo), TSDB_FILE_NAME(pFile)); terrno = TSDB_CODE_TDB_FILE_ALREADY_EXISTS; goto _err; } @@ -324,12 +324,12 @@ int tsdbUpdateFileHeader(SFile *pFile) { taosCalcChecksumAppend(0, (uint8_t *)buf, TSDB_FILE_HEAD_SIZE); if (lseek(pFile->fd, 0, SEEK_SET) < 0) { - tsdbError("failed to lseek file %s since %s", pFile->fname, strerror(errno)); + tsdbError("failed to lseek file %s since %s", TSDB_FILE_NAME(pFile), strerror(errno)); terrno = TAOS_SYSTEM_ERROR(errno); return -1; } if (taosWrite(pFile->fd, (void *)buf, TSDB_FILE_HEAD_SIZE) < TSDB_FILE_HEAD_SIZE) { - tsdbError("failed to write %d bytes to file %s since %s", TSDB_FILE_HEAD_SIZE, pFile->fname, strerror(errno)); + tsdbError("failed to write %d bytes to file %s since %s", TSDB_FILE_HEAD_SIZE, TSDB_FILE_NAME(pFile), strerror(errno)); terrno = TAOS_SYSTEM_ERROR(errno); return -1; } @@ -384,20 +384,20 @@ int tsdbLoadFileHeader(SFile *pFile, uint32_t *version) { char buf[TSDB_FILE_HEAD_SIZE] = "\0"; if (lseek(pFile->fd, 0, SEEK_SET) < 0) { - tsdbError("failed to lseek file %s to start since %s", pFile->fname, strerror(errno)); + tsdbError("failed to lseek file %s to start since %s", TSDB_FILE_NAME(pFile), strerror(errno)); terrno = TAOS_SYSTEM_ERROR(errno); return -1; } if (taosRead(pFile->fd, buf, TSDB_FILE_HEAD_SIZE) < TSDB_FILE_HEAD_SIZE) { - tsdbError("failed to read file %s header part with %d bytes, reason:%s", pFile->fname, TSDB_FILE_HEAD_SIZE, + tsdbError("failed to read file %s header part with %d bytes, reason:%s", TSDB_FILE_NAME(pFile), TSDB_FILE_HEAD_SIZE, strerror(errno)); terrno = TSDB_CODE_TDB_FILE_CORRUPTED; return -1; } if (!taosCheckChecksumWhole((uint8_t *)buf, TSDB_FILE_HEAD_SIZE)) { - tsdbError("file %s header part is corrupted with failed checksum", pFile->fname); + tsdbError("file %s header part is corrupted with failed checksum", TSDB_FILE_NAME(pFile)); terrno = TSDB_CODE_TDB_FILE_CORRUPTED; return -1; } @@ -414,7 +414,7 @@ void tsdbGetFileInfoImpl(char *fname, uint32_t *magic, int64_t *size) { SFile file; SFile * pFile = &file; - strncpy(pFile->fname, fname, TSDB_FILENAME_LEN - 1); + strncpy(TSDB_FILE_NAME(pFile), fname, TSDB_FILENAME_LEN - 1); pFile->fd = -1; if (tsdbOpenFile(pFile, O_RDONLY) < 0) goto _err; @@ -627,8 +627,8 @@ static int keyFGroupCompFunc(const void *key, const void *fgroup) { // tdGetTsdbRootDir(pDisk->dir, REPO_ID(pRepo), tsdbRootDir); // for (int type = 0; type < TSDB_FILE_TYPE_MAX; type++) { // SFile *pFile = pFileGroup->files + type; -// tsdbGetDataFileName(tsdbRootDir, REPO_ID(pRepo), fid, TSDB_FILE_TYPE_HEAD, pFile->fname); -// if (access(pFile->fname, F_OK) != 0) { +// tsdbGetDataFileName(tsdbRootDir, REPO_ID(pRepo), fid, TSDB_FILE_TYPE_HEAD, TSDB_FILE_NAME(pFile)); +// if (access(TSDB_FILE_NAME(pFile), F_OK) != 0) { // memset(&(pFile->info), 0, sizeof(pFile->info)); // pFile->info.magic = TSDB_FILE_INIT_MAGIC; // pFileGroup->state = 1; @@ -681,7 +681,7 @@ static int keyFGroupCompFunc(const void *key, const void *fgroup) { // if (version != TSDB_FILE_VERSION) { // tsdbError("vgId:%d file %s version %u is not the same as program version %u which may cause problem", -// REPO_ID(pRepo), pFile->fname, version, TSDB_FILE_VERSION); +// REPO_ID(pRepo), TSDB_FILE_NAME(pFile), version, TSDB_FILE_VERSION); // } // tsdbCloseFile(pFile); diff --git a/src/tsdb/src/tsdbMain.c b/src/tsdb/src/tsdbMain.c index 3990c0c516d1768135934b098efbcd7746ab424c..8a7fba4bff915285ca3cb1488c408c2ee5051f84 100644 --- a/src/tsdb/src/tsdbMain.c +++ b/src/tsdb/src/tsdbMain.c @@ -317,7 +317,7 @@ char *tsdbGetMetaFileName(char *rootDir) { return fname; } -void tsdbGetDataFileName(char *rootDir, int vid, int fid, int type, char *fname) { +void tsdbGetDataFileName(char *rootDir, int vid, int fid, int type, const char *fname) { snprintf(fname, TSDB_FILENAME_LEN, "%s/%s/v%df%d%s", rootDir, TSDB_DATA_DIR_NAME, vid, fid, tsdbFileSuffix[type]); } diff --git a/src/tsdb/src/tsdbRWHelper.c b/src/tsdb/src/tsdbRWHelper.c index f91f59c81dfcbe290ad0f373203afc772fdec0ef..7aa265d427e6c1a4bae16b8b8dad0678293eac20 100644 --- a/src/tsdb/src/tsdbRWHelper.c +++ b/src/tsdb/src/tsdbRWHelper.c @@ -198,7 +198,7 @@ int tsdbCloseHelperFile(SRWHelper *pHelper, bool hasError, SFileGroup *pGroup) { fsync(pFile->fd); } tsdbCloseFile(pFile); - if (hasError) (void)remove(pFile->fname); + if (hasError) (void)remove(TSDB_FILE_NAME(pFile)); } pFile = helperNewLastF(pHelper); @@ -208,7 +208,7 @@ int tsdbCloseHelperFile(SRWHelper *pHelper, bool hasError, SFileGroup *pGroup) { fsync(pFile->fd); } tsdbCloseFile(pFile); - if (hasError) (void)remove(pFile->fname); + if (hasError) (void)remove(TSDB_FILE_NAME(pFile)); } } return 0; @@ -376,7 +376,7 @@ int tsdbWriteCompInfo(SRWHelper *pHelper) { pFile->info.magic, (uint8_t *)POINTER_SHIFT(pHelper->pCompInfo, pIdx->len - sizeof(TSCKSUM)), sizeof(TSCKSUM)); offset = lseek(pFile->fd, 0, SEEK_END); if (offset < 0) { - tsdbError("vgId:%d failed to lseek file %s since %s", REPO_ID(pHelper->pRepo), pFile->fname, strerror(errno)); + tsdbError("vgId:%d failed to lseek file %s since %s", REPO_ID(pHelper->pRepo), TSDB_FILE_NAME(pFile), strerror(errno)); terrno = TAOS_SYSTEM_ERROR(errno); return -1; } @@ -387,7 +387,7 @@ int tsdbWriteCompInfo(SRWHelper *pHelper) { if (taosWrite(pFile->fd, (void *)(pHelper->pCompInfo), pIdx->len) < (int)pIdx->len) { tsdbError("vgId:%d failed to write %d bytes to file %s since %s", REPO_ID(pHelper->pRepo), pIdx->len, - pFile->fname, strerror(errno)); + TSDB_FILE_NAME(pFile), strerror(errno)); terrno = TAOS_SYSTEM_ERROR(errno); return -1; } @@ -430,7 +430,7 @@ int tsdbWriteCompIdx(SRWHelper *pHelper) { offset = lseek(pFile->fd, 0, SEEK_END); if (offset < 0) { - tsdbError("vgId:%d failed to lseek file %s since %s", REPO_ID(pHelper->pRepo), pFile->fname, strerror(errno)); + tsdbError("vgId:%d failed to lseek file %s since %s", REPO_ID(pHelper->pRepo), TSDB_FILE_NAME(pFile), strerror(errno)); terrno = TAOS_SYSTEM_ERROR(errno); return -1; } @@ -439,7 +439,7 @@ int tsdbWriteCompIdx(SRWHelper *pHelper) { if (taosWrite(pFile->fd, (void *)pHelper->pWIdx, pFile->info.len) < (int)pFile->info.len) { tsdbError("vgId:%d failed to write %d bytes to file %s since %s", REPO_ID(pHelper->pRepo), pFile->info.len, - pFile->fname, strerror(errno)); + TSDB_FILE_NAME(pFile), strerror(errno)); terrno = TAOS_SYSTEM_ERROR(errno); return -1; } @@ -454,20 +454,20 @@ int tsdbWriteCompIdx(SRWHelper *pHelper) { int tsdbLoadCompIdxImpl(SFile *pFile, uint32_t offset, uint32_t len, void *buffer) { const char *prefixMsg = "failed to load SCompIdx part"; if (lseek(pFile->fd, offset, SEEK_SET) < 0) { - tsdbError("%s: seek to file %s offset %u failed since %s", prefixMsg, pFile->fname, offset, strerror(errno)); + tsdbError("%s: seek to file %s offset %u failed since %s", prefixMsg, TSDB_FILE_NAME(pFile), offset, strerror(errno)); terrno = TAOS_SYSTEM_ERROR(errno); return -1; } if (taosRead(pFile->fd, buffer, len) < len) { - tsdbError("%s: read file %s offset %u len %u failed since %s", prefixMsg, pFile->fname, offset, len, + tsdbError("%s: read file %s offset %u len %u failed since %s", prefixMsg, TSDB_FILE_NAME(pFile), offset, len, strerror(errno)); terrno = TSDB_CODE_TDB_FILE_CORRUPTED; return -1; } if (!taosCheckChecksumWhole((uint8_t *)buffer, len)) { - tsdbError("%s: file %s corrupted, offset %u len %u", prefixMsg, pFile->fname, offset, len); + tsdbError("%s: file %s corrupted, offset %u len %u", prefixMsg, TSDB_FILE_NAME(pFile), offset, len); terrno = TSDB_CODE_TDB_FILE_CORRUPTED; return -1; } @@ -526,7 +526,7 @@ int tsdbLoadCompIdx(SRWHelper *pHelper, void *target) { // Decode the SCompIdx part if (tsdbDecodeSCompIdxImpl(pHelper->pBuffer, pFile->info.len, &(pHelper->idxH.pIdxArray), &(pHelper->idxH.numOfIdx)) < 0) { - tsdbError("vgId:%d failed to decode SCompIdx part from file %s since %s", REPO_ID(pHelper->pRepo), pFile->fname, + tsdbError("vgId:%d failed to decode SCompIdx part from file %s since %s", REPO_ID(pHelper->pRepo), TSDB_FILE_NAME(pFile), tstrerror(errno)); return -1; } @@ -545,7 +545,7 @@ int tsdbLoadCompInfoImpl(SFile *pFile, SCompIdx *pIdx, SCompInfo **ppCompInfo) { const char *prefixMsg = "failed to load SCompInfo/SCompBlock part"; if (lseek(pFile->fd, pIdx->offset, SEEK_SET) < 0) { - tsdbError("%s: seek to file %s offset %u failed since %s", prefixMsg, pFile->fname, pIdx->offset, strerror(errno)); + tsdbError("%s: seek to file %s offset %u failed since %s", prefixMsg, TSDB_FILE_NAME(pFile), pIdx->offset, strerror(errno)); terrno = TAOS_SYSTEM_ERROR(errno); return -1; } @@ -557,14 +557,14 @@ int tsdbLoadCompInfoImpl(SFile *pFile, SCompIdx *pIdx, SCompInfo **ppCompInfo) { } if (taosRead(pFile->fd, (void *)(*ppCompInfo), pIdx->len) < (int)pIdx->len) { - tsdbError("%s: read file %s offset %u len %u failed since %s", prefixMsg, pFile->fname, pIdx->offset, pIdx->len, + tsdbError("%s: read file %s offset %u len %u failed since %s", prefixMsg, TSDB_FILE_NAME(pFile), pIdx->offset, pIdx->len, strerror(errno)); terrno = TAOS_SYSTEM_ERROR(errno); return -1; } if (!taosCheckChecksumWhole((uint8_t *)(*ppCompInfo), pIdx->len)) { - tsdbError("%s: file %s corrupted, offset %u len %u", prefixMsg, pFile->fname, pIdx->offset, pIdx->len); + tsdbError("%s: file %s corrupted, offset %u len %u", prefixMsg, TSDB_FILE_NAME(pFile), pIdx->offset, pIdx->len); terrno = TSDB_CODE_TDB_FILE_CORRUPTED; return -1; } @@ -601,7 +601,7 @@ int tsdbLoadCompData(SRWHelper *pHelper, SCompBlock *pCompBlock, void *target) { SFile *pFile = (pCompBlock->last) ? helperLastF(pHelper) : helperDataF(pHelper); if (lseek(pFile->fd, (off_t)pCompBlock->offset, SEEK_SET) < 0) { - tsdbError("vgId:%d failed to lseek file %s since %s", REPO_ID(pHelper->pRepo), pFile->fname, strerror(errno)); + tsdbError("vgId:%d failed to lseek file %s since %s", REPO_ID(pHelper->pRepo), TSDB_FILE_NAME(pFile), strerror(errno)); terrno = TAOS_SYSTEM_ERROR(errno); return -1; } @@ -614,14 +614,14 @@ int tsdbLoadCompData(SRWHelper *pHelper, SCompBlock *pCompBlock, void *target) { } if (taosRead(pFile->fd, (void *)pHelper->pCompData, tsize) < tsize) { - tsdbError("vgId:%d failed to read %" PRIzu " bytes from file %s since %s", REPO_ID(pHelper->pRepo), tsize, pFile->fname, + tsdbError("vgId:%d failed to read %" PRIzu " bytes from file %s since %s", REPO_ID(pHelper->pRepo), tsize, TSDB_FILE_NAME(pFile), strerror(errno)); terrno = TAOS_SYSTEM_ERROR(errno); return -1; } if (!taosCheckChecksumWhole((uint8_t *)pHelper->pCompData, (uint32_t)tsize)) { - tsdbError("vgId:%d file %s is broken, offset %" PRId64 " size %" PRIzu "", REPO_ID(pHelper->pRepo), pFile->fname, + tsdbError("vgId:%d file %s is broken, offset %" PRId64 " size %" PRIzu "", REPO_ID(pHelper->pRepo), TSDB_FILE_NAME(pFile), (int64_t)pCompBlock->offset, tsize); terrno = TSDB_CODE_TDB_FILE_CORRUPTED; return -1; @@ -736,7 +736,7 @@ static int tsdbWriteBlockToFile(SRWHelper *pHelper, SFile *pFile, SDataCols *pDa offset = lseek(pFile->fd, 0, SEEK_END); if (offset < 0) { - tsdbError("vgId:%d failed to write block to file %s since %s", REPO_ID(pHelper->pRepo), pFile->fname, + tsdbError("vgId:%d failed to write block to file %s since %s", REPO_ID(pHelper->pRepo), TSDB_FILE_NAME(pFile), strerror(errno)); terrno = TAOS_SYSTEM_ERROR(errno); goto _err; @@ -829,7 +829,7 @@ static int tsdbWriteBlockToFile(SRWHelper *pHelper, SFile *pFile, SDataCols *pDa // Write the whole block to file if (taosWrite(pFile->fd, (void *)pCompData, lsize) < lsize) { - tsdbError("vgId:%d failed to write %d bytes to file %s since %s", REPO_ID(helperRepo(pHelper)), lsize, pFile->fname, + tsdbError("vgId:%d failed to write %d bytes to file %s since %s", REPO_ID(helperRepo(pHelper)), lsize, TSDB_FILE_NAME(pFile), strerror(errno)); terrno = TAOS_SYSTEM_ERROR(errno); goto _err; @@ -849,7 +849,7 @@ static int tsdbWriteBlockToFile(SRWHelper *pHelper, SFile *pFile, SDataCols *pDa tsdbDebug("vgId:%d tid:%d a block of data is written to file %s, offset %" PRId64 " numOfRows %d len %d numOfCols %" PRId16 " keyFirst %" PRId64 " keyLast %" PRId64, - REPO_ID(helperRepo(pHelper)), pHelper->tableInfo.tid, pFile->fname, (int64_t)(pCompBlock->offset), + REPO_ID(helperRepo(pHelper)), pHelper->tableInfo.tid, TSDB_FILE_NAME(pFile), (int64_t)(pCompBlock->offset), (int)(pCompBlock->numOfRows), pCompBlock->len, pCompBlock->numOfCols, pCompBlock->keyFirst, pCompBlock->keyLast); @@ -1249,13 +1249,13 @@ static int tsdbLoadColData(SRWHelper *pHelper, SFile *pFile, SCompBlock *pCompBl int64_t offset = pCompBlock->offset + TSDB_GET_COMPCOL_LEN(pCompBlock->numOfCols) + pCompCol->offset; if (lseek(pFile->fd, (off_t)offset, SEEK_SET) < 0) { - tsdbError("vgId:%d failed to lseek file %s since %s", REPO_ID(pHelper->pRepo), pFile->fname, strerror(errno)); + tsdbError("vgId:%d failed to lseek file %s since %s", REPO_ID(pHelper->pRepo), TSDB_FILE_NAME(pFile), strerror(errno)); terrno = TAOS_SYSTEM_ERROR(errno); return -1; } if (taosRead(pFile->fd, pHelper->pBuffer, pCompCol->len) < pCompCol->len) { - tsdbError("vgId:%d failed to read %d bytes from file %s since %s", REPO_ID(pHelper->pRepo), pCompCol->len, pFile->fname, + tsdbError("vgId:%d failed to read %d bytes from file %s since %s", REPO_ID(pHelper->pRepo), pCompCol->len, TSDB_FILE_NAME(pFile), strerror(errno)); terrno = TAOS_SYSTEM_ERROR(errno); return -1; @@ -1264,7 +1264,7 @@ static int tsdbLoadColData(SRWHelper *pHelper, SFile *pFile, SCompBlock *pCompBl if (tsdbCheckAndDecodeColumnData(pDataCol, pHelper->pBuffer, pCompCol->len, pCompBlock->algorithm, pCompBlock->numOfRows, pHelper->pRepo->config.maxRowsPerFileBlock, pHelper->compBuffer, (int32_t)taosTSizeof(pHelper->compBuffer)) < 0) { - tsdbError("vgId:%d file %s is broken at column %d offset %" PRId64, REPO_ID(pHelper->pRepo), pFile->fname, + tsdbError("vgId:%d file %s is broken at column %d offset %" PRId64, REPO_ID(pHelper->pRepo), TSDB_FILE_NAME(pFile), pCompCol->colId, offset); return -1; } @@ -1365,13 +1365,13 @@ static int tsdbLoadBlockDataImpl(SRWHelper *pHelper, SCompBlock *pCompBlock, SDa int fd = pFile->fd; if (lseek(fd, (off_t)pCompBlock->offset, SEEK_SET) < 0) { tsdbError("vgId:%d tid:%d failed to lseek file %s since %s", REPO_ID(pHelper->pRepo), pHelper->tableInfo.tid, - pFile->fname, strerror(errno)); + TSDB_FILE_NAME(pFile), strerror(errno)); terrno = TAOS_SYSTEM_ERROR(errno); goto _err; } if (taosRead(fd, (void *)pCompData, pCompBlock->len) < pCompBlock->len) { tsdbError("vgId:%d failed to read %d bytes from file %s since %s", REPO_ID(pHelper->pRepo), pCompBlock->len, - pFile->fname, strerror(errno)); + TSDB_FILE_NAME(pFile), strerror(errno)); terrno = TAOS_SYSTEM_ERROR(errno); goto _err; } @@ -1379,7 +1379,7 @@ static int tsdbLoadBlockDataImpl(SRWHelper *pHelper, SCompBlock *pCompBlock, SDa int32_t tsize = TSDB_GET_COMPCOL_LEN(pCompBlock->numOfCols); if (!taosCheckChecksumWhole((uint8_t *)pCompData, tsize)) { tsdbError("vgId:%d file %s block data is corrupted offset %" PRId64 " len %d", REPO_ID(pHelper->pRepo), - pFile->fname, (int64_t)(pCompBlock->offset), pCompBlock->len); + TSDB_FILE_NAME(pFile), (int64_t)(pCompBlock->offset), pCompBlock->len); terrno = TSDB_CODE_TDB_FILE_CORRUPTED; goto _err; } @@ -1428,7 +1428,7 @@ static int tsdbLoadBlockDataImpl(SRWHelper *pHelper, SCompBlock *pCompBlock, SDa pCompBlock->numOfRows, pDataCols->maxPoints, pHelper->compBuffer, (int32_t)taosTSizeof(pHelper->compBuffer)) < 0) { tsdbError("vgId:%d file %s is broken at column %d block offset %" PRId64 " column offset %d", - REPO_ID(pHelper->pRepo), pFile->fname, tcolId, (int64_t)pCompBlock->offset, toffset); + REPO_ID(pHelper->pRepo), TSDB_FILE_NAME(pFile), tcolId, (int64_t)pCompBlock->offset, toffset); goto _err; } if (dcol != 0) ccol++;