Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
王长生-AnH
TDengine
提交
5468d172
T
TDengine
项目概览
王长生-AnH
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
5
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,发现更多精彩内容 >>
提交
5468d172
编写于
3月 22, 2020
作者:
H
hzcheng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '2.0' into feature/2.0tsdb
上级
41f8bf16
7aa8791f
变更
23
展开全部
显示空白变更内容
内联
并排
Showing
23 changed file
with
2171 addition
and
1211 deletion
+2171
-1211
src/client/inc/tscUtil.h
src/client/inc/tscUtil.h
+1
-1
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+2
-2
src/client/src/tscLocal.c
src/client/src/tscLocal.c
+4
-3
src/client/src/tscParseInsert.c
src/client/src/tscParseInsert.c
+11
-16
src/client/src/tscSchemaUtil.c
src/client/src/tscSchemaUtil.c
+1
-1
src/client/src/tscServer.c
src/client/src/tscServer.c
+49
-48
src/client/src/tscSql.c
src/client/src/tscSql.c
+3
-1
src/client/src/tscSub.c
src/client/src/tscSub.c
+1
-1
src/client/src/tscSystem.c
src/client/src/tscSystem.c
+0
-3
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+6
-5
src/dnode/src/dnodeRead.c
src/dnode/src/dnodeRead.c
+62
-23
src/dnode/src/dnodeWrite.c
src/dnode/src/dnodeWrite.c
+3
-1
src/inc/taosmsg.h
src/inc/taosmsg.h
+22
-25
src/mnode/src/mgmtChildTable.c
src/mnode/src/mgmtChildTable.c
+1
-1
src/mnode/src/mgmtDnode.c
src/mnode/src/mgmtDnode.c
+4
-1
src/mnode/src/mgmtNormalTable.c
src/mnode/src/mgmtNormalTable.c
+1
-1
src/mnode/src/mgmtSuperTable.c
src/mnode/src/mgmtSuperTable.c
+1
-1
src/query/CMakeLists.txt
src/query/CMakeLists.txt
+1
-1
src/query/inc/qextbuffer.h
src/query/inc/qextbuffer.h
+1
-2
src/query/inc/queryExecutor.h
src/query/inc/queryExecutor.h
+21
-11
src/query/src/queryExecutor.c
src/query/src/queryExecutor.c
+1903
-1038
src/rpc/src/rpcMain.c
src/rpc/src/rpcMain.c
+25
-25
src/vnode/tsdb/src/tsdbRead.c
src/vnode/tsdb/src/tsdbRead.c
+48
-0
未找到文件。
src/client/inc/tscUtil.h
浏览文件 @
5468d172
...
...
@@ -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/inc/tsclient.h
浏览文件 @
5468d172
...
...
@@ -62,7 +62,7 @@ typedef struct STableMeta {
int8_t
numOfVpeers
;
int16_t
sversion
;
SVnodeDesc
vpeerDesc
[
TSDB_VNODES_SUPPORT
];
int32_t
vg
i
d
;
// virtual group id, which current table belongs to
int32_t
vg
I
d
;
// virtual group id, which current table belongs to
int32_t
sid
;
// the index of one table in a virtual node
uint64_t
uid
;
// unique id of a table
SSchema
schema
[];
// if the table is TSDB_CHILD_TABLE, schema is acquired by super table meta info
...
...
@@ -182,7 +182,7 @@ typedef struct STableDataBlocks {
char
tableId
[
TSDB_TABLE_ID_LEN
];
int8_t
tsSource
;
// where does the UNIX timestamp come from, server or client
bool
ordered
;
// if current rows are ordered or not
int64_t
vg
i
d
;
// virtual group id
int64_t
vg
I
d
;
// virtual group id
int64_t
prevTS
;
// previous timestamp, recorded to decide if the records array is ts ascending
int32_t
numOfTables
;
// number of tables in current submit block
...
...
src/client/src/tscLocal.c
浏览文件 @
5468d172
...
...
@@ -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
);
assert
(
0
);
char
*
val
=
pSidExt
->
tags
+
vOffset
[
offsetId
];
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/tscParseInsert.c
浏览文件 @
5468d172
...
...
@@ -698,7 +698,7 @@ static int32_t doParseInsertStatement(SSqlObj *pSql, void *pTableHashList, char
SShellSubmitBlock
*
pBlocks
=
(
SShellSubmitBlock
*
)(
dataBuf
->
pData
);
tsSetBlockInfo
(
pBlocks
,
pTableMeta
,
numOfRows
);
dataBuf
->
vg
id
=
pTableMeta
->
vgi
d
;
dataBuf
->
vg
Id
=
pTableMeta
->
vgI
d
;
dataBuf
->
numOfTables
=
1
;
/*
...
...
@@ -1058,7 +1058,6 @@ int doParseInsertSql(SSqlObj *pSql, char *str) {
goto
_error_clean
;
}
void
*
fp
=
pSql
->
fp
;
ptrdiff_t
pos
=
pSql
->
asyncTblPos
-
pSql
->
sqlstr
;
if
((
code
=
tscCheckIfCreateTable
(
&
str
,
pSql
))
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -1068,7 +1067,6 @@ int doParseInsertSql(SSqlObj *pSql, char *str) {
* And during the getMeterMetaCallback function, the sql string will be parsed from the
* interrupted position.
*/
if
(
fp
!=
NULL
)
{
if
(
TSDB_CODE_ACTION_IN_PROGRESS
==
code
)
{
tscTrace
(
"async insert and waiting to get meter meta, then continue parse sql from offset: %"
PRId64
,
pos
);
return
code
;
...
...
@@ -1077,7 +1075,6 @@ int doParseInsertSql(SSqlObj *pSql, char *str) {
// todo add to return
tscError
(
"async insert parse error, code:%d, %s"
,
code
,
tstrerror
(
code
));
pSql
->
asyncTblPos
=
NULL
;
}
goto
_error_clean
;
// TODO: should _clean or _error_clean to async flow ????
}
...
...
@@ -1096,15 +1093,13 @@ int doParseInsertSql(SSqlObj *pSql, char *str) {
goto
_error_clean
;
}
int32_t
numOfCols
=
tscGetNumOfTags
(
pTableMetaInfo
->
pTableMeta
);
STableComInfo
tinfo
=
tscGetTableInfo
(
pTableMetaInfo
->
pTableMeta
);
if
(
sToken
.
type
==
TK_VALUES
)
{
SParsedDataColInfo
spd
=
{.
numOfCols
=
numOfCol
s
};
SParsedDataColInfo
spd
=
{.
numOfCols
=
tinfo
.
numOfColumn
s
};
SSchema
*
pSchema
=
tscGetTableSchema
(
pTableMetaInfo
->
pTableMeta
);
tscSetAssignedColumnInfo
(
&
spd
,
pSchema
,
numOfCols
);
tscSetAssignedColumnInfo
(
&
spd
,
pSchema
,
tinfo
.
numOfColumns
);
if
(
validateDataSource
(
pCmd
,
DATA_FROM_SQL_STRING
,
sToken
.
z
)
!=
TSDB_CODE_SUCCESS
)
{
goto
_error_clean
;
...
...
@@ -1243,7 +1238,7 @@ int doParseInsertSql(SSqlObj *pSql, char *str) {
// submit to more than one vnode
if
(
pCmd
->
pDataBlocks
->
nSize
>
0
)
{
// merge according to vg
i
d
// merge according to vg
I
d
if
((
code
=
tscMergeTableDataBlocks
(
pSql
,
pCmd
->
pDataBlocks
))
!=
TSDB_CODE_SUCCESS
)
{
goto
_error_clean
;
}
...
...
src/client/src/tscSchemaUtil.c
浏览文件 @
5468d172
...
...
@@ -165,7 +165,7 @@ STableMeta* tscCreateTableMetaFromMsg(STableMetaMsg* pTableMetaMsg, size_t* size
pTableMeta
->
sid
=
pTableMetaMsg
->
sid
;
pTableMeta
->
uid
=
pTableMetaMsg
->
uid
;
pTableMeta
->
vg
id
=
pTableMetaMsg
->
vgi
d
;
pTableMeta
->
vg
Id
=
pTableMetaMsg
->
vgI
d
;
pTableMeta
->
numOfVpeers
=
pTableMetaMsg
->
numOfVpeers
;
memcpy
(
pTableMeta
->
vpeerDesc
,
pTableMetaMsg
->
vpeerDesc
,
sizeof
(
SVnodeDesc
)
*
pTableMeta
->
numOfVpeers
);
...
...
src/client/src/tscServer.c
浏览文件 @
5468d172
...
...
@@ -341,11 +341,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg) {
* the tscShouldFreeAsyncSqlObj will success and tscFreeSqlObj free it immediately.
*/
bool
shouldFree
=
tscShouldFreeAsyncSqlObj
(
pSql
);
if
(
command
==
TSDB_SQL_INSERT
)
{
// handle multi-vnode insertion situation
(
*
pSql
->
fp
)(
pSql
,
taosres
,
rpcMsg
->
code
);
}
else
{
(
*
pSql
->
fp
)(
pSql
->
param
,
taosres
,
rpcMsg
->
code
);
}
if
(
shouldFree
)
{
// If it is failed, all objects allocated during execution taos_connect_a should be released
...
...
@@ -539,22 +535,27 @@ int tscBuildSubmitMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
char
*
pMsg
,
*
pStart
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pSql
->
cmd
,
0
);
STableMeta
*
pTableMeta
=
tscGetMetaInfo
(
pQueryInfo
,
0
)
->
pTableMeta
;
pStart
=
pSql
->
cmd
.
payload
+
tsRpcHeadSize
;
pMsg
=
pStart
;
pShellMsg
=
(
SShellSubmitMsg
*
)
pMsg
;
pShellMsg
->
desc
.
numOfVnodes
=
htonl
(
1
);
pShellMsg
->
import
=
htons
(
TSDB_QUERY_HAS_TYPE
(
pQueryInfo
->
type
,
TSDB_QUERY_TYPE_INSERT
)
?
0
:
1
);
pShellMsg
->
vnode
=
0
;
//htons(pTableMeta->vpeerDesc[pTableMeta->index].vnode);
pShellMsg
->
numOfSid
=
htonl
(
pSql
->
cmd
.
numOfTablesInSubmit
);
// number of meters to be inserted
pShellMsg
->
header
.
vgId
=
htonl
(
pTableMeta
->
vgId
);
pShellMsg
->
header
.
contLen
=
htonl
(
pSql
->
cmd
.
payloadLen
);
pShellMsg
->
numOfTables
=
htonl
(
pSql
->
cmd
.
numOfTablesInSubmit
);
// number of meters to be inserted
// pSql->cmd.payloadLen is set during parse sql routine, so we do not use it here
pSql
->
cmd
.
msgType
=
TSDB_MSG_TYPE_SUBMIT
;
// tscTrace("%p update submit msg vnode:%s:%d", pSql, taosIpStr(pTableMeta->vpeerDesc[pTableMeta->index].ip),
// htons(pShellMsg->vnode));
pSql
->
cmd
.
payloadLen
=
sizeof
(
SShellSubmitMsg
);
//
pSql->cmd.payloadLen = sizeof(SShellSubmitMsg);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -598,7 +599,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
;
...
...
@@ -609,37 +610,34 @@ static int32_t tscEstimateQueryMsgSize(SSqlCmd *pCmd, int32_t clauseIndex) {
return
size
;
}
static
char
*
doSerializeTableInfo
(
SSqlObj
*
pSql
,
int32_t
numOfTables
,
int32_t
v
node
Id
,
char
*
pMsg
)
{
static
char
*
doSerializeTableInfo
(
SSqlObj
*
pSql
,
int32_t
numOfTables
,
int32_t
v
g
Id
,
char
*
pMsg
)
{
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
&
pSql
->
cmd
,
pSql
->
cmd
.
clauseIndex
,
0
);
STableMeta
*
pTableMeta
=
pTableMetaInfo
->
pTableMeta
;
SSuperTableMeta
*
pMetricMeta
=
pTableMetaInfo
->
pMetricMeta
;
tscTrace
(
"%p v
id:%d, query on %d meters"
,
pSql
,
vnode
Id
,
numOfTables
);
tscTrace
(
"%p v
gId:%d, query on %d tables"
,
pSql
,
vg
Id
,
numOfTables
);
if
(
UTIL_TABLE_IS_NOMRAL_TABLE
(
pTableMetaInfo
))
{
#ifdef _DEBUG_VIEW
tscTrace
(
"%p sid:%d, uid:%"
PRIu64
,
pSql
,
pTableMetaInfo
->
pTableMeta
->
sid
,
pTableMetaInfo
->
pTableMeta
->
uid
);
#endif
STable
SidExtInfo
*
pTableMetaInfo
=
(
STableSidExt
Info
*
)
pMsg
;
pTable
Meta
Info
->
sid
=
htonl
(
pTableMeta
->
sid
);
pTable
Meta
Info
->
uid
=
htobe64
(
pTableMeta
->
uid
);
pTable
Meta
Info
->
key
=
htobe64
(
tscGetSubscriptionProgress
(
pSql
->
pSubscription
,
pTableMeta
->
uid
));
pMsg
+=
sizeof
(
STable
SidExt
Info
);
STable
IdInfo
*
pTableIdInfo
=
(
STableId
Info
*
)
pMsg
;
pTable
Id
Info
->
sid
=
htonl
(
pTableMeta
->
sid
);
pTable
Id
Info
->
uid
=
htobe64
(
pTableMeta
->
uid
);
pTable
Id
Info
->
key
=
htobe64
(
tscGetSubscriptionProgress
(
pSql
->
pSubscription
,
pTableMeta
->
uid
));
pMsg
+=
sizeof
(
STable
Id
Info
);
}
else
{
SVnodeSidList
*
pVnodeSidList
=
tscGetVnodeSidList
(
pMetricMeta
,
pTableMetaInfo
->
vnodeIndex
);
for
(
int32_t
i
=
0
;
i
<
numOfTables
;
++
i
)
{
STableSidExtInfo
*
pTableMetaInfo
=
(
STableSidExtInfo
*
)
pMsg
;
STableSidExtInfo
*
pQueryMeterInfo
=
tscGetMeterSidInfo
(
pVnodeSidList
,
i
);
pTableMetaInfo
->
sid
=
htonl
(
pQueryMeterInfo
->
sid
);
pTableMetaInfo
->
uid
=
htobe64
(
pQueryMeterInfo
->
uid
);
pTableMetaInfo
->
key
=
htobe64
(
tscGetSubscriptionProgress
(
pSql
->
pSubscription
,
pQueryMeterInfo
->
uid
));
STableIdInfo
*
pTableIdInfo
=
(
STableIdInfo
*
)
pMsg
;
STableIdInfo
*
pQueryMeterInfo
=
tscGetMeterSidInfo
(
pVnodeSidList
,
i
);
pMsg
+=
sizeof
(
STableSidExtInfo
);
pTableIdInfo
->
sid
=
htonl
(
pQueryMeterInfo
->
sid
);
pTableIdInfo
->
uid
=
htobe64
(
pQueryMeterInfo
->
uid
);
pTableIdInfo
->
key
=
htobe64
(
tscGetSubscriptionProgress
(
pSql
->
pSubscription
,
pQueryMeterInfo
->
uid
));
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
);
...
...
@@ -679,6 +677,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
pQueryMsg
->
uid
=
pTableMeta
->
uid
;
pQueryMsg
->
numOfTagsCols
=
0
;
pQueryMsg
->
vgId
=
htonl
(
pTableMeta
->
vgId
);
tscTrace
(
"%p queried tables:%d, table id: %s"
,
pSql
,
1
,
pTableMetaInfo
->
name
);
}
else
{
// query on super table
if
(
pTableMetaInfo
->
vnodeIndex
<
0
)
{
...
...
@@ -696,7 +695,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
}
tscTrace
(
"%p query on vid:%d, number of tables:%d"
,
pSql
,
vnodeId
,
numOfTables
);
pQueryMsg
->
v
node
=
htons
(
vnodeId
);
pQueryMsg
->
v
gId
=
htons
(
vnodeId
);
}
pQueryMsg
->
numOfTables
=
htonl
(
numOfTables
);
...
...
@@ -764,14 +763,14 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
SColumnBase
*
pCol
=
tscColumnBaseInfoGet
(
&
pQueryInfo
->
colList
,
i
);
SSchema
*
pColSchema
=
&
pSchema
[
pCol
->
colIndex
.
columnIndex
];
if
(
pCol
->
colIndex
.
columnIndex
>=
tscGetNumOfColumns
(
pTableMeta
)
||
pColSchema
->
type
<
TSDB_DATA_TYPE_BOOL
||
pColSchema
->
type
>
TSDB_DATA_TYPE_NCHAR
)
{
tscError
(
"%p vid:%d sid:%d id:%s, column index out of range, numOfColumns:%d, index:%d, column name:%s"
,
pSql
,
htons
(
pQueryMsg
->
vnode
),
pTableMeta
->
sid
,
pTableMetaInfo
->
name
,
tscGetNumOfColumns
(
pTableMeta
),
pCol
->
colIndex
,
pColSchema
->
name
);
return
-
1
;
// 0 means build msg failed
}
//
if (pCol->colIndex.columnIndex >= tscGetNumOfColumns(pTableMeta) || pColSchema->type < TSDB_DATA_TYPE_BOOL ||
//
pColSchema->type > TSDB_DATA_TYPE_NCHAR) {
//
tscError("%p vid:%d sid:%d id:%s, column index out of range, numOfColumns:%d, index:%d, column name:%s", pSql,
//
htons(pQueryMsg->vnode), pTableMeta->sid, pTableMetaInfo->name, tscGetNumOfColumns(pTableMeta), pCol->colIndex,
//
pColSchema->name);
//
//
return -1; // 0 means build msg failed
//
}
pQueryMsg
->
colList
[
i
].
colId
=
htons
(
pColSchema
->
colId
);
pQueryMsg
->
colList
[
i
].
bytes
=
htons
(
pColSchema
->
bytes
);
...
...
@@ -865,7 +864,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
pQueryMsg
->
colNameLen
=
htonl
(
len
);
// serialize the table info (sid, uid, tags)
pMsg
=
doSerializeTableInfo
(
pSql
,
numOfTables
,
htons
(
pQueryMsg
->
v
node
),
pMsg
);
pMsg
=
doSerializeTableInfo
(
pSql
,
numOfTables
,
htons
(
pQueryMsg
->
v
gId
),
pMsg
);
// only include the required tag column schema. If a tag is not required, it won't be sent to vnode
if
(
pTableMetaInfo
->
numOfTags
>
0
)
{
...
...
@@ -947,6 +946,8 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
pCmd
->
payloadLen
=
msgLen
;
pSql
->
cmd
.
msgType
=
TSDB_MSG_TYPE_QUERY
;
pQueryMsg
->
contLen
=
htonl
(
msgLen
);
assert
(
msgLen
+
minMsgSize
()
<=
size
);
return
TSDB_CODE_SUCCESS
;
...
...
@@ -1849,12 +1850,12 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) {
pMetaMsg
->
sid
=
htonl
(
pMetaMsg
->
sid
);
pMetaMsg
->
sversion
=
htons
(
pMetaMsg
->
sversion
);
pMetaMsg
->
vg
id
=
htonl
(
pMetaMsg
->
vgi
d
);
pMetaMsg
->
vg
Id
=
htonl
(
pMetaMsg
->
vgI
d
);
pMetaMsg
->
uid
=
htobe64
(
pMetaMsg
->
uid
);
pMetaMsg
->
contLen
=
htons
(
pMetaMsg
->
contLen
);
if
(
pMetaMsg
->
sid
<
0
||
pMetaMsg
->
vg
i
d
<
0
)
{
tscError
(
"invalid meter vg
id:%d, sid%d"
,
pMetaMsg
->
vgi
d
,
pMetaMsg
->
sid
);
if
(
pMetaMsg
->
sid
<
0
||
pMetaMsg
->
vg
I
d
<
0
)
{
tscError
(
"invalid meter vg
Id:%d, sid%d"
,
pMetaMsg
->
vgI
d
,
pMetaMsg
->
sid
);
return
TSDB_CODE_INVALID_VALUE
;
}
...
...
@@ -1948,11 +1949,11 @@ int tscProcessMultiMeterMetaRsp(SSqlObj *pSql) {
pMeta
->
sid
=
htonl
(
pMeta
->
sid
);
pMeta
->
sversion
=
htons
(
pMeta
->
sversion
);
pMeta
->
vg
id
=
htonl
(
pMeta
->
vgi
d
);
pMeta
->
vg
Id
=
htonl
(
pMeta
->
vgI
d
);
pMeta
->
uid
=
htobe64
(
pMeta
->
uid
);
if
(
pMeta
->
sid
<=
0
||
pMeta
->
vg
i
d
<
0
)
{
tscError
(
"invalid meter vg
id:%d, sid%d"
,
pMeta
->
vgi
d
,
pMeta
->
sid
);
if
(
pMeta
->
sid
<=
0
||
pMeta
->
vg
I
d
<
0
)
{
tscError
(
"invalid meter vg
Id:%d, sid%d"
,
pMeta
->
vgI
d
,
pMeta
->
sid
);
pSql
->
res
.
code
=
TSDB_CODE_INVALID_VALUE
;
pSql
->
res
.
numOfTotal
=
i
;
return
TSDB_CODE_OTHERS
;
...
...
@@ -2067,7 +2068,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 +2094,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/tscSql.c
浏览文件 @
5468d172
...
...
@@ -130,7 +130,7 @@ STscObj *taosConnectImpl(const char *ip, const char *user, const char *pass, con
pSql
->
pTscObj
=
pObj
;
pSql
->
signature
=
pSql
;
tsem_init
(
&
pSql
->
rspSem
,
0
,
0
);
// tsem_init(&pSql->emptyRspSem, 0, 1);
pObj
->
pSql
=
pSql
;
pSql
->
fp
=
fp
;
pSql
->
param
=
param
;
...
...
@@ -146,6 +146,8 @@ STscObj *taosConnectImpl(const char *ip, const char *user, const char *pass, con
return
NULL
;
}
// tsRpcHeaderSize will be updated during RPC initialization, so only after it initialization, this value is valid
tsInsertHeadSize
=
tsRpcHeadSize
+
sizeof
(
SShellSubmitMsg
);
return
pObj
;
}
...
...
src/client/src/tscSub.c
浏览文件 @
5468d172
...
...
@@ -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/tscSystem.c
浏览文件 @
5468d172
...
...
@@ -34,7 +34,6 @@ void * pTscMgmtConn;
void
*
pSlaveConn
;
void
*
tscCacheHandle
;
int32_t
globalCode
=
0
;
int
initialized
=
0
;
int
slaveIndex
;
void
*
tscTmr
;
void
*
tscQhandle
;
...
...
@@ -187,9 +186,7 @@ void taos_init_imp() {
if
(
tscCacheHandle
==
NULL
)
tscCacheHandle
=
taosCacheInit
(
tscTmr
,
refreshTime
);
initialized
=
1
;
tscTrace
(
"client is initialized successfully"
);
tsInsertHeadSize
=
tsRpcHeadSize
+
sizeof
(
SShellSubmitMsg
);
}
void
taos_init
()
{
pthread_once
(
&
tscinit
,
taos_init_imp
);
}
...
...
src/client/src/tscUtil.c
浏览文件 @
5468d172
...
...
@@ -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
)
{
...
...
@@ -614,7 +614,7 @@ int32_t tscCopyDataBlockToPayload(SSqlObj* pSql, STableDataBlocks* pDataBlock) {
*/
pCmd
->
payloadLen
=
pDataBlock
->
nAllocSize
-
tsRpcHeadSize
;
assert
(
pCmd
->
allocSize
>=
pCmd
->
payloadLen
+
tsRpcHeadSize
+
100
);
assert
(
pCmd
->
allocSize
>=
pCmd
->
payloadLen
+
tsRpcHeadSize
+
100
&&
pCmd
->
payloadLen
>
0
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -705,8 +705,9 @@ int32_t tscMergeTableDataBlocks(SSqlObj* pSql, SDataBlockList* pTableDataBlockLi
STableDataBlocks
*
pOneTableBlock
=
pTableDataBlockList
->
pData
[
i
];
STableDataBlocks
*
dataBuf
=
NULL
;
int32_t
ret
=
tscGetDataBlockFromList
(
pVnodeDataBlockHashList
,
pVnodeDataBlockList
,
pOneTableBlock
->
vg
i
d
,
TSDB_PAYLOAD_SIZE
,
tscGetDataBlockFromList
(
pVnodeDataBlockHashList
,
pVnodeDataBlockList
,
pOneTableBlock
->
vg
I
d
,
TSDB_PAYLOAD_SIZE
,
tsInsertHeadSize
,
0
,
pOneTableBlock
->
tableId
,
pOneTableBlock
->
pTableMeta
,
&
dataBuf
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
tscError
(
"%p failed to prepare the data block buffer for merging table data, code:%d"
,
pSql
,
ret
);
...
...
src/dnode/src/dnodeRead.c
浏览文件 @
5468d172
...
...
@@ -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,20 +226,26 @@ 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
code
=
qCreateQueryInfo
(
pQueryTableMsg
,
&
pQInfo
);
SQueryTableRsp
*
pRsp
=
(
SQueryTableRsp
*
)
rpcMallocCont
(
sizeof
(
SQueryTableRsp
));
pRsp
->
code
=
0
;
pRsp
->
code
=
code
;
pRsp
->
qhandle
=
htobe64
((
uint64_t
)
(
pQInfo
));
SRpcMsg
rpcRsp
=
{
.
handle
=
pMsg
->
rpcMsg
.
handle
,
.
pCont
=
pRsp
,
.
contLen
=
sizeof
(
SQueryTableRsp
),
.
code
=
0
,
.
code
=
code
,
.
msgType
=
0
};
// do execute query
qTableQuery
(
pQInfo
);
rpcSendResponse
(
&
rpcRsp
);
}
...
...
@@ -246,20 +255,50 @@ static void dnodeProcessRetrieveMsg(SReadMsg *pMsg) {
dTrace
(
"retrieve msg is disposed, qInfo:%p"
,
pQInfo
);
assert
(
pQInfo
!=
NULL
);
int32_t
contLen
=
100
;
SRetrieveTableRsp
*
pRsp
=
(
SRetrieveTableRsp
*
)
rpcMallocCont
(
contLen
);
int32_t
rowSize
=
0
;
int32_t
numOfRows
=
0
;
int32_t
contLen
=
0
;
SRpcMsg
rpcRsp
=
{
0
};
int32_t
code
=
qRetrieveQueryResultInfo
(
pQInfo
,
&
numOfRows
,
&
rowSize
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
contLen
=
sizeof
(
SRetrieveTableRsp
);
SRetrieveTableRsp
*
pRsp
=
(
SRetrieveTableRsp
*
)
rpcMallocCont
(
contLen
);
pRsp
->
numOfRows
=
0
;
pRsp
->
precision
=
0
;
pRsp
->
offset
=
0
;
pRsp
->
useconds
=
0
;
SRpcMsg
rpcRsp
=
{
rpcRsp
=
(
SRpcMsg
)
{
.
handle
=
pMsg
->
rpcMsg
.
handle
,
.
pCont
=
pRsp
,
.
contLen
=
contLen
,
.
code
=
0
,
.
code
=
code
,
.
msgType
=
0
};
//todo free qinfo
}
else
{
contLen
=
100
;
SRetrieveTableRsp
*
pRsp
=
(
SRetrieveTableRsp
*
)
rpcMallocCont
(
contLen
);
pRsp
->
numOfRows
=
0
;
pRsp
->
precision
=
0
;
pRsp
->
offset
=
0
;
pRsp
->
useconds
=
0
;
*
(
int64_t
*
)
pRsp
->
data
=
1000
;
rpcRsp
=
(
SRpcMsg
)
{
.
handle
=
pMsg
->
rpcMsg
.
handle
,
.
pCont
=
pRsp
,
.
contLen
=
contLen
,
.
code
=
code
,
.
msgType
=
0
};
}
rpcSendResponse
(
&
rpcRsp
);
}
src/dnode/src/dnodeWrite.c
浏览文件 @
5468d172
...
...
@@ -276,6 +276,8 @@ static void dnodeProcessSubmitMsg(SWriteMsg *pMsg) {
pRsp
->
affectedRows
=
htonl
(
1
);
pRsp
->
numOfFailedBlocks
=
0
;
// todo write to tsdb
SRpcMsg
rpcRsp
=
{
.
handle
=
pMsg
->
rpcMsg
.
handle
,
.
pCont
=
pRsp
,
...
...
src/inc/taosmsg.h
浏览文件 @
5468d172
...
...
@@ -198,10 +198,20 @@ typedef struct {
}
SShellSubmitBlock
;
typedef
struct
{
int32_t
numOfVnodes
;
}
SMsgDesc
;
typedef
struct
SMsgHead
{
int32_t
contLen
;
int32_t
vgId
;
}
SMsgHead
;
typedef
struct
{
SMsgDesc
desc
;
SMsgHead
header
;
int16_t
import
;
int16_t
vnode
;
int32_t
numOfSid
;
/* total number of sid */
char
blks
[];
/* numOfSid blocks, each blocks for one table */
int32_t
numOfTables
;
// total number of sid
char
blks
[];
// number of data blocks, each table has at least one data block
}
SShellSubmitMsg
;
typedef
struct
{
...
...
@@ -232,15 +242,6 @@ typedef struct {
uint32_t
ip
;
}
SVnodeDesc
;
typedef
struct
{
int32_t
numOfVnodes
;
}
SMsgDesc
;
typedef
struct
{
int32_t
contLen
;
int32_t
vgId
;
}
SMsgHead
;
typedef
struct
{
int32_t
contLen
;
int32_t
vgId
;
...
...
@@ -434,15 +435,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
;
...
...
@@ -455,10 +452,10 @@ typedef struct STimeWindow {
* the outputCols will be 3 while the numOfCols is 1.
*/
typedef
struct
{
int16_t
vnode
;
int32_t
numOfTables
;
uint64_t
pSidExtInfo
;
// table id & tag info ptr, in windows pointer may
int32_t
contLen
;
// msg header
int16_t
vgId
;
int32_t
numOfTables
;
uint64_t
uid
;
STimeWindow
window
;
...
...
@@ -504,7 +501,7 @@ typedef struct {
}
SQueryTableMsg
;
typedef
struct
{
char
code
;
int32_t
code
;
uint64_t
qhandle
;
}
SQueryTableRsp
;
...
...
@@ -670,7 +667,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
{
...
...
@@ -692,7 +689,7 @@ typedef struct STableMetaMsg {
int8_t
numOfVpeers
;
SVnodeDesc
vpeerDesc
[
TSDB_VNODES_SUPPORT
];
int32_t
sid
;
int32_t
vg
i
d
;
int32_t
vg
I
d
;
uint64_t
uid
;
SSchema
schema
[];
}
STableMetaMsg
;
...
...
src/mnode/src/mgmtChildTable.c
浏览文件 @
5468d172
...
...
@@ -445,7 +445,7 @@ int32_t mgmtModifyChildTableTagValueByName(SChildTableObj *pTable, char *tagName
int32_t
mgmtGetChildTableMeta
(
SDbObj
*
pDb
,
SChildTableObj
*
pTable
,
STableMetaMsg
*
pMeta
,
bool
usePublicIp
)
{
pMeta
->
uid
=
htobe64
(
pTable
->
uid
);
pMeta
->
sid
=
htonl
(
pTable
->
sid
);
pMeta
->
vg
i
d
=
htonl
(
pTable
->
vgId
);
pMeta
->
vg
I
d
=
htonl
(
pTable
->
vgId
);
pMeta
->
sversion
=
htons
(
pTable
->
superTable
->
sversion
);
pMeta
->
precision
=
pDb
->
cfg
.
precision
;
pMeta
->
numOfTags
=
pTable
->
superTable
->
numOfTags
;
...
...
src/mnode/src/mgmtDnode.c
浏览文件 @
5468d172
...
...
@@ -553,11 +553,14 @@ void mgmtProcessDnodeStatusMsg(SRpcMsg *rpcMsg) {
pDnode
->
privateIp
=
htonl
(
pStatus
->
privateIp
);
pDnode
->
publicIp
=
htonl
(
pStatus
->
publicIp
);
pDnode
->
lastReboot
=
htonl
(
pStatus
->
lastReboot
);
pDnode
->
numOfTotalVnodes
=
htons
(
pStatus
->
numOfTotalVnodes
);
pDnode
->
numOfCores
=
htons
(
pStatus
->
numOfCores
);
pDnode
->
diskAvailable
=
pStatus
->
diskAvailable
;
pDnode
->
alternativeRole
=
pStatus
->
alternativeRole
;
if
(
pDnode
->
numOfTotalVnodes
==
0
)
{
pDnode
->
numOfTotalVnodes
=
htons
(
pStatus
->
numOfTotalVnodes
);
}
if
(
pStatus
->
dnodeId
==
0
)
{
mTrace
(
"dnode:%d, first access, privateIp:%s, name:%s, "
,
pDnode
->
dnodeId
,
taosIpStr
(
pDnode
->
privateIp
),
pDnode
->
dnodeName
);
mgmtSetDnodeMaxVnodes
(
pDnode
);
...
...
src/mnode/src/mgmtNormalTable.c
浏览文件 @
5468d172
...
...
@@ -524,7 +524,7 @@ static int32_t mgmtSetSchemaFromNormalTable(SSchema *pSchema, SNormalTableObj *p
int32_t
mgmtGetNormalTableMeta
(
SDbObj
*
pDb
,
SNormalTableObj
*
pTable
,
STableMetaMsg
*
pMeta
,
bool
usePublicIp
)
{
pMeta
->
uid
=
htobe64
(
pTable
->
uid
);
pMeta
->
sid
=
htonl
(
pTable
->
sid
);
pMeta
->
vg
i
d
=
htonl
(
pTable
->
vgId
);
pMeta
->
vg
I
d
=
htonl
(
pTable
->
vgId
);
pMeta
->
sversion
=
htons
(
pTable
->
sversion
);
pMeta
->
precision
=
pDb
->
cfg
.
precision
;
pMeta
->
numOfTags
=
0
;
...
...
src/mnode/src/mgmtSuperTable.c
浏览文件 @
5468d172
...
...
@@ -654,7 +654,7 @@ int32_t mgmtSetSchemaFromSuperTable(SSchema *pSchema, SSuperTableObj *pTable) {
int32_t
mgmtGetSuperTableMeta
(
SDbObj
*
pDb
,
SSuperTableObj
*
pTable
,
STableMetaMsg
*
pMeta
,
bool
usePublicIp
)
{
pMeta
->
uid
=
htobe64
(
pTable
->
uid
);
pMeta
->
sid
=
htonl
(
pTable
->
sid
);
pMeta
->
vg
i
d
=
htonl
(
pTable
->
vgId
);
pMeta
->
vg
I
d
=
htonl
(
pTable
->
vgId
);
pMeta
->
sversion
=
htons
(
pTable
->
sversion
);
pMeta
->
precision
=
pDb
->
cfg
.
precision
;
pMeta
->
numOfTags
=
pTable
->
numOfTags
;
...
...
src/query/CMakeLists.txt
浏览文件 @
5468d172
...
...
@@ -11,5 +11,5 @@ INCLUDE_DIRECTORIES(inc)
IF
((
TD_LINUX_64
)
OR
(
TD_LINUX_32 AND TD_ARM
))
AUX_SOURCE_DIRECTORY
(
src SRC
)
ADD_LIBRARY
(
query
${
SRC
}
)
TARGET_LINK_LIBRARIES
(
query tutil m rt
)
TARGET_LINK_LIBRARIES
(
query t
sdb t
util m rt
)
ENDIF
()
\ No newline at end of file
src/query/inc/qextbuffer.h
浏览文件 @
5468d172
...
...
@@ -124,9 +124,8 @@ typedef struct tTagSchema {
typedef
struct
tSidSet
{
int32_t
numOfSids
;
int32_t
numOfSubSet
;
STable
SidExtInfo
**
pSids
;
STable
IdInfo
**
pTableIdList
;
int32_t
*
starterPos
;
// position of each subgroup, generated according to
SColumnModel
*
pColumnModel
;
SColumnOrderInfo
orderIdx
;
}
tSidSet
;
...
...
src/query/inc/queryExecutor.h
浏览文件 @
5468d172
...
...
@@ -25,6 +25,7 @@
#include "taosdef.h"
#include "tref.h"
#include "tsqlfunction.h"
#include "tarray.h"
typedef
struct
SData
{
int32_t
num
;
...
...
@@ -39,7 +40,7 @@ enum {
struct
SColumnFilterElem
;
typedef
bool
(
*
__filter_func_t
)(
struct
SColumnFilterElem
*
pFilter
,
char
*
val1
,
char
*
val2
);
typedef
int
(
*
__block_search_fn_t
)(
char
*
data
,
int
num
,
int64_t
key
,
in
t
order
);
typedef
int
32_t
(
*
__block_search_fn_t
)(
char
*
data
,
int32_t
num
,
int64_t
key
,
int32_
t
order
);
typedef
struct
SSqlGroupbyExpr
{
int16_t
tableIndex
;
...
...
@@ -142,7 +143,7 @@ typedef struct SQuery {
int32_t
pos
;
int64_t
pointsOffset
;
// the number of points offset to save read data
SData
**
sdata
;
int32_t
capacity
;
SSingleColumnFilterInfo
*
pFilterInfo
;
}
SQuery
;
...
...
@@ -152,7 +153,6 @@ typedef struct SQueryCostSummary {
typedef
struct
SQueryRuntimeEnv
{
SResultInfo
*
resultInfo
;
// todo refactor to merge with SWindowResInfo
SQuery
*
pQuery
;
void
*
pTabObj
;
SData
**
pInterpoBuf
;
SQLFunctionCtx
*
pCtx
;
int16_t
numOfRowsPerPage
;
...
...
@@ -174,15 +174,16 @@ typedef struct SQInfo {
TSKEY
startTime
;
int64_t
elapsedTime
;
SResultRec
rec
;
int
pointsReturned
;
int
pointsInterpo
;
int
code
;
// error code to returned to client
int32_t
pointsReturned
;
int32_t
pointsInterpo
;
int32_t
code
;
// error code to returned to client
int32_t
killed
;
// denotes if current query is killed
sem_t
dataReady
;
S
HashObj
*
pTable
List
;
// table list
S
Array
*
pTableId
List
;
// table list
SQueryRuntimeEnv
runtimeEnv
;
int32_t
subgroupIdx
;
int32_t
offset
;
/* offset in group result set of subgroup */
tSidSet
*
pSidSet
;
//
tSidSet* pSidSet;
T_REF_DECLARE
()
/*
...
...
@@ -204,13 +205,13 @@ 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
* @param pReadMsg
*/
void
qTableQuery
(
void
*
pReadMsg
);
void
qTableQuery
(
SQInfo
*
pQInfo
);
/**
* query on super table
...
...
@@ -218,4 +219,13 @@ void qTableQuery(void* pReadMsg);
*/
void
qSuperTableQuery
(
void
*
pReadMsg
);
/**
* wait for the query completed, and retrieve final results to client
* @param pQInfo
*/
int32_t
qRetrieveQueryResultInfo
(
SQInfo
*
pQInfo
,
int32_t
*
numOfRows
,
int32_t
*
rowsize
);
//int32_t qBuildQueryResult(SQInfo* pQInfo, void* pBuf);
#endif // TDENGINE_QUERYEXECUTOR_H
src/query/src/queryExecutor.c
浏览文件 @
5468d172
此差异已折叠。
点击以展开。
src/rpc/src/rpcMain.c
浏览文件 @
5468d172
...
...
@@ -287,7 +287,7 @@ void rpcClose(void *param) {
(
*
taosCleanUpConn
[
pRpc
->
connType
])(
pRpc
->
udphandle
);
for
(
int
i
=
0
;
i
<
pRpc
->
sessions
;
++
i
)
{
if
(
pRpc
->
connList
[
i
].
user
[
0
])
{
if
(
pRpc
->
connList
&&
pRpc
->
connList
[
i
].
user
[
0
])
{
rpcCloseConn
((
void
*
)(
pRpc
->
connList
+
i
));
}
}
...
...
@@ -495,9 +495,10 @@ static void rpcCloseConn(void *thandle) {
SRpcConn
*
pConn
=
(
SRpcConn
*
)
thandle
;
SRpcInfo
*
pRpc
=
pConn
->
pRpc
;
if
(
pConn
->
user
[
0
]
==
0
)
return
;
rpcLockConn
(
pConn
);
if
(
pConn
->
user
[
0
])
{
pConn
->
user
[
0
]
=
0
;
if
(
taosCloseConn
[
pConn
->
connType
])
(
*
taosCloseConn
[
pConn
->
connType
])(
pConn
->
chandle
);
...
...
@@ -522,7 +523,6 @@ static void rpcCloseConn(void *thandle) {
pConn
->
pContext
=
NULL
;
tTrace
(
"%s %p, rpc connection is closed"
,
pRpc
->
label
,
pConn
);
}
rpcUnlockConn
(
pConn
);
}
...
...
src/vnode/tsdb/src/tsdbRead.c
浏览文件 @
5468d172
...
...
@@ -16,3 +16,51 @@
#include "os.h"
#include "tsdb.h"
tsdb_query_handle_t
*
tsdbQueryByTableId
(
STsdbQueryCond
*
pCond
,
SArray
*
idList
,
SArray
*
pColumnInfo
)
{
}
bool
tsdbNextDataBlock
(
tsdb_query_handle_t
*
pQueryHandle
)
{
return
false
;
}
SDataBlockInfo
tsdbRetrieveDataBlockInfo
(
tsdb_query_handle_t
*
pQueryHandle
)
{
}
int32_t
tsdbRetrieveDataBlockStatisInfo
(
tsdb_query_handle_t
*
pQueryHandle
,
SDataStatis
**
pBlockStatis
)
{
}
SArray
*
tsdbRetrieveDataBlock
(
tsdb_query_handle_t
*
pQueryHandle
,
SArray
*
pIdList
)
{
}
int32_t
tsdbResetQuery
(
tsdb_query_handle_t
*
pQueryHandle
,
STimeWindow
*
window
,
tsdbpos_t
position
,
int16_t
order
)
{
}
int32_t
tsdbDataBlockSeek
(
tsdb_query_handle_t
*
pQueryHandle
,
tsdbpos_t
pos
)
{
}
tsdbpos_t
tsdbDataBlockTell
(
tsdb_query_handle_t
*
pQueryHandle
)
{
return
NULL
;
}
SArray
*
tsdbRetrieveDataRow
(
tsdb_query_handle_t
*
pQueryHandle
,
SArray
*
pIdList
,
SQueryRowCond
*
pCond
)
{
}
tsdb_query_handle_t
*
tsdbQueryFromTagConds
(
STsdbQueryCond
*
pCond
,
int16_t
stableId
,
const
char
*
pTagFilterStr
)
{
}
STableIDList
*
tsdbGetTableList
(
tsdb_query_handle_t
*
pQueryHandle
)
{
}
STableIDList
*
tsdbQueryTableList
(
int16_t
stableId
,
const
char
*
pTagCond
)
{
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录