Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
960d40d4
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看板
提交
960d40d4
编写于
2月 19, 2020
作者:
H
hjxilinx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix bugs found in regression test.
上级
acc083b2
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
67 addition
and
21 deletion
+67
-21
src/system/detail/inc/vnodeQueryImpl.h
src/system/detail/inc/vnodeQueryImpl.h
+1
-1
src/system/detail/src/vnodeQueryImpl.c
src/system/detail/src/vnodeQueryImpl.c
+62
-17
src/system/detail/src/vnodeQueryProcess.c
src/system/detail/src/vnodeQueryProcess.c
+4
-3
未找到文件。
src/system/detail/inc/vnodeQueryImpl.h
浏览文件 @
960d40d4
...
@@ -228,7 +228,7 @@ void destroyMeterQueryInfo(SMeterQueryInfo* pMeterQueryInfo, int32_t numOfCols);
...
@@ -228,7 +228,7 @@ void destroyMeterQueryInfo(SMeterQueryInfo* pMeterQueryInfo, int32_t numOfCols);
* @param skey
* @param skey
* @param ekey
* @param ekey
*/
*/
void
changeMeterQueryInfoForSuppleQuery
(
SQuery
DiskbasedResultBuf
*
pResultBuf
,
SMeterQueryInfo
*
pMeterQueryInfo
,
void
changeMeterQueryInfoForSuppleQuery
(
SQuery
*
pQuery
,
SMeterQueryInfo
*
pMeterQueryInfo
,
TSKEY
skey
,
TSKEY
ekey
);
TSKEY
skey
,
TSKEY
ekey
);
/**
/**
...
...
src/system/detail/src/vnodeQueryImpl.c
浏览文件 @
960d40d4
...
@@ -1445,9 +1445,15 @@ static char *getDataBlocks(SQueryRuntimeEnv *pRuntimeEnv, SArithmeticSupport *sa
...
@@ -1445,9 +1445,15 @@ static char *getDataBlocks(SQueryRuntimeEnv *pRuntimeEnv, SArithmeticSupport *sa
}
}
static
bool
isWindowResClosed
(
SWindowResInfo
*
pWindowResInfo
,
int32_t
slot
)
{
static
bool
isWindowResClosed
(
SWindowResInfo
*
pWindowResInfo
,
int32_t
slot
)
{
assert
(
pWindowResInfo
!=
NULL
&&
slot
>=
0
&&
slot
<
pWindowResInfo
->
size
);
return
(
pWindowResInfo
->
pResult
[
slot
].
status
.
closed
==
true
);
return
(
pWindowResInfo
->
pResult
[
slot
].
status
.
closed
==
true
);
}
}
static
SWindowResult
*
getWindowResult
(
SWindowResInfo
*
pWindowResInfo
,
int32_t
slot
)
{
assert
(
pWindowResInfo
!=
NULL
&&
slot
>=
0
&&
slot
<
pWindowResInfo
->
size
);
return
&
pWindowResInfo
->
pResult
[
slot
];
}
static
int32_t
curTimeWindow
(
SWindowResInfo
*
pWindowResInfo
)
{
static
int32_t
curTimeWindow
(
SWindowResInfo
*
pWindowResInfo
)
{
assert
(
pWindowResInfo
->
curIndex
>=
0
&&
pWindowResInfo
->
curIndex
<
pWindowResInfo
->
size
);
assert
(
pWindowResInfo
->
curIndex
>=
0
&&
pWindowResInfo
->
curIndex
<
pWindowResInfo
->
size
);
return
pWindowResInfo
->
curIndex
;
return
pWindowResInfo
->
curIndex
;
...
@@ -1516,8 +1522,6 @@ static STimeWindow getActiveTimeWindow(SWindowResInfo *pWindowResInfo, int64_t t
...
@@ -1516,8 +1522,6 @@ static STimeWindow getActiveTimeWindow(SWindowResInfo *pWindowResInfo, int64_t t
w
.
ekey
=
w
.
skey
+
pQuery
->
intervalTime
-
1
;
w
.
ekey
=
w
.
skey
+
pQuery
->
intervalTime
-
1
;
}
}
assert
(
ts
>=
w
.
skey
&&
ts
<=
w
.
ekey
&&
w
.
skey
!=
0
);
// query border check
// query border check
if
(
w
.
ekey
>
pQuery
->
ekey
&&
QUERY_IS_ASC_QUERY
(
pQuery
))
{
if
(
w
.
ekey
>
pQuery
->
ekey
&&
QUERY_IS_ASC_QUERY
(
pQuery
))
{
w
.
ekey
=
pQuery
->
ekey
;
w
.
ekey
=
pQuery
->
ekey
;
...
@@ -1526,6 +1530,11 @@ static STimeWindow getActiveTimeWindow(SWindowResInfo *pWindowResInfo, int64_t t
...
@@ -1526,6 +1530,11 @@ static STimeWindow getActiveTimeWindow(SWindowResInfo *pWindowResInfo, int64_t t
w
.
skey
=
pQuery
->
ekey
;
w
.
skey
=
pQuery
->
ekey
;
}
}
assert
(
ts
>=
w
.
skey
&&
ts
<=
w
.
ekey
&&
w
.
skey
!=
0
);
if
(
w
.
skey
==
1542597000000
)
{
int32_t
k
=
1
;
}
return
w
;
return
w
;
}
}
...
@@ -1559,6 +1568,9 @@ static int32_t addNewWindowResultBuf(SWindowResult *pWindowRes, SQueryDiskbasedR
...
@@ -1559,6 +1568,9 @@ static int32_t addNewWindowResultBuf(SWindowResult *pWindowRes, SQueryDiskbasedR
return
-
1
;
return
-
1
;
}
}
if
(
pageId
==
153
&&
pData
->
numOfElems
>=
138
)
{
int32_t
k
=
1
;
}
// set the number of rows in current disk page
// set the number of rows in current disk page
if
(
pWindowRes
->
pos
.
pageId
==
-
1
)
{
// not allocated yet, allocate new buffer
if
(
pWindowRes
->
pos
.
pageId
==
-
1
)
{
// not allocated yet, allocate new buffer
pWindowRes
->
pos
.
pageId
=
pageId
;
pWindowRes
->
pos
.
pageId
=
pageId
;
...
@@ -1686,7 +1698,7 @@ static int32_t getNumOfRowsInTimeWindow(SQuery *pQuery, SBlockInfo *pBlockInfo,
...
@@ -1686,7 +1698,7 @@ static int32_t getNumOfRowsInTimeWindow(SQuery *pQuery, SBlockInfo *pBlockInfo,
assert
(
ekey
<
pPrimaryColumn
[
startPos
]);
assert
(
ekey
<
pPrimaryColumn
[
startPos
]);
}
else
{
}
else
{
if
(
updateLastKey
)
{
if
(
updateLastKey
)
{
pQuery
->
lastKey
=
MAX
(
ekey
,
pPrimaryColumn
[
startPos
+
(
num
-
1
)])
+
step
;
pQuery
->
lastKey
=
pPrimaryColumn
[
startPos
+
(
num
-
1
)]
+
step
;
}
}
}
}
}
else
{
}
else
{
...
@@ -1702,7 +1714,7 @@ static int32_t getNumOfRowsInTimeWindow(SQuery *pQuery, SBlockInfo *pBlockInfo,
...
@@ -1702,7 +1714,7 @@ static int32_t getNumOfRowsInTimeWindow(SQuery *pQuery, SBlockInfo *pBlockInfo,
assert
(
ekey
>
pPrimaryColumn
[
startPos
]);
assert
(
ekey
>
pPrimaryColumn
[
startPos
]);
}
else
{
}
else
{
if
(
updateLastKey
)
{
if
(
updateLastKey
)
{
pQuery
->
lastKey
=
MIN
(
ekey
,
pPrimaryColumn
[
startPos
-
(
num
-
1
)])
+
step
;
pQuery
->
lastKey
=
pPrimaryColumn
[
startPos
-
(
num
-
1
)]
+
step
;
}
}
}
}
}
else
{
}
else
{
...
@@ -1712,6 +1724,10 @@ static int32_t getNumOfRowsInTimeWindow(SQuery *pQuery, SBlockInfo *pBlockInfo,
...
@@ -1712,6 +1724,10 @@ static int32_t getNumOfRowsInTimeWindow(SQuery *pQuery, SBlockInfo *pBlockInfo,
}
}
}
}
}
}
if
(
pQuery
->
lastKey
==
1542597000001
)
{
int32_t
k
=
1
;
}
assert
(
num
>=
0
);
assert
(
num
>=
0
);
return
num
;
return
num
;
...
@@ -1849,12 +1865,20 @@ static int32_t blockwiseApplyAllFunctions(SQueryRuntimeEnv *pRuntimeEnv, int32_t
...
@@ -1849,12 +1865,20 @@ static int32_t blockwiseApplyAllFunctions(SQueryRuntimeEnv *pRuntimeEnv, int32_t
TSKEY
ts
=
primaryKeyCol
[
offset
];
TSKEY
ts
=
primaryKeyCol
[
offset
];
STimeWindow
win
=
getActiveTimeWindow
(
pWindowResInfo
,
ts
,
pQuery
);
STimeWindow
win
=
getActiveTimeWindow
(
pWindowResInfo
,
ts
,
pQuery
);
if
(
win
.
skey
>=
1542597000000
&&
pRuntimeEnv
->
pMeterObj
->
sid
==
9
&&
IS_MASTER_SCAN
(
pRuntimeEnv
))
{
int32_t
k
=
1
;
}
if
(
win
.
skey
>=
1542597000000
&&
pRuntimeEnv
->
pMeterObj
->
sid
==
9
&&
!
IS_MASTER_SCAN
(
pRuntimeEnv
))
{
int32_t
k
=
1
;
}
if
(
setWindowOutputBufByKey
(
pRuntimeEnv
,
pWindowResInfo
,
pRuntimeEnv
->
pMeterObj
->
sid
,
&
win
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
setWindowOutputBufByKey
(
pRuntimeEnv
,
pWindowResInfo
,
pRuntimeEnv
->
pMeterObj
->
sid
,
&
win
)
!=
TSDB_CODE_SUCCESS
)
{
return
0
;
return
0
;
}
}
TSKEY
ekey
=
QUERY_IS_ASC_QUERY
(
pQuery
)
?
win
.
ekey
:
win
.
skey
;
TSKEY
ekey
=
QUERY_IS_ASC_QUERY
(
pQuery
)
?
win
.
ekey
:
win
.
skey
;
forwardStep
=
getNumOfRowsInTimeWindow
(
pQuery
,
pBlockInfo
,
primaryKeyCol
,
pQuery
->
pos
,
ekey
,
searchFn
,
fals
e
);
forwardStep
=
getNumOfRowsInTimeWindow
(
pQuery
,
pBlockInfo
,
primaryKeyCol
,
pQuery
->
pos
,
ekey
,
searchFn
,
tru
e
);
SWindowStatus
*
pStatus
=
getTimeWindowResStatus
(
pWindowResInfo
,
curTimeWindow
(
pWindowResInfo
));
SWindowStatus
*
pStatus
=
getTimeWindowResStatus
(
pWindowResInfo
,
curTimeWindow
(
pWindowResInfo
));
doBlockwiseApplyFunctions
(
pRuntimeEnv
,
pStatus
,
&
win
,
pQuery
->
pos
,
forwardStep
);
doBlockwiseApplyFunctions
(
pRuntimeEnv
,
pStatus
,
&
win
,
pQuery
->
pos
,
forwardStep
);
...
@@ -1868,7 +1892,11 @@ static int32_t blockwiseApplyAllFunctions(SQueryRuntimeEnv *pRuntimeEnv, int32_t
...
@@ -1868,7 +1892,11 @@ static int32_t blockwiseApplyAllFunctions(SQueryRuntimeEnv *pRuntimeEnv, int32_t
if
(
startPos
<
0
)
{
if
(
startPos
<
0
)
{
break
;
break
;
}
}
if
(
nextWin
.
skey
>=
1542597000000
&&
pRuntimeEnv
->
pMeterObj
->
sid
==
9
&&
IS_MASTER_SCAN
(
pRuntimeEnv
))
{
int32_t
k
=
1
;
}
// null data, failed to allocate more memory buffer
// null data, failed to allocate more memory buffer
int32_t
sid
=
pRuntimeEnv
->
pMeterObj
->
sid
;
int32_t
sid
=
pRuntimeEnv
->
pMeterObj
->
sid
;
if
(
setWindowOutputBufByKey
(
pRuntimeEnv
,
pWindowResInfo
,
sid
,
&
nextWin
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
setWindowOutputBufByKey
(
pRuntimeEnv
,
pWindowResInfo
,
sid
,
&
nextWin
)
!=
TSDB_CODE_SUCCESS
)
{
...
@@ -1876,7 +1904,7 @@ static int32_t blockwiseApplyAllFunctions(SQueryRuntimeEnv *pRuntimeEnv, int32_t
...
@@ -1876,7 +1904,7 @@ static int32_t blockwiseApplyAllFunctions(SQueryRuntimeEnv *pRuntimeEnv, int32_t
}
}
ekey
=
QUERY_IS_ASC_QUERY
(
pQuery
)
?
nextWin
.
ekey
:
nextWin
.
skey
;
ekey
=
QUERY_IS_ASC_QUERY
(
pQuery
)
?
nextWin
.
ekey
:
nextWin
.
skey
;
forwardStep
=
getNumOfRowsInTimeWindow
(
pQuery
,
pBlockInfo
,
primaryKeyCol
,
startPos
,
ekey
,
searchFn
,
fals
e
);
forwardStep
=
getNumOfRowsInTimeWindow
(
pQuery
,
pBlockInfo
,
primaryKeyCol
,
startPos
,
ekey
,
searchFn
,
tru
e
);
pStatus
=
getTimeWindowResStatus
(
pWindowResInfo
,
curTimeWindow
(
pWindowResInfo
));
pStatus
=
getTimeWindowResStatus
(
pWindowResInfo
,
curTimeWindow
(
pWindowResInfo
));
doBlockwiseApplyFunctions
(
pRuntimeEnv
,
pStatus
,
&
nextWin
,
startPos
,
forwardStep
);
doBlockwiseApplyFunctions
(
pRuntimeEnv
,
pStatus
,
&
nextWin
,
startPos
,
forwardStep
);
...
@@ -5486,7 +5514,7 @@ static void printBinaryData(int32_t functionId, char *data, int32_t srcDataType)
...
@@ -5486,7 +5514,7 @@ static void printBinaryData(int32_t functionId, char *data, int32_t srcDataType)
void
UNUSED_FUNC
displayInterResult
(
SData
**
pdata
,
SQuery
*
pQuery
,
int32_t
numOfRows
)
{
void
UNUSED_FUNC
displayInterResult
(
SData
**
pdata
,
SQuery
*
pQuery
,
int32_t
numOfRows
)
{
int32_t
numOfCols
=
pQuery
->
numOfOutputCols
;
int32_t
numOfCols
=
pQuery
->
numOfOutputCols
;
printf
(
"
metric query intern-
result, total:%d
\n
"
,
numOfRows
);
printf
(
"
super table query intermediate
result, total:%d
\n
"
,
numOfRows
);
SQInfo
*
pQInfo
=
(
SQInfo
*
)(
GET_QINFO_ADDR
(
pQuery
));
SQInfo
*
pQInfo
=
(
SQInfo
*
)(
GET_QINFO_ADDR
(
pQuery
));
SMeterObj
*
pMeterObj
=
pQInfo
->
pObj
;
SMeterObj
*
pMeterObj
=
pQInfo
->
pObj
;
...
@@ -5720,6 +5748,8 @@ int32_t doMergeMetersResultsToGroupRes(STableQuerySupportObj *pSupporter, SQuery
...
@@ -5720,6 +5748,8 @@ int32_t doMergeMetersResultsToGroupRes(STableQuerySupportObj *pSupporter, SQuery
tFilePage
*
pPage
=
getMeterDataPage
(
pResultBuf
,
pTableList
[
pos
]
->
pMeterQInfo
,
position
->
pageIdx
);
tFilePage
*
pPage
=
getMeterDataPage
(
pResultBuf
,
pTableList
[
pos
]
->
pMeterQInfo
,
position
->
pageIdx
);
int64_t
ts
=
getCurrentTimestamp
(
&
cs
,
pos
);
int64_t
ts
=
getCurrentTimestamp
(
&
cs
,
pos
);
assert
(
ts
>
0
);
if
(
ts
==
lastTimestamp
)
{
// merge with the last one
if
(
ts
==
lastTimestamp
)
{
// merge with the last one
doMerge
(
pRuntimeEnv
,
ts
,
pPage
,
position
->
rowIdx
,
true
);
doMerge
(
pRuntimeEnv
,
ts
,
pPage
,
position
->
rowIdx
,
true
);
}
else
{
}
else
{
...
@@ -6559,15 +6589,25 @@ void destroyMeterQueryInfo(SMeterQueryInfo *pMeterQueryInfo, int32_t numOfCols)
...
@@ -6559,15 +6589,25 @@ void destroyMeterQueryInfo(SMeterQueryInfo *pMeterQueryInfo, int32_t numOfCols)
free
(
pMeterQueryInfo
);
free
(
pMeterQueryInfo
);
}
}
void
changeMeterQueryInfoForSuppleQuery
(
SQuery
DiskbasedResultBuf
*
pResultBuf
,
SMeterQueryInfo
*
pMeterQueryInfo
,
void
changeMeterQueryInfoForSuppleQuery
(
SQuery
*
pQuery
,
SMeterQueryInfo
*
pMeterQueryInfo
,
TSKEY
skey
,
TSKEY
ekey
)
{
TSKEY
skey
,
TSKEY
ekey
)
{
if
(
pMeterQueryInfo
==
NULL
)
{
if
(
pMeterQueryInfo
==
NULL
)
{
return
;
return
;
}
}
//order has change already!
int32_t
step
=
GET_FORWARD_DIRECTION_FACTOR
(
pQuery
->
order
.
order
);
if
(
!
QUERY_IS_ASC_QUERY
(
pQuery
))
{
assert
(
pMeterQueryInfo
->
ekey
>=
pMeterQueryInfo
->
lastKey
+
step
);
}
else
{
assert
(
pMeterQueryInfo
->
ekey
<=
pMeterQueryInfo
->
lastKey
+
step
);
}
pMeterQueryInfo
->
ekey
=
pMeterQueryInfo
->
lastKey
+
step
;
SWAP
(
pMeterQueryInfo
->
skey
,
pMeterQueryInfo
->
ekey
,
TSKEY
);
SWAP
(
pMeterQueryInfo
->
skey
,
pMeterQueryInfo
->
ekey
,
TSKEY
);
pMeterQueryInfo
->
lastKey
=
pMeterQueryInfo
->
skey
;
pMeterQueryInfo
->
lastKey
=
pMeterQueryInfo
->
skey
;
// pMeterQueryInfo->queryRangeSet = 0;
// pMeterQueryInfo->queryRangeSet = 0;
pMeterQueryInfo
->
cur
.
order
=
pMeterQueryInfo
->
cur
.
order
^
1
;
pMeterQueryInfo
->
cur
.
order
=
pMeterQueryInfo
->
cur
.
order
^
1
;
pMeterQueryInfo
->
cur
.
vnodeIndex
=
-
1
;
pMeterQueryInfo
->
cur
.
vnodeIndex
=
-
1
;
...
@@ -7524,15 +7564,20 @@ void applyIntervalQueryOnBlock(STableQuerySupportObj *pSupporter, SMeterDataInfo
...
@@ -7524,15 +7564,20 @@ void applyIntervalQueryOnBlock(STableQuerySupportObj *pSupporter, SMeterDataInfo
if
(
pQuery
->
intervalTime
==
0
)
{
// todo refactor
if
(
pQuery
->
intervalTime
==
0
)
{
// todo refactor
SWindowResInfo
*
p1
=
&
pRuntimeEnv
->
windowResInfo
;
SWindowResInfo
*
p1
=
&
pRuntimeEnv
->
windowResInfo
;
for
(
int32_t
i
=
0
;
i
<
p1
->
size
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
p1
->
size
;
++
i
)
{
p1
->
pResult
[
i
].
numOfRows
=
p1
->
pResult
->
resultInfo
->
numOfRes
;
SWindowResult
*
pResult
=
getWindowResult
(
p1
,
i
);
if
(
isWindowResClosed
(
p1
,
i
)
&&
pResult
->
numOfRows
==
0
)
{
pResult
->
numOfRows
=
getNumOfResult
(
pRuntimeEnv
);
}
}
}
}
}
int32_t
step
=
GET_FORWARD_DIRECTION_FACTOR
(
pQuery
->
order
.
order
);
// get the true maximum timestamp within the query range to set the correct time window
if
((
pQuery
->
lastKey
>
pSupporter
->
rawEKey
&&
QUERY_IS_ASC_QUERY
(
pQuery
))
||
// in the supplementary query
(
pQuery
->
lastKey
<
pSupporter
->
rawEKey
&&
!
QUERY_IS_ASC_QUERY
(
pQuery
)))
{
// int32_t step = GET_FORWARD_DIRECTION_FACTOR(pQuery->order.order);
pMeterQueryInfo
->
ekey
=
pQuery
->
lastKey
-
step
;
// if ((pQuery->lastKey > pBlockInfo->keyLast && QUERY_IS_ASC_QUERY(pQuery)) ||
}
// (pQuery->lastKey < pBlockInfo->keyFirst && !QUERY_IS_ASC_QUERY(pQuery))) {
// pMeterQueryInfo->ekey = pQuery->lastKey - step;
// }
updatelastkey
(
pQuery
,
pMeterQueryInfo
);
updatelastkey
(
pQuery
,
pMeterQueryInfo
);
}
}
...
...
src/system/detail/src/vnodeQueryProcess.c
浏览文件 @
960d40d4
...
@@ -849,10 +849,11 @@ static void doOrderedScan(SQInfo *pQInfo) {
...
@@ -849,10 +849,11 @@ static void doOrderedScan(SQInfo *pQInfo) {
}
}
static
void
setupMeterQueryInfoForSupplementQuery
(
STableQuerySupportObj
*
pSupporter
)
{
static
void
setupMeterQueryInfoForSupplementQuery
(
STableQuerySupportObj
*
pSupporter
)
{
SQuery
*
pQuery
=
pSupporter
->
runtimeEnv
.
pQuery
;
for
(
int32_t
i
=
0
;
i
<
pSupporter
->
numOfMeters
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pSupporter
->
numOfMeters
;
++
i
)
{
SMeterQueryInfo
*
pMeterQueryInfo
=
pSupporter
->
pMeterDataInfo
[
i
].
pMeterQInfo
;
SMeterQueryInfo
*
pMeterQueryInfo
=
pSupporter
->
pMeterDataInfo
[
i
].
pMeterQInfo
;
SQueryDiskbasedResultBuf
*
pResultBuf
=
pSupporter
->
runtimeEnv
.
pResultBuf
;
changeMeterQueryInfoForSuppleQuery
(
pQuery
,
pMeterQueryInfo
,
pSupporter
->
rawSKey
,
pSupporter
->
rawEKey
);
changeMeterQueryInfoForSuppleQuery
(
pResultBuf
,
pMeterQueryInfo
,
pSupporter
->
rawSKey
,
pSupporter
->
rawEKey
);
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录