Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
9ca99fa7
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看板
未验证
提交
9ca99fa7
编写于
7月 29, 2020
作者:
S
Shengliang Guan
提交者:
GitHub
7月 29, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2798 from taosdata/feature/query
[td-225] fix deadlock for client during query.
上级
2db7ed6d
cf509b85
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
54 addition
and
66 deletion
+54
-66
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+6
-7
src/client/src/tscParseInsert.c
src/client/src/tscParseInsert.c
+3
-3
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+8
-8
src/client/src/tscSchemaUtil.c
src/client/src/tscSchemaUtil.c
+2
-2
src/client/src/tscServer.c
src/client/src/tscServer.c
+11
-11
src/client/src/tscSub.c
src/client/src/tscSub.c
+1
-1
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+7
-7
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+3
-3
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+13
-22
src/util/inc/talgo.h
src/util/inc/talgo.h
+0
-2
未找到文件。
src/client/inc/tsclient.h
浏览文件 @
9ca99fa7
...
...
@@ -60,15 +60,14 @@ typedef struct SCMCorVgroupInfo {
}
SCMCorVgroupInfo
;
typedef
struct
STableMeta
{
STableComInfo
tableInfo
;
uint8_t
tableType
;
int16_t
sversion
;
int16_t
tversion
;
STableComInfo
tableInfo
;
uint8_t
tableType
;
int16_t
sversion
;
int16_t
tversion
;
SCMVgroupInfo
vgroupInfo
;
SCMCorVgroupInfo
corVgroupInfo
;
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
STableId
id
;
SSchema
schema
[];
// if the table is TSDB_CHILD_TABLE, schema is acquired by super table meta info
}
STableMeta
;
typedef
struct
STableMetaInfo
{
...
...
src/client/src/tscParseInsert.c
浏览文件 @
9ca99fa7
...
...
@@ -629,8 +629,8 @@ int32_t tscAllocateMemIfNeed(STableDataBlocks *pDataBlock, int32_t rowSize, int3
}
static
void
tsSetBlockInfo
(
SSubmitBlk
*
pBlocks
,
const
STableMeta
*
pTableMeta
,
int32_t
numOfRows
)
{
pBlocks
->
tid
=
pTableMeta
->
s
id
;
pBlocks
->
uid
=
pTableMeta
->
uid
;
pBlocks
->
tid
=
pTableMeta
->
id
.
t
id
;
pBlocks
->
uid
=
pTableMeta
->
id
.
uid
;
pBlocks
->
sversion
=
pTableMeta
->
sversion
;
pBlocks
->
numOfRows
+=
numOfRows
;
}
...
...
@@ -686,7 +686,7 @@ static int32_t doParseInsertStatement(SSqlObj *pSql, void *pTableList, char **st
STableComInfo
tinfo
=
tscGetTableInfo
(
pTableMeta
);
STableDataBlocks
*
dataBuf
=
NULL
;
int32_t
ret
=
tscGetDataBlockFromList
(
pTableList
,
pCmd
->
pDataBlocks
,
pTableMeta
->
uid
,
TSDB_DEFAULT_PAYLOAD_SIZE
,
int32_t
ret
=
tscGetDataBlockFromList
(
pTableList
,
pCmd
->
pDataBlocks
,
pTableMeta
->
id
.
uid
,
TSDB_DEFAULT_PAYLOAD_SIZE
,
sizeof
(
SSubmitBlk
),
tinfo
.
rowSize
,
pTableMetaInfo
->
name
,
pTableMeta
,
&
dataBuf
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
...
...
src/client/src/tscSQLParser.c
浏览文件 @
9ca99fa7
...
...
@@ -635,7 +635,7 @@ int32_t parseIntervalClause(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SQuerySQL* pQ
int32_t
tableIndex
=
COLUMN_INDEX_INITIAL_VAL
;
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
numOfTables
;
++
i
)
{
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
i
);
if
(
pTableMetaInfo
->
pTableMeta
->
uid
==
uid
)
{
if
(
pTableMetaInfo
->
pTableMeta
->
id
.
uid
==
uid
)
{
tableIndex
=
i
;
break
;
}
...
...
@@ -3053,7 +3053,7 @@ static int32_t getJoinCondInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSQLExpr*
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
index
.
tableIndex
);
SSchema
*
pTagSchema1
=
tscGetTableColumnSchema
(
pTableMetaInfo
->
pTableMeta
,
index
.
columnIndex
);
pLeft
->
uid
=
pTableMetaInfo
->
pTableMeta
->
uid
;
pLeft
->
uid
=
pTableMetaInfo
->
pTableMeta
->
id
.
uid
;
pLeft
->
tagColId
=
pTagSchema1
->
colId
;
strcpy
(
pLeft
->
tableId
,
pTableMetaInfo
->
name
);
...
...
@@ -3065,7 +3065,7 @@ static int32_t getJoinCondInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSQLExpr*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
index
.
tableIndex
);
SSchema
*
pTagSchema2
=
tscGetTableColumnSchema
(
pTableMetaInfo
->
pTableMeta
,
index
.
columnIndex
);
pRight
->
uid
=
pTableMetaInfo
->
pTableMeta
->
uid
;
pRight
->
uid
=
pTableMetaInfo
->
pTableMeta
->
id
.
uid
;
pRight
->
tagColId
=
pTagSchema2
->
colId
;
strcpy
(
pRight
->
tableId
,
pTableMetaInfo
->
name
);
...
...
@@ -3603,7 +3603,7 @@ static int32_t setTableCondForSTableQuery(SSqlCmd* pCmd, SQueryInfo* pQueryInfo,
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
tableCondIndex
);
STagCond
*
pTagCond
=
&
pQueryInfo
->
tagCond
;
pTagCond
->
tbnameCond
.
uid
=
pTableMetaInfo
->
pTableMeta
->
uid
;
pTagCond
->
tbnameCond
.
uid
=
pTableMetaInfo
->
pTableMeta
->
id
.
uid
;
assert
(
pExpr
->
nSQLOptr
==
TK_LIKE
||
pExpr
->
nSQLOptr
==
TK_IN
);
...
...
@@ -3840,7 +3840,7 @@ static int32_t getTagQueryCondExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SCondE
// add to source column list
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
i
);
int64_t
uid
=
pTableMetaInfo
->
pTableMeta
->
uid
;
int64_t
uid
=
pTableMetaInfo
->
pTableMeta
->
id
.
uid
;
int32_t
numOfCols
=
tscGetNumOfColumns
(
pTableMetaInfo
->
pTableMeta
);
size_t
num
=
taosArrayGetSize
(
colList
);
...
...
@@ -4506,8 +4506,8 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
SUpdateTableTagValMsg
*
pUpdateMsg
=
(
SUpdateTableTagValMsg
*
)
pCmd
->
payload
;
pUpdateMsg
->
head
.
vgId
=
htonl
(
pTableMeta
->
vgroupInfo
.
vgId
);
pUpdateMsg
->
tid
=
htonl
(
pTableMeta
->
s
id
);
pUpdateMsg
->
uid
=
htobe64
(
pTableMeta
->
uid
);
pUpdateMsg
->
tid
=
htonl
(
pTableMeta
->
id
.
t
id
);
pUpdateMsg
->
uid
=
htobe64
(
pTableMeta
->
id
.
uid
);
pUpdateMsg
->
colId
=
htons
(
pTagsSchema
->
colId
);
pUpdateMsg
->
type
=
pTagsSchema
->
type
;
pUpdateMsg
->
bytes
=
htons
(
pTagsSchema
->
bytes
);
...
...
@@ -5045,7 +5045,7 @@ void addGroupInfoForSubquery(SSqlObj* pParentObj, SSqlObj* pSql, int32_t subClau
if
(
pExpr
->
functionId
!=
TSDB_FUNC_TAG
)
{
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
tableIndex
);
int16_t
columnInfo
=
tscGetJoinTagColIdByUid
(
&
pQueryInfo
->
tagCond
,
pTableMetaInfo
->
pTableMeta
->
uid
);
int16_t
columnInfo
=
tscGetJoinTagColIdByUid
(
&
pQueryInfo
->
tagCond
,
pTableMetaInfo
->
pTableMeta
->
id
.
uid
);
SColumnIndex
index
=
{.
tableIndex
=
0
,
.
columnIndex
=
columnInfo
};
SSchema
*
pSchema
=
tscGetTableTagSchema
(
pTableMetaInfo
->
pTableMeta
);
...
...
src/client/src/tscSchemaUtil.c
浏览文件 @
9ca99fa7
...
...
@@ -162,8 +162,8 @@ STableMeta* tscCreateTableMetaFromMsg(STableMetaMsg* pTableMetaMsg, size_t* size
.
numOfColumns
=
pTableMetaMsg
->
numOfColumns
,
};
pTableMeta
->
s
id
=
pTableMetaMsg
->
sid
;
pTableMeta
->
uid
=
pTableMetaMsg
->
uid
;
pTableMeta
->
id
.
t
id
=
pTableMetaMsg
->
sid
;
pTableMeta
->
id
.
uid
=
pTableMetaMsg
->
uid
;
pTableMeta
->
vgroupInfo
=
pTableMetaMsg
->
vgroup
;
tscInitCorVgroupInfo
(
&
pTableMeta
->
corVgroupInfo
,
&
pTableMeta
->
vgroupInfo
);
...
...
src/client/src/tscServer.c
浏览文件 @
9ca99fa7
...
...
@@ -605,9 +605,9 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char
}
STableIdInfo
*
pTableIdInfo
=
(
STableIdInfo
*
)
pMsg
;
pTableIdInfo
->
tid
=
htonl
(
pTableMeta
->
s
id
);
pTableIdInfo
->
uid
=
htobe64
(
pTableMeta
->
uid
);
pTableIdInfo
->
key
=
htobe64
(
tscGetSubscriptionProgress
(
pSql
->
pSubscription
,
pTableMeta
->
uid
,
dfltKey
));
pTableIdInfo
->
tid
=
htonl
(
pTableMeta
->
id
.
t
id
);
pTableIdInfo
->
uid
=
htobe64
(
pTableMeta
->
id
.
uid
);
pTableIdInfo
->
key
=
htobe64
(
tscGetSubscriptionProgress
(
pSql
->
pSubscription
,
pTableMeta
->
id
.
uid
,
dfltKey
));
pQueryMsg
->
numOfTables
=
htonl
(
1
);
// set the number of tables
pMsg
+=
sizeof
(
STableIdInfo
);
...
...
@@ -640,7 +640,7 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char
}
tscDebug
(
"%p vgId:%d, query on table:%s, tid:%d, uid:%"
PRIu64
,
pSql
,
htonl
(
pQueryMsg
->
head
.
vgId
),
pTableMetaInfo
->
name
,
pTableMeta
->
sid
,
pTableMeta
->
uid
);
pTableMeta
->
id
.
tid
,
pTableMeta
->
id
.
uid
);
return
pMsg
;
}
...
...
@@ -714,8 +714,8 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
if
(
pCol
->
colIndex
.
columnIndex
>=
tscGetNumOfColumns
(
pTableMeta
)
||
pColSchema
->
type
<
TSDB_DATA_TYPE_BOOL
||
pColSchema
->
type
>
TSDB_DATA_TYPE_NCHAR
)
{
tscError
(
"%p
s
id:%d uid:%"
PRIu64
" id:%s, column index out of range, numOfColumns:%d, index:%d, column name:%s"
,
pSql
,
pTableMeta
->
sid
,
pTableMeta
->
uid
,
pTableMetaInfo
->
name
,
tscGetNumOfColumns
(
pTableMeta
),
pCol
->
colIndex
.
columnIndex
,
tscError
(
"%p
t
id:%d uid:%"
PRIu64
" id:%s, column index out of range, numOfColumns:%d, index:%d, column name:%s"
,
pSql
,
pTableMeta
->
id
.
tid
,
pTableMeta
->
id
.
uid
,
pTableMetaInfo
->
name
,
tscGetNumOfColumns
(
pTableMeta
),
pCol
->
colIndex
.
columnIndex
,
pColSchema
->
name
);
return
TSDB_CODE_TSC_INVALID_SQL
;
...
...
@@ -833,8 +833,8 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
if
((
pCol
->
colIndex
.
columnIndex
>=
numOfTagColumns
||
pCol
->
colIndex
.
columnIndex
<
-
1
)
||
(
pColSchema
->
type
<
TSDB_DATA_TYPE_BOOL
||
pColSchema
->
type
>
TSDB_DATA_TYPE_NCHAR
))
{
tscError
(
"%p
s
id:%d uid:%"
PRIu64
" id:%s, tag index out of range, totalCols:%d, numOfTags:%d, index:%d, column name:%s"
,
pSql
,
pTableMeta
->
sid
,
pTableMeta
->
uid
,
pTableMetaInfo
->
name
,
total
,
numOfTagColumns
,
tscError
(
"%p
t
id:%d uid:%"
PRIu64
" id:%s, tag index out of range, totalCols:%d, numOfTags:%d, index:%d, column name:%s"
,
pSql
,
pTableMeta
->
id
.
tid
,
pTableMeta
->
id
.
uid
,
pTableMetaInfo
->
name
,
total
,
numOfTagColumns
,
pCol
->
colIndex
.
columnIndex
,
pColSchema
->
name
);
return
TSDB_CODE_TSC_INVALID_SQL
;
...
...
@@ -855,7 +855,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
if
(
pQueryInfo
->
tagCond
.
pCond
!=
NULL
&&
taosArrayGetSize
(
pQueryInfo
->
tagCond
.
pCond
)
>
0
)
{
STagCond
*
pTagCond
=
&
pQueryInfo
->
tagCond
;
SCond
*
pCond
=
tsGetSTableQueryCond
(
pTagCond
,
pTableMeta
->
uid
);
SCond
*
pCond
=
tsGetSTableQueryCond
(
pTagCond
,
pTableMeta
->
id
.
uid
);
if
(
pCond
!=
NULL
&&
pCond
->
cond
!=
NULL
)
{
pQueryMsg
->
tagCondLen
=
htons
(
pCond
->
len
);
memcpy
(
pMsg
,
pCond
->
cond
,
pCond
->
len
);
...
...
@@ -1739,7 +1739,7 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) {
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
tscDebug
(
"%p recv table meta, uid:%"
PRId64
", tid:%d, name:%s"
,
pSql
,
pTableMeta
->
uid
,
pTableMeta
->
s
id
,
pTableMetaInfo
->
name
);
tscDebug
(
"%p recv table meta, uid:%"
PRId64
", tid:%d, name:%s"
,
pSql
,
pTableMeta
->
id
.
uid
,
pTableMeta
->
id
.
t
id
,
pTableMetaInfo
->
name
);
free
(
pTableMeta
);
return
TSDB_CODE_SUCCESS
;
...
...
@@ -2215,7 +2215,7 @@ int tscRenewTableMeta(SSqlObj *pSql, char *tableId) {
STableMeta
*
pTableMeta
=
pTableMetaInfo
->
pTableMeta
;
if
(
pTableMetaInfo
->
pTableMeta
)
{
tscDebug
(
"%p update table meta, old meta numOfTags:%d, numOfCols:%d, uid:%"
PRId64
", addr:%p"
,
pSql
,
tscGetNumOfTags
(
pTableMeta
),
tscGetNumOfColumns
(
pTableMeta
),
pTableMeta
->
uid
,
pTableMeta
);
tscGetNumOfTags
(
pTableMeta
),
tscGetNumOfColumns
(
pTableMeta
),
pTableMeta
->
id
.
uid
,
pTableMeta
);
}
taosCacheRelease
(
tscCacheHandle
,
(
void
**
)
&
(
pTableMetaInfo
->
pTableMeta
),
true
);
...
...
src/client/src/tscSub.c
浏览文件 @
9ca99fa7
...
...
@@ -241,7 +241,7 @@ static int tscUpdateSubscription(STscObj* pObj, SSub* pSub) {
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
if
(
UTIL_TABLE_IS_NORMAL_TABLE
(
pTableMetaInfo
))
{
STableMeta
*
pTableMeta
=
pTableMetaInfo
->
pTableMeta
;
SSubscriptionProgress
target
=
{.
uid
=
pTableMeta
->
uid
,
.
key
=
0
};
SSubscriptionProgress
target
=
{.
uid
=
pTableMeta
->
id
.
uid
,
.
key
=
0
};
SSubscriptionProgress
*
p
=
taosArraySearch
(
pSub
->
progress
,
&
target
,
tscCompareSubscriptionProgress
);
if
(
p
==
NULL
)
{
taosArrayClear
(
pSub
->
progress
);
...
...
src/client/src/tscSubquery.c
浏览文件 @
9ca99fa7
...
...
@@ -180,7 +180,7 @@ SJoinSupporter* tscCreateJoinSupporter(SSqlObj* pSql, SSubqueryState* pState, in
pSupporter
->
limit
=
pQueryInfo
->
limit
;
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
&
pSql
->
cmd
,
pSql
->
cmd
.
clauseIndex
,
index
);
pSupporter
->
uid
=
pTableMetaInfo
->
pTableMeta
->
uid
;
pSupporter
->
uid
=
pTableMetaInfo
->
pTableMeta
->
id
.
uid
;
assert
(
pSupporter
->
uid
!=
0
);
getTmpfilePath
(
"join-"
,
pSupporter
->
path
);
...
...
@@ -355,7 +355,7 @@ static int32_t tscLaunchRealSubqueries(SSqlObj* pSql) {
// set the join condition tag column info, to do extract method
if
(
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
))
{
assert
(
pQueryInfo
->
tagCond
.
joinInfo
.
hasJoin
);
int16_t
colId
=
tscGetJoinTagColIdByUid
(
&
pQueryInfo
->
tagCond
,
pTableMetaInfo
->
pTableMeta
->
uid
);
int16_t
colId
=
tscGetJoinTagColIdByUid
(
&
pQueryInfo
->
tagCond
,
pTableMetaInfo
->
pTableMeta
->
id
.
uid
);
pExpr
->
param
[
0
].
i64Key
=
colId
;
pExpr
->
numOfParams
=
1
;
...
...
@@ -499,7 +499,7 @@ static void issueTSCompQuery(SSqlObj* pSql, SJoinSupporter* pSupporter, SSqlObj*
// set the tags value for ts_comp function
if
(
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
))
{
SSqlExpr
*
pExpr
=
tscSqlExprGet
(
pQueryInfo
,
0
);
int16_t
tagColId
=
tscGetJoinTagColIdByUid
(
&
pSupporter
->
tagCond
,
pTableMetaInfo
->
pTableMeta
->
uid
);
int16_t
tagColId
=
tscGetJoinTagColIdByUid
(
&
pSupporter
->
tagCond
,
pTableMetaInfo
->
pTableMeta
->
id
.
uid
);
pExpr
->
param
->
i64Key
=
tagColId
;
pExpr
->
numOfParams
=
1
;
}
...
...
@@ -560,7 +560,7 @@ static int32_t getIntersectionOfTableTuple(SQueryInfo* pQueryInfo, SSqlObj* pPar
qsort
(
p2
->
pIdTagList
,
p2
->
num
,
p2
->
tagSize
,
tscCompareTidTags
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
int16_t
tagColId
=
tscGetJoinTagColIdByUid
(
&
pQueryInfo
->
tagCond
,
pTableMetaInfo
->
pTableMeta
->
uid
);
int16_t
tagColId
=
tscGetJoinTagColIdByUid
(
&
pQueryInfo
->
tagCond
,
pTableMetaInfo
->
pTableMeta
->
id
.
uid
);
SSchema
*
pColSchema
=
tscGetTableColumnSchemaById
(
pTableMetaInfo
->
pTableMeta
,
tagColId
);
...
...
@@ -1034,7 +1034,7 @@ void tscSetupOutputColumnIndex(SSqlObj* pSql) {
int32_t
tableIndexOfSub
=
-
1
;
for
(
int32_t
j
=
0
;
j
<
pQueryInfo
->
numOfTables
;
++
j
)
{
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
j
);
if
(
pTableMetaInfo
->
pTableMeta
->
uid
==
pExpr
->
uid
)
{
if
(
pTableMetaInfo
->
pTableMeta
->
id
.
uid
==
pExpr
->
uid
)
{
tableIndexOfSub
=
j
;
break
;
}
...
...
@@ -1205,7 +1205,7 @@ int32_t tscLaunchJoinSubquery(SSqlObj *pSql, int16_t tableIndex, SJoinSupporter
STagCond
*
pTagCond
=
&
pSupporter
->
tagCond
;
assert
(
pTagCond
->
joinInfo
.
hasJoin
);
int32_t
tagColId
=
tscGetJoinTagColIdByUid
(
pTagCond
,
pTableMetaInfo
->
pTableMeta
->
uid
);
int32_t
tagColId
=
tscGetJoinTagColIdByUid
(
pTagCond
,
pTableMetaInfo
->
pTableMeta
->
id
.
uid
);
SSchema
*
s
=
tscGetTableColumnSchemaById
(
pTableMetaInfo
->
pTableMeta
,
tagColId
);
int16_t
bytes
=
0
;
...
...
@@ -1237,7 +1237,7 @@ int32_t tscLaunchJoinSubquery(SSqlObj *pSql, int16_t tableIndex, SJoinSupporter
SSqlExpr
*
pExpr
=
tscSqlExprGet
(
pNewQueryInfo
,
0
);
if
(
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
))
{
int16_t
tagColId
=
tscGetJoinTagColIdByUid
(
&
pSupporter
->
tagCond
,
pTableMetaInfo
->
pTableMeta
->
uid
);
int16_t
tagColId
=
tscGetJoinTagColIdByUid
(
&
pSupporter
->
tagCond
,
pTableMetaInfo
->
pTableMeta
->
id
.
uid
);
pExpr
->
param
->
i64Key
=
tagColId
;
pExpr
->
numOfParams
=
1
;
}
...
...
src/client/src/tscUtil.c
浏览文件 @
9ca99fa7
...
...
@@ -955,7 +955,7 @@ static SSqlExpr* doBuildSqlExpr(SQueryInfo* pQueryInfo, int16_t functionId, SCol
pExpr
->
interBytes
=
interSize
;
if
(
pTableMetaInfo
->
pTableMeta
)
{
pExpr
->
uid
=
pTableMetaInfo
->
pTableMeta
->
uid
;
pExpr
->
uid
=
pTableMetaInfo
->
pTableMeta
->
id
.
uid
;
}
return
pExpr
;
...
...
@@ -1482,7 +1482,7 @@ STableMetaInfo* tscGetTableMetaInfoByUid(SQueryInfo* pQueryInfo, uint64_t uid, i
int32_t
k
=
-
1
;
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
numOfTables
;
++
i
)
{
if
(
pQueryInfo
->
pTableMetaInfo
[
i
]
->
pTableMeta
->
uid
==
uid
)
{
if
(
pQueryInfo
->
pTableMetaInfo
[
i
]
->
pTableMeta
->
id
.
uid
==
uid
)
{
k
=
i
;
break
;
}
...
...
@@ -1760,7 +1760,7 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, void (*fp)(), void
TSDB_QUERY_SET_TYPE
(
pNewQueryInfo
->
type
,
TSDB_QUERY_TYPE_SUBQUERY
);
// it must be the subquery
}
uint64_t
uid
=
pTableMetaInfo
->
pTableMeta
->
uid
;
uint64_t
uid
=
pTableMetaInfo
->
pTableMeta
->
id
.
uid
;
tscSqlExprCopy
(
pNewQueryInfo
->
exprList
,
pQueryInfo
->
exprList
,
uid
,
true
);
int32_t
numOfOutput
=
tscSqlExprNumOfExprs
(
pNewQueryInfo
);
...
...
src/query/src/qExecutor.c
浏览文件 @
9ca99fa7
...
...
@@ -6287,10 +6287,17 @@ void qDestroyQueryInfo(qinfo_t qHandle) {
freeQInfo
(
pQInfo
);
}
static
void
setQueryResultReady
(
SQInfo
*
pQInfo
)
{
static
bool
doBuildResCheck
(
SQInfo
*
pQInfo
)
{
bool
buildRes
=
false
;
pthread_mutex_lock
(
&
pQInfo
->
lock
);
pQInfo
->
dataReady
=
QUERY_RESULT_READY
;
buildRes
=
(
pQInfo
->
rspContext
!=
NULL
);
pthread_mutex_unlock
(
&
pQInfo
->
lock
);
return
buildRes
;
}
bool
qTableQuery
(
qinfo_t
qinfo
)
{
...
...
@@ -6303,16 +6310,13 @@ bool qTableQuery(qinfo_t qinfo) {
if
(
IS_QUERY_KILLED
(
pQInfo
))
{
qDebug
(
"QInfo:%p it is already killed, abort"
,
pQInfo
);
setQueryResultReady
(
pQInfo
);
return
false
;
return
doBuildResCheck
(
pQInfo
);
}
if
(
pQInfo
->
tableqinfoGroupInfo
.
numOfTables
==
0
)
{
setQueryStatus
(
pQInfo
->
runtimeEnv
.
pQuery
,
QUERY_COMPLETED
);
setQueryResultReady
(
pQInfo
);
qDebug
(
"QInfo:%p no table exists for query, abort"
,
pQInfo
);
return
false
;
setQueryStatus
(
pQInfo
->
runtimeEnv
.
pQuery
,
QUERY_COMPLETED
);
return
doBuildResCheck
(
pQInfo
);
}
// error occurs, record the error code and return to client
...
...
@@ -6320,9 +6324,7 @@ bool qTableQuery(qinfo_t qinfo) {
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
pQInfo
->
code
=
ret
;
qDebug
(
"QInfo:%p query abort due to error/cancel occurs, code:%s"
,
pQInfo
,
tstrerror
(
pQInfo
->
code
));
setQueryResultReady
(
pQInfo
);
return
false
;
return
doBuildResCheck
(
pQInfo
);
}
qDebug
(
"QInfo:%p query task is launched"
,
pQInfo
);
...
...
@@ -6347,17 +6349,7 @@ bool qTableQuery(qinfo_t qinfo) {
pQInfo
,
pQuery
->
rec
.
rows
,
pQuery
->
rec
.
total
+
pQuery
->
rec
.
rows
);
}
bool
buildRes
=
false
;
pthread_mutex_lock
(
&
pQInfo
->
lock
);
pQInfo
->
dataReady
=
QUERY_RESULT_READY
;
if
(
pQInfo
->
rspContext
!=
NULL
)
{
buildRes
=
true
;
}
pthread_mutex_unlock
(
&
pQInfo
->
lock
);
return
buildRes
;
return
doBuildResCheck
(
pQInfo
);
}
int32_t
qRetrieveQueryResultInfo
(
qinfo_t
qinfo
,
bool
*
buildRes
,
void
*
pRspContext
)
{
...
...
@@ -6484,7 +6476,6 @@ int32_t qKillQuery(qinfo_t qinfo) {
return
TSDB_CODE_QRY_INVALID_QHANDLE
;
}
// sem_post(&pQInfo->dataReady);
setQueryKilled
(
pQInfo
);
return
TSDB_CODE_SUCCESS
;
}
...
...
src/util/inc/talgo.h
浏览文件 @
9ca99fa7
...
...
@@ -20,8 +20,6 @@
extern
"C"
{
#endif
#include "os.h"
#define TD_EQ 0x1
#define TD_GT 0x2
#define TD_LT 0x4
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录