提交 f8d35c2a 编写于 作者: S slguan

fix compile error

上级 a00be5e3
...@@ -68,38 +68,6 @@ void dnodeCleanUpModules() { ...@@ -68,38 +68,6 @@ void dnodeCleanUpModules() {
} }
} }
void dnodeProcessModuleStatus(uint32_t status) {
if (dnodeGetRunStatus() != TSDB_DNODE_RUN_STATUS_RUNING) {
return;
}
int news = status;
int olds = tsModuleStatus;
for (int moduleType = 0; moduleType < TSDB_MOD_MAX; ++moduleType) {
int newStatus = news & (1 << moduleType);
int oldStatus = olds & (1 << moduleType);
if (oldStatus > 0) {
if (newStatus == 0) {
if (tsModule[moduleType].stopFp) {
dPrint("module:%s is stopped on this node", tsModule[moduleType].name);
(*tsModule[moduleType].stopFp)();
}
}
} else if (oldStatus == 0) {
if (newStatus > 0) {
if (tsModule[moduleType].startFp) {
dPrint("module:%s is started on this node", tsModule[moduleType].name);
(*tsModule[moduleType].startFp)();
}
}
} else {
}
}
tsModuleStatus = status;
}
int32_t dnodeInitModules() { int32_t dnodeInitModules() {
for (int mod = 0; mod < TSDB_MOD_MAX; ++mod) { for (int mod = 0; mod < TSDB_MOD_MAX; ++mod) {
if (tsModule[mod].num != 0 && tsModule[mod].initFp) { if (tsModule[mod].num != 0 && tsModule[mod].initFp) {
......
...@@ -33,12 +33,14 @@ ...@@ -33,12 +33,14 @@
#include "dnodeVnodeMgmt.h" #include "dnodeVnodeMgmt.h"
#ifdef CLUSTER #ifdef CLUSTER
//#include "acct.h" #include "account.h"
//#include "admin.h" #include "admin.h"
//#include "cluster.h" #include "balance.h"
//#include "grant.h" #include "cluster.h"
//#include "replica.h" #include "grant.h"
//#include "storage.h" #include "mpeer.h"
#include "storage.h"
#include "vpeer.h"
#endif #endif
static pthread_mutex_t tsDnodeMutex; static pthread_mutex_t tsDnodeMutex;
...@@ -89,8 +91,6 @@ void dnodeCleanUpSystem() { ...@@ -89,8 +91,6 @@ void dnodeCleanUpSystem() {
dnodeSetRunStatus(TSDB_DNODE_RUN_STATUS_STOPPED); dnodeSetRunStatus(TSDB_DNODE_RUN_STATUS_STOPPED);
} }
dnodeCleanupShell(); dnodeCleanupShell();
dnodeCleanUpModules(); dnodeCleanUpModules();
dnodeCleanupVnodes(); dnodeCleanupVnodes();
...@@ -112,7 +112,13 @@ void dnodeCheckDataDirOpenned(const char *dir) { ...@@ -112,7 +112,13 @@ void dnodeCheckDataDirOpenned(const char *dir) {
void dnodeInitPlugins() { void dnodeInitPlugins() {
#ifdef CLUSTER #ifdef CLUSTER
acctInit(); // acctInit();
// adminInit();
// balanceInit();
// clusterInit();
// grantInit();
// mpeerInit();
// storageInit();
#endif #endif
} }
......
...@@ -14,7 +14,7 @@ IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM)) ...@@ -14,7 +14,7 @@ IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM))
TARGET_LINK_LIBRARIES(mnode trpc tutil sdb pthread) TARGET_LINK_LIBRARIES(mnode trpc tutil sdb pthread)
IF (TD_CLUSTER) IF (TD_CLUSTER)
TARGET_LINK_LIBRARIES(mnode acct) TARGET_LINK_LIBRARIES(mnode)
ENDIF () ENDIF ()
ENDIF () ENDIF ()
......
...@@ -24,8 +24,8 @@ extern "C" { ...@@ -24,8 +24,8 @@ extern "C" {
#include <stdbool.h> #include <stdbool.h>
#include "mnode.h" #include "mnode.h"
int32_t mgmtInitMnodes(); int32_t mgmtAddMnode(uint32_t privateIp, uint32_t publicIp);
void mgmtCleanUpMnodes(); int32_t mgmtRemoveMnode(uint32_t privateIp);
int32_t mgmtGetMnodeMeta(STableMeta *pMeta, SShowObj *pShow, void *pConn); int32_t mgmtGetMnodeMeta(STableMeta *pMeta, SShowObj *pShow, void *pConn);
int32_t mgmtRetrieveMnodes(SShowObj *pShow, char *data, int32_t rows, void *pConn); int32_t mgmtRetrieveMnodes(SShowObj *pShow, char *data, int32_t rows, void *pConn);
......
...@@ -77,11 +77,3 @@ int32_t mgmtAllocVnodes(SVgObj *pVgroup) { ...@@ -77,11 +77,3 @@ int32_t mgmtAllocVnodes(SVgObj *pVgroup) {
return 0; return 0;
} }
} }
char *mgmtGetVnodeStatus(SVgObj *pVgroup, SVnodeGid *pVnode) {
if (mgmtGetVnodeStatusFp) {
return (*mgmtGetVnodeStatusFp)(pVgroup, pVnode);
} else {
return "master";
}
}
...@@ -18,11 +18,27 @@ ...@@ -18,11 +18,27 @@
#include "mgmtMnode.h" #include "mgmtMnode.h"
#include "mgmtUser.h" #include "mgmtUser.h"
int32_t (*mgmtInitMnodesFp)() = NULL; int32_t (*mgmtAddMnodeFp)(uint32_t privateIp, uint32_t publicIp) = NULL;
void (*mgmtCleanUpMnodesFp)() = NULL; int32_t (*mgmtRemoveMnodeFp)(uint32_t privateIp) = NULL;
int32_t (*mgmtGetMnodesNumFp)() = NULL; int32_t (*mgmtGetMnodesNumFp)() = NULL;
void * (*mgmtGetNextMnodeFp)(SShowObj *pShow, SSdbPeer **pMnode) = NULL; void * (*mgmtGetNextMnodeFp)(SShowObj *pShow, SSdbPeer **pMnode) = NULL;
int32_t mgmtAddMnode(uint32_t privateIp, uint32_t publicIp) {
if (mgmtAddMnodeFp) {
return (*mgmtAddMnodeFp)(privateIp, publicIp);
} else {
return 0;
}
}
int32_t mgmtRemoveMnode(uint32_t privateIp) {
if (mgmtRemoveMnodeFp) {
return (*mgmtRemoveMnodeFp)(privateIp);
} else {
return 0;
}
}
static int32_t mgmtGetMnodesNum() { static int32_t mgmtGetMnodesNum() {
if (mgmtGetMnodesNumFp) { if (mgmtGetMnodesNumFp) {
return (*mgmtGetMnodesNumFp)(); return (*mgmtGetMnodesNumFp)();
......
...@@ -13,6 +13,6 @@ IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM)) ...@@ -13,6 +13,6 @@ IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM))
TARGET_LINK_LIBRARIES(http taos_static z) TARGET_LINK_LIBRARIES(http taos_static z)
IF (TD_CLUSTER) IF (TD_CLUSTER)
TARGET_LINK_LIBRARIES(http http_admin) TARGET_LINK_LIBRARIES(http)
ENDIF () ENDIF ()
ENDIF () ENDIF ()
...@@ -34,13 +34,21 @@ ...@@ -34,13 +34,21 @@
#include "tgHandle.h" #include "tgHandle.h"
#include "tlog.h" #include "tlog.h"
#ifdef CLUSTER
void adminInitHandle(HttpServer* pServer); void (*adminInitHandleFp)(HttpServer* pServer) = NULL;
void opInitHandle(HttpServer* pServer); void (*opInitHandleFp)(HttpServer* pServer) = NULL;
#else
void adminInitHandle(HttpServer* pServer) {} void adminInitHandle(HttpServer* pServer) {
void opInitHandle(HttpServer* pServer) {} if (adminInitHandleFp) {
#endif (*adminInitHandleFp)(pServer);
}
}
void opInitHandle(HttpServer* pServer) {
if (opInitHandleFp) {
(*opInitHandleFp)(pServer);
}
}
static HttpServer *httpServer = NULL; static HttpServer *httpServer = NULL;
void taosInitNote(int numOfNoteLines, int maxNotes, char* lable); void taosInitNote(int numOfNoteLines, int maxNotes, char* lable);
......
...@@ -11,6 +11,6 @@ IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM)) ...@@ -11,6 +11,6 @@ IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM))
ADD_LIBRARY(sdb ${SRC}) ADD_LIBRARY(sdb ${SRC})
TARGET_LINK_LIBRARIES(sdb trpc) TARGET_LINK_LIBRARIES(sdb trpc)
IF (TD_CLUSTER) IF (TD_CLUSTER)
TARGET_LINK_LIBRARIES(sdb mreplica) TARGET_LINK_LIBRARIES(sdb)
ENDIF() ENDIF()
ENDIF () ENDIF ()
...@@ -84,7 +84,7 @@ typedef struct { ...@@ -84,7 +84,7 @@ typedef struct {
char *row; char *row;
} SSdbUpdate; } SSdbUpdate;
typedef struct { typedef struct _SSdbTable {
SSdbHeader header; SSdbHeader header;
int maxRows; int maxRows;
int dbId; int dbId;
...@@ -132,7 +132,7 @@ extern int sdbMaxPeers; ...@@ -132,7 +132,7 @@ extern int sdbMaxPeers;
extern int sdbNumOfTables; extern int sdbNumOfTables;
extern int64_t sdbVersion; extern int64_t sdbVersion;
int mpeerForwardDbReqToPeer(SSdbTable *pTable, char type, char *data, int dataLen); int sdbForwardDbReqToPeer(SSdbTable *pTable, char type, char *data, int dataLen);
int mpeerRetrieveRows(int fd, SSdbTable *pTable, uint64_t version); int mpeerRetrieveRows(int fd, SSdbTable *pTable, uint64_t version);
void sdbResetTable(SSdbTable *pTable); void sdbResetTable(SSdbTable *pTable);
extern const int16_t sdbFileVersion; extern const int16_t sdbFileVersion;
......
...@@ -430,7 +430,7 @@ int64_t sdbInsertRow(void *handle, void *row, int rowSize) { ...@@ -430,7 +430,7 @@ int64_t sdbInsertRow(void *handle, void *row, int rowSize) {
pthread_mutex_lock(&pTable->mutex); pthread_mutex_lock(&pTable->mutex);
if (mpeerForwardDbReqToPeer(pTable, SDB_TYPE_INSERT, rowHead->data, rowHead->rowSize) == 0) { if (sdbForwardDbReqToPeer(pTable, SDB_TYPE_INSERT, rowHead->data, rowHead->rowSize) == 0) {
pTable->id++; pTable->id++;
sdbVersion++; sdbVersion++;
if (pTable->keyType == SDB_KEYTYPE_AUTO) { if (pTable->keyType == SDB_KEYTYPE_AUTO) {
...@@ -547,7 +547,7 @@ int sdbDeleteRow(void *handle, void *row) { ...@@ -547,7 +547,7 @@ int sdbDeleteRow(void *handle, void *row) {
pthread_mutex_lock(&pTable->mutex); pthread_mutex_lock(&pTable->mutex);
if (mpeerForwardDbReqToPeer(pTable, SDB_TYPE_DELETE, (char *)row, rowSize) == 0) { if (sdbForwardDbReqToPeer(pTable, SDB_TYPE_DELETE, (char *)row, rowSize) == 0) {
pTable->id++; pTable->id++;
sdbVersion++; sdbVersion++;
...@@ -665,7 +665,7 @@ int sdbUpdateRow(void *handle, void *row, int updateSize, char isUpdated) { ...@@ -665,7 +665,7 @@ int sdbUpdateRow(void *handle, void *row, int updateSize, char isUpdated) {
pthread_mutex_lock(&pTable->mutex); pthread_mutex_lock(&pTable->mutex);
if (mpeerForwardDbReqToPeer(pTable, SDB_TYPE_UPDATE, rowHead->data, rowHead->rowSize) == 0) { if (sdbForwardDbReqToPeer(pTable, SDB_TYPE_UPDATE, rowHead->data, rowHead->rowSize) == 0) {
pTable->id++; pTable->id++;
sdbVersion++; sdbVersion++;
...@@ -744,7 +744,7 @@ int sdbBatchUpdateRow(void *handle, void *row, int rowSize) { ...@@ -744,7 +744,7 @@ int sdbBatchUpdateRow(void *handle, void *row, int rowSize) {
} }
pthread_mutex_lock(&pTable->mutex); pthread_mutex_lock(&pTable->mutex);
if (mpeerForwardDbReqToPeer(pTable, SDB_TYPE_BATCH_UPDATE, row, rowSize) == 0) { if (sdbForwardDbReqToPeer(pTable, SDB_TYPE_BATCH_UPDATE, row, rowSize) == 0) {
/* // write action */ /* // write action */
/* write(pTable->fd, &action, sizeof(action)); */ /* write(pTable->fd, &action, sizeof(action)); */
/* pTable->size += sizeof(action); */ /* pTable->size += sizeof(action); */
......
...@@ -12,32 +12,47 @@ ...@@ -12,32 +12,47 @@
* 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/>.
*/ */
#define _DEFAULT_SOURCE
#include "sdbint.h" #include "sdbint.h"
char* sdbStatusStr[] = {"offline", "unsynced", "syncing", "serving", "null"}; int32_t (*mpeerInitMnodesFp)(char *directory) = NULL;
void (*mpeerCleanUpMnodesFp)() = NULL;
char* sdbRoleStr[] = {"unauthed", "undecided", "master", "slave", "null"}; int32_t (*mpeerForwardRequestFp)(SSdbTable *pTable, char type, void *cont, int32_t contLen) = NULL;
#ifndef CLUSTER char *sdbStatusStr[] = {
"offline",
/* "unsynced",
* Lite Version sync request is always successful "syncing",
*/ "serving",
int mpeerForwardDbReqToPeer(SSdbTable *pTable, char type, char *data, int dataLen) { "null"
return 0; };
char *sdbRoleStr[] = {
"unauthed",
"undecided",
"master",
"slave",
"null"
};
int32_t sdbForwardDbReqToPeer(SSdbTable *pTable, char type, char *data, int32_t dataLen) {
if (mpeerForwardRequestFp) {
return mpeerForwardRequestFp(pTable, type, data, dataLen);
} else {
return 0;
}
} }
/* int32_t sdbInitPeers(char *directory) {
* Lite Version does not need to initialize peers if (mpeerInitMnodesFp) {
*/ return (*mpeerInitMnodesFp)(directory);
int sdbInitPeers(char *directory) { } else {
return 0; return 0;
}
} }
/* void sdbCleanUpPeers() {
* Lite Version does not need to cleanup peers if (mpeerCleanUpMnodesFp) {
*/ (*mpeerCleanUpMnodesFp)();
void sdbCleanUpPeers(){} }
}
#endif
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册