Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
6639ef6e
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
6639ef6e
编写于
3月 12, 2020
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix bug in dnode write module
上级
66e5cd34
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
62 addition
and
36 deletion
+62
-36
src/dnode/src/dnodeMClient.c
src/dnode/src/dnodeMClient.c
+1
-1
src/dnode/src/dnodeMnode.c
src/dnode/src/dnodeMnode.c
+1
-1
src/dnode/src/dnodeWrite.c
src/dnode/src/dnodeWrite.c
+28
-10
src/inc/taosmsg.h
src/inc/taosmsg.h
+9
-1
src/mnode/src/mgmtChildTable.c
src/mnode/src/mgmtChildTable.c
+1
-1
src/mnode/src/mgmtDClient.c
src/mnode/src/mgmtDClient.c
+1
-1
src/mnode/src/mgmtDServer.c
src/mnode/src/mgmtDServer.c
+1
-1
src/mnode/src/mgmtNormalTable.c
src/mnode/src/mgmtNormalTable.c
+1
-1
src/mnode/src/mgmtShell.c
src/mnode/src/mgmtShell.c
+2
-3
src/mnode/src/mgmtTable.c
src/mnode/src/mgmtTable.c
+13
-14
src/mnode/src/mgmtVgroup.c
src/mnode/src/mgmtVgroup.c
+4
-2
未找到文件。
src/dnode/src/dnodeMClient.c
浏览文件 @
6639ef6e
...
...
@@ -60,7 +60,7 @@ static void dnodeProcessRspFromMnode(SRpcMsg *pMsg) {
if
(
dnodeProcessMgmtRspFp
[
pMsg
->
msgType
])
{
(
*
dnodeProcessMgmtRspFp
[
pMsg
->
msgType
])(
pMsg
);
}
else
{
dError
(
"%s is not processed"
,
taosMsg
[
pMsg
->
msgType
]);
dError
(
"%s is not processed
in mclient
"
,
taosMsg
[
pMsg
->
msgType
]);
}
rpcFreeCont
(
pMsg
->
pCont
);
...
...
src/dnode/src/dnodeMnode.c
浏览文件 @
6639ef6e
...
...
@@ -81,7 +81,7 @@ static void dnodeProcessMsgFromMnode(SRpcMsg *pMsg) {
if
(
dnodeProcessMgmtMsgFp
[
pMsg
->
msgType
])
{
(
*
dnodeProcessMgmtMsgFp
[
pMsg
->
msgType
])(
pMsg
);
}
else
{
dError
(
"%s is not processed"
,
taosMsg
[
pMsg
->
msgType
]);
dError
(
"%s is not processed
in mserver
"
,
taosMsg
[
pMsg
->
msgType
]);
rspMsg
.
code
=
TSDB_CODE_MSG_NOT_PROCESSED
;
rpcSendResponse
(
&
rspMsg
);
rpcFreeCont
(
pMsg
->
pCont
);
...
...
src/dnode/src/dnodeWrite.c
浏览文件 @
6639ef6e
...
...
@@ -84,27 +84,33 @@ void dnodeCleanupWrite() {
}
void
dnodeWrite
(
SRpcMsg
*
pMsg
)
{
int32_t
queuedMsgNum
=
0
;
int32_t
leftLen
=
pMsg
->
contLen
;
char
*
pCont
=
(
char
*
)
pMsg
->
pCont
;
int32_t
contLen
=
0
;
int32_t
numOfVnodes
=
0
;
int32_t
vgId
=
0
;
SRpcContext
*
pRpcContext
=
NULL
;
// parse head, get number of vnodes;
int32_t
numOfVnodes
=
0
;
if
(
pMsg
->
msgType
==
TSDB_MSG_TYPE_SUBMIT
)
{
// TODO parse head, get number of vnodes;
numOfVnodes
=
1
;
}
else
{
numOfVnodes
=
1
;
}
if
(
numOfVnodes
>
1
)
{
if
(
numOfVnodes
>
1
)
{
pRpcContext
=
calloc
(
sizeof
(
SRpcContext
),
1
);
pRpcContext
->
numOfVnodes
=
numOfVnodes
;
}
while
(
leftLen
>
0
)
{
// todo: parse head, get vgId, contLen
SWriteMsgHead
*
pHead
=
(
SWriteMsgHead
*
)
pCont
;
int32_t
vgId
=
htonl
(
pHead
->
vgId
);
int32_t
contLen
=
htonl
(
pHead
->
contLen
);
// get pVnode from vgId
void
*
pVnode
=
dnodeGetVnode
(
vgId
);
if
(
pVnode
==
NULL
)
{
leftLen
-=
contLen
;
pCont
-=
contLen
;
continue
;
}
...
...
@@ -118,10 +124,22 @@ void dnodeWrite(SRpcMsg *pMsg) {
taos_queue
queue
=
dnodeGetVnodeWworker
(
pVnode
);
taosWriteQitem
(
queue
,
&
writeMsg
);
// next vnode
leftLen
-=
contLen
;
pCont
-=
contLen
;
pCont
-=
contLen
;
queuedMsgNum
++
;
}
if
(
queuedMsgNum
==
0
)
{
SRpcMsg
rpcRsp
=
{
.
handle
=
pMsg
->
handle
,
.
pCont
=
NULL
,
.
contLen
=
0
,
.
code
=
TSDB_CODE_INVALID_VGROUP_ID
,
.
msgType
=
0
};
rpcSendResponse
(
&
rpcRsp
);
}
}
...
...
src/inc/taosmsg.h
浏览文件 @
6639ef6e
...
...
@@ -244,6 +244,14 @@ typedef struct {
}
SVnodeDesc
;
typedef
struct
{
int32_t
contLen
;
int32_t
vgId
;
}
SWriteMsgHead
;
typedef
struct
{
int32_t
contLen
;
int32_t
vgId
;
int8_t
tableType
;
int16_t
numOfColumns
;
int16_t
numOfTags
;
...
...
@@ -251,7 +259,6 @@ typedef struct {
int32_t
sversion
;
int32_t
tagDataLen
;
int32_t
sqlDataLen
;
int32_t
contLen
;
int32_t
numOfVPeers
;
uint64_t
uid
;
uint64_t
superTableUid
;
...
...
@@ -337,6 +344,7 @@ typedef struct {
}
SMgmtHead
;
typedef
struct
{
int32_t
vgId
;
int32_t
sid
;
int32_t
numOfVPeers
;
uint64_t
uid
;
...
...
src/mnode/src/mgmtChildTable.c
浏览文件 @
6639ef6e
...
...
@@ -359,7 +359,7 @@ int32_t mgmtCreateChildTable(SCMCreateTableMsg *pCreate, int32_t contLen, SVgObj
*
pTableOut
=
(
STableInfo
*
)
pTable
;
mTrace
(
"table:%s, create table in vgroup, vgroup:%d sid:%d vnode:%d uid:%"
PRIu64
,
mTrace
(
"table:%s, create
c
table in vgroup, vgroup:%d sid:%d vnode:%d uid:%"
PRIu64
,
pTable
->
tableId
,
pVgroup
->
vgId
,
sid
,
pVgroup
->
vnodeGid
[
0
].
vnode
,
pTable
->
uid
);
return
TSDB_CODE_SUCCESS
;
...
...
src/mnode/src/mgmtDClient.c
浏览文件 @
6639ef6e
...
...
@@ -78,7 +78,7 @@ static void mgmtProcessRspFromDnode(SRpcMsg *rpcMsg) {
if
(
mgmtProcessDnodeRspFp
[
rpcMsg
->
msgType
])
{
(
*
mgmtProcessDnodeRspFp
[
rpcMsg
->
msgType
])(
rpcMsg
);
}
else
{
dError
(
"%s is not processed
"
,
taosMsg
[
rpcMsg
->
msgType
]);
mError
(
"%s is not processed in dclient
"
,
taosMsg
[
rpcMsg
->
msgType
]);
}
rpcFreeCont
(
rpcMsg
->
pCont
);
...
...
src/mnode/src/mgmtDServer.c
浏览文件 @
6639ef6e
...
...
@@ -76,7 +76,7 @@ static void mgmtProcessMsgFromDnode(SRpcMsg *rpcMsg) {
if
(
mgmtProcessDnodeMsgFp
[
rpcMsg
->
msgType
])
{
(
*
mgmtProcessDnodeMsgFp
[
rpcMsg
->
msgType
])(
rpcMsg
);
}
else
{
mError
(
"%s is not processed"
,
taosMsg
[
rpcMsg
->
msgType
]);
mError
(
"%s is not processed
in dserver
"
,
taosMsg
[
rpcMsg
->
msgType
]);
}
rpcFreeCont
(
rpcMsg
->
pCont
);
...
...
src/mnode/src/mgmtNormalTable.c
浏览文件 @
6639ef6e
...
...
@@ -393,7 +393,7 @@ int32_t mgmtCreateNormalTable(SCMCreateTableMsg *pCreate, int32_t contLen, SVgOb
*
pTableOut
=
(
STableInfo
*
)
pTable
;
mTrace
(
"table:%s, create table in vgroup, vgroup:%d sid:%d vnode:%d uid:%"
PRIu64
,
mTrace
(
"table:%s, create
n
table in vgroup, vgroup:%d sid:%d vnode:%d uid:%"
PRIu64
,
pTable
->
tableId
,
pVgroup
->
vgId
,
sid
,
pVgroup
->
vnodeGid
[
0
].
vnode
,
pTable
->
uid
);
return
TSDB_CODE_SUCCESS
;
...
...
src/mnode/src/mgmtShell.c
浏览文件 @
6639ef6e
...
...
@@ -145,7 +145,6 @@ static void mgmtProcessMsgFromShell(SRpcMsg *rpcMsg) {
SUserObj
*
pUser
=
mgmtGetUserFromConn
(
rpcMsg
->
handle
);
if
(
pUser
==
NULL
)
{
mError
(
"thandle:%p, failed to retrieve user info"
,
rpcMsg
->
handle
);
mgmtSendSimpleResp
(
rpcMsg
->
handle
,
TSDB_CODE_INVALID_USER
);
rpcFreeCont
(
rpcMsg
->
pCont
);
return
;
...
...
@@ -242,7 +241,7 @@ static void mgmtProcessRetrieveMsg(SQueuedMsg *pMsg) {
}
SShowObj
*
pShow
=
(
SShowObj
*
)
pRetrieve
->
qhandle
;
if
(
!
mgmtCheckQhandle
(
p
Show
))
{
if
(
!
mgmtCheckQhandle
(
p
Retrieve
->
qhandle
))
{
mError
(
"pShow:%p, query memory is corrupted"
,
pShow
);
mgmtSendSimpleResp
(
pMsg
->
thandle
,
TSDB_CODE_MEMORY_CORRUPTED
);
return
;
...
...
@@ -466,7 +465,7 @@ static bool mgmtCheckMsgReadOnly(int8_t type, void *pCont) {
}
static
void
mgmtProcessUnSupportMsg
(
SRpcMsg
*
rpcMsg
)
{
mError
(
"%s is not processed"
,
taosMsg
[
rpcMsg
->
msgType
]);
mError
(
"%s is not processed
in shell
"
,
taosMsg
[
rpcMsg
->
msgType
]);
SRpcMsg
rpcRsp
=
{
.
msgType
=
0
,
.
pCont
=
0
,
...
...
src/mnode/src/mgmtTable.c
浏览文件 @
6639ef6e
...
...
@@ -181,6 +181,8 @@ static void mgmtCreateTable(SVgObj *pVgroup, SQueuedMsg *pMsg) {
.
code
=
0
,
.
msgType
=
TSDB_MSG_TYPE_MD_CREATE_TABLE
};
pMsg
->
ahandle
=
pTable
;
mgmtSendMsgToDnode
(
&
ipSet
,
&
rpcMsg
);
}
...
...
@@ -441,14 +443,11 @@ void mgmtSetTableDirty(STableInfo *pTable, bool isDirty) {
}
void
mgmtProcessCreateTableMsg
(
SQueuedMsg
*
pMsg
)
{
if
(
mgmtCheckRedirect
(
pMsg
->
thandle
))
return
;
SCMCreateTableMsg
*
pCreate
=
pMsg
->
pCont
;
mTrace
(
"thandle:%p, start to create table:%s"
,
pMsg
->
thandle
,
pCreate
->
tableId
);
if
(
mgmtCheckRedirect
(
pMsg
->
thandle
))
{
mError
(
"thandle:%p, failed to create table:%s, need redirect"
,
pMsg
->
thandle
,
pCreate
->
tableId
);
return
;
}
if
(
mgmtCheckExpired
())
{
mError
(
"thandle:%p, failed to create table:%s, grant expired"
,
pCreate
->
tableId
);
mgmtSendSimpleResp
(
pMsg
->
thandle
,
TSDB_CODE_GRANT_EXPIRED
);
...
...
@@ -469,8 +468,8 @@ void mgmtProcessCreateTableMsg(SQueuedMsg *pMsg) {
return
;
}
SDbObj
*
pDb
=
mgmtGetDb
(
pCreate
->
db
);
if
(
pDb
==
NULL
)
{
pMsg
->
pDb
=
mgmtGetDb
(
pCreate
->
db
);
if
(
p
Msg
->
p
Db
==
NULL
)
{
mError
(
"thandle:%p, failed to create table:%s, db not selected"
,
pMsg
->
thandle
,
pCreate
->
tableId
);
mgmtSendSimpleResp
(
pMsg
->
thandle
,
TSDB_CODE_DB_NOT_SELECTED
);
return
;
...
...
@@ -492,7 +491,7 @@ void mgmtProcessCreateTableMsg(SQueuedMsg *pMsg) {
if
(
pCreate
->
numOfTags
!=
0
)
{
mTrace
(
"thandle:%p, start to create super table:%s, tags:%d columns:%d"
,
pMsg
->
thandle
,
pCreate
->
tableId
,
pCreate
->
numOfTags
,
pCreate
->
numOfColumns
);
code
=
mgmtCreateSuperTable
(
pDb
,
pCreate
);
code
=
mgmtCreateSuperTable
(
p
Msg
->
p
Db
,
pCreate
);
mgmtSendSimpleResp
(
pMsg
->
thandle
,
code
);
return
;
}
...
...
@@ -508,13 +507,13 @@ void mgmtProcessCreateTableMsg(SQueuedMsg *pMsg) {
memcpy
(
newMsg
,
pMsg
,
sizeof
(
SQueuedMsg
));
pMsg
->
pCont
=
NULL
;
SVgObj
*
pVgroup
=
mgmtGetAvailableVgroup
(
pDb
);
SVgObj
*
pVgroup
=
mgmtGetAvailableVgroup
(
p
Msg
->
p
Db
);
if
(
pVgroup
==
NULL
)
{
mTrace
(
"thandle:%p, table:%s start to create a new vgroup"
,
p
Msg
->
thandle
,
pCreate
->
tableId
);
mgmtCreateVgroup
(
p
Msg
);
mTrace
(
"thandle:%p, table:%s start to create a new vgroup"
,
new
Msg
->
thandle
,
pCreate
->
tableId
);
mgmtCreateVgroup
(
new
Msg
);
}
else
{
mTrace
(
"thandle:%p, create table:%s in vgroup:%d"
,
p
Msg
->
thandle
,
pCreate
->
tableId
,
pVgroup
->
vgId
);
mgmtCreateTable
(
pVgroup
,
p
Msg
);
mTrace
(
"thandle:%p, create table:%s in vgroup:%d"
,
new
Msg
->
thandle
,
pCreate
->
tableId
,
pVgroup
->
vgId
);
mgmtCreateTable
(
pVgroup
,
new
Msg
);
}
}
...
...
@@ -769,7 +768,7 @@ static void mgmtProcessCreateTableRsp(SRpcMsg *rpcMsg) {
mgmtSetTableDirty
(
pTable
,
true
);
//sdbDeleteRow(tsVgroupSdb, pVgroup);
mgmtSendSimpleResp
(
queueMsg
->
thandle
,
rpcMsg
->
code
);
mError
(
"table:%s, failed to create in dnode,
code:%d, set it dirty"
,
pTable
->
tableId
,
rpcMsg
->
code
);
mError
(
"table:%s, failed to create in dnode,
reason:%s, set it dirty"
,
pTable
->
tableId
,
tstrerror
(
rpcMsg
->
code
)
);
mgmtSetTableDirty
(
pTable
,
true
);
}
else
{
mTrace
(
"table:%s, created in dnode"
,
pTable
->
tableId
);
...
...
src/mnode/src/mgmtVgroup.c
浏览文件 @
6639ef6e
...
...
@@ -182,6 +182,8 @@ void mgmtCreateVgroup(SQueuedMsg *pMsg) {
taosIpStr
(
pVgroup
->
vnodeGid
[
i
].
ip
),
pVgroup
->
vnodeGid
[
i
].
vnode
);
}
pMsg
->
ahandle
=
pVgroup
;
pMsg
->
expected
=
pVgroup
->
numOfVnodes
;
mgmtSendCreateVgroupMsg
(
pVgroup
,
pMsg
);
}
...
...
@@ -561,7 +563,7 @@ SRpcIpSet mgmtGetIpSetFromVgroup(SVgObj *pVgroup) {
SRpcIpSet
ipSet
=
{
.
numOfIps
=
pVgroup
->
numOfVnodes
,
.
inUse
=
0
,
.
port
=
ts
MnodeD
nodePort
.
port
=
ts
DnodeM
nodePort
};
for
(
int
i
=
0
;
i
<
pVgroup
->
numOfVnodes
;
++
i
)
{
ipSet
.
ip
[
i
]
=
pVgroup
->
vnodeGid
[
i
].
ip
;
...
...
@@ -574,7 +576,7 @@ SRpcIpSet mgmtGetIpSetFromIp(uint32_t ip) {
.
ip
[
0
]
=
ip
,
.
numOfIps
=
1
,
.
inUse
=
0
,
.
port
=
ts
MnodeD
nodePort
.
port
=
ts
DnodeM
nodePort
};
return
ipSet
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录