fix: fix log not compressed when logKeepDays set to positive value

This commit is contained in:
Ganlin Zhao 2023-05-25 14:13:34 +08:00
parent 70c18d44a2
commit a57da3bdf7
1 changed files with 7 additions and 7 deletions

View File

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