Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7729ce2e
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
7729ce2e
编写于
5月 16, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: adjust SRpcMsg
上级
fc94b71c
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
104 addition
and
173 deletion
+104
-173
include/common/tmsgcb.h
include/common/tmsgcb.h
+1
-1
source/common/src/tmsgcb.c
source/common/src/tmsgcb.c
+9
-28
source/dnode/mgmt/mgmt_bnode/src/bmWorker.c
source/dnode/mgmt/mgmt_bnode/src/bmWorker.c
+8
-13
source/dnode/mgmt/mgmt_qnode/src/qmWorker.c
source/dnode/mgmt/mgmt_qnode/src/qmWorker.c
+1
-3
source/dnode/mgmt/mgmt_snode/src/smWorker.c
source/dnode/mgmt/mgmt_snode/src/smWorker.c
+1
-3
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
+3
-9
source/dnode/mgmt/node_mgmt/src/dmTransport.c
source/dnode/mgmt/node_mgmt/src/dmTransport.c
+3
-7
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+23
-25
source/dnode/mnode/impl/src/mndTrans.c
source/dnode/mnode/impl/src/mndTrans.c
+6
-12
source/dnode/vnode/src/vnd/vnodeQuery.c
source/dnode/vnode/src/vnd/vnodeQuery.c
+1
-3
source/libs/qworker/inc/qworkerInt.h
source/libs/qworker/inc/qworkerInt.h
+12
-16
source/libs/qworker/inc/qworkerMsg.h
source/libs/qworker/inc/qworkerMsg.h
+10
-10
source/libs/qworker/src/qworker.c
source/libs/qworker/src/qworker.c
+7
-7
source/libs/qworker/src/qworkerMsg.c
source/libs/qworker/src/qworkerMsg.c
+19
-36
未找到文件。
include/common/tmsgcb.h
浏览文件 @
7729ce2e
...
...
@@ -41,7 +41,7 @@ typedef int32_t (*PutToQueueFp)(void *pMgmt, SRpcMsg* pReq);
typedef
int32_t
(
*
GetQueueSizeFp
)(
void
*
pMgmt
,
int32_t
vgId
,
EQueueType
qtype
);
typedef
int32_t
(
*
SendReqFp
)(
SMgmtWrapper
*
pWrapper
,
const
SEpSet
*
epSet
,
SRpcMsg
*
pReq
);
typedef
int32_t
(
*
SendMnodeReqFp
)(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pReq
);
typedef
void
(
*
SendRspFp
)(
SMgmtWrapper
*
pWrapper
,
const
SRpcMsg
*
pRsp
);
typedef
void
(
*
SendRspFp
)(
const
SRpcMsg
*
pRsp
);
typedef
void
(
*
SendMnodeRecvFp
)(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pReq
,
SRpcMsg
*
pRsp
);
typedef
void
(
*
SendRedirectRspFp
)(
SMgmtWrapper
*
pWrapper
,
const
SRpcMsg
*
pRsp
,
const
SEpSet
*
pNewEpSet
);
typedef
void
(
*
RegisterBrokenLinkArgFp
)(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pMsg
);
...
...
source/common/src/tmsgcb.c
浏览文件 @
7729ce2e
...
...
@@ -19,49 +19,30 @@
static
SMsgCb
tsDefaultMsgCb
;
void
tmsgSetDefaultMsgCb
(
const
SMsgCb
*
pMsgCb
)
{
// if (tsDefaultMsgCb.pWrapper == NULL) {
tsDefaultMsgCb
=
*
pMsgCb
;
//}
}
void
tmsgSetDefaultMsgCb
(
const
SMsgCb
*
pMsgCb
)
{
tsDefaultMsgCb
=
*
pMsgCb
;
}
int32_t
tmsgPutToQueue
(
const
SMsgCb
*
pMsgCb
,
EQueueType
qtype
,
SRpcMsg
*
pReq
)
{
// cannot be empty, but not checked for faster detect
PutToQueueFp
fp
=
pMsgCb
->
queueFps
[
qtype
];
if
(
fp
!=
NULL
)
{
return
(
*
fp
)(
pMsgCb
->
pMgmt
,
pReq
);
}
else
{
terrno
=
TSDB_CODE_INVALID_PTR
;
return
-
1
;
}
return
(
*
fp
)(
pMsgCb
->
pMgmt
,
pReq
);
}
int32_t
tmsgGetQueueSize
(
const
SMsgCb
*
pMsgCb
,
int32_t
vgId
,
EQueueType
qtype
)
{
// cannot be empty, but not checked for faster detect
GetQueueSizeFp
fp
=
pMsgCb
->
qsizeFp
;
if
(
fp
!=
NULL
)
{
return
(
*
fp
)(
pMsgCb
->
pMgmt
,
vgId
,
qtype
);
}
else
{
terrno
=
TSDB_CODE_INVALID_PTR
;
return
-
1
;
}
return
(
*
fp
)(
pMsgCb
->
pMgmt
,
vgId
,
qtype
);
}
int32_t
tmsgSendReq
(
const
SMsgCb
*
pMsgCb
,
const
SEpSet
*
epSet
,
SRpcMsg
*
pReq
)
{
// cannot be empty, but not checked for faster detect
SendReqFp
fp
=
pMsgCb
->
sendReqFp
;
if
(
fp
!=
NULL
)
{
return
(
*
fp
)(
pMsgCb
->
pWrapper
,
epSet
,
pReq
);
}
else
{
terrno
=
TSDB_CODE_INVALID_PTR
;
return
-
1
;
}
return
(
*
fp
)(
pMsgCb
->
pWrapper
,
epSet
,
pReq
);
}
void
tmsgSendRsp
(
SRpcMsg
*
pRsp
)
{
// cannot be empty, but not checked for faster detect
SendRspFp
fp
=
tsDefaultMsgCb
.
sendRspFp
;
if
(
fp
!=
NULL
)
{
return
(
*
fp
)(
tsDefaultMsgCb
.
pWrapper
,
pRsp
);
}
else
{
terrno
=
TSDB_CODE_INVALID_PTR
;
}
return
(
*
fp
)(
pRsp
);
}
void
tmsgSendRedirectRsp
(
SRpcMsg
*
pRsp
,
const
SEpSet
*
pNewEpSet
)
{
...
...
source/dnode/mgmt/mgmt_bnode/src/bmWorker.c
浏览文件 @
7729ce2e
...
...
@@ -17,13 +17,8 @@
#include "bmInt.h"
static
void
bmSendErrorRsp
(
SRpcMsg
*
pMsg
,
int32_t
code
)
{
SRpcMsg
rpcRsp
=
{
.
info
.
handle
=
pMsg
->
info
.
handle
,
.
info
.
ahandle
=
pMsg
->
info
.
ahandle
,
.
code
=
code
,
.
info
.
refId
=
pMsg
->
info
.
refId
,
};
tmsgSendRsp
(
&
rpcRsp
);
SRpcMsg
rsp
=
{.
code
=
code
,
.
info
=
pMsg
->
info
};
tmsgSendRsp
(
&
rsp
);
dTrace
(
"msg:%p, is freed"
,
pMsg
);
rpcFreeCont
(
pMsg
->
pCont
);
...
...
@@ -41,12 +36,12 @@ static void bmSendErrorRsps(STaosQall *qall, int32_t numOfMsgs, int32_t code) {
}
static
inline
void
bmSendRsp
(
SRpcMsg
*
pMsg
,
int32_t
code
)
{
SRpcMsg
rsp
=
{
.
info
.
handle
=
pMsg
->
info
.
handle
,
.
info
.
ahandle
=
pMsg
->
info
.
ahandl
e
,
.
info
.
refId
=
pMsg
->
info
.
refId
,
.
code
=
code
,
.
pCont
=
pMsg
->
info
.
rsp
,
.
contLen
=
pMsg
->
info
.
rspLen
,
};
SRpcMsg
rsp
=
{
.
code
=
cod
e
,
.
info
=
pMsg
->
info
,
.
pCont
=
pMsg
->
info
.
rsp
,
.
contLen
=
pMsg
->
info
.
rspLen
,
};
tmsgSendRsp
(
&
rsp
);
}
...
...
source/dnode/mgmt/mgmt_qnode/src/qmWorker.c
浏览文件 @
7729ce2e
...
...
@@ -18,10 +18,8 @@
static
inline
void
qmSendRsp
(
SRpcMsg
*
pMsg
,
int32_t
code
)
{
SRpcMsg
rsp
=
{
.
info
.
handle
=
pMsg
->
info
.
handle
,
.
info
.
ahandle
=
pMsg
->
info
.
ahandle
,
.
info
.
refId
=
pMsg
->
info
.
refId
,
.
code
=
code
,
.
info
=
pMsg
->
info
,
.
pCont
=
pMsg
->
info
.
rsp
,
.
contLen
=
pMsg
->
info
.
rspLen
,
};
...
...
source/dnode/mgmt/mgmt_snode/src/smWorker.c
浏览文件 @
7729ce2e
...
...
@@ -18,10 +18,8 @@
static
inline
void
smSendRsp
(
SRpcMsg
*
pMsg
,
int32_t
code
)
{
SRpcMsg
rsp
=
{
.
info
.
handle
=
pMsg
->
info
.
handle
,
.
info
.
ahandle
=
pMsg
->
info
.
ahandle
,
.
info
.
refId
=
pMsg
->
info
.
refId
,
.
code
=
code
,
.
info
=
pMsg
->
info
,
.
pCont
=
pMsg
->
info
.
rsp
,
.
contLen
=
pMsg
->
info
.
rspLen
,
};
...
...
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
浏览文件 @
7729ce2e
...
...
@@ -21,10 +21,8 @@
static
inline
void
vmSendRsp
(
SRpcMsg
*
pMsg
,
int32_t
code
)
{
SRpcMsg
rsp
=
{
.
info
.
handle
=
pMsg
->
info
.
handle
,
.
info
.
ahandle
=
pMsg
->
info
.
ahandle
,
.
info
.
refId
=
pMsg
->
info
.
refId
,
.
code
=
code
,
.
info
=
pMsg
->
info
,
.
pCont
=
pMsg
->
info
.
rsp
,
.
contLen
=
pMsg
->
info
.
rspLen
,
};
...
...
@@ -124,9 +122,7 @@ static void vmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
pMsg
=
*
(
SRpcMsg
**
)
taosArrayGet
(
pArray
,
i
);
pRpc
=
pMsg
;
rsp
.
info
.
ahandle
=
pRpc
->
info
.
ahandle
;
rsp
.
info
.
handle
=
pRpc
->
info
.
handle
;
rsp
.
info
.
refId
=
pRpc
->
info
.
refId
;
rsp
.
info
=
pRpc
->
info
;
rsp
.
pCont
=
NULL
;
rsp
.
contLen
=
0
;
...
...
@@ -193,9 +189,7 @@ static void vmProcessApplyQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
// if leader, send response
if
(
pMsg
->
info
.
handle
!=
NULL
&&
pMsg
->
info
.
ahandle
!=
NULL
)
{
rsp
.
info
.
ahandle
=
pMsg
->
info
.
ahandle
;
rsp
.
info
.
handle
=
pMsg
->
info
.
handle
;
rsp
.
info
.
refId
=
pMsg
->
info
.
refId
;
rsp
.
info
=
pMsg
->
info
;
tmsgSendRsp
(
&
rsp
);
}
...
...
source/dnode/mgmt/node_mgmt/src/dmTransport.c
浏览文件 @
7729ce2e
...
...
@@ -172,12 +172,7 @@ _OVER:
code
=
TSDB_CODE_NODE_REDIRECT
;
}
}
SRpcMsg
rspMsg
=
{
.
info
.
handle
=
pRpc
->
info
.
handle
,
.
code
=
code
,
.
info
.
ahandle
=
pRpc
->
info
.
ahandle
,
.
info
.
refId
=
pRpc
->
info
.
refId
,
};
SRpcMsg
rspMsg
=
{.
code
=
code
,
.
info
=
pRpc
->
info
};
tmsgSendRsp
(
&
rspMsg
);
}
...
...
@@ -282,7 +277,8 @@ static inline int32_t dmSendReq(SMgmtWrapper *pWrapper, const SEpSet *pEpSet, SR
return
0
;
}
static
inline
void
dmSendRsp
(
SMgmtWrapper
*
pWrapper
,
const
SRpcMsg
*
pRsp
)
{
static
inline
void
dmSendRsp
(
const
SRpcMsg
*
pRsp
)
{
SMgmtWrapper
*
pWrapper
=
pRsp
->
info
.
wrapper
;
if
(
InChildProc
(
pWrapper
->
proc
.
ptype
))
{
dmPutToProcPQueue
(
&
pWrapper
->
proc
,
pRsp
,
sizeof
(
SRpcMsg
),
pRsp
->
pCont
,
pRsp
->
contLen
,
DND_FUNC_RSP
);
}
else
{
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
7729ce2e
...
...
@@ -144,31 +144,29 @@ typedef enum {
}
ECsmUpdateType
;
typedef
struct
{
int32_t
id
;
ETrnStage
stage
;
ETrnPolicy
policy
;
ETrnType
type
;
int32_t
code
;
int32_t
failedTimes
;
void
*
rpcHandle
;
void
*
rpcAHandle
;
int64_t
rpcRefId
;
void
*
rpcRsp
;
int32_t
rpcRspLen
;
SArray
*
redoLogs
;
SArray
*
undoLogs
;
SArray
*
commitLogs
;
SArray
*
redoActions
;
SArray
*
undoActions
;
int64_t
createdTime
;
int64_t
lastExecTime
;
int64_t
dbUid
;
char
dbname
[
TSDB_DB_FNAME_LEN
];
char
lastError
[
TSDB_TRANS_ERROR_LEN
];
int32_t
startFunc
;
int32_t
stopFunc
;
int32_t
paramLen
;
void
*
param
;
int32_t
id
;
ETrnStage
stage
;
ETrnPolicy
policy
;
ETrnType
type
;
int32_t
code
;
int32_t
failedTimes
;
SRpcHandleInfo
rpcInfo
;
void
*
rpcRsp
;
int32_t
rpcRspLen
;
SArray
*
redoLogs
;
SArray
*
undoLogs
;
SArray
*
commitLogs
;
SArray
*
redoActions
;
SArray
*
undoActions
;
int64_t
createdTime
;
int64_t
lastExecTime
;
int64_t
dbUid
;
char
dbname
[
TSDB_DB_FNAME_LEN
];
char
lastError
[
TSDB_TRANS_ERROR_LEN
];
int32_t
startFunc
;
int32_t
stopFunc
;
int32_t
paramLen
;
void
*
param
;
}
STrans
;
typedef
struct
{
...
...
source/dnode/mnode/impl/src/mndTrans.c
浏览文件 @
7729ce2e
...
...
@@ -563,9 +563,7 @@ STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, ETrnType type, const S
pTrans
->
policy
=
policy
;
pTrans
->
type
=
type
;
pTrans
->
createdTime
=
taosGetTimestampMs
();
pTrans
->
rpcHandle
=
pReq
->
info
.
handle
;
pTrans
->
rpcAHandle
=
pReq
->
info
.
ahandle
;
pTrans
->
rpcRefId
=
pReq
->
info
.
refId
;
pTrans
->
rpcInfo
=
pReq
->
info
;
pTrans
->
redoLogs
=
taosArrayInit
(
TRANS_ARRAY_SIZE
,
sizeof
(
void
*
));
pTrans
->
undoLogs
=
taosArrayInit
(
TRANS_ARRAY_SIZE
,
sizeof
(
void
*
));
pTrans
->
commitLogs
=
taosArrayInit
(
TRANS_ARRAY_SIZE
,
sizeof
(
void
*
));
...
...
@@ -783,9 +781,7 @@ int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans) {
return
-
1
;
}
pNew
->
rpcHandle
=
pTrans
->
rpcHandle
;
pNew
->
rpcAHandle
=
pTrans
->
rpcAHandle
;
pNew
->
rpcRefId
=
pTrans
->
rpcRefId
;
pNew
->
rpcInfo
=
pTrans
->
rpcInfo
;
pNew
->
rpcRsp
=
pTrans
->
rpcRsp
;
pNew
->
rpcRspLen
=
pTrans
->
rpcRspLen
;
pTrans
->
rpcRsp
=
NULL
;
...
...
@@ -839,7 +835,7 @@ static void mndTransSendRpcRsp(SMnode *pMnode, STrans *pTrans) {
}
}
if
(
sendRsp
&&
pTrans
->
rpc
H
andle
!=
NULL
)
{
if
(
sendRsp
&&
pTrans
->
rpc
Info
.
h
andle
!=
NULL
)
{
void
*
rpcCont
=
rpcMallocCont
(
pTrans
->
rpcRspLen
);
if
(
rpcCont
!=
NULL
)
{
memcpy
(
rpcCont
,
pTrans
->
rpcRsp
,
pTrans
->
rpcRspLen
);
...
...
@@ -847,17 +843,15 @@ static void mndTransSendRpcRsp(SMnode *pMnode, STrans *pTrans) {
taosMemoryFree
(
pTrans
->
rpcRsp
);
mDebug
(
"trans:%d, send rsp, code:0x%04x stage:%d app:%p"
,
pTrans
->
id
,
code
&
0xFFFF
,
pTrans
->
stage
,
pTrans
->
rpc
AH
andle
);
pTrans
->
rpc
Info
.
ah
andle
);
SRpcMsg
rspMsg
=
{
.
info
.
handle
=
pTrans
->
rpcHandle
,
.
info
.
ahandle
=
pTrans
->
rpcAHandle
,
.
info
.
refId
=
pTrans
->
rpcRefId
,
.
info
=
pTrans
->
rpcInfo
,
.
code
=
code
,
.
pCont
=
rpcCont
,
.
contLen
=
pTrans
->
rpcRspLen
,
};
tmsgSendRsp
(
&
rspMsg
);
pTrans
->
rpc
H
andle
=
NULL
;
pTrans
->
rpc
Info
.
h
andle
=
NULL
;
pTrans
->
rpcRsp
=
NULL
;
pTrans
->
rpcRspLen
=
0
;
}
...
...
source/dnode/vnode/src/vnd/vnodeQuery.c
浏览文件 @
7729ce2e
...
...
@@ -107,9 +107,7 @@ int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg) {
tSerializeSTableMetaRsp
(
pRsp
,
rspLen
,
&
metaRsp
);
_exit:
rpcMsg
.
info
.
handle
=
pMsg
->
info
.
handle
;
rpcMsg
.
info
.
ahandle
=
pMsg
->
info
.
ahandle
;
rpcMsg
.
info
.
refId
=
pMsg
->
info
.
refId
;
rpcMsg
.
info
=
pMsg
->
info
;
rpcMsg
.
pCont
=
pRsp
;
rpcMsg
.
contLen
=
rspLen
;
rpcMsg
.
code
=
code
;
...
...
source/libs/qworker/inc/qworkerInt.h
浏览文件 @
7729ce2e
...
...
@@ -27,6 +27,8 @@ extern "C" {
#include "tref.h"
#include "plannodes.h"
#include "trpc.h"
#define QW_DEFAULT_SCHEDULER_NUMBER 10000
#define QW_DEFAULT_TASK_NUMBER 10000
#define QW_DEFAULT_SCH_TASK_NUMBER 10000
...
...
@@ -74,18 +76,12 @@ typedef struct SQWDebug {
bool
dumpEnable
;
}
SQWDebug
;
typedef
struct
SQWConnInfo
{
void
*
handle
;
void
*
ahandle
;
int64_t
refId
;
}
SQWConnInfo
;
typedef
struct
SQWMsg
{
void
*
node
;
int32_t
code
;
char
*
msg
;
int32_t
msgLen
;
S
QWConn
Info
connInfo
;
void
*
node
;
int32_t
code
;
char
*
msg
;
int32_t
msgLen
;
S
RpcHandle
Info
connInfo
;
}
SQWMsg
;
typedef
struct
SQWHbParam
{
...
...
@@ -96,7 +92,7 @@ typedef struct SQWHbParam {
typedef
struct
SQWHbInfo
{
SSchedulerHbRsp
rsp
;
S
QWConnInfo
connInfo
;
S
RpcHandleInfo
connInfo
;
}
SQWHbInfo
;
typedef
struct
SQWPhaseInput
{
...
...
@@ -127,8 +123,8 @@ typedef struct SQWTaskCtx {
bool
queryInQueue
;
int32_t
rspCode
;
S
QWConn
Info
ctrlConnInfo
;
S
QWConn
Info
dataConnInfo
;
S
RpcHandle
Info
ctrlConnInfo
;
S
RpcHandle
Info
dataConnInfo
;
int8_t
events
[
QW_EVENT_MAX
];
...
...
@@ -140,10 +136,10 @@ typedef struct SQWTaskCtx {
typedef
struct
SQWSchStatus
{
int32_t
lastAccessTs
;
// timestamp in second
SRWLatch
hbConnLock
;
S
QWConnInfo
hbConnInfo
;
S
RpcHandleInfo
hbConnInfo
;
SQueryNodeEpId
hbEpId
;
SRWLatch
tasksLock
;
SHashObj
*
tasksHash
;
// key:queryId+taskId, value: SQWTaskStatus
SHashObj
*
tasksHash
;
// key:queryId+taskId, value: SQWTaskStatus
}
SQWSchStatus
;
// Qnode/Vnode level task management
...
...
source/libs/qworker/inc/qworkerMsg.h
浏览文件 @
7729ce2e
...
...
@@ -30,21 +30,21 @@ int32_t qwProcessFetch(QW_FPARAMS_DEF, SQWMsg *qwMsg);
int32_t
qwProcessDrop
(
QW_FPARAMS_DEF
,
SQWMsg
*
qwMsg
);
int32_t
qwProcessHb
(
SQWorker
*
mgmt
,
SQWMsg
*
qwMsg
,
SSchedulerHbReq
*
req
);
int32_t
qwBuildAndSendDropRsp
(
S
QWConn
Info
*
pConn
,
int32_t
code
);
int32_t
qwBuildAndSendCancelRsp
(
S
QWConn
Info
*
pConn
,
int32_t
code
);
int32_t
qwBuildAndSendFetchRsp
(
S
QWConn
Info
*
pConn
,
SRetrieveTableRsp
*
pRsp
,
int32_t
dataLength
,
int32_t
qwBuildAndSendDropRsp
(
S
RpcHandle
Info
*
pConn
,
int32_t
code
);
int32_t
qwBuildAndSendCancelRsp
(
S
RpcHandle
Info
*
pConn
,
int32_t
code
);
int32_t
qwBuildAndSendFetchRsp
(
S
RpcHandle
Info
*
pConn
,
SRetrieveTableRsp
*
pRsp
,
int32_t
dataLength
,
int32_t
code
);
void
qwBuildFetchRsp
(
void
*
msg
,
SOutputData
*
input
,
int32_t
len
,
bool
qComplete
);
int32_t
qwBuildAndSendCQueryMsg
(
QW_FPARAMS_DEF
,
S
QWConn
Info
*
pConn
);
int32_t
qwBuildAndSendReadyRsp
(
S
QWConn
Info
*
pConn
,
int32_t
code
);
int32_t
qwBuildAndSendQueryRsp
(
S
QWConn
Info
*
pConn
,
int32_t
code
);
int32_t
qwBuildAndSendExplainRsp
(
S
QWConn
Info
*
pConn
,
SExplainExecInfo
*
execInfo
,
int32_t
num
);
int32_t
qwBuildAndSendCQueryMsg
(
QW_FPARAMS_DEF
,
S
RpcHandle
Info
*
pConn
);
int32_t
qwBuildAndSendReadyRsp
(
S
RpcHandle
Info
*
pConn
,
int32_t
code
);
int32_t
qwBuildAndSendQueryRsp
(
S
RpcHandle
Info
*
pConn
,
int32_t
code
);
int32_t
qwBuildAndSendExplainRsp
(
S
RpcHandle
Info
*
pConn
,
SExplainExecInfo
*
execInfo
,
int32_t
num
);
void
qwFreeFetchRsp
(
void
*
msg
);
int32_t
qwMallocFetchRsp
(
int32_t
length
,
SRetrieveTableRsp
**
rsp
);
int32_t
qwGetSchTasksStatus
(
SQWorker
*
mgmt
,
uint64_t
sId
,
SSchedulerStatusRsp
**
rsp
);
int32_t
qwBuildAndSendHbRsp
(
S
QWConn
Info
*
pConn
,
SSchedulerHbRsp
*
rsp
,
int32_t
code
);
int32_t
qwRegisterQueryBrokenLinkArg
(
QW_FPARAMS_DEF
,
S
QWConn
Info
*
pConn
);
int32_t
qwRegisterHbBrokenLinkArg
(
SQWorker
*
mgmt
,
uint64_t
sId
,
S
QWConn
Info
*
pConn
);
int32_t
qwBuildAndSendHbRsp
(
S
RpcHandle
Info
*
pConn
,
SSchedulerHbRsp
*
rsp
,
int32_t
code
);
int32_t
qwRegisterQueryBrokenLinkArg
(
QW_FPARAMS_DEF
,
S
RpcHandle
Info
*
pConn
);
int32_t
qwRegisterHbBrokenLinkArg
(
SQWorker
*
mgmt
,
uint64_t
sId
,
S
RpcHandle
Info
*
pConn
);
#ifdef __cplusplus
}
...
...
source/libs/qworker/src/qworker.c
浏览文件 @
7729ce2e
...
...
@@ -536,7 +536,7 @@ int32_t qwHandleTaskComplete(QW_FPARAMS_DEF, SQWTaskCtx *ctx) {
int32_t
resNum
=
0
;
QW_ERR_RET
(
qGetExplainExecInfo
(
ctx
->
taskHandle
,
&
resNum
,
&
execInfo
));
S
QWConn
Info
connInfo
=
{
0
};
S
RpcHandle
Info
connInfo
=
{
0
};
connInfo
.
handle
=
ctx
->
ctrlConnInfo
.
handle
;
connInfo
.
refId
=
ctx
->
ctrlConnInfo
.
refId
;
...
...
@@ -723,8 +723,8 @@ int32_t qwGetResFromSink(QW_FPARAMS_DEF, SQWTaskCtx *ctx, int32_t *dataLen, void
int32_t
qwHandlePrePhaseEvents
(
QW_FPARAMS_DEF
,
int8_t
phase
,
SQWPhaseInput
*
input
,
SQWPhaseOutput
*
output
)
{
int32_t
code
=
0
;
SQWTaskCtx
*
ctx
=
NULL
;
S
QWConn
Info
*
dropConnection
=
NULL
;
S
QWConn
Info
*
cancelConnection
=
NULL
;
S
RpcHandle
Info
*
dropConnection
=
NULL
;
S
RpcHandle
Info
*
cancelConnection
=
NULL
;
QW_TASK_DLOG
(
"start to handle event at phase %s"
,
qwPhaseStr
(
phase
));
...
...
@@ -842,10 +842,10 @@ _return:
}
int32_t
qwHandlePostPhaseEvents
(
QW_FPARAMS_DEF
,
int8_t
phase
,
SQWPhaseInput
*
input
,
SQWPhaseOutput
*
output
)
{
int32_t
code
=
0
;
SQWTaskCtx
*
ctx
=
NULL
;
S
QWConn
Info
connInfo
=
{
0
};
S
QWConn
Info
*
readyConnection
=
NULL
;
int32_t
code
=
0
;
SQWTaskCtx
*
ctx
=
NULL
;
S
RpcHandle
Info
connInfo
=
{
0
};
S
RpcHandle
Info
*
readyConnection
=
NULL
;
QW_TASK_DLOG
(
"start to handle event at phase %s"
,
qwPhaseStr
(
phase
));
...
...
source/libs/qworker/src/qworkerMsg.c
浏览文件 @
7729ce2e
...
...
@@ -43,7 +43,7 @@ void qwFreeFetchRsp(void *msg) {
}
}
int32_t
qwBuildAndSendQueryRsp
(
S
QWConn
Info
*
pConn
,
int32_t
code
)
{
int32_t
qwBuildAndSendQueryRsp
(
S
RpcHandle
Info
*
pConn
,
int32_t
code
)
{
SQueryTableRsp
rsp
=
{.
code
=
code
};
int32_t
contLen
=
tSerializeSQueryTableRsp
(
NULL
,
0
,
&
rsp
);
...
...
@@ -52,9 +52,7 @@ int32_t qwBuildAndSendQueryRsp(SQWConnInfo *pConn, int32_t code) {
SRpcMsg
rpcRsp
=
{
.
msgType
=
TDMT_VND_QUERY_RSP
,
.
info
.
handle
=
pConn
->
handle
,
.
info
.
ahandle
=
pConn
->
ahandle
,
.
info
.
refId
=
pConn
->
refId
,
.
info
=
pConn
,
.
pCont
=
msg
,
.
contLen
=
contLen
,
.
code
=
code
,
...
...
@@ -65,14 +63,13 @@ int32_t qwBuildAndSendQueryRsp(SQWConnInfo *pConn, int32_t code) {
return
TSDB_CODE_SUCCESS
;
}
int32_t
qwBuildAndSendReadyRsp
(
S
QWConn
Info
*
pConn
,
int32_t
code
)
{
int32_t
qwBuildAndSendReadyRsp
(
S
RpcHandle
Info
*
pConn
,
int32_t
code
)
{
SResReadyRsp
*
pRsp
=
(
SResReadyRsp
*
)
rpcMallocCont
(
sizeof
(
SResReadyRsp
));
pRsp
->
code
=
code
;
SRpcMsg
rpcRsp
=
{
.
msgType
=
TDMT_VND_RES_READY_RSP
,
.
info
.
handle
=
pConn
->
handle
,
.
info
.
refId
=
pConn
->
refId
,
.
info
=
pConn
,
.
info
.
ahandle
=
NULL
,
.
pCont
=
pRsp
,
.
contLen
=
sizeof
(
*
pRsp
),
...
...
@@ -84,7 +81,7 @@ int32_t qwBuildAndSendReadyRsp(SQWConnInfo *pConn, int32_t code) {
return
TSDB_CODE_SUCCESS
;
}
int32_t
qwBuildAndSendExplainRsp
(
S
QWConn
Info
*
pConn
,
SExplainExecInfo
*
execInfo
,
int32_t
num
)
{
int32_t
qwBuildAndSendExplainRsp
(
S
RpcHandle
Info
*
pConn
,
SExplainExecInfo
*
execInfo
,
int32_t
num
)
{
SExplainRsp
rsp
=
{.
numOfPlans
=
num
,
.
subplanInfo
=
execInfo
};
int32_t
contLen
=
tSerializeSExplainRsp
(
NULL
,
0
,
&
rsp
);
...
...
@@ -93,9 +90,7 @@ int32_t qwBuildAndSendExplainRsp(SQWConnInfo *pConn, SExplainExecInfo *execInfo,
SRpcMsg
rpcRsp
=
{
.
msgType
=
TDMT_VND_EXPLAIN_RSP
,
.
info
.
handle
=
pConn
->
handle
,
.
info
.
ahandle
=
pConn
->
ahandle
,
.
info
.
refId
=
pConn
->
refId
,
.
info
=
pConn
,
.
pCont
=
pRsp
,
.
contLen
=
contLen
,
.
code
=
0
,
...
...
@@ -106,16 +101,14 @@ int32_t qwBuildAndSendExplainRsp(SQWConnInfo *pConn, SExplainExecInfo *execInfo,
return
TSDB_CODE_SUCCESS
;
}
int32_t
qwBuildAndSendHbRsp
(
S
QWConn
Info
*
pConn
,
SSchedulerHbRsp
*
pStatus
,
int32_t
code
)
{
int32_t
qwBuildAndSendHbRsp
(
S
RpcHandle
Info
*
pConn
,
SSchedulerHbRsp
*
pStatus
,
int32_t
code
)
{
int32_t
contLen
=
tSerializeSSchedulerHbRsp
(
NULL
,
0
,
pStatus
);
void
*
pRsp
=
rpcMallocCont
(
contLen
);
tSerializeSSchedulerHbRsp
(
pRsp
,
contLen
,
pStatus
);
SRpcMsg
rpcRsp
=
{
.
msgType
=
TDMT_VND_QUERY_HEARTBEAT_RSP
,
.
info
.
handle
=
pConn
->
handle
,
.
info
.
ahandle
=
pConn
->
ahandle
,
.
info
.
refId
=
pConn
->
refId
,
.
info
=
pConn
,
.
pCont
=
pRsp
,
.
contLen
=
contLen
,
.
code
=
code
,
...
...
@@ -126,7 +119,7 @@ int32_t qwBuildAndSendHbRsp(SQWConnInfo *pConn, SSchedulerHbRsp *pStatus, int32_
return
TSDB_CODE_SUCCESS
;
}
int32_t
qwBuildAndSendFetchRsp
(
S
QWConn
Info
*
pConn
,
SRetrieveTableRsp
*
pRsp
,
int32_t
dataLength
,
int32_t
code
)
{
int32_t
qwBuildAndSendFetchRsp
(
S
RpcHandle
Info
*
pConn
,
SRetrieveTableRsp
*
pRsp
,
int32_t
dataLength
,
int32_t
code
)
{
if
(
NULL
==
pRsp
)
{
pRsp
=
(
SRetrieveTableRsp
*
)
rpcMallocCont
(
sizeof
(
SRetrieveTableRsp
));
memset
(
pRsp
,
0
,
sizeof
(
SRetrieveTableRsp
));
...
...
@@ -135,9 +128,7 @@ int32_t qwBuildAndSendFetchRsp(SQWConnInfo *pConn, SRetrieveTableRsp *pRsp, int3
SRpcMsg
rpcRsp
=
{
.
msgType
=
TDMT_VND_FETCH_RSP
,
.
info
.
handle
=
pConn
->
handle
,
.
info
.
ahandle
=
pConn
->
ahandle
,
.
info
.
refId
=
pConn
->
refId
,
.
info
=
pConn
,
.
pCont
=
pRsp
,
.
contLen
=
sizeof
(
*
pRsp
)
+
dataLength
,
.
code
=
code
,
...
...
@@ -148,15 +139,13 @@ int32_t qwBuildAndSendFetchRsp(SQWConnInfo *pConn, SRetrieveTableRsp *pRsp, int3
return
TSDB_CODE_SUCCESS
;
}
int32_t
qwBuildAndSendCancelRsp
(
S
QWConn
Info
*
pConn
,
int32_t
code
)
{
int32_t
qwBuildAndSendCancelRsp
(
S
RpcHandle
Info
*
pConn
,
int32_t
code
)
{
STaskCancelRsp
*
pRsp
=
(
STaskCancelRsp
*
)
rpcMallocCont
(
sizeof
(
STaskCancelRsp
));
pRsp
->
code
=
code
;
SRpcMsg
rpcRsp
=
{
.
msgType
=
TDMT_VND_CANCEL_TASK_RSP
,
.
info
.
handle
=
pConn
->
handle
,
.
info
.
ahandle
=
pConn
->
ahandle
,
.
info
.
refId
=
pConn
->
refId
,
.
info
=
pConn
,
.
pCont
=
pRsp
,
.
contLen
=
sizeof
(
*
pRsp
),
.
code
=
code
,
...
...
@@ -166,15 +155,13 @@ int32_t qwBuildAndSendCancelRsp(SQWConnInfo *pConn, int32_t code) {
return
TSDB_CODE_SUCCESS
;
}
int32_t
qwBuildAndSendDropRsp
(
S
QWConn
Info
*
pConn
,
int32_t
code
)
{
int32_t
qwBuildAndSendDropRsp
(
S
RpcHandle
Info
*
pConn
,
int32_t
code
)
{
STaskDropRsp
*
pRsp
=
(
STaskDropRsp
*
)
rpcMallocCont
(
sizeof
(
STaskDropRsp
));
pRsp
->
code
=
code
;
SRpcMsg
rpcRsp
=
{
.
msgType
=
TDMT_VND_DROP_TASK_RSP
,
.
info
.
handle
=
pConn
->
handle
,
.
info
.
ahandle
=
pConn
->
ahandle
,
.
info
.
refId
=
pConn
->
refId
,
.
info
=
pConn
,
.
pCont
=
pRsp
,
.
contLen
=
sizeof
(
*
pRsp
),
.
code
=
code
,
...
...
@@ -228,9 +215,7 @@ int32_t qwBuildAndSendShowRsp(SRpcMsg *pMsg, int32_t code) {
tSerializeSShowRsp
(
pBuf
,
bufLen
,
&
showRsp
);
SRpcMsg
rpcMsg
=
{
.
info
.
handle
=
pMsg
->
info
.
handle
,
.
info
.
ahandle
=
pMsg
->
info
.
ahandle
,
.
info
.
refId
=
pMsg
->
info
.
refId
,
.
info
=
pMsg
->
info
,
.
pCont
=
pBuf
,
.
contLen
=
bufLen
,
.
code
=
code
,
...
...
@@ -246,9 +231,7 @@ int32_t qwBuildAndSendShowFetchRsp(SRpcMsg *pMsg, SVShowTablesFetchReq *pFetchRe
pRsp
->
numOfRows
=
0
;
SRpcMsg
rpcMsg
=
{
.
info
.
handle
=
pMsg
->
info
.
handle
,
.
info
.
ahandle
=
pMsg
->
info
.
ahandle
,
.
info
.
refId
=
pMsg
->
info
.
refId
,
.
info
=
pMsg
->
info
,
.
pCont
=
pRsp
,
.
contLen
=
sizeof
(
*
pRsp
),
.
code
=
0
,
...
...
@@ -258,7 +241,7 @@ int32_t qwBuildAndSendShowFetchRsp(SRpcMsg *pMsg, SVShowTablesFetchReq *pFetchRe
return
TSDB_CODE_SUCCESS
;
}
int32_t
qwBuildAndSendCQueryMsg
(
QW_FPARAMS_DEF
,
S
QWConn
Info
*
pConn
)
{
int32_t
qwBuildAndSendCQueryMsg
(
QW_FPARAMS_DEF
,
S
RpcHandle
Info
*
pConn
)
{
SQueryContinueReq
*
req
=
(
SQueryContinueReq
*
)
rpcMallocCont
(
sizeof
(
SQueryContinueReq
));
if
(
NULL
==
req
)
{
QW_SCH_TASK_ELOG
(
"rpcMallocCont %d failed"
,
(
int32_t
)
sizeof
(
SQueryContinueReq
));
...
...
@@ -292,7 +275,7 @@ int32_t qwBuildAndSendCQueryMsg(QW_FPARAMS_DEF, SQWConnInfo *pConn) {
return
TSDB_CODE_SUCCESS
;
}
int32_t
qwRegisterQueryBrokenLinkArg
(
QW_FPARAMS_DEF
,
S
QWConn
Info
*
pConn
)
{
int32_t
qwRegisterQueryBrokenLinkArg
(
QW_FPARAMS_DEF
,
S
RpcHandle
Info
*
pConn
)
{
STaskDropReq
*
req
=
(
STaskDropReq
*
)
rpcMallocCont
(
sizeof
(
STaskDropReq
));
if
(
NULL
==
req
)
{
QW_SCH_TASK_ELOG
(
"rpcMallocCont %d failed"
,
(
int32_t
)
sizeof
(
STaskDropReq
));
...
...
@@ -320,7 +303,7 @@ int32_t qwRegisterQueryBrokenLinkArg(QW_FPARAMS_DEF, SQWConnInfo *pConn) {
return
TSDB_CODE_SUCCESS
;
}
int32_t
qwRegisterHbBrokenLinkArg
(
SQWorker
*
mgmt
,
uint64_t
sId
,
S
QWConn
Info
*
pConn
)
{
int32_t
qwRegisterHbBrokenLinkArg
(
SQWorker
*
mgmt
,
uint64_t
sId
,
S
RpcHandle
Info
*
pConn
)
{
SSchedulerHbReq
req
=
{
0
};
req
.
header
.
vgId
=
mgmt
->
nodeId
;
req
.
sId
=
sId
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录