提交 f8d35c2a 编写于 作者: S slguan

fix compile error

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