Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
50e91af9
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
50e91af9
编写于
6月 28, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-526] change sdb log
上级
7b7a57b5
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
41 addition
and
30 deletion
+41
-30
documentation/tdenginedocs-cn/administrator/index.html
documentation/tdenginedocs-cn/administrator/index.html
+1
-1
src/common/inc/tglobal.h
src/common/inc/tglobal.h
+1
-0
src/common/src/tglobal.c
src/common/src/tglobal.c
+13
-0
src/mnode/src/mnodeSdb.c
src/mnode/src/mnodeSdb.c
+10
-14
src/wal/src/walMain.c
src/wal/src/walMain.c
+16
-15
未找到文件。
documentation/tdenginedocs-cn/administrator/index.html
浏览文件 @
50e91af9
...
...
@@ -55,7 +55,7 @@
<li>
enableMonitor: 系统监测标志位,0:关闭,1:打开
</li>
<li>
logDir: 日志文件目录,缺省是/var/log/taos
</li>
<li>
numOfLogLines:日志文件的最大行数
</li>
<li>
debugFlag: 系统debug日志开关,131:仅错误和报警信息,135:
所有
</li>
<li>
debugFlag: 系统debug日志开关,131:仅错误和报警信息,135:
调试信息,151:非常详细的调试信息
</li>
</ul>
<p>
不同应用场景的数据往往具有不同的数据特征,比如保留天数、副本数、采集频次、记录大小、采集点的数量、压缩等都可完全不同。为获得在存储上的最高效率,TDengine提供如下存储相关的系统配置参数:
</p>
<ul>
...
...
src/common/inc/tglobal.h
浏览文件 @
50e91af9
...
...
@@ -160,6 +160,7 @@ extern int32_t uDebugFlag;
extern
int32_t
rpcDebugFlag
;
extern
int32_t
odbcDebugFlag
;
extern
int32_t
qDebugFlag
;
extern
int32_t
wDebugFlag
;
extern
int32_t
debugFlag
;
#define NEEDTO_COMPRESSS_MSG(size) (tsCompressMsgSize != -1 && (size) > tsCompressMsgSize)
...
...
src/common/src/tglobal.c
浏览文件 @
50e91af9
...
...
@@ -194,6 +194,7 @@ int32_t rpcDebugFlag = 135;
int32_t
uDebugFlag
=
131
;
int32_t
debugFlag
=
131
;
int32_t
sDebugFlag
=
135
;
int32_t
wDebugFlag
=
135
;
int32_t
tsdbDebugFlag
=
135
;
static
pthread_once_t
tsInitGlobalCfgOnce
=
PTHREAD_ONCE_INIT
;
...
...
@@ -213,6 +214,7 @@ void taosSetAllDebugFlag() {
rpcDebugFlag
=
debugFlag
;
uDebugFlag
=
debugFlag
;
sDebugFlag
=
debugFlag
;
wDebugFlag
=
debugFlag
;
tsdbDebugFlag
=
debugFlag
;
qDebugFlag
=
debugFlag
;
}
...
...
@@ -977,6 +979,17 @@ static void doInitGlobalConfig() {
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
cfg
.
option
=
"wDebugFlag"
;
cfg
.
ptr
=
&
wDebugFlag
;
cfg
.
valType
=
TAOS_CFG_VTYPE_INT32
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_LOG
;
cfg
.
minValue
=
0
;
cfg
.
maxValue
=
255
;
cfg
.
ptrLength
=
0
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
cfg
.
option
=
"sdbDebugFlag"
;
cfg
.
ptr
=
&
sdbDebugFlag
;
cfg
.
valType
=
TAOS_CFG_VTYPE_INT32
;
...
...
src/mnode/src/mnodeSdb.c
浏览文件 @
50e91af9
...
...
@@ -181,7 +181,7 @@ static int32_t sdbInitWal() {
return
-
1
;
}
sdb
Debug
(
"open sdb wal for restore"
);
sdb
Info
(
"open sdb wal for restore"
);
walRestore
(
tsSdbObj
.
wal
,
NULL
,
sdbWrite
);
return
0
;
}
...
...
@@ -201,7 +201,7 @@ static void sdbRestoreTables() {
sdbDebug
(
"table:%s, is restored, numOfRows:%"
PRId64
,
pTable
->
tableName
,
pTable
->
numOfRows
);
}
sdb
Debug
(
"sdb is restored, version:%"
PRId64
" totalRows:%d numOfTables:%d"
,
tsSdbObj
.
version
,
totalRows
,
numOfTables
);
sdb
Info
(
"sdb is restored, version:%"
PRId64
" totalRows:%d numOfTables:%d"
,
tsSdbObj
.
version
,
totalRows
,
numOfTables
);
}
void
sdbUpdateMnodeRoles
()
{
...
...
@@ -388,9 +388,7 @@ void sdbIncRef(void *handle, void *pObj) {
SSdbTable
*
pTable
=
handle
;
int32_t
*
pRefCount
=
(
int32_t
*
)(
pObj
+
pTable
->
refCountPos
);
atomic_add_fetch_32
(
pRefCount
,
1
);
if
(
0
&&
(
pTable
->
tableId
==
SDB_TABLE_CTABLE
||
pTable
->
tableId
==
SDB_TABLE_DB
))
{
sdbDebug
(
"add ref to table:%s record:%p:%s:%d"
,
pTable
->
tableName
,
pObj
,
sdbGetKeyStrFromObj
(
pTable
,
pObj
),
*
pRefCount
);
}
sdbTrace
(
"add ref to table:%s record:%p:%s:%d"
,
pTable
->
tableName
,
pObj
,
sdbGetKeyStrFromObj
(
pTable
,
pObj
),
*
pRefCount
);
}
void
sdbDecRef
(
void
*
handle
,
void
*
pObj
)
{
...
...
@@ -399,13 +397,11 @@ void sdbDecRef(void *handle, void *pObj) {
SSdbTable
*
pTable
=
handle
;
int32_t
*
pRefCount
=
(
int32_t
*
)(
pObj
+
pTable
->
refCountPos
);
int32_t
refCount
=
atomic_sub_fetch_32
(
pRefCount
,
1
);
if
(
0
&&
(
pTable
->
tableId
==
SDB_TABLE_CTABLE
||
pTable
->
tableId
==
SDB_TABLE_DB
))
{
sdbDebug
(
"def ref of table:%s record:%p:%s:%d"
,
pTable
->
tableName
,
pObj
,
sdbGetKeyStrFromObj
(
pTable
,
pObj
),
*
pRefCount
);
}
sdbTrace
(
"def ref of table:%s record:%p:%s:%d"
,
pTable
->
tableName
,
pObj
,
sdbGetKeyStrFromObj
(
pTable
,
pObj
),
*
pRefCount
);
int8_t
*
updateEnd
=
pObj
+
pTable
->
refCountPos
-
1
;
if
(
refCount
<=
0
&&
*
updateEnd
)
{
sdb
Debug
(
"table:%s, record:%p:%s:%d is destroyed"
,
pTable
->
tableName
,
pObj
,
sdbGetKeyStrFromObj
(
pTable
,
pObj
),
*
pRefCount
);
sdb
Trace
(
"table:%s, record:%p:%s:%d is destroyed"
,
pTable
->
tableName
,
pObj
,
sdbGetKeyStrFromObj
(
pTable
,
pObj
),
*
pRefCount
);
SSdbOper
oper
=
{.
pObj
=
pObj
};
(
*
pTable
->
destroyFp
)(
&
oper
);
}
...
...
@@ -551,7 +547,7 @@ static int sdbWrite(void *param, void *data, int type) {
// from app, oper is created
if
(
pOper
!=
NULL
)
{
sdb
Debug
(
"record from app is disposed, table:%s action:%s record:%s version:%"
PRIu64
" result:%s"
,
sdb
Trace
(
"record from app is disposed, table:%s action:%s record:%s version:%"
PRIu64
" result:%s"
,
pTable
->
tableName
,
sdbGetActionStr
(
action
),
sdbGetKeyStr
(
pTable
,
pHead
->
cont
),
pHead
->
version
,
tstrerror
(
code
));
return
code
;
...
...
@@ -559,11 +555,11 @@ static int sdbWrite(void *param, void *data, int type) {
// from wal or forward msg, oper not created, should add into hash
if
(
tsSdbObj
.
sync
!=
NULL
)
{
sdb
Debug
(
"record from wal forward is disposed, table:%s action:%s record:%s version:%"
PRIu64
" confirm it"
,
sdb
Trace
(
"record from wal forward is disposed, table:%s action:%s record:%s version:%"
PRIu64
" confirm it"
,
pTable
->
tableName
,
sdbGetActionStr
(
action
),
sdbGetKeyStr
(
pTable
,
pHead
->
cont
),
pHead
->
version
);
syncConfirmForward
(
tsSdbObj
.
sync
,
pHead
->
version
,
code
);
}
else
{
sdb
Debug
(
"record from wal restore is disposed, table:%s action:%s record:%s version:%"
PRIu64
,
pTable
->
tableName
,
sdb
Trace
(
"record from wal restore is disposed, table:%s action:%s record:%s version:%"
PRIu64
,
pTable
->
tableName
,
sdbGetActionStr
(
action
),
sdbGetKeyStr
(
pTable
,
pHead
->
cont
),
pHead
->
version
);
}
...
...
@@ -971,12 +967,12 @@ static void *sdbWorkerFp(void *param) {
if
(
type
==
TAOS_QTYPE_RPC
)
{
pOper
=
(
SSdbOper
*
)
item
;
if
(
pOper
!=
NULL
&&
pOper
->
cb
!=
NULL
)
{
sdb
Debug
(
"app:%p:%p, will do callback func, index:%d"
,
pOper
->
pMsg
->
rpcMsg
.
ahandle
,
pOper
->
pMsg
,
i
);
sdb
Trace
(
"app:%p:%p, will do callback func, index:%d"
,
pOper
->
pMsg
->
rpcMsg
.
ahandle
,
pOper
->
pMsg
,
i
);
pOper
->
retCode
=
(
*
pOper
->
cb
)(
pOper
->
pMsg
,
pOper
->
retCode
);
}
if
(
pOper
!=
NULL
&&
pOper
->
pMsg
!=
NULL
)
{
sdb
Debug
(
"app:%p:%p, msg is processed, result:%s"
,
pOper
->
pMsg
->
rpcMsg
.
ahandle
,
pOper
->
pMsg
,
sdb
Trace
(
"app:%p:%p, msg is processed, result:%s"
,
pOper
->
pMsg
->
rpcMsg
.
ahandle
,
pOper
->
pMsg
,
tstrerror
(
pOper
->
retCode
));
}
...
...
src/wal/src/walMain.c
浏览文件 @
50e91af9
...
...
@@ -30,10 +30,13 @@
#include "tqueue.h"
#define walPrefix "wal"
#define wError(...) if (wDebugFlag & DEBUG_ERROR) {taosPrintLog("ERROR WAL ", wDebugFlag, __VA_ARGS__);}
#define wWarn(...) if (wDebugFlag & DEBUG_WARN) {taosPrintLog("WARN WAL ", wDebugFlag, __VA_ARGS__);}
#define wTrace(...) if (wDebugFlag & DEBUG_TRACE) {taosPrintLog("WAL ", wDebugFlag, __VA_ARGS__);}
#define wPrint(...) {taosPrintLog("WAL ", 255, __VA_ARGS__);}
#define wFatal(...) { if (wDebugFlag & DEBUG_FATAL) { taosPrintLog("WAL FATAL ", wDebugFlag, __VA_ARGS__); }}
#define wError(...) { if (wDebugFlag & DEBUG_ERROR) { taosPrintLog("WAL ERROR ", wDebugFlag, __VA_ARGS__); }}
#define wWarn(...) { if (wDebugFlag & DEBUG_WARN) { taosPrintLog("WAL WARN ", wDebugFlag, __VA_ARGS__); }}
#define wInfo(...) { if (wDebugFlag & DEBUG_INFO) { taosPrintLog("WAL INFO ", wDebugFlag, __VA_ARGS__); }}
#define wDebug(...) { if (wDebugFlag & DEBUG_DEBUG) { taosPrintLog("WAL DEBUG ", wDebugFlag, __VA_ARGS__); }}
#define wTrace(...) { if (wDebugFlag & DEBUG_TRACE) { taosPrintLog("WAL TRACE ", wDebugFlag, __VA_ARGS__); }}
typedef
struct
{
uint64_t
version
;
...
...
@@ -48,8 +51,6 @@ typedef struct {
pthread_mutex_t
mutex
;
}
SWal
;
int
wDebugFlag
=
135
;
static
uint32_t
walSignature
=
0xFAFBFDFE
;
static
int
walHandleExistingFiles
(
const
char
*
path
);
static
int
walRestoreWalFile
(
SWal
*
pWal
,
void
*
pVnode
,
FWalWrite
writeFp
);
...
...
@@ -92,7 +93,7 @@ void *walOpen(const char *path, const SWalCfg *pCfg) {
pWal
=
NULL
;
}
if
(
pWal
)
w
Trace
(
"wal:%s, it is open, level:%d"
,
path
,
pWal
->
level
);
if
(
pWal
)
w
Debug
(
"wal:%s, it is open, level:%d"
,
path
,
pWal
->
level
);
return
pWal
;
}
...
...
@@ -109,11 +110,11 @@ void walClose(void *handle) {
if
(
remove
(
pWal
->
name
)
<
0
)
{
wError
(
"wal:%s, failed to remove"
,
pWal
->
name
);
}
else
{
w
Trace
(
"wal:%s, it is removed"
,
pWal
->
name
);
w
Debug
(
"wal:%s, it is removed"
,
pWal
->
name
);
}
}
}
else
{
w
Trace
(
"wal:%s, it is closed and kept"
,
pWal
->
name
);
w
Debug
(
"wal:%s, it is closed and kept"
,
pWal
->
name
);
}
pthread_mutex_destroy
(
&
pWal
->
mutex
);
...
...
@@ -132,7 +133,7 @@ int walRenew(void *handle) {
if
(
pWal
->
fd
>=
0
)
{
close
(
pWal
->
fd
);
pWal
->
id
++
;
w
Trace
(
"wal:%s, it is closed"
,
pWal
->
name
);
w
Debug
(
"wal:%s, it is closed"
,
pWal
->
name
);
}
pWal
->
num
++
;
...
...
@@ -144,7 +145,7 @@ int walRenew(void *handle) {
wError
(
"wal:%s, failed to open(%s)"
,
pWal
->
name
,
strerror
(
errno
));
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
}
else
{
w
Trace
(
"wal:%s, it is created"
,
pWal
->
name
);
w
Debug
(
"wal:%s, it is created"
,
pWal
->
name
);
if
(
pWal
->
num
>
pWal
->
max
)
{
// remove the oldest wal file
...
...
@@ -153,7 +154,7 @@ int walRenew(void *handle) {
if
(
remove
(
name
)
<
0
)
{
wError
(
"wal:%s, failed to remove(%s)"
,
name
,
strerror
(
errno
));
}
else
{
w
Trace
(
"wal:%s, it is removed"
,
name
);
w
Debug
(
"wal:%s, it is removed"
,
name
);
}
pWal
->
num
--
;
...
...
@@ -242,7 +243,7 @@ int walRestore(void *handle, void *pVnode, int (*writeFp)(void *, void *, int))
wError
(
"wal:%s, messed up, count:%d max:%d min:%d"
,
opath
,
count
,
maxId
,
minId
);
terrno
=
TSDB_CODE_WAL_APP_ERROR
;
}
else
{
w
Trace
(
"wal:%s, %d files will be restored"
,
opath
,
count
);
w
Debug
(
"wal:%s, %d files will be restored"
,
opath
,
count
);
for
(
index
=
minId
;
index
<=
maxId
;
++
index
)
{
snprintf
(
pWal
->
name
,
sizeof
(
pWal
->
name
),
"%s/%s%d"
,
opath
,
walPrefix
,
index
);
...
...
@@ -321,7 +322,7 @@ static int walRestoreWalFile(SWal *pWal, void *pVnode, FWalWrite writeFp) {
return
terrno
;
}
w
Trace
(
"wal:%s, start to restore"
,
name
);
w
Debug
(
"wal:%s, start to restore"
,
name
);
while
(
1
)
{
int
ret
=
read
(
fd
,
pHead
,
sizeof
(
SWalHead
));
...
...
@@ -395,7 +396,7 @@ int walHandleExistingFiles(const char *path) {
}
}
w
Trace
(
"wal:%s, %d files are moved for restoration"
,
path
,
count
);
w
Debug
(
"wal:%s, %d files are moved for restoration"
,
path
,
count
);
}
closedir
(
dir
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录