diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h index 90f1bd9b8e..7c82b08e3c 100644 --- a/source/dnode/mnode/impl/inc/mndDef.h +++ b/source/dnode/mnode/impl/inc/mndDef.h @@ -205,7 +205,7 @@ typedef struct { typedef struct { int64_t id; - char name[TSDB_CLUSTER_ID_LEN]; + char nameX[TSDB_CLUSTER_ID_LEN]; int64_t createdTime; int64_t updateTime; int32_t upTime; diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index 4f5ca8d789..0803040211 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -385,13 +385,21 @@ static void taosReserveOldLog(char *oldName, char *keepName) { static void taosKeepOldLog(char *oldName) { if (oldName[0] != 0) { - char compressFileName[PATH_MAX + 20]; - snprintf(compressFileName, PATH_MAX + 20, "%s.gz", oldName); - if (taosCompressFile(oldName, compressFileName) == 0) { - int32_t code = taosRemoveFile(oldName); - if (code != 0) { - TAOS_UNUSED(printf("failed to remove file:%s, reason:%s\n", oldName, tstrerror(code))); - } + int32_t code = 0, lino = 0; + TdFilePtr oldFile = NULL; + if ((oldFile = taosOpenFile(oldName, TD_FILE_READ))) { + TAOS_CHECK_GOTO(taosLockFile(oldFile), &lino, _exit2); + char compressFileName[PATH_MAX + 20]; + snprintf(compressFileName, PATH_MAX + 20, "%s.gz", oldName); + TAOS_CHECK_GOTO(taosCompressFile(oldName, compressFileName), &lino, _exit1); + TAOS_CHECK_GOTO(taosRemoveFile(oldName), &lino, _exit1); + } + _exit1: + TAOS_UNUSED(taosUnLockFile(oldFile)); + _exit2: + TAOS_UNUSED(taosCloseFile(&oldFile)); + if (code != 0) { + uWarn("failed at line %d to keep old log file:%s, reason:%s\n", oldName, lino, tstrerror(code)); } } } @@ -1041,7 +1049,7 @@ static void taosWriteLog(SLogBuff *pLogBuf) { } #define LOG_ROTATE_INTERVAL 3600 -#if !defined(TD_ENTERPRISE) || defined(ASSERT_NOT_CORE) +#if !defined(TD_ENTERPRISE) || defined(ASSERT_NOT_CORE) || defined(GRANTS_CFG) #define LOG_INACTIVE_TIME 7200 #define LOG_ROTATE_BOOT 900 #else