Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
1d5bab8d
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
Star
22015
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1d5bab8d
编写于
3月 21, 2020
作者:
H
hjxilinx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-32] refactor codes, change the prepare qinfo functions
上级
f19c9742
变更
10
展开全部
隐藏空白更改
内联
并排
Showing
10 changed file
with
1701 addition
and
968 deletion
+1701
-968
src/client/inc/tscUtil.h
src/client/inc/tscUtil.h
+1
-1
src/client/src/tscLocal.c
src/client/src/tscLocal.c
+4
-3
src/client/src/tscServer.c
src/client/src/tscServer.c
+14
-17
src/client/src/tscSub.c
src/client/src/tscSub.c
+1
-1
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+2
-2
src/dnode/src/dnodeRead.c
src/dnode/src/dnodeRead.c
+11
-4
src/inc/taosmsg.h
src/inc/taosmsg.h
+4
-8
src/query/inc/qextbuffer.h
src/query/inc/qextbuffer.h
+1
-1
src/query/inc/queryExecutor.h
src/query/inc/queryExecutor.h
+2
-2
src/query/src/queryExecutor.c
src/query/src/queryExecutor.c
+1661
-929
未找到文件。
src/client/inc/tscUtil.h
浏览文件 @
1d5bab8d
...
...
@@ -85,7 +85,7 @@ int32_t tscGetDataBlockFromList(void* pHashList, SDataBlockList* pDataBlockList,
STableDataBlocks
**
dataBlocks
);
SVnodeSidList
*
tscGetVnodeSidList
(
SSuperTableMeta
*
pMetricmeta
,
int32_t
vnodeIdx
);
STable
SidExt
Info
*
tscGetMeterSidInfo
(
SVnodeSidList
*
pSidList
,
int32_t
idx
);
STable
Id
Info
*
tscGetMeterSidInfo
(
SVnodeSidList
*
pSidList
,
int32_t
idx
);
/**
*
...
...
src/client/src/tscLocal.c
浏览文件 @
1d5bab8d
...
...
@@ -318,15 +318,16 @@ static int tscBuildMetricTagProjectionResult(SSqlObj *pSql) {
SVnodeSidList
*
pSidList
=
(
SVnodeSidList
*
)((
char
*
)
pMetricMeta
+
pMetricMeta
->
list
[
i
]);
for
(
int32_t
j
=
0
;
j
<
pSidList
->
numOfSids
;
++
j
)
{
STable
SidExt
Info
*
pSidExt
=
tscGetMeterSidInfo
(
pSidList
,
j
);
STable
Id
Info
*
pSidExt
=
tscGetMeterSidInfo
(
pSidList
,
j
);
for
(
int32_t
k
=
0
;
k
<
pQueryInfo
->
fieldsInfo
.
numOfOutputCols
;
++
k
)
{
SColIndexEx
*
pColIndex
=
&
tscSqlExprGet
(
pQueryInfo
,
k
)
->
colInfo
;
int16_t
offsetId
=
pColIndex
->
colIdx
;
assert
((
pColIndex
->
flag
&
TSDB_COL_TAG
)
!=
0
);
char
*
val
=
pSidExt
->
tags
+
vOffset
[
offsetId
];
assert
(
0
);
char
*
val
=
NULL
;
//pSidExt->tags + vOffset[offsetId];
TAOS_FIELD
*
pField
=
tscFieldInfoGetField
(
pQueryInfo
,
k
);
memcpy
(
pRes
->
data
+
tscFieldInfoGetOffset
(
pQueryInfo
,
k
)
*
totalNumOfResults
+
pField
->
bytes
*
rowIdx
,
val
,
...
...
src/client/src/tscServer.c
浏览文件 @
1d5bab8d
...
...
@@ -598,7 +598,7 @@ static int32_t tscEstimateQueryMsgSize(SSqlCmd *pCmd, int32_t clauseIndex) {
SSuperTableMeta
*
pMetricMeta
=
pTableMetaInfo
->
pMetricMeta
;
SVnodeSidList
*
pVnodeSidList
=
tscGetVnodeSidList
(
pMetricMeta
,
pTableMetaInfo
->
vnodeIndex
);
int32_t
meterInfoSize
=
(
pMetricMeta
->
tagLen
+
sizeof
(
STable
SidExt
Info
))
*
pVnodeSidList
->
numOfSids
;
int32_t
meterInfoSize
=
(
pMetricMeta
->
tagLen
+
sizeof
(
STable
Id
Info
))
*
pVnodeSidList
->
numOfSids
;
int32_t
outputColumnSize
=
pQueryInfo
->
exprsInfo
.
numOfExprs
*
sizeof
(
SSqlFuncExprMsg
);
int32_t
size
=
meterInfoSize
+
outputColumnSize
+
srcColListSize
+
exprSize
+
MIN_QUERY_MSG_PKT_SIZE
;
...
...
@@ -620,26 +620,23 @@ static char *doSerializeTableInfo(SSqlObj *pSql, int32_t numOfTables, int32_t vn
#ifdef _DEBUG_VIEW
tscTrace
(
"%p sid:%d, uid:%"
PRIu64
,
pSql
,
pTableMetaInfo
->
pTableMeta
->
sid
,
pTableMetaInfo
->
pTableMeta
->
uid
);
#endif
STable
SidExtInfo
*
pTableMetaInfo
=
(
STableSidExt
Info
*
)
pMsg
;
STable
IdInfo
*
pTableMetaInfo
=
(
STableId
Info
*
)
pMsg
;
pTableMetaInfo
->
sid
=
htonl
(
pTableMeta
->
sid
);
pTableMetaInfo
->
uid
=
htobe64
(
pTableMeta
->
uid
);
pTableMetaInfo
->
key
=
htobe64
(
tscGetSubscriptionProgress
(
pSql
->
pSubscription
,
pTableMeta
->
uid
));
pMsg
+=
sizeof
(
STable
SidExt
Info
);
pMsg
+=
sizeof
(
STable
Id
Info
);
}
else
{
SVnodeSidList
*
pVnodeSidList
=
tscGetVnodeSidList
(
pMetricMeta
,
pTableMetaInfo
->
vnodeIndex
);
for
(
int32_t
i
=
0
;
i
<
numOfTables
;
++
i
)
{
STable
SidExtInfo
*
pTableMetaInfo
=
(
STableSidExt
Info
*
)
pMsg
;
STable
SidExt
Info
*
pQueryMeterInfo
=
tscGetMeterSidInfo
(
pVnodeSidList
,
i
);
STable
IdInfo
*
pTableIdInfo
=
(
STableId
Info
*
)
pMsg
;
STable
Id
Info
*
pQueryMeterInfo
=
tscGetMeterSidInfo
(
pVnodeSidList
,
i
);
pTable
Meta
Info
->
sid
=
htonl
(
pQueryMeterInfo
->
sid
);
pTable
Meta
Info
->
uid
=
htobe64
(
pQueryMeterInfo
->
uid
);
pTable
Meta
Info
->
key
=
htobe64
(
tscGetSubscriptionProgress
(
pSql
->
pSubscription
,
pQueryMeterInfo
->
uid
));
pTable
Id
Info
->
sid
=
htonl
(
pQueryMeterInfo
->
sid
);
pTable
Id
Info
->
uid
=
htobe64
(
pQueryMeterInfo
->
uid
);
pTable
Id
Info
->
key
=
htobe64
(
tscGetSubscriptionProgress
(
pSql
->
pSubscription
,
pQueryMeterInfo
->
uid
));
pMsg
+=
sizeof
(
STableSidExtInfo
);
memcpy
(
pMsg
,
pQueryMeterInfo
->
tags
,
pMetricMeta
->
tagLen
);
pMsg
+=
pMetricMeta
->
tagLen
;
pMsg
+=
sizeof
(
STableIdInfo
);
#ifdef _DEBUG_VIEW
tscTrace
(
"%p sid:%d, uid:%"
PRId64
,
pSql
,
pQueryMeterInfo
->
sid
,
pQueryMeterInfo
->
uid
);
...
...
@@ -2067,7 +2064,7 @@ int tscProcessMetricMetaRsp(SSqlObj *pSql) {
pMeta
->
numOfVnodes
=
htonl
(
pMeta
->
numOfVnodes
);
pMeta
->
tagLen
=
htons
(
pMeta
->
tagLen
);
size
+=
pMeta
->
numOfVnodes
*
sizeof
(
SVnodeSidList
*
)
+
pMeta
->
numOfTables
*
sizeof
(
STable
SidExt
Info
*
);
size
+=
pMeta
->
numOfVnodes
*
sizeof
(
SVnodeSidList
*
)
+
pMeta
->
numOfTables
*
sizeof
(
STable
Id
Info
*
);
char
*
pBuf
=
calloc
(
1
,
size
);
if
(
pBuf
==
NULL
)
{
...
...
@@ -2093,16 +2090,16 @@ int tscProcessMetricMetaRsp(SSqlObj *pSql) {
tscTrace
(
"%p metricmeta:vid:%d,numOfTables:%d"
,
pSql
,
i
,
pLists
->
numOfSids
);
pBuf
+=
sizeof
(
SVnodeSidList
)
+
sizeof
(
STable
SidExt
Info
*
)
*
pSidLists
->
numOfSids
;
pBuf
+=
sizeof
(
SVnodeSidList
)
+
sizeof
(
STable
Id
Info
*
)
*
pSidLists
->
numOfSids
;
rsp
+=
sizeof
(
SVnodeSidList
);
size_t
elemSize
=
sizeof
(
STable
SidExt
Info
)
+
pNewMetricMeta
->
tagLen
;
size_t
elemSize
=
sizeof
(
STable
Id
Info
)
+
pNewMetricMeta
->
tagLen
;
for
(
int32_t
j
=
0
;
j
<
pSidLists
->
numOfSids
;
++
j
)
{
pLists
->
pSidExtInfoList
[
j
]
=
pBuf
-
(
char
*
)
pLists
;
memcpy
(
pBuf
,
rsp
,
elemSize
);
((
STable
SidExtInfo
*
)
pBuf
)
->
uid
=
htobe64
(((
STableSidExt
Info
*
)
pBuf
)
->
uid
);
((
STable
SidExtInfo
*
)
pBuf
)
->
sid
=
htonl
(((
STableSidExt
Info
*
)
pBuf
)
->
sid
);
((
STable
IdInfo
*
)
pBuf
)
->
uid
=
htobe64
(((
STableId
Info
*
)
pBuf
)
->
uid
);
((
STable
IdInfo
*
)
pBuf
)
->
sid
=
htonl
(((
STableId
Info
*
)
pBuf
)
->
sid
);
rsp
+=
elemSize
;
pBuf
+=
elemSize
;
...
...
src/client/src/tscSub.c
浏览文件 @
1d5bab8d
...
...
@@ -202,7 +202,7 @@ int tscUpdateSubscription(STscObj* pObj, SSub* pSub) {
for
(
int32_t
i
=
0
;
i
<
pMetricMeta
->
numOfVnodes
;
i
++
)
{
SVnodeSidList
*
pVnodeSidList
=
tscGetVnodeSidList
(
pMetricMeta
,
i
);
for
(
int32_t
j
=
0
;
j
<
pVnodeSidList
->
numOfSids
;
j
++
)
{
STable
SidExt
Info
*
pTableMetaInfo
=
tscGetMeterSidInfo
(
pVnodeSidList
,
j
);
STable
Id
Info
*
pTableMetaInfo
=
tscGetMeterSidInfo
(
pVnodeSidList
,
j
);
int64_t
uid
=
pTableMetaInfo
->
uid
;
progress
[
numOfTables
].
uid
=
uid
;
progress
[
numOfTables
++
].
key
=
tscGetSubscriptionProgress
(
pSub
,
uid
);
...
...
src/client/src/tscUtil.c
浏览文件 @
1d5bab8d
...
...
@@ -191,7 +191,7 @@ SVnodeSidList* tscGetVnodeSidList(SSuperTableMeta* pMetricmeta, int32_t vnodeIdx
return
(
SVnodeSidList
*
)(
pMetricmeta
->
list
[
vnodeIdx
]
+
(
char
*
)
pMetricmeta
);
}
STable
SidExt
Info
*
tscGetMeterSidInfo
(
SVnodeSidList
*
pSidList
,
int32_t
idx
)
{
STable
Id
Info
*
tscGetMeterSidInfo
(
SVnodeSidList
*
pSidList
,
int32_t
idx
)
{
if
(
pSidList
==
NULL
)
{
tscError
(
"illegal sidlist"
);
return
0
;
...
...
@@ -206,7 +206,7 @@ STableSidExtInfo* tscGetMeterSidInfo(SVnodeSidList* pSidList, int32_t idx) {
assert
(
pSidList
->
pSidExtInfoList
[
idx
]
>=
0
);
return
(
STable
SidExt
Info
*
)(
pSidList
->
pSidExtInfoList
[
idx
]
+
(
char
*
)
pSidList
);
return
(
STable
Id
Info
*
)(
pSidList
->
pSidExtInfoList
[
idx
]
+
(
char
*
)
pSidList
);
}
bool
tscIsTwoStageSTableQuery
(
SQueryInfo
*
pQueryInfo
,
int32_t
tableIndex
)
{
...
...
src/dnode/src/dnodeRead.c
浏览文件 @
1d5bab8d
...
...
@@ -15,13 +15,16 @@
#define _DEFAULT_SOURCE
#include "os.h"
#include "taoserror.h"
#include "taosmsg.h"
#include "tlog.h"
#include "tqueue.h"
#include "trpc.h"
#include "dnodeRead.h"
#include "dnodeMgmt.h"
#include "dnodeRead.h"
#include "queryExecutor.h"
typedef
struct
{
int32_t
code
;
...
...
@@ -88,7 +91,7 @@ void dnodeRead(SRpcMsg *pMsg) {
while
(
leftLen
>
0
)
{
SMsgHead
*
pHead
=
(
SMsgHead
*
)
pCont
;
pHead
->
vgId
=
1
;
//htonl(pHead->vgId);
pHead
->
vgId
=
1
;
//htonl(pHead->vgId);
pHead
->
contLen
=
pMsg
->
contLen
;
//htonl(pHead->contLen);
void
*
pVnode
=
dnodeGetVnode
(
pHead
->
vgId
);
...
...
@@ -223,8 +226,12 @@ static void dnodeProcessReadResult(SReadMsg *pRead) {
}
static
void
dnodeProcessQueryMsg
(
SReadMsg
*
pMsg
)
{
void
*
pQInfo
=
(
void
*
)
100
;
dTrace
(
"query msg is disposed, qInfo:%p"
,
pQInfo
);
SQueryTableMsg
*
pQueryTableMsg
=
(
SQueryTableMsg
*
)
pMsg
->
pCont
;
SQInfo
*
pQInfo
=
NULL
;
int32_t
ret
=
qCreateQueryInfo
(
pQueryTableMsg
,
&
pQInfo
);
dTrace
(
"query msg is disposed, qInfo:%p"
,
pQueryTableMsg
);
SQueryTableRsp
*
pRsp
=
(
SQueryTableRsp
*
)
rpcMallocCont
(
sizeof
(
SQueryTableRsp
));
pRsp
->
code
=
0
;
...
...
src/inc/taosmsg.h
浏览文件 @
1d5bab8d
...
...
@@ -434,15 +434,11 @@ typedef struct SColumnInfo {
SColumnFilterInfo
*
filters
;
}
SColumnInfo
;
/*
* enable vnode to understand how to group several tables with different tag;
*/
typedef
struct
STableSidExtInfo
{
typedef
struct
STableIdInfo
{
int32_t
sid
;
int64_t
uid
;
TSKEY
key
;
// key for subscription
char
tags
[];
}
STableSidExtInfo
;
TSKEY
key
;
// last accessed ts, for subscription
}
STableIdInfo
;
typedef
struct
STimeWindow
{
TSKEY
skey
;
...
...
@@ -670,7 +666,7 @@ typedef struct {
SVnodeDesc
vpeerDesc
[
TSDB_VNODES_SUPPORT
];
int16_t
index
;
// used locally
int32_t
numOfSids
;
int32_t
pSidExtInfoList
[];
// offset value of STable
SidExt
Info
int32_t
pSidExtInfoList
[];
// offset value of STable
Id
Info
}
SVnodeSidList
;
typedef
struct
{
...
...
src/query/inc/qextbuffer.h
浏览文件 @
1d5bab8d
...
...
@@ -124,7 +124,7 @@ typedef struct tTagSchema {
typedef
struct
tSidSet
{
int32_t
numOfSids
;
int32_t
numOfSubSet
;
STable
SidExt
Info
**
pSids
;
STable
Id
Info
**
pSids
;
int32_t
*
starterPos
;
// position of each subgroup, generated according to
SColumnModel
*
pColumnModel
;
...
...
src/query/inc/queryExecutor.h
浏览文件 @
1d5bab8d
...
...
@@ -152,7 +152,7 @@ typedef struct SQueryCostSummary {
typedef
struct
SQueryRuntimeEnv
{
SResultInfo
*
resultInfo
;
// todo refactor to merge with SWindowResInfo
SQuery
*
pQuery
;
void
*
pTabObj
;
//
void* pTabObj;
SData
**
pInterpoBuf
;
SQLFunctionCtx
*
pCtx
;
int16_t
numOfRowsPerPage
;
...
...
@@ -204,7 +204,7 @@ typedef struct SQInfo {
* @param pQInfo
* @return
*/
int32_t
qCreateQueryInfo
(
void
*
pRead
Msg
,
SQInfo
**
pQInfo
);
int32_t
qCreateQueryInfo
(
SQueryTableMsg
*
pQueryTable
Msg
,
SQInfo
**
pQInfo
);
/**
* query on single table
...
...
src/query/src/queryExecutor.c
浏览文件 @
1d5bab8d
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录