[TD-82] first edition of balance
This commit is contained in:
parent
8568f4c461
commit
4f350284ab
|
@ -220,7 +220,6 @@ static int32_t dnodeInitStorage() {
|
|||
sprintf(tsMnodeDir, "%s/mnode", dataDir);
|
||||
sprintf(tsVnodeDir, "%s/vnode", dataDir);
|
||||
sprintf(tsDnodeDir, "%s/dnode", dataDir);
|
||||
mkdir(tsMnodeDir, 0755);
|
||||
mkdir(tsVnodeDir, 0755);
|
||||
mkdir(tsDnodeDir, 0755);
|
||||
|
||||
|
|
|
@ -26,11 +26,11 @@ extern "C" {
|
|||
|
||||
struct _dnode_obj;
|
||||
|
||||
enum _TSDB_DN_STATUS {
|
||||
TSDB_DN_STATUS_OFFLINE,
|
||||
TSDB_DN_STATUS_DROPING,
|
||||
TSDB_DN_STATUS_BALANCING,
|
||||
TSDB_DN_STATUS_READY
|
||||
enum _TAOS_DN_STATUS {
|
||||
TAOS_DN_STATUS_OFFLINE,
|
||||
TAOS_DN_STATUS_DROPPING,
|
||||
TAOS_DN_STATUS_BALANCING,
|
||||
TAOS_DN_STATUS_READY
|
||||
};
|
||||
|
||||
int32_t clusterInit();
|
||||
|
|
|
@ -48,7 +48,7 @@ int32_t clusterInitDnodes() {
|
|||
tsDnodeObj.publicIp = inet_addr(tsPublicIp);
|
||||
tsDnodeObj.createdTime = taosGetTimestampMs();
|
||||
tsDnodeObj.numOfTotalVnodes = tsNumOfTotalVnodes;
|
||||
tsDnodeObj.status = TSDB_DN_STATUS_OFFLINE;
|
||||
tsDnodeObj.status = TAOS_DN_STATUS_OFFLINE;
|
||||
tsDnodeObj.lastReboot = taosGetTimestampSec();
|
||||
sprintf(tsDnodeObj.dnodeName, "%d", tsDnodeObj.dnodeId);
|
||||
|
||||
|
@ -203,9 +203,9 @@ void clusterProcessDnodeStatusMsg(SRpcMsg *rpcMsg) {
|
|||
mgmtReleaseVgroup(pVgroup);
|
||||
}
|
||||
|
||||
if (pDnode->status != TSDB_DN_STATUS_READY) {
|
||||
if (pDnode->status == TAOS_DN_STATUS_OFFLINE) {
|
||||
mTrace("dnode:%d, from offline to online", pDnode->dnodeId);
|
||||
pDnode->status = TSDB_DN_STATUS_READY;
|
||||
pDnode->status = TAOS_DN_STATUS_READY;
|
||||
balanceNotify();
|
||||
}
|
||||
|
||||
|
@ -673,10 +673,10 @@ static int32_t clusterRetrieveVnodes(SShowObj *pShow, char *data, int32_t rows,
|
|||
|
||||
char* clusterGetDnodeStatusStr(int32_t dnodeStatus) {
|
||||
switch (dnodeStatus) {
|
||||
case TSDB_DN_STATUS_OFFLINE: return "offline";
|
||||
case TSDB_DN_STATUS_DROPING: return "dropping";
|
||||
case TSDB_DN_STATUS_BALANCING: return "balancing";
|
||||
case TSDB_DN_STATUS_READY: return "ready";
|
||||
case TAOS_DN_STATUS_OFFLINE: return "offline";
|
||||
case TAOS_DN_STATUS_DROPPING: return "dropping";
|
||||
case TAOS_DN_STATUS_BALANCING: return "balancing";
|
||||
case TAOS_DN_STATUS_READY: return "ready";
|
||||
default: return "undefined";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -435,7 +435,7 @@ void sdbIncRef(void *handle, void *pRow) {
|
|||
SSdbTable *pTable = handle;
|
||||
int32_t *pRefCount = (int32_t *)(pRow + pTable->refCountPos);
|
||||
atomic_add_fetch_32(pRefCount, 1);
|
||||
if (0) {
|
||||
if (0 && strcmp(pTable->tableName, "dnodes") == 0) {
|
||||
sdbTrace("table:%s, add ref to record:%s:%s:%d", pTable->tableName, pTable->tableName, sdbGetkeyStr(pTable, pRow), *pRefCount);
|
||||
}
|
||||
}
|
||||
|
@ -446,7 +446,7 @@ void sdbDecRef(void *handle, void *pRow) {
|
|||
SSdbTable *pTable = handle;
|
||||
int32_t *pRefCount = (int32_t *)(pRow + pTable->refCountPos);
|
||||
int32_t refCount = atomic_sub_fetch_32(pRefCount, 1);
|
||||
if (0) {
|
||||
if (0 && strcmp(pTable->tableName, "dnodes") == 0) {
|
||||
sdbTrace("table:%s, def ref of record:%s:%s:%d", pTable->tableName, pTable->tableName, sdbGetkeyStr(pTable, pRow), *pRefCount);
|
||||
}
|
||||
int8_t* updateEnd = pRow + pTable->refCountPos - 1;
|
||||
|
|
|
@ -372,7 +372,7 @@ char *mgmtGetVnodeStatus(SVgObj *pVgroup, SVnodeGid *pVnode) {
|
|||
}
|
||||
clusterReleaseDnode(pDnode);
|
||||
|
||||
if (pDnode->status == TSDB_DN_STATUS_OFFLINE) {
|
||||
if (pDnode->status == TAOS_DN_STATUS_OFFLINE) {
|
||||
return "offline";
|
||||
}
|
||||
|
||||
|
|
|
@ -28,8 +28,6 @@ enum _module {
|
|||
TSDB_MOD_MGMT,
|
||||
TSDB_MOD_HTTP,
|
||||
TSDB_MOD_MONITOR,
|
||||
TSDB_MOD_DCLUSTER,
|
||||
TSDB_MOD_MSTORAGE,
|
||||
TSDB_MOD_MAX
|
||||
};
|
||||
|
||||
|
|
|
@ -266,6 +266,7 @@ static void vnodeBuildVloadMsg(char *pNode, void * param) {
|
|||
pLoad->vgId = htonl(pVnode->vgId);
|
||||
pLoad->vnode = htonl(pVnode->vgId);
|
||||
pLoad->status = pVnode->status;
|
||||
pLoad->role = pVnode->role;
|
||||
}
|
||||
|
||||
static void vnodeCleanUp(SVnodeObj *pVnode) {
|
||||
|
|
Loading…
Reference in New Issue