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

Merge pull request #10428 from taosdata/feature/config

Feature/config
...@@ -16,11 +16,12 @@ ...@@ -16,11 +16,12 @@
#ifndef _TD_UTIL_COMPARE_H_ #ifndef _TD_UTIL_COMPARE_H_
#define _TD_UTIL_COMPARE_H_ #define _TD_UTIL_COMPARE_H_
#include "os.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#include "os.h"
#define TSDB_PATTERN_MATCH 0 #define TSDB_PATTERN_MATCH 0
#define TSDB_PATTERN_NOMATCH 1 #define TSDB_PATTERN_NOMATCH 1
...@@ -62,7 +63,6 @@ int32_t setChkNotInBytes8(const void *pLeft, const void *pRight); ...@@ -62,7 +63,6 @@ int32_t setChkNotInBytes8(const void *pLeft, const void *pRight);
int32_t compareChkInString(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 compareChkNotInString(const void *pLeft, const void *pRight);
int32_t compareInt8Val(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 compareInt16Val(const void *pLeft, const void *pRight);
int32_t compareInt32Val(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); ...@@ -83,7 +83,6 @@ int32_t compareStrRegexComp(const void *pLeft, const void *pRight);
int32_t compareStrRegexCompMatch(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 compareStrRegexCompNMatch(const void *pLeft, const void *pRight);
int32_t compareInt8ValDesc(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 compareInt16ValDesc(const void *pLeft, const void *pRight);
int32_t compareInt32ValDesc(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); ...@@ -102,7 +101,6 @@ int32_t compareLenPrefixedWStrDesc(const void *pLeft, const void *pRight);
__compar_fn_t getComparFunc(int32_t type, int32_t optr); __compar_fn_t getComparFunc(int32_t type, int32_t optr);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
此差异已折叠。
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
extern "C" { extern "C" {
#endif #endif
extern bool tsLogInited;
extern bool tsAsyncLog; extern bool tsAsyncLog;
extern int32_t tsNumOfLogLines; extern int32_t tsNumOfLogLines;
extern int32_t tsLogKeepDays; extern int32_t tsLogKeepDays;
...@@ -55,7 +54,7 @@ int32_t taosInitLog(const char *logName, int32_t maxFiles); ...@@ -55,7 +54,7 @@ int32_t taosInitLog(const char *logName, int32_t maxFiles);
void taosCloseLog(); void taosCloseLog();
void taosResetLog(); void taosResetLog();
void taosSetAllDebugFlag(int32_t flag); 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, ...) void taosPrintLog(const char *flags, int32_t dflag, const char *format, ...)
#ifdef __GNUC__ #ifdef __GNUC__
...@@ -69,6 +68,18 @@ void taosPrintLongString(const char *flags, int32_t dflag, const char *format, . ...@@ -69,6 +68,18 @@ void taosPrintLongString(const char *flags, int32_t dflag, const char *format, .
#endif #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 #ifdef __cplusplus
} }
#endif #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 @@ ...@@ -13,11 +13,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "tdataformat.h" #include "tdataformat.h"
#include "ulog.h"
#include "talgo.h" #include "talgo.h"
#include "tcoding.h" #include "tcoding.h"
#include "wchar.h" #include "wchar.h"
#include "tarray.h" #include "tarray.h"
#include "tlog.h"
static void dataColSetNEleNull(SDataCol *pCol, int nEle); static void dataColSetNEleNull(SDataCol *pCol, int nEle);
#if 0 #if 0
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "tglobal.h" #include "tglobal.h"
#include "tlog.h" #include "tlog.h"
#include "tutil.h" #include "tutil.h"
#include "ulog.h"
SConfig *tsCfg = NULL; SConfig *tsCfg = NULL;
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include "dnode.h" #include "dnode.h"
#include "taoserror.h" #include "taoserror.h"
#include "tglobal.h" #include "tglobal.h"
#include "ulog.h" #include "tlog.h"
#include "version.h" #include "version.h"
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -26,10 +26,10 @@ ...@@ -26,10 +26,10 @@
#include "tmsg.h" #include "tmsg.h"
#include "trpc.h" #include "trpc.h"
#include "tthread.h" #include "tthread.h"
#include "ulog.h"
#include "client.h" #include "client.h"
#include "server.h" #include "server.h"
#include "tlog.h"
class Testbase { class Testbase {
public: public:
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include "tglobal.h" #include "tglobal.h"
#include "tskiplist.h" #include "tskiplist.h"
#include "tutil.h" #include "tutil.h"
#include "ulog.h" #include "tlog.h"
static std::string dir = "/tmp/index"; static std::string dir = "/tmp/index";
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include "tep.h" #include "tep.h"
#include "tglobal.h" #include "tglobal.h"
#include "trpc.h" #include "trpc.h"
#include "ulog.h" #include "tlog.h"
using namespace std; using namespace std;
const char *label = "APP"; const char *label = "APP";
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include "regex.h" #include "regex.h"
#include "thash.h" #include "thash.h"
#include "types.h" #include "types.h"
#include "ulog.h" #include "tlog.h"
#include "tdef.h" #include "tdef.h"
#include "taos.h" #include "taos.h"
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#define _DEFAULT_SOURCE #define _DEFAULT_SOURCE
#include "os.h" #include "os.h"
#include "ulog.h" #include "tlog.h"
#include "ttimer.h" #include "ttimer.h"
#include "tutil.h" #include "tutil.h"
#include "tcache.h" #include "tcache.h"
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
#include "td_sz.h" #include "td_sz.h"
#endif #endif
#include "tcompression.h" #include "tcompression.h"
#include "ulog.h" #include "tlog.h"
static const int TEST_NUMBER = 1; static const int TEST_NUMBER = 1;
#define is_bigendian() ((*(char *)&TEST_NUMBER) == 0) #define is_bigendian() ((*(char *)&TEST_NUMBER) == 0)
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include "tcfg.h" #include "tcfg.h"
#include "thash.h" #include "thash.h"
#include "tutil.h" #include "tutil.h"
#include "ulog.h" #include "tlog.h"
#define CFG_NAME_PRINT_LEN 24 #define CFG_NAME_PRINT_LEN 24
#define CFG_SRC_PRINT_LEN 12 #define CFG_SRC_PRINT_LEN 12
......
...@@ -13,7 +13,9 @@ ...@@ -13,7 +13,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#define _DEFAULT_SOURCE
#include "os.h" #include "os.h"
#include "taoserror.h"
#define TAOS_ERROR_C #define TAOS_ERROR_C
...@@ -22,16 +24,12 @@ typedef struct { ...@@ -22,16 +24,12 @@ typedef struct {
const char* str; const char* str;
} STaosError; } STaosError;
#include "os.h"
#include "taoserror.h"
static threadlocal int32_t tsErrno; static threadlocal int32_t tsErrno;
int32_t* taosGetErrno() {
return &tsErrno; int32_t* taosGetErrno() { return &tsErrno; }
}
#ifdef TAOS_ERROR_C #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 #else
#define TAOS_DEFINE_ERROR(name, mod, code, msg) static const int32_t name = TAOS_DEF_ERROR_CODE(mod, code); #define TAOS_DEFINE_ERROR(name, mod, code, msg) static const int32_t name = TAOS_DEF_ERROR_CODE(mod, code);
#endif #endif
...@@ -374,8 +372,6 @@ TAOS_DEFINE_ERROR(TSDB_CODE_QRY_TASK_MSG_ERROR, "Task message error") ...@@ -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_JOB_FREED, "Job already freed")
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_TASK_STATUS_ERROR, "Task status error") TAOS_DEFINE_ERROR(TSDB_CODE_QRY_TASK_STATUS_ERROR, "Task status error")
// grant // grant
TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_EXPIRED, "License expired") TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_EXPIRED, "License expired")
TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_DNODE_LIMITED, "DNode creation limited by licence") 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 ...@@ -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_STATUS_ERROR, "scheduler status error")
TAOS_DEFINE_ERROR(TSDB_CODE_SCH_INTERNAL_ERROR, "scheduler internal error") TAOS_DEFINE_ERROR(TSDB_CODE_SCH_INTERNAL_ERROR, "scheduler internal error")
#ifdef TAOS_ERROR_C #ifdef TAOS_ERROR_C
}; };
#endif #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* x = (const STaosError*)a;
const STaosError* y = (const STaosError*)b; const STaosError* y = (const STaosError*)b;
if (x->val < y->val) { if (x->val < y->val) {
...@@ -450,11 +445,11 @@ static int tsCompareTaosError(const void* a, const void* b) { ...@@ -450,11 +445,11 @@ static int tsCompareTaosError(const void* a, const void* b) {
} }
static pthread_once_t tsErrorInit = PTHREAD_ONCE_INIT; static pthread_once_t tsErrorInit = PTHREAD_ONCE_INIT;
static void tsSortError(void) { 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) { const char* tstrerror(int32_t err) {
pthread_once(&tsErrorInit, tsSortError); pthread_once(&tsErrorInit, tsSortError);
...@@ -463,9 +458,11 @@ const char* tstrerror(int32_t err) { ...@@ -463,9 +458,11 @@ const char* tstrerror(int32_t err) {
return strerror(err & 0x0000ffff); 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) { while (s < e) {
size_t mid = (s + e) / 2; int32_t mid = (s + e) / 2;
int32_t val = errors[mid].val; int32_t val = errors[mid].val;
if (err > val) { if (err > val) {
s = mid + 1; s = mid + 1;
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include "taoserror.h" #include "taoserror.h"
#include "tref.h" #include "tref.h"
#include "tutil.h" #include "tutil.h"
#include "ulog.h" #include "tlog.h"
static int32_t tsFileRsetId = -1; static int32_t tsFileRsetId = -1;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include "os.h" #include "os.h"
#include "thash.h" #include "thash.h"
#include "ulog.h" #include "tlog.h"
#include "taos.h" #include "taos.h"
#include "tdef.h" #include "tdef.h"
......
...@@ -13,8 +13,7 @@ ...@@ -13,8 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "os.h" #include "tlog.h"
#include "ulog.h"
typedef struct { typedef struct {
int maxId; int maxId;
......
...@@ -14,25 +14,23 @@ ...@@ -14,25 +14,23 @@
*/ */
#define _DEFAULT_SOURCE #define _DEFAULT_SOURCE
#include "tlog.h"
#include "os.h"
#include "tutil.h" #include "tutil.h"
#include "ulog.h" #include "tlog.h"
#define MAX_LOGLINE_SIZE (1000) #define LOG_MAX_LINE_SIZE (1000)
#define MAX_LOGLINE_BUFFER_SIZE (MAX_LOGLINE_SIZE + 10) #define LOG_MAX_LINE_BUFFER_SIZE (LOG_MAX_LINE_SIZE + 10)
#define MAX_LOGLINE_CONTENT_SIZE (MAX_LOGLINE_SIZE - 100) #define LOG_MAX_LINE_CONTENT_SIZE (LOG_MAX_LINE_SIZE - 100)
#define MAX_LOGLINE_DUMP_SIZE (65 * 1024) #define LOG_MAX_LINE_DUMP_SIZE (65 * 1024)
#define MAX_LOGLINE_DUMP_BUFFER_SIZE (MAX_LOGLINE_DUMP_SIZE + 10) #define LOG_MAX_LINE_DUMP_BUFFER_SIZE (LOG_MAX_LINE_DUMP_SIZE + 10)
#define MAX_LOGLINE_DUMP_CONTENT_SIZE (MAX_LOGLINE_DUMP_SIZE - 100) #define LOG_MAX_LINE_DUMP_CONTENT_SIZE (LOG_MAX_LINE_DUMP_SIZE - 100)
#define LOG_FILE_NAME_LEN 300 #define LOG_FILE_NAME_LEN 300
#define TSDB_DEFAULT_LOG_BUF_SIZE (20 * 1024 * 1024) // 20MB #define LOG_DEFAULT_BUF_SIZE (20 * 1024 * 1024) // 20MB
#define DEFAULT_LOG_INTERVAL 25 #define LOG_DEFAULT_INTERVAL 25
#define LOG_INTERVAL_STEP 5 #define LOG_INTERVAL_STEP 5
#define MIN_LOG_INTERVAL 5 #define LOG_MIN_INTERVAL 5
#define MAX_LOG_INTERVAL 25 #define LOG_MAX_INTERVAL 25
#define LOG_MAX_WAIT_MSEC 1000 #define LOG_MAX_WAIT_MSEC 1000
#define LOG_BUF_BUFFER(x) ((x)->buffer) #define LOG_BUF_BUFFER(x) ((x)->buffer)
...@@ -70,9 +68,9 @@ int8_t tscEmbeddedInUtil = 0; ...@@ -70,9 +68,9 @@ int8_t tscEmbeddedInUtil = 0;
int32_t tsLogKeepDays = 0; int32_t tsLogKeepDays = 0;
bool tsAsyncLog = true; bool tsAsyncLog = true;
bool tsLogInited = false; int8_t tsLogInited = 0;
int64_t asyncLogLostLines = 0; int64_t asyncLogLostLines = 0;
int32_t writeInterval = DEFAULT_LOG_INTERVAL; int32_t writeInterval = LOG_DEFAULT_INTERVAL;
// log // log
int32_t tsNumOfLogLines = 10000000; int32_t tsNumOfLogLines = 10000000;
...@@ -117,13 +115,13 @@ static int32_t taosStartLog() { ...@@ -117,13 +115,13 @@ static int32_t taosStartLog() {
} }
int32_t taosInitLog(const char *logName, int maxFiles) { 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(); osUpdate();
char fullName[PATH_MAX] = {0}; char fullName[PATH_MAX] = {0};
snprintf(fullName, PATH_MAX, "%s" TD_DIRSEP "%s", tsLogDir, logName); 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 (tsLogObj.logHandle == NULL) return -1;
if (taosOpenLogFile(fullName, tsNumOfLogLines, maxFiles) < 0) return -1; if (taosOpenLogFile(fullName, tsNumOfLogLines, maxFiles) < 0) return -1;
if (taosStartLog() < 0) return -1; if (taosStartLog() < 0) return -1;
...@@ -140,7 +138,7 @@ static void taosStopLog() { ...@@ -140,7 +138,7 @@ static void taosStopLog() {
void taosCloseLog() { void taosCloseLog() {
taosStopLog(); taosStopLog();
// tsem_post(&(tsLogObj.logHandle->buffNotEmpty)); // tsem_post(&(tsLogObj.logHandle->buffNotEmpty));
taosMsleep(MAX_LOG_INTERVAL / 1000); taosMsleep(LOG_MAX_INTERVAL / 1000);
if (taosCheckPthreadValid(tsLogObj.logHandle->asyncThread)) { if (taosCheckPthreadValid(tsLogObj.logHandle->asyncThread)) {
pthread_join(tsLogObj.logHandle->asyncThread, NULL); pthread_join(tsLogObj.logHandle->asyncThread, NULL);
} }
...@@ -383,7 +381,7 @@ void taosPrintLog(const char *flags, int32_t dflag, const char *format, ...) { ...@@ -383,7 +381,7 @@ void taosPrintLog(const char *flags, int32_t dflag, const char *format, ...) {
if (!osLogSpaceAvailable()) return; if (!osLogSpaceAvailable()) return;
va_list argpointer; va_list argpointer;
char buffer[MAX_LOGLINE_BUFFER_SIZE] = {0}; char buffer[LOG_MAX_LINE_BUFFER_SIZE] = {0};
int32_t len; int32_t len;
struct tm Tm, *ptm; struct tm Tm, *ptm;
struct timeval timeSecs; struct timeval timeSecs;
...@@ -398,20 +396,20 @@ void taosPrintLog(const char *flags, int32_t dflag, const char *format, ...) { ...@@ -398,20 +396,20 @@ void taosPrintLog(const char *flags, int32_t dflag, const char *format, ...) {
len += sprintf(buffer + len, "%s", flags); len += sprintf(buffer + len, "%s", flags);
va_start(argpointer, format); 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) { if (writeLen <= 0) {
char tmp[MAX_LOGLINE_DUMP_BUFFER_SIZE] = {0}; char tmp[LOG_MAX_LINE_DUMP_BUFFER_SIZE] = {0};
writeLen = vsnprintf(tmp, MAX_LOGLINE_DUMP_CONTENT_SIZE, format, argpointer); writeLen = vsnprintf(tmp, LOG_MAX_LINE_DUMP_CONTENT_SIZE, format, argpointer);
strncpy(buffer + len, tmp, MAX_LOGLINE_CONTENT_SIZE); strncpy(buffer + len, tmp, LOG_MAX_LINE_CONTENT_SIZE);
len += MAX_LOGLINE_CONTENT_SIZE; len += LOG_MAX_LINE_CONTENT_SIZE;
} else if (writeLen >= MAX_LOGLINE_CONTENT_SIZE) { } else if (writeLen >= LOG_MAX_LINE_CONTENT_SIZE) {
len += MAX_LOGLINE_CONTENT_SIZE; len += LOG_MAX_LINE_CONTENT_SIZE;
} else { } else {
len += writeLen; len += writeLen;
} }
va_end(argpointer); 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++] = '\n';
buffer[len] = 0; buffer[len] = 0;
...@@ -460,7 +458,7 @@ void taosPrintLongString(const char *flags, int32_t dflag, const char *format, . ...@@ -460,7 +458,7 @@ void taosPrintLongString(const char *flags, int32_t dflag, const char *format, .
if (!osLogSpaceAvailable()) return; if (!osLogSpaceAvailable()) return;
va_list argpointer; va_list argpointer;
char buffer[MAX_LOGLINE_DUMP_BUFFER_SIZE]; char buffer[LOG_MAX_LINE_DUMP_BUFFER_SIZE];
int32_t len; int32_t len;
struct tm Tm, *ptm; struct tm Tm, *ptm;
struct timeval timeSecs; struct timeval timeSecs;
...@@ -475,10 +473,10 @@ void taosPrintLongString(const char *flags, int32_t dflag, const char *format, . ...@@ -475,10 +473,10 @@ void taosPrintLongString(const char *flags, int32_t dflag, const char *format, .
len += sprintf(buffer + len, "%s", flags); len += sprintf(buffer + len, "%s", flags);
va_start(argpointer, format); 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); 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++] = '\n';
buffer[len] = 0; buffer[len] = 0;
...@@ -629,7 +627,7 @@ static void taosWriteLog(SLogBuff *tLogBuff) { ...@@ -629,7 +627,7 @@ static void taosWriteLog(SLogBuff *tLogBuff) {
if (start == end) { if (start == end) {
dbgEmptyW++; dbgEmptyW++;
writeInterval = MAX_LOG_INTERVAL; writeInterval = LOG_MAX_INTERVAL;
return; return;
} }
...@@ -658,14 +656,14 @@ static void taosWriteLog(SLogBuff *tLogBuff) { ...@@ -658,14 +656,14 @@ static void taosWriteLog(SLogBuff *tLogBuff) {
if (pollSize < tLogBuff->minBuffSize) { if (pollSize < tLogBuff->minBuffSize) {
dbgSmallWN++; dbgSmallWN++;
if (writeInterval < MAX_LOG_INTERVAL) { if (writeInterval < LOG_MAX_INTERVAL) {
writeInterval += LOG_INTERVAL_STEP; writeInterval += LOG_INTERVAL_STEP;
} }
} else if (pollSize > LOG_BUF_SIZE(tLogBuff) / 3) { } else if (pollSize > LOG_BUF_SIZE(tLogBuff) / 3) {
dbgBigWN++; dbgBigWN++;
writeInterval = MIN_LOG_INTERVAL; writeInterval = LOG_MIN_INTERVAL;
} else if (pollSize > LOG_BUF_SIZE(tLogBuff) / 4) { } else if (pollSize > LOG_BUF_SIZE(tLogBuff) / 4) {
if (writeInterval > MIN_LOG_INTERVAL) { if (writeInterval > LOG_MIN_INTERVAL) {
writeInterval -= LOG_INTERVAL_STEP; writeInterval -= LOG_INTERVAL_STEP;
} }
} }
...@@ -680,7 +678,7 @@ static void taosWriteLog(SLogBuff *tLogBuff) { ...@@ -680,7 +678,7 @@ static void taosWriteLog(SLogBuff *tLogBuff) {
break; break;
} }
writeInterval = MIN_LOG_INTERVAL; writeInterval = LOG_MIN_INTERVAL;
remainChecked = 1; remainChecked = 1;
} while (1); } while (1);
...@@ -707,7 +705,7 @@ int32_t taosCompressFile(char *srcFileName, char *destFileName) { ...@@ -707,7 +705,7 @@ int32_t taosCompressFile(char *srcFileName, char *destFileName) {
int32_t ret = 0; int32_t ret = 0;
int32_t len = 0; int32_t len = 0;
char *data = malloc(compressSize); char *data = malloc(compressSize);
// gzFile dstFp = NULL; // gzFile dstFp = NULL;
// srcFp = fopen(srcFileName, "r"); // srcFp = fopen(srcFileName, "r");
TdFilePtr pSrcFile = taosOpenFile(srcFileName, TD_FILE_READ); TdFilePtr pSrcFile = taosOpenFile(srcFileName, TD_FILE_READ);
...@@ -722,25 +720,25 @@ int32_t taosCompressFile(char *srcFileName, char *destFileName) { ...@@ -722,25 +720,25 @@ int32_t taosCompressFile(char *srcFileName, char *destFileName) {
goto cmp_end; goto cmp_end;
} }
// dstFp = gzdopen(fd, "wb6f"); // dstFp = gzdopen(fd, "wb6f");
// if (dstFp == NULL) { // if (dstFp == NULL) {
// ret = -3; // ret = -3;
// close(fd); // close(fd);
// goto cmp_end; // goto cmp_end;
// } // }
// //
// while (!feof(srcFp)) { // while (!feof(srcFp)) {
// len = (int32_t)fread(data, 1, compressSize, srcFp); // len = (int32_t)fread(data, 1, compressSize, srcFp);
// (void)gzwrite(dstFp, data, len); // (void)gzwrite(dstFp, data, len);
// } // }
cmp_end: cmp_end:
if (pSrcFile) { if (pSrcFile) {
taosCloseFile(&pSrcFile); taosCloseFile(&pSrcFile);
} }
// if (dstFp) { // if (dstFp) {
// gzclose(dstFp); // gzclose(dstFp);
// } // }
free(data); free(data);
return ret; return ret;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
*/ */
#include "os.h" #include "os.h"
#include "ulog.h" #include "tlog.h"
#include "tlosertree.h" #include "tlosertree.h"
#include "taoserror.h" #include "taoserror.h"
......
...@@ -13,8 +13,7 @@ ...@@ -13,8 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "os.h" #include "tlog.h"
#include "ulog.h"
#include "tmempool.h" #include "tmempool.h"
#include "tutil.h" #include "tutil.h"
......
#include "os.h" #include "tlog.h"
#include "ulog.h"
#include "tpagedbuf.h" #include "tpagedbuf.h"
#include "taoserror.h" #include "taoserror.h"
#include "tcompression.h" #include "tcompression.h"
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#define _DEFAULT_SOURCE #define _DEFAULT_SOURCE
#include "tqueue.h" #include "tqueue.h"
#include "taoserror.h" #include "taoserror.h"
#include "ulog.h" #include "tlog.h"
typedef struct STaosQnode STaosQnode; typedef struct STaosQnode STaosQnode;
......
...@@ -14,8 +14,9 @@ ...@@ -14,8 +14,9 @@
*/ */
#include "os.h" #include "os.h"
#include "taoserror.h" #include "taoserror.h"
#include "ulog.h" #include "tlog.h"
#include "tutil.h" #include "tutil.h"
#define TSDB_REF_OBJECTS 50 #define TSDB_REF_OBJECTS 50
......
...@@ -13,10 +13,9 @@ ...@@ -13,10 +13,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "os.h"
#include "tdef.h" #include "tdef.h"
#include "tutil.h" #include "tutil.h"
#include "ulog.h" #include "tlog.h"
#include "tsched.h" #include "tsched.h"
#include "ttimer.h" #include "ttimer.h"
......
...@@ -14,12 +14,10 @@ ...@@ -14,12 +14,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "os.h"
#include "compare.h" #include "compare.h"
#include "tskiplist.h" #include "tskiplist.h"
#include "tutil.h" #include "tutil.h"
#include "ulog.h" #include "tlog.h"
static int initForwardBackwardPtr(SSkipList *pSkipList); static int initForwardBackwardPtr(SSkipList *pSkipList);
static SSkipListNode * getPriorNode(SSkipList *pSkipList, const char *val, int32_t order, SSkipListNode **pCur); static SSkipListNode * getPriorNode(SSkipList *pSkipList, const char *val, int32_t order, SSkipListNode **pCur);
......
...@@ -14,8 +14,7 @@ ...@@ -14,8 +14,7 @@
*/ */
#define _DEFAULT_SOURCE #define _DEFAULT_SOURCE
#include "os.h" #include "tlog.h"
#include "ulog.h"
#include "taoserror.h" #include "taoserror.h"
#include "tstep.h" #include "tstep.h"
......
...@@ -14,11 +14,10 @@ ...@@ -14,11 +14,10 @@
*/ */
#include "tthread.h" #include "tthread.h"
#include "os.h"
#include "taoserror.h" #include "taoserror.h"
#include "tdef.h" #include "tdef.h"
#include "tutil.h" #include "tutil.h"
#include "ulog.h" #include "tlog.h"
// create new thread // create new thread
pthread_t* taosCreateThread(void* (*__start_routine)(void*), void* param) { pthread_t* taosCreateThread(void* (*__start_routine)(void*), void* param) {
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include "os.h" #include "os.h"
#include "taoserror.h" #include "taoserror.h"
#include "tdef.h" #include "tdef.h"
#include "ulog.h"
int32_t taosVersionStrToInt(const char *vstr, int32_t *vint) { int32_t taosVersionStrToInt(const char *vstr, int32_t *vint) {
if (vstr == NULL) { if (vstr == NULL) {
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#define _DEFAULT_SOURCE #define _DEFAULT_SOURCE
#include "tworker.h" #include "tworker.h"
#include "taoserror.h" #include "taoserror.h"
#include "ulog.h" #include "tlog.h"
typedef void *(*ThreadFp)(void *param); typedef void *(*ThreadFp)(void *param);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include "tlog.h" #include "tlog.h"
#include "tglobal.h" #include "tglobal.h"
#include "taoserror.h" #include "taoserror.h"
#include "ulog.h" #include "tlog.h"
typedef struct { typedef struct {
int refNum; int refNum;
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include "taosdef.h" #include "taosdef.h"
#include "tmsg.h" #include "tmsg.h"
#include "taoserror.h" #include "taoserror.h"
#include "tulog.h" #include "tlog.h"
#include "tglobal.h" #include "tglobal.h"
#include "tsocket.h" #include "tsocket.h"
#include "trpc.h" #include "trpc.h"
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include "shell.h" #include "shell.h"
#include "shellCommand.h" #include "shellCommand.h"
#include "tkey.h" #include "tkey.h"
#include "ulog.h" #include "tlog.h"
#include "version.h" #include "version.h"
#include <wordexp.h> #include <wordexp.h>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册