Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
4d34d09f
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看板
提交
4d34d09f
编写于
7月 29, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-1003]
上级
afacc551
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
26 addition
and
21 deletion
+26
-21
src/mnode/inc/mnodeDef.h
src/mnode/inc/mnodeDef.h
+1
-0
src/mnode/src/mnodeShow.c
src/mnode/src/mnodeShow.c
+25
-21
未找到文件。
src/mnode/inc/mnodeDef.h
浏览文件 @
4d34d09f
...
@@ -251,6 +251,7 @@ typedef struct {
...
@@ -251,6 +251,7 @@ typedef struct {
int32_t
rowSize
;
int32_t
rowSize
;
int32_t
numOfRows
;
int32_t
numOfRows
;
void
*
pIter
;
void
*
pIter
;
void
**
ppShow
;
int16_t
offset
[
TSDB_MAX_COLUMNS
];
int16_t
offset
[
TSDB_MAX_COLUMNS
];
int16_t
bytes
[
TSDB_MAX_COLUMNS
];
int16_t
bytes
[
TSDB_MAX_COLUMNS
];
int32_t
numOfReads
;
int32_t
numOfReads
;
...
...
src/mnode/src/mnodeShow.c
浏览文件 @
4d34d09f
...
@@ -49,8 +49,8 @@ static int32_t mnodeProcessUseMsg(SMnodeMsg *mnodeMsg);
...
@@ -49,8 +49,8 @@ static int32_t mnodeProcessUseMsg(SMnodeMsg *mnodeMsg);
static
void
mnodeFreeShowObj
(
void
*
data
);
static
void
mnodeFreeShowObj
(
void
*
data
);
static
bool
mnodeAccquireShowObj
(
SShowObj
*
pShow
);
static
bool
mnodeAccquireShowObj
(
SShowObj
*
pShow
);
static
bool
mnodeCheckShowFinished
(
SShowObj
*
pShow
);
static
bool
mnodeCheckShowFinished
(
SShowObj
*
pShow
);
static
void
*
mnodePutShowObj
(
SShowObj
*
pShow
,
int32_t
size
);
static
void
*
mnodePutShowObj
(
SShowObj
*
pShow
);
static
void
mnodeReleaseShowObj
(
void
*
pShow
,
bool
forceRemove
);
static
void
mnodeReleaseShowObj
(
SShowObj
*
pShow
,
bool
forceRemove
);
extern
void
*
tsMnodeTmr
;
extern
void
*
tsMnodeTmr
;
static
void
*
tsMnodeShowCache
=
NULL
;
static
void
*
tsMnodeShowCache
=
NULL
;
...
@@ -65,7 +65,7 @@ int32_t mnodeInitShow() {
...
@@ -65,7 +65,7 @@ int32_t mnodeInitShow() {
mnodeAddReadMsgHandle
(
TSDB_MSG_TYPE_CM_CONNECT
,
mnodeProcessConnectMsg
);
mnodeAddReadMsgHandle
(
TSDB_MSG_TYPE_CM_CONNECT
,
mnodeProcessConnectMsg
);
mnodeAddReadMsgHandle
(
TSDB_MSG_TYPE_CM_USE_DB
,
mnodeProcessUseMsg
);
mnodeAddReadMsgHandle
(
TSDB_MSG_TYPE_CM_USE_DB
,
mnodeProcessUseMsg
);
tsMnodeShowCache
=
taosCacheInit
(
TSDB_DATA_TYPE_INT
,
5
,
false
,
mnodeFreeShowObj
,
"show"
);
tsMnodeShowCache
=
taosCacheInit
(
TSDB_DATA_TYPE_
BIG
INT
,
5
,
false
,
mnodeFreeShowObj
,
"show"
);
return
0
;
return
0
;
}
}
...
@@ -121,13 +121,13 @@ static int32_t mnodeProcessShowMsg(SMnodeMsg *pMsg) {
...
@@ -121,13 +121,13 @@ static int32_t mnodeProcessShowMsg(SMnodeMsg *pMsg) {
}
}
int32_t
showObjSize
=
sizeof
(
SShowObj
)
+
htons
(
pShowMsg
->
payloadLen
);
int32_t
showObjSize
=
sizeof
(
SShowObj
)
+
htons
(
pShowMsg
->
payloadLen
);
SShowObj
*
pShow
=
(
SShowObj
*
)
calloc
(
1
,
showObjSize
);
SShowObj
*
pShow
=
calloc
(
1
,
showObjSize
);
pShow
->
type
=
pShowMsg
->
type
;
pShow
->
type
=
pShowMsg
->
type
;
pShow
->
payloadLen
=
htons
(
pShowMsg
->
payloadLen
);
pShow
->
payloadLen
=
htons
(
pShowMsg
->
payloadLen
);
tstrncpy
(
pShow
->
db
,
pShowMsg
->
db
,
TSDB_DB_NAME_LEN
);
tstrncpy
(
pShow
->
db
,
pShowMsg
->
db
,
TSDB_DB_NAME_LEN
);
memcpy
(
pShow
->
payload
,
pShowMsg
->
payload
,
pShow
->
payloadLen
);
memcpy
(
pShow
->
payload
,
pShowMsg
->
payload
,
pShow
->
payloadLen
);
pShow
=
mnodePutShowObj
(
pShow
,
showObjSize
);
pShow
=
mnodePutShowObj
(
pShow
);
if
(
pShow
==
NULL
)
{
if
(
pShow
==
NULL
)
{
return
TSDB_CODE_MND_OUT_OF_MEMORY
;
return
TSDB_CODE_MND_OUT_OF_MEMORY
;
}
}
...
@@ -377,37 +377,41 @@ static bool mnodeCheckShowFinished(SShowObj *pShow) {
...
@@ -377,37 +377,41 @@ static bool mnodeCheckShowFinished(SShowObj *pShow) {
}
}
static
bool
mnodeAccquireShowObj
(
SShowObj
*
pShow
)
{
static
bool
mnodeAccquireShowObj
(
SShowObj
*
pShow
)
{
SShowObj
*
pSaved
=
taosCacheAcquireByKey
(
tsMnodeShowCache
,
&
pShow
->
index
,
sizeof
(
int32
_t
));
SShowObj
*
*
ppShow
=
taosCacheAcquireByKey
(
tsMnodeShowCache
,
&
pShow
,
sizeof
(
int64
_t
));
if
(
p
Saved
==
pShow
)
{
if
(
ppShow
)
{
mDebug
(
"%p, show is accquired from cache
"
,
pShow
);
mDebug
(
"%p, show is accquired from cache
, data:%p, index:%d"
,
pShow
,
ppShow
,
pShow
->
index
);
return
true
;
return
true
;
}
else
{
return
false
;
}
}
return
false
;
}
}
static
void
*
mnodePutShowObj
(
SShowObj
*
pShow
,
int32_t
size
)
{
static
void
*
mnodePutShowObj
(
SShowObj
*
pShow
)
{
if
(
tsMnodeShowCache
!=
NULL
)
{
if
(
tsMnodeShowCache
!=
NULL
)
{
pShow
->
index
=
atomic_add_fetch_32
(
&
tsShowObjIndex
,
1
);
pShow
->
index
=
atomic_add_fetch_32
(
&
tsShowObjIndex
,
1
);
SShowObj
*
newQhandle
=
taosCachePut
(
tsMnodeShowCache
,
&
pShow
->
index
,
sizeof
(
int32_t
),
pShow
,
size
,
6
);
SShowObj
**
ppShow
=
taosCachePut
(
tsMnodeShowCache
,
&
pShow
,
sizeof
(
int64_t
),
&
pShow
,
sizeof
(
int64_t
),
6
);
mDebug
(
"%p, show is put into cache, index:%d"
,
newQhandle
,
pShow
->
index
);
pShow
->
ppShow
=
(
void
**
)
ppShow
;
free
(
pShow
);
mDebug
(
"%p, show is put into cache, data:%p index:%d"
,
pShow
,
ppShow
,
pShow
->
index
);
return
pShow
;
return
newQhandle
;
}
}
return
NULL
;
return
NULL
;
}
}
static
void
mnodeFreeShowObj
(
void
*
data
)
{
static
void
mnodeFreeShowObj
(
void
*
data
)
{
SShowObj
*
pShow
=
data
;
SShowObj
*
pShow
=
*
(
SShowObj
**
)
data
;
sdbFreeIter
(
pShow
->
pIter
);
sdbFreeIter
(
pShow
->
pIter
);
mDebug
(
"%p, show is destroyed"
,
pShow
);
mDebug
(
"%p, show is destroyed, data:%p index:%d"
,
pShow
,
data
,
pShow
->
index
);
tfree
(
pShow
);
}
}
static
void
mnodeReleaseShowObj
(
void
*
pShow
,
bool
forceRemove
)
{
static
void
mnodeReleaseShowObj
(
SShowObj
*
pShow
,
bool
forceRemove
)
{
mDebug
(
"%p, show is released, force:%s"
,
pShow
,
forceRemove
?
"true"
:
"false"
);
SShowObj
**
ppShow
=
(
SShowObj
**
)
pShow
->
ppShow
;
taosCacheRelease
(
tsMnodeShowCache
,
&
pShow
,
forceRemove
);
mDebug
(
"%p, show is released, force:%s data:%p index:%d"
,
pShow
,
forceRemove
?
"true"
:
"false"
,
ppShow
,
pShow
->
index
);
taosCacheRelease
(
tsMnodeShowCache
,
(
void
**
)(
&
ppShow
),
forceRemove
);
}
}
void
mnodeVacuumResult
(
char
*
data
,
int32_t
numOfCols
,
int32_t
rows
,
int32_t
capacity
,
SShowObj
*
pShow
)
{
void
mnodeVacuumResult
(
char
*
data
,
int32_t
numOfCols
,
int32_t
rows
,
int32_t
capacity
,
SShowObj
*
pShow
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录