Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
codyshao
TDengine
提交
1f1ae670
T
TDengine
项目概览
codyshao
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
2
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,发现更多精彩内容 >>
未验证
提交
1f1ae670
编写于
6月 12, 2020
作者:
S
Shengliang Guan
提交者:
GitHub
6月 12, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2253 from taosdata/feature/query
Feature/query
上级
e6817376
df41013e
变更
9
显示空白变更内容
内联
并排
Showing
9 changed file
with
96 addition
and
103 deletion
+96
-103
src/client/src/tscSecondaryMerge.c
src/client/src/tscSecondaryMerge.c
+5
-5
src/client/src/tscServer.c
src/client/src/tscServer.c
+5
-5
src/client/src/tscSql.c
src/client/src/tscSql.c
+22
-13
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+1
-20
src/query/inc/tsqlfunction.h
src/query/inc/tsqlfunction.h
+1
-1
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+35
-33
src/rpc/src/rpcMain.c
src/rpc/src/rpcMain.c
+0
-1
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+23
-23
src/vnode/src/vnodeRead.c
src/vnode/src/vnodeRead.c
+4
-2
未找到文件。
src/client/src/tscSecondaryMerge.c
浏览文件 @
1f1ae670
src/client/src/tscServer.c
浏览文件 @
1f1ae670
...
@@ -209,6 +209,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcIpSet *pIpSet) {
...
@@ -209,6 +209,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcIpSet *pIpSet) {
tscError
(
"%p sql is already released"
,
pSql
->
signature
);
tscError
(
"%p sql is already released"
,
pSql
->
signature
);
return
;
return
;
}
}
if
(
pSql
->
signature
!=
pSql
)
{
if
(
pSql
->
signature
!=
pSql
)
{
tscError
(
"%p sql is already released, signature:%p"
,
pSql
,
pSql
->
signature
);
tscError
(
"%p sql is already released, signature:%p"
,
pSql
,
pSql
->
signature
);
return
;
return
;
...
@@ -217,10 +218,9 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcIpSet *pIpSet) {
...
@@ -217,10 +218,9 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcIpSet *pIpSet) {
SSqlRes
*
pRes
=
&
pSql
->
res
;
SSqlRes
*
pRes
=
&
pSql
->
res
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
STscObj
*
pObj
=
pSql
->
pTscObj
;
STscObj
*
pObj
=
pSql
->
pTscObj
;
// tscTrace("%p msg:%s is received from server", pSql, taosMsg[rpcMsg->msgType]);
if
(
pObj
->
signature
!=
pObj
)
{
if
(
pObj
->
signature
!=
pObj
||
pSql
->
freed
==
1
)
{
tscTrace
(
"%p sql
is already
released or DB connection is closed, freed:%d pObj:%p signature:%p"
,
pSql
,
pSql
->
freed
,
tscTrace
(
"%p sql
Obj needs to be
released or DB connection is closed, freed:%d pObj:%p signature:%p"
,
pSql
,
pSql
->
freed
,
pObj
,
pObj
->
signature
);
pObj
,
pObj
->
signature
);
tscFreeSqlObj
(
pSql
);
tscFreeSqlObj
(
pSql
);
rpcFreeCont
(
rpcMsg
->
pCont
);
rpcFreeCont
(
rpcMsg
->
pCont
);
...
@@ -375,7 +375,7 @@ int tscProcessSql(SSqlObj *pSql) {
...
@@ -375,7 +375,7 @@ int tscProcessSql(SSqlObj *pSql) {
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
STableMetaInfo
*
pTableMetaInfo
=
NULL
;
STableMetaInfo
*
pTableMetaInfo
=
NULL
;
uint
16
_t
type
=
0
;
uint
32
_t
type
=
0
;
if
(
pQueryInfo
!=
NULL
)
{
if
(
pQueryInfo
!=
NULL
)
{
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
...
@@ -424,7 +424,7 @@ void tscKillSTableQuery(SSqlObj *pSql) {
...
@@ -424,7 +424,7 @@ void tscKillSTableQuery(SSqlObj *pSql) {
* sub-queries not correctly released and master sql object of super table query reaches an abnormal state.
* sub-queries not correctly released and master sql object of super table query reaches an abnormal state.
*/
*/
pSql
->
pSubs
[
i
]
->
res
.
code
=
TSDB_CODE_TSC_QUERY_CANCELLED
;
pSql
->
pSubs
[
i
]
->
res
.
code
=
TSDB_CODE_TSC_QUERY_CANCELLED
;
//taosStopRpcConn(pSql->pSubs[i]->thandle
);
// taosStopRpcConn(pSql->pSubs[i]->
);
}
}
/*
/*
...
...
src/client/src/tscSql.c
浏览文件 @
1f1ae670
...
@@ -219,6 +219,11 @@ void waitForQueryRsp(void *param, TAOS_RES *tres, int code) {
...
@@ -219,6 +219,11 @@ void waitForQueryRsp(void *param, TAOS_RES *tres, int code) {
sem_post
(
&
pSql
->
rspSem
);
sem_post
(
&
pSql
->
rspSem
);
}
}
static
void
waitForRetrieveRsp
(
void
*
param
,
TAOS_RES
*
tres
,
int
numOfRows
)
{
SSqlObj
*
pSql
=
(
SSqlObj
*
)
tres
;
sem_post
(
&
pSql
->
rspSem
);
}
TAOS_RES
*
taos_query
(
TAOS
*
taos
,
const
char
*
sqlstr
)
{
TAOS_RES
*
taos_query
(
TAOS
*
taos
,
const
char
*
sqlstr
)
{
STscObj
*
pObj
=
(
STscObj
*
)
taos
;
STscObj
*
pObj
=
(
STscObj
*
)
taos
;
if
(
pObj
==
NULL
||
pObj
->
signature
!=
pObj
)
{
if
(
pObj
==
NULL
||
pObj
->
signature
!=
pObj
)
{
...
@@ -369,11 +374,6 @@ int taos_fetch_block_impl(TAOS_RES *res, TAOS_ROW *rows) {
...
@@ -369,11 +374,6 @@ int taos_fetch_block_impl(TAOS_RES *res, TAOS_ROW *rows) {
return
(
pQueryInfo
->
order
.
order
==
TSDB_ORDER_DESC
)
?
pRes
->
numOfRows
:
-
pRes
->
numOfRows
;
return
(
pQueryInfo
->
order
.
order
==
TSDB_ORDER_DESC
)
?
pRes
->
numOfRows
:
-
pRes
->
numOfRows
;
}
}
static
void
waitForRetrieveRsp
(
void
*
param
,
TAOS_RES
*
tres
,
int
numOfRows
)
{
SSqlObj
*
pSql
=
(
SSqlObj
*
)
tres
;
sem_post
(
&
pSql
->
rspSem
);
}
TAOS_ROW
taos_fetch_row
(
TAOS_RES
*
res
)
{
TAOS_ROW
taos_fetch_row
(
TAOS_RES
*
res
)
{
SSqlObj
*
pSql
=
(
SSqlObj
*
)
res
;
SSqlObj
*
pSql
=
(
SSqlObj
*
)
res
;
if
(
pSql
==
NULL
||
pSql
->
signature
!=
pSql
)
{
if
(
pSql
==
NULL
||
pSql
->
signature
!=
pSql
)
{
...
@@ -476,7 +476,7 @@ int taos_select_db(TAOS *taos, const char *db) {
...
@@ -476,7 +476,7 @@ int taos_select_db(TAOS *taos, const char *db) {
}
}
// send free message to vnode to free qhandle and corresponding resources in vnode
// send free message to vnode to free qhandle and corresponding resources in vnode
static
void
tscFreeQhandleInVnode
(
SSqlObj
*
pSql
)
{
static
bool
tscFreeQhandleInVnode
(
SSqlObj
*
pSql
)
{
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlRes
*
pRes
=
&
pSql
->
res
;
SSqlRes
*
pRes
=
&
pSql
->
res
;
...
@@ -496,10 +496,19 @@ static void tscFreeQhandleInVnode(SSqlObj* pSql) {
...
@@ -496,10 +496,19 @@ static void tscFreeQhandleInVnode(SSqlObj* pSql) {
tscProcessSql
(
pSql
);
tscProcessSql
(
pSql
);
// in case of sync model query, waits for response and then goes on
// in case of sync model query, waits for response and then goes on
if
(
pSql
->
fp
==
waitForQueryRsp
||
pSql
->
fp
==
waitForRetrieveRsp
)
{
// if (pSql->fp == waitForQueryRsp || pSql->fp == waitForRetrieveRsp) {
sem_wait
(
&
pSql
->
rspSem
);
// sem_wait(&pSql->rspSem);
}
// tscFreeSqlObj(pSql);
// tscTrace("%p sqlObj is freed by app", pSql);
// } else {
tscTrace
(
"%p sqlObj will be freed while rsp received"
,
pSql
);
// }
return
true
;
}
}
return
false
;
}
}
void
taos_free_result
(
TAOS_RES
*
res
)
{
void
taos_free_result
(
TAOS_RES
*
res
)
{
...
@@ -527,10 +536,10 @@ void taos_free_result(TAOS_RES *res) {
...
@@ -527,10 +536,10 @@ void taos_free_result(TAOS_RES *res) {
}
}
pQueryInfo
->
type
=
TSDB_QUERY_TYPE_FREE_RESOURCE
;
pQueryInfo
->
type
=
TSDB_QUERY_TYPE_FREE_RESOURCE
;
tscFreeQhandleInVnode
(
pSql
);
if
(
!
tscFreeQhandleInVnode
(
pSql
))
{
tscFreeSqlObj
(
pSql
);
tscFreeSqlObj
(
pSql
);
tscTrace
(
"%p sqlObj is freed by app"
,
pSql
);
tscTrace
(
"%p sql result is freed by app"
,
pSql
);
}
}
}
// todo should not be used in async query
// todo should not be used in async query
...
...
src/client/src/tscUtil.c
浏览文件 @
1f1ae670
...
@@ -134,24 +134,6 @@ void tscGetDBInfoFromMeterId(char* tableId, char* db) {
...
@@ -134,24 +134,6 @@ void tscGetDBInfoFromMeterId(char* tableId, char* db) {
db
[
0
]
=
0
;
db
[
0
]
=
0
;
}
}
//STableIdInfo* tscGetMeterSidInfo(SVnodeSidList* pSidList, int32_t idx) {
// if (pSidList == NULL) {
// tscError("illegal sidlist");
// return 0;
// }
//
// if (idx < 0 || idx >= pSidList->numOfSids) {
// int32_t sidRange = (pSidList->numOfSids > 0) ? (pSidList->numOfSids - 1) : 0;
//
// tscError("illegal sidIdx:%d, reset to 0, sidIdx range:%d-%d", idx, 0, sidRange);
// idx = 0;
// }
//
// assert(pSidList->pSidExtInfoList[idx] >= 0);
//
// return (STableIdInfo*)(pSidList->pSidExtInfoList[idx] + (char*)pSidList);
//}
bool
tscIsTwoStageSTableQuery
(
SQueryInfo
*
pQueryInfo
,
int32_t
tableIndex
)
{
bool
tscIsTwoStageSTableQuery
(
SQueryInfo
*
pQueryInfo
,
int32_t
tableIndex
)
{
if
(
pQueryInfo
==
NULL
)
{
if
(
pQueryInfo
==
NULL
)
{
return
false
;
return
false
;
...
@@ -176,8 +158,7 @@ bool tscIsTwoStageSTableQuery(SQueryInfo* pQueryInfo, int32_t tableIndex) {
...
@@ -176,8 +158,7 @@ bool tscIsTwoStageSTableQuery(SQueryInfo* pQueryInfo, int32_t tableIndex) {
return
false
;
return
false
;
}
}
if
(((
pQueryInfo
->
type
&
TSDB_QUERY_TYPE_STABLE_SUBQUERY
)
!=
TSDB_QUERY_TYPE_STABLE_SUBQUERY
)
&&
if
(
!
TSDB_QUERY_HAS_TYPE
(
pQueryInfo
->
type
,
TSDB_QUERY_TYPE_STABLE_SUBQUERY
)
&&
pQueryInfo
->
command
==
TSDB_SQL_SELECT
)
{
pQueryInfo
->
command
==
TSDB_SQL_SELECT
)
{
return
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
);
return
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
);
}
}
...
...
src/query/inc/tsqlfunction.h
浏览文件 @
1f1ae670
src/query/src/qExecutor.c
浏览文件 @
1f1ae670
...
@@ -4470,7 +4470,7 @@ static void multiTableQueryProcess(SQInfo *pQInfo) {
...
@@ -4470,7 +4470,7 @@ static void multiTableQueryProcess(SQInfo *pQInfo) {
// query error occurred or query is killed, abort current execution
// query error occurred or query is killed, abort current execution
if
(
pQInfo
->
code
!=
TSDB_CODE_SUCCESS
||
isQueryKilled
(
pQInfo
))
{
if
(
pQInfo
->
code
!=
TSDB_CODE_SUCCESS
||
isQueryKilled
(
pQInfo
))
{
qTrace
(
"QInfo:%p query killed or error occurred, code:%
d, abort"
,
pQInfo
,
pQInfo
->
code
);
qTrace
(
"QInfo:%p query killed or error occurred, code:%
s, abort"
,
pQInfo
,
tstrerror
(
pQInfo
->
code
)
);
return
;
return
;
}
}
...
@@ -4491,7 +4491,7 @@ static void multiTableQueryProcess(SQInfo *pQInfo) {
...
@@ -4491,7 +4491,7 @@ static void multiTableQueryProcess(SQInfo *pQInfo) {
setQueryStatus
(
pQuery
,
QUERY_COMPLETED
);
setQueryStatus
(
pQuery
,
QUERY_COMPLETED
);
if
(
pQInfo
->
code
!=
TSDB_CODE_SUCCESS
||
isQueryKilled
(
pQInfo
))
{
if
(
pQInfo
->
code
!=
TSDB_CODE_SUCCESS
||
isQueryKilled
(
pQInfo
))
{
qTrace
(
"QInfo:%p query killed or error occurred, code:%
d, abort"
,
pQInfo
,
pQInfo
->
code
);
qTrace
(
"QInfo:%p query killed or error occurred, code:%
s, abort"
,
pQInfo
,
tstrerror
(
pQInfo
->
code
)
);
return
;
return
;
}
}
...
@@ -5851,6 +5851,8 @@ void qDestroyQueryInfo(qinfo_t qHandle) {
...
@@ -5851,6 +5851,8 @@ void qDestroyQueryInfo(qinfo_t qHandle) {
}
}
int16_t
ref
=
T_REF_DEC
(
pQInfo
);
int16_t
ref
=
T_REF_DEC
(
pQInfo
);
qTrace
(
"QInfo:%p dec refCount, value:%d"
,
pQInfo
,
ref
);
if
(
ref
==
0
)
{
if
(
ref
==
0
)
{
doDestoryQueryInfo
(
pQInfo
);
doDestoryQueryInfo
(
pQInfo
);
}
}
...
...
src/rpc/src/rpcMain.c
浏览文件 @
1f1ae670
...
@@ -393,7 +393,6 @@ void rpcSendResponse(const SRpcMsg *pRsp) {
...
@@ -393,7 +393,6 @@ void rpcSendResponse(const SRpcMsg *pRsp) {
if
(
pConn
->
inType
==
0
||
pConn
->
user
[
0
]
==
0
)
{
if
(
pConn
->
inType
==
0
||
pConn
->
user
[
0
]
==
0
)
{
tTrace
(
"%s, connection is already released, rsp wont be sent"
,
pConn
->
info
);
tTrace
(
"%s, connection is already released, rsp wont be sent"
,
pConn
->
info
);
rpcUnlockConn
(
pConn
);
rpcUnlockConn
(
pConn
);
rpcDecRef
(
pRpc
);
return
;
return
;
}
}
...
...
src/tsdb/src/tsdbRead.c
浏览文件 @
1f1ae670
src/vnode/src/vnodeRead.c
浏览文件 @
1f1ae670
...
@@ -68,6 +68,7 @@ static void vnodeNotifyCurrentQhandle(void* handle, void* qhandle, int32_t vgId)
...
@@ -68,6 +68,7 @@ static void vnodeNotifyCurrentQhandle(void* handle, void* qhandle, int32_t vgId)
killQueryMsg
->
header
.
vgId
=
htonl
(
vgId
);
killQueryMsg
->
header
.
vgId
=
htonl
(
vgId
);
killQueryMsg
->
header
.
contLen
=
htonl
(
sizeof
(
SRetrieveTableMsg
));
killQueryMsg
->
header
.
contLen
=
htonl
(
sizeof
(
SRetrieveTableMsg
));
vTrace
(
"QInfo:%p register qhandle to connect:%p"
,
qhandle
,
handle
);
rpcReportProgress
(
handle
,
(
char
*
)
killQueryMsg
,
sizeof
(
SRetrieveTableMsg
));
rpcReportProgress
(
handle
,
(
char
*
)
killQueryMsg
,
sizeof
(
SRetrieveTableMsg
));
}
}
...
@@ -85,10 +86,11 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SReadMsg *pReadMsg) {
...
@@ -85,10 +86,11 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SReadMsg *pReadMsg) {
killQueryMsg
->
free
=
htons
(
killQueryMsg
->
free
);
killQueryMsg
->
free
=
htons
(
killQueryMsg
->
free
);
killQueryMsg
->
qhandle
=
htobe64
(
killQueryMsg
->
qhandle
);
killQueryMsg
->
qhandle
=
htobe64
(
killQueryMsg
->
qhandle
);
vWarn
(
"QInfo:%p connection %p broken, kill query"
,
killQueryMsg
->
qhandle
,
pReadMsg
->
rpcMsg
.
handle
);
assert
(
pReadMsg
->
rpcMsg
.
contLen
>
0
&&
killQueryMsg
->
free
==
1
);
assert
(
pReadMsg
->
rpcMsg
.
contLen
>
0
&&
killQueryMsg
->
free
==
1
);
qDestroyQueryInfo
((
qinfo_t
)
killQueryMsg
->
qhandle
);
return
TSDB_CODE_SUCCESS
;
qKillQuery
((
qinfo_t
)
killQueryMsg
->
qhandle
);
return
TSDB_CODE_TSC_QUERY_CANCELLED
;
// todo change the error code
}
}
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录