提交 8cb08465 编写于 作者: S slguan

#1177

上级 473586ef
......@@ -376,16 +376,6 @@ int grantRetrieveGrants(SShowObj *pShow, char *data, int rows, SConnObj *pConn);
int mgmtGetVnodeMeta(SMeterMeta *pMeta, SShowObj *pShow, SConnObj *pConn);
int mgmtRetrieveVnodes(SShowObj *pShow, char *data, int rows, SConnObj *pConn);
// dnode balance api
int mgmtInitBalance();
void mgmtCleanupBalance();
int mgmtAllocVnodes(SVgObj *pVgroup);
int mgmtSetDnodeShellRemoving(SDnodeObj *pDnode);
void mgmtSetDnodeUnRemove(SDnodeObj *pDnode);
void mgmtStartBalanceTimer(int64_t mseconds);
void mgmtSetDnodeOfflineOnSdbChanged();
void mgmtUpdateVgroupState(SVgObj *pVgroup, int lbStatus, int srcIp);
bool mgmtAddVnode(SVgObj *pVgroup, SDnodeObj *pSrcDnode, SDnodeObj *pDestDnode);
void mgmtSetModuleInDnode(SDnodeObj *pDnode, int moduleType);
int mgmtUnSetModuleInDnode(SDnodeObj *pDnode, int moduleType);
......
......@@ -13,60 +13,32 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TDENGINE_MGMTBALANCE_H
#define TDENGINE_MGMTBALANCE_H
#ifndef TDENGINE_MGMT_BALANCE_H
#define TDENGINE_MGMT_BALANCE_H
#ifdef __cplusplus
extern "C" {
#endif
#include "os.h"
#include "dnodeSystem.h"
#include "mgmt.h"
#include "tglobalcfg.h"
#include "vnodeStatus.h"
#include "ttime.h"
void mgmtCreateDnodeOrderList();
void mgmtReleaseDnodeOrderList();
void mgmtMakeDnodeOrderList();
void mgmtCalcSystemScore();
float mgmtTryCalcDnodeScore(SDnodeObj *pDnode, int extraVnode);
bool mgmtCheckDnodeInOfflineState(SDnodeObj *pDnode);
bool mgmtCheckDnodeInRemoveState(SDnodeObj *pDnode);
bool mgmtCheckModuleInDnode(SDnodeObj *pDnode, int moduleType);
void mgmtMonitorDnodeModule();
void mgmtSetModuleInDnode(SDnodeObj *pDnode, int moduleType);
int mgmtUnSetModuleInDnode(SDnodeObj *pDnode, int moduleType);
void mgmtMonitorVgroups();
void mgmtMonitorDnodes();
void mgmtCalcNumOfFreeVnodes(SDnodeObj *pDnode);
extern void * dnodeSdb;
extern void * vgSdb;
extern void * balanceTimer;
extern int mgmtOrderedDnodesSize;
extern int mgmtOrderedDnodesMallocSize;
extern SDnodeObj **mgmtOrderedDnodes;
extern uint32_t mgmtAccessSquence;
extern SMgmtIpList mgmtIpList;
extern void (*mgmtStartBalanceTimer)(int64_t mseconds);
extern int32_t (*mgmtInitBalance)();
extern void (*mgmtCleanupBalance)();
extern int32_t (*mgmtAllocVnodes)(SVgObj *pVgroup);
extern bool (*mgmtCheckModuleInDnode)(SDnodeObj *pDnode, int moduleType);
extern char* (*mgmtGetVnodeStatus)(SVgObj *pVgroup, SVnodeGid *pVnode);
extern bool (*mgmtCheckVnodeReady)(SDnodeObj *pDnode, SVgObj *pVgroup, SVnodeGid *pVnode);
extern void (*mgmtUpdateDnodeState)(SDnodeObj *pDnode, int lbStatus);
extern void (*mgmtUpdateVgroupState)(SVgObj *pVgroup, int lbStatus, int srcIp);
extern bool (*mgmtAddVnode)(SVgObj *pVgroup, SDnodeObj *pSrcDnode, SDnodeObj *pDestDnode);
#ifdef __cplusplus
}
#endif
#endif // TDENGINE_MGMTBALANCE_H
#endif
......@@ -18,13 +18,16 @@
#include "vnodeStatus.h"
#include "dnodeModule.h"
void mgmtStartBalanceTimer(int64_t mseconds) {}
void mgmtStartBalanceTimerImp(int64_t mseconds) {}
void (*mgmtStartBalanceTimer)(int64_t mseconds) = mgmtStartBalanceTimerImp;
int mgmtInitBalance() { return 0; }
int32_t mgmtInitBalanceImp() { return 0; }
int32_t (*mgmtInitBalance)() = mgmtInitBalanceImp;
void mgmtCleanupBalance() {}
void mgmtCleanupBalanceImp() {}
void (*mgmtCleanupBalance)() = mgmtCleanupBalanceImp;
int mgmtAllocVnodes(SVgObj *pVgroup) {
int32_t mgmtAllocVnodesImp(SVgObj *pVgroup) {
int selectedVnode = -1;
SDnodeObj *pDnode = &dnodeObj;
int lastAllocVode = pDnode->lastAllocVnode;
......@@ -48,17 +51,26 @@ int mgmtAllocVnodes(SVgObj *pVgroup) {
return 0;
}
}
int32_t (*mgmtAllocVnodes)(SVgObj *pVgroup) = mgmtAllocVnodesImp;
bool mgmtCheckModuleInDnode(SDnodeObj *pDnode, int moduleType) {
bool mgmtCheckModuleInDnodeImp(SDnodeObj *pDnode, int moduleType) {
return tsModule[moduleType].num != 0;
}
bool (*mgmtCheckModuleInDnode)(SDnodeObj *pDnode, int moduleType) = mgmtCheckModuleInDnodeImp;
char *mgmtGetVnodeStatus(SVgObj *pVgroup, SVnodeGid *pVnode) { return "master"; }
char *mgmtGetVnodeStatusImp(SVgObj *pVgroup, SVnodeGid *pVnode) { return "master"; }
char *(*mgmtGetVnodeStatus)(SVgObj *pVgroup, SVnodeGid *pVnode) = mgmtGetVnodeStatusImp;
bool mgmtCheckVnodeReady(SDnodeObj *pDnode, SVgObj *pVgroup, SVnodeGid *pVnode) { return true; }
bool mgmtCheckVnodeReadyImp(SDnodeObj *pDnode, SVgObj *pVgroup, SVnodeGid *pVnode) { return true; }
bool (*mgmtCheckVnodeReady)(SDnodeObj *pDnode, SVgObj *pVgroup, SVnodeGid *pVnode) = mgmtCheckVnodeReadyImp;
void mgmtUpdateDnodeState(SDnodeObj *pDnode, int lbStatus) {}
void mgmtUpdateVgroupState(SVgObj *pVgroup, int lbStatus, int srcIp) {}
void mgmtUpdateDnodeStateImp(SDnodeObj *pDnode, int lbStatus) {}
void (*mgmtUpdateDnodeState)(SDnodeObj *pDnode, int lbStatus) = mgmtUpdateDnodeStateImp;
void mgmtUpdateVgroupStateImp(SVgObj *pVgroup, int lbStatus, int srcIp) {}
void (*mgmtUpdateVgroupState)(SVgObj *pVgroup, int lbStatus, int srcIp) = mgmtUpdateVgroupStateImp;
bool mgmtAddVnodeImp(SVgObj *pVgroup, SDnodeObj *pSrcDnode, SDnodeObj *pDestDnode) { return false; }
bool (*mgmtAddVnode)(SVgObj *pVgroup, SDnodeObj *pSrcDnode, SDnodeObj *pDestDnode) = mgmtAddVnodeImp;
bool mgmtAddVnode(SVgObj *pVgroup, SDnodeObj *pSrcDnode, SDnodeObj *pDestDnode) { return false; }
\ No newline at end of file
......@@ -14,9 +14,7 @@
*/
#define _DEFAULT_SOURCE
#include "os.h"
#include "mgmt.h"
#include "taosmsg.h"
#include "tschemautil.h"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册