Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
11e0df78
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
11e0df78
编写于
12月 22, 2021
作者:
C
Cary Xu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TS-953]<enhance>:add specificLogType to control createTable log
上级
2409a9d0
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
70 addition
and
11 deletion
+70
-11
src/common/inc/tglobal.h
src/common/inc/tglobal.h
+3
-0
src/common/src/tglobal.c
src/common/src/tglobal.c
+14
-0
src/dnode/src/dnodeVWrite.c
src/dnode/src/dnodeVWrite.c
+10
-3
src/inc/taosdef.h
src/inc/taosdef.h
+5
-0
src/mnode/src/mnodeTable.c
src/mnode/src/mnodeTable.c
+9
-4
src/rpc/src/rpcMain.c
src/rpc/src/rpcMain.c
+10
-0
src/tsdb/src/tsdbMeta.c
src/tsdb/src/tsdbMeta.c
+2
-2
src/util/inc/tconfig.h
src/util/inc/tconfig.h
+1
-1
src/vnode/src/vnodeWrite.c
src/vnode/src/vnodeWrite.c
+16
-1
未找到文件。
src/common/inc/tglobal.h
浏览文件 @
11e0df78
...
...
@@ -211,6 +211,8 @@ extern int32_t wDebugFlag;
extern
int32_t
cqDebugFlag
;
extern
int32_t
debugFlag
;
extern
int32_t
tsSpecificLogType
;
extern
int8_t
tsClientMerge
;
#ifdef TD_TSZ
...
...
@@ -245,6 +247,7 @@ bool taosCheckBalanceCfgOptions(const char *option, int32_t *vnodeId, int32_t
void
taosAddDataDir
(
int
index
,
char
*
v1
,
int
level
,
int
primary
);
void
taosReadDataDirCfg
(
char
*
v1
,
char
*
v2
,
char
*
v3
);
void
taosPrintDataDirCfg
();
bool
taosPrintCreateTable
();
#ifdef __cplusplus
}
...
...
src/common/src/tglobal.c
浏览文件 @
11e0df78
...
...
@@ -255,6 +255,8 @@ int32_t tsdbDebugFlag = 131;
int32_t
cqDebugFlag
=
131
;
int32_t
fsDebugFlag
=
135
;
int32_t
tsSpecificLogType
=
0
;
// show specific log(bit operation): 0x01 create table, 0x02 ...
int8_t
tsClientMerge
=
0
;
#ifdef TD_TSZ
...
...
@@ -1620,6 +1622,16 @@ static void doInitGlobalConfig(void) {
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
cfg
.
option
=
"specificLogType"
;
cfg
.
ptr
=
&
tsSpecificLogType
;
cfg
.
valType
=
TAOS_CFG_VTYPE_INT32
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_SHOW
;
cfg
.
minValue
=
0
;
cfg
.
maxValue
=
2147483647
;
cfg
.
ptrLength
=
0
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
#ifdef TD_TSZ
// lossy compress
cfg
.
option
=
"lossyColumns"
;
...
...
@@ -1819,3 +1831,5 @@ bool taosCheckBalanceCfgOptions(const char *option, int32_t *vnodeId, int32_t *d
return
true
;
}
bool
taosPrintCreateTable
()
{
return
(
tsSpecificLogType
&
LOG_CREATE_TABLE
)
?
true
:
false
;
}
src/dnode/src/dnodeVWrite.c
浏览文件 @
11e0df78
...
...
@@ -203,9 +203,16 @@ static void *dnodeProcessVWriteQueue(void *wparam) {
bool
forceFsync
=
false
;
for
(
int32_t
i
=
0
;
i
<
numOfMsgs
;
++
i
)
{
taosGetQitem
(
pWorker
->
qall
,
&
qtype
,
(
void
**
)
&
pWrite
);
dTrace
(
"msg:%p, app:%p type:%s will be processed in vwrite queue, qtype:%s hver:%"
PRIu64
,
pWrite
,
pWrite
->
rpcMsg
.
ahandle
,
taosMsg
[
pWrite
->
walHead
.
msgType
],
qtypeStr
[
qtype
],
pWrite
->
walHead
.
version
);
if
((
pWrite
->
walHead
.
msgType
==
TSDB_MSG_TYPE_MD_CREATE_TABLE
)
&&
taosPrintCreateTable
())
{
SMDCreateTableMsg
*
pMsg
=
(
SMDCreateTableMsg
*
)
pWrite
->
walHead
.
cont
;
dInfo
(
"msg:%p, app:%p type:%s for uid:%"
PRIu64
", tid:%"
PRIu32
" will be processed in vwrite queue, qtype:%s hver:%"
PRIu64
,
pWrite
,
pWrite
->
rpcMsg
.
ahandle
,
taosMsg
[
pWrite
->
walHead
.
msgType
],
pMsg
?
htobe64
(
pMsg
->
uid
)
:
-
1
,
pMsg
?
htonl
(
pMsg
->
tid
)
:
-
1
,
qtypeStr
[
qtype
],
pWrite
->
walHead
.
version
);
}
else
{
dTrace
(
"msg:%p, app:%p type:%s will be processed in vwrite queue, qtype:%s hver:%"
PRIu64
,
pWrite
,
pWrite
->
rpcMsg
.
ahandle
,
taosMsg
[
pWrite
->
walHead
.
msgType
],
qtypeStr
[
qtype
],
pWrite
->
walHead
.
version
);
}
pWrite
->
code
=
vnodeProcessWrite
(
pVnode
,
&
pWrite
->
walHead
,
qtype
,
pWrite
);
if
(
pWrite
->
code
<=
0
)
atomic_add_fetch_32
(
&
pWrite
->
processedCount
,
1
);
if
(
pWrite
->
code
>
0
)
pWrite
->
code
=
0
;
...
...
src/inc/taosdef.h
浏览文件 @
11e0df78
...
...
@@ -451,6 +451,11 @@ typedef enum {
TD_ROW_PARTIAL_UPDATE
=
2
}
TDUpdateConfig
;
typedef
enum
{
LOG_CREATE_TABLE
=
0x01
,
// ...
}
ESpecificLogType
;
// bit operation
extern
char
*
qtypeStr
[];
#ifdef __cplusplus
...
...
src/mnode/src/mnodeTable.c
浏览文件 @
11e0df78
...
...
@@ -939,9 +939,14 @@ static int32_t mnodeProcessCreateTableMsg(SMnodeMsg *pMsg) {
p
->
tableName
,
pMsg
->
rpcMsg
.
handle
);
return
mnodeProcessCreateSuperTableMsg
(
pMsg
);
}
else
{
mDebug
(
"msg:%p, app:%p table:%s, create ctable msg is received from thandle:%p"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
mDebug
(
"
p
msg:%p, app:%p table:%s, create ctable msg is received from thandle:%p"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
p
->
tableName
,
pMsg
->
rpcMsg
.
handle
);
return
mnodeProcessCreateChildTableMsg
(
pMsg
);
int32_t
code
=
mnodeProcessCreateChildTableMsg
(
pMsg
);
if
(
code
!=
TSDB_CODE_MND_ACTION_IN_PROGRESS
&&
code
!=
TSDB_CODE_SUCCESS
)
{
mError
(
"msg:%p, app:%p table:%s, failed to create ctable for thandle:%p since %s"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
p
->
tableName
,
pMsg
->
rpcMsg
.
handle
,
tstrerror
(
code
));
}
return
code
;
}
}
...
...
@@ -2201,10 +2206,10 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) {
int32_t
code
=
sdbInsertRow
(
&
desc
);
if
(
code
!=
TSDB_CODE_SUCCESS
&&
code
!=
TSDB_CODE_MND_ACTION_IN_PROGRESS
)
{
mError
(
"msg:%p, app:%p table:%s, failed to create, vgId:%d sid:%d uid:%"
PRIu64
" reason:%s"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
pCreate
->
tableName
,
pVgroup
->
vgId
,
pTable
->
tid
,
pTable
->
uid
,
tstrerror
(
code
));
mnodeDestroyChildTable
(
pTable
);
pMsg
->
pTable
=
NULL
;
mError
(
"msg:%p, app:%p table:%s, failed to create, reason:%s"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
pCreate
->
tableName
,
tstrerror
(
code
));
}
else
{
mDebug
(
"msg:%p, app:%p table:%s, allocated in vgroup, vgId:%d sid:%d uid:%"
PRIu64
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
pTable
->
info
.
tableId
,
pVgroup
->
vgId
,
pTable
->
tid
,
pTable
->
uid
);
...
...
src/rpc/src/rpcMain.c
浏览文件 @
11e0df78
...
...
@@ -1161,6 +1161,11 @@ static void rpcProcessIncomingMsg(SRpcConn *pConn, SRpcHead *pHead, SRpcReqConte
rpcAddRef
(
pRpc
);
// add the refCount for requests
// notify the server app
if
((
rpcMsg
.
msgType
==
TSDB_MSG_TYPE_MD_CREATE_TABLE
)
&&
taosPrintCreateTable
())
{
SMDCreateTableMsg
*
pMsg
=
(
SMDCreateTableMsg
*
)
rpcMsg
.
pCont
;
tInfo
(
"%p, msg:%s received, uid:%"
PRIu64
", tid:%"
PRIu32
,
rpcMsg
.
ahandle
,
taosMsg
[
rpcMsg
.
msgType
],
htobe64
(
pMsg
->
uid
),
htonl
(
pMsg
->
tid
));
}
(
*
(
pRpc
->
cfp
))(
&
rpcMsg
,
NULL
);
}
else
{
// it's a response
...
...
@@ -1348,6 +1353,10 @@ static void rpcSendMsgToPeer(SRpcConn *pConn, void *msg, int msgLen) {
}
//tTrace("connection type is: %d", pConn->connType);
if
((
pConn
->
outType
==
TSDB_MSG_TYPE_MD_CREATE_TABLE
)
&&
taosPrintCreateTable
())
{
tInfo
(
"%s, msg:%s is sent to 0x%x:%hu, code:0x%x len:%d sig:0x%08x:0x%08x:%d"
,
pConn
->
info
,
taosMsg
[
pHead
->
msgType
],
pConn
->
peerIp
,
pConn
->
peerPort
,
htonl
(
pHead
->
code
),
msgLen
,
pHead
->
sourceId
,
pHead
->
destId
,
pHead
->
tranId
);
}
writtenLen
=
(
*
taosSendData
[
pConn
->
connType
])(
pConn
->
peerIp
,
pConn
->
peerPort
,
pHead
,
msgLen
,
pConn
->
chandle
);
if
(
writtenLen
!=
msgLen
)
{
...
...
@@ -1363,6 +1372,7 @@ static void rpcProcessConnError(void *param, void *id) {
SRpcMsg
rpcMsg
;
if
(
pRpc
==
NULL
)
{
tError
(
"%p, pRpc is NULL"
,
pContext
->
ahandle
);
return
;
}
...
...
src/tsdb/src/tsdbMeta.c
浏览文件 @
11e0df78
...
...
@@ -58,7 +58,7 @@ int tsdbCreateTable(STsdbRepo *repo, STableCfg *pCfg) {
STable
*
pTable
=
NULL
;
if
(
tid
<
1
||
tid
>
TSDB_MAX_TABLES
)
{
tsdbError
(
"vgId:%d failed to create table since invalid tid %d
"
,
REPO_ID
(
pRepo
),
t
id
);
tsdbError
(
"vgId:%d failed to create table since invalid tid %d
uid%"
PRIu64
,
REPO_ID
(
pRepo
),
tid
,
pCfg
->
tableId
.
u
id
);
terrno
=
TSDB_CODE_TDB_IVD_CREATE_TABLE_INFO
;
goto
_err
;
}
...
...
@@ -942,7 +942,7 @@ static int tsdbAddTableToMeta(STsdbRepo *pRepo, STable *pTable, bool addIdx, boo
}
if
(
TABLE_TYPE
(
pTable
)
==
TSDB_CHILD_TABLE
&&
addIdx
)
{
// add STABLE to the index
if
(
tsdbAddTableIntoIndex
(
pMeta
,
pTable
,
true
)
<
0
)
{
tsdb
Debug
(
"vgId:%d failed to add table %s to meta while add table to index since %s"
,
REPO_ID
(
pRepo
),
tsdb
Error
(
"vgId:%d failed to add table %s to meta while add table to index since %s"
,
REPO_ID
(
pRepo
),
TABLE_CHAR_NAME
(
pTable
),
tstrerror
(
terrno
));
goto
_err
;
}
...
...
src/util/inc/tconfig.h
浏览文件 @
11e0df78
...
...
@@ -20,7 +20,7 @@
extern
"C"
{
#endif
#define TSDB_CFG_MAX_NUM 12
2
#define TSDB_CFG_MAX_NUM 12
3
#define TSDB_CFG_PRINT_LEN 23
#define TSDB_CFG_OPTION_LEN 24
#define TSDB_CFG_VALUE_LEN 41
...
...
src/vnode/src/vnodeWrite.c
浏览文件 @
11e0df78
...
...
@@ -112,6 +112,10 @@ int32_t vnodeProcessWrite(void *vparam, void *wparam, int32_t qtype, void *rpara
code
=
(
*
vnodeProcessWriteMsgFp
[
pHead
->
msgType
])(
pVnode
,
pHead
->
cont
,
pRspRet
);
if
(
code
<
0
)
{
if
(
syncCode
>
0
)
atomic_sub_fetch_32
(
&
pWrite
->
processedCount
,
1
);
vError
(
"app:%p, vgId:%d, hver:%"
PRIu64
" vver:%"
PRIu64
" msgType:% "
PRId8
", code:0x%x, processWrite failed since %s"
,
pWrite
->
rpcMsg
.
ahandle
,
pVnode
->
vgId
,
pHead
->
version
,
pVnode
->
version
,
pHead
->
msgType
,
code
,
tstrerror
(
code
));
return
code
;
}
...
...
@@ -170,17 +174,28 @@ static int32_t vnodeProcessSubmitMsg(SVnodeObj *pVnode, void *pCont, SRspRet *pR
static
int32_t
vnodeProcessCreateTableMsg
(
SVnodeObj
*
pVnode
,
void
*
pCont
,
SRspRet
*
pRet
)
{
int
code
=
TSDB_CODE_SUCCESS
;
STableCfg
*
pCfg
=
tsdbCreateTableCfgFromMsg
((
SMDCreateTableMsg
*
)
pCont
);
SMDCreateTableMsg
*
pMsg
=
(
SMDCreateTableMsg
*
)
pCont
;
STableCfg
*
pCfg
=
tsdbCreateTableCfgFromMsg
(
pMsg
);
if
(
pCfg
==
NULL
)
{
ASSERT
(
terrno
!=
0
);
vError
(
"vgId:%d, uid:%"
PRIu64
", tid:%"
PRIu32
", failed to create tableCfgFromMsg since %s"
,
pVnode
->
vgId
,
htobe64
(
pMsg
->
uid
),
htonl
(
pMsg
->
tid
),
tstrerror
(
terrno
));
return
terrno
;
}
if
(
tsdbCreateTable
(
pVnode
->
tsdb
,
pCfg
)
<
0
)
{
code
=
terrno
;
vError
(
"vgId:%d, uid:%"
PRIu64
", tid:%"
PRIu32
", failed to create table since %s"
,
pVnode
->
vgId
,
htobe64
(
pMsg
->
uid
),
htonl
(
pMsg
->
tid
),
tstrerror
(
terrno
));
ASSERT
(
code
!=
0
);
}
if
(
taosPrintCreateTable
())
{
vInfo
(
"vgId:%d, table[%s], uid:%"
PRIu64
", tid:%"
PRIu32
" is created successfully"
,
pVnode
->
vgId
,
pMsg
->
tableFname
,
htobe64
(
pMsg
->
uid
),
htonl
(
pMsg
->
tid
));
}
tsdbClearTableCfg
(
pCfg
);
return
code
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录