Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
cac83334
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看板
未验证
提交
cac83334
编写于
3月 17, 2021
作者:
H
haojun Liao
提交者:
GitHub
3月 17, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5426 from taosdata/hotfix/TD-3030
[TD-3030]two queries use one query info issue
上级
57eb2da6
a4b97eec
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
36 addition
and
25 deletion
+36
-25
src/client/src/tscServer.c
src/client/src/tscServer.c
+3
-3
src/inc/query.h
src/inc/query.h
+3
-2
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+2
-1
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+11
-2
src/query/src/queryMain.c
src/query/src/queryMain.c
+4
-5
src/vnode/src/vnodeRead.c
src/vnode/src/vnodeRead.c
+13
-12
未找到文件。
src/client/src/tscServer.c
浏览文件 @
cac83334
...
@@ -520,7 +520,7 @@ int tscBuildFetchMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -520,7 +520,7 @@ int tscBuildFetchMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
assert
(
pVgroupInfo
->
vgroups
[
vgIndex
].
vgId
>
0
&&
vgIndex
<
pTableMetaInfo
->
vgroupList
->
numOfVgroups
);
assert
(
pVgroupInfo
->
vgroups
[
vgIndex
].
vgId
>
0
&&
vgIndex
<
pTableMetaInfo
->
vgroupList
->
numOfVgroups
);
pRetrieveMsg
->
header
.
vgId
=
htonl
(
pVgroupInfo
->
vgroups
[
vgIndex
].
vgId
);
pRetrieveMsg
->
header
.
vgId
=
htonl
(
pVgroupInfo
->
vgroups
[
vgIndex
].
vgId
);
tscDebug
(
"%p build fetch msg from vgId:%d, vgIndex:%d
"
,
pSql
,
pVgroupInfo
->
vgroups
[
vgIndex
].
vgId
,
vgIndex
);
tscDebug
(
"%p build fetch msg from vgId:%d, vgIndex:%d
, qhandle:%"
PRIX64
,
pSql
,
pVgroupInfo
->
vgroups
[
vgIndex
].
vgId
,
vgIndex
,
pSql
->
res
.
qhandle
);
}
else
{
}
else
{
int32_t
numOfVgroups
=
(
int32_t
)
taosArrayGetSize
(
pTableMetaInfo
->
pVgroupTables
);
int32_t
numOfVgroups
=
(
int32_t
)
taosArrayGetSize
(
pTableMetaInfo
->
pVgroupTables
);
assert
(
vgIndex
>=
0
&&
vgIndex
<
numOfVgroups
);
assert
(
vgIndex
>=
0
&&
vgIndex
<
numOfVgroups
);
...
@@ -528,12 +528,12 @@ int tscBuildFetchMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -528,12 +528,12 @@ int tscBuildFetchMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
SVgroupTableInfo
*
pTableIdList
=
taosArrayGet
(
pTableMetaInfo
->
pVgroupTables
,
vgIndex
);
SVgroupTableInfo
*
pTableIdList
=
taosArrayGet
(
pTableMetaInfo
->
pVgroupTables
,
vgIndex
);
pRetrieveMsg
->
header
.
vgId
=
htonl
(
pTableIdList
->
vgInfo
.
vgId
);
pRetrieveMsg
->
header
.
vgId
=
htonl
(
pTableIdList
->
vgInfo
.
vgId
);
tscDebug
(
"%p build fetch msg from vgId:%d, vgIndex:%d
"
,
pSql
,
pTableIdList
->
vgInfo
.
vgId
,
vgIndex
);
tscDebug
(
"%p build fetch msg from vgId:%d, vgIndex:%d
, qhandle:%"
PRIX64
,
pSql
,
pTableIdList
->
vgInfo
.
vgId
,
vgIndex
,
pSql
->
res
.
qhandle
);
}
}
}
else
{
}
else
{
STableMeta
*
pTableMeta
=
pTableMetaInfo
->
pTableMeta
;
STableMeta
*
pTableMeta
=
pTableMetaInfo
->
pTableMeta
;
pRetrieveMsg
->
header
.
vgId
=
htonl
(
pTableMeta
->
vgId
);
pRetrieveMsg
->
header
.
vgId
=
htonl
(
pTableMeta
->
vgId
);
tscDebug
(
"%p build fetch msg from only one vgroup, vgId:%d
"
,
pSql
,
pTableMeta
->
vgId
);
tscDebug
(
"%p build fetch msg from only one vgroup, vgId:%d
, qhandle:%"
PRIX64
,
pSql
,
pTableMeta
->
vgId
,
pSql
->
res
.
qhandle
);
}
}
pSql
->
cmd
.
payloadLen
=
sizeof
(
SRetrieveTableMsg
);
pSql
->
cmd
.
payloadLen
=
sizeof
(
SRetrieveTableMsg
);
...
...
src/inc/query.h
浏览文件 @
cac83334
...
@@ -28,7 +28,7 @@ typedef void* qinfo_t;
...
@@ -28,7 +28,7 @@ typedef void* qinfo_t;
* @param qinfo
* @param qinfo
* @return
* @return
*/
*/
int32_t
qCreateQueryInfo
(
void
*
tsdb
,
int32_t
vgId
,
SQueryTableMsg
*
pQueryTableMsg
,
qinfo_t
*
qinfo
);
int32_t
qCreateQueryInfo
(
void
*
tsdb
,
int32_t
vgId
,
SQueryTableMsg
*
pQueryTableMsg
,
qinfo_t
*
qinfo
,
uint64_t
*
qId
);
/**
/**
...
@@ -88,9 +88,10 @@ void* qOpenQueryMgmt(int32_t vgId);
...
@@ -88,9 +88,10 @@ void* qOpenQueryMgmt(int32_t vgId);
void
qQueryMgmtNotifyClosed
(
void
*
pExecutor
);
void
qQueryMgmtNotifyClosed
(
void
*
pExecutor
);
void
qQueryMgmtReOpen
(
void
*
pExecutor
);
void
qQueryMgmtReOpen
(
void
*
pExecutor
);
void
qCleanupQueryMgmt
(
void
*
pExecutor
);
void
qCleanupQueryMgmt
(
void
*
pExecutor
);
void
**
qRegisterQInfo
(
void
*
pMgmt
,
uint64_t
qInfo
);
void
**
qRegisterQInfo
(
void
*
pMgmt
,
uint64_t
qI
d
,
uint64_t
qI
nfo
);
void
**
qAcquireQInfo
(
void
*
pMgmt
,
uint64_t
key
);
void
**
qAcquireQInfo
(
void
*
pMgmt
,
uint64_t
key
);
void
**
qReleaseQInfo
(
void
*
pMgmt
,
void
*
pQInfo
,
bool
freeHandle
);
void
**
qReleaseQInfo
(
void
*
pMgmt
,
void
*
pQInfo
,
bool
freeHandle
);
bool
checkQIdEqual
(
void
*
qHandle
,
uint64_t
qId
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
src/query/inc/qExecutor.h
浏览文件 @
cac83334
...
@@ -308,6 +308,7 @@ enum {
...
@@ -308,6 +308,7 @@ enum {
typedef
struct
SQInfo
{
typedef
struct
SQInfo
{
void
*
signature
;
void
*
signature
;
uint64_t
qId
;
int32_t
code
;
// error code to returned to client
int32_t
code
;
// error code to returned to client
int64_t
owner
;
// if it is in execution
int64_t
owner
;
// if it is in execution
...
@@ -429,7 +430,7 @@ int32_t createIndirectQueryFuncExprFromMsg(SQueryTableMsg *pQueryMsg, int32_t nu
...
@@ -429,7 +430,7 @@ int32_t createIndirectQueryFuncExprFromMsg(SQueryTableMsg *pQueryMsg, int32_t nu
SSqlGroupbyExpr
*
createGroupbyExprFromMsg
(
SQueryTableMsg
*
pQueryMsg
,
SColIndex
*
pColIndex
,
int32_t
*
code
);
SSqlGroupbyExpr
*
createGroupbyExprFromMsg
(
SQueryTableMsg
*
pQueryMsg
,
SColIndex
*
pColIndex
,
int32_t
*
code
);
SQInfo
*
createQInfoImpl
(
SQueryTableMsg
*
pQueryMsg
,
SSqlGroupbyExpr
*
pGroupbyExpr
,
SExprInfo
*
pExprs
,
SQInfo
*
createQInfoImpl
(
SQueryTableMsg
*
pQueryMsg
,
SSqlGroupbyExpr
*
pGroupbyExpr
,
SExprInfo
*
pExprs
,
SExprInfo
*
pSecExprs
,
STableGroupInfo
*
pTableGroupInfo
,
SColumnInfo
*
pTagCols
,
bool
stableQuery
,
char
*
sql
);
SExprInfo
*
pSecExprs
,
STableGroupInfo
*
pTableGroupInfo
,
SColumnInfo
*
pTagCols
,
bool
stableQuery
,
char
*
sql
,
uint64_t
*
qId
);
int32_t
initQInfo
(
SQueryTableMsg
*
pQueryMsg
,
void
*
tsdb
,
int32_t
vgId
,
SQInfo
*
pQInfo
,
SQueryParam
*
param
,
bool
isSTable
);
int32_t
initQInfo
(
SQueryTableMsg
*
pQueryMsg
,
void
*
tsdb
,
int32_t
vgId
,
SQInfo
*
pQInfo
,
SQueryParam
*
param
,
bool
isSTable
);
void
freeColumnFilterInfo
(
SColumnFilterInfo
*
pFilter
,
int32_t
numOfFilters
);
void
freeColumnFilterInfo
(
SColumnFilterInfo
*
pFilter
,
int32_t
numOfFilters
);
...
...
src/query/src/qExecutor.c
浏览文件 @
cac83334
...
@@ -98,6 +98,9 @@ static UNUSED_FUNC void* u_realloc(void* p, size_t __size) {
...
@@ -98,6 +98,9 @@ static UNUSED_FUNC void* u_realloc(void* p, size_t __size) {
#define GET_NUM_OF_TABLEGROUP(q) taosArrayGetSize((q)->tableqinfoGroupInfo.pGroupList)
#define GET_NUM_OF_TABLEGROUP(q) taosArrayGetSize((q)->tableqinfoGroupInfo.pGroupList)
#define QUERY_IS_INTERVAL_QUERY(_q) ((_q)->interval.interval > 0)
#define QUERY_IS_INTERVAL_QUERY(_q) ((_q)->interval.interval > 0)
uint64_t
queryHandleId
=
0
;
int32_t
getMaximumIdleDurationSec
()
{
int32_t
getMaximumIdleDurationSec
()
{
return
tsShellActivityTimer
*
2
;
return
tsShellActivityTimer
*
2
;
}
}
...
@@ -6111,9 +6114,13 @@ void setResultBufSize(SQuery* pQuery, SRspResultInfo* pResultInfo) {
...
@@ -6111,9 +6114,13 @@ void setResultBufSize(SQuery* pQuery, SRspResultInfo* pResultInfo) {
pResultInfo
->
total
=
0
;
pResultInfo
->
total
=
0
;
}
}
FORCE_INLINE
bool
checkQIdEqual
(
void
*
qHandle
,
uint64_t
qId
)
{
return
((
SQInfo
*
)
qHandle
)
->
qId
==
qId
;
}
SQInfo
*
createQInfoImpl
(
SQueryTableMsg
*
pQueryMsg
,
SSqlGroupbyExpr
*
pGroupbyExpr
,
SExprInfo
*
pExprs
,
SQInfo
*
createQInfoImpl
(
SQueryTableMsg
*
pQueryMsg
,
SSqlGroupbyExpr
*
pGroupbyExpr
,
SExprInfo
*
pExprs
,
SExprInfo
*
pSecExprs
,
STableGroupInfo
*
pTableGroupInfo
,
SColumnInfo
*
pTagCols
,
bool
stableQuery
,
SExprInfo
*
pSecExprs
,
STableGroupInfo
*
pTableGroupInfo
,
SColumnInfo
*
pTagCols
,
bool
stableQuery
,
char
*
sql
)
{
char
*
sql
,
uint64_t
*
qId
)
{
int16_t
numOfCols
=
pQueryMsg
->
numOfCols
;
int16_t
numOfCols
=
pQueryMsg
->
numOfCols
;
int16_t
numOfOutput
=
pQueryMsg
->
numOfOutput
;
int16_t
numOfOutput
=
pQueryMsg
->
numOfOutput
;
...
@@ -6254,7 +6261,9 @@ SQInfo* createQInfoImpl(SQueryTableMsg* pQueryMsg, SSqlGroupbyExpr* pGroupbyExpr
...
@@ -6254,7 +6261,9 @@ SQInfo* createQInfoImpl(SQueryTableMsg* pQueryMsg, SSqlGroupbyExpr* pGroupbyExpr
// todo refactor
// todo refactor
pQInfo
->
query
.
queryBlockDist
=
(
numOfOutput
==
1
&&
pExprs
[
0
].
base
.
colInfo
.
colId
==
TSDB_BLOCK_DIST_COLUMN_INDEX
);
pQInfo
->
query
.
queryBlockDist
=
(
numOfOutput
==
1
&&
pExprs
[
0
].
base
.
colInfo
.
colId
==
TSDB_BLOCK_DIST_COLUMN_INDEX
);
qDebug
(
"qmsg:%p QInfo:%p created"
,
pQueryMsg
,
pQInfo
);
pQInfo
->
qId
=
atomic_add_fetch_64
(
&
queryHandleId
,
1
);
*
qId
=
pQInfo
->
qId
;
qDebug
(
"qmsg:%p QInfo:%"
PRIu64
"-%p created"
,
pQueryMsg
,
pQInfo
->
qId
,
pQInfo
);
return
pQInfo
;
return
pQInfo
;
_cleanup_qinfo:
_cleanup_qinfo:
...
...
src/query/src/queryMain.c
浏览文件 @
cac83334
...
@@ -68,7 +68,7 @@ void freeParam(SQueryParam *param) {
...
@@ -68,7 +68,7 @@ void freeParam(SQueryParam *param) {
tfree
(
param
->
prevResult
);
tfree
(
param
->
prevResult
);
}
}
int32_t
qCreateQueryInfo
(
void
*
tsdb
,
int32_t
vgId
,
SQueryTableMsg
*
pQueryMsg
,
qinfo_t
*
pQInfo
)
{
int32_t
qCreateQueryInfo
(
void
*
tsdb
,
int32_t
vgId
,
SQueryTableMsg
*
pQueryMsg
,
qinfo_t
*
pQInfo
,
uint64_t
*
qId
)
{
assert
(
pQueryMsg
!=
NULL
&&
tsdb
!=
NULL
);
assert
(
pQueryMsg
!=
NULL
&&
tsdb
!=
NULL
);
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
...
@@ -158,7 +158,7 @@ int32_t qCreateQueryInfo(void* tsdb, int32_t vgId, SQueryTableMsg* pQueryMsg, qi
...
@@ -158,7 +158,7 @@ int32_t qCreateQueryInfo(void* tsdb, int32_t vgId, SQueryTableMsg* pQueryMsg, qi
goto
_over
;
goto
_over
;
}
}
(
*
pQInfo
)
=
createQInfoImpl
(
pQueryMsg
,
param
.
pGroupbyExpr
,
param
.
pExprs
,
param
.
pSecExprs
,
&
tableGroupInfo
,
param
.
pTagColumnInfo
,
isSTableQuery
,
param
.
sql
);
(
*
pQInfo
)
=
createQInfoImpl
(
pQueryMsg
,
param
.
pGroupbyExpr
,
param
.
pExprs
,
param
.
pSecExprs
,
&
tableGroupInfo
,
param
.
pTagColumnInfo
,
isSTableQuery
,
param
.
sql
,
qId
);
param
.
sql
=
NULL
;
param
.
sql
=
NULL
;
param
.
pExprs
=
NULL
;
param
.
pExprs
=
NULL
;
...
@@ -472,7 +472,7 @@ void qCleanupQueryMgmt(void* pQMgmt) {
...
@@ -472,7 +472,7 @@ void qCleanupQueryMgmt(void* pQMgmt) {
qDebug
(
"vgId:%d, queryMgmt cleanup completed"
,
vgId
);
qDebug
(
"vgId:%d, queryMgmt cleanup completed"
,
vgId
);
}
}
void
**
qRegisterQInfo
(
void
*
pMgmt
,
uint64_t
qInfo
)
{
void
**
qRegisterQInfo
(
void
*
pMgmt
,
uint64_t
qI
d
,
uint64_t
qI
nfo
)
{
if
(
pMgmt
==
NULL
)
{
if
(
pMgmt
==
NULL
)
{
terrno
=
TSDB_CODE_VND_INVALID_VGROUP_ID
;
terrno
=
TSDB_CODE_VND_INVALID_VGROUP_ID
;
return
NULL
;
return
NULL
;
...
@@ -492,8 +492,7 @@ void** qRegisterQInfo(void* pMgmt, uint64_t qInfo) {
...
@@ -492,8 +492,7 @@ void** qRegisterQInfo(void* pMgmt, uint64_t qInfo) {
terrno
=
TSDB_CODE_VND_INVALID_VGROUP_ID
;
terrno
=
TSDB_CODE_VND_INVALID_VGROUP_ID
;
return
NULL
;
return
NULL
;
}
else
{
}
else
{
TSDB_CACHE_PTR_TYPE
handleVal
=
(
TSDB_CACHE_PTR_TYPE
)
qInfo
;
void
**
handle
=
taosCachePut
(
pQueryMgmt
->
qinfoPool
,
&
qId
,
sizeof
(
qId
),
&
qInfo
,
sizeof
(
TSDB_CACHE_PTR_TYPE
),
void
**
handle
=
taosCachePut
(
pQueryMgmt
->
qinfoPool
,
&
handleVal
,
sizeof
(
TSDB_CACHE_PTR_TYPE
),
&
qInfo
,
sizeof
(
TSDB_CACHE_PTR_TYPE
),
(
getMaximumIdleDurationSec
()
*
1000
));
(
getMaximumIdleDurationSec
()
*
1000
));
pthread_mutex_unlock
(
&
pQueryMgmt
->
lock
);
pthread_mutex_unlock
(
&
pQueryMgmt
->
lock
);
...
...
src/vnode/src/vnodeRead.c
浏览文件 @
cac83334
...
@@ -247,7 +247,8 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
...
@@ -247,7 +247,8 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
if
(
contLen
!=
0
)
{
if
(
contLen
!=
0
)
{
qinfo_t
pQInfo
=
NULL
;
qinfo_t
pQInfo
=
NULL
;
code
=
qCreateQueryInfo
(
pVnode
->
tsdb
,
pVnode
->
vgId
,
pQueryTableMsg
,
&
pQInfo
);
uint64_t
qId
=
0
;
code
=
qCreateQueryInfo
(
pVnode
->
tsdb
,
pVnode
->
vgId
,
pQueryTableMsg
,
&
pQInfo
,
&
qId
);
SQueryTableRsp
*
pRsp
=
(
SQueryTableRsp
*
)
rpcMallocCont
(
sizeof
(
SQueryTableRsp
));
SQueryTableRsp
*
pRsp
=
(
SQueryTableRsp
*
)
rpcMallocCont
(
sizeof
(
SQueryTableRsp
));
pRsp
->
code
=
code
;
pRsp
->
code
=
code
;
...
@@ -259,22 +260,22 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
...
@@ -259,22 +260,22 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
// current connect is broken
// current connect is broken
if
(
code
==
TSDB_CODE_SUCCESS
)
{
if
(
code
==
TSDB_CODE_SUCCESS
)
{
handle
=
qRegisterQInfo
(
pVnode
->
qMgmt
,
(
uint64_t
)
pQInfo
);
handle
=
qRegisterQInfo
(
pVnode
->
qMgmt
,
qId
,
(
uint64_t
)
pQInfo
);
if
(
handle
==
NULL
)
{
// failed to register qhandle
if
(
handle
==
NULL
)
{
// failed to register qhandle
pRsp
->
code
=
terrno
;
pRsp
->
code
=
terrno
;
terrno
=
0
;
terrno
=
0
;
vError
(
"vgId:%d, QInfo:%
p register qhandle failed, return to app, code:%s"
,
pVnode
->
vg
Id
,
(
void
*
)
pQInfo
,
vError
(
"vgId:%d, QInfo:%
"
PRIu64
"-%p register qhandle failed, return to app, code:%s"
,
pVnode
->
vgId
,
q
Id
,
(
void
*
)
pQInfo
,
tstrerror
(
pRsp
->
code
));
tstrerror
(
pRsp
->
code
));
qDestroyQueryInfo
(
pQInfo
);
// destroy it directly
qDestroyQueryInfo
(
pQInfo
);
// destroy it directly
return
pRsp
->
code
;
return
pRsp
->
code
;
}
else
{
}
else
{
assert
(
*
handle
==
pQInfo
);
assert
(
*
handle
==
pQInfo
);
pRsp
->
qhandle
=
htobe64
(
(
uint64_t
)
pQInfo
);
pRsp
->
qhandle
=
htobe64
(
qId
);
}
}
if
(
handle
!=
NULL
&&
if
(
handle
!=
NULL
&&
vnodeNotifyCurrentQhandle
(
pRead
->
rpcHandle
,
*
handle
,
pVnode
->
vgId
)
!=
TSDB_CODE_SUCCESS
)
{
vnodeNotifyCurrentQhandle
(
pRead
->
rpcHandle
,
*
handle
,
pVnode
->
vgId
)
!=
TSDB_CODE_SUCCESS
)
{
vError
(
"vgId:%d, QInfo:%
p, query discarded since link is broken, %p"
,
pVnode
->
vg
Id
,
*
handle
,
vError
(
"vgId:%d, QInfo:%
"
PRIu64
"-%p, query discarded since link is broken, %p"
,
pVnode
->
vgId
,
q
Id
,
*
handle
,
pRead
->
rpcHandle
);
pRead
->
rpcHandle
);
pRsp
->
code
=
TSDB_CODE_RPC_NETWORK_UNAVAIL
;
pRsp
->
code
=
TSDB_CODE_RPC_NETWORK_UNAVAIL
;
qReleaseQInfo
(
pVnode
->
qMgmt
,
(
void
**
)
&
handle
,
true
);
qReleaseQInfo
(
pVnode
->
qMgmt
,
(
void
**
)
&
handle
,
true
);
...
@@ -285,7 +286,7 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
...
@@ -285,7 +286,7 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
}
}
if
(
handle
!=
NULL
)
{
if
(
handle
!=
NULL
)
{
vTrace
(
"vgId:%d, QInfo:%
p, dnode query msg disposed, create qhandle and returns to app"
,
vg
Id
,
*
handle
);
vTrace
(
"vgId:%d, QInfo:%
"
PRIu64
"-%p, dnode query msg disposed, create qhandle and returns to app"
,
vgId
,
q
Id
,
*
handle
);
code
=
vnodePutItemIntoReadQueue
(
pVnode
,
handle
,
pRead
->
rpcHandle
);
code
=
vnodePutItemIntoReadQueue
(
pVnode
,
handle
,
pRead
->
rpcHandle
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
pRsp
->
code
=
code
;
pRsp
->
code
=
code
;
...
@@ -349,7 +350,7 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
...
@@ -349,7 +350,7 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
pRetrieve
->
free
=
htons
(
pRetrieve
->
free
);
pRetrieve
->
free
=
htons
(
pRetrieve
->
free
);
pRetrieve
->
qhandle
=
htobe64
(
pRetrieve
->
qhandle
);
pRetrieve
->
qhandle
=
htobe64
(
pRetrieve
->
qhandle
);
vTrace
(
"vgId:%d, QInfo:%
p, retrieve msg is disposed, free:%d, conn:%p"
,
pVnode
->
vgId
,
(
void
*
)
pRetrieve
->
qhandle
,
vTrace
(
"vgId:%d, QInfo:%
"
PRIu64
", retrieve msg is disposed, free:%d, conn:%p"
,
pVnode
->
vgId
,
pRetrieve
->
qhandle
,
pRetrieve
->
free
,
pRead
->
rpcHandle
);
pRetrieve
->
free
,
pRead
->
rpcHandle
);
memset
(
pRet
,
0
,
sizeof
(
SRspRet
));
memset
(
pRet
,
0
,
sizeof
(
SRspRet
));
...
@@ -360,19 +361,19 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
...
@@ -360,19 +361,19 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
if
(
handle
==
NULL
)
{
if
(
handle
==
NULL
)
{
code
=
terrno
;
code
=
terrno
;
terrno
=
TSDB_CODE_SUCCESS
;
terrno
=
TSDB_CODE_SUCCESS
;
}
else
if
(
(
*
handle
)
!=
(
void
*
)
pRetrieve
->
qhandle
)
{
}
else
if
(
!
checkQIdEqual
(
*
handle
,
pRetrieve
->
qhandle
)
)
{
code
=
TSDB_CODE_QRY_INVALID_QHANDLE
;
code
=
TSDB_CODE_QRY_INVALID_QHANDLE
;
}
}
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
vError
(
"vgId:%d, invalid handle in retrieving result, code:%s, QInfo:%
p"
,
pVnode
->
vgId
,
tstrerror
(
code
),
(
void
*
)
pRetrieve
->
qhandle
);
vError
(
"vgId:%d, invalid handle in retrieving result, code:%s, QInfo:%
"
PRIu64
,
pVnode
->
vgId
,
tstrerror
(
code
),
pRetrieve
->
qhandle
);
vnodeBuildNoResultQueryRsp
(
pRet
);
vnodeBuildNoResultQueryRsp
(
pRet
);
return
code
;
return
code
;
}
}
// kill current query and free corresponding resources.
// kill current query and free corresponding resources.
if
(
pRetrieve
->
free
==
1
)
{
if
(
pRetrieve
->
free
==
1
)
{
v
Debug
(
"vgId:%d, QInfo:%p, retrieve msg received to kill query and free qhandle"
,
pVnode
->
vgId
,
*
handle
);
v
Warn
(
"vgId:%d, QInfo:%"
PRIu64
"-%p, retrieve msg received to kill query and free qhandle"
,
pVnode
->
vgId
,
pRetrieve
->
qhandle
,
*
handle
);
qKillQuery
(
*
handle
);
qKillQuery
(
*
handle
);
qReleaseQInfo
(
pVnode
->
qMgmt
,
(
void
**
)
&
handle
,
true
);
qReleaseQInfo
(
pVnode
->
qMgmt
,
(
void
**
)
&
handle
,
true
);
...
@@ -383,7 +384,7 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
...
@@ -383,7 +384,7 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
// register the qhandle to connect to quit query immediate if connection is broken
// register the qhandle to connect to quit query immediate if connection is broken
if
(
vnodeNotifyCurrentQhandle
(
pRead
->
rpcHandle
,
*
handle
,
pVnode
->
vgId
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
vnodeNotifyCurrentQhandle
(
pRead
->
rpcHandle
,
*
handle
,
pVnode
->
vgId
)
!=
TSDB_CODE_SUCCESS
)
{
vError
(
"vgId:%d, QInfo:%
p, retrieve discarded since link is broken, %p"
,
pVnode
->
vgId
,
*
handle
,
pRead
->
rpcHandle
);
vError
(
"vgId:%d, QInfo:%
"
PRIu64
"-%p, retrieve discarded since link is broken, %p"
,
pVnode
->
vgId
,
pRetrieve
->
qhandle
,
*
handle
,
pRead
->
rpcHandle
);
code
=
TSDB_CODE_RPC_NETWORK_UNAVAIL
;
code
=
TSDB_CODE_RPC_NETWORK_UNAVAIL
;
qKillQuery
(
*
handle
);
qKillQuery
(
*
handle
);
qReleaseQInfo
(
pVnode
->
qMgmt
,
(
void
**
)
&
handle
,
true
);
qReleaseQInfo
(
pVnode
->
qMgmt
,
(
void
**
)
&
handle
,
true
);
...
@@ -441,4 +442,4 @@ void vnodeWaitReadCompleted(SVnodeObj *pVnode) {
...
@@ -441,4 +442,4 @@ void vnodeWaitReadCompleted(SVnodeObj *pVnode) {
vTrace
(
"vgId:%d, queued rmsg num:%d"
,
pVnode
->
vgId
,
pVnode
->
queuedRMsg
);
vTrace
(
"vgId:%d, queued rmsg num:%d"
,
pVnode
->
vgId
,
pVnode
->
queuedRMsg
);
taosMsleep
(
10
);
taosMsleep
(
10
);
}
}
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录