From b508c2511840fd5aaeed6a8b11df9631ff5c4e2e Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 25 Oct 2022 15:55:19 +0800 Subject: [PATCH] enh: redistribute vgroup --- source/dnode/mgmt/mgmt_vnode/src/vmWorker.c | 4 ++++ source/dnode/mnode/impl/src/mndVgroup.c | 10 +++++++++- source/util/src/tqueue.c | 2 ++ tests/script/jenkins/basic.txt | 8 ++++---- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c index 76d181761b..d5b1e18c7b 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c @@ -307,6 +307,10 @@ int32_t vmGetQueueSize(SVnodeMgmt *pMgmt, int32_t vgId, EQueueType qtype) { } vmReleaseVnode(pMgmt, pVnode); } + if (size < 0) { + dError("vgId:%d, can't get size from queue since %s, qtype:%d", vgId, terrstr(), qtype); + size = 0; + } return size; } diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c index 2d9023c526..23397cedc6 100644 --- a/source/dnode/mnode/impl/src/mndVgroup.c +++ b/source/dnode/mnode/impl/src/mndVgroup.c @@ -260,6 +260,12 @@ void *mndBuildCreateVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVg return NULL; } + mInfo("vgId:%d, build create vnode req, replica:%d selfIndex:%d strict:%d", createReq.vgId, createReq.replica, + createReq.selfIndex, createReq.strict); + for (int32_t i = 0; i < createReq.replica; ++i) { + mInfo("vgId:%d, replica:%d ep:%s:%u", createReq.vgId, i, createReq.replicas[i].fqdn, createReq.replicas[i].port); + } + int32_t contLen = tSerializeSCreateVnodeReq(NULL, 0, &createReq); if (contLen < 0) { terrno = TSDB_CODE_OUT_OF_MEMORY; @@ -293,6 +299,7 @@ static void *mndBuildAlterVnodeConfigReq(SMnode *pMnode, SDbObj *pDb, SVgObj *pV alterReq.strict = pDb->cfg.strict; alterReq.cacheLast = pDb->cfg.cacheLast; + mInfo("vgId:%d, build alter vnode config req", pVgroup->vgId); int32_t contLen = tSerializeSAlterVnodeConfigReq(NULL, 0, &alterReq); if (contLen < 0) { terrno = TSDB_CODE_OUT_OF_MEMORY; @@ -342,7 +349,7 @@ static void *mndBuildAlterVnodeReplicaReq(SMnode *pMnode, SDbObj *pDb, SVgObj *p } } alterReq.replica = pVgroup->replica; - mInfo("vgId:%d, start to alter vnode, replica:%d selfIndex:%d strict:%d", alterReq.vgId, alterReq.replica, + mInfo("vgId:%d, build alter vnode req, replica:%d selfIndex:%d strict:%d", alterReq.vgId, alterReq.replica, alterReq.selfIndex, alterReq.strict); for (int32_t i = 0; i < alterReq.replica; ++i) { mInfo("vgId:%d, replica:%d ep:%s:%u", alterReq.vgId, i, alterReq.replicas[i].fqdn, alterReq.replicas[i].port); @@ -377,6 +384,7 @@ void *mndBuildDropVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVgOb memcpy(dropReq.db, pDb->name, TSDB_DB_FNAME_LEN); dropReq.dbUid = pDb->uid; + mInfo("vgId:%d, build drop vnode req", dropReq.vgId); int32_t contLen = tSerializeSDropVnodeReq(NULL, 0, &dropReq); if (contLen < 0) { terrno = TSDB_CODE_OUT_OF_MEMORY; diff --git a/source/util/src/tqueue.c b/source/util/src/tqueue.c index f1f926c0b7..19b9b89cab 100644 --- a/source/util/src/tqueue.c +++ b/source/util/src/tqueue.c @@ -137,6 +137,8 @@ int32_t taosQueueItemSize(STaosQueue *queue) { taosThreadMutexLock(&queue->mutex); int32_t numOfItems = queue->numOfItems; taosThreadMutexUnlock(&queue->mutex); + + uTrace("queue:%p, numOfItems:%d memOfItems:%" PRId64, queue, queue->numOfItems, queue->memOfItems); return numOfItems; } diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 50019cd837..e8b8bce5c2 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -51,10 +51,10 @@ # unsupport ./test.sh -f tsim/dnode/drop_dnode_has_multi_vnode_replica3.sim ./test.sh -f tsim/dnode/offline_reason.sim ./test.sh -f tsim/dnode/redistribute_vgroup_replica1.sim -# unsupport ./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v1_leader.sim -# unsupport ./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v1_follower.sim -# unsupport ./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v2.sim -# unsupport ./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v3.sim +./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v1_leader.sim +./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v1_follower.sim +./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v2.sim +./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v3.sim # unsupport ./test.sh -f tsim/dnode/vnode_clean.sim ./test.sh -f tsim/dnode/use_dropped_dnode.sim -- GitLab