Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
KASAKI11
TDengine
提交
e9dc2db7
T
TDengine
项目概览
KASAKI11
/
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e9dc2db7
编写于
2月 20, 2020
作者:
H
hjxilinx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix bugs found in regression test.
上级
8928dea5
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
301 addition
and
408 deletion
+301
-408
src/client/src/tscServer.c
src/client/src/tscServer.c
+7
-4
src/system/detail/inc/vnodeQueryImpl.h
src/system/detail/inc/vnodeQueryImpl.h
+6
-10
src/system/detail/inc/vnodeRead.h
src/system/detail/inc/vnodeRead.h
+4
-9
src/system/detail/src/vnodeQueryImpl.c
src/system/detail/src/vnodeQueryImpl.c
+241
-342
src/system/detail/src/vnodeQueryProcess.c
src/system/detail/src/vnodeQueryProcess.c
+43
-43
未找到文件。
src/client/src/tscServer.c
浏览文件 @
e9dc2db7
...
...
@@ -2817,11 +2817,14 @@ int tscBuildMetricMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
offset
=
pMsg
-
(
char
*
)
pMetaMsg
;
pElem
->
tableCond
=
htonl
(
offset
);
uint32_t
len
=
strlen
(
pTagCond
->
tbnameCond
.
cond
);
uint32_t
len
=
0
;
if
(
pTagCond
->
tbnameCond
.
cond
!=
NULL
)
{
len
=
strlen
(
pTagCond
->
tbnameCond
.
cond
);
memcpy
(
pMsg
,
pTagCond
->
tbnameCond
.
cond
,
len
);
}
pElem
->
tableCondLen
=
htonl
(
len
);
memcpy
(
pMsg
,
pTagCond
->
tbnameCond
.
cond
,
len
);
pMsg
+=
len
;
}
...
...
src/system/detail/inc/vnodeQueryImpl.h
浏览文件 @
e9dc2db7
...
...
@@ -153,7 +153,6 @@ void doSkipResults(SQueryRuntimeEnv* pRuntimeEnv);
void
doFinalizeResult
(
SQueryRuntimeEnv
*
pRuntimeEnv
);
int64_t
getNumOfResult
(
SQueryRuntimeEnv
*
pRuntimeEnv
);
void
forwardIntervalQueryRange
(
STableQuerySupportObj
*
pSupporter
,
SQueryRuntimeEnv
*
pRuntimeEnv
);
void
forwardQueryStartPosition
(
SQueryRuntimeEnv
*
pRuntimeEnv
);
bool
normalizedFirstQueryRange
(
bool
dataInDisk
,
bool
dataInCache
,
STableQuerySupportObj
*
pSupporter
,
...
...
@@ -171,12 +170,10 @@ void enableFunctForMasterScan(SQueryRuntimeEnv* pRuntimeEnv, int32_t order);
int32_t
mergeMetersResultToOneGroups
(
STableQuerySupportObj
*
pSupporter
);
void
copyFromWindowResToSData
(
SQInfo
*
pQInfo
,
SWindowResult
*
result
);
SBlockInfo
getBlockBasicInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
void
*
pBlock
,
int32_t
blockType
);
S
CacheBlock
*
getCacheDataBlock
(
SMeterObj
*
pMeterObj
,
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
slot
);
SBlockInfo
getBlockInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
);
S
BlockInfo
getBlockBasicInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
void
*
pBlock
,
int32_t
type
);
// void queryOnBlock(STableQuerySupportObj* pSupporter, int32_t blockStatus, SBlockInfo* pBlockBasicInfo,
// SMeterDataInfo* pDataHeadInfoEx, SField* pFields,
// __block_search_fn_t searchFn);
SCacheBlock
*
getCacheDataBlock
(
SMeterObj
*
pMeterObj
,
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
slot
);
void
stableApplyFunctionsOnBlock
(
STableQuerySupportObj
*
pSupporter
,
SMeterDataInfo
*
pMeterDataInfo
,
SBlockInfo
*
pBlockInfo
,
SField
*
pFields
,
__block_search_fn_t
searchFn
);
...
...
@@ -190,14 +187,13 @@ int32_t createDataBlocksInfoEx(SMeterDataInfo** pMeterDataInfo, int32_t numOfMet
int32_t
*
nAllocBlocksInfoSize
,
int64_t
addr
);
void
freeMeterBlockInfoEx
(
SMeterDataBlockInfoEx
*
pDataBlockInfoEx
,
int32_t
len
);
void
setExecutionContext
(
STableQuerySupportObj
*
pSupporter
,
S
WindowResult
*
outputRes
,
int32_t
meterIdx
,
int32_t
groupIdx
,
SMeterQueryInfo
*
sqinfo
);
int32_t
set
IntervalQueryExecutionContext
(
STableQuerySupportObj
*
pSupporter
,
int32_t
meterIdx
,
SMeterQueryInfo
*
sqi
nfo
);
void
setExecutionContext
(
STableQuerySupportObj
*
pSupporter
,
S
MeterQueryInfo
*
pMeterQueryInfo
,
int32_t
meterIdx
,
int32_t
groupIdx
,
TSKEY
nextKey
);
int32_t
set
AdditionalInfo
(
STableQuerySupportObj
*
pSupporter
,
int32_t
meterIdx
,
SMeterQueryInfo
*
pMeterQueryI
nfo
);
void
doGetAlignedIntervalQueryRangeImpl
(
SQuery
*
pQuery
,
int64_t
pKey
,
int64_t
keyFirst
,
int64_t
keyLast
,
int64_t
*
actualSkey
,
int64_t
*
actualEkey
,
int64_t
*
skey
,
int64_t
*
ekey
);
int64_t
getQueryStartPositionInCache
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
*
slot
,
int32_t
*
pos
,
bool
ignoreQueryRange
);
int64_t
getNextAccessedKeyInData
(
SQuery
*
pQuery
,
int64_t
*
pPrimaryCol
,
SBlockInfo
*
pBlockInfo
,
int32_t
blockStatus
);
int32_t
getDataBlocksForMeters
(
STableQuerySupportObj
*
pSupporter
,
SQuery
*
pQuery
,
int32_t
numOfMeters
,
const
char
*
filePath
,
SMeterDataInfo
**
pMeterDataInfo
,
uint32_t
*
numOfBlocks
);
...
...
src/system/detail/inc/vnodeRead.h
浏览文件 @
e9dc2db7
...
...
@@ -169,19 +169,16 @@ typedef struct SQueryRuntimeEnv {
STSBuf
*
pTSBuf
;
STSCursor
cur
;
SQueryCostSummary
summary
;
S
TimeWindow
intervalWindow
;
// the complete time window, not affected by the actual data distribution
bool
stableQuery
;
// is super table query or not
S
QueryDiskbasedResultBuf
*
pResultBuf
;
// query result buffer based on blocked-wised disk file
/*
* Temporarily hold the in-memory cache block info during scan cache blocks
* Here we do not use the cacheblock info from pMeterObj, simple because it may change anytime
* during the query by the sub
u
mit/insert handling threads.
* Here we do not use the cache
block info from pMeterObj, simple because it may change anytime
* during the query by the submit/insert handling threads.
* So we keep a copy of the support structure as well as the cache block data itself.
*/
SCacheBlock
cacheBlock
;
SQueryDiskbasedResultBuf
*
pResultBuf
;
// query result buffer based on blocked-wised disk file
bool
stableQuery
;
// is super table query or not
}
SQueryRuntimeEnv
;
/* intermediate pos during multimeter query involves interval */
...
...
@@ -222,13 +219,11 @@ typedef struct STableQuerySupportObj {
* rows may be generated by a specific subgroup. When query on all subgroups is executed,
* the result is copy to output buffer. This attribution is not used during single meter query processing.
*/
// SWindowResult* pResult;
SQueryRuntimeEnv
runtimeEnv
;
int64_t
rawSKey
;
int64_t
rawEKey
;
int32_t
subgroupIdx
;
int32_t
offset
;
/* offset in group result set of subgroup */
tSidSet
*
pSidSet
;
/*
...
...
src/system/detail/src/vnodeQueryImpl.c
浏览文件 @
e9dc2db7
此差异已折叠。
点击以展开。
src/system/detail/src/vnodeQueryProcess.c
浏览文件 @
e9dc2db7
...
...
@@ -84,7 +84,7 @@ static void enableExecutionForNextTable(SQueryRuntimeEnv *pRuntimeEnv) {
}
}
static
void
queryOnMultiDataCache
(
SQInfo
*
pQInfo
,
SMeterDataInfo
*
pMeterInfo
)
{
static
void
queryOnMultiDataCache
(
SQInfo
*
pQInfo
,
SMeterDataInfo
*
pMeter
Data
Info
)
{
SQuery
*
pQuery
=
&
pQInfo
->
query
;
STableQuerySupportObj
*
pSupporter
=
pQInfo
->
pTableQuerySupporter
;
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
pQInfo
->
pTableQuerySupporter
->
runtimeEnv
;
...
...
@@ -119,18 +119,18 @@ static void queryOnMultiDataCache(SQInfo *pQInfo, SMeterDataInfo *pMeterInfo) {
pQInfo
->
pObj
=
pMeterObj
;
pRuntimeEnv
->
pMeterObj
=
pMeterObj
;
if
(
pMeterInfo
[
k
].
pMeterQInfo
==
NULL
)
{
pMeterInfo
[
k
].
pMeterQInfo
=
if
(
pMeter
Data
Info
[
k
].
pMeterQInfo
==
NULL
)
{
pMeter
Data
Info
[
k
].
pMeterQInfo
=
createMeterQueryInfo
(
pSupporter
,
pMeterObj
->
sid
,
pSupporter
->
rawSKey
,
pSupporter
->
rawEKey
);
}
if
(
pMeterInfo
[
k
].
pMeterObj
==
NULL
)
{
// no data in disk for this meter, set its pointer
setMeterDataInfo
(
&
pMeterInfo
[
k
],
pMeterObj
,
k
,
groupIdx
);
if
(
pMeter
Data
Info
[
k
].
pMeterObj
==
NULL
)
{
// no data in disk for this meter, set its pointer
setMeterDataInfo
(
&
pMeter
Data
Info
[
k
],
pMeterObj
,
k
,
groupIdx
);
}
assert
(
pMeter
Info
[
k
].
meterOrderIdx
==
k
&&
pMeterObj
==
pMeter
Info
[
k
].
pMeterObj
);
assert
(
pMeter
DataInfo
[
k
].
meterOrderIdx
==
k
&&
pMeterObj
==
pMeterData
Info
[
k
].
pMeterObj
);
SMeterQueryInfo
*
pMeterQueryInfo
=
pMeterInfo
[
k
].
pMeterQInfo
;
SMeterQueryInfo
*
pMeterQueryInfo
=
pMeter
Data
Info
[
k
].
pMeterQInfo
;
restoreIntervalQueryRange
(
pRuntimeEnv
,
pMeterQueryInfo
);
/*
...
...
@@ -208,11 +208,10 @@ static void queryOnMultiDataCache(SQInfo *pQInfo, SMeterDataInfo *pMeterInfo) {
}
if
(
pQuery
->
intervalTime
==
0
)
{
setExecutionContext
(
pSupporter
,
pRuntimeEnv
->
windowResInfo
.
pResult
,
k
,
pMeterInfo
[
k
].
groupIdx
,
pMeterQueryInfo
);
setExecutionContext
(
pSupporter
,
pMeterQueryInfo
,
k
,
pMeterDataInfo
[
k
].
groupIdx
,
key
);
}
else
{
setIntervalQueryRange
(
pMeterQueryInfo
,
pSupporter
,
key
);
int32_t
ret
=
set
IntervalQueryExecutionContext
(
pSupporter
,
k
,
pMeterQueryInfo
);
int32_t
ret
=
set
AdditionalInfo
(
pSupporter
,
k
,
pMeterQueryInfo
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
pQInfo
->
killed
=
1
;
return
;
...
...
@@ -224,14 +223,14 @@ static void queryOnMultiDataCache(SQInfo *pQInfo, SMeterDataInfo *pMeterInfo) {
// only record the key on last block
SET_CACHE_BLOCK_FLAG
(
pRuntimeEnv
->
blockStatus
);
SBlockInfo
binfo
=
getBlock
BasicInfo
(
pRuntimeEnv
,
pBlock
,
BLK_CACHE_BLOCK
);
SBlockInfo
binfo
=
getBlock
Info
(
pRuntimeEnv
);
dTrace
(
"QInfo:%p check data block, brange:%"
PRId64
"-%"
PRId64
", fileId:%d, slot:%d, pos:%d, bstatus:%d"
,
GET_QINFO_ADDR
(
pQuery
),
binfo
.
keyFirst
,
binfo
.
keyLast
,
pQuery
->
fileId
,
pQuery
->
slot
,
pQuery
->
pos
,
pRuntimeEnv
->
blockStatus
);
totalBlocks
++
;
stableApplyFunctionsOnBlock
(
pSupporter
,
&
pMeterInfo
[
k
],
&
binfo
,
NULL
,
searchFn
);
stableApplyFunctionsOnBlock
(
pSupporter
,
&
pMeter
Data
Info
[
k
],
&
binfo
,
NULL
,
searchFn
);
if
(
ALL_CACHE_BLOCKS_CHECKED
(
pQuery
))
{
break
;
...
...
@@ -400,8 +399,8 @@ static void queryOnMultiDataFiles(SQInfo *pQInfo, SMeterDataInfo *pMeterDataInfo
SCompBlock
*
pBlock
=
pInfoEx
->
pBlock
.
compBlock
;
bool
ondemandLoad
=
onDemandLoadDatablock
(
pQuery
,
pMeterQueryInfo
->
queryRangeSet
);
int32_t
ret
=
LoadDatablockOnDemand
(
pBlock
,
&
pInfoEx
->
pBlock
.
fields
,
&
pRuntimeEnv
->
blockStatus
,
pRuntimeEnv
,
fileIdx
,
pInfoEx
->
blockIndex
,
searchFn
,
ondemandLoad
);
ret
=
LoadDatablockOnDemand
(
pBlock
,
&
pInfoEx
->
pBlock
.
fields
,
&
pRuntimeEnv
->
blockStatus
,
pRuntimeEnv
,
fileIdx
,
pInfoEx
->
blockIndex
,
searchFn
,
ondemandLoad
);
if
(
ret
!=
DISK_DATA_LOADED
)
{
pSummary
->
skippedFileBlocks
++
;
continue
;
...
...
@@ -425,21 +424,22 @@ static void queryOnMultiDataFiles(SQInfo *pQInfo, SMeterDataInfo *pMeterDataInfo
// if data block is not loaded, it must be the intermediate blocks
assert
((
pBlock
->
keyFirst
>=
pQuery
->
lastKey
&&
pBlock
->
keyLast
<=
pQuery
->
ekey
&&
QUERY_IS_ASC_QUERY
(
pQuery
))
||
(
pBlock
->
keyFirst
>=
pQuery
->
ekey
&&
pBlock
->
keyLast
<=
pQuery
->
lastKey
&&
!
QUERY_IS_ASC_QUERY
(
pQuery
)));
nextKey
=
QUERY_IS_ASC_QUERY
(
pQuery
)
?
pBlock
->
keyFirst
:
pBlock
->
keyLast
;
}
if
(
pQuery
->
intervalTime
==
0
)
{
setExecutionContext
(
pSupporter
,
p
RuntimeEnv
->
windowResInfo
.
pResult
,
pOneMeterDataInfo
->
meterOrder
Idx
,
pOneMeterDataInfo
->
groupIdx
,
pMeterQueryInfo
);
}
else
/* if (pQuery->intervalTime > 0)*/
{
// interval query
setExecutionContext
(
pSupporter
,
p
MeterQueryInfo
,
pOneMeterDataInfo
->
meterOrderIdx
,
pOneMeterDataInfo
->
group
Idx
,
nextKey
);
}
else
{
// interval query
setIntervalQueryRange
(
pMeterQueryInfo
,
pSupporter
,
nextKey
);
ret
=
set
IntervalQueryExecutionContext
(
pSupporter
,
pOneMeterDataInfo
->
meterOrderIdx
,
pMeterQueryInfo
);
ret
=
set
AdditionalInfo
(
pSupporter
,
pOneMeterDataInfo
->
meterOrderIdx
,
pMeterQueryInfo
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
tfree
(
pReqMeterDataInfo
);
// error code has been set
pQInfo
->
killed
=
1
;
return
;
}
}
stableApplyFunctionsOnBlock
(
pSupporter
,
pOneMeterDataInfo
,
&
binfo
,
pInfoEx
->
pBlock
.
fields
,
searchFn
);
}
...
...
@@ -849,8 +849,8 @@ static void doOrderedScan(SQInfo *pQInfo) {
}
static
void
setupMeterQueryInfoForSupplementQuery
(
STableQuerySupportObj
*
pSupporter
)
{
SQuery
*
pQuery
=
pSupporter
->
runtimeEnv
.
pQuery
;
SQuery
*
pQuery
=
pSupporter
->
runtimeEnv
.
pQuery
;
for
(
int32_t
i
=
0
;
i
<
pSupporter
->
numOfMeters
;
++
i
)
{
SMeterQueryInfo
*
pMeterQueryInfo
=
pSupporter
->
pMeterDataInfo
[
i
].
pMeterQInfo
;
changeMeterQueryInfoForSuppleQuery
(
pQuery
,
pMeterQueryInfo
,
pSupporter
->
rawSKey
,
pSupporter
->
rawEKey
);
...
...
@@ -1101,7 +1101,7 @@ static void vnodeSingleMeterIntervalMainLooper(STableQuerySupportObj *pSupporter
doFinalizeResult
(
pRuntimeEnv
);
// int64_t maxOutput = getNumOfResult(pRuntimeEnv);
// int64_t maxOutput = getNumOfResult(pRuntimeEnv);
// here we can ignore the records in case of no interpolation
// todo handle offset, in case of top/bottom interval query
...
...
@@ -1109,8 +1109,8 @@ static void vnodeSingleMeterIntervalMainLooper(STableQuerySupportObj *pSupporter
pQuery
->
interpoType
==
TSDB_INTERPO_NONE
)
{
// maxOutput <= 0, means current query does not generate any results
int32_t
numOfClosed
=
numOfClosedTimeWindow
(
&
pRuntimeEnv
->
windowResInfo
);
int32_t
c
=
MIN
(
numOfClosed
,
pQuery
->
limit
.
offset
);
int32_t
c
=
MIN
(
numOfClosed
,
pQuery
->
limit
.
offset
);
clearFirstNTimeWindow
(
pRuntimeEnv
,
c
);
pQuery
->
limit
.
offset
-=
c
;
}
else
{
...
...
@@ -1127,16 +1127,16 @@ static void vnodeSingleMeterIntervalMainLooper(STableQuerySupportObj *pSupporter
break
;
}
// /*
// * the scan limitation mechanism is upon here,
// * 1. since there is only one(k) record is generated in one scan operation
// * 2. remain space is not sufficient for next query output, abort
// */
// if ((pQuery->pointsRead % pQuery->pointsToRead == 0 && pQuery->pointsRead != 0) ||
// ((pQuery->pointsRead + maxOutput) > pQuery->pointsToRead)) {
// setQueryStatus(pQuery, QUERY_RESBUF_FULL);
// break;
// }
// /*
// * the scan limitation mechanism is upon here,
// * 1. since there is only one(k) record is generated in one scan operation
// * 2. remain space is not sufficient for next query output, abort
// */
// if ((pQuery->pointsRead % pQuery->pointsToRead == 0 && pQuery->pointsRead != 0) ||
// ((pQuery->pointsRead + maxOutput) > pQuery->pointsToRead)) {
// setQueryStatus(pQuery, QUERY_RESBUF_FULL);
// break;
// }
}
}
...
...
@@ -1158,7 +1158,7 @@ static void vnodeSingleTableIntervalProcessor(SQInfo *pQInfo) {
pSupporter
->
subgroupIdx
=
0
;
// always start from 0
pQuery
->
pointsRead
=
0
;
copyFromWindowResToSData
(
pQInfo
,
pRuntimeEnv
->
windowResInfo
.
pResult
);
clearFirstNTimeWindow
(
pRuntimeEnv
,
pSupporter
->
subgroupIdx
);
}
...
...
@@ -1221,11 +1221,11 @@ void vnodeSingleTableQuery(SSchedMsg *pMsg) {
assert
(
pQInfo
->
refCount
>=
1
);
SQuery
*
pQuery
=
&
pQInfo
->
query
;
SMeterObj
*
pMeterObj
=
pQInfo
->
pObj
;
STableQuerySupportObj
*
pSupporter
=
pQInfo
->
pTableQuerySupporter
;
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
pSupporter
->
runtimeEnv
;
SQuery
*
pQuery
=
&
pQInfo
->
query
;
SMeterObj
*
pMeterObj
=
pQInfo
->
pObj
;
STableQuerySupportObj
*
pSupporter
=
pQInfo
->
pTableQuerySupporter
;
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
pSupporter
->
runtimeEnv
;
assert
(
pRuntimeEnv
->
pMeterObj
==
pMeterObj
);
dTrace
(
"vid:%d sid:%d id:%s, query thread is created, numOfQueries:%d, QInfo:%p"
,
pMeterObj
->
vnode
,
pMeterObj
->
sid
,
...
...
@@ -1265,13 +1265,13 @@ void vnodeSingleTableQuery(SSchedMsg *pMsg) {
if
(
isGroupbyNormalCol
(
pQuery
->
pGroupbyExpr
)
||
pQuery
->
intervalTime
>
0
)
{
pQuery
->
pointsRead
=
0
;
pSupporter
->
subgroupIdx
=
0
;
// always start from 0
if
(
pRuntimeEnv
->
windowResInfo
.
size
>
0
)
{
copyFromWindowResToSData
(
pQInfo
,
pRuntimeEnv
->
windowResInfo
.
pResult
);
pQInfo
->
pointsRead
+=
pQuery
->
pointsRead
;
clearFirstNTimeWindow
(
pRuntimeEnv
,
pSupporter
->
subgroupIdx
);
if
(
pQuery
->
pointsRead
>
0
)
{
dTrace
(
"QInfo:%p vid:%d sid:%d id:%s, %d points returned %d from group results, totalRead:%d totalReturn:%d"
,
pQInfo
,
pMeterObj
->
vnode
,
pMeterObj
->
sid
,
pMeterObj
->
meterId
,
pQuery
->
pointsRead
,
pQInfo
->
pointsRead
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录