Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ca10ef44
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看板
提交
ca10ef44
编写于
1月 16, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix invalid db err while process connect req
上级
ca8ed353
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
38 addition
and
32 deletion
+38
-32
source/dnode/mnode/impl/src/mndProfile.c
source/dnode/mnode/impl/src/mndProfile.c
+38
-32
未找到文件。
source/dnode/mnode/impl/src/mndProfile.c
浏览文件 @
ca10ef44
...
@@ -179,7 +179,12 @@ static void mndCancelGetNextConn(SMnode *pMnode, void *pIter) {
...
@@ -179,7 +179,12 @@ static void mndCancelGetNextConn(SMnode *pMnode, void *pIter) {
}
}
static
int32_t
mndProcessConnectReq
(
SMnodeMsg
*
pReq
)
{
static
int32_t
mndProcessConnectReq
(
SMnodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SMnode
*
pMnode
=
pReq
->
pMnode
;
SUserObj
*
pUser
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SConnObj
*
pConn
=
NULL
;
int32_t
code
=
-
1
;
SConnectReq
*
pConnReq
=
pReq
->
rpcMsg
.
pCont
;
SConnectReq
*
pConnReq
=
pReq
->
rpcMsg
.
pCont
;
pConnReq
->
pid
=
htonl
(
pConnReq
->
pid
);
pConnReq
->
pid
=
htonl
(
pConnReq
->
pid
);
pConnReq
->
startTime
=
htobe64
(
pConnReq
->
startTime
);
pConnReq
->
startTime
=
htobe64
(
pConnReq
->
startTime
);
...
@@ -187,54 +192,61 @@ static int32_t mndProcessConnectReq(SMnodeMsg *pReq) {
...
@@ -187,54 +192,61 @@ static int32_t mndProcessConnectReq(SMnodeMsg *pReq) {
SRpcConnInfo
info
=
{
0
};
SRpcConnInfo
info
=
{
0
};
if
(
rpcGetConnInfo
(
pReq
->
rpcMsg
.
handle
,
&
info
)
!=
0
)
{
if
(
rpcGetConnInfo
(
pReq
->
rpcMsg
.
handle
,
&
info
)
!=
0
)
{
mError
(
"user:%s, failed to login while get connection info since %s"
,
pReq
->
user
,
terrstr
());
mError
(
"user:%s, failed to login while get connection info since %s"
,
pReq
->
user
,
terrstr
());
return
-
1
;
goto
CONN_OVER
;
}
}
char
ip
[
30
];
char
ip
[
30
];
taosIp2String
(
info
.
clientIp
,
ip
);
taosIp2String
(
info
.
clientIp
,
ip
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
if
(
pUser
==
NULL
)
{
mError
(
"user:%s, failed to login while acquire user since %s"
,
pReq
->
user
,
terrstr
());
goto
CONN_OVER
;
}
if
(
pConnReq
->
db
[
0
])
{
if
(
pConnReq
->
db
[
0
])
{
snprintf
(
pReq
->
db
,
TSDB_DB_FNAME_LEN
,
"%d%s%s"
,
p
Req
->
acctId
,
TS_PATH_DELIMITER
,
pConnReq
->
db
);
snprintf
(
pReq
->
db
,
TSDB_DB_FNAME_LEN
,
"%d%s%s"
,
p
User
->
acctId
,
TS_PATH_DELIMITER
,
pConnReq
->
db
);
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
pReq
->
db
);
pDb
=
mndAcquireDb
(
pMnode
,
pReq
->
db
);
if
(
pDb
==
NULL
)
{
if
(
pDb
==
NULL
)
{
terrno
=
TSDB_CODE_MND_INVALID_DB
;
terrno
=
TSDB_CODE_MND_INVALID_DB
;
mError
(
"user:%s, failed to login from %s while use db:%s since %s"
,
pReq
->
user
,
ip
,
pConnReq
->
db
,
terrstr
());
mError
(
"user:%s, failed to login from %s while use db:%s since %s"
,
pReq
->
user
,
ip
,
pConnReq
->
db
,
terrstr
());
return
-
1
;
goto
CONN_OVER
;
}
}
mndReleaseDb
(
pMnode
,
pDb
);
}
}
SConnObj
*
pConn
=
mndCreateConn
(
pMnode
,
&
info
,
pConnReq
->
pid
,
pConnReq
->
app
,
pConnReq
->
startTime
);
pConn
=
mndCreateConn
(
pMnode
,
&
info
,
pConnReq
->
pid
,
pConnReq
->
app
,
pConnReq
->
startTime
);
if
(
pConn
==
NULL
)
{
if
(
pConn
==
NULL
)
{
mError
(
"user:%s, failed to login from %s while create connection since %s"
,
pReq
->
user
,
ip
,
terrstr
());
mError
(
"user:%s, failed to login from %s while create connection since %s"
,
pReq
->
user
,
ip
,
terrstr
());
return
-
1
;
goto
CONN_OVER
;
}
}
SConnectRsp
*
pRsp
=
rpcMallocCont
(
sizeof
(
SConnectRsp
));
SConnectRsp
*
pRsp
=
rpcMallocCont
(
sizeof
(
SConnectRsp
));
if
(
pRsp
==
NULL
)
{
if
(
pRsp
==
NULL
)
{
mndReleaseConn
(
pMnode
,
pConn
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
mError
(
"user:%s, failed to login from %s while create rsp since %s"
,
pReq
->
user
,
ip
,
terrstr
());
mError
(
"user:%s, failed to login from %s while create rsp since %s"
,
pReq
->
user
,
ip
,
terrstr
());
return
-
1
;
goto
CONN_OVER
;
}
SUserObj
*
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
if
(
pUser
!=
NULL
)
{
pRsp
->
acctId
=
htonl
(
pUser
->
acctId
);
pRsp
->
superUser
=
pUser
->
superUser
;
mndReleaseUser
(
pMnode
,
pUser
);
}
}
pRsp
->
acctId
=
htonl
(
pUser
->
acctId
);
pRsp
->
superUser
=
pUser
->
superUser
;
pRsp
->
clusterId
=
htobe64
(
pMnode
->
clusterId
);
pRsp
->
clusterId
=
htobe64
(
pMnode
->
clusterId
);
pRsp
->
connId
=
htonl
(
pConn
->
id
);
pRsp
->
connId
=
htonl
(
pConn
->
id
);
mndGetMnodeEpSet
(
pMnode
,
&
pRsp
->
epSet
);
mndGetMnodeEpSet
(
pMnode
,
&
pRsp
->
epSet
);
mndReleaseConn
(
pMnode
,
pConn
);
pReq
->
contLen
=
sizeof
(
SConnectRsp
);
pReq
->
contLen
=
sizeof
(
SConnectRsp
);
pReq
->
pCont
=
pRsp
;
pReq
->
pCont
=
pRsp
;
mDebug
(
"user:%s, login from %s, conn:%d, app:%s"
,
info
.
user
,
ip
,
pConn
->
id
,
pConnReq
->
app
);
mDebug
(
"user:%s, login from %s, conn:%d, app:%s"
,
info
.
user
,
ip
,
pConn
->
id
,
pConnReq
->
app
);
return
0
;
code
=
0
;
CONN_OVER:
mndReleaseUser
(
pMnode
,
pUser
);
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseConn
(
pMnode
,
pConn
);
return
code
;
}
}
static
int32_t
mndSaveQueryStreamList
(
SConnObj
*
pConn
,
SHeartBeatReq
*
pReq
)
{
static
int32_t
mndSaveQueryStreamList
(
SConnObj
*
pConn
,
SHeartBeatReq
*
pReq
)
{
...
@@ -258,33 +270,27 @@ static int32_t mndSaveQueryStreamList(SConnObj *pConn, SHeartBeatReq *pReq) {
...
@@ -258,33 +270,27 @@ static int32_t mndSaveQueryStreamList(SConnObj *pConn, SHeartBeatReq *pReq) {
}
}
static
int32_t
mndProcessHeartBeatReq
(
SMnodeMsg
*
pReq
)
{
static
int32_t
mndProcessHeartBeatReq
(
SMnodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SMnode
*
pMnode
=
pReq
->
pMnode
;
char
*
batchReqStr
=
pReq
->
rpcMsg
.
pCont
;
char
*
batchReqStr
=
pReq
->
rpcMsg
.
pCont
;
SClientHbBatchReq
batchReq
=
{
0
};
SClientHbBatchReq
batchReq
=
{
0
};
tDeserializeSClientHbBatchReq
(
batchReqStr
,
&
batchReq
);
tDeserializeSClientHbBatchReq
(
batchReqStr
,
&
batchReq
);
SArray
*
pArray
=
batchReq
.
reqs
;
SArray
*
pArray
=
batchReq
.
reqs
;
int
sz
=
taosArrayGetSize
(
pArray
);
int
sz
=
taosArrayGetSize
(
pArray
);
SClientHbBatchRsp
batchRsp
=
{
0
};
SClientHbBatchRsp
batchRsp
=
{
0
};
batchRsp
.
rsps
=
taosArrayInit
(
0
,
sizeof
(
SClientHbRsp
));
batchRsp
.
rsps
=
taosArrayInit
(
0
,
sizeof
(
SClientHbRsp
));
for
(
int
i
=
0
;
i
<
sz
;
i
++
)
{
for
(
int
i
=
0
;
i
<
sz
;
i
++
)
{
SClientHbReq
*
pHbReq
=
taosArrayGet
(
pArray
,
i
);
SClientHbReq
*
pHbReq
=
taosArrayGet
(
pArray
,
i
);
if
(
pHbReq
->
connKey
.
hbType
==
HEARTBEAT_TYPE_QUERY
)
{
if
(
pHbReq
->
connKey
.
hbType
==
HEARTBEAT_TYPE_QUERY
)
{
}
else
if
(
pHbReq
->
connKey
.
hbType
==
HEARTBEAT_TYPE_MQ
)
{
}
else
if
(
pHbReq
->
connKey
.
hbType
==
HEARTBEAT_TYPE_MQ
)
{
SClientHbRsp
rsp
=
{
SClientHbRsp
rsp
=
{.
status
=
0
,
.
connKey
=
pHbReq
->
connKey
,
.
bodyLen
=
0
,
.
body
=
NULL
};
.
status
=
0
,
.
connKey
=
pHbReq
->
connKey
,
.
bodyLen
=
0
,
.
body
=
NULL
};
taosArrayPush
(
batchRsp
.
rsps
,
&
rsp
);
taosArrayPush
(
batchRsp
.
rsps
,
&
rsp
);
}
}
}
}
int32_t
tlen
=
tSerializeSClientHbBatchRsp
(
NULL
,
&
batchRsp
);
int32_t
tlen
=
tSerializeSClientHbBatchRsp
(
NULL
,
&
batchRsp
);
void
*
buf
=
rpcMallocCont
(
tlen
);
void
*
buf
=
rpcMallocCont
(
tlen
);
void
*
bufCopy
=
buf
;
void
*
bufCopy
=
buf
;
tSerializeSClientHbBatchRsp
(
&
bufCopy
,
&
batchRsp
);
tSerializeSClientHbBatchRsp
(
&
bufCopy
,
&
batchRsp
);
pReq
->
contLen
=
tlen
;
pReq
->
contLen
=
tlen
;
pReq
->
pCont
=
buf
;
pReq
->
pCont
=
buf
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录