提交 78d9ffd7 编写于 作者: S slguan

#1177

上级 2abbf436
......@@ -7,6 +7,7 @@ ADD_SUBDIRECTORY(rpc)
ADD_SUBDIRECTORY(client)
ADD_SUBDIRECTORY(kit)
ADD_SUBDIRECTORY(modules)
ADD_SUBDIRECTORY(sdb)
ADD_SUBDIRECTORY(mnode)
ADD_SUBDIRECTORY(dnode)
ADD_SUBDIRECTORY(vnode)
......
......@@ -21,14 +21,7 @@ extern "C" {
#endif
#include "tsched.h"
typedef struct {
char id[20];
char sid;
void *thandle;
int mgmtIndex;
char status; // 0:offline, 1:online
} SMgmtObj;
#include "dnode.h"
int vnodeProcessCreateMeterRequest(char *pMsg, int msgLen, SMgmtObj *pMgmtObj);
int vnodeProcessRemoveMeterRequest(char *pMsg, int msgLen, SMgmtObj *pMgmtObj);
......@@ -37,24 +30,6 @@ void dnodeDistributeMsgFromMgmt(char *content, int msgLen, int msgType, SMgmtObj
void mgmtProcessMsgFromDnodeSpec(SSchedMsg *sched);
extern void *dmQhandle;
extern char *(*taosBuildRspMsgToMnodeWithSize)(SMgmtObj *pObj, char type, int size);
extern char *(*taosBuildReqMsgToMnodeWithSize)(SMgmtObj *pObj, char type, int size);
extern char *(*taosBuildRspMsgToMnode)(SMgmtObj *pObj, char type);
extern char *(*taosBuildReqMsgToMnode)(SMgmtObj *pObj, char type);
extern int (*taosSendMsgToMnode)(SMgmtObj *pObj, char *msg, int msgLen);
extern int (*taosSendSimpleRspToMnode)(SMgmtObj *pObj, char rsptype, char code);
extern void (*dnodeInitMgmtIp)();
extern int (*dnodeInitMgmtConn)();
char *taosBuildRspMsgToMnodeWithSizeEdgeImp(SMgmtObj *pObj, char type, int size);
char *taosBuildReqMsgToMnodeWithSizeEdgeImp(SMgmtObj *pObj, char type, int size);
char *taosBuildRspMsgToMnodeEdgeImp(SMgmtObj *pObj, char type);
char *taosBuildReqMsgToMnodeEdgeImp(SMgmtObj *pObj, char type);
int taosSendMsgToMnodeEdgeImp(SMgmtObj *pObj, char *msg, int msgLen);
int taosSendSimpleRspToMnodeEdgeImp(SMgmtObj *pObj, char rsptype, char code);
void dnodeInitMgmtIpEdgeImp();
void* dnodeProcessMsgFromMgmtEdgeImp(SSchedMsg *sched);
int dnodeInitMgmtConnEdgeImp();
#ifdef __cplusplus
}
......
/*
* 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 TDENGINE_DNODE_SERVICE_H
#define TDENGINE_DNODE_SERVICE_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif
......@@ -17,6 +17,7 @@
#include "os.h"
#include "dnode.h"
#include "dnodeSystem.h"
#include "dnodeMgmt.h"
......@@ -43,17 +44,7 @@ void vnodeUpdateHeadFile(int vnode, int oldTables, int newTables);
void vnodeOpenVnode(int vnode);
void vnodeCleanUpOneVnode(int vnode);
char *(*taosBuildRspMsgToMnodeWithSize)(SMgmtObj *pObj, char type, int size) = NULL;
char *(*taosBuildReqMsgToMnodeWithSize)(SMgmtObj *pObj, char type, int size) = NULL;
char *(*taosBuildRspMsgToMnode)(SMgmtObj *pObj, char type) = NULL;
char *(*taosBuildReqMsgToMnode)(SMgmtObj *pObj, char type) = NULL;
int (*taosSendMsgToMnode)(SMgmtObj *pObj, char *msg, int msgLen) = NULL;
int (*taosSendSimpleRspToMnode)(SMgmtObj *pObj, char rsptype, char code) = NULL;
void (*dnodeInitMgmtIp)() = NULL;
int (*dnodeInitMgmtConn)() = NULL;
char *taosBuildRspMsgToMnodeWithSizeEdgeImp(SMgmtObj *pObj, char type, int size) {
char *taosBuildRspMsgToMnodeWithSizeImp(SMgmtObj *pObj, char type, int size) {
char *pStart = (char *)malloc(size);
if (pStart == NULL) {
return NULL;
......@@ -62,8 +53,9 @@ char *taosBuildRspMsgToMnodeWithSizeEdgeImp(SMgmtObj *pObj, char type, int size)
*pStart = type;
return pStart + 1;
}
char *(*taosBuildRspMsgToMnodeWithSize)(SMgmtObj *pObj, char type, int size) = taosBuildRspMsgToMnodeWithSizeImp;
char *taosBuildReqMsgToMnodeWithSizeEdgeImp(SMgmtObj *pObj, char type, int size) {
char *taosBuildReqMsgToMnodeWithSizeImp(SMgmtObj *pObj, char type, int size) {
char *pStart = (char *)malloc(size);
if (pStart == NULL) {
return NULL;
......@@ -72,16 +64,19 @@ char *taosBuildReqMsgToMnodeWithSizeEdgeImp(SMgmtObj *pObj, char type, int size)
*pStart = type;
return pStart + 1;
}
char *(*taosBuildReqMsgToMnodeWithSize)(SMgmtObj *pObj, char type, int size) = taosBuildReqMsgToMnodeWithSizeImp;
char *taosBuildRspMsgToMnodeEdgeImp(SMgmtObj *pObj, char type) {
return taosBuildRspMsgToMnodeWithSize(pObj, type, 256);
char *taosBuildRspMsgToMnodeImp(SMgmtObj *pObj, char type) {
return taosBuildRspMsgToMnodeWithSizeImp(pObj, type, 256);
}
char *(*taosBuildRspMsgToMnode)(SMgmtObj *pObj, char type) = taosBuildRspMsgToMnodeImp;
char *taosBuildReqMsgToMnodeEdgeImp(SMgmtObj *pObj, char type) {
return taosBuildReqMsgToMnodeWithSize(pObj, type, 256);
char *taosBuildReqMsgToMnodeImp(SMgmtObj *pObj, char type) {
return taosBuildReqMsgToMnodeWithSizeImp(pObj, type, 256);
}
char *(*taosBuildReqMsgToMnode)(SMgmtObj *pObj, char type) = taosBuildReqMsgToMnodeImp;
int taosSendMsgToMnodeEdgeImp(SMgmtObj *pObj, char *msg, int msgLen) {
int taosSendMsgToMnodeImp(SMgmtObj *pObj, char *msg, int msgLen) {
dTrace("msg:%s is sent to mnode", taosMsg[(uint8_t)(*(msg-1))]);
/*
......@@ -96,8 +91,9 @@ int taosSendMsgToMnodeEdgeImp(SMgmtObj *pObj, char *msg, int msgLen) {
return 0;
}
int (*taosSendMsgToMnode)(SMgmtObj *pObj, char *msg, int msgLen) = taosSendMsgToMnodeImp;
int taosSendSimpleRspToMnodeEdgeImp(SMgmtObj *pObj, char rsptype, char code) {
int taosSendSimpleRspToMnodeImp(SMgmtObj *pObj, char rsptype, char code) {
char *pStart = taosBuildRspMsgToMnode(0, rsptype);
if (pStart == NULL) {
return 0;
......@@ -108,8 +104,15 @@ int taosSendSimpleRspToMnodeEdgeImp(SMgmtObj *pObj, char rsptype, char code) {
return 0;
}
int (*taosSendSimpleRspToMnode)(SMgmtObj *pObj, char rsptype, char code) = taosSendSimpleRspToMnodeImp;
int32_t dnodeInitMgmtImp() { return 0; }
int32_t (*dnodeInitMgmt)() = dnodeInitMgmtImp;
void* dnodeProcessMsgFromMgmtEdgeImp(SSchedMsg *sched) {
void dnodeInitMgmtIpImp() {}
void (*dnodeInitMgmtIp)() = dnodeInitMgmtIpImp;
void* dnodeProcessMsgFromMgmtImp(SSchedMsg *sched) {
char msgType = *sched->msg;
char *content = sched->msg + 1;
......@@ -122,13 +125,6 @@ void* dnodeProcessMsgFromMgmtEdgeImp(SSchedMsg *sched) {
return NULL;
}
int dnodeInitMgmtConnEdgeImp() {
return 0;
}
void dnodeInitMgmtIpEdgeImp() {}
void dnodeDistributeMsgFromMgmt(char *content, int msgLen, int msgType, SMgmtObj *pObj) {
if (msgType == TSDB_MSG_TYPE_CREATE) {
vnodeProcessCreateMeterRequest(content, msgLen, pObj);
......
......@@ -23,9 +23,6 @@
#include "httpSystem.h"
#include "mgmtSystem.h"
#include "dcluster.h"
#include "mstorage.h"
SModule tsModule[TSDB_MOD_MAX] = {0};
uint32_t tsModuleStatus = 0;
......
......@@ -36,7 +36,7 @@
mnodeAccountInit();
mnodeBalanceInit();
mnodeClusterInit();
mnodeReplicaInit();
sdbReplicaInit();
multilevelStorageInit();
vnodeClusterInit();
vnodeReplicaInit();
......
......@@ -21,7 +21,6 @@
#include "dnode.h"
#include "dnodeMgmt.h"
#include "dnodeModule.h"
#include "dnodeService.h"
#include "dnodeSystem.h"
#include "monitorSystem.h"
#include "httpSystem.h"
......@@ -43,14 +42,10 @@ void * queryQhandle;
int tsVnodePeers = TSDB_VNODES_SUPPORT - 1;
int tsMaxQueues;
uint32_t tsRebootTime;
int (*dnodeInitStorage)() = NULL;
void (*dnodeCleanupStorage)() = NULL;
int (*dnodeCheckSystem)() = NULL;
int32_t dnodeInitRpcQHandle();
int32_t dnodeInitQueryQHandle();
int32_t dnodeInitTmrCtl();
void dnodeInitPlugin();
void dnodeCountRequestImp(SCountInfo *info);
void dnodeCleanUpSystem() {
......@@ -89,8 +84,6 @@ int dnodeInitSystem() {
char temp[128];
struct stat dirstat;
dnodeInitPlugin();
taosResolveCRC();
tsRebootTime = taosGetTimestampSec();
......@@ -170,7 +163,7 @@ int dnodeInitSystem() {
return -1;
}
if (dnodeInitMgmtConn() < 0) {
if (dnodeInitMgmt() < 0) {
dError("failed to init communication to mgmt");
return -1;
}
......@@ -208,7 +201,7 @@ void dnodeCountRequestImp(SCountInfo *info) {
info->insertReqNum = atomic_exchange_32(&vnodeInsertReqNum, 0);
}
int dnodeInitStorageComImp() {
int dnodeInitStorageImp() {
struct stat dirstat;
strcpy(tsDirectory, dataDir);
if (stat(dataDir, &dirstat) < 0) {
......@@ -229,8 +222,10 @@ int dnodeInitStorageComImp() {
return 0;
}
int32_t (*dnodeInitStorage)() = dnodeInitStorageImp;
void dnodeCleanupStorageComImp() {}
void dnodeCleanupStorageImp() {}
void (*dnodeCleanupStorage)() = dnodeCleanupStorageImp;
int32_t dnodeInitQueryQHandle() {
int numOfThreads = tsRatioOfQueryThreads * tsNumOfCores * tsNumOfThreadsPerCore;
......@@ -271,24 +266,7 @@ int32_t dnodeInitRpcQHandle() {
}
int dnodeCheckSystemComImp() {
return 0;
}
void dnodeInitPlugin() {
dnodeInitMgmtConn = dnodeInitMgmtConnEdgeImp;
dnodeInitMgmtIp = dnodeInitMgmtIpEdgeImp;
taosBuildRspMsgToMnodeWithSize = taosBuildRspMsgToMnodeWithSizeEdgeImp;
taosBuildReqMsgToMnodeWithSize = taosBuildReqMsgToMnodeWithSizeEdgeImp;
taosBuildRspMsgToMnode = taosBuildRspMsgToMnodeEdgeImp;
taosBuildReqMsgToMnode = taosBuildReqMsgToMnodeEdgeImp;
taosSendMsgToMnode = taosSendMsgToMnodeEdgeImp;
taosSendSimpleRspToMnode = taosSendSimpleRspToMnodeEdgeImp;
dnodeCheckSystem = dnodeCheckSystemComImp;
dnodeInitStorage = dnodeInitStorageComImp;
dnodeCleanupStorage = dnodeCleanupStorageComImp;
}
int dnodeCheckSystemImp() { return 0; }
int (*dnodeCheckSystem)() = dnodeCheckSystemImp;
......@@ -23,12 +23,30 @@ extern "C" {
#include <stdint.h>
#include <pthread.h>
typedef struct {
char id[20];
char sid;
void *thandle;
int mgmtIndex;
char status; // 0:offline, 1:online
} SMgmtObj;
// global variables
extern pthread_mutex_t dmutex;
// dnodeCluster
extern void (*dnodeStartModules)();
extern void (*dnodeParseParameterK)();
extern int32_t (*dnodeCheckSystem)();
extern char *(*taosBuildRspMsgToMnodeWithSize)(SMgmtObj *pObj, char type, int size);
extern char *(*taosBuildReqMsgToMnodeWithSize)(SMgmtObj *pObj, char type, int size);
extern char *(*taosBuildRspMsgToMnode)(SMgmtObj *pObj, char type);
extern char *(*taosBuildReqMsgToMnode)(SMgmtObj *pObj, char type);
extern int (*taosSendMsgToMnode)(SMgmtObj *pObj, char *msg, int msgLen);
extern int (*taosSendSimpleRspToMnode)(SMgmtObj *pObj, char rsptype, char code);
extern void (*dnodeInitMgmtIp)();
extern int (*dnodeInitMgmt)();
// multilevelStorage
extern int32_t (*dnodeInitStorage)();
......
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(TDengine)
ADD_SUBDIRECTORY(sdb)
ADD_SUBDIRECTORY(detail)
ADD_SUBDIRECTORY(lite)
\ No newline at end of file
......@@ -28,7 +28,7 @@
extern void *dmQhandle;
void * mgmtStatusTimer = NULL;
void mgmtProcessMsgFromDnode(char *content, int msgLen, int msgType, SDnodeObj *pObj);
void* dnodeProcessMsgFromMgmtEdgeImp(SSchedMsg *sched);
void* dnodeProcessMsgFromMgmtImp(SSchedMsg *sched);
char *taosBuildRspMsgToDnodeWithSize(SDnodeObj *pObj, char type, int size) {
char *pStart = (char *)malloc(size);
......@@ -67,7 +67,7 @@ int taosSendMsgToDnode(SDnodeObj *pObj, char *msg, int msgLen) {
* Lite version has no message header, so minus one
*/
SSchedMsg schedMsg;
schedMsg.fp = dnodeProcessMsgFromMgmtEdgeImp;
schedMsg.fp = dnodeProcessMsgFromMgmtImp;
schedMsg.msg = msg - 1;
schedMsg.ahandle = NULL;
schedMsg.thandle = NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册