Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
ca136d47
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看板
提交
ca136d47
编写于
1月 14, 2020
作者:
H
hjxilinx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add the support of issue #1131. [tbase-901]
上级
33367d70
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
530 addition
and
474 deletion
+530
-474
src/client/src/tscParseInsert.c
src/client/src/tscParseInsert.c
+0
-1
src/client/src/tscSql.c
src/client/src/tscSql.c
+1
-1
src/system/detail/inc/vnodeQueryImpl.h
src/system/detail/inc/vnodeQueryImpl.h
+4
-3
src/system/detail/inc/vnodeRead.h
src/system/detail/inc/vnodeRead.h
+26
-18
src/system/detail/src/vnodeQueryImpl.c
src/system/detail/src/vnodeQueryImpl.c
+482
-434
src/system/detail/src/vnodeQueryProcess.c
src/system/detail/src/vnodeQueryProcess.c
+17
-17
未找到文件。
src/client/src/tscParseInsert.c
浏览文件 @
ca136d47
...
...
@@ -1307,7 +1307,6 @@ int tsParseSql(SSqlObj *pSql, bool multiVnodeInsertion) {
tscTrace
(
"continue parse sql: %s"
,
pSql
->
asyncTblPos
);
}
if
(
tscIsInsertOrImportData
(
pSql
->
sqlstr
))
{
/*
* only for async multi-vnode insertion
...
...
src/client/src/tscSql.c
浏览文件 @
ca136d47
...
...
@@ -829,7 +829,7 @@ static bool hasAdditionalErrorInfo(int32_t code, SSqlCmd* pCmd) {
char
*
z
=
NULL
;
if
(
len
>
0
)
{
z
=
strstr
(
pCmd
->
payload
,
"invalid
sql
"
);
z
=
strstr
(
pCmd
->
payload
,
"invalid
SQL
"
);
}
return
z
!=
NULL
;
...
...
src/system/detail/inc/vnodeQueryImpl.h
浏览文件 @
ca136d47
...
...
@@ -129,6 +129,7 @@ bool isPointInterpoQuery(SQuery* pQuery);
bool
isTopBottomQuery
(
SQuery
*
pQuery
);
bool
isFirstLastRowQuery
(
SQuery
*
pQuery
);
bool
isTSCompQuery
(
SQuery
*
pQuery
);
bool
notHasQueryTimeRange
(
SQuery
*
pQuery
);
bool
needSupplementaryScan
(
SQuery
*
pQuery
);
bool
onDemandLoadDatablock
(
SQuery
*
pQuery
,
int16_t
queryRangeSet
);
...
...
@@ -172,10 +173,10 @@ void enableFunctForMasterScan(SQueryRuntimeEnv* pRuntimeEnv, int32_t order);
int32_t
mergeMetersResultToOneGroups
(
SMeterQuerySupportObj
*
pSupporter
);
void
copyFromGroupBuf
(
SQInfo
*
pQInfo
,
SOutputRes
*
result
);
SBlockInfo
getBlockBasicInfo
(
void
*
pBlock
,
int32_t
blockType
);
SCacheBlock
*
getCacheDataBlock
(
SMeterObj
*
pMeterObj
,
SQuery
*
pQuery
,
int32_t
slot
);
SBlockInfo
getBlockBasicInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
void
*
pBlock
,
int32_t
blockType
);
SCacheBlock
*
getCacheDataBlock
(
SMeterObj
*
pMeterObj
,
SQuery
RuntimeEnv
*
pRuntimeEnv
,
int32_t
slot
);
void
queryOnBlock
(
SMeterQuerySupportObj
*
pSupporter
,
int64_t
*
primaryKeys
,
int32_t
blockStatus
,
char
*
data
,
void
queryOnBlock
(
SMeterQuerySupportObj
*
pSupporter
,
int64_t
*
primaryKeys
,
int32_t
blockStatus
,
SBlockInfo
*
pBlockBasicInfo
,
SMeterDataInfo
*
pDataHeadInfoEx
,
SField
*
pFields
,
__block_search_fn_t
searchFn
);
...
...
src/system/detail/inc/vnodeRead.h
浏览文件 @
ca136d47
...
...
@@ -35,19 +35,19 @@ typedef struct {
int32_t
fileId
;
}
SPositionInfo
;
typedef
struct
S
QueryLoad
BlockInfo
{
typedef
struct
S
LoadData
BlockInfo
{
int32_t
fileListIndex
;
/* index of this file in files list of this vnode */
int32_t
fileId
;
int32_t
slotIdx
;
int32_t
sid
;
bool
tsLoaded
;
// if timestamp column of current block is loaded or not
}
S
QueryLoad
BlockInfo
;
}
S
LoadData
BlockInfo
;
typedef
struct
S
Query
LoadCompBlockInfo
{
typedef
struct
SLoadCompBlockInfo
{
int32_t
sid
;
/* meter sid */
int32_t
fileId
;
int32_t
fileListIndex
;
}
S
Query
LoadCompBlockInfo
;
}
SLoadCompBlockInfo
;
/*
* the header file info for one vnode
...
...
@@ -126,20 +126,28 @@ typedef struct RuntimeEnvironment {
SQuery
*
pQuery
;
SMeterObj
*
pMeterObj
;
SQLFunctionCtx
*
pCtx
;
SQueryLoadBlockInfo
loadBlockInfo
;
/* record current block load information */
SQueryLoadCompBlockInfo
loadCompBlockInfo
;
/* record current compblock information in SQuery */
SQueryFilesInfo
vnodeFileInfo
;
int16_t
numOfRowsPerPage
;
int16_t
offset
[
TSDB_MAX_COLUMNS
];
int16_t
scanFlag
;
// denotes reversed scan of data or not
SInterpolationInfo
interpoInfo
;
SData
**
pInterpoBuf
;
SOutputRes
*
pResult
;
// reference to SQuerySupporter->pResult
void
*
hashList
;
int32_t
usedIndex
;
// assigned SOutputRes in list
STSBuf
*
pTSBuf
;
STSCursor
cur
;
SQueryCostSummary
summary
;
SLoadDataBlockInfo
loadBlockInfo
;
/* record current block load information */
SLoadCompBlockInfo
loadCompBlockInfo
;
/* record current compblock information in SQuery */
SQueryFilesInfo
vnodeFileInfo
;
int16_t
numOfRowsPerPage
;
int16_t
offset
[
TSDB_MAX_COLUMNS
];
int16_t
scanFlag
;
// denotes reversed scan of data or not
SInterpolationInfo
interpoInfo
;
SData
**
pInterpoBuf
;
SOutputRes
*
pResult
;
// reference to SQuerySupporter->pResult
void
*
hashList
;
int32_t
usedIndex
;
// assigned SOutputRes in list
STSBuf
*
pTSBuf
;
STSCursor
cur
;
SQueryCostSummary
summary
;
/*
* 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 subumit/insert handling threads.
* So we keep a copy of the support structure as well as the cache block data itself.
*/
SCacheBlock
cacheBlock
;
}
SQueryRuntimeEnv
;
/* intermediate result during multimeter query involves interval */
...
...
src/system/detail/src/vnodeQueryImpl.c
浏览文件 @
ca136d47
此差异已折叠。
点击以展开。
src/system/detail/src/vnodeQueryProcess.c
浏览文件 @
ca136d47
...
...
@@ -146,9 +146,7 @@ static SMeterDataInfo *queryOnMultiDataCache(SQInfo *pQInfo, SMeterDataInfo *pMe
if
(
pQuery
->
nAggTimeInterval
==
0
)
{
if
((
pQuery
->
lastKey
>
pQuery
->
ekey
&&
QUERY_IS_ASC_QUERY
(
pQuery
))
||
(
pQuery
->
lastKey
<
pQuery
->
ekey
&&
!
QUERY_IS_ASC_QUERY
(
pQuery
)))
{
dTrace
(
"QInfo:%p vid:%d sid:%d id:%s, query completed, no need to scan data in cache. qrange:%lld-%lld, "
"lastKey:%lld"
,
dTrace
(
"QInfo:%p vid:%d sid:%d id:%s, query completed, ignore data in cache. qrange:%lld-%lld, lastKey:%lld"
,
pQInfo
,
pMeterObj
->
vnode
,
pMeterObj
->
sid
,
pMeterObj
->
meterId
,
pQuery
->
skey
,
pQuery
->
ekey
,
pQuery
->
lastKey
);
...
...
@@ -183,7 +181,7 @@ static SMeterDataInfo *queryOnMultiDataCache(SQInfo *pQInfo, SMeterDataInfo *pMe
// data in this block may be flushed to disk and this block is allocated to other meter
// todo try with remain cache blocks
SCacheBlock
*
pBlock
=
getCacheDataBlock
(
pMeterObj
,
p
Query
,
pQuery
->
slot
);
SCacheBlock
*
pBlock
=
getCacheDataBlock
(
pMeterObj
,
p
RuntimeEnv
,
pQuery
->
slot
);
if
(
pBlock
==
NULL
)
{
continue
;
}
...
...
@@ -196,7 +194,7 @@ static SMeterDataInfo *queryOnMultiDataCache(SQInfo *pQInfo, SMeterDataInfo *pMe
SCacheInfo
*
pCacheInfo
=
(
SCacheInfo
*
)
pMeterObj
->
pCache
;
for
(
int32_t
i
=
0
;
i
<
pCacheInfo
->
maxBlocks
;
++
i
)
{
pBlock
=
getCacheDataBlock
(
pMeterObj
,
p
Query
,
pQuery
->
slot
);
pBlock
=
getCacheDataBlock
(
pMeterObj
,
p
RuntimeEnv
,
pQuery
->
slot
);
/*
* 1. pBlock == NULL. The cache block may be flushed to disk, so it is not available, skip and try next
...
...
@@ -216,8 +214,8 @@ static SMeterDataInfo *queryOnMultiDataCache(SQInfo *pQInfo, SMeterDataInfo *pMe
setStartPositionForCacheBlock
(
pQuery
,
pBlock
,
&
firstCheckSlot
);
TSKEY
*
primaryKeys
=
(
TSKEY
*
)
pBlock
->
offset
[
0
]
;
TSKEY
*
primaryKeys
=
(
TSKEY
*
)
pRuntimeEnv
->
primaryColBuffer
->
data
;
// in handling file data block, the timestamp range validation is done during fetching candidate file blocks
if
((
primaryKeys
[
pQuery
->
pos
]
>
pSupporter
->
rawEKey
&&
QUERY_IS_ASC_QUERY
(
pQuery
))
||
(
primaryKeys
[
pQuery
->
pos
]
<
pSupporter
->
rawEKey
&&
!
QUERY_IS_ASC_QUERY
(
pQuery
)))
{
...
...
@@ -226,15 +224,14 @@ static SMeterDataInfo *queryOnMultiDataCache(SQInfo *pQInfo, SMeterDataInfo *pMe
// only record the key on last block
SET_CACHE_BLOCK_FLAG
(
pRuntimeEnv
->
blockStatus
);
SBlockInfo
binfo
=
getBlockBasicInfo
(
pBlock
,
BLK_CACHE_BLOCK
);
SBlockInfo
binfo
=
getBlockBasicInfo
(
p
RuntimeEnv
,
p
Block
,
BLK_CACHE_BLOCK
);
dTrace
(
"QInfo:%p check data block, brange:%lld-%lld, 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
++
;
queryOnBlock
(
pSupporter
,
primaryKeys
,
pRuntimeEnv
->
blockStatus
,
(
char
*
)
pBlock
,
&
binfo
,
&
pMeterInfo
[
k
],
NULL
,
searchFn
);
queryOnBlock
(
pSupporter
,
primaryKeys
,
pRuntimeEnv
->
blockStatus
,
&
binfo
,
&
pMeterInfo
[
k
],
NULL
,
searchFn
);
if
(
ALL_CACHE_BLOCKS_CHECKED
(
pQuery
))
{
break
;
...
...
@@ -425,7 +422,7 @@ static SMeterDataInfo *queryOnMultiDataFiles(SQInfo *pQInfo, SMeterDataInfo *pMe
continue
;
}
SBlockInfo
binfo
=
getBlockBasicInfo
(
pBlock
,
BLK_FILE_BLOCK
);
SBlockInfo
binfo
=
getBlockBasicInfo
(
p
RuntimeEnv
,
p
Block
,
BLK_FILE_BLOCK
);
assert
(
pQuery
->
pos
>=
0
&&
pQuery
->
pos
<
pBlock
->
numOfPoints
);
TSKEY
*
primaryKeys
=
(
TSKEY
*
)
pRuntimeEnv
->
primaryColBuffer
->
data
;
...
...
@@ -441,8 +438,8 @@ static SMeterDataInfo *queryOnMultiDataFiles(SQInfo *pQInfo, SMeterDataInfo *pMe
(
pBlock
->
keyFirst
>=
pQuery
->
ekey
&&
pBlock
->
keyLast
<=
pQuery
->
lastKey
&&
!
QUERY_IS_ASC_QUERY
(
pQuery
)));
}
queryOnBlock
(
pSupporter
,
primaryKeys
,
pRuntimeEnv
->
blockStatus
,
(
char
*
)
pRuntimeEnv
->
colDataBuffer
,
&
binfo
,
pOneMeterDataInfo
,
pInfoEx
->
pBlock
.
fields
,
searchFn
);
queryOnBlock
(
pSupporter
,
primaryKeys
,
pRuntimeEnv
->
blockStatus
,
&
binfo
,
pOneMeterDataInfo
,
pInfoEx
->
pBlock
.
fields
,
searchFn
);
}
tfree
(
pReqMeterDataInfo
);
...
...
@@ -489,6 +486,9 @@ static bool multimeterMultioutputHelper(SQInfo *pQInfo, bool *dataInDisk, bool *
pQInfo
->
pObj
=
pMeterObj
;
pQuery
->
lastKey
=
pQuery
->
skey
;
pRuntimeEnv
->
pMeterObj
=
pMeterObj
;
vnodeUpdateQueryColumnIndex
(
pQuery
,
pRuntimeEnv
->
pMeterObj
);
vnodeUpdateFilterColumnIndex
(
pQuery
);
vnodeCheckIfDataExists
(
pRuntimeEnv
,
pMeterObj
,
dataInDisk
,
dataInCache
);
...
...
@@ -619,6 +619,9 @@ static void vnodeMultiMeterMultiOutputProcessor(SQInfo *pQInfo) {
pSupporter
->
rawEKey
=
key
;
int64_t
num
=
doCheckMetersInGroup
(
pQInfo
,
index
,
start
);
if
(
num
==
0
)
{
int32_t
k
=
1
;
}
assert
(
num
>=
0
);
}
else
{
dTrace
(
"QInfo:%p interp query on vid:%d, numOfGroups:%d, current group:%d"
,
pQInfo
,
pOneMeter
->
vnode
,
...
...
@@ -686,7 +689,7 @@ static void vnodeMultiMeterMultiOutputProcessor(SQInfo *pQInfo) {
setQueryStatus
(
pQuery
,
QUERY_NO_DATA_TO_CHECK
);
return
;
}
bool
dataInDisk
=
true
;
bool
dataInCache
=
true
;
if
(
!
multimeterMultioutputHelper
(
pQInfo
,
&
dataInDisk
,
&
dataInCache
,
k
,
0
))
{
...
...
@@ -725,9 +728,6 @@ static void vnodeMultiMeterMultiOutputProcessor(SQInfo *pQInfo) {
}
}
vnodeUpdateQueryColumnIndex
(
pQuery
,
pRuntimeEnv
->
pMeterObj
);
vnodeUpdateFilterColumnIndex
(
pQuery
);
vnodeScanAllData
(
pRuntimeEnv
);
pQuery
->
pointsRead
=
getNumOfResult
(
pRuntimeEnv
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录