add qnode snode bnode

This commit is contained in:
Shengliang Guan 2021-12-27 02:43:27 -08:00
parent 08e32652b7
commit b63266b05e
22 changed files with 654 additions and 35 deletions

View File

@ -0,0 +1,86 @@
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_BNODE_H_
#define _TD_BNODE_H_
#ifdef __cplusplus
extern "C" {
#endif
/* ------------------------ TYPES EXPOSED ------------------------ */
typedef struct SDnode SDnode;
typedef struct SBnode SBnode;
typedef void (*SendMsgToDnodeFp)(SDnode *pDnode, struct SEpSet *epSet, struct SRpcMsg *rpcMsg);
typedef void (*SendMsgToMnodeFp)(SDnode *pDnode, struct SRpcMsg *rpcMsg);
typedef void (*SendRedirectMsgFp)(SDnode *pDnode, struct SRpcMsg *rpcMsg);
typedef struct {
int64_t numOfErrors;
} SBnodeLoad;
typedef struct {
int32_t sver;
} SBnodeCfg;
typedef struct {
int32_t dnodeId;
int64_t clusterId;
SBnodeCfg cfg;
SDnode *pDnode;
SendMsgToDnodeFp sendMsgToDnodeFp;
SendMsgToMnodeFp sendMsgToMnodeFp;
SendRedirectMsgFp sendRedirectMsgFp;
} SBnodeOpt;
/* ------------------------ SBnode ------------------------ */
/**
* @brief Start one Bnode in Dnode.
*
* @param pOption Option of the bnode.
* @return SBnode* The bnode object.
*/
SBnode *bndOpen(const SBnodeOpt *pOption);
/**
* @brief Stop Bnode in Dnode.
*
* @param pBnode The bnode object to close.
*/
void bndClose(SBnode *pBnode);
/**
* @brief Get the statistical information of Bnode
*
* @param pBnode The bnode object.
* @param pLoad Statistics of the bnode.
* @return int32_t 0 for success, -1 for failure.
*/
int32_t bndGetLoad(SBnode *pBnode, SBnodeLoad *pLoad);
/**
* @brief Process a query message.
*
* @param pBnode The bnode object.
* @param pMsgs The array of SRpcMsg
* @return int32_t 0 for success, -1 for failure
*/
int32_t bndProcessWMsgs(SBnode *pBnode, SArray *pMsgs);
#ifdef __cplusplus
}
#endif
#endif /*_TD_BNODE_H_*/

View File

