From f1fa948594b4d85fd2fd89304271961d4aa913d9 Mon Sep 17 00:00:00 2001 From: kailixu Date: Tue, 11 Jun 2024 18:27:46 +0800 Subject: [PATCH] fix: reserve log file name --- source/util/src/tlog.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index ca809e1d5d..e2a5d39888 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -66,7 +66,7 @@ typedef struct { int32_t lines; int32_t flag; int32_t openInProgress; - int64_t lastFileSec; + int64_t lastKeepFileSec; pid_t pid; char logName[LOG_FILE_NAME_LEN]; SLogBuff *logHandle; @@ -276,10 +276,10 @@ static void taosReserveOldLog(char *oldName, char *keepName) { int32_t code = 0; int64_t fileSec = taosGetTimestampSec(); - if (tsLogObj.lastFileSec < fileSec) { - tsLogObj.lastFileSec = fileSec; + if (tsLogObj.lastKeepFileSec < fileSec) { + tsLogObj.lastKeepFileSec = fileSec; } else { - fileSec = ++tsLogObj.lastFileSec; + fileSec = ++tsLogObj.lastKeepFileSec; } snprintf(keepName, LOG_FILE_NAME_LEN + 20, "%s.%" PRId64, tsLogObj.logName, fileSec); if ((code = taosRenameFile(oldName, keepName))) {