未验证 提交 29afc80f 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #10428 from taosdata/feature/config

Feature/config
......@@ -16,17 +16,18 @@
#ifndef _TD_UTIL_COMPARE_H_
#define _TD_UTIL_COMPARE_H_
#include "os.h"
#ifdef __cplusplus
extern "C" {
#endif
#include "os.h"
#define TSDB_PATTERN_MATCH 0
#define TSDB_PATTERN_NOMATCH 1
#define TSDB_PATTERN_NOWILDCARDMATCH 2
#define TSDB_PATTERN_MATCH 0
#define TSDB_PATTERN_NOMATCH 1
#define TSDB_PATTERN_NOWILDCARDMATCH 2
#define TSDB_PATTERN_STRING_DEFAULT_LEN 100
#define TSDB_REGEX_STRING_DEFAULT_LEN 128
#define TSDB_REGEX_STRING_DEFAULT_LEN 128
#define FLT_COMPAR_TOL_FACTOR 4
#define FLT_EQUAL(_x, _y) (fabs((_x) - (_y)) <= (FLT_COMPAR_TOL_FACTOR * FLT_EPSILON))
......@@ -62,7 +63,6 @@ int32_t setChkNotInBytes8(const void *pLeft, const void *pRight);
int32_t compareChkInString(const void *pLeft, const void *pRight);
int32_t compareChkNotInString(const void *pLeft, const void *pRight);
int32_t compareInt8Val(const void *pLeft, const void *pRight);
int32_t compareInt16Val(const void *pLeft, const void *pRight);
int32_t compareInt32Val(const void *pLeft, const void *pRight);
......@@ -83,7 +83,6 @@ int32_t compareStrRegexComp(const void *pLeft, const void *pRight);
int32_t compareStrRegexCompMatch(const void *pLeft, const void *pRight);
int32_t compareStrRegexCompNMatch(const void *pLeft, const void *pRight);
int32_t compareInt8ValDesc(const void *pLeft, const void *pRight);
int32_t compareInt16ValDesc(const void *pLeft, const void *pRight);
int32_t compareInt32ValDesc(const void *pLeft, const void *pRight);
......@@ -102,7 +101,6 @@ int32_t compareLenPrefixedWStrDesc(const void *pLeft, const void *pRight);
__compar_fn_t getComparFunc(int32_t type, int32_t optr);
#ifdef __cplusplus
}
#endif
......
此差异已折叠。
......@@ -22,7 +22,6 @@
extern "C" {
#endif
extern bool tsLogInited;
extern bool tsAsyncLog;
extern int32_t tsNumOfLogLines;
extern int32_t tsLogKeepDays;
......@@ -55,7 +54,7 @@ int32_t taosInitLog(const char *logName, int32_t maxFiles);
void taosCloseLog();
void taosResetLog();
void taosSetAllDebugFlag(int32_t flag);
void taosDumpData(unsigned char *msg, int32_t len);
void taosDumpData(uint8_t *msg, int32_t len);
void taosPrintLog(const char *flags, int32_t dflag, const char *format, ...)
#ifdef __GNUC__
......@@ -69,6 +68,18 @@ void taosPrintLongString(const char *flags, int32_t dflag, const char *format, .
#endif
;
extern int8_t tscEmbeddedInUtil;
#define uFatal(...) { if (uDebugFlag & DEBUG_FATAL) { taosPrintLog("UTL FATAL", tscEmbeddedInUtil ? 255 : uDebugFlag, __VA_ARGS__); }}
#define uError(...) { if (uDebugFlag & DEBUG_ERROR) { taosPrintLog("UTL ERROR ", tscEmbeddedInUtil ? 255 : uDebugFlag, __VA_ARGS__); }}
#define uWarn(...) { if (uDebugFlag & DEBUG_WARN) { taosPrintLog("UTL WARN ", tscEmbeddedInUtil ? 255 : uDebugFlag, __VA_ARGS__); }}
#define uInfo(...) { if (uDebugFlag & DEBUG_INFO) { taosPrintLog("UTL ", tscEmbeddedInUtil ? 255 : uDebugFlag, __VA_ARGS__); }}
#define uDebug(...) { if (uDebugFlag & DEBUG_DEBUG) { taosPrintLog("UTL ", uDebugFlag, __VA_ARGS__); }}
#define uTrace(...) { if (uDebugFlag & DEBUG_TRACE) { taosPrintLog("UTL ", uDebugFlag, __VA_ARGS__); }}
#define pError(...) { taosPrintLog("APP ERROR ", 255, __VA_ARGS__); }
#define pPrint(...) { taosPrintLog("APP ", 255, __VA_ARGS__); }
#ifdef __cplusplus
}
#endif
......
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_UTIL_ULOG_H
#define _TD_UTIL_ULOG_H
#ifdef __cplusplus
extern "C" {
#endif
#include "os.h"
#include "tlog.h"
extern int32_t uDebugFlag;
extern int8_t tscEmbeddedInUtil;
#define uFatal(...) { if (uDebugFlag & DEBUG_FATAL) { taosPrintLog("UTL FATAL", tscEmbeddedInUtil ? 255 : uDebugFlag, __VA_ARGS__); }}
#define uError(...) { if (uDebugFlag & DEBUG_ERROR) { taosPrintLog("UTL ERROR ", tscEmbeddedInUtil ? 255 : uDebugFlag, __VA_ARGS__); }}
#define uWarn(...) { if (uDebugFlag & DEBUG_WARN) { taosPrintLog("UTL WARN ", tscEmbeddedInUtil ? 255 : uDebugFlag, __VA_ARGS__); }}
#define uInfo(...) { if (uDebugFlag & DEBUG_INFO) { taosPrintLog("UTL ", tscEmbeddedInUtil ? 255 : uDebugFlag, __VA_ARGS__); }}
#define uDebug(...) { if (uDebugFlag & DEBUG_DEBUG) { taosPrintLog("UTL ", uDebugFlag, __VA_ARGS__); }}
#define uTrace(...) { if (uDebugFlag & DEBUG_TRACE) { taosPrintLog("UTL ", uDebugFlag, __VA_ARGS__); }}
#define pError(...) { taosPrintLog("APP ERROR ", 255, __VA_ARGS__); }
#define pPrint(...) { taosPrintLog("APP ", 255, __VA_ARGS__); }
#ifdef __cplusplus
}
#endif
#endif /*_TD_UTIL_ULOG_H*/
......@@ -13,11 +13,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "tdataformat.h"
#include "ulog.h"
#include "talgo.h"
#include "tcoding.h"
#include "wchar.h"
#include "tarray.h"
#include "tlog.h"
static void dataColSetNEleNull(SDataCol *pCol, int nEle);
#if 0
......
......@@ -24,7 +24,6 @@
#include "tglobal.h"
#include "tlog.h"
#include "tutil.h"
#include "ulog.h"
SConfig *tsCfg = NULL;
......
......@@ -21,7 +21,7 @@
#include "dnode.h"
#include "taoserror.h"
#include "tglobal.h"
#include "ulog.h"
#include "tlog.h"
#include "version.h"
#ifdef __cplusplus
......
......@@ -26,10 +26,10 @@
#include "tmsg.h"
#include "trpc.h"
#include "tthread.h"
#include "ulog.h"
#include "client.h"
#include "server.h"
#include "tlog.h"
class Testbase {
public:
......
......@@ -15,7 +15,7 @@
#include "tglobal.h"
#include "tskiplist.h"
#include "tutil.h"
#include "ulog.h"
#include "tlog.h"
static std::string dir = "/tmp/index";
......
......@@ -18,7 +18,7 @@
#include "tep.h"
#include "tglobal.h"
#include "trpc.h"
#include "ulog.h"
#include "tlog.h"
using namespace std;
const char *label = "APP";
......
......@@ -22,7 +22,7 @@
#include "regex.h"
#include "thash.h"
#include "types.h"
#include "ulog.h"
#include "tlog.h"
#include "tdef.h"
#include "taos.h"
......
......@@ -15,7 +15,7 @@
#define _DEFAULT_SOURCE
#include "os.h"
#include "ulog.h"
#include "tlog.h"
#include "ttimer.h"
#include "tutil.h"
#include "tcache.h"
......
......@@ -53,7 +53,7 @@
#include "td_sz.h"
#endif
#include "tcompression.h"
#include "ulog.h"
#include "tlog.h"
static const int TEST_NUMBER = 1;
#define is_bigendian() ((*(char *)&TEST_NUMBER) == 0)
......
......@@ -19,7 +19,7 @@
#include "tcfg.h"
#include "thash.h"
#include "tutil.h"
#include "ulog.h"
#include "tlog.h"
#define CFG_NAME_PRINT_LEN 24
#define CFG_SRC_PRINT_LEN 12
......
......@@ -13,32 +13,30 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define _DEFAULT_SOURCE
#include "os.h"
#include "taoserror.h"
#define TAOS_ERROR_C
typedef struct {
int32_t val;
const char* str;
int32_t val;
const char* str;
} STaosError;
#include "os.h"
#include "taoserror.h"
static threadlocal int32_t tsErrno;
int32_t* taosGetErrno() {
return &tsErrno;
}
int32_t* taosGetErrno() { return &tsErrno; }
#ifdef TAOS_ERROR_C
#define TAOS_DEFINE_ERROR(name, msg) {.val = (name), .str=(msg)},
#define TAOS_DEFINE_ERROR(name, msg) {.val = (name), .str = (msg)},
#else
#define TAOS_DEFINE_ERROR(name, mod, code, msg) static const int32_t name = TAOS_DEF_ERROR_CODE(mod, code);
#endif
#define TAOS_SYSTEM_ERROR(code) (0x80ff0000 | (code))
#define TAOS_SUCCEEDED(err) ((err) >= 0)
#define TAOS_FAILED(err) ((err) < 0)
#define TAOS_SYSTEM_ERROR(code) (0x80ff0000 | (code))
#define TAOS_SUCCEEDED(err) ((err) >= 0)
#define TAOS_FAILED(err) ((err) < 0)
#ifdef TAOS_ERROR_C
STaosError errors[] = {
......@@ -253,16 +251,16 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_FUNC_NAME, "Invalid func name")
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_FUNC_COMMENT, "Invalid func comment")
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_FUNC_CODE, "Invalid func code")
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_FUNC_BUFSIZE, "Invalid func bufSize")
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_FUNC_RETRIEVE, "Invalid func retrieve msg")
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_FUNC_RETRIEVE, "Invalid func retrieve msg")
// mnode-trans
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_ALREADY_EXIST, "Transaction already exists")
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_NOT_EXIST, "Transaction not exists")
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_INVALID_STAGE, "Invalid stage to kill")
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_CANT_PARALLEL, "Invalid stage to kill")
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_ALREADY_EXIST, "Transaction already exists")
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_NOT_EXIST, "Transaction not exists")
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_INVALID_STAGE, "Invalid stage to kill")
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_CANT_PARALLEL, "Invalid stage to kill")
// mnode-topic
TAOS_DEFINE_ERROR(TSDB_CODE_MND_UNSUPPORTED_TOPIC, "Topic with STable not supported yet")
TAOS_DEFINE_ERROR(TSDB_CODE_MND_UNSUPPORTED_TOPIC, "Topic with STable not supported yet")
// dnode
TAOS_DEFINE_ERROR(TSDB_CODE_DND_ACTION_IN_PROGRESS, "Action in progress")
......@@ -374,8 +372,6 @@ TAOS_DEFINE_ERROR(TSDB_CODE_QRY_TASK_MSG_ERROR, "Task message error")
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_JOB_FREED, "Job already freed")
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_TASK_STATUS_ERROR, "Task status error")
// grant
TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_EXPIRED, "License expired")
TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_DNODE_LIMITED, "DNode creation limited by licence")
......@@ -432,12 +428,11 @@ TAOS_DEFINE_ERROR(TSDB_CODE_CTG_OUT_OF_SERVICE, "catalog is out of ser
TAOS_DEFINE_ERROR(TSDB_CODE_SCH_STATUS_ERROR, "scheduler status error")
TAOS_DEFINE_ERROR(TSDB_CODE_SCH_INTERNAL_ERROR, "scheduler internal error")
#ifdef TAOS_ERROR_C
};
#endif
static int tsCompareTaosError(const void* a, const void* b) {
static int32_t taosCompareTaosError(const void* a, const void* b) {
const STaosError* x = (const STaosError*)a;
const STaosError* y = (const STaosError*)b;
if (x->val < y->val) {
......@@ -450,11 +445,11 @@ static int tsCompareTaosError(const void* a, const void* b) {
}
static pthread_once_t tsErrorInit = PTHREAD_ONCE_INIT;
static void tsSortError(void) {
qsort(errors, sizeof(errors)/sizeof(errors[0]), sizeof(errors[0]), tsCompareTaosError);
qsort(errors, sizeof(errors) / sizeof(errors[0]), sizeof(errors[0]), taosCompareTaosError);
}
const char* tstrerror(int32_t err) {
pthread_once(&tsErrorInit, tsSortError);
......@@ -463,9 +458,11 @@ const char* tstrerror(int32_t err) {
return strerror(err & 0x0000ffff);
}
size_t s = 0, e = sizeof(errors)/sizeof(errors[0]);
int32_t s = 0;
int32_t e = sizeof(errors) / sizeof(errors[0]);
while (s < e) {
size_t mid = (s + e) / 2;
int32_t mid = (s + e) / 2;
int32_t val = errors[mid].val;
if (err > val) {
s = mid + 1;
......
......@@ -18,7 +18,7 @@
#include "taoserror.h"
#include "tref.h"
#include "tutil.h"
#include "ulog.h"
#include "tlog.h"
static int32_t tsFileRsetId = -1;
......
......@@ -15,7 +15,7 @@
#include "os.h"
#include "thash.h"
#include "ulog.h"
#include "tlog.h"
#include "taos.h"
#include "tdef.h"
......
......@@ -13,8 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "os.h"
#include "ulog.h"
#include "tlog.h"
typedef struct {
int maxId;
......
......@@ -14,32 +14,30 @@
*/
#define _DEFAULT_SOURCE
#include "tlog.h"
#include "os.h"
#include "tutil.h"
#include "ulog.h"
#include "tlog.h"
#define MAX_LOGLINE_SIZE (1000)
#define MAX_LOGLINE_BUFFER_SIZE (MAX_LOGLINE_SIZE + 10)
#define MAX_LOGLINE_CONTENT_SIZE (MAX_LOGLINE_SIZE - 100)
#define MAX_LOGLINE_DUMP_SIZE (65 * 1024)
#define MAX_LOGLINE_DUMP_BUFFER_SIZE (MAX_LOGLINE_DUMP_SIZE + 10)
#define MAX_LOGLINE_DUMP_CONTENT_SIZE (MAX_LOGLINE_DUMP_SIZE - 100)
#define LOG_MAX_LINE_SIZE (1000)
#define LOG_MAX_LINE_BUFFER_SIZE (LOG_MAX_LINE_SIZE + 10)
#define LOG_MAX_LINE_CONTENT_SIZE (LOG_MAX_LINE_SIZE - 100)
#define LOG_MAX_LINE_DUMP_SIZE (65 * 1024)
#define LOG_MAX_LINE_DUMP_BUFFER_SIZE (LOG_MAX_LINE_DUMP_SIZE + 10)
#define LOG_MAX_LINE_DUMP_CONTENT_SIZE (LOG_MAX_LINE_DUMP_SIZE - 100)
#define LOG_FILE_NAME_LEN 300
#define TSDB_DEFAULT_LOG_BUF_SIZE (20 * 1024 * 1024) // 20MB
#define LOG_FILE_NAME_LEN 300
#define LOG_DEFAULT_BUF_SIZE (20 * 1024 * 1024) // 20MB
#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_DEFAULT_INTERVAL 25
#define LOG_INTERVAL_STEP 5
#define LOG_MIN_INTERVAL 5
#define LOG_MAX_INTERVAL 25
#define LOG_MAX_WAIT_MSEC 1000
#define LOG_BUF_BUFFER(x) ((x)->buffer)
#define LOG_BUF_START(x) ((x)->buffStart)
#define LOG_BUF_END(x) ((x)->buffEnd)
#define LOG_BUF_SIZE(x) ((x)->buffSize)
#define LOG_BUF_MUTEX(x) ((x)->buffMutex)
#define LOG_BUF_START(x) ((x)->buffStart)
#define LOG_BUF_END(x) ((x)->buffEnd)
#define LOG_BUF_SIZE(x) ((x)->buffSize)
#define LOG_BUF_MUTEX(x) ((x)->buffMutex)
typedef struct {
char *buffer;
......@@ -70,9 +68,9 @@ int8_t tscEmbeddedInUtil = 0;
int32_t tsLogKeepDays = 0;
bool tsAsyncLog = true;
bool tsLogInited = false;
int8_t tsLogInited = 0;
int64_t asyncLogLostLines = 0;
int32_t writeInterval = DEFAULT_LOG_INTERVAL;
int32_t writeInterval = LOG_DEFAULT_INTERVAL;
// log
int32_t tsNumOfLogLines = 10000000;
......@@ -117,13 +115,13 @@ static int32_t taosStartLog() {
}
int32_t taosInitLog(const char *logName, int maxFiles) {
if (tsLogInited) return 0;
if (atomic_val_compare_exchange_8(&tsLogInited, 0, 1) != 0) return 0;
osUpdate();
char fullName[PATH_MAX] = {0};
snprintf(fullName, PATH_MAX, "%s" TD_DIRSEP "%s", tsLogDir, logName);
tsLogObj.logHandle = taosLogBuffNew(TSDB_DEFAULT_LOG_BUF_SIZE);
tsLogObj.logHandle = taosLogBuffNew(LOG_DEFAULT_BUF_SIZE);
if (tsLogObj.logHandle == NULL) return -1;
if (taosOpenLogFile(fullName, tsNumOfLogLines, maxFiles) < 0) return -1;
if (taosStartLog() < 0) return -1;
......@@ -140,7 +138,7 @@ static void taosStopLog() {
void taosCloseLog() {
taosStopLog();
// tsem_post(&(tsLogObj.logHandle->buffNotEmpty));
taosMsleep(MAX_LOG_INTERVAL / 1000);
taosMsleep(LOG_MAX_INTERVAL / 1000);
if (taosCheckPthreadValid(tsLogObj.logHandle->asyncThread)) {
pthread_join(tsLogObj.logHandle->asyncThread, NULL);
}
......@@ -383,7 +381,7 @@ void taosPrintLog(const char *flags, int32_t dflag, const char *format, ...) {
if (!osLogSpaceAvailable()) return;
va_list argpointer;
char buffer[MAX_LOGLINE_BUFFER_SIZE] = {0};
char buffer[LOG_MAX_LINE_BUFFER_SIZE] = {0};
int32_t len;
struct tm Tm, *ptm;
struct timeval timeSecs;
......@@ -398,20 +396,20 @@ void taosPrintLog(const char *flags, int32_t dflag, const char *format, ...) {
len += sprintf(buffer + len, "%s", flags);
va_start(argpointer, format);
int32_t writeLen = vsnprintf(buffer + len, MAX_LOGLINE_CONTENT_SIZE, format, argpointer);
int32_t writeLen = vsnprintf(buffer + len, LOG_MAX_LINE_CONTENT_SIZE, format, argpointer);
if (writeLen <= 0) {
char tmp[MAX_LOGLINE_DUMP_BUFFER_SIZE] = {0};
writeLen = vsnprintf(tmp, MAX_LOGLINE_DUMP_CONTENT_SIZE, format, argpointer);
strncpy(buffer + len, tmp, MAX_LOGLINE_CONTENT_SIZE);
len += MAX_LOGLINE_CONTENT_SIZE;
} else if (writeLen >= MAX_LOGLINE_CONTENT_SIZE) {
len += MAX_LOGLINE_CONTENT_SIZE;
char tmp[LOG_MAX_LINE_DUMP_BUFFER_SIZE] = {0};
writeLen = vsnprintf(tmp, LOG_MAX_LINE_DUMP_CONTENT_SIZE, format, argpointer);
strncpy(buffer + len, tmp, LOG_MAX_LINE_CONTENT_SIZE);
len += LOG_MAX_LINE_CONTENT_SIZE;
} else if (writeLen >= LOG_MAX_LINE_CONTENT_SIZE) {
len += LOG_MAX_LINE_CONTENT_SIZE;
} else {
len += writeLen;
}
va_end(argpointer);
if (len > MAX_LOGLINE_SIZE) len = MAX_LOGLINE_SIZE;
if (len > LOG_MAX_LINE_SIZE) len = LOG_MAX_LINE_SIZE;
buffer[len++] = '\n';
buffer[len] = 0;
......@@ -460,7 +458,7 @@ void taosPrintLongString(const char *flags, int32_t dflag, const char *format, .
if (!osLogSpaceAvailable()) return;
va_list argpointer;
char buffer[MAX_LOGLINE_DUMP_BUFFER_SIZE];
char buffer[LOG_MAX_LINE_DUMP_BUFFER_SIZE];
int32_t len;
struct tm Tm, *ptm;
struct timeval timeSecs;
......@@ -475,10 +473,10 @@ void taosPrintLongString(const char *flags, int32_t dflag, const char *format, .
len += sprintf(buffer + len, "%s", flags);
va_start(argpointer, format);
len += vsnprintf(buffer + len, MAX_LOGLINE_DUMP_CONTENT_SIZE, format, argpointer);
len += vsnprintf(buffer + len, LOG_MAX_LINE_DUMP_CONTENT_SIZE, format, argpointer);
va_end(argpointer);
if (len > MAX_LOGLINE_DUMP_SIZE) len = MAX_LOGLINE_DUMP_SIZE;
if (len > LOG_MAX_LINE_DUMP_SIZE) len = LOG_MAX_LINE_DUMP_SIZE;
buffer[len++] = '\n';
buffer[len] = 0;
......@@ -629,7 +627,7 @@ static void taosWriteLog(SLogBuff *tLogBuff) {
if (start == end) {
dbgEmptyW++;
writeInterval = MAX_LOG_INTERVAL;
writeInterval = LOG_MAX_INTERVAL;
return;
}
......@@ -658,14 +656,14 @@ static void taosWriteLog(SLogBuff *tLogBuff) {
if (pollSize < tLogBuff->minBuffSize) {
dbgSmallWN++;
if (writeInterval < MAX_LOG_INTERVAL) {
if (writeInterval < LOG_MAX_INTERVAL) {
writeInterval += LOG_INTERVAL_STEP;
}
} else if (pollSize > LOG_BUF_SIZE(tLogBuff) / 3) {
dbgBigWN++;
writeInterval = MIN_LOG_INTERVAL;
writeInterval = LOG_MIN_INTERVAL;
} else if (pollSize > LOG_BUF_SIZE(tLogBuff) / 4) {
if (writeInterval > MIN_LOG_INTERVAL) {
if (writeInterval > LOG_MIN_INTERVAL) {
writeInterval -= LOG_INTERVAL_STEP;
}
}
......@@ -680,7 +678,7 @@ static void taosWriteLog(SLogBuff *tLogBuff) {
break;
}
writeInterval = MIN_LOG_INTERVAL;
writeInterval = LOG_MIN_INTERVAL;
remainChecked = 1;
} while (1);
......@@ -707,7 +705,7 @@ int32_t taosCompressFile(char *srcFileName, char *destFileName) {
int32_t ret = 0;
int32_t len = 0;
char *data = malloc(compressSize);
// gzFile dstFp = NULL;
// gzFile dstFp = NULL;
// srcFp = fopen(srcFileName, "r");
TdFilePtr pSrcFile = taosOpenFile(srcFileName, TD_FILE_READ);
......@@ -722,25 +720,25 @@ int32_t taosCompressFile(char *srcFileName, char *destFileName) {
goto cmp_end;
}
// dstFp = gzdopen(fd, "wb6f");
// if (dstFp == NULL) {
// ret = -3;
// close(fd);
// goto cmp_end;
// }
//
// while (!feof(srcFp)) {
// len = (int32_t)fread(data, 1, compressSize, srcFp);
// (void)gzwrite(dstFp, data, len);
// }
// dstFp = gzdopen(fd, "wb6f");
// if (dstFp == NULL) {
// ret = -3;
// close(fd);
// goto cmp_end;
// }
//
// while (!feof(srcFp)) {
// len = (int32_t)fread(data, 1, compressSize, srcFp);
// (void)gzwrite(dstFp, data, len);
// }
cmp_end:
if (pSrcFile) {
taosCloseFile(&pSrcFile);
}
// if (dstFp) {
// gzclose(dstFp);
// }
// if (dstFp) {
// gzclose(dstFp);
// }
free(data);
return ret;
......
......@@ -14,7 +14,7 @@
*/
#include "os.h"
#include "ulog.h"
#include "tlog.h"
#include "tlosertree.h"
#include "taoserror.h"
......
......@@ -13,8 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "os.h"
#include "ulog.h"
#include "tlog.h"
#include "tmempool.h"
#include "tutil.h"
......
#include "os.h"
#include "ulog.h"
#include "tlog.h"
#include "tpagedbuf.h"
#include "taoserror.h"
#include "tcompression.h"
......
......@@ -16,7 +16,7 @@
#define _DEFAULT_SOURCE
#include "tqueue.h"
#include "taoserror.h"
#include "ulog.h"
#include "tlog.h"
typedef struct STaosQnode STaosQnode;
......
......@@ -14,8 +14,9 @@
*/
#include "os.h"
#include "taoserror.h"
#include "ulog.h"
#include "tlog.h"
#include "tutil.h"
#define TSDB_REF_OBJECTS 50
......
......@@ -13,10 +13,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "os.h"
#include "tdef.h"
#include "tutil.h"
#include "ulog.h"
#include "tlog.h"
#include "tsched.h"
#include "ttimer.h"
......
......@@ -14,12 +14,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "os.h"
#include "compare.h"
#include "tskiplist.h"
#include "tutil.h"
#include "ulog.h"
#include "tlog.h"
static int initForwardBackwardPtr(SSkipList *pSkipList);
static SSkipListNode * getPriorNode(SSkipList *pSkipList, const char *val, int32_t order, SSkipListNode **pCur);
......
......@@ -14,8 +14,7 @@
*/
#define _DEFAULT_SOURCE
#include "os.h"
#include "ulog.h"
#include "tlog.h"
#include "taoserror.h"
#include "tstep.h"
......
......@@ -14,11 +14,10 @@
*/
#include "tthread.h"
#include "os.h"
#include "taoserror.h"
#include "tdef.h"
#include "tutil.h"
#include "ulog.h"
#include "tlog.h"
// create new thread
pthread_t* taosCreateThread(void* (*__start_routine)(void*), void* param) {
......
......@@ -17,7 +17,6 @@
#include "os.h"
#include "taoserror.h"
#include "tdef.h"
#include "ulog.h"
int32_t taosVersionStrToInt(const char *vstr, int32_t *vint) {
if (vstr == NULL) {
......
......@@ -16,7 +16,7 @@
#define _DEFAULT_SOURCE
#include "tworker.h"
#include "taoserror.h"
#include "ulog.h"
#include "tlog.h"
typedef void *(*ThreadFp)(void *param);
......
......@@ -8,7 +8,7 @@
#include "tlog.h"
#include "tglobal.h"
#include "taoserror.h"
#include "ulog.h"
#include "tlog.h"
typedef struct {
int refNum;
......
......@@ -18,7 +18,7 @@
#include "taosdef.h"
#include "tmsg.h"
#include "taoserror.h"
#include "tulog.h"
#include "tlog.h"
#include "tglobal.h"
#include "tsocket.h"
#include "trpc.h"
......
......@@ -19,7 +19,7 @@
#include "shell.h"
#include "shellCommand.h"
#include "tkey.h"
#include "ulog.h"
#include "tlog.h"
#include "version.h"
#include <wordexp.h>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册