@ -29,6 +29,7 @@ typedef struct {
int32_t sver; int32_t sver;
int16_t numOfCores; int16_t numOfCores;
int16_t numOfSupportVnodes; int16_t numOfSupportVnodes;
int16_t numOfCommitThreads;
int8_t enableTelem; int8_t enableTelem;
int32_t statusInterval; int32_t statusInterval;
float numOfThreadsPerCore; float numOfThreadsPerCore;

View File

@ -19,52 +19,83 @@
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#include "trpc.h"
/* ------------------------ TYPES EXPOSED ------------------------ */
typedef struct SDnode SDnode;
typedef struct SQnode SQnode;
typedef void (*SendMsgToDnodeFp)(SDnode *pDnode, struct SEpSet *epSet, struct SRpcMsg *rpcMsg);
typedef void (*SendMsgToMnodeFp)(SDnode *pDnode, struct SRpcMsg *rpcMsg);
typedef void (*SendRedirectMsgFp)(SDnode *pDnode, struct SRpcMsg *rpcMsg);
typedef struct { typedef struct {
uint64_t numOfStartTask; int64_t numOfStartTask;
uint64_t numOfStopTask; int64_t numOfStopTask;
uint64_t numOfRecvedFetch; int64_t numOfRecvedFetch;
uint64_t numOfSentHb; int64_t numOfSentHb;
uint64_t numOfSentFetch; int64_t numOfSentFetch;
uint64_t numOfTaskInQueue; int64_t numOfTaskInQueue;
uint64_t numOfFetchInQueue; int64_t numOfFetchInQueue;
uint64_t numOfErrors; int64_t numOfErrors;
} SQnodeStat; } SQnodeLoad;
typedef struct {
int32_t sver;
} SQnodeCfg;
typedef struct {
int32_t dnodeId;
int64_t clusterId;
SQnodeCfg cfg;
SDnode *pDnode;
SendMsgToDnodeFp sendMsgToDnodeFp;
SendMsgToMnodeFp sendMsgToMnodeFp;
SendRedirectMsgFp sendRedirectMsgFp;
} SQnodeOpt;
/* ------------------------ SQnode ------------------------ */
/** /**
* Start one Qnode in Dnode. * @brief Start one Qnode in Dnode.
* @return Error Code.
*/
int32_t qnodeStart();
/**
* Stop Qnode in Dnode.
* *
* @param qnodeId Qnode ID to stop, -1 for all Qnodes. * @param pOption Option of the qnode.
* @return SQnode* The qnode object.
*/ */
void qnodeStop(int64_t qnodeId); SQnode *qndOpen(const SQnodeOpt *pOption);
/** /**
* Get the statistical information of Qnode * @brief Stop Qnode in Dnode.
* *
* @param qnodeId Qnode ID to get statistics, -1 for all * @param pQnode The qnode object to close.
* @param stat Statistical information.
* @return Error Code.
*/ */
int32_t qnodeGetStatistics(int64_t qnodeId, SQnodeStat *stat); void qndClose(SQnode *pQnode);
/** /**
* Interface for processing Qnode messages. * @brief Get the statistical information of Qnode
* *
* @param pMsg Message to be processed. * @param pQnode The qnode object.
* @return Error code * @param pLoad Statistics of the qnode.
* @return int32_t 0 for success, -1 for failure.
*/ */
void qnodeProcessReq(SRpcMsg *pMsg); int32_t qndGetLoad(SQnode *pQnode, SQnodeLoad *pLoad);
/**
* @brief Process a query message.
*
* @param pQnode The qnode object.
* @param pMsg The request message
* @param pRsp The response message
* @return int32_t 0 for success, -1 for failure
*/
int32_t qndProcessQueryReq(SQnode *pQnode, SRpcMsg *pMsg, SRpcMsg **pRsp);
/**
* @brief Process a fetch message.
*
* @param pQnode The qnode object.
* @param pMsg The request message
* @param pRsp The response message
* @return int32_t 0 for success, -1 for failure
*/
int32_t qndProcessFetchReq(SQnode *pQnode, SRpcMsg *pMsg, SRpcMsg **pRsp);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -0,0 +1,87 @@
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_SNODE_H_
#define _TD_SNODE_H_
#ifdef __cplusplus
extern "C" {
#endif
/* ------------------------ TYPES EXPOSED ------------------------ */
typedef struct SDnode SDnode;
typedef struct SSnode SSnode;
typedef void (*SendMsgToDnodeFp)(SDnode *pDnode, struct SEpSet *epSet, struct SRpcMsg *rpcMsg);
typedef void (*SendMsgToMnodeFp)(SDnode *pDnode, struct SRpcMsg *rpcMsg);
typedef void (*SendRedirectMsgFp)(SDnode *pDnode, struct SRpcMsg *rpcMsg);
typedef struct {
int64_t numOfErrors;
} SSnodeLoad;
typedef struct {
int32_t sver;
} SSnodeCfg;
typedef struct {
int32_t dnodeId;
int64_t clusterId;
SSnodeCfg cfg;
SDnode *pDnode;
SendMsgToDnodeFp sendMsgToDnodeFp;
SendMsgToMnodeFp sendMsgToMnodeFp;
SendRedirectMsgFp sendRedirectMsgFp;
} SSnodeOpt;
/* ------------------------ SSnode ------------------------ */
/**
* @brief Start one Snode in Dnode.
*
* @param pOption Option of the snode.
* @return SSnode* The snode object.
*/
SSnode *sndOpen(const SSnodeOpt *pOption);
/**
* @brief Stop Snode in Dnode.
*
* @param pSnode The snode object to close.
*/
void sndClose(SSnode *pSnode);
/**
* @brief Get the statistical information of Snode
*
* @param pSnode The snode object.
* @param pLoad Statistics of the snode.
* @return int32_t 0 for success, -1 for failure.
*/
int32_t sndGetLoad(SSnode *pSnode, SSnodeLoad *pLoad);
/**
* @brief Process a query message.
*
* @param pSnode The snode object.
* @param pMsg The request message
* @param pRsp The response message
* @return int32_t 0 for success, -1 for failure
*/
int32_t sndProcessWriteMsg(SSnode *pSnode, SRpcMsg *pMsg, SRpcMsg **pRsp);
#ifdef __cplusplus
}
#endif
#endif /*_TD_SNODE_H_*/

View File

@ -1,4 +1,6 @@
add_subdirectory(mnode) add_subdirectory(mnode)
add_subdirectory(vnode) add_subdirectory(vnode)
add_subdirectory(qnode) add_subdirectory(qnode)
add_subdirectory(snode)
add_subdirectory(bnode)
add_subdirectory(mgmt) add_subdirectory(mgmt)

View File

@ -0,0 +1,14 @@
aux_source_directory(src BNODE_SRC)
add_library(bnode ${BNODE_SRC})
target_include_directories(
bnode
PUBLIC "${CMAKE_SOURCE_DIR}/include/dnode/bnode"
private "${CMAKE_CURRENT_SOURCE_DIR}/inc"
)
target_link_libraries(
bnode
PRIVATE transport
PRIVATE os
PRIVATE common
PRIVATE util
)

View File

@ -0,0 +1,45 @@
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_BNODE_INT_H_
#define _TD_BNODE_INT_H_
#include "os.h"
#include "tarray.h"
#include "tlog.h"
#include "tmsg.h"
#include "trpc.h"
#include "bnode.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct SBnode {
int32_t dnodeId;
int64_t clusterId;
SBnodeCfg cfg;
SendMsgToDnodeFp sendMsgToDnodeFp;
SendMsgToMnodeFp sendMsgToMnodeFp;
SendRedirectMsgFp sendRedirectMsgFp;
} SBnode;
#ifdef __cplusplus
}
#endif
#endif /*_TD_BNODE_INT_H_*/

