From cafe84d1108c17c2d3938b30e8f4f25df3beaeeb Mon Sep 17 00:00:00 2001 From: dapan1121 <89396746@qq.com> Date: Thu, 25 Feb 2021 11:25:01 +0800 Subject: [PATCH] fix bug --- src/util/src/tlog.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/util/src/tlog.c b/src/util/src/tlog.c index 9bf69b46b5..933a65131b 100644 --- a/src/util/src/tlog.c +++ b/src/util/src/tlog.c @@ -30,11 +30,11 @@ #define LOG_FILE_NAME_LEN 300 #define TSDB_DEFAULT_LOG_BUF_SIZE (20 * 1024 * 1024) // 20MB -#define DEFAULT_LOG_INTERVAL 25000 -#define LOG_INTERVAL_STEP 5000 -#define MIN_LOG_INTERVAL 5000 -#define MAX_LOG_INTERVAL 25000 -#define LOG_MAX_WAIT_USEC 1000000 +#define DEFAULT_LOG_INTERVAL 25 +#define LOG_INTERVAL_STEP 5 +#define MIN_LOG_INTERVAL 5 +#define MAX_LOG_INTERVAL 25 +#define LOG_MAX_WAIT_MSEC 1000 #define LOG_BUF_BUFFER(x) ((x)->buffer) #define LOG_BUF_START(x) ((x)->buffStart) @@ -122,7 +122,7 @@ static void taosStopLog() { void taosCloseLog() { taosStopLog(); //tsem_post(&(tsLogObj.logHandle->buffNotEmpty)); - usleep(MAX_LOG_INTERVAL); + taosMsleep(MAX_LOG_INTERVAL/1000); if (taosCheckPthreadValid(tsLogObj.logHandle->asyncThread)) { pthread_join(tsLogObj.logHandle->asyncThread, NULL); } @@ -632,7 +632,7 @@ static void taosWriteLog(SLogBuff *tLogBuff) { pollSize = taosGetLogRemainSize(tLogBuff, start, end); if (pollSize < tLogBuff->minBuffSize) { lastDuration += writeInterval; - if (lastDuration < LOG_MAX_WAIT_USEC) { + if (lastDuration < LOG_MAX_WAIT_MSEC) { break; } } @@ -688,7 +688,7 @@ static void *taosAsyncOutputLog(void *param) { while (1) { //tsem_wait(&(tLogBuff->buffNotEmpty)); - usleep(writeInterval); + taosMsleep(writeInterval); // Polling the buffer taosWriteLog(tLogBuff); -- GitLab