Merge pull request #21469 from taosdata/fix/TD-24369

fix: fix log not compressed when logKeepDays set to positive value
This commit is contained in:
dapan1121 2023-05-26 10:07:43 +08:00 committed by GitHub
commit 3cf0ebe55f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 7 deletions

View File

@ -210,15 +210,15 @@ static void taosKeepOldLog(char *oldName) {
(void)taosRenameFile(oldName, fileName); (void)taosRenameFile(oldName, fileName);
if (tsLogKeepDays < 0) { char compressFileName[LOG_FILE_NAME_LEN + 20];
char compressFileName[LOG_FILE_NAME_LEN + 20]; snprintf(compressFileName, LOG_FILE_NAME_LEN + 20, "%s.%" PRId64 ".gz", tsLogObj.logName, fileSec);
snprintf(compressFileName, LOG_FILE_NAME_LEN + 20, "%s.%" PRId64 ".gz", tsLogObj.logName, fileSec); if (taosCompressFile(fileName, compressFileName) == 0) {
if (taosCompressFile(fileName, compressFileName) == 0) { (void)taosRemoveFile(fileName);
(void)taosRemoveFile(fileName);
}
} }
taosRemoveOldFiles(tsLogDir, TABS(tsLogKeepDays)); if (tsLogKeepDays > 0) {
taosRemoveOldFiles(tsLogDir, tsLogKeepDays);
}
} }
static void *taosThreadToOpenNewFile(void *param) { static void *taosThreadToOpenNewFile(void *param) {