View File

@ -0,0 +1,27 @@
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "bndInt.h"
SBnode *bndOpen(const SBnodeOpt *pOption) {
SBnode *pBnode = calloc(1, sizeof(SBnode));
return pBnode;
}
void bndClose(SBnode *pBnode) { free(pBnode); }
int32_t bndGetLoad(SBnode *pBnode, SBnodeLoad *pLoad) { return 0; }
int32_t bndProcessWMsgs(SBnode *pBnode, SArray *pMsgs) { return 0; }

View File

@ -140,6 +140,7 @@ void dmnInitOption(SDnodeOpt *pOption) {
pOption->sver = 30000000; //3.0.0.0 pOption->sver = 30000000; //3.0.0.0
pOption->numOfCores = tsNumOfCores; pOption->numOfCores = tsNumOfCores;
pOption->numOfSupportVnodes = 1; pOption->numOfSupportVnodes = 1;
pOption->numOfCommitThreads = 1;
pOption->statusInterval = tsStatusInterval; pOption->statusInterval = tsStatusInterval;
pOption->numOfThreadsPerCore = tsNumOfThreadsPerCore; pOption->numOfThreadsPerCore = tsNumOfThreadsPerCore;
pOption->ratioOfQueryCores = tsRatioOfQueryCores; pOption->ratioOfQueryCores = tsRatioOfQueryCores;

View File

@ -5,6 +5,9 @@ target_link_libraries(
PUBLIC cjson PUBLIC cjson
PUBLIC mnode PUBLIC mnode
PUBLIC vnode PUBLIC vnode
PUBLIC qnode
PUBLIC snode
PUBLIC bnode
PUBLIC wal PUBLIC wal
PUBLIC sync PUBLIC sync
PUBLIC taos PUBLIC taos

View File

@ -0,0 +1,35 @@
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_DND_BNODE_H_
#define _TD_DND_BNODE_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "dndInt.h"
int32_t dndInitBnode(SDnode *pDnode);
void dndCleanupBnode(SDnode *pDnode);
ioid dndProcessBnodeWriteMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet);
int32_t dndProcessCreateBnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg);
int32_t dndProcessDropBnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg);
#ifdef __cplusplus
}
#endif
#endif /*_TD_DND_BNODE_H_*/

View File

@ -20,8 +20,11 @@
extern "C" { extern "C" {
#endif #endif
#include "cJSON.h"
#include "os.h" #include "os.h"
#include "cJSON.h"
#include "tcache.h"
#include "tcrc32c.h"
#include "tep.h" #include "tep.h"
#include "thash.h" #include "thash.h"
#include "tlockfree.h" #include "tlockfree.h"
@ -34,7 +37,11 @@ extern "C" {
#include "tworker.h" #include "tworker.h"
#include "dnode.h" #include "dnode.h"
#include "bnode.h"
#include "mnode.h" #include "mnode.h"
#include "qnode.h"
#include "snode.h"
#include "vnode.h" #include "vnode.h"
extern int32_t dDebugFlag; extern int32_t dDebugFlag;
@ -93,6 +100,41 @@ typedef struct {
SWorkerPool syncPool; SWorkerPool syncPool;
} SMnodeMgmt; } SMnodeMgmt;
typedef struct {
int32_t refCount;
int8_t deployed;
int8_t dropped;
char *file;
SQnode *pQnode;
SRWLatch latch;
taos_queue pQueryQ;
taos_queue pFetchQ;
SWorkerPool queryPool;
SWorkerPool fetchPool;
} SQnodeMgmt;
typedef struct {
int32_t refCount;
int8_t deployed;
int8_t dropped;
char *file;
SSnode *pSnode;
SRWLatch latch;
taos_queue pWriteQ;
SWorkerPool writePool;
} SSnodeMgmt;
typedef struct {
int32_t refCount;
int8_t deployed;
int8_t dropped;
char *file;
SBnode *pBnode;
SRWLatch latch;
taos_queue pWriteQ;
SMWorkerPool writePool;
} SBnodeMgmt;
typedef struct { typedef struct {
SHashObj *hash; SHashObj *hash;
int32_t openVnodes; int32_t openVnodes;
@ -117,6 +159,9 @@ typedef struct SDnode {
FileFd lockFd; FileFd lockFd;
SDnodeMgmt dmgmt; SDnodeMgmt dmgmt;
SMnodeMgmt mmgmt; SMnodeMgmt mmgmt;
SQnodeMgmt qmgmt;
SSnodeMgmt smgmt;
SBnodeMgmt bmgmt;
SVnodesMgmt vmgmt; SVnodesMgmt vmgmt;
STransMgmt tmgmt; STransMgmt tmgmt;
SStartupMsg startup; SStartupMsg startup;

View File

@ -0,0 +1,36 @@
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_DND_QNODE_H_
#define _TD_DND_QNODE_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "dndInt.h"
int32_t dndInitQnode(SDnode *pDnode);
void dndCleanupQnode(SDnode *pDnode);
ioid dndProcessQnodeQueryMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet);
void dndProcessQnodeFetchMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet);
int32_t dndProcessCreateQnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg);
int32_t dndProcessDropQnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg);
#ifdef __cplusplus
}
#endif
#endif /*_TD_DND_QNODE_H_*/

View File

@ -0,0 +1,35 @@
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_DND_SNODE_H_
#define _TD_DND_SNODE_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "dndInt.h"
int32_t dndInitSnode(SDnode *pDnode);
void dndCleanupSnode(SDnode *pDnode);
void dndProcessSnodeWriteMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet);
int32_t dndProcessCreateSnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg);
int32_t dndProcessDropSnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg);
#ifdef __cplusplus
}
#endif
#endif /*_TD_DND_SNODE_H_*/

View File

@ -19,8 +19,6 @@
#include "dndTransport.h" #include "dndTransport.h"
#include "dndVnodes.h" #include "dndVnodes.h"
#include "sync.h" #include "sync.h"
#include "tcache.h"
#include "tcrc32c.h"
#include "wal.h" #include "wal.h"
EStat dndGetStat(SDnode *pDnode) { return pDnode->stat; } EStat dndGetStat(SDnode *pDnode) { return pDnode->stat; }
@ -93,6 +91,15 @@ static int32_t dndInitEnv(SDnode *pDnode, SDnodeOpt *pOption) {
snprintf(path, sizeof(path), "%s%sdnode", pOption->dataDir, TD_DIRSEP); snprintf(path, sizeof(path), "%s%sdnode", pOption->dataDir, TD_DIRSEP);
pDnode->dir.dnode = tstrdup(path); pDnode->dir.dnode = tstrdup(path);
snprintf(path, sizeof(path), "%s%sqnode", pOption->dataDir, TD_DIRSEP);
pDnode->dir.dnode = tstrdup(path);
snprintf(path, sizeof(path), "%s%ssnode", pOption->dataDir, TD_DIRSEP);
pDnode->dir.dnode = tstrdup(path);
snprintf(path, sizeof(path), "%s%sbnode", pOption->dataDir, TD_DIRSEP);
pDnode->dir.dnode = tstrdup(path);
if (pDnode->dir.mnode == NULL || pDnode->dir.vnodes == NULL || pDnode->dir.dnode == NULL) { if (pDnode->dir.mnode == NULL || pDnode->dir.vnodes == NULL || pDnode->dir.dnode == NULL) {
dError("failed to malloc dir object"); dError("failed to malloc dir object");
terrno = TSDB_CODE_OUT_OF_MEMORY; terrno = TSDB_CODE_OUT_OF_MEMORY;
@ -117,6 +124,24 @@ static int32_t dndInitEnv(SDnode *pDnode, SDnodeOpt *pOption) {
return -1; return -1;
} }
if (taosMkDir(pDnode->dir.qnode) != 0) {
dError("failed to create dir:%s since %s", pDnode->dir.qnode, strerror(errno));
terrno = TAOS_SYSTEM_ERROR(errno);
return -1;
}
if (taosMkDir(pDnode->dir.snode) != 0) {
dError("failed to create dir:%s since %s", pDnode->dir.snode, strerror(errno));
terrno = TAOS_SYSTEM_ERROR(errno);
return -1;
}
if (taosMkDir(pDnode->dir.bnode) != 0) {
dError("failed to create dir:%s since %s", pDnode->dir.bnode, strerror(errno));
terrno = TAOS_SYSTEM_ERROR(errno);
return -1;
}
memcpy(&pDnode->opt, pOption, sizeof(SDnodeOpt)); memcpy(&pDnode->opt, pOption, sizeof(SDnodeOpt));
return 0; return 0;
} }
@ -134,6 +159,18 @@ static void dndCleanupEnv(SDnode *pDnode) {
tfree(pDnode->dir.dnode); tfree(pDnode->dir.dnode);
} }
if (pDnode->dir.qnode != NULL) {
tfree(pDnode->dir.qnode);
}
if (pDnode->dir.bnode != NULL) {
tfree(pDnode->dir.snode);
}
if (pDnode->dir.snode != NULL) {
tfree(pDnode->dir.bnode);
}
if (pDnode->lockFd >= 0) { if (pDnode->lockFd >= 0) {
taosUnLockFile(pDnode->lockFd); taosUnLockFile(pDnode->lockFd);
taosCloseFile(pDnode->lockFd); taosCloseFile(pDnode->lockFd);
@ -176,7 +213,7 @@ SDnode *dndInit(SDnodeOpt *pOption) {
return NULL; return NULL;
} }
if (vnodeInit(1) != 0) { if (vnodeInit(pDnode->opt.numOfCommitThreads) != 0) {
dError("failed to init vnode env"); dError("failed to init vnode env");
dndCleanup(pDnode); dndCleanup(pDnode);
return NULL; return NULL;

View File

@ -27,6 +27,7 @@ SDnodeOpt TestServer::BuildOption(const char* path, const char* fqdn, uint16_t p
option.sver = 1; option.sver = 1;
option.numOfCores = 1; option.numOfCores = 1;
option.numOfSupportVnodes = 1; option.numOfSupportVnodes = 1;
option.numOfCommitThreads = 1;
option.statusInterval = 1; option.statusInterval = 1;
option.numOfThreadsPerCore = 1; option.numOfThreadsPerCore = 1;
option.ratioOfQueryCores = 1; option.ratioOfQueryCores = 1;

View File

@ -4,4 +4,11 @@ target_include_directories(
qnode qnode
PUBLIC "${CMAKE_SOURCE_DIR}/include/dnode/qnode" PUBLIC "${CMAKE_SOURCE_DIR}/include/dnode/qnode"
private "${CMAKE_CURRENT_SOURCE_DIR}/inc" private "${CMAKE_CURRENT_SOURCE_DIR}/inc"
)
target_link_libraries(
qnode
PRIVATE transport
PRIVATE os
PRIVATE common
PRIVATE util
) )

View File

@ -16,10 +16,27 @@
#ifndef _TD_QNODE_INT_H_ #ifndef _TD_QNODE_INT_H_
#define _TD_QNODE_INT_H_ #define _TD_QNODE_INT_H_
#include "os.h"
#include "tlog.h"
#include "tmsg.h"
#include "trpc.h"
#include "qnode.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
typedef struct SQnode {
int32_t dnodeId;
int64_t clusterId;
SQnodeCfg cfg;
SendMsgToDnodeFp sendMsgToDnodeFp;
SendMsgToMnodeFp sendMsgToMnodeFp;
SendRedirectMsgFp sendRedirectMsgFp;
} SQnode;
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -11,4 +11,25 @@
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "qndInt.h"
SQnode *qndOpen(const SQnodeOpt *pOption) {
SQnode *pQnode = calloc(1, sizeof(SQnode));
return pQnode;
}
void qndClose(SQnode *pQnode) { free(pQnode); }
int32_t qndGetLoad(SQnode *pQnode, SQnodeLoad *pLoad) { return 0; }
int32_t qndProcessQueryReq(SQnode *pQnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
*pRsp = NULL;
return 0;
}
int32_t qndProcessFetchReq(SQnode *pQnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
*pRsp = NULL;
return 0;
}

View File

@ -0,0 +1,14 @@
aux_source_directory(src SNODE_SRC)
add_library(snode ${SNODE_SRC})
target_include_directories(
snode
PUBLIC "${CMAKE_SOURCE_DIR}/include/dnode/snode"
private "${CMAKE_CURRENT_SOURCE_DIR}/inc"
)
target_link_libraries(
snode
PRIVATE transport
PRIVATE os
PRIVATE common
PRIVATE util
)

View File

@ -0,0 +1,44 @@
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_SNODE_INT_H_
#define _TD_SNODE_INT_H_
#include "os.h"
#include "tlog.h"
#include "tmsg.h"
#include "trpc.h"
#include "snode.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct SSnode {
int32_t dnodeId;
int64_t clusterId;
SSnodeCfg cfg;
SendMsgToDnodeFp sendMsgToDnodeFp;
SendMsgToMnodeFp sendMsgToMnodeFp;
SendRedirectMsgFp sendRedirectMsgFp;
} SSnode;
#ifdef __cplusplus
}
#endif
#endif /*_TD_SNODE_INT_H_*/

View File

@ -0,0 +1,30 @@
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "sndInt.h"
SSnode *sndOpen(const SSnodeOpt *pOption) {
SSnode *pSnode = calloc(1, sizeof(SSnode));
return pSnode;
}
void sndClose(SSnode *pSnode) { free(pSnode); }
int32_t sndGetLoad(SSnode *pSnode, SSnodeLoad *pLoad) { return 0; }
int32_t sndProcessWriteMsg(SSnode *pSnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
*pRsp = NULL;
return 0;
}