Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
30eb8d50
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
30eb8d50
编写于
3月 28, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
shm
上级
187eb299
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
28 addition
and
23 deletion
+28
-23
include/libs/transport/trpc.h
include/libs/transport/trpc.h
+7
-5
source/dnode/mgmt/container/src/dndMsg.c
source/dnode/mgmt/container/src/dndMsg.c
+2
-0
source/dnode/mnode/impl/src/mndProfile.c
source/dnode/mnode/impl/src/mndProfile.c
+14
-17
source/util/src/tprocess.c
source/util/src/tprocess.c
+5
-1
未找到文件。
include/libs/transport/trpc.h
浏览文件 @
30eb8d50
...
...
@@ -50,10 +50,12 @@ typedef struct SRpcMsg {
typedef
struct
{
char
user
[
TSDB_USER_LEN
];
uint32_t
clientIp
;
uint16_t
clientPort
;
SRpcMsg
rpcMsg
;
int32_t
rspLen
;
void
*
pRsp
;
void
*
pNode
;
void
*
pRsp
;
void
*
pNode
;
}
SNodeMsg
;
typedef
struct
SRpcInit
{
...
...
source/dnode/mgmt/container/src/dndMsg.c
浏览文件 @
30eb8d50
...
...
@@ -42,6 +42,8 @@ static inline int32_t dndBuildMsg(SNodeMsg *pMsg, SRpcMsg *pRpc) {
}
memcpy
(
pMsg
->
user
,
connInfo
.
user
,
TSDB_USER_LEN
);
pMsg
->
clientIp
=
connInfo
.
clientIp
;
pMsg
->
clientPort
=
connInfo
.
clientPort
;
memcpy
(
&
pMsg
->
rpcMsg
,
pRpc
,
sizeof
(
SRpcMsg
));
return
0
;
}
...
...
source/dnode/mnode/impl/src/mndProfile.c
浏览文件 @
30eb8d50
...
...
@@ -44,7 +44,8 @@ typedef struct {
SQueryDesc
*
pQueries
;
}
SConnObj
;
static
SConnObj
*
mndCreateConn
(
SMnode
*
pMnode
,
SRpcConnInfo
*
pInfo
,
int32_t
pid
,
const
char
*
app
,
int64_t
startTime
);
static
SConnObj
*
mndCreateConn
(
SMnode
*
pMnode
,
const
char
*
user
,
uint32_t
ip
,
uint16_t
port
,
int32_t
pid
,
const
char
*
app
,
int64_t
startTime
);
static
void
mndFreeConn
(
SConnObj
*
pConn
);
static
SConnObj
*
mndAcquireConn
(
SMnode
*
pMnode
,
int32_t
connId
);
static
void
mndReleaseConn
(
SMnode
*
pMnode
,
SConnObj
*
pConn
);
...
...
@@ -94,7 +95,8 @@ void mndCleanupProfile(SMnode *pMnode) {
}
}
static
SConnObj
*
mndCreateConn
(
SMnode
*
pMnode
,
SRpcConnInfo
*
pInfo
,
int32_t
pid
,
const
char
*
app
,
int64_t
startTime
)
{
static
SConnObj
*
mndCreateConn
(
SMnode
*
pMnode
,
const
char
*
user
,
uint32_t
ip
,
uint16_t
port
,
int32_t
pid
,
const
char
*
app
,
int64_t
startTime
)
{
SProfileMgmt
*
pMgmt
=
&
pMnode
->
profileMgmt
;
int32_t
connId
=
atomic_add_fetch_32
(
&
pMgmt
->
connId
,
1
);
...
...
@@ -104,8 +106,8 @@ static SConnObj *mndCreateConn(SMnode *pMnode, SRpcConnInfo *pInfo, int32_t pid,
SConnObj
connObj
=
{.
id
=
connId
,
.
appStartTimeMs
=
startTime
,
.
pid
=
pid
,
.
ip
=
pInfo
->
clientI
p
,
.
port
=
p
Info
->
clientP
ort
,
.
ip
=
i
p
,
.
port
=
port
,
.
killed
=
0
,
.
loginTimeMs
=
taosGetTimestampMs
(),
.
lastAccessTimeMs
=
0
,
...
...
@@ -114,17 +116,17 @@ static SConnObj *mndCreateConn(SMnode *pMnode, SRpcConnInfo *pInfo, int32_t pid,
.
pQueries
=
NULL
};
connObj
.
lastAccessTimeMs
=
connObj
.
loginTimeMs
;
tstrncpy
(
connObj
.
user
,
pInfo
->
user
,
TSDB_USER_LEN
);
tstrncpy
(
connObj
.
user
,
user
,
TSDB_USER_LEN
);
tstrncpy
(
connObj
.
app
,
app
,
TSDB_APP_NAME_LEN
);
int32_t
keepTime
=
tsShellActivityTimer
*
3
;
SConnObj
*
pConn
=
taosCachePut
(
pMgmt
->
cache
,
&
connId
,
sizeof
(
int32_t
),
&
connObj
,
sizeof
(
connObj
),
keepTime
*
1000
);
if
(
pConn
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
mError
(
"conn:%d, failed to put into cache since %s, user:%s"
,
connId
,
pInfo
->
user
,
terrstr
());
mError
(
"conn:%d, failed to put into cache since %s, user:%s"
,
connId
,
user
,
terrstr
());
return
NULL
;
}
else
{
mTrace
(
"conn:%d, is created, data:%p user:%s"
,
pConn
->
id
,
pConn
,
pInfo
->
user
);
mTrace
(
"conn:%d, is created, data:%p user:%s"
,
pConn
->
id
,
pConn
,
user
);
return
pConn
;
}
}
...
...
@@ -184,20 +186,14 @@ static int32_t mndProcessConnectReq(SNodeMsg *pReq) {
SConnObj
*
pConn
=
NULL
;
int32_t
code
=
-
1
;
SConnectReq
connReq
=
{
0
};
char
ip
[
30
]
=
{
0
};
if
(
tDeserializeSConnectReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
connReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
CONN_OVER
;
}
SRpcConnInfo
info
=
{
0
};
if
(
rpcGetConnInfo
(
pReq
->
rpcMsg
.
handle
,
&
info
)
!=
0
)
{
mError
(
"user:%s, failed to login while get connection info since %s"
,
pReq
->
user
,
terrstr
());
goto
CONN_OVER
;
}
char
ip
[
30
];
taosIp2String
(
info
.
clientIp
,
ip
);
taosIp2String
(
pReq
->
clientIp
,
ip
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
if
(
pUser
==
NULL
)
{
...
...
@@ -216,7 +212,8 @@ static int32_t mndProcessConnectReq(SNodeMsg *pReq) {
}
}
pConn
=
mndCreateConn
(
pMnode
,
&
info
,
connReq
.
pid
,
connReq
.
app
,
connReq
.
startTime
);
pConn
=
mndCreateConn
(
pMnode
,
pReq
->
user
,
pReq
->
clientIp
,
pReq
->
clientPort
,
connReq
.
pid
,
connReq
.
app
,
connReq
.
startTime
);
if
(
pConn
==
NULL
)
{
mError
(
"user:%s, failed to login from %s while create connection since %s"
,
pReq
->
user
,
ip
,
terrstr
());
goto
CONN_OVER
;
...
...
@@ -241,7 +238,7 @@ static int32_t mndProcessConnectReq(SNodeMsg *pReq) {
pReq
->
rspLen
=
contLen
;
pReq
->
pRsp
=
pRsp
;
mDebug
(
"user:%s, login from %s, conn:%d, app:%s"
,
info
.
user
,
ip
,
pConn
->
id
,
connReq
.
app
);
mDebug
(
"user:%s, login from %s, conn:%d, app:%s"
,
pReq
->
user
,
ip
,
pConn
->
id
,
connReq
.
app
);
code
=
0
;
...
...
source/util/src/tprocess.c
浏览文件 @
30eb8d50
...
...
@@ -24,7 +24,6 @@
#include <sys/wait.h>
#define SHM_DEFAULT_SIZE (20 * 1024 * 1024)
#define CEIL8(n) (ceil((float)(n) / 8) * 8)
typedef
void
*
(
*
ProcThreadFp
)(
void
*
param
);
typedef
struct
SProcQueue
{
...
...
@@ -58,6 +57,11 @@ typedef struct SProcObj {
bool
stopFlag
;
}
SProcObj
;
static
inline
int32_t
CEIL8
(
int32_t
v
)
{
const
int32_t
c
=
ceil
((
float
)(
v
)
/
8
)
*
8
;
return
c
<
8
?
8
:
c
;
}
static
int32_t
taosProcInitMutex
(
TdThreadMutex
**
ppMutex
,
int32_t
*
pShmid
)
{
TdThreadMutex
*
pMutex
=
NULL
;
TdThreadMutexAttr
mattr
=
{
0
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录