Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
29afc80f
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
29afc80f
编写于
2月 27, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
2月 27, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #10428 from taosdata/feature/config
Feature/config
上级
2d063326
b7537c70
变更
33
展开全部
隐藏空白更改
内联
并排
Showing
33 changed file
with
329 addition
and
379 deletion
+329
-379
include/util/compare.h
include/util/compare.h
+6
-8
include/util/taoserror.h
include/util/taoserror.h
+205
-207
include/util/tlog.h
include/util/tlog.h
+13
-2
include/util/ulog.h
include/util/ulog.h
+0
-43
source/common/src/tdataformat.c
source/common/src/tdataformat.c
+1
-1
source/common/src/tglobal.c
source/common/src/tglobal.c
+0
-1
source/dnode/mgmt/daemon/inc/dmnInt.h
source/dnode/mgmt/daemon/inc/dmnInt.h
+1
-1
source/dnode/mgmt/impl/test/sut/inc/sut.h
source/dnode/mgmt/impl/test/sut/inc/sut.h
+1
-1
source/libs/index/test/fstUT.cc
source/libs/index/test/fstUT.cc
+1
-1
source/libs/transport/test/transUT.cc
source/libs/transport/test/transUT.cc
+1
-1
source/util/src/compare.c
source/util/src/compare.c
+1
-1
source/util/src/tcache.c
source/util/src/tcache.c
+1
-1
source/util/src/tcompression.c
source/util/src/tcompression.c
+1
-1
source/util/src/tconfig.c
source/util/src/tconfig.c
+1
-1
source/util/src/terror.c
source/util/src/terror.c
+24
-27
source/util/src/tfile.c
source/util/src/tfile.c
+1
-1
source/util/src/thash.c
source/util/src/thash.c
+1
-1
source/util/src/tidpool.c
source/util/src/tidpool.c
+1
-2
source/util/src/tlog.c
source/util/src/tlog.c
+55
-57
source/util/src/tlosertree.c
source/util/src/tlosertree.c
+1
-1
source/util/src/tmempool.c
source/util/src/tmempool.c
+1
-2
source/util/src/tpagedbuf.c
source/util/src/tpagedbuf.c
+1
-2
source/util/src/tqueue.c
source/util/src/tqueue.c
+1
-1
source/util/src/tref.c
source/util/src/tref.c
+2
-1
source/util/src/tsched.c
source/util/src/tsched.c
+1
-2
source/util/src/tskiplist.c
source/util/src/tskiplist.c
+1
-3
source/util/src/tstep.c
source/util/src/tstep.c
+1
-2
source/util/src/tthread.c
source/util/src/tthread.c
+1
-2
source/util/src/tversion.c
source/util/src/tversion.c
+0
-1
source/util/src/tworker.c
source/util/src/tworker.c
+1
-1
source/util/test/trefTest.c
source/util/test/trefTest.c
+1
-1
tools/shell/src/backup/tnettest.c
tools/shell/src/backup/tnettest.c
+1
-1
tools/shell/src/shellLinux.c
tools/shell/src/shellLinux.c
+1
-1
未找到文件。
include/util/compare.h
浏览文件 @
29afc80f
...
...
@@ -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
...
...
include/util/taoserror.h
浏览文件 @
29afc80f
此差异已折叠。
点击以展开。
include/util/tlog.h
浏览文件 @
29afc80f
...
...
@@ -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
(
u
nsigned
char
*
msg
,
int32_t
len
);
void
taosDumpData
(
u
int8_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
...
...
include/util/ulog.h
已删除
100644 → 0
浏览文件 @
2d063326
/*
* 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*/
source/common/src/tdataformat.c
浏览文件 @
29afc80f
...
...
@@ -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
...
...
source/common/src/tglobal.c
浏览文件 @
29afc80f
...
...
@@ -24,7 +24,6 @@
#include "tglobal.h"
#include "tlog.h"
#include "tutil.h"
#include "ulog.h"
SConfig
*
tsCfg
=
NULL
;
...
...
source/dnode/mgmt/daemon/inc/dmnInt.h
浏览文件 @
29afc80f
...
...
@@ -21,7 +21,7 @@
#include "dnode.h"
#include "taoserror.h"
#include "tglobal.h"
#include "
u
log.h"
#include "
t
log.h"
#include "version.h"
#ifdef __cplusplus
...
...
source/dnode/mgmt/impl/test/sut/inc/sut.h
浏览文件 @
29afc80f
...
...
@@ -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:
...
...
source/libs/index/test/fstUT.cc
浏览文件 @
29afc80f
...
...
@@ -15,7 +15,7 @@
#include "tglobal.h"
#include "tskiplist.h"
#include "tutil.h"
#include "
u
log.h"
#include "
t
log.h"
static
std
::
string
dir
=
"/tmp/index"
;
...
...
source/libs/transport/test/transUT.cc
浏览文件 @
29afc80f
...
...
@@ -18,7 +18,7 @@
#include "tep.h"
#include "tglobal.h"
#include "trpc.h"
#include "
u
log.h"
#include "
t
log.h"
using
namespace
std
;
const
char
*
label
=
"APP"
;
...
...
source/util/src/compare.c
浏览文件 @
29afc80f
...
...
@@ -22,7 +22,7 @@
#include "regex.h"
#include "thash.h"
#include "types.h"
#include "
u
log.h"
#include "
t
log.h"
#include "tdef.h"
#include "taos.h"
...
...
source/util/src/tcache.c
浏览文件 @
29afc80f
...
...
@@ -15,7 +15,7 @@
#define _DEFAULT_SOURCE
#include "os.h"
#include "
u
log.h"
#include "
t
log.h"
#include "ttimer.h"
#include "tutil.h"
#include "tcache.h"
...
...
source/util/src/tcompression.c
浏览文件 @
29afc80f
...
...
@@ -53,7 +53,7 @@
#include "td_sz.h"
#endif
#include "tcompression.h"
#include "
u
log.h"
#include "
t
log.h"
static
const
int
TEST_NUMBER
=
1
;
#define is_bigendian() ((*(char *)&TEST_NUMBER) == 0)
...
...
source/util/src/tconfig.c
浏览文件 @
29afc80f
...
...
@@ -19,7 +19,7 @@
#include "tcfg.h"
#include "thash.h"
#include "tutil.h"
#include "
u
log.h"
#include "
t
log.h"
#define CFG_NAME_PRINT_LEN 24
#define CFG_SRC_PRINT_LEN 12
...
...
source/util/src/terror.c
浏览文件 @
29afc80f
...
...
@@ -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
t
sCompareTaosError
(
const
void
*
a
,
const
void
*
b
)
{
static
int
32_t
tao
sCompareTaosError
(
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
]),
t
sCompareTaosError
);
qsort
(
errors
,
sizeof
(
errors
)
/
sizeof
(
errors
[
0
]),
sizeof
(
errors
[
0
]),
tao
sCompareTaosError
);
}
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
;
...
...
source/util/src/tfile.c
浏览文件 @
29afc80f
...
...
@@ -18,7 +18,7 @@
#include "taoserror.h"
#include "tref.h"
#include "tutil.h"
#include "
u
log.h"
#include "
t
log.h"
static
int32_t
tsFileRsetId
=
-
1
;
...
...
source/util/src/thash.c
浏览文件 @
29afc80f
...
...
@@ -15,7 +15,7 @@
#include "os.h"
#include "thash.h"
#include "
u
log.h"
#include "
t
log.h"
#include "taos.h"
#include "tdef.h"
...
...
source/util/src/tidpool.c
浏览文件 @
29afc80f
...
...
@@ -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
;
...
...
source/util/src/tlog.c
浏览文件 @
29afc80f
...
...
@@ -14,32 +14,30 @@
*/
#define _DEFAULT_SOURCE
#include "tlog.h"
#include "os.h"
#include "tutil.h"
#include "
u
log.h"
#include "
t
log.h"
#define
MAX_LOGLINE_SIZE
(1000)
#define
MAX_LOGLINE_BUFFER_SIZE (MAX_LOG
LINE_SIZE + 10)
#define
MAX_LOGLINE_CONTENT_SIZE (MAX_LOG
LINE_SIZE - 100)
#define
MAX_LOGLINE_DUMP_SIZE
(65 * 1024)
#define
MAX_LOGLINE_DUMP_BUFFER_SIZE (MAX_LOG
LINE_DUMP_SIZE + 10)
#define
MAX_LOGLINE_DUMP_CONTENT_SIZE (MAX_LOG
LINE_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_LOG
LINE_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_LOG
LINE_CONTENT_SIZE
,
format
,
argpointer
);
int32_t
writeLen
=
vsnprintf
(
buffer
+
len
,
LOG_MAX_
LINE_CONTENT_SIZE
,
format
,
argpointer
);
if
(
writeLen
<=
0
)
{
char
tmp
[
MAX_LOG
LINE_DUMP_BUFFER_SIZE
]
=
{
0
};
writeLen
=
vsnprintf
(
tmp
,
MAX_LOG
LINE_DUMP_CONTENT_SIZE
,
format
,
argpointer
);
strncpy
(
buffer
+
len
,
tmp
,
MAX_LOG
LINE_CONTENT_SIZE
);
len
+=
MAX_LOG
LINE_CONTENT_SIZE
;
}
else
if
(
writeLen
>=
MAX_LOG
LINE_CONTENT_SIZE
)
{
len
+=
MAX_LOG
LINE_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_LOG
LINE_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_LOG
LINE_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_LOG
LINE_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_LOG
LINE_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
;
...
...
source/util/src/tlosertree.c
浏览文件 @
29afc80f
...
...
@@ -14,7 +14,7 @@
*/
#include "os.h"
#include "
u
log.h"
#include "
t
log.h"
#include "tlosertree.h"
#include "taoserror.h"
...
...
source/util/src/tmempool.c
浏览文件 @
29afc80f
...
...
@@ -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"
...
...
source/util/src/tpagedbuf.c
浏览文件 @
29afc80f
#include "os.h"
#include "ulog.h"
#include "tlog.h"
#include "tpagedbuf.h"
#include "taoserror.h"
#include "tcompression.h"
...
...
source/util/src/tqueue.c
浏览文件 @
29afc80f
...
...
@@ -16,7 +16,7 @@
#define _DEFAULT_SOURCE
#include "tqueue.h"
#include "taoserror.h"
#include "
u
log.h"
#include "
t
log.h"
typedef
struct
STaosQnode
STaosQnode
;
...
...
source/util/src/tref.c
浏览文件 @
29afc80f
...
...
@@ -14,8 +14,9 @@
*/
#include "os.h"
#include "taoserror.h"
#include "
u
log.h"
#include "
t
log.h"
#include "tutil.h"
#define TSDB_REF_OBJECTS 50
...
...
source/util/src/tsched.c
浏览文件 @
29afc80f
...
...
@@ -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 "
u
log.h"
#include "
t
log.h"
#include "tsched.h"
#include "ttimer.h"
...
...
source/util/src/tskiplist.c
浏览文件 @
29afc80f
...
...
@@ -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 "
u
log.h"
#include "
t
log.h"
static
int
initForwardBackwardPtr
(
SSkipList
*
pSkipList
);
static
SSkipListNode
*
getPriorNode
(
SSkipList
*
pSkipList
,
const
char
*
val
,
int32_t
order
,
SSkipListNode
**
pCur
);
...
...
source/util/src/tstep.c
浏览文件 @
29afc80f
...
...
@@ -14,8 +14,7 @@
*/
#define _DEFAULT_SOURCE
#include "os.h"
#include "ulog.h"
#include "tlog.h"
#include "taoserror.h"
#include "tstep.h"
...
...
source/util/src/tthread.c
浏览文件 @
29afc80f
...
...
@@ -14,11 +14,10 @@
*/
#include "tthread.h"
#include "os.h"
#include "taoserror.h"
#include "tdef.h"
#include "tutil.h"
#include "
u
log.h"
#include "
t
log.h"
// create new thread
pthread_t
*
taosCreateThread
(
void
*
(
*
__start_routine
)(
void
*
),
void
*
param
)
{
...
...
source/util/src/tversion.c
浏览文件 @
29afc80f
...
...
@@ -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
)
{
...
...
source/util/src/tworker.c
浏览文件 @
29afc80f
...
...
@@ -16,7 +16,7 @@
#define _DEFAULT_SOURCE
#include "tworker.h"
#include "taoserror.h"
#include "
u
log.h"
#include "
t
log.h"
typedef
void
*
(
*
ThreadFp
)(
void
*
param
);
...
...
source/util/test/trefTest.c
浏览文件 @
29afc80f
...
...
@@ -8,7 +8,7 @@
#include "tlog.h"
#include "tglobal.h"
#include "taoserror.h"
#include "
u
log.h"
#include "
t
log.h"
typedef
struct
{
int
refNum
;
...
...
tools/shell/src/backup/tnettest.c
浏览文件 @
29afc80f
...
...
@@ -18,7 +18,7 @@
#include "taosdef.h"
#include "tmsg.h"
#include "taoserror.h"
#include "t
u
log.h"
#include "tlog.h"
#include "tglobal.h"
#include "tsocket.h"
#include "trpc.h"
...
...
tools/shell/src/shellLinux.c
浏览文件 @
29afc80f
...
...
@@ -19,7 +19,7 @@
#include "shell.h"
#include "shellCommand.h"
#include "tkey.h"
#include "
u
log.h"
#include "
t
log.h"
#include "version.h"
#include <wordexp.h>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录