Merge pull request #27493 from taosdata/fix/TD-31702

fix:[TD-31702]avoid remove slowlog when check if log out of logkeepdays
This commit is contained in:
Pan Wei 2024-08-28 10:00:49 +08:00 committed by GitHub
commit aa4b8192e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 1 deletions

View File

@ -294,6 +294,8 @@ void taosRemoveOldFiles(const char *dirname, int32_t keepDays) {
int32_t len = (int32_t)strlen(filename);
if (len > 3 && strcmp(filename + len - 3, ".gz") == 0) {
len -= 3;
}else{
continue;
}
int64_t fileSec = 0;
@ -308,7 +310,7 @@ void taosRemoveOldFiles(const char *dirname, int32_t keepDays) {
int32_t days = (int32_t)(TABS(sec - fileSec) / 86400 + 1);
if (days > keepDays) {
(void)taosRemoveFile(filename);
// printf("file:%s is removed, days:%d keepDays:%d", filename, days, keepDays);
uInfo("file:%s is removed, days:%d keepDays:%d, sed:%"PRId64, filename, days, keepDays, fileSec);
} else {
// printf("file:%s won't be removed, days:%d keepDays:%d", filename, days, keepDays);
}