Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
08df5bf9
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看板
提交
08df5bf9
编写于
2月 17, 2020
作者:
H
hjxilinx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor codes.
上级
08854f86
变更
9
展开全部
隐藏空白更改
内联
并排
Showing
9 changed file
with
1104 addition
and
939 deletion
+1104
-939
src/client/inc/tscSQLParser.h
src/client/inc/tscSQLParser.h
+1
-1
src/client/src/tscFunctionImpl.c
src/client/src/tscFunctionImpl.c
+13
-7
src/client/src/tscSecondaryMerge.c
src/client/src/tscSecondaryMerge.c
+16
-16
src/system/detail/inc/vnodeQueryImpl.h
src/system/detail/inc/vnodeQueryImpl.h
+52
-45
src/system/detail/inc/vnodeRead.h
src/system/detail/inc/vnodeRead.h
+7
-8
src/system/detail/src/vnodeQueryImpl.c
src/system/detail/src/vnodeQueryImpl.c
+832
-672
src/system/detail/src/vnodeQueryProcess.c
src/system/detail/src/vnodeQueryProcess.c
+168
-175
src/system/detail/src/vnodeRead.c
src/system/detail/src/vnodeRead.c
+8
-8
src/system/detail/src/vnodeShell.c
src/system/detail/src/vnodeShell.c
+7
-7
未找到文件。
src/client/inc/tscSQLParser.h
浏览文件 @
08df5bf9
...
...
@@ -112,7 +112,7 @@ typedef struct SLimitVal {
}
SLimitVal
;
typedef
struct
SOrderVal
{
int32_t
order
;
u
int32_t
order
;
int32_t
orderColId
;
}
SOrderVal
;
...
...
src/client/src/tscFunctionImpl.c
浏览文件 @
08df5bf9
...
...
@@ -697,12 +697,15 @@ static int32_t first_dist_data_req_info(SQLFunctionCtx *pCtx, TSKEY start, TSKEY
return
BLK_DATA_NO_NEEDED
;
}
SFirstLastInfo
*
pInfo
=
(
SFirstLastInfo
*
)
(
pCtx
->
aOutputBuf
+
pCtx
->
inputBytes
);
if
(
pInfo
->
hasResult
!=
DATA_SET_FLAG
)
{
return
BLK_DATA_ALL_NEEDED
;
}
else
{
// data in current block is not earlier than current result
return
(
pInfo
->
ts
<=
start
)
?
BLK_DATA_NO_NEEDED
:
BLK_DATA_ALL_NEEDED
;
}
// result buffer has not been set yet.
return
BLK_DATA_ALL_NEEDED
;
//todo optimize the filter info
// SFirstLastInfo *pInfo = (SFirstLastInfo*) (pCtx->aOutputBuf + pCtx->inputBytes);
// if (pInfo->hasResult != DATA_SET_FLAG) {
// return BLK_DATA_ALL_NEEDED;
// } else { // data in current block is not earlier than current result
// return (pInfo->ts <= start) ? BLK_DATA_NO_NEEDED : BLK_DATA_ALL_NEEDED;
// }
}
static
int32_t
last_dist_data_req_info
(
SQLFunctionCtx
*
pCtx
,
TSKEY
start
,
TSKEY
end
,
int32_t
colId
,
...
...
@@ -1415,7 +1418,9 @@ static void stddev_next_step(SQLFunctionCtx *pCtx) {
*/
pStd
->
stage
++
;
avg_finalizer
(
pCtx
);
pResInfo
->
initialized
=
true
;
// set it initialized to avoid re-initialization
// save average value into tmpBuf, for second stage scan
SAvgInfo
*
pAvg
=
pResInfo
->
interResultBuf
;
...
...
@@ -2078,6 +2083,7 @@ static void copyTopBotRes(SQLFunctionCtx *pCtx, int32_t type) {
TSKEY
*
output
=
pCtx
->
ptsOutputBuf
;
for
(
int32_t
i
=
0
;
i
<
len
;
++
i
,
output
+=
step
)
{
*
output
=
tvp
[
i
]
->
timestamp
;
printf
(
"-------------%lld
\n
"
,
*
output
);
}
// set the corresponding tag data for each record
...
...
src/client/src/tscSecondaryMerge.c
浏览文件 @
08df5bf9
...
...
@@ -765,22 +765,22 @@ void savePrevRecordAndSetupInterpoInfo(SLocalReducer *pLocalReducer, SQueryInfo*
}
// todo merge with following function
static
void
reversedCopyResultToDstBuf
(
SQueryInfo
*
pQueryInfo
,
SSqlRes
*
pRes
,
tFilePage
*
pFinalDataPage
)
{
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
exprsInfo
.
numOfExprs
;
++
i
)
{
TAOS_FIELD
*
pField
=
tscFieldInfoGetField
(
pQueryInfo
,
i
);
int32_t
offset
=
tscFieldInfoGetOffset
(
pQueryInfo
,
i
);
char
*
src
=
pFinalDataPage
->
data
+
(
pRes
->
numOfRows
-
1
)
*
pField
->
bytes
+
pRes
->
numOfRows
*
offset
;
char
*
dst
=
pRes
->
data
+
pRes
->
numOfRows
*
offset
;
for
(
int32_t
j
=
0
;
j
<
pRes
->
numOfRows
;
++
j
)
{
memcpy
(
dst
,
src
,
(
size_t
)
pField
->
bytes
);
dst
+=
pField
->
bytes
;
src
-=
pField
->
bytes
;
}
}
}
//
static void reversedCopyResultToDstBuf(SQueryInfo* pQueryInfo, SSqlRes *pRes, tFilePage *pFinalDataPage) {
//
//
for (int32_t i = 0; i < pQueryInfo->exprsInfo.numOfExprs; ++i) {
//
TAOS_FIELD *pField = tscFieldInfoGetField(pQueryInfo, i);
//
//
int32_t offset = tscFieldInfoGetOffset(pQueryInfo, i);
//
char * src = pFinalDataPage->data + (pRes->numOfRows - 1) * pField->bytes + pRes->numOfRows * offset;
//
char * dst = pRes->data + pRes->numOfRows * offset;
//
//
for (int32_t j = 0; j < pRes->numOfRows; ++j) {
//
memcpy(dst, src, (size_t)pField->bytes);
//
dst += pField->bytes;
//
src -= pField->bytes;
//
}
//
}
//
}
static
void
reversedCopyFromInterpolationToDstBuf
(
SQueryInfo
*
pQueryInfo
,
SSqlRes
*
pRes
,
tFilePage
**
pResPages
,
SLocalReducer
*
pLocalReducer
)
{
assert
(
0
);
...
...
src/system/detail/inc/vnodeQueryImpl.h
浏览文件 @
08df5bf9
...
...
@@ -25,7 +25,7 @@ extern "C" {
#include "hash.h"
#include "hashutil.h"
#define GET_QINFO_ADDR(x)
((char*)(x)-offsetof(SQInfo, query))
#define GET_QINFO_ADDR(x) ((char*)(x)-offsetof(SQInfo, query))
#define Q_STATUS_EQUAL(p, s) (((p) & (s)) != 0)
/*
...
...
@@ -33,10 +33,10 @@ extern "C" {
* The page size should be sufficient for at least one output result or intermediate result.
* Some intermediate results may be extremely large, such as top/bottom(100) query.
*/
#define DEFAULT_INTERN_BUF_SIZE
16384L
#define DEFAULT_INTERN_BUF_SIZE 16384L
#define INIT_ALLOCATE_DISK_PAGES
60L
#define DEFAULT_DATA_FILE_MAPPING_PAGES
2L
#define INIT_ALLOCATE_DISK_PAGES 60L
#define DEFAULT_DATA_FILE_MAPPING_PAGES 2L
#define DEFAULT_DATA_FILE_MMAP_WINDOW_SIZE (DEFAULT_DATA_FILE_MAPPING_PAGES * DEFAULT_INTERN_BUF_SIZE)
#define IO_ENGINE_MMAP 0
...
...
@@ -120,7 +120,7 @@ typedef enum {
typedef
int
(
*
__block_search_fn_t
)(
char
*
data
,
int
num
,
int64_t
key
,
int
order
);
static
FORCE_INLINE
SMeterObj
*
getMeterObj
(
void
*
hashHandle
,
int32_t
sid
)
{
return
*
(
SMeterObj
**
)
taosGetDataFromHashTable
(
hashHandle
,
(
const
char
*
)
&
sid
,
sizeof
(
sid
));
return
*
(
SMeterObj
**
)
taosGetDataFromHashTable
(
hashHandle
,
(
const
char
*
)
&
sid
,
sizeof
(
sid
));
}
bool
isQueryKilled
(
SQuery
*
pQuery
);
...
...
@@ -129,7 +129,7 @@ bool isPointInterpoQuery(SQuery* pQuery);
bool
isTopBottomQuery
(
SQuery
*
pQuery
);
bool
isFirstLastRowQuery
(
SQuery
*
pQuery
);
bool
isTSCompQuery
(
SQuery
*
pQuery
);
bool
notHasQueryTimeRange
(
SQuery
*
pQuery
);
bool
notHasQueryTimeRange
(
SQuery
*
pQuery
);
bool
needSupplementaryScan
(
SQuery
*
pQuery
);
bool
onDemandLoadDatablock
(
SQuery
*
pQuery
,
int16_t
queryRangeSet
);
...
...
@@ -148,16 +148,16 @@ void vnodeScanAllData(SQueryRuntimeEnv* pRuntimeEnv);
int32_t
vnodeQueryResultInterpolate
(
SQInfo
*
pQInfo
,
tFilePage
**
pDst
,
tFilePage
**
pDataSrc
,
int32_t
numOfRows
,
int32_t
*
numOfInterpo
);
void
copyResToQueryResultBuf
(
SMeter
QuerySupportObj
*
pSupporter
,
SQuery
*
pQuery
);
void
copyResToQueryResultBuf
(
STable
QuerySupportObj
*
pSupporter
,
SQuery
*
pQuery
);
void
doSkipResults
(
SQueryRuntimeEnv
*
pRuntimeEnv
);
void
doFinalizeResult
(
SQueryRuntimeEnv
*
pRuntimeEnv
);
void
doSkipResults
(
SQueryRuntimeEnv
*
pRuntimeEnv
);
void
doFinalizeResult
(
SQueryRuntimeEnv
*
pRuntimeEnv
);
int64_t
getNumOfResult
(
SQueryRuntimeEnv
*
pRuntimeEnv
);
void
forwardIntervalQueryRange
(
S
Meter
QuerySupportObj
*
pSupporter
,
SQueryRuntimeEnv
*
pRuntimeEnv
);
void
forwardIntervalQueryRange
(
S
Table
QuerySupportObj
*
pSupporter
,
SQueryRuntimeEnv
*
pRuntimeEnv
);
void
forwardQueryStartPosition
(
SQueryRuntimeEnv
*
pRuntimeEnv
);
bool
normalizedFirstQueryRange
(
bool
dataInDisk
,
bool
dataInCache
,
S
Meter
QuerySupportObj
*
pSupporter
,
bool
normalizedFirstQueryRange
(
bool
dataInDisk
,
bool
dataInCache
,
S
Table
QuerySupportObj
*
pSupporter
,
SPointInterpoSupporter
*
pPointInterpSupporter
,
int64_t
*
key
);
void
pointInterpSupporterInit
(
SQuery
*
pQuery
,
SPointInterpoSupporter
*
pInterpoSupport
);
...
...
@@ -165,42 +165,46 @@ void pointInterpSupporterDestroy(SPointInterpoSupporter* pPointInterpSupport);
void
pointInterpSupporterSetData
(
SQInfo
*
pQInfo
,
SPointInterpoSupporter
*
pPointInterpSupport
);
int64_t
loadRequiredBlockIntoMem
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SPositionInfo
*
position
);
int32_t
doCloseAllOpenedResults
(
S
Meter
QuerySupportObj
*
pSupporter
);
void
disableFunctForSuppleScan
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
order
);
void
enableFunctForMasterScan
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
order
);
int32_t
doCloseAllOpenedResults
(
S
Table
QuerySupportObj
*
pSupporter
);
void
disableFunctForSuppleScan
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
order
);
void
enableFunctForMasterScan
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
order
);
int32_t
mergeMetersResultToOneGroups
(
S
Meter
QuerySupportObj
*
pSupporter
);
void
copyFromGroupBuf
(
SQInfo
*
pQInfo
,
SWindowResult
*
result
);
int32_t
mergeMetersResultToOneGroups
(
S
Table
QuerySupportObj
*
pSupporter
);
void
copyFromGroupBuf
(
SQInfo
*
pQInfo
,
SWindowResult
*
result
);
SBlockInfo
getBlockBasicInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
void
*
pBlock
,
int32_t
blockType
);
SBlockInfo
getBlockBasicInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
void
*
pBlock
,
int32_t
blockType
);
SCacheBlock
*
getCacheDataBlock
(
SMeterObj
*
pMeterObj
,
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
slot
);
void
queryOnBlock
(
SMeterQuerySupportObj
*
pSupporter
,
int32_t
blockStatus
,
SBlockInfo
*
pBlockBasicInfo
,
SMeterDataInfo
*
pDataHeadInfoEx
,
SField
*
pFields
,
__block_search_fn_t
searchFn
);
// void queryOnBlock(STableQuerySupportObj* pSupporter, int32_t blockStatus, SBlockInfo* pBlockBasicInfo,
// SMeterDataInfo* pDataHeadInfoEx, SField* pFields,
// __block_search_fn_t searchFn);
int32_t
vnodeFilterQualifiedMeters
(
SQInfo
*
pQInfo
,
int32_t
vid
,
tSidSet
*
pSidSet
,
SMeterDataInfo
*
pMeterDataInfo
,
int32_t
*
numOfMeters
,
SMeterDataInfo
***
pReqMeterDataInfo
);
void
applyIntervalQueryOnBlock
(
STableQuerySupportObj
*
pSupporter
,
SMeterDataInfo
*
pMeterDataInfo
,
SBlockInfo
*
pBlockInfo
,
SField
*
pFields
,
__block_search_fn_t
searchFn
);
int32_t
vnodeFilterQualifiedMeters
(
SQInfo
*
pQInfo
,
int32_t
vid
,
tSidSet
*
pSidSet
,
SMeterDataInfo
*
pMeterDataInfo
,
int32_t
*
numOfMeters
,
SMeterDataInfo
***
pReqMeterDataInfo
);
int32_t
vnodeGetVnodeHeaderFileIndex
(
int32_t
*
fid
,
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
order
);
int32_t
createDataBlocksInfoEx
(
SMeterDataInfo
**
pMeterDataInfo
,
int32_t
numOfMeters
,
SMeterDataBlockInfoEx
**
pDataBlockInfoEx
,
int32_t
numOfCompBlocks
,
int32_t
*
nAllocBlocksInfoSize
,
int64_t
addr
);
void
freeMeterBlockInfoEx
(
SMeterDataBlockInfoEx
*
pDataBlockInfoEx
,
int32_t
len
);
void
freeMeterBlockInfoEx
(
SMeterDataBlockInfoEx
*
pDataBlockInfoEx
,
int32_t
len
);
void
setExecutionContext
(
SMeterQuerySupportObj
*
pSupporter
,
SWindowResult
*
outputRes
,
int32_t
meterIdx
,
int32_t
group
Idx
,
SMeterQueryInfo
*
sqinfo
);
int32_t
setIntervalQueryExecutionContext
(
S
Meter
QuerySupportObj
*
pSupporter
,
int32_t
meterIdx
,
SMeterQueryInfo
*
sqinfo
);
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
);
void
setExecutionContext
(
STableQuerySupportObj
*
pSupporter
,
SWindowResult
*
outputRes
,
int32_t
meter
Idx
,
int32_t
groupIdx
,
SMeterQueryInfo
*
sqinfo
);
int32_t
setIntervalQueryExecutionContext
(
S
Table
QuerySupportObj
*
pSupporter
,
int32_t
meterIdx
,
SMeterQueryInfo
*
sqinfo
);
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
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
(
S
Meter
QuerySupportObj
*
pSupporter
,
SQuery
*
pQuery
,
int32_t
numOfMeters
,
const
char
*
filePath
,
SMeterDataInfo
**
pMeterDataInfo
,
uint32_t
*
numOfBlocks
);
int32_t
getDataBlocksForMeters
(
S
Table
QuerySupportObj
*
pSupporter
,
SQuery
*
pQuery
,
int32_t
numOfMeters
,
const
char
*
filePath
,
SMeterDataInfo
**
pMeterDataInfo
,
uint32_t
*
numOfBlocks
);
int32_t
LoadDatablockOnDemand
(
SCompBlock
*
pBlock
,
SField
**
pFields
,
uint8_t
*
blkStatus
,
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
fileIdx
,
int32_t
slotIdx
,
__block_search_fn_t
searchFn
,
bool
onDemand
);
int32_t
vnodeGetHeaderFile
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
fileIndex
);
int32_t
vnodeGetHeaderFile
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
fileIndex
);
/**
* Create SMeterQueryInfo.
...
...
@@ -210,14 +214,14 @@ int32_t vnodeGetHeaderFile(SQueryRuntimeEnv *pRuntimeEnv, int32_t fileIndex);
* @param ekey
* @return
*/
SMeterQueryInfo
*
createMeterQueryInfo
(
S
MeterQuerySupportObj
*
pSupporter
,
int32_t
sid
,
TSKEY
skey
,
TSKEY
ekey
);
SMeterQueryInfo
*
createMeterQueryInfo
(
S
TableQuerySupportObj
*
pSupporter
,
int32_t
sid
,
TSKEY
skey
,
TSKEY
ekey
);
/**
* Destroy meter query info
* @param pMeterQInfo
* @param numOfCols
*/
void
destroyMeterQueryInfo
(
SMeterQueryInfo
*
pMeterQueryInfo
,
int32_t
numOfCols
);
void
destroyMeterQueryInfo
(
SMeterQueryInfo
*
pMeterQueryInfo
,
int32_t
numOfCols
);
/**
* change the meter query info for supplement scan
...
...
@@ -225,7 +229,8 @@ void destroyMeterQueryInfo(SMeterQueryInfo *pMeterQueryInfo, int32_t numOfCols);
* @param skey
* @param ekey
*/
void
changeMeterQueryInfoForSuppleQuery
(
SQueryDiskbasedResultBuf
*
pResultBuf
,
SMeterQueryInfo
*
pMeterQueryInfo
,
TSKEY
skey
,
TSKEY
ekey
);
void
changeMeterQueryInfoForSuppleQuery
(
SQueryDiskbasedResultBuf
*
pResultBuf
,
SMeterQueryInfo
*
pMeterQueryInfo
,
TSKEY
skey
,
TSKEY
ekey
);
/**
* add the new allocated disk page to meter query info
...
...
@@ -234,7 +239,8 @@ void changeMeterQueryInfoForSuppleQuery(SQueryDiskbasedResultBuf* pResultBuf, SM
* @param pMeterQueryInfo
* @param pSupporter
*/
tFilePage
*
addDataPageForMeterQueryInfo
(
SQuery
*
pQuery
,
SMeterQueryInfo
*
pMeterQueryInfo
,
SMeterQuerySupportObj
*
pSupporter
);
tFilePage
*
addDataPageForMeterQueryInfo
(
SQuery
*
pQuery
,
SMeterQueryInfo
*
pMeterQueryInfo
,
STableQuerySupportObj
*
pSupporter
);
/**
* save the query range data into SMeterQueryInfo
...
...
@@ -258,7 +264,7 @@ void restoreIntervalQueryRange(SQueryRuntimeEnv* pRuntimeEnv, SMeterQueryInfo* p
* @param pSupporter
* @param key
*/
void
setIntervalQueryRange
(
SMeterQueryInfo
*
pMeterQueryInfo
,
SMeter
QuerySupportObj
*
pSupporter
,
int64_t
key
);
void
setIntervalQueryRange
(
SMeterQueryInfo
*
pMeterQueryInfo
,
STable
QuerySupportObj
*
pSupporter
,
int64_t
key
);
/**
* set the meter data information
...
...
@@ -275,19 +281,20 @@ void vnodeCheckIfDataExists(SQueryRuntimeEnv* pRuntimeEnv, SMeterObj* pMeterObj,
void
displayInterResult
(
SData
**
pdata
,
SQuery
*
pQuery
,
int32_t
numOfRows
);
void
vnodePrintQueryStatistics
(
S
Meter
QuerySupportObj
*
pSupporter
);
void
vnodePrintQueryStatistics
(
S
Table
QuerySupportObj
*
pSupporter
);
void
clearTimeWindowResBuf
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SWindowResult
*
pOneOutputRes
);
void
copyTimeWindowResBuf
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SWindowResult
*
dst
,
const
SWindowResult
*
src
);
void
clearTimeWindowResBuf
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SWindowResult
*
pOneOutputRes
);
void
copyTimeWindowResBuf
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SWindowResult
*
dst
,
const
SWindowResult
*
src
);
int32_t
initWindowResInfo
(
SWindowResInfo
*
pWindowResInfo
,
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
size
,
int32_t
threshold
,
int16_t
type
);
int32_t
initWindowResInfo
(
SWindowResInfo
*
pWindowResInfo
,
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
size
,
int32_t
threshold
,
int16_t
type
);
void
cleanupTimeWindowInfo
(
SWindowResInfo
*
pWindowResInfo
,
SQueryRuntimeEnv
*
pRuntimeEnv
);
void
resetTimeWindowInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SWindowResInfo
*
pWindowResInfo
);
void
clearClosedTimeWindow
(
SQueryRuntimeEnv
*
pRuntimeEnv
);
void
cleanupTimeWindowInfo
(
SWindowResInfo
*
pWindowResInfo
,
SQueryRuntimeEnv
*
pRuntimeEnv
);
void
resetTimeWindowInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SWindowResInfo
*
pWindowResInfo
);
void
clearClosedTimeWindow
(
SQueryRuntimeEnv
*
pRuntimeEnv
);
int32_t
numOfClosedTimeWindow
(
SWindowResInfo
*
pWindowResInfo
);
void
closeTimeWindow
(
SWindowResInfo
*
pWindowResInfo
,
int32_t
slot
);
void
closeAllTimeWindow
(
SWindowResInfo
*
pWindowResInfo
);
void
closeTimeWindow
(
SWindowResInfo
*
pWindowResInfo
,
int32_t
slot
);
void
closeAllTimeWindow
(
SWindowResInfo
*
pWindowResInfo
);
#ifdef __cplusplus
}
...
...
src/system/detail/inc/vnodeRead.h
浏览文件 @
08df5bf9
...
...
@@ -101,7 +101,6 @@ typedef struct SWindowStatus {
typedef
struct
SWindowResult
{
uint16_t
numOfRows
;
int16_t
nAlloc
;
SPosInfo
pos
;
// Position of current result in disk-based output buffer
SResultInfo
*
resultInfo
;
// For each result column, there is a resultInfo
STimeWindow
window
;
// The time window that current result covers.
...
...
@@ -191,8 +190,8 @@ typedef struct SMeterQueryInfo {
int64_t
skey
;
int64_t
ekey
;
int32_t
numOfRes
;
int32_t
reverseIndex
;
// reversed output indicator, start from (numOfRes-1)
int16_t
reverseFillRes
;
// denote if reverse fill the results in supplementary scan required or not
//
int32_t reverseIndex; // reversed output indicator, start from (numOfRes-1)
//
int16_t reverseFillRes; // denote if reverse fill the results in supplementary scan required or not
int16_t
queryRangeSet
;
// denote if the query range is set, only available for interval query
int16_t
lastResRows
;
int64_t
tag
;
...
...
@@ -213,7 +212,7 @@ typedef struct SMeterDataInfo {
SMeterQueryInfo
*
pMeterQInfo
;
}
SMeterDataInfo
;
typedef
struct
S
Meter
QuerySupportObj
{
typedef
struct
S
Table
QuerySupportObj
{
void
*
pMetersHashTable
;
// meter table hash list
SMeterSidExtInfo
**
pMeterSidExtInfo
;
...
...
@@ -248,7 +247,7 @@ typedef struct SMeterQuerySupportObj {
SMeterDataInfo
*
pMeterDataInfo
;
TSKEY
*
tsList
;
}
S
Meter
QuerySupportObj
;
}
S
Table
QuerySupportObj
;
typedef
struct
_qinfo
{
uint64_t
signature
;
...
...
@@ -274,18 +273,18 @@ typedef struct _qinfo {
SMeterObj
*
pObj
;
sem_t
dataReady
;
S
MeterQuerySupportObj
*
pMeter
QuerySupporter
;
S
TableQuerySupportObj
*
pTable
QuerySupporter
;
int
(
*
fp
)(
SMeterObj
*
,
SQuery
*
);
}
SQInfo
;
int32_t
vnodeQuery
SingleTablePrepare
(
SQInfo
*
pQInfo
,
SMeterObj
*
pMeterObj
,
SMeter
QuerySupportObj
*
pSMultiMeterObj
,
int32_t
vnodeQuery
TablePrepare
(
SQInfo
*
pQInfo
,
SMeterObj
*
pMeterObj
,
STable
QuerySupportObj
*
pSMultiMeterObj
,
void
*
param
);
void
vnodeQueryFreeQInfoEx
(
SQInfo
*
pQInfo
);
bool
vnodeParametersSafetyCheck
(
SQuery
*
pQuery
);
int32_t
vnode
MultiMeter
QueryPrepare
(
SQInfo
*
pQInfo
,
SQuery
*
pQuery
,
void
*
param
);
int32_t
vnode
STable
QueryPrepare
(
SQInfo
*
pQInfo
,
SQuery
*
pQuery
,
void
*
param
);
/**
* decrease the numofQuery of each table that is queried, enable the
...
...
src/system/detail/src/vnodeQueryImpl.c
浏览文件 @
08df5bf9
此差异已折叠。
点击以展开。
src/system/detail/src/vnodeQueryProcess.c
浏览文件 @
08df5bf9
此差异已折叠。
点击以展开。
src/system/detail/src/vnodeRead.c
浏览文件 @
08df5bf9
...
...
@@ -648,7 +648,7 @@ void *vnodeQueryOnSingleTable(SMeterObj **pMetersObj, SSqlGroupbyExpr *pGroupbyE
goto
_error
;
}
S
MeterQuerySupportObj
*
pSupporter
=
(
SMeterQuerySupportObj
*
)
calloc
(
1
,
sizeof
(
SMeter
QuerySupportObj
));
S
TableQuerySupportObj
*
pSupporter
=
(
STableQuerySupportObj
*
)
calloc
(
1
,
sizeof
(
STable
QuerySupportObj
));
pSupporter
->
numOfMeters
=
1
;
pSupporter
->
pMetersHashTable
=
taosInitHashTable
(
pSupporter
->
numOfMeters
,
taosIntHash_32
,
false
);
...
...
@@ -659,7 +659,7 @@ void *vnodeQueryOnSingleTable(SMeterObj **pMetersObj, SSqlGroupbyExpr *pGroupbyE
pSupporter
->
subgroupIdx
=
-
1
;
pSupporter
->
pMeterSidExtInfo
=
NULL
;
pQInfo
->
p
Meter
QuerySupporter
=
pSupporter
;
pQInfo
->
p
Table
QuerySupporter
=
pSupporter
;
STSBuf
*
pTSBuf
=
NULL
;
if
(
pQueryMsg
->
tsLen
>
0
)
{
...
...
@@ -670,7 +670,7 @@ void *vnodeQueryOnSingleTable(SMeterObj **pMetersObj, SSqlGroupbyExpr *pGroupbyE
tsBufNextPos
(
pTSBuf
);
}
if
(((
*
code
)
=
vnodeQuery
Single
TablePrepare
(
pQInfo
,
pQInfo
->
pObj
,
pSupporter
,
pTSBuf
))
!=
TSDB_CODE_SUCCESS
)
{
if
(((
*
code
)
=
vnodeQueryTablePrepare
(
pQInfo
,
pQInfo
->
pObj
,
pSupporter
,
pTSBuf
))
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
@@ -739,7 +739,7 @@ void *vnodeQueryOnMultiMeters(SMeterObj **pMetersObj, SSqlGroupbyExpr *pGroupbyE
SSchedMsg
schedMsg
=
{
0
};
S
MeterQuerySupportObj
*
pSupporter
=
(
SMeterQuerySupportObj
*
)
calloc
(
1
,
sizeof
(
SMeter
QuerySupportObj
));
S
TableQuerySupportObj
*
pSupporter
=
(
STableQuerySupportObj
*
)
calloc
(
1
,
sizeof
(
STable
QuerySupportObj
));
pSupporter
->
numOfMeters
=
pQueryMsg
->
numOfSids
;
pSupporter
->
pMetersHashTable
=
taosInitHashTable
(
pSupporter
->
numOfMeters
,
taosIntHash_32
,
false
);
...
...
@@ -784,7 +784,7 @@ void *vnodeQueryOnMultiMeters(SMeterObj **pMetersObj, SSqlGroupbyExpr *pGroupbyE
(
SSchema
*
)
pQueryMsg
->
pTagSchema
,
pQueryMsg
->
numOfTagsCols
,
NULL
,
0
);
}
pQInfo
->
p
Meter
QuerySupporter
=
pSupporter
;
pQInfo
->
p
Table
QuerySupporter
=
pSupporter
;
STSBuf
*
pTSBuf
=
NULL
;
if
(
pQueryMsg
->
tsLen
>
0
)
{
...
...
@@ -794,7 +794,7 @@ void *vnodeQueryOnMultiMeters(SMeterObj **pMetersObj, SSqlGroupbyExpr *pGroupbyE
tsBufResetPos
(
pTSBuf
);
}
if
(((
*
code
)
=
vnode
MultiMeter
QueryPrepare
(
pQInfo
,
pQuery
,
pTSBuf
))
!=
TSDB_CODE_SUCCESS
)
{
if
(((
*
code
)
=
vnode
STable
QueryPrepare
(
pQInfo
,
pQuery
,
pTSBuf
))
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
@@ -898,8 +898,8 @@ int vnodeSaveQueryResult(void *handle, char *data, int32_t *size) {
SSchedMsg
schedMsg
=
{
0
};
if
(
pQInfo
->
p
Meter
QuerySupporter
!=
NULL
)
{
if
(
pQInfo
->
p
Meter
QuerySupporter
->
pSidSet
==
NULL
)
{
if
(
pQInfo
->
p
Table
QuerySupporter
!=
NULL
)
{
if
(
pQInfo
->
p
Table
QuerySupporter
->
pSidSet
==
NULL
)
{
schedMsg
.
fp
=
vnodeSingleTableQuery
;
}
else
{
// group by tag
schedMsg
.
fp
=
vnodeMultiMeterQuery
;
...
...
src/system/detail/src/vnodeShell.c
浏览文件 @
08df5bf9
...
...
@@ -446,8 +446,8 @@ void vnodeExecuteRetrieveReq(SSchedMsg *pSched) {
// buffer size for progress information, including meter count,
// and for each meter, including 'uid' and 'TSKEY'.
int
progressSize
=
0
;
if
(
pQInfo
->
p
Meter
QuerySupporter
!=
NULL
)
progressSize
=
pQInfo
->
p
Meter
QuerySupporter
->
numOfMeters
*
(
sizeof
(
int64_t
)
+
sizeof
(
TSKEY
))
+
sizeof
(
int32_t
);
if
(
pQInfo
->
p
Table
QuerySupporter
!=
NULL
)
progressSize
=
pQInfo
->
p
Table
QuerySupporter
->
numOfMeters
*
(
sizeof
(
int64_t
)
+
sizeof
(
TSKEY
))
+
sizeof
(
int32_t
);
else
if
(
pQInfo
->
pObj
!=
NULL
)
progressSize
=
sizeof
(
int64_t
)
+
sizeof
(
TSKEY
)
+
sizeof
(
int32_t
);
...
...
@@ -486,13 +486,13 @@ void vnodeExecuteRetrieveReq(SSchedMsg *pSched) {
// write the progress information of each meter to response
// this is required by subscriptions
if
(
numOfRows
>
0
&&
code
==
TSDB_CODE_SUCCESS
)
{
if
(
pQInfo
->
p
MeterQuerySupporter
!=
NULL
&&
pQInfo
->
pMeter
QuerySupporter
->
pMeterSidExtInfo
!=
NULL
)
{
*
((
int32_t
*
)
pMsg
)
=
htonl
(
pQInfo
->
p
Meter
QuerySupporter
->
numOfMeters
);
if
(
pQInfo
->
p
TableQuerySupporter
!=
NULL
&&
pQInfo
->
pTable
QuerySupporter
->
pMeterSidExtInfo
!=
NULL
)
{
*
((
int32_t
*
)
pMsg
)
=
htonl
(
pQInfo
->
p
Table
QuerySupporter
->
numOfMeters
);
pMsg
+=
sizeof
(
int32_t
);
for
(
int32_t
i
=
0
;
i
<
pQInfo
->
p
Meter
QuerySupporter
->
numOfMeters
;
i
++
)
{
*
((
int64_t
*
)
pMsg
)
=
htobe64
(
pQInfo
->
p
Meter
QuerySupporter
->
pMeterSidExtInfo
[
i
]
->
uid
);
for
(
int32_t
i
=
0
;
i
<
pQInfo
->
p
Table
QuerySupporter
->
numOfMeters
;
i
++
)
{
*
((
int64_t
*
)
pMsg
)
=
htobe64
(
pQInfo
->
p
Table
QuerySupporter
->
pMeterSidExtInfo
[
i
]
->
uid
);
pMsg
+=
sizeof
(
int64_t
);
*
((
TSKEY
*
)
pMsg
)
=
htobe64
(
pQInfo
->
p
Meter
QuerySupporter
->
pMeterSidExtInfo
[
i
]
->
key
);
*
((
TSKEY
*
)
pMsg
)
=
htobe64
(
pQInfo
->
p
Table
QuerySupporter
->
pMeterSidExtInfo
[
i
]
->
key
);
pMsg
+=
sizeof
(
TSKEY
);
}
}
else
if
(
pQInfo
->
pObj
!=
NULL
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录