Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
62ecad98
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看板
未验证
提交
62ecad98
编写于
8月 05, 2021
作者:
H
Haojun Liao
提交者:
GitHub
8月 05, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #7122 from taosdata/feature/TD-5729
[TD-5729]<feature>: add subquery states and obj_ids to show queries output
上级
bc07960f
4c53af4f
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
46 addition
and
11 deletion
+46
-11
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+1
-1
src/client/src/tscProfile.c
src/client/src/tscProfile.c
+18
-3
src/inc/taosdef.h
src/inc/taosdef.h
+1
-0
src/inc/taosmsg.h
src/inc/taosmsg.h
+2
-0
src/mnode/src/mnodeProfile.c
src/mnode/src/mnodeProfile.c
+24
-7
未找到文件。
src/client/inc/tsclient.h
浏览文件 @
62ecad98
...
...
@@ -295,7 +295,7 @@ typedef struct SSqlObj {
SSqlCmd
cmd
;
SSqlRes
res
;
bool
isBind
;
SSubqueryState
subState
;
struct
SSqlObj
**
pSubs
;
...
...
src/client/src/tscProfile.c
浏览文件 @
62ecad98
...
...
@@ -255,10 +255,25 @@ int tscBuildQueryStreamDesc(void *pMsg, STscObj *pObj) {
pQdesc
->
qId
=
htobe64
(
pSql
->
res
.
qId
);
pQdesc
->
sqlObjId
=
htobe64
(
pSql
->
self
);
pQdesc
->
pid
=
pHeartbeat
->
pid
;
if
(
pSql
->
cmd
.
pQueryInfo
->
stableQuery
==
true
)
{
pQdesc
->
numOfSub
=
pSql
->
subState
.
numOfSub
;
pQdesc
->
stableQuery
=
pSql
->
cmd
.
pQueryInfo
->
stableQuery
;
pQdesc
->
numOfSub
=
pSql
->
subState
.
numOfSub
;
char
*
p
=
pQdesc
->
subSqlInfo
;
int32_t
remainLen
=
sizeof
(
pQdesc
->
subSqlInfo
);
if
(
pQdesc
->
numOfSub
==
0
)
{
snprintf
(
p
,
remainLen
,
"N/A"
);
}
else
{
pQdesc
->
numOfSub
=
1
;
int32_t
len
;
for
(
int32_t
i
=
0
;
i
<
pQdesc
->
numOfSub
;
++
i
)
{
len
=
snprintf
(
p
,
remainLen
,
"[%d]0x%"
PRIx64
"(%c) "
,
i
,
pSql
->
pSubs
[
i
]
->
self
,
pSql
->
subState
.
states
[
i
]
?
'C'
:
'I'
);
if
(
len
>
remainLen
)
{
break
;
}
remainLen
-=
len
;
p
+=
len
;
}
}
pQdesc
->
numOfSub
=
htonl
(
pQdesc
->
numOfSub
);
...
...
src/inc/taosdef.h
浏览文件 @
62ecad98
...
...
@@ -223,6 +223,7 @@ do { \
#define TSDB_IPv4ADDR_LEN 16
#define TSDB_FILENAME_LEN 128
#define TSDB_SHOW_SQL_LEN 512
#define TSDB_SHOW_SUBQUERY_LEN 1000
#define TSDB_SLOW_QUERY_SQL_LEN 512
#define TSDB_STEP_NAME_LEN 32
...
...
src/inc/taosmsg.h
浏览文件 @
62ecad98
...
...
@@ -877,7 +877,9 @@ typedef struct {
uint64_t
sqlObjId
;
int32_t
pid
;
char
fqdn
[
TSDB_FQDN_LEN
];
bool
stableQuery
;
int32_t
numOfSub
;
char
subSqlInfo
[
TSDB_SHOW_SUBQUERY_LEN
];
//include subqueries' index, Obj IDs and states(C-complete/I-imcomplete)
}
SQueryDesc
;
typedef
struct
{
...
...
src/mnode/src/mnodeProfile.c
浏览文件 @
62ecad98
...
...
@@ -32,7 +32,8 @@
#define CONN_KEEP_TIME (tsShellActivityTimer * 3)
#define CONN_CHECK_TIME (tsShellActivityTimer * 2)
#define QUERY_ID_SIZE 20
#define QUERY_OBJ_ID_SIZE 10
#define QUERY_OBJ_ID_SIZE 18
#define SUBQUERY_INFO_SIZE 6
#define QUERY_STREAM_SAVE_SIZE 20
static
SCacheObj
*
tsMnodeConnCache
=
NULL
;
...
...
@@ -380,12 +381,24 @@ static int32_t mnodeGetQueryMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pC
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
1
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BOOL
;
strcpy
(
pSchema
[
cols
].
name
,
"stable_query"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"sub_queries"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_SHOW_SUBQUERY_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"sub_query_info"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_SHOW_SQL_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"sql"
);
...
...
@@ -459,12 +472,8 @@ static int32_t mnodeRetrieveQueries(SShowObj *pShow, char *data, int32_t rows, v
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
int64_t
*
)
pWrite
=
htobe64
(
pDesc
->
useconds
);
cols
++
;
/*
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
*(int64_t *)pWrite = htobe64(pDesc->sqlObjId);
cols++;
*/
snprintf
(
str
,
tListLen
(
str
),
"0x%08"
PRIx64
,
htobe64
(
pDesc
->
sqlObjId
));
snprintf
(
str
,
tListLen
(
str
),
"0x%"
PRIx64
,
htobe64
(
pDesc
->
sqlObjId
));
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
str
,
pShow
->
bytes
[
cols
]);
cols
++
;
...
...
@@ -479,10 +488,18 @@ static int32_t mnodeRetrieveQueries(SShowObj *pShow, char *data, int32_t rows, v
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
epBuf
,
pShow
->
bytes
[
cols
]);
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
bool
*
)
pWrite
=
pDesc
->
stableQuery
;
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
int32_t
*
)
pWrite
=
htonl
(
pDesc
->
numOfSub
);
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
pDesc
->
subSqlInfo
,
pShow
->
bytes
[
cols
]);
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
pDesc
->
sql
,
pShow
->
bytes
[
cols
]);
cols
++
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录