Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
e03f3364
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看板
提交
e03f3364
编写于
12月 11, 2019
作者:
H
hjxilinx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[tbase-1326]
上级
c060be25
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
10 addition
and
67 deletion
+10
-67
src/system/detail/inc/vnode.h
src/system/detail/inc/vnode.h
+0
-22
src/system/detail/src/vnodeQueryProcess.c
src/system/detail/src/vnodeQueryProcess.c
+7
-21
src/system/detail/src/vnodeRead.c
src/system/detail/src/vnodeRead.c
+3
-24
未找到文件。
src/system/detail/inc/vnode.h
浏览文件 @
e03f3364
...
...
@@ -206,28 +206,6 @@ typedef struct {
char
cont
[];
}
SVMsgHeader
;
/*
* The value of QInfo.signature is used to denote that a query is executing, it isn't safe to release QInfo yet.
* The release operations will be blocked in a busy-waiting until the query operation reach a safepoint.
* Then it will reset the signature in a atomic operation, followed by release operation.
* Only the QInfo.signature == QInfo, this structure can be released safely.
*/
#define TSDB_QINFO_QUERY_FLAG 0x1
//#define TSDB_QINFO_RESET_SIG(x) atomic_store_64(&((x)->signature), (uint64_t)(x))
#define TSDB_QINFO_RESET_SIG(x)
#define TSDB_QINFO_SET_QUERY_FLAG(x)
//#define TSDB_QINFO_SET_QUERY_FLAG(x) \
// atomic_val_compare_exchange_64(&((x)->signature), (uint64_t)(x), TSDB_QINFO_QUERY_FLAG);
// live lock: wait for query reaching a safe-point, release all resources
// belongs to this query
#define TSDB_WAIT_TO_SAFE_DROP_QINFO(x) \
// { \
// while (atomic_val_compare_exchange_64(&((x)->signature), (x), 0) == TSDB_QINFO_QUERY_FLAG) { \
// taosMsleep(1); \
// } \
// }
struct
tSQLBinaryExpr
;
typedef
struct
SColumnInfoEx
{
...
...
src/system/detail/src/vnodeQueryProcess.c
浏览文件 @
e03f3364
...
...
@@ -1173,15 +1173,13 @@ void vnodeSingleMeterQuery(SSchedMsg *pMsg) {
}
if
(
pQInfo
->
killed
)
{
TSDB_QINFO_RESET_SIG
(
pQInfo
);
dTrace
(
"QInfo:%p it is already killed, reset signature and abort"
,
pQInfo
);
dTrace
(
"QInfo:%p it is already killed, abort"
,
pQInfo
);
vnodeDecRefCount
(
pQInfo
);
return
;
}
assert
(
pQInfo
->
refCount
>=
1
);
// assert(pQInfo->signature == TSDB_QINFO_QUERY_FLAG);
SQuery
*
pQuery
=
&
pQInfo
->
query
;
SMeterObj
*
pMeterObj
=
pQInfo
->
pObj
;
...
...
@@ -1215,10 +1213,7 @@ void vnodeSingleMeterQuery(SSchedMsg *pMsg) {
pQInfo
,
pMeterObj
->
vnode
,
pMeterObj
->
sid
,
pMeterObj
->
meterId
,
pQuery
->
pointsRead
,
numOfInterpo
,
pQInfo
->
pointsRead
,
pQInfo
->
pointsInterpo
,
pQInfo
->
pointsReturned
);
dTrace
(
"QInfo:%p reset signature"
,
pQInfo
);
sem_post
(
&
pQInfo
->
dataReady
);
TSDB_QINFO_RESET_SIG
(
pQInfo
);
vnodeDecRefCount
(
pQInfo
);
return
;
...
...
@@ -1238,10 +1233,7 @@ void vnodeSingleMeterQuery(SSchedMsg *pMsg) {
pQInfo
,
pMeterObj
->
vnode
,
pMeterObj
->
sid
,
pMeterObj
->
meterId
,
pQuery
->
pointsRead
,
pQInfo
->
pointsRead
,
pQInfo
->
pointsInterpo
,
pQInfo
->
pointsReturned
);
dTrace
(
"QInfo:%p reset signature"
,
pQInfo
);
sem_post
(
&
pQInfo
->
dataReady
);
TSDB_QINFO_RESET_SIG
(
pQInfo
);
vnodeDecRefCount
(
pQInfo
);
return
;
...
...
@@ -1250,12 +1242,12 @@ void vnodeSingleMeterQuery(SSchedMsg *pMsg) {
}
pQInfo
->
over
=
1
;
dTrace
(
"QInfo:%p vid:%d sid:%d id:%s, query over, %d points are returned
, reset signature
"
,
pQInfo
,
dTrace
(
"QInfo:%p vid:%d sid:%d id:%s, query over, %d points are returned"
,
pQInfo
,
pMeterObj
->
vnode
,
pMeterObj
->
sid
,
pMeterObj
->
meterId
,
pQInfo
->
pointsRead
);
vnodePrintQueryStatistics
(
pQInfo
->
pMeterQuerySupporter
);
sem_post
(
&
pQInfo
->
dataReady
);
TSDB_QINFO_RESET_SIG
(
pQInfo
);
vnodeDecRefCount
(
pQInfo
);
return
;
}
...
...
@@ -1284,16 +1276,14 @@ void vnodeSingleMeterQuery(SSchedMsg *pMsg) {
/* check if query is killed or not */
if
(
isQueryKilled
(
pQuery
))
{
dTrace
(
"QInfo:%p query is killed
, reset signature
"
,
pQInfo
);
dTrace
(
"QInfo:%p query is killed"
,
pQInfo
);
pQInfo
->
over
=
1
;
}
else
{
dTrace
(
"QInfo:%p vid:%d sid:%d id:%s, meter query thread completed, %d points are returned
, reset signature
"
,
dTrace
(
"QInfo:%p vid:%d sid:%d id:%s, meter query thread completed, %d points are returned"
,
pQInfo
,
pMeterObj
->
vnode
,
pMeterObj
->
sid
,
pMeterObj
->
meterId
,
pQuery
->
pointsRead
);
}
TSDB_QINFO_RESET_SIG
(
pQInfo
);
sem_post
(
&
pQInfo
->
dataReady
);
vnodeDecRefCount
(
pQInfo
);
}
...
...
@@ -1305,14 +1295,12 @@ void vnodeMultiMeterQuery(SSchedMsg *pMsg) {
}
if
(
pQInfo
->
killed
)
{
TSDB_QINFO_RESET_SIG
(
pQInfo
);
vnodeDecRefCount
(
pQInfo
);
dTrace
(
"QInfo:%p it is already killed,
reset signature and
abort"
,
pQInfo
);
dTrace
(
"QInfo:%p it is already killed, abort"
,
pQInfo
);
return
;
}
assert
(
pQInfo
->
refCount
>=
1
);
// assert(pQInfo->signature == TSDB_QINFO_QUERY_FLAG);
SQuery
*
pQuery
=
&
pQInfo
->
query
;
pQuery
->
pointsRead
=
0
;
...
...
@@ -1333,7 +1321,6 @@ void vnodeMultiMeterQuery(SSchedMsg *pMsg) {
pQInfo
->
useconds
+=
(
taosGetTimestampUs
()
-
st
);
pQInfo
->
over
=
isQueryKilled
(
pQuery
)
?
1
:
0
;
dTrace
(
"QInfo:%p reset signature"
,
pQInfo
);
taosInterpoSetStartInfo
(
&
pQInfo
->
pMeterQuerySupporter
->
runtimeEnv
.
interpoInfo
,
pQuery
->
pointsRead
,
pQInfo
->
query
.
interpoType
);
...
...
@@ -1341,12 +1328,11 @@ void vnodeMultiMeterQuery(SSchedMsg *pMsg) {
if
(
pQuery
->
pointsRead
==
0
)
{
pQInfo
->
over
=
1
;
dTrace
(
"QInfo:%p over, %d meters queried, %d points are returned
, reset signature
"
,
pQInfo
,
pSupporter
->
numOfMeters
,
dTrace
(
"QInfo:%p over, %d meters queried, %d points are returned"
,
pQInfo
,
pSupporter
->
numOfMeters
,
pQInfo
->
pointsRead
);
vnodePrintQueryStatistics
(
pSupporter
);
}
sem_post
(
&
pQInfo
->
dataReady
);
TSDB_QINFO_RESET_SIG
(
pQInfo
);
vnodeDecRefCount
(
pQInfo
);
}
src/system/detail/src/vnodeRead.c
浏览文件 @
e03f3364
...
...
@@ -422,8 +422,6 @@ void vnodeFreeQInfo(void *param, bool decQueryRef) {
if
(
!
vnodeIsQInfoValid
(
param
))
return
;
pQInfo
->
killed
=
1
;
TSDB_WAIT_TO_SAFE_DROP_QINFO
(
pQInfo
);
SMeterObj
*
pObj
=
pQInfo
->
pObj
;
dTrace
(
"QInfo:%p start to free SQInfo"
,
pQInfo
);
...
...
@@ -502,7 +500,6 @@ bool vnodeIsQInfoValid(void *param) {
* into local variable, then compare by using local variable
*/
uint64_t
sig
=
pQInfo
->
signature
;
// return (sig == (uint64_t)pQInfo) || (sig == TSDB_QINFO_QUERY_FLAG);
return
(
sig
==
(
uint64_t
)
pQInfo
);
}
...
...
@@ -536,13 +533,11 @@ void vnodeQueryData(SSchedMsg *pMsg) {
pQInfo
=
(
SQInfo
*
)
pMsg
->
ahandle
;
if
(
pQInfo
->
killed
)
{
TSDB_QINFO_RESET_SIG
(
pQInfo
);
dTrace
(
"QInfo:%p it is already killed, reset signature and abort"
,
pQInfo
);
dTrace
(
"QInfo:%p it is already killed, abort"
,
pQInfo
);
vnodeDecRefCount
(
pQInfo
);
return
;
}
// assert(pQInfo->signature == TSDB_QINFO_QUERY_FLAG);
pQuery
=
&
(
pQInfo
->
query
);
SMeterObj
*
pObj
=
pQInfo
->
pObj
;
...
...
@@ -610,9 +605,6 @@ void vnodeQueryData(SSchedMsg *pMsg) {
tclose
(
pQInfo
->
query
.
lfd
);
}
/* reset QInfo signature */
dTrace
(
"QInfo:%p reset signature"
,
pQInfo
);
TSDB_QINFO_RESET_SIG
(
pQInfo
);
sem_post
(
&
pQInfo
->
dataReady
);
vnodeDecRefCount
(
pQInfo
);
}
...
...
@@ -697,9 +689,6 @@ void *vnodeQueryOnSingleTable(SMeterObj **pMetersObj, SSqlGroupbyExpr *pGroupbyE
schedMsg
.
fp
=
vnodeQueryData
;
}
// set in query flag
// pQInfo->signature = TSDB_QINFO_QUERY_FLAG;
/*
* The reference count, which is 2, is for both the current query thread and the future retrieve request,
* which will always be issued by client to acquire data or free SQInfo struct.
...
...
@@ -818,7 +807,6 @@ void *vnodeQueryOnMultiMeters(SMeterObj **pMetersObj, SSqlGroupbyExpr *pGroupbyE
return
pQInfo
;
}
// pQInfo->signature = TSDB_QINFO_QUERY_FLAG;
vnodeAddRefCount
(
pQInfo
);
schedMsg
.
msg
=
NULL
;
...
...
@@ -900,18 +888,9 @@ int vnodeSaveQueryResult(void *handle, char *data, int32_t *size) {
pQInfo
->
pointsRead
);
if
(
pQInfo
->
over
==
0
)
{
//dTrace("QInfo:%p set query flag, oldSig:%p, func:%s", pQInfo, pQInfo->signature, __FUNCTION__);
dTrace
(
"QInfo:%p set query flag, oldSig:%p"
,
pQInfo
,
pQInfo
->
signature
);
// uint64_t oldSignature = TSDB_QINFO_SET_QUERY_FLAG(pQInfo);
/*
* If SQInfo has been released, the value of signature cannot be equalled to the address of pQInfo,
* since in release function, the original value has been destroyed. However, this memory area may be reused
* by another function. It may be 0 or any value, but it is rarely still be equalled to the address of SQInfo.
*/
// if (oldSignature == 0 || oldSignature != (uint64_t)pQInfo) {
dTrace
(
"QInfo:%p set query flag, sig:%p, func:%s"
,
pQInfo
,
pQInfo
->
signature
,
__FUNCTION__
);
if
(
pQInfo
->
killed
==
1
)
{
// dTrace("%p freed or killed, old sig:%p abort query", pQInfo, oldSignature);
dTrace
(
"%p freed or killed, abort query"
,
pQInfo
);
}
else
{
vnodeAddRefCount
(
pQInfo
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录