提交 4f350284 编写于 作者: S slguan

[TD-82] first edition of balance

上级 8568f4c4
...@@ -220,7 +220,6 @@ static int32_t dnodeInitStorage() { ...@@ -220,7 +220,6 @@ static int32_t dnodeInitStorage() {
sprintf(tsMnodeDir, "%s/mnode", dataDir); sprintf(tsMnodeDir, "%s/mnode", dataDir);
sprintf(tsVnodeDir, "%s/vnode", dataDir); sprintf(tsVnodeDir, "%s/vnode", dataDir);
sprintf(tsDnodeDir, "%s/dnode", dataDir); sprintf(tsDnodeDir, "%s/dnode", dataDir);
mkdir(tsMnodeDir, 0755);
mkdir(tsVnodeDir, 0755); mkdir(tsVnodeDir, 0755);
mkdir(tsDnodeDir, 0755); mkdir(tsDnodeDir, 0755);
......
...@@ -26,11 +26,11 @@ extern "C" { ...@@ -26,11 +26,11 @@ extern "C" {
struct _dnode_obj; struct _dnode_obj;
enum _TSDB_DN_STATUS { enum _TAOS_DN_STATUS {
TSDB_DN_STATUS_OFFLINE, TAOS_DN_STATUS_OFFLINE,
TSDB_DN_STATUS_DROPING, TAOS_DN_STATUS_DROPPING,
TSDB_DN_STATUS_BALANCING, TAOS_DN_STATUS_BALANCING,
TSDB_DN_STATUS_READY TAOS_DN_STATUS_READY
}; };
int32_t clusterInit(); int32_t clusterInit();
......
...@@ -48,7 +48,7 @@ int32_t clusterInitDnodes() { ...@@ -48,7 +48,7 @@ int32_t clusterInitDnodes() {
tsDnodeObj.publicIp = inet_addr(tsPublicIp); tsDnodeObj.publicIp = inet_addr(tsPublicIp);
tsDnodeObj.createdTime = taosGetTimestampMs(); tsDnodeObj.createdTime = taosGetTimestampMs();
tsDnodeObj.numOfTotalVnodes = tsNumOfTotalVnodes; tsDnodeObj.numOfTotalVnodes = tsNumOfTotalVnodes;
tsDnodeObj.status = TSDB_DN_STATUS_OFFLINE; tsDnodeObj.status = TAOS_DN_STATUS_OFFLINE;
tsDnodeObj.lastReboot = taosGetTimestampSec(); tsDnodeObj.lastReboot = taosGetTimestampSec();
sprintf(tsDnodeObj.dnodeName, "%d", tsDnodeObj.dnodeId); sprintf(tsDnodeObj.dnodeName, "%d", tsDnodeObj.dnodeId);
...@@ -203,9 +203,9 @@ void clusterProcessDnodeStatusMsg(SRpcMsg *rpcMsg) { ...@@ -203,9 +203,9 @@ void clusterProcessDnodeStatusMsg(SRpcMsg *rpcMsg) {
mgmtReleaseVgroup(pVgroup); 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); mTrace("dnode:%d, from offline to online", pDnode->dnodeId);
pDnode->status = TSDB_DN_STATUS_READY; pDnode->status = TAOS_DN_STATUS_READY;
balanceNotify(); balanceNotify();
} }
...@@ -673,10 +673,10 @@ static int32_t clusterRetrieveVnodes(SShowObj *pShow, char *data, int32_t rows, ...@@ -673,10 +673,10 @@ static int32_t clusterRetrieveVnodes(SShowObj *pShow, char *data, int32_t rows,
char* clusterGetDnodeStatusStr(int32_t dnodeStatus) { char* clusterGetDnodeStatusStr(int32_t dnodeStatus) {
switch (dnodeStatus) { switch (dnodeStatus) {
case TSDB_DN_STATUS_OFFLINE: return "offline"; case TAOS_DN_STATUS_OFFLINE: return "offline";
case TSDB_DN_STATUS_DROPING: return "dropping"; case TAOS_DN_STATUS_DROPPING: return "dropping";
case TSDB_DN_STATUS_BALANCING: return "balancing"; case TAOS_DN_STATUS_BALANCING: return "balancing";
case TSDB_DN_STATUS_READY: return "ready"; case TAOS_DN_STATUS_READY: return "ready";
default: return "undefined"; default: return "undefined";
} }
} }
...@@ -435,7 +435,7 @@ void sdbIncRef(void *handle, void *pRow) { ...@@ -435,7 +435,7 @@ void sdbIncRef(void *handle, void *pRow) {
SSdbTable *pTable = handle; SSdbTable *pTable = handle;
int32_t *pRefCount = (int32_t *)(pRow + pTable->refCountPos); int32_t *pRefCount = (int32_t *)(pRow + pTable->refCountPos);
atomic_add_fetch_32(pRefCount, 1); 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); 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) { ...@@ -446,7 +446,7 @@ void sdbDecRef(void *handle, void *pRow) {
SSdbTable *pTable = handle; SSdbTable *pTable = handle;
int32_t *pRefCount = (int32_t *)(pRow + pTable->refCountPos); int32_t *pRefCount = (int32_t *)(pRow + pTable->refCountPos);
int32_t refCount = atomic_sub_fetch_32(pRefCount, 1); 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); 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; int8_t* updateEnd = pRow + pTable->refCountPos - 1;
......
...@@ -372,7 +372,7 @@ char *mgmtGetVnodeStatus(SVgObj *pVgroup, SVnodeGid *pVnode) { ...@@ -372,7 +372,7 @@ char *mgmtGetVnodeStatus(SVgObj *pVgroup, SVnodeGid *pVnode) {
} }
clusterReleaseDnode(pDnode); clusterReleaseDnode(pDnode);
if (pDnode->status == TSDB_DN_STATUS_OFFLINE) { if (pDnode->status == TAOS_DN_STATUS_OFFLINE) {
return "offline"; return "offline";
} }
......
...@@ -28,8 +28,6 @@ enum _module { ...@@ -28,8 +28,6 @@ enum _module {
TSDB_MOD_MGMT, TSDB_MOD_MGMT,
TSDB_MOD_HTTP, TSDB_MOD_HTTP,
TSDB_MOD_MONITOR, TSDB_MOD_MONITOR,
TSDB_MOD_DCLUSTER,
TSDB_MOD_MSTORAGE,
TSDB_MOD_MAX TSDB_MOD_MAX
}; };
......
...@@ -266,6 +266,7 @@ static void vnodeBuildVloadMsg(char *pNode, void * param) { ...@@ -266,6 +266,7 @@ static void vnodeBuildVloadMsg(char *pNode, void * param) {
pLoad->vgId = htonl(pVnode->vgId); pLoad->vgId = htonl(pVnode->vgId);
pLoad->vnode = htonl(pVnode->vgId); pLoad->vnode = htonl(pVnode->vgId);
pLoad->status = pVnode->status; pLoad->status = pVnode->status;
pLoad->role = pVnode->role;
} }
static void vnodeCleanUp(SVnodeObj *pVnode) { static void vnodeCleanUp(SVnodeObj *pVnode) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册