From 76045b7874a87471d02caabc45b426582361a7b4 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Tue, 27 Aug 2024 16:36:01 +0800 Subject: [PATCH] fix:[TD-31702]avoid remove slowlog when check if log out of logkeepdays --- source/os/src/osDir.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/os/src/osDir.c b/source/os/src/osDir.c index c04add2f42..9f3908183e 100644 --- a/source/os/src/osDir.c +++ b/source/os/src/osDir.c @@ -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); }