Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
95aa47c4
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
未验证
提交
95aa47c4
编写于
3月 02, 2020
作者:
S
slguan
提交者:
GitHub
3月 02, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1291 from taosdata/feature/liaohj
avoid the retry efforts to consume too many CPU time in getting first…
上级
ab684979
577704d2
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
33 addition
and
29 deletion
+33
-29
src/system/detail/src/vnodeQueryImpl.c
src/system/detail/src/vnodeQueryImpl.c
+33
-29
未找到文件。
src/system/detail/src/vnodeQueryImpl.c
浏览文件 @
95aa47c4
...
...
@@ -1157,24 +1157,22 @@ SCacheBlock *getCacheDataBlock(SMeterObj *pMeterObj, SQueryRuntimeEnv *pRuntimeE
offset
=
pQuery
->
commitPoint
;
numOfPoints
=
pNewBlock
->
numOfPoints
-
offset
;
if
(
offset
!=
0
)
{
dTrace
(
"%p ignore the data in cache block that are commit already, numOfblock:%d slot:%d ignore points:%d. "
"first:%d last:%d"
,
GET_QINFO_ADDR
(
pQuery
),
pQuery
->
numOfBlocks
,
pQuery
->
slot
,
pQuery
->
commitPoint
,
pQuery
->
firstSlot
,
pQuery
->
currentSlot
);
}
pNewBlock
->
numOfPoints
=
numOfPoints
;
// current block are all commit already, ignore it
if
(
pNewBlock
->
numOfPoints
==
0
)
{
dTrace
(
"%p ignore current in cache block that are all commit already, numOfblock:%d slot:%d"
"first:%d last:%d"
,
GET_QINFO_ADDR
(
pQuery
),
pQuery
->
numOfBlocks
,
pQuery
->
slot
,
pQuery
->
firstSlot
,
pQuery
->
currentSlot
);
return
NULL
;
if
(
offset
!=
0
)
{
if
(
pNewBlock
->
numOfPoints
>
0
)
{
dTrace
(
"QInfo:%p ignore the data in cache block that are commit already, numOfBlock:%d slot:%d ignore points:%d "
"remain:%d first:%d last:%d"
,
GET_QINFO_ADDR
(
pQuery
),
pQuery
->
numOfBlocks
,
pQuery
->
slot
,
pQuery
->
commitPoint
,
pNewBlock
->
numOfPoints
,
pQuery
->
firstSlot
,
pQuery
->
currentSlot
);
}
else
{
// current block are all commit already, ignore it
assert
(
pNewBlock
->
numOfPoints
==
0
);
dTrace
(
"QInfo:%p ignore points in cache block that are all commit already, numOfBlock:%d slot:%d ignore points:%d "
"first:%d last:%d"
,
GET_QINFO_ADDR
(
pQuery
),
pQuery
->
numOfBlocks
,
slot
,
offset
,
pQuery
->
firstSlot
,
pQuery
->
currentSlot
);
return
NULL
;
}
}
}
...
...
@@ -3113,19 +3111,19 @@ static bool cacheBoundaryCheck(SQueryRuntimeEnv *pRuntimeEnv, SMeterObj *pMeterO
// earliest key in cache
TSKEY
keyFirst
=
0
;
TSKEY
keyLast
=
pMeterObj
->
lastKey
;
// keep the value in local variable, since it may be changed by other thread any time
int32_t
numOfBlocks
=
pCacheInfo
->
numOfBlocks
;
int32_t
currentSlot
=
pCacheInfo
->
currentSlot
;
// no data in cache, return false directly
if
(
numOfBlocks
==
0
)
{
return
false
;
}
int32_t
first
=
getFirstCacheSlot
(
numOfBlocks
,
currentSlot
,
pCacheInfo
);
while
(
1
)
{
// keep the value in local variable, since it may be changed by other thread any time
int32_t
numOfBlocks
=
pCacheInfo
->
numOfBlocks
;
int32_t
currentSlot
=
pCacheInfo
->
currentSlot
;
// no data in cache, return false directly
if
(
numOfBlocks
==
0
)
{
return
false
;
}
int32_t
first
=
getFirstCacheSlot
(
numOfBlocks
,
currentSlot
,
pCacheInfo
);
/*
* pBlock may be null value since this block is flushed to disk, and re-distributes to
* other meter, so go on until we get the first not flushed cache block.
...
...
@@ -3137,9 +3135,12 @@ static bool cacheBoundaryCheck(SQueryRuntimeEnv *pRuntimeEnv, SMeterObj *pMeterO
/*
* there may be only one empty cache block existed caused by import.
*/
if
(
numOfBlocks
==
1
)
{
if
(
first
==
currentSlot
||
numOfBlocks
==
1
)
{
return
false
;
}
// todo use defined macro
first
=
(
first
+
1
+
pCacheInfo
->
maxBlocks
)
%
pCacheInfo
->
maxBlocks
;
}
}
...
...
@@ -4950,7 +4951,10 @@ int32_t vnodeSTableQueryPrepare(SQInfo *pQInfo, SQuery *pQuery, void *param) {
*/
void
vnodeDecMeterRefcnt
(
SQInfo
*
pQInfo
)
{
STableQuerySupportObj
*
pSupporter
=
pQInfo
->
pTableQuerySupporter
;
if
(
pSupporter
!=
NULL
)
{
assert
(
pSupporter
->
numOfMeters
>=
1
);
}
if
(
pSupporter
==
NULL
||
pSupporter
->
numOfMeters
==
1
)
{
atomic_fetch_sub_32
(
&
pQInfo
->
pObj
->
numOfQueries
,
1
);
dTrace
(
"QInfo:%p vid:%d sid:%d meterId:%s, query is over, numOfQueries:%d"
,
pQInfo
,
pQInfo
->
pObj
->
vnode
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录