提交 fefd2506 编写于 作者: dengyihao's avatar dengyihao

fix rpc bug

上级 124b8b66
......@@ -275,7 +275,7 @@ static void dmCloseNodes(SDnode *pDnode) {
static void dmProcessProcHandle(void *handle) {
dWarn("handle:%p, the child process dies and send an offline rsp", handle);
SRpcMsg rpcMsg = {.handle = handle, .code = TSDB_CODE_NODE_OFFLINE, .refId = -1};
SRpcMsg rpcMsg = {.handle = handle, .code = TSDB_CODE_NODE_OFFLINE};
rpcSendResponse(&rpcMsg);
}
......
......@@ -38,6 +38,7 @@ static void bmSendErrorRsps(STaosQall *qall, int32_t numOfMsgs, int32_t code) {
static inline void bmSendRsp(SNodeMsg *pMsg, int32_t code) {
SRpcMsg rsp = {.handle = pMsg->rpcMsg.handle,
.ahandle = pMsg->rpcMsg.ahandle,
.refId = pMsg->rpcMsg.refId,
.code = code,
.pCont = pMsg->pRsp,
.contLen = pMsg->rspLen};
......@@ -101,7 +102,7 @@ static void bmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
}
int32_t bmProcessWriteMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
SBnodeMgmt *pMgmt = pWrapper->pMgmt;
SBnodeMgmt * pMgmt = pWrapper->pMgmt;
SMultiWorker *pWorker = &pMgmt->writeWorker;
dTrace("msg:%p, put into worker:%s", pMsg, pWorker->name);
......@@ -110,7 +111,7 @@ int32_t bmProcessWriteMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
}
int32_t bmProcessMonitorMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
SBnodeMgmt *pMgmt = pWrapper->pMgmt;
SBnodeMgmt * pMgmt = pWrapper->pMgmt;
SSingleWorker *pWorker = &pMgmt->monitorWorker;
dTrace("msg:%p, put into worker:%s", pMsg, pWorker->name);
......
......@@ -19,6 +19,7 @@
static inline void mmSendRsp(SNodeMsg *pMsg, int32_t code) {
SRpcMsg rsp = {.handle = pMsg->rpcMsg.handle,
.ahandle = pMsg->rpcMsg.ahandle,
.refId = pMsg->rpcMsg.refId,
.code = code,
.pCont = pMsg->pRsp,
.contLen = pMsg->rspLen};
......
......@@ -19,6 +19,7 @@
static inline void qmSendRsp(SNodeMsg *pMsg, int32_t code) {
SRpcMsg rsp = {.handle = pMsg->rpcMsg.handle,
.ahandle = pMsg->rpcMsg.ahandle,
.refId = pMsg->rpcMsg.refId,
.code = code,
.pCont = pMsg->pRsp,
.contLen = pMsg->rspLen};
......
......@@ -19,6 +19,7 @@
static inline void smSendRsp(SNodeMsg *pMsg, int32_t code) {
SRpcMsg rsp = {.handle = pMsg->rpcMsg.handle,
.ahandle = pMsg->rpcMsg.ahandle,
.refId = pMsg->rpcMsg.refId,
.code = code,
.pCont = pMsg->pRsp,
.contLen = pMsg->rspLen};
......@@ -149,7 +150,7 @@ static FORCE_INLINE int32_t smGetSWTypeFromMsg(SRpcMsg *pMsg) {
}
int32_t smProcessMgmtMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
SSnodeMgmt *pMgmt = pWrapper->pMgmt;
SSnodeMgmt * pMgmt = pWrapper->pMgmt;
SMultiWorker *pWorker = taosArrayGetP(pMgmt->uniqueWorkers, 0);
if (pWorker == NULL) {
terrno = TSDB_CODE_INVALID_MSG;
......@@ -162,7 +163,7 @@ int32_t smProcessMgmtMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
}
int32_t smProcessMonitorMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
SSnodeMgmt *pMgmt = pWrapper->pMgmt;
SSnodeMgmt * pMgmt = pWrapper->pMgmt;
SSingleWorker *pWorker = &pMgmt->monitorWorker;
dTrace("msg:%p, put into worker:%s", pMsg, pWorker->name);
......@@ -171,7 +172,7 @@ int32_t smProcessMonitorMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
}
int32_t smProcessUniqueMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
SSnodeMgmt *pMgmt = pWrapper->pMgmt;
SSnodeMgmt * pMgmt = pWrapper->pMgmt;
int32_t index = smGetSWIdFromMsg(&pMsg->rpcMsg);
SMultiWorker *pWorker = taosArrayGetP(pMgmt->uniqueWorkers, index);
if (pWorker == NULL) {
......@@ -185,7 +186,7 @@ int32_t smProcessUniqueMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
}
int32_t smProcessSharedMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
SSnodeMgmt *pMgmt = pWrapper->pMgmt;
SSnodeMgmt * pMgmt = pWrapper->pMgmt;
SSingleWorker *pWorker = &pMgmt->sharedWorker;
dTrace("msg:%p, put into worker:%s", pMsg, pWorker->name);
......
......@@ -19,6 +19,7 @@
static inline void vmSendRsp(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int32_t code) {
SRpcMsg rsp = {.handle = pMsg->rpcMsg.handle,
.ahandle = pMsg->rpcMsg.ahandle,
.refId = pMsg->rpcMsg.refId,
.code = code,
.pCont = pMsg->pRsp,
.contLen = pMsg->rspLen};
......@@ -112,7 +113,7 @@ static void vmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
numOfMsgs = taosArrayGetSize(pArray);
for (int32_t i = 0; i < numOfMsgs; i++) {
SNodeMsg *pMsg = *(SNodeMsg **)taosArrayGet(pArray, i);
SRpcMsg *pRpc = &pMsg->rpcMsg;
SRpcMsg * pRpc = &pMsg->rpcMsg;
SRpcMsg rsp;
rsp.pCont = NULL;
......@@ -120,6 +121,7 @@ static void vmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
rsp.code = 0;
rsp.handle = pRpc->handle;
rsp.ahandle = pRpc->ahandle;
rsp.refId = pRpc->refId;
int32_t code = vnodeProcessWriteReq(pVnode->pImpl, pRpc, version++, &rsp);
tmsgSendRsp(&rsp);
......@@ -147,7 +149,7 @@ static void vmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
static void vmProcessApplyQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) {
SVnodeObj *pVnode = pInfo->ahandle;
SNodeMsg *pMsg = NULL;
SNodeMsg * pMsg = NULL;
for (int32_t i = 0; i < numOfMsgs; ++i) {
taosGetQitem(qall, (void **)&pMsg);
......@@ -160,7 +162,7 @@ static void vmProcessApplyQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
static void vmProcessSyncQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) {
SVnodeObj *pVnode = pInfo->ahandle;
SNodeMsg *pMsg = NULL;
SNodeMsg * pMsg = NULL;
for (int32_t i = 0; i < numOfMsgs; ++i) {
taosGetQitem(qall, (void **)&pMsg);
......@@ -173,7 +175,7 @@ static void vmProcessSyncQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numOf
static void vmProcessMergeQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) {
SVnodeObj *pVnode = pInfo->ahandle;
SNodeMsg *pMsg = NULL;
SNodeMsg * pMsg = NULL;
for (int32_t i = 0; i < numOfMsgs; ++i) {
taosGetQitem(qall, (void **)&pMsg);
......@@ -190,7 +192,7 @@ static void vmProcessMergeQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
}
static int32_t vmPutNodeMsgToQueue(SVnodesMgmt *pMgmt, SNodeMsg *pMsg, EQueueType qtype) {
SRpcMsg *pRpc = &pMsg->rpcMsg;
SRpcMsg * pRpc = &pMsg->rpcMsg;
SMsgHead *pHead = pRpc->pCont;
pHead->contLen = ntohl(pHead->contLen);
pHead->vgId = ntohl(pHead->vgId);
......@@ -259,7 +261,7 @@ int32_t vmProcessMergeMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
}
int32_t vmProcessMgmtMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
SVnodesMgmt *pMgmt = pWrapper->pMgmt;
SVnodesMgmt * pMgmt = pWrapper->pMgmt;
SSingleWorker *pWorker = &pMgmt->mgmtWorker;
dTrace("msg:%p, will be written to vnode-mgmt queue, worker:%s", pMsg, pWorker->name);
taosWriteQitem(pWorker->queue, pMsg);
......@@ -267,7 +269,7 @@ int32_t vmProcessMgmtMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
}
int32_t vmProcessMonitorMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
SVnodesMgmt *pMgmt = pWrapper->pMgmt;
SVnodesMgmt * pMgmt = pWrapper->pMgmt;
SSingleWorker *pWorker = &pMgmt->monitorWorker;
dTrace("msg:%p, put into worker:%s", pMsg, pWorker->name);
......@@ -277,7 +279,7 @@ int32_t vmProcessMonitorMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
static int32_t vmPutRpcMsgToQueue(SMgmtWrapper *pWrapper, SRpcMsg *pRpc, EQueueType qtype) {
SVnodesMgmt *pMgmt = pWrapper->pMgmt;
SMsgHead *pHead = pRpc->pCont;
SMsgHead * pHead = pRpc->pCont;
SVnodeObj *pVnode = vmAcquireVnode(pMgmt, pHead->vgId);
if (pVnode == NULL) return -1;
......
......@@ -135,6 +135,7 @@ typedef struct {
int32_t failedTimes;
void* rpcHandle;
void* rpcAHandle;
int64_t rpcRefId;
void* rpcRsp;
int32_t rpcRspLen;
SArray* redoLogs;
......
......@@ -193,9 +193,9 @@ TRANS_ENCODE_OVER:
static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
SSdbRow *pRow = NULL;
STrans *pTrans = NULL;
char *pData = NULL;
SSdbRow * pRow = NULL;
STrans * pTrans = NULL;
char * pData = NULL;
int32_t dataLen = 0;
int8_t sver = 0;
int32_t redoLogNum = 0;
......@@ -456,7 +456,7 @@ static int32_t mndTransActionUpdate(SSdb *pSdb, STrans *pOld, STrans *pNew) {
}
static STrans *mndAcquireTrans(SMnode *pMnode, int32_t transId) {
SSdb *pSdb = pMnode->pSdb;
SSdb * pSdb = pMnode->pSdb;
STrans *pTrans = sdbAcquire(pSdb, SDB_TRANS, &transId);
if (pTrans == NULL) {
terrno = TSDB_CODE_MND_TRANS_NOT_EXIST;
......@@ -484,6 +484,7 @@ STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, ETrnType type, const S
pTrans->createdTime = taosGetTimestampMs();
pTrans->rpcHandle = pReq->handle;
pTrans->rpcAHandle = pReq->ahandle;
pTrans->rpcRefId = pReq->refId;
pTrans->redoLogs = taosArrayInit(MND_TRANS_ARRAY_SIZE, sizeof(void *));
pTrans->undoLogs = taosArrayInit(MND_TRANS_ARRAY_SIZE, sizeof(void *));
pTrans->commitLogs = taosArrayInit(MND_TRANS_ARRAY_SIZE, sizeof(void *));
......@@ -625,7 +626,7 @@ static int32_t mndCheckTransCanBeStartedInParallel(SMnode *pMnode, STrans *pNewT
if (mndIsBasicTrans(pNewTrans)) return 0;
STrans *pTrans = NULL;
void *pIter = NULL;
void * pIter = NULL;
int32_t code = 0;
while (1) {
......@@ -703,6 +704,7 @@ int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans) {
pNew->rpcHandle = pTrans->rpcHandle;
pNew->rpcAHandle = pTrans->rpcAHandle;
pNew->rpcRefId = pTrans->rpcRefId;
pNew->rpcRsp = pTrans->rpcRsp;
pNew->rpcRspLen = pTrans->rpcRspLen;
pTrans->rpcRsp = NULL;
......@@ -767,6 +769,7 @@ static void mndTransSendRpcRsp(SMnode *pMnode, STrans *pTrans) {
SRpcMsg rspMsg = {.handle = pTrans->rpcHandle,
.code = pTrans->code,
.ahandle = pTrans->rpcAHandle,
.refId = pTrans->rpcRefId,
.pCont = rpcCont,
.contLen = pTrans->rpcRspLen};
tmsgSendRsp(&rspMsg);
......@@ -827,7 +830,7 @@ HANDLE_ACTION_RSP_OVER:
}
static int32_t mndTransExecuteLogs(SMnode *pMnode, SArray *pArray) {
SSdb *pSdb = pMnode->pSdb;
SSdb * pSdb = pMnode->pSdb;
int32_t arraySize = taosArrayGetSize(pArray);
if (arraySize == 0) return 0;
......@@ -1202,11 +1205,11 @@ static int32_t mndKillTrans(SMnode *pMnode, STrans *pTrans) {
}
static int32_t mndProcessKillTransReq(SNodeMsg *pReq) {
SMnode *pMnode = pReq->pNode;
SMnode * pMnode = pReq->pNode;
SKillTransReq killReq = {0};
int32_t code = -1;
SUserObj *pUser = NULL;
STrans *pTrans = NULL;
SUserObj * pUser = NULL;
STrans * pTrans = NULL;
if (tDeserializeSKillTransReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &killReq) != 0) {
terrno = TSDB_CODE_INVALID_MSG;
......@@ -1246,7 +1249,7 @@ KILL_OVER:
void mndTransPullup(SMnode *pMnode) {
STrans *pTrans = NULL;
void *pIter = NULL;
void * pIter = NULL;
while (1) {
pIter = sdbFetch(pMnode->pSdb, SDB_TRANS, pIter, (void **)&pTrans);
......@@ -1261,11 +1264,11 @@ void mndTransPullup(SMnode *pMnode) {
static int32_t mndRetrieveTrans(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) {
SMnode *pMnode = pReq->pNode;
SSdb *pSdb = pMnode->pSdb;
SSdb * pSdb = pMnode->pSdb;
int32_t numOfRows = 0;
STrans *pTrans = NULL;
int32_t cols = 0;
char *pWrite;
char * pWrite;
while (numOfRows < rows) {
pShow->pIter = sdbFetch(pSdb, SDB_TRANS, pShow->pIter, (void **)&pTrans);
......
802e2d77c00 include/tkv/tkv.h (Hongze Cheng 2021-09-22 13:21:07 +0800 1) /*
802e2d77c00 include/tkv/tkv.h (Hongze Cheng 2021-09-22 13:21:07 +0800 2) * Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
802e2d77c00 include/tkv/tkv.h (Hongze Cheng 2021-09-22 13:21:07 +0800 3) *
802e2d77c00 include/tkv/tkv.h (Hongze Cheng 2021-09-22 13:21:07 +0800 4) * This program is free software: you can use, redistribute, and/or modify
802e2d77c00 include/tkv/tkv.h (Hongze Cheng 2021-09-22 13:21:07 +0800 5) * it under the terms of the GNU Affero General Public License, version 3
802e2d77c00 include/tkv/tkv.h (Hongze Cheng 2021-09-22 13:21:07 +0800 6) * or later ("AGPL"), as published by the Free Software Foundation.
802e2d77c00 include/tkv/tkv.h (Hongze Cheng 2021-09-22 13:21:07 +0800 7) *
802e2d77c00 include/tkv/tkv.h (Hongze Cheng 2021-09-22 13:21:07 +0800 8) * This program is distributed in the hope that it will be useful, but WITHOUT
802e2d77c00 include/tkv/tkv.h (Hongze Cheng 2021-09-22 13:21:07 +0800 9) * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
802e2d77c00 include/tkv/tkv.h (Hongze Cheng 2021-09-22 13:21:07 +0800 10) * FITNESS FOR A PARTICULAR PURPOSE.
802e2d77c00 include/tkv/tkv.h (Hongze Cheng 2021-09-22 13:21:07 +0800 11) *
802e2d77c00 include/tkv/tkv.h (Hongze Cheng 2021-09-22 13:21:07 +0800 12) * You should have received a copy of the GNU Affero General Public License
802e2d77c00 include/tkv/tkv.h (Hongze Cheng 2021-09-22 13:21:07 +0800 13) * along with this program. If not, see <http://www.gnu.org/licenses/>.
ce7a1600eb4 include/server/vnode/vnode.h (Shengliang Guan 2021-09-22 20:29:24 +0800 14) */
ce7a1600eb4 include/server/vnode/vnode.h (Shengliang Guan 2021-09-22 20:29:24 +0800 15)
ce7a1600eb4 include/server/vnode/vnode.h (Shengliang Guan 2021-09-22 20:29:24 +0800 16) #ifndef _TD_VNODE_H_
ce7a1600eb4 include/server/vnode/vnode.h (Shengliang Guan 2021-09-22 20:29:24 +0800 17) #define _TD_VNODE_H_
ce7a1600eb4 include/server/vnode/vnode.h (Shengliang Guan 2021-09-22 20:29:24 +0800 18)
79e5aeaa093 include/server/vnode/vnode.h (Hongze Cheng 2021-11-09 13:24:22 +0800 19) #include "os.h"
220fdfabe29 source/dnode/vnode/inc/vnode.h (Shengliang Guan 2022-03-21 19:08:25 +0800 20) #include "tmsgcb.h"
a9ad7ebd100 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-29 18:58:15 +0800 21) #include "tqueue.h"
a9ad7ebd100 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-29 18:58:15 +0800 22) #include "trpc.h"
79e5aeaa093 include/server/vnode/vnode.h (Hongze Cheng 2021-11-09 13:24:22 +0800 23)
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 24) #include "tarray.h"
cc5563716c5 source/dnode/vnode/inc/vnode.h (Shengliang Guan 2022-01-18 22:04:01 -0800 25) #include "tfs.h"
2b5e0592c4d include/dnode/vnode/vnode.h (Hongze Cheng 2021-11-24 16:29:02 +0800 26) #include "wal.h"
2f36662750f include/server/vnode/vnode.h (Shengliang Guan 2021-11-01 19:49:44 +0800 27)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 28) #include "tmallocator.h"
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 29) #include "tmsg.h"
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 30) #include "trow.h"
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 31) #include "tmallocator.h"
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 32) #include "tcommon.h"
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 33) #include "tfs.h"
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 34)
ce7a1600eb4 include/server/vnode/vnode.h (Shengliang Guan 2021-09-22 20:29:24 +0800 35) #ifdef __cplusplus
ce7a1600eb4 include/server/vnode/vnode.h (Shengliang Guan 2021-09-22 20:29:24 +0800 36) extern "C" {
ce7a1600eb4 include/server/vnode/vnode.h (Shengliang Guan 2021-09-22 20:29:24 +0800 37) #endif
ce7a1600eb4 include/server/vnode/vnode.h (Shengliang Guan 2021-09-22 20:29:24 +0800 38)
993d28df0f6 include/server/vnode/vnode.h (Hongze Cheng 2021-11-07 15:58:32 +0800 39) /* ------------------------ TYPES EXPOSED ------------------------ */
5832b6772c1 source/dnode/vnode/inc/vnode.h (Shengliang Guan 2022-03-16 21:18:54 +0800 40) typedef struct SMgmtWrapper SMgmtWrapper;
5832b6772c1 source/dnode/vnode/inc/vnode.h (Shengliang Guan 2022-03-16 21:18:54 +0800 41) typedef struct SVnode SVnode;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 42)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 43) #define META_SUPER_TABLE TD_SUPER_TABLE
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 44) #define META_CHILD_TABLE TD_CHILD_TABLE
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 45) #define META_NORMAL_TABLE TD_NORMAL_TABLE
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 46)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 47) // Types exported
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 48) typedef struct SMeta SMeta;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 49)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 50) typedef struct SMetaCfg {
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 51) /// LRU cache size
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 52) uint64_t lruSize;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 53) } SMetaCfg;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 54)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 55) typedef struct SMTbCursor SMTbCursor;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 56) typedef struct SMCtbCursor SMCtbCursor;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 57) typedef struct SMSmaCursor SMSmaCursor;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 58)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 59) typedef SVCreateTbReq STbCfg;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 60) typedef SVCreateTSmaReq SSmaCfg;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 61)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 62) typedef struct SDataStatis {
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 63) int16_t colId;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 64) int16_t maxIndex;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 65) int16_t minIndex;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 66) int16_t numOfNull;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 67) int64_t sum;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 68) int64_t max;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 69) int64_t min;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 70) } SDataStatis;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 71)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 72) typedef struct STsdbQueryCond {
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 73) STimeWindow twindow;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 74) int32_t order; // desc|asc order to iterate the data block
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 75) int32_t numOfCols;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 76) SColumnInfo *colList;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 77) bool loadExternalRows; // load external rows or not
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 78) int32_t type; // data block load type:
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 79) } STsdbQueryCond;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 80)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 81) typedef struct {
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 82) TSKEY lastKey;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 83) uint64_t uid;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 84) } STableKeyInfo;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 85)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 86)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 87) typedef struct STable {
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 88) uint64_t tid;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 89) uint64_t uid;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 90) STSchema *pSchema;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 91) } STable;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 92)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 93) #define BLOCK_LOAD_OFFSET_SEQ_ORDER 1
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 94) #define BLOCK_LOAD_TABLE_SEQ_ORDER 2
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 95) #define BLOCK_LOAD_TABLE_RR_ORDER 3
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 96)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 97) #define TABLE_TID(t) (t)->tid
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 98) #define TABLE_UID(t) (t)->uid
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 99)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 100) // TYPES EXPOSED
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 101) typedef struct STsdb STsdb;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 102)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 103) typedef struct STsdbCfg {
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 104) int8_t precision;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 105) int8_t update;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 106) int8_t compression;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 107) int32_t daysPerFile;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 108) int32_t minRowsPerFileBlock;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 109) int32_t maxRowsPerFileBlock;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 110) int32_t keep;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 111) int32_t keep1;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 112) int32_t keep2;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 113) uint64_t lruCacheSize;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 114) SArray *retentions;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 115) } STsdbCfg;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 116)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 117)
a038c466075 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-02-15 10:11:34 +0800 118) typedef struct {
35749cb3742 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-21 16:12:02 +0800 119) // TODO
35749cb3742 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-21 16:12:02 +0800 120) int32_t reserved;
35749cb3742 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-21 16:12:02 +0800 121) } STqCfg;
35749cb3742 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-21 16:12:02 +0800 122)
a038c466075 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-02-15 10:11:34 +0800 123) typedef struct {
7dbc861b4c1 source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-01-13 08:57:18 +0000 124) int32_t vgId;
5f2dc1401fe source/dnode/vnode/inc/vnode.h (dapan1121 2022-02-11 19:52:07 +0800 125) uint64_t dbId;
ed9709c3f0a source/dnode/vnode/inc/vnode.h (Shengliang Guan 2022-01-18 21:39:32 -0800 126) STfs *pTfs;
7dbc861b4c1 source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-01-13 08:57:18 +0000 127) uint64_t wsize;
7dbc861b4c1 source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-01-13 08:57:18 +0000 128) uint64_t ssize;
7dbc861b4c1 source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-01-13 08:57:18 +0000 129) uint64_t lsize;
7dbc861b4c1 source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-01-13 08:57:18 +0000 130) bool isHeapAllocator;
2ae35c3404c include/dnode/vnode/vnode.h (Hongze Cheng 2021-11-26 13:43:38 +0800 131) uint32_t ttl;
2ae35c3404c include/dnode/vnode/vnode.h (Hongze Cheng 2021-11-26 13:43:38 +0800 132) uint32_t keep;
82bcecc4ff5 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-02-18 16:59:33 +0800 133) int8_t streamMode;
7dbc861b4c1 source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-01-13 08:57:18 +0000 134) bool isWeak;
2ae35c3404c include/dnode/vnode/vnode.h (Hongze Cheng 2021-11-26 13:43:38 +0800 135) STsdbCfg tsdbCfg;
2ae35c3404c include/dnode/vnode/vnode.h (Hongze Cheng 2021-11-26 13:43:38 +0800 136) SMetaCfg metaCfg;
7dbc861b4c1 source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-01-13 08:57:18 +0000 137) STqCfg tqCfg;
7dbc861b4c1 source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-01-13 08:57:18 +0000 138) SWalCfg walCfg;
220fdfabe29 source/dnode/vnode/inc/vnode.h (Shengliang Guan 2022-03-21 19:08:25 +0800 139) SMsgCb msgCb;
09e6462c5fa source/dnode/vnode/inc/vnode.h (dapan1121 2022-03-03 09:09:11 +0800 140) uint32_t hashBegin;
09e6462c5fa source/dnode/vnode/inc/vnode.h (dapan1121 2022-03-03 09:09:11 +0800 141) uint32_t hashEnd;
913e8d70d87 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-09 10:49:42 +0800 142) int8_t hashMethod;
2ae35c3404c include/dnode/vnode/vnode.h (Hongze Cheng 2021-11-26 13:43:38 +0800 143) } SVnodeCfg;
993d28df0f6 include/server/vnode/vnode.h (Hongze Cheng 2021-11-07 15:58:32 +0800 144)
a038c466075 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-02-15 10:11:34 +0800 145) typedef struct {
5bb010ef4af source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-28 15:24:09 +0800 146) int64_t ver;
a038c466075 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-02-15 10:11:34 +0800 147) int64_t tbUid;
5bb010ef4af source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-28 15:24:09 +0800 148) SHashObj *tbIdHash;
246311d4fcf source/dnode/vnode/inc/vnode.h (Shengliang Guan 2022-02-16 15:27:19 +0800 149) const SSubmitReq *pMsg;
5bb010ef4af source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-28 15:24:09 +0800 150) SSubmitBlk *pBlock;
5bb010ef4af source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-28 15:24:09 +0800 151) SSubmitMsgIter msgIter;
5bb010ef4af source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-28 15:24:09 +0800 152) SSubmitBlkIter blkIter;
5bb010ef4af source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-28 15:24:09 +0800 153) SMeta *pVnodeMeta;
5bb010ef4af source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-28 15:24:09 +0800 154) SArray *pColIdList; // SArray<int32_t>
5bb010ef4af source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-28 15:24:09 +0800 155) int32_t sver;
5bb010ef4af source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-28 15:24:09 +0800 156) SSchemaWrapper *pSchemaWrapper;
5bb010ef4af source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-28 15:24:09 +0800 157) STSchema *pSchema;
35749cb3742 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-21 16:12:02 +0800 158) } STqReadHandle;
35749cb3742 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-21 16:12:02 +0800 159)
993d28df0f6 include/server/vnode/vnode.h (Hongze Cheng 2021-11-07 15:58:32 +0800 160) /* ------------------------ SVnode ------------------------ */
757dea61705 include/dnode/vnode/vnode.h (Hongze Cheng 2021-11-29 14:06:16 +0800 161) /**
757dea61705 include/dnode/vnode/vnode.h (Hongze Cheng 2021-11-29 14:06:16 +0800 162) * @brief Initialize the vnode module
018661e1779 include/dnode/vnode/vnode.h (Hongze Cheng 2021-11-29 15:42:17 +0800 163) *
757dea61705 include/dnode/vnode/vnode.h (Hongze Cheng 2021-11-29 14:06:16 +0800 164) * @return int 0 for success and -1 for failure
757dea61705 include/dnode/vnode/vnode.h (Hongze Cheng 2021-11-29 14:06:16 +0800 165) */
220fdfabe29 source/dnode/vnode/inc/vnode.h (Shengliang Guan 2022-03-21 19:08:25 +0800 166) int vnodeInit();
757dea61705 include/dnode/vnode/vnode.h (Hongze Cheng 2021-11-29 14:06:16 +0800 167)
757dea61705 include/dnode/vnode/vnode.h (Hongze Cheng 2021-11-29 14:06:16 +0800 168) /**
0b6d32a3d92 include/dnode/vnode/vnode.h (Shengliang Guan 2022-01-11 19:35:40 -0800 169) * @brief Cleanup the vnode module
018661e1779 include/dnode/vnode/vnode.h (Hongze Cheng 2021-11-29 15:42:17 +0800 170) *
757dea61705 include/dnode/vnode/vnode.h (Hongze Cheng 2021-11-29 14:06:16 +0800 171) */
0b6d32a3d92 include/dnode/vnode/vnode.h (Shengliang Guan 2022-01-11 19:35:40 -0800 172) void vnodeCleanup();
757dea61705 include/dnode/vnode/vnode.h (Hongze Cheng 2021-11-29 14:06:16 +0800 173)
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 174) /**
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 175) * @brief Open a VNODE.
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 176) *
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 177) * @param path path of the vnode
3906f6a7073 include/dnode/vnode/vnode.h (Hongze Cheng 2021-11-22 15:39:05 +0800 178) * @param pVnodeCfg options of the vnode
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 179) * @return SVnode* The vnode object
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 180) */
ab3378e0901 include/dnode/vnode/vnode.h (Shengliang Guan 2022-01-11 16:44:11 -0800 181) SVnode *vnodeOpen(const char *path, const SVnodeCfg *pVnodeCfg);
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 182)
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 183) /**
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 184) * @brief Close a VNODE
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 185) *
baac49c75b2 include/dnode/vnode/vnode.h (Hongze Cheng 2021-11-12 17:50:46 +0800 186) * @param pVnode The vnode object to close
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 187) */
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 188) void vnodeClose(SVnode *pVnode);
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 189)
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 190) /**
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 191) * @brief Destroy a VNODE.
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 192) *
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 193) * @param path Path of the VNODE.
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 194) */
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 195) void vnodeDestroy(const char *path);
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 196)
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 197) /**
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 198) * @brief Process an array of write messages.
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 199) *
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 200) * @param pVnode The vnode object.
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 201) * @param pMsgs The array of SRpcMsg
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 202) */
50229512d32 source/dnode/vnode/inc/vnode.h (Shengliang Guan 2022-03-21 14:39:35 +0800 203) void vnodeProcessWMsgs(SVnode *pVnode, SArray *pMsgs);
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 204)
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 205) /**
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 206) * @brief Apply a write request message.
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 207) *
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 208) * @param pVnode The vnode object.
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 209) * @param pMsg The request message
15d9a46600d include/server/vnode/vnode.h (Hongze Cheng 2021-11-12 10:53:52 +0800 210) * @param pRsp The response message
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 211) * @return int 0 for success, -1 for failure
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 212) */
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 213) int vnodeApplyWMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp);
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 214)
6beee204d82 include/dnode/vnode/vnode.h (Liu Jicong 2021-12-21 20:07:32 +0800 215) /**
6beee204d82 include/dnode/vnode/vnode.h (Liu Jicong 2021-12-21 20:07:32 +0800 216) * @brief Process a consume message.
6beee204d82 include/dnode/vnode/vnode.h (Liu Jicong 2021-12-21 20:07:32 +0800 217) *
6beee204d82 include/dnode/vnode/vnode.h (Liu Jicong 2021-12-21 20:07:32 +0800 218) * @param pVnode The vnode object.
6beee204d82 include/dnode/vnode/vnode.h (Liu Jicong 2021-12-21 20:07:32 +0800 219) * @param pMsg The request message
6beee204d82 include/dnode/vnode/vnode.h (Liu Jicong 2021-12-21 20:07:32 +0800 220) * @param pRsp The response message
6beee204d82 include/dnode/vnode/vnode.h (Liu Jicong 2021-12-21 20:07:32 +0800 221) * @return int 0 for success, -1 for failure
6beee204d82 include/dnode/vnode/vnode.h (Liu Jicong 2021-12-21 20:07:32 +0800 222) */
6beee204d82 include/dnode/vnode/vnode.h (Liu Jicong 2021-12-21 20:07:32 +0800 223) int vnodeProcessCMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp);
6beee204d82 include/dnode/vnode/vnode.h (Liu Jicong 2021-12-21 20:07:32 +0800 224)
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 225) /**
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 226) * @brief Process the sync request
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 227) *
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 228) * @param pVnode
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 229) * @param pMsg
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 230) * @param pRsp
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 231) * @return int
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 232) */
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 233) int vnodeProcessSyncReq(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp);
993d28df0f6 include/server/vnode/vnode.h (Hongze Cheng 2021-11-07 15:58:32 +0800 234)
293ad0bb066 include/dnode/vnode/vnode.h (Shengliang Guan 2021-12-21 16:15:38 +0800 235) /**
293ad0bb066 include/dnode/vnode/vnode.h (Shengliang Guan 2021-12-21 16:15:38 +0800 236) * @brief Process a query message.
293ad0bb066 include/dnode/vnode/vnode.h (Shengliang Guan 2021-12-21 16:15:38 +0800 237) *
293ad0bb066 include/dnode/vnode/vnode.h (Shengliang Guan 2021-12-21 16:15:38 +0800 238) * @param pVnode The vnode object.
293ad0bb066 include/dnode/vnode/vnode.h (Shengliang Guan 2021-12-21 16:15:38 +0800 239) * @param pMsg The request message
293ad0bb066 include/dnode/vnode/vnode.h (Shengliang Guan 2021-12-21 16:15:38 +0800 240) * @return int 0 for success, -1 for failure
293ad0bb066 include/dnode/vnode/vnode.h (Shengliang Guan 2021-12-21 16:15:38 +0800 241) */
808efe80698 source/dnode/vnode/inc/vnode.h (Shengliang 2022-01-25 14:20:52 +0800 242) int vnodeProcessQueryMsg(SVnode *pVnode, SRpcMsg *pMsg);
293ad0bb066 include/dnode/vnode/vnode.h (Shengliang Guan 2021-12-21 16:15:38 +0800 243)
293ad0bb066 include/dnode/vnode/vnode.h (Shengliang Guan 2021-12-21 16:15:38 +0800 244) /**
293ad0bb066 include/dnode/vnode/vnode.h (Shengliang Guan 2021-12-21 16:15:38 +0800 245) * @brief Process a fetch message.
293ad0bb066 include/dnode/vnode/vnode.h (Shengliang Guan 2021-12-21 16:15:38 +0800 246) *
293ad0bb066 include/dnode/vnode/vnode.h (Shengliang Guan 2021-12-21 16:15:38 +0800 247) * @param pVnode The vnode object.
293ad0bb066 include/dnode/vnode/vnode.h (Shengliang Guan 2021-12-21 16:15:38 +0800 248) * @param pMsg The request message
293ad0bb066 include/dnode/vnode/vnode.h (Shengliang Guan 2021-12-21 16:15:38 +0800 249) * @return int 0 for success, -1 for failure
293ad0bb066 include/dnode/vnode/vnode.h (Shengliang Guan 2021-12-21 16:15:38 +0800 250) */
a9ad7ebd100 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-29 18:58:15 +0800 251) int vnodeProcessFetchMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo);
293ad0bb066 include/dnode/vnode/vnode.h (Shengliang Guan 2021-12-21 16:15:38 +0800 252)
9001468b212 include/dnode/vnode/vnode.h (Hongze Cheng 2021-11-22 15:02:53 +0800 253) /* ------------------------ SVnodeCfg ------------------------ */
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 254) /**
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 255) * @brief Initialize VNODE options.
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 256) *
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 257) * @param pOptions The options object to be initialized. It should not be NULL.
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 258) */
9001468b212 include/dnode/vnode/vnode.h (Hongze Cheng 2021-11-22 15:02:53 +0800 259) void vnodeOptionsInit(SVnodeCfg *pOptions);
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 260)
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 261) /**
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 262) * @brief Clear VNODE options.
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 263) *
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 264) * @param pOptions Options to clear.
7277784852b include/server/vnode/vnode.h (Hongze Cheng 2021-11-11 11:41:16 +0800 265) */
9001468b212 include/dnode/vnode/vnode.h (Hongze Cheng 2021-11-22 15:02:53 +0800 266) void vnodeOptionsClear(SVnodeCfg *pOptions);
993d28df0f6 include/server/vnode/vnode.h (Hongze Cheng 2021-11-07 15:58:32 +0800 267)
260aad808b4 source/dnode/vnode/inc/vnode.h (dapan1121 2022-03-11 19:45:34 +0800 268) int vnodeValidateTableHash(SVnodeCfg *pVnodeOptions, char *tableFName);
763eccf8aa4 source/dnode/vnode/inc/vnode.h (dapan1121 2022-03-10 19:05:58 +0800 269)
c8ee7ba9a7b include/server/vnode/vnode.h (Hongze Cheng 2021-11-09 14:36:53 +0800 270) /* ------------------------ FOR COMPILE ------------------------ */
c8ee7ba9a7b include/server/vnode/vnode.h (Hongze Cheng 2021-11-09 14:36:53 +0800 271)
2f36662750f include/server/vnode/vnode.h (Shengliang Guan 2021-11-01 19:49:44 +0800 272) int32_t vnodeAlter(SVnode *pVnode, const SVnodeCfg *pCfg);
2f36662750f include/server/vnode/vnode.h (Shengliang Guan 2021-11-01 19:49:44 +0800 273) int32_t vnodeCompact(SVnode *pVnode);
2f36662750f include/server/vnode/vnode.h (Shengliang Guan 2021-11-01 19:49:44 +0800 274) int32_t vnodeSync(SVnode *pVnode);
dd3281c9d2f include/server/vnode/vnode.h (Shengliang Guan 2021-11-04 18:38:07 +0800 275) int32_t vnodeGetLoad(SVnode *pVnode, SVnodeLoad *pLoad);
2f09d49aa4c include/server/vnode/vnode.h (Shengliang Guan 2021-11-04 14:06:29 +0800 276)
a038c466075 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-02-15 10:11:34 +0800 277) /* ------------------------- TQ READ --------------------------- */
35749cb3742 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-21 16:12:02 +0800 278)
913e8d70d87 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-09 10:49:42 +0800 279) enum {
913e8d70d87 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-09 10:49:42 +0800 280) TQ_STREAM_TOKEN__DATA = 1,
913e8d70d87 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-09 10:49:42 +0800 281) TQ_STREAM_TOKEN__WATERMARK,
913e8d70d87 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-09 10:49:42 +0800 282) TQ_STREAM_TOKEN__CHECKPOINT,
913e8d70d87 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-09 10:49:42 +0800 283) };
913e8d70d87 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-09 10:49:42 +0800 284)
913e8d70d87 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-09 10:49:42 +0800 285) typedef struct {
913e8d70d87 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-09 10:49:42 +0800 286) int8_t type;
913e8d70d87 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-09 10:49:42 +0800 287) int8_t reserved[7];
913e8d70d87 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-09 10:49:42 +0800 288) union {
913e8d70d87 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-09 10:49:42 +0800 289) void *data;
913e8d70d87 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-09 10:49:42 +0800 290) int64_t wmTs;
913e8d70d87 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-09 10:49:42 +0800 291) int64_t checkpointId;
913e8d70d87 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-09 10:49:42 +0800 292) };
913e8d70d87 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-09 10:49:42 +0800 293) } STqStreamToken;
913e8d70d87 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-09 10:49:42 +0800 294)
5bb010ef4af source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-28 15:24:09 +0800 295) STqReadHandle *tqInitSubmitMsgScanner(SMeta *pMeta);
35749cb3742 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-21 16:12:02 +0800 296)
5bb010ef4af source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-28 15:24:09 +0800 297) static FORCE_INLINE void tqReadHandleSetColIdList(STqReadHandle *pReadHandle, SArray *pColIdList) {
a1c6c94c0b3 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-21 19:00:09 +0800 298) pReadHandle->pColIdList = pColIdList;
a1c6c94c0b3 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-21 19:00:09 +0800 299) }
a1c6c94c0b3 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-21 19:00:09 +0800 300)
a038c466075 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-02-15 10:11:34 +0800 301) // static FORCE_INLINE void tqReadHandleSetTbUid(STqReadHandle* pHandle, int64_t tbUid) {
a038c466075 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-02-15 10:11:34 +0800 302) // pHandle->tbUid = tbUid;
60a1ae8ce4c source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-28 13:31:46 +0800 303) //}
35749cb3742 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-21 16:12:02 +0800 304)
5bb010ef4af source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-28 15:24:09 +0800 305) static FORCE_INLINE int tqReadHandleSetTbUidList(STqReadHandle *pHandle, const SArray *tbUidList) {
b7788aca04f source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-02 16:22:43 +0800 306) if (pHandle->tbIdHash) {
b7788aca04f source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-02 16:22:43 +0800 307) taosHashClear(pHandle->tbIdHash);
b7788aca04f source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-02 16:22:43 +0800 308) }
b7788aca04f source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-02 16:22:43 +0800 309)
a038c466075 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-02-15 10:11:34 +0800 310) pHandle->tbIdHash = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK);
963fb9b9f61 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-27 18:05:23 +0800 311) if (pHandle->tbIdHash == NULL) {
36aedfbb7cd source/dnode/vnode/inc/vnode.h (Haojun Liao 2022-02-17 15:24:00 +0800 312) terrno = TSDB_CODE_OUT_OF_MEMORY;
963fb9b9f61 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-27 18:05:23 +0800 313) return -1;
963fb9b9f61 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-27 18:05:23 +0800 314) }
36aedfbb7cd source/dnode/vnode/inc/vnode.h (Haojun Liao 2022-02-17 15:24:00 +0800 315)
963fb9b9f61 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-27 18:05:23 +0800 316) for (int i = 0; i < taosArrayGetSize(tbUidList); i++) {
5bb010ef4af source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-28 15:24:09 +0800 317) int64_t *pKey = (int64_t *)taosArrayGet(tbUidList, i);
963fb9b9f61 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-27 18:05:23 +0800 318) taosHashPut(pHandle->tbIdHash, pKey, sizeof(int64_t), NULL, 0);
963fb9b9f61 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-27 18:05:23 +0800 319) }
36aedfbb7cd source/dnode/vnode/inc/vnode.h (Haojun Liao 2022-02-17 15:24:00 +0800 320)
963fb9b9f61 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-27 18:05:23 +0800 321) return 0;
963fb9b9f61 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-27 18:05:23 +0800 322) }
963fb9b9f61 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-27 18:05:23 +0800 323)
b7788aca04f source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-02 16:22:43 +0800 324) static FORCE_INLINE int tqReadHandleAddTbUidList(STqReadHandle *pHandle, const SArray *tbUidList) {
b7788aca04f source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-02 16:22:43 +0800 325) if (pHandle->tbIdHash == NULL) {
b7788aca04f source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-02 16:22:43 +0800 326) pHandle->tbIdHash = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK);
b7788aca04f source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-02 16:22:43 +0800 327) if (pHandle->tbIdHash == NULL) {
b7788aca04f source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-02 16:22:43 +0800 328) terrno = TSDB_CODE_OUT_OF_MEMORY;
b7788aca04f source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-02 16:22:43 +0800 329) return -1;
b7788aca04f source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-02 16:22:43 +0800 330) }
b7788aca04f source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-02 16:22:43 +0800 331) }
b7788aca04f source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-02 16:22:43 +0800 332)
b7788aca04f source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-02 16:22:43 +0800 333) for (int i = 0; i < taosArrayGetSize(tbUidList); i++) {
b7788aca04f source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-02 16:22:43 +0800 334) int64_t *pKey = (int64_t *)taosArrayGet(tbUidList, i);
b7788aca04f source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-02 16:22:43 +0800 335) taosHashPut(pHandle->tbIdHash, pKey, sizeof(int64_t), NULL, 0);
b7788aca04f source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-02 16:22:43 +0800 336) }
b7788aca04f source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-02 16:22:43 +0800 337)
b7788aca04f source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-02 16:22:43 +0800 338) return 0;
b7788aca04f source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-02 16:22:43 +0800 339) }
b7788aca04f source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-03-02 16:22:43 +0800 340)
7ee6657cf72 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-02-21 10:48:23 +0800 341) int32_t tqReadHandleSetMsg(STqReadHandle *pHandle, SSubmitReq *pMsg, int64_t ver);
7ee6657cf72 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-02-21 10:48:23 +0800 342) bool tqNextDataBlock(STqReadHandle *pHandle);
7ee6657cf72 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-02-21 10:48:23 +0800 343) int tqRetrieveDataBlockInfo(STqReadHandle *pHandle, SDataBlockInfo *pBlockInfo);
35749cb3742 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-21 16:12:02 +0800 344) // return SArray<SColumnInfoData>
5bb010ef4af source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-28 15:24:09 +0800 345) SArray *tqRetrieveDataBlock(STqReadHandle *pHandle);
35749cb3742 source/dnode/vnode/inc/vnode.h (Liu Jicong 2022-01-21 16:12:02 +0800 346)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 347) // meta.h
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 348) SMeta *metaOpen(const char *path, const SMetaCfg *pMetaCfg, SMemAllocatorFactory *pMAF);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 349) void metaClose(SMeta *pMeta);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 350) void metaRemove(const char *path);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 351) int metaCreateTable(SMeta *pMeta, STbCfg *pTbCfg);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 352) int metaDropTable(SMeta *pMeta, tb_uid_t uid);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 353) int metaCommit(SMeta *pMeta);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 354) int32_t metaCreateTSma(SMeta *pMeta, SSmaCfg *pCfg);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 355) int32_t metaDropTSma(SMeta *pMeta, int64_t indexUid);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 356) STbCfg *metaGetTbInfoByUid(SMeta *pMeta, tb_uid_t uid);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 357) STbCfg *metaGetTbInfoByName(SMeta *pMeta, char *tbname, tb_uid_t *uid);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 358) SSchemaWrapper *metaGetTableSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver, bool isinline);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 359) STSchema *metaGetTbTSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 360) STSma *metaGetSmaInfoByIndex(SMeta *pMeta, int64_t indexUid);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 361) STSmaWrapper *metaGetSmaInfoByTable(SMeta *pMeta, tb_uid_t uid);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 362) SArray *metaGetSmaTbUids(SMeta *pMeta, bool isDup);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 363) int metaGetTbNum(SMeta *pMeta);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 364) SMTbCursor *metaOpenTbCursor(SMeta *pMeta);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 365) void metaCloseTbCursor(SMTbCursor *pTbCur);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 366) char *metaTbCursorNext(SMTbCursor *pTbCur);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 367) SMCtbCursor *metaOpenCtbCursor(SMeta *pMeta, tb_uid_t uid);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 368) void metaCloseCtbCurosr(SMCtbCursor *pCtbCur);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 369) tb_uid_t metaCtbCursorNext(SMCtbCursor *pCtbCur);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 370)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 371) SMSmaCursor *metaOpenSmaCursor(SMeta *pMeta, tb_uid_t uid);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 372) void metaCloseSmaCurosr(SMSmaCursor *pSmaCur);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 373) const char *metaSmaCursorNext(SMSmaCursor *pSmaCur);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 374)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 375) // Options
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 376) void metaOptionsInit(SMetaCfg *pMetaCfg);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 377) void metaOptionsClear(SMetaCfg *pMetaCfg);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 378)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 379) // query condition to build multi-table data block iterator
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 380) // STsdb
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 381) STsdb *tsdbOpen(const char *path, int32_t vgId, const STsdbCfg *pTsdbCfg, SMemAllocatorFactory *pMAF, SMeta *pMeta, STfs *pTfs);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 382) void tsdbClose(STsdb *);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 383) void tsdbRemove(const char *path);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 384) int tsdbInsertData(STsdb *pTsdb, SSubmitReq *pMsg, SSubmitRsp *pRsp);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 385) int tsdbPrepareCommit(STsdb *pTsdb);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 386) int tsdbCommit(STsdb *pTsdb);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 387)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 388)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 389) int32_t tsdbInitSma(STsdb *pTsdb);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 390) int32_t tsdbCreateTSma(STsdb *pTsdb, char *pMsg);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 391) int32_t tsdbDropTSma(STsdb *pTsdb, char *pMsg);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 392) /**
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 393) * @brief When submit msg received, update the relative expired window synchronously.
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 394) *
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 395) * @param pTsdb
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 396) * @param msg
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 397) * @return int32_t
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 398) */
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 399) int32_t tsdbUpdateSmaWindow(STsdb *pTsdb, SSubmitReq *pMsg);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 400)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 401) /**
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 402) * @brief Insert tSma(Time-range-wise SMA) data from stream computing engine
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 403) *
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 404) * @param pTsdb
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 405) * @param indexUid
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 406) * @param msg
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 407) * @return int32_t
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 408) */
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 409) int32_t tsdbInsertTSmaData(STsdb *pTsdb, int64_t indexUid, const char *msg);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 410)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 411) /**
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 412) * @brief Drop tSma data and local cache.
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 413) *
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 414) * @param pTsdb
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 415) * @param indexUid
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 416) * @return int32_t
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 417) */
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 418) int32_t tsdbDropTSmaData(STsdb *pTsdb, int64_t indexUid);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 419)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 420) /**
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 421) * @brief Insert RSma(Rollup SMA) data.
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 422) *
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 423) * @param pTsdb
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 424) * @param msg
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 425) * @return int32_t
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 426) */
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 427) int32_t tsdbInsertRSmaData(STsdb *pTsdb, char *msg);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 428)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 429) // TODO: This is the basic params, and should wrap the params to a queryHandle.
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 430) /**
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 431) * @brief Get tSma(Time-range-wise SMA) data.
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 432) *
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 433) * @param pTsdb
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 434) * @param pData
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 435) * @param indexUid
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 436) * @param querySKey
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 437) * @param nMaxResult
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 438) * @return int32_t
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 439) */
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 440) int32_t tsdbGetTSmaData(STsdb *pTsdb, char *pData, int64_t indexUid, TSKEY querySKey, int32_t nMaxResult);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 441)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 442) // STsdbCfg
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 443) int tsdbOptionsInit(STsdbCfg *);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 444) void tsdbOptionsClear(STsdbCfg *);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 445)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 446) typedef void* tsdbReaderT;
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 447)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 448) /**
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 449) * Get the data block iterator, starting from position according to the query condition
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 450) *
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 451) * @param tsdb tsdb handle
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 452) * @param pCond query condition, including time window, result set order, and basic required columns for each block
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 453) * @param tableInfoGroup table object list in the form of set, grouped into different sets according to the
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 454) * group by condition
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 455) * @param qinfo query info handle from query processor
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 456) * @return
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 457) */
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 458) tsdbReaderT *tsdbQueryTables(STsdb *tsdb, STsdbQueryCond *pCond, STableGroupInfo *tableInfoGroup, uint64_t qId, uint64_t taskId);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 459)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 460) /**
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 461) * Get the last row of the given query time window for all the tables in STableGroupInfo object.
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 462) * Note that only one data block with only row will be returned while invoking retrieve data block function for
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 463) * all tables in this group.
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 464) *
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 465) * @param tsdb tsdb handle
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 466) * @param pCond query condition, including time window, result set order, and basic required columns for each block
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 467) * @param tableInfo table list.
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 468) * @return
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 469) */
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 470) //tsdbReaderT tsdbQueryLastRow(STsdbRepo *tsdb, STsdbQueryCond *pCond, STableGroupInfo *tableInfo, uint64_t qId,
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 471) // SMemRef *pRef);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 472)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 473)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 474) tsdbReaderT tsdbQueryCacheLast(STsdb *tsdb, STsdbQueryCond *pCond, STableGroupInfo *groupList, uint64_t qId, void* pMemRef);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 475)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 476) int32_t tsdbGetFileBlocksDistInfo(tsdbReaderT* pReader, STableBlockDistInfo* pTableBlockInfo);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 477)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 478) bool isTsdbCacheLastRow(tsdbReaderT* pReader);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 479)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 480) /**
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 481) *
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 482) * @param tsdb
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 483) * @param uid
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 484) * @param skey
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 485) * @param pTagCond
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 486) * @param len
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 487) * @param tagNameRelType
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 488) * @param tbnameCond
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 489) * @param pGroupInfo
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 490) * @param pColIndex
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 491) * @param numOfCols
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 492) * @param reqId
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 493) * @return
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 494) */
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 495) int32_t tsdbQuerySTableByTagCond(void* pMeta, uint64_t uid, TSKEY skey, const char* pTagCond, size_t len,
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 496) int16_t tagNameRelType, const char* tbnameCond, STableGroupInfo* pGroupInfo,
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 497) SColIndex* pColIndex, int32_t numOfCols, uint64_t reqId, uint64_t taskId);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 498) /**
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 499) * get num of rows in mem table
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 500) *
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 501) * @param pHandle
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 502) * @return row size
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 503) */
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 504)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 505) int64_t tsdbGetNumOfRowsInMemTable(tsdbReaderT* pHandle);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 506)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 507) /**
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 508) * move to next block if exists
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 509) *
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 510) * @param pTsdbReadHandle
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 511) * @return
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 512) */
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 513) bool tsdbNextDataBlock(tsdbReaderT pTsdbReadHandle);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 514)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 515) /**
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 516) * Get current data block information
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 517) *
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 518) * @param pTsdbReadHandle
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 519) * @param pBlockInfo
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 520) * @return
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 521) */
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 522) void tsdbRetrieveDataBlockInfo(tsdbReaderT *pTsdbReadHandle, SDataBlockInfo *pBlockInfo);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 523)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 524) /**
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 525) *
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 526) * Get the pre-calculated information w.r.t. current data block.
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 527) *
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 528) * In case of data block in cache, the pBlockStatis will always be NULL.
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 529) * If a block is not completed loaded from disk, the pBlockStatis will be NULL.
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 530)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 531) * @pBlockStatis the pre-calculated value for current data blocks. if the block is a cache block, always return 0
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 532) * @return
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 533) */
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 534) int32_t tsdbRetrieveDataBlockStatisInfo(tsdbReaderT *pTsdbReadHandle, SDataStatis **pBlockStatis);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 535)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 536) /**
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 537) *
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 538) * The query condition with primary timestamp is passed to iterator during its constructor function,
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 539) * the returned data block must be satisfied with the time window condition in any cases,
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 540) * which means the SData data block is not actually the completed disk data blocks.
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 541) *
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 542) * @param pTsdbReadHandle query handle
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 543) * @param pColumnIdList required data columns id list
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 544) * @return
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 545) */
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 546) SArray *tsdbRetrieveDataBlock(tsdbReaderT *pTsdbReadHandle, SArray *pColumnIdList);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 547)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 548) /**
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 549) * destroy the created table group list, which is generated by tag query
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 550) * @param pGroupList
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 551) */
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 552) void tsdbDestroyTableGroup(STableGroupInfo *pGroupList);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 553)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 554) /**
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 555) * create the table group result including only one table, used to handle the normal table query
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 556) *
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 557) * @param tsdb tsdbHandle
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 558) * @param uid table uid
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 559) * @param pGroupInfo the generated result
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 560) * @return
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 561) */
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 562) int32_t tsdbGetOneTableGroup(void *pMeta, uint64_t uid, TSKEY startKey, STableGroupInfo *pGroupInfo);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 563)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 564) /**
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 565) *
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 566) * @param tsdb
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 567) * @param pTableIdList
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 568) * @param pGroupInfo
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 569) * @return
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 570) */
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 571) int32_t tsdbGetTableGroupFromIdList(STsdb *tsdb, SArray *pTableIdList, STableGroupInfo *pGroupInfo);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 572)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 573) /**
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 574) * clean up the query handle
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 575) * @param queryHandle
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 576) */
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 577) void tsdbCleanupReadHandle(tsdbReaderT queryHandle);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 578)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 579) int32_t tdScanAndConvertSubmitMsg(SSubmitReq *pMsg);
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 580)
6faaafb7a2f source/dnode/vnode/inc/vnode.h (Hongze Cheng 2022-04-08 06:09:15 +0000 581)
ce7a1600eb4 include/server/vnode/vnode.h (Shengliang Guan 2021-09-22 20:29:24 +0800 582) #ifdef __cplusplus
ce7a1600eb4 include/server/vnode/vnode.h (Shengliang Guan 2021-09-22 20:29:24 +0800 583) }
ce7a1600eb4 include/server/vnode/vnode.h (Shengliang Guan 2021-09-22 20:29:24 +0800 584) #endif
ce7a1600eb4 include/server/vnode/vnode.h (Shengliang Guan 2021-09-22 20:29:24 +0800 585)
daafc0feb7f include/server/vnode/vnode.h (Shengliang Guan 2021-09-29 19:26:11 +0800 586) #endif /*_TD_VNODE_H_*/
......@@ -120,8 +120,8 @@ typedef struct SQWTaskCtx {
int8_t events[QW_EVENT_MAX];
qTaskInfo_t taskHandle;
DataSinkHandle sinkHandle;
void *taskHandle;
void *sinkHandle;
} SQWTaskCtx;
typedef struct SQWSchStatus {
......
#include "qworker.h"
#include "tcommon.h"
#include "qworkerMsg.h"
#include "dataSinkMgt.h"
#include "executor.h"
#include "planner.h"
#include "query.h"
#include "qworker.h"
#include "qworkerInt.h"
#include "qworkerMsg.h"
#include "tcommon.h"
#include "tmsg.h"
#include "tname.h"
#include "dataSinkMgt.h"
int32_t qwMallocFetchRsp(int32_t length, SRetrieveTableRsp **rsp) {
int32_t msgSize = sizeof(SRetrieveTableRsp) + length;
......@@ -26,8 +25,6 @@ int32_t qwMallocFetchRsp(int32_t length, SRetrieveTableRsp **rsp) {
return TSDB_CODE_SUCCESS;
}
void qwBuildFetchRsp(void *msg, SOutputData *input, int32_t len, bool qComplete) {
SRetrieveTableRsp *rsp = (SRetrieveTableRsp *)msg;
......@@ -39,7 +36,6 @@ void qwBuildFetchRsp(void *msg, SOutputData *input, int32_t len, bool qComplete)
rsp->numOfRows = htonl(input->numOfRows);
}
void qwFreeFetchRsp(void *msg) {
if (msg) {
rpcFreeCont(msg);
......@@ -50,13 +46,14 @@ int32_t qwBuildAndSendQueryRsp(SQWConnInfo *pConn, int32_t code) {
SQueryTableRsp rsp = {.code = code};
int32_t contLen = tSerializeSQueryTableRsp(NULL, 0, &rsp);
void *msg = rpcMallocCont(contLen);
void * msg = rpcMallocCont(contLen);
tSerializeSQueryTableRsp(msg, contLen, &rsp);
SRpcMsg rpcRsp = {
.msgType = TDMT_VND_QUERY_RSP,
.handle = pConn->handle,
.ahandle = pConn->ahandle,
.refId = pConn->refId,
.pCont = msg,
.contLen = contLen,
.code = code,
......@@ -74,6 +71,7 @@ int32_t qwBuildAndSendReadyRsp(SQWConnInfo *pConn, int32_t code) {
SRpcMsg rpcRsp = {
.msgType = TDMT_VND_RES_READY_RSP,
.handle = pConn->handle,
.refId = pConn->refId,
.ahandle = NULL,
.pCont = pRsp,
.contLen = sizeof(*pRsp),
......@@ -89,13 +87,14 @@ int32_t qwBuildAndSendExplainRsp(SQWConnInfo *pConn, SExplainExecInfo *execInfo,
SExplainRsp rsp = {.numOfPlans = num, .subplanInfo = execInfo};
int32_t contLen = tSerializeSExplainRsp(NULL, 0, &rsp);
void *pRsp = rpcMallocCont(contLen);
void * pRsp = rpcMallocCont(contLen);
tSerializeSExplainRsp(pRsp, contLen, &rsp);
SRpcMsg rpcRsp = {
.msgType = TDMT_VND_EXPLAIN_RSP,
.handle = pConn->handle,
.ahandle = pConn->ahandle,
.refId = pConn->refId,
.pCont = pRsp,
.contLen = contLen,
.code = 0,
......@@ -108,13 +107,14 @@ int32_t qwBuildAndSendExplainRsp(SQWConnInfo *pConn, SExplainExecInfo *execInfo,
int32_t qwBuildAndSendHbRsp(SQWConnInfo *pConn, SSchedulerHbRsp *pStatus, int32_t code) {
int32_t contLen = tSerializeSSchedulerHbRsp(NULL, 0, pStatus);
void *pRsp = rpcMallocCont(contLen);
void * pRsp = rpcMallocCont(contLen);
tSerializeSSchedulerHbRsp(pRsp, contLen, pStatus);
SRpcMsg rpcRsp = {
.msgType = TDMT_VND_QUERY_HEARTBEAT_RSP,
.handle = pConn->handle,
.ahandle = pConn->ahandle,
.refId = pConn->refId,
.pCont = pRsp,
.contLen = contLen,
.code = code,
......@@ -136,6 +136,7 @@ int32_t qwBuildAndSendFetchRsp(SQWConnInfo *pConn, SRetrieveTableRsp *pRsp, int3
.msgType = TDMT_VND_FETCH_RSP,
.handle = pConn->handle,
.ahandle = pConn->ahandle,
.refId = pConn->refId,
.pCont = pRsp,
.contLen = sizeof(*pRsp) + dataLength,
.code = code,
......@@ -154,6 +155,7 @@ int32_t qwBuildAndSendCancelRsp(SQWConnInfo *pConn, int32_t code) {
.msgType = TDMT_VND_CANCEL_TASK_RSP,
.handle = pConn->handle,
.ahandle = pConn->ahandle,
.refId = pConn->refId,
.pCont = pRsp,
.contLen = sizeof(*pRsp),
.code = code,
......@@ -171,6 +173,7 @@ int32_t qwBuildAndSendDropRsp(SQWConnInfo *pConn, int32_t code) {
.msgType = TDMT_VND_DROP_TASK_RSP,
.handle = pConn->handle,
.ahandle = pConn->ahandle,
.refId = pConn->refId,
.pCont = pRsp,
.contLen = sizeof(*pRsp),
.code = code,
......@@ -220,12 +223,13 @@ int32_t qwBuildAndSendShowRsp(SRpcMsg *pMsg, int32_t code) {
showRsp.tableMeta.numOfColumns = cols;
int32_t bufLen = tSerializeSShowRsp(NULL, 0, &showRsp);
void *pBuf = rpcMallocCont(bufLen);
void * pBuf = rpcMallocCont(bufLen);
tSerializeSShowRsp(pBuf, bufLen, &showRsp);
SRpcMsg rpcMsg = {
.handle = pMsg->handle,
.ahandle = pMsg->ahandle,
.refId = pMsg->refId,
.pCont = pBuf,
.contLen = bufLen,
.code = code,
......@@ -235,7 +239,7 @@ int32_t qwBuildAndSendShowRsp(SRpcMsg *pMsg, int32_t code) {
return TSDB_CODE_SUCCESS;
}
int32_t qwBuildAndSendShowFetchRsp(SRpcMsg *pMsg, SVShowTablesFetchReq* pFetchReq) {
int32_t qwBuildAndSendShowFetchRsp(SRpcMsg *pMsg, SVShowTablesFetchReq *pFetchReq) {
SVShowTablesFetchRsp *pRsp = (SVShowTablesFetchRsp *)rpcMallocCont(sizeof(SVShowTablesFetchRsp));
int32_t handle = htonl(pFetchReq->id);
......@@ -243,6 +247,7 @@ int32_t qwBuildAndSendShowFetchRsp(SRpcMsg *pMsg, SVShowTablesFetchReq* pFetchRe
SRpcMsg rpcMsg = {
.handle = pMsg->handle,
.ahandle = pMsg->ahandle,
.refId = pMsg->refId,
.pCont = pRsp,
.contLen = sizeof(*pRsp),
.code = 0,
......@@ -253,7 +258,7 @@ int32_t qwBuildAndSendShowFetchRsp(SRpcMsg *pMsg, SVShowTablesFetchReq* pFetchRe
}
int32_t qwBuildAndSendCQueryMsg(QW_FPARAMS_DEF, SQWConnInfo *pConn) {
SQueryContinueReq * req = (SQueryContinueReq *)rpcMallocCont(sizeof(SQueryContinueReq));
SQueryContinueReq *req = (SQueryContinueReq *)rpcMallocCont(sizeof(SQueryContinueReq));
if (NULL == req) {
QW_SCH_TASK_ELOG("rpcMallocCont %d failed", (int32_t)sizeof(SQueryContinueReq));
QW_ERR_RET(TSDB_CODE_QRY_OUT_OF_MEMORY);
......@@ -268,6 +273,7 @@ int32_t qwBuildAndSendCQueryMsg(QW_FPARAMS_DEF, SQWConnInfo *pConn) {
.handle = pConn->handle,
.ahandle = pConn->ahandle,
.msgType = TDMT_VND_QUERY_CONTINUE,
.refId = pConn->refId,
.pCont = req,
.contLen = sizeof(SQueryContinueReq),
.code = 0,
......@@ -285,9 +291,8 @@ int32_t qwBuildAndSendCQueryMsg(QW_FPARAMS_DEF, SQWConnInfo *pConn) {
return TSDB_CODE_SUCCESS;
}
int32_t qwRegisterBrokenLinkArg(QW_FPARAMS_DEF, SQWConnInfo *pConn) {
STaskDropReq * req = (STaskDropReq *)rpcMallocCont(sizeof(STaskDropReq));
STaskDropReq *req = (STaskDropReq *)rpcMallocCont(sizeof(STaskDropReq));
if (NULL == req) {
QW_SCH_TASK_ELOG("rpcMallocCont %d failed", (int32_t)sizeof(STaskDropReq));
QW_ERR_RET(TSDB_CODE_QRY_OUT_OF_MEMORY);
......@@ -302,6 +307,7 @@ int32_t qwRegisterBrokenLinkArg(QW_FPARAMS_DEF, SQWConnInfo *pConn) {
SRpcMsg pMsg = {
.handle = pConn->handle,
.ahandle = pConn->ahandle,
.refId = pConn->refId,
.msgType = TDMT_VND_DROP_TASK,
.pCont = req,
.contLen = sizeof(STaskDropReq),
......@@ -313,7 +319,6 @@ int32_t qwRegisterBrokenLinkArg(QW_FPARAMS_DEF, SQWConnInfo *pConn) {
return TSDB_CODE_SUCCESS;
}
int32_t qWorkerProcessQueryMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg) {
if (NULL == node || NULL == qWorkerMgmt || NULL == pMsg) {
QW_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT);
......@@ -343,8 +348,9 @@ int32_t qWorkerProcessQueryMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg) {
SQWMsg qwMsg = {.node = node, .msg = msg->msg + msg->sqlLen, .msgLen = msg->phyLen};
qwMsg.connInfo.handle = pMsg->handle;
qwMsg.connInfo.ahandle = pMsg->ahandle;
qwMsg.connInfo.refId = pMsg->refId;
char* sql = strndup(msg->msg, msg->sqlLen);
char *sql = strndup(msg->msg, msg->sqlLen);
QW_SCH_TASK_DLOG("processQuery start, node:%p, handle:%p, sql:%s", node, pMsg->handle, sql);
taosMemoryFreeClear(sql);
......@@ -361,8 +367,8 @@ int32_t qWorkerProcessCQueryMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg) {
bool queryDone = false;
SQueryContinueReq *msg = (SQueryContinueReq *)pMsg->pCont;
bool needStop = false;
SQWTaskCtx *handles = NULL;
SQWorkerMgmt *mgmt = (SQWorkerMgmt *)qWorkerMgmt;
SQWTaskCtx * handles = NULL;
SQWorkerMgmt * mgmt = (SQWorkerMgmt *)qWorkerMgmt;
if (NULL == msg || pMsg->contLen < sizeof(*msg)) {
QW_ELOG("invalid cquery msg, msg:%p, msgLen:%d", msg, pMsg->contLen);
......@@ -377,6 +383,7 @@ int32_t qWorkerProcessCQueryMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg) {
SQWMsg qwMsg = {.node = node, .msg = NULL, .msgLen = 0};
qwMsg.connInfo.handle = pMsg->handle;
qwMsg.connInfo.ahandle = pMsg->ahandle;
qwMsg.connInfo.refId = pMsg->refId;
QW_SCH_TASK_DLOG("processCQuery start, node:%p, handle:%p", node, pMsg->handle);
......@@ -387,7 +394,7 @@ int32_t qWorkerProcessCQueryMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg) {
return TSDB_CODE_SUCCESS;
}
int32_t qWorkerProcessReadyMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg){
int32_t qWorkerProcessReadyMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg) {
if (NULL == node || NULL == qWorkerMgmt || NULL == pMsg) {
return TSDB_CODE_QRY_INVALID_INPUT;
}
......@@ -411,6 +418,7 @@ int32_t qWorkerProcessReadyMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg){
SQWMsg qwMsg = {.node = node, .msg = NULL, .msgLen = 0};
qwMsg.connInfo.handle = pMsg->handle;
qwMsg.connInfo.ahandle = pMsg->ahandle;
qwMsg.connInfo.refId = pMsg->refId;
QW_SCH_TASK_DLOG("processReady start, node:%p, handle:%p", node, pMsg->handle);
......@@ -439,11 +447,11 @@ int32_t qWorkerProcessStatusMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg) {
SSchedulerStatusRsp *sStatus = NULL;
//QW_ERR_JRET(qwGetSchTasksStatus(qWorkerMgmt, msg->sId, &sStatus));
// QW_ERR_JRET(qwGetSchTasksStatus(qWorkerMgmt, msg->sId, &sStatus));
_return:
//QW_ERR_RET(qwBuildAndSendStatusRsp(pMsg, sStatus));
// QW_ERR_RET(qwBuildAndSendStatusRsp(pMsg, sStatus));
return TSDB_CODE_SUCCESS;
}
......@@ -473,6 +481,7 @@ int32_t qWorkerProcessFetchMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg) {
SQWMsg qwMsg = {.node = node, .msg = NULL, .msgLen = 0};
qwMsg.connInfo.handle = pMsg->handle;
qwMsg.connInfo.ahandle = pMsg->ahandle;
qwMsg.connInfo.refId = pMsg->refId;
QW_SCH_TASK_DLOG("processFetch start, node:%p, handle:%p", node, pMsg->handle);
......@@ -493,7 +502,7 @@ int32_t qWorkerProcessCancelMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg) {
return TSDB_CODE_QRY_INVALID_INPUT;
}
SQWorkerMgmt *mgmt = (SQWorkerMgmt *)qWorkerMgmt;
SQWorkerMgmt * mgmt = (SQWorkerMgmt *)qWorkerMgmt;
int32_t code = 0;
STaskCancelReq *msg = pMsg->pCont;
if (NULL == msg || pMsg->contLen < sizeof(*msg)) {
......@@ -514,8 +523,9 @@ int32_t qWorkerProcessCancelMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg) {
SQWMsg qwMsg = {.node = node, .msg = NULL, .msgLen = 0};
qwMsg.connInfo.handle = pMsg->handle;
qwMsg.connInfo.ahandle = pMsg->ahandle;
qwMsg.connInfo.refId = pMsg->refId;
//QW_ERR_JRET(qwCancelTask(qWorkerMgmt, msg->sId, msg->queryId, msg->taskId));
// QW_ERR_JRET(qwCancelTask(qWorkerMgmt, msg->sId, msg->queryId, msg->taskId));
_return:
......@@ -552,6 +562,7 @@ int32_t qWorkerProcessDropMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg) {
SQWMsg qwMsg = {.node = node, .msg = NULL, .msgLen = 0, .code = pMsg->code};
qwMsg.connInfo.handle = pMsg->handle;
qwMsg.connInfo.ahandle = pMsg->ahandle;
qwMsg.connInfo.refId = pMsg->refId;
if (TSDB_CODE_RPC_NETWORK_UNAVAIL == pMsg->code) {
QW_SCH_TASK_DLOG("receive drop task due to network broken, error:%s", tstrerror(pMsg->code));
......@@ -573,7 +584,7 @@ int32_t qWorkerProcessHbMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg) {
int32_t code = 0;
SSchedulerHbReq req = {0};
SQWorkerMgmt *mgmt = (SQWorkerMgmt *)qWorkerMgmt;
SQWorkerMgmt * mgmt = (SQWorkerMgmt *)qWorkerMgmt;
if (NULL == pMsg->pCont) {
QW_ELOG("invalid hb msg, msg:%p, msgLen:%d", pMsg->pCont, pMsg->contLen);
......@@ -590,6 +601,7 @@ int32_t qWorkerProcessHbMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg) {
SQWMsg qwMsg = {.node = node, .msg = NULL, .msgLen = 0};
qwMsg.connInfo.handle = pMsg->handle;
qwMsg.connInfo.ahandle = pMsg->ahandle;
qwMsg.connInfo.refId = pMsg->refId;
QW_SCH_DLOG("processHb start, node:%p, handle:%p", node, pMsg->handle);
......
......@@ -327,6 +327,10 @@ void transQueueClear(STransQueue* queue);
*/
void transQueueDestroy(STransQueue* queue);
/*
* init global func
*/
void transThreadOnce();
#ifdef __cplusplus
}
#endif
......
......@@ -16,6 +16,8 @@
#include "transComm.h"
// static TdThreadOnce transModuleInit = PTHREAD_ONCE_INIT;
int transAuthenticateMsg(void* pMsg, int msgLen, void* pAuth, void* pKey) {
T_MD5_CTX context;
int ret = -1;
......@@ -361,5 +363,10 @@ void transQueueDestroy(STransQueue* queue) {
transQueueClear(queue);
taosArrayDestroy(queue->q);
}
// int32_t transGetExHandle() {
// static
//}
// void transThreadOnce() {
// taosThreadOnce(&transModuleInit, );
//}
#endif
......@@ -17,6 +17,10 @@
#include "transComm.h"
static TdThreadOnce transModuleInit = PTHREAD_ONCE_INIT;
static char* notify = "a";
typedef struct {
int notifyCount; //
int init; // init or not
......@@ -97,8 +101,6 @@ typedef struct SExHandle {
SWorkThrdObj* pThrd;
} SExHandle;
static const char* notify = "a";
static void uvAllocConnBufferCb(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf);
static void uvAllocRecvBufferCb(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf);
static void uvOnRecvCb(uv_stream_t* cli, ssize_t nread, const uv_buf_t* buf);
......@@ -138,9 +140,11 @@ static void uvHandleRegister(SSrvMsg* msg, SWorkThrdObj* thrd);
static void (*transAsyncHandle[])(SSrvMsg* msg, SWorkThrdObj* thrd) = {uvHandleResp, uvHandleQuit, uvHandleRelease,
uvHandleRegister};
static int exHandlesMgt;
static int32_t exHandlesMgt;
void uvInitExHandleMgt();
void uvOpenExHandleMgt(int size);
void uvCloseExHandleMgt();
int64_t uvAddExHandle(void* p);
int32_t uvRemoveExHandle(int64_t refId);
int32_t uvReleaseExHandle(int64_t refId);
......@@ -189,18 +193,35 @@ static bool addHandleToAcceptloop(void* arg);
do { \
if (thrd->quit) { \
tTrace("worker thread already quit, ignore msg"); \
goto _return; \
goto _return1; \
} \
} while (0)
#define ASYNC_CHECK_HANDLE(exh1, refId) \
do { \
if (refId != -1) { \
if (refId > 0) { \
tTrace("server handle step1"); \
SExHandle* exh2 = uvAcquireExHandle(refId); \
if (exh2 == NULL || exh1 != exh2) { \
tTrace("server conn %p except, may already freed, ignore msg", exh2 ? exh2->handle : NULL); \
goto _return; \
tTrace("server handle %p except, may already freed, ignore msg, ref1: %" PRIu64 ", ref2 : %" PRIu64 "", exh1, \
exh1->refId, refId); \
tTrace("server handle step2"); \
goto _return1; \
} \
} else if (refId == 0) { \
tTrace("server handle step3"); \
SExHandle* exh2 = uvAcquireExHandle(refId); \
tTrace("server handle %p except, may already freed, ignore msg, ", exh1); \
if (exh2 != NULL && exh1 != exh2) { \
tTrace("server handle step4"); \
tTrace("server handle %p except, may already freed, ignore msg, ", exh1); \
goto _return1; \
} else { \
refId = exh1->refId; \
} \
} else if (refId == -1) { \
tTrace("server handle step5"); \
goto _return2; \
} \
} while (0)
......@@ -269,9 +290,13 @@ static void uvHandleReq(SSrvConn* pConn) {
// 1. server application should not send resp on handle
// 2. once send out data, cli conn released to conn pool immediately
// 3. not mixed with persist
transMsg.handle = (void*)uvAcquireExHandle(pConn->refId);
tTrace("server handle %p conn: %p translated to app, refId: %" PRIu64 "", transMsg.handle, pConn, pConn->refId);
transMsg.refId = pConn->refId;
assert(transMsg.handle != NULL);
if (pHead->noResp == 1) {
// transMsg.refId = -1;
transMsg.refId = -1;
}
uvReleaseExHandle(pConn->refId);
......@@ -444,6 +469,7 @@ static void destroySmsg(SSrvMsg* smsg) {
taosMemoryFree(smsg);
}
static void destroyAllConn(SWorkThrdObj* pThrd) {
tTrace("thread %p destroy all conn ", pThrd);
while (!QUEUE_IS_EMPTY(&pThrd->conn)) {
queue* h = QUEUE_HEAD(&pThrd->conn);
QUEUE_REMOVE(h);
......@@ -477,19 +503,25 @@ void uvWorkerAsyncCb(uv_async_t* handle) {
continue;
}
// release handle to rpc init
if (msg->type == Quit) {
(*transAsyncHandle[msg->type])(msg, pThrd);
continue;
} else {
STransMsg transMsg = msg->msg;
SExHandle* exh1 = transMsg.handle;
int64_t refId = transMsg.refId;
SExHandle* exh2 = uvAcquireExHandle(refId);
if (exh2 == NULL || exh1 != exh2) {
tTrace("server handle %p except msg, ignore it", exh1);
uvReleaseExHandle(refId);
destroySmsg(msg);
continue;
}
msg->pConn = exh1->handle;
(*transAsyncHandle[msg->type])(msg, pThrd);
}
}
}
static void uvWalkCb(uv_handle_t* handle, void* arg) {
if (!uv_is_closing(handle)) {
......@@ -718,7 +750,7 @@ static SSrvConn* createConn(void* hThrd) {
pConn->refId = exh->refId;
transRefSrvHandle(pConn);
tTrace("server conn %p created", pConn);
tTrace("server handle %p, conn %p created, refId: %" PRId64 "", exh, pConn, pConn->refId);
return pConn;
}
......@@ -767,7 +799,8 @@ void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads,
srv->port = port;
uv_loop_init(srv->loop);
uvOpenExHandleMgt(10000);
taosThreadOnce(&transModuleInit, uvInitExHandleMgt);
// uvOpenExHandleMgt(10000);
for (int i = 0; i < srv->numOfThreads; i++) {
SWorkThrdObj* thrd = (SWorkThrdObj*)taosMemoryCalloc(1, sizeof(SWorkThrdObj));
......@@ -813,10 +846,19 @@ End:
transCloseServer(srv);
return NULL;
}
void uvInitExHandleMgt() {
// init exhandle mgt
uvOpenExHandleMgt(10000);
}
void uvOpenExHandleMgt(int size) {
// added into once later
exHandlesMgt = taosOpenRef(size, uvDestoryExHandle);
}
void uvCloseExHandleMgt() {
// close ref
taosCloseRef(exHandlesMgt);
}
int64_t uvAddExHandle(void* p) {
// acquire extern handle
return taosAddRef(exHandlesMgt, p);
......@@ -932,6 +974,8 @@ void transCloseServer(void* arg) {
taosMemoryFree(srv->pipe);
taosMemoryFree(srv);
// uvCloseExHandleMgt();
}
void transRefSrvHandle(void* handle) {
......@@ -955,14 +999,14 @@ void transUnrefSrvHandle(void* handle) {
void transReleaseSrvHandle(void* handle) {
SExHandle* exh = handle;
// TODO(yihaoDeng): not safy here,
int64_t refId = exh->refId;
ASYNC_CHECK_HANDLE(exh, refId);
SWorkThrdObj* pThrd = exh->pThrd;
ASYNC_ERR_JRET(pThrd);
STransMsg tmsg = {.code = 0, .handle = exh, .ahandle = NULL, .refId = exh->refId};
STransMsg tmsg = {.code = 0, .handle = exh, .ahandle = NULL, .refId = refId};
SSrvMsg* srvMsg = taosMemoryCalloc(1, sizeof(SSrvMsg));
srvMsg->msg = tmsg;
......@@ -972,50 +1016,73 @@ void transReleaseSrvHandle(void* handle) {
transSendAsync(pThrd->asyncPool, &srvMsg->q);
uvReleaseExHandle(refId);
return;
_return:
_return1:
uvReleaseExHandle(refId);
return;
_return2:
return;
}
void transSendResponse(const STransMsg* msg) {
SExHandle* exh = msg->handle;
int64_t refId = msg->refId;
ASYNC_CHECK_HANDLE(exh, refId);
STransMsg tmsg = *msg;
tmsg.refId = refId;
SWorkThrdObj* pThrd = exh->pThrd;
ASYNC_ERR_JRET(pThrd);
SSrvMsg* srvMsg = taosMemoryCalloc(1, sizeof(SSrvMsg));
srvMsg->msg = *msg;
srvMsg->msg = tmsg;
srvMsg->type = Normal;
tTrace("server conn %p start to send resp (1/2)", exh->handle);
transSendAsync(pThrd->asyncPool, &srvMsg->q);
uvReleaseExHandle(refId);
return;
_return:
_return1:
rpcFreeCont(msg->pCont);
uvReleaseExHandle(refId);
return;
_return2:
rpcFreeCont(msg->pCont);
return;
}
void transRegisterMsg(const STransMsg* msg) {
SExHandle* exh = NULL;
SExHandle* exh = msg->handle;
int64_t refId = msg->refId;
ASYNC_CHECK_HANDLE(exh, refId);
STransMsg tmsg = *msg;
tmsg.refId = refId;
SWorkThrdObj* pThrd = exh->pThrd;
ASYNC_ERR_JRET(pThrd);
SSrvMsg* srvMsg = taosMemoryCalloc(1, sizeof(SSrvMsg));
srvMsg->msg = *msg;
srvMsg->msg = tmsg;
srvMsg->type = Register;
tTrace("server conn %p start to register brokenlink callback", exh->handle);
transSendAsync(pThrd->asyncPool, &srvMsg->q);
uvReleaseExHandle(refId);
return;
_return:
_return1:
rpcFreeCont(msg->pCont);
uvReleaseExHandle(refId);
return;
_return2:
rpcFreeCont(msg->pCont);
}
int transGetConnInfo(void* thandle, STransHandleInfo* pInfo) {
if (thandle == NULL) {
tTrace("invalid handle %p, failed to Get Conn info", thandle);
return -1;
}
SExHandle* ex = thandle;
SSrvConn* pConn = ex->handle;
struct sockaddr_in addr = pConn->addr;
struct sockaddr_in addr = pConn->addr;
pInfo->clientIp = (uint32_t)(addr.sin_addr.s_addr);
pInfo->clientPort = ntohs(addr.sin_port);
tstrncpy(pInfo->user, pConn->user, sizeof(pInfo->user));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册