未验证 提交 569e7760 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #17586 from taosdata/enh/TD-19461

fix: alter replica one by one
......@@ -1586,10 +1586,11 @@ int32_t mndBuildAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pOldDb
if (mndAddVnodeToVgroup(pMnode, &newVgroup, pArray) != 0) return -1;
if (mndAddVnodeToVgroup(pMnode, &newVgroup, pArray) != 0) return -1;
if (mndAddCreateVnodeAction(pMnode, pTrans, pNewDb, &newVgroup, &newVgroup.vnodeGid[1]) != 0) return -1;
if (mndAddCreateVnodeAction(pMnode, pTrans, pNewDb, &newVgroup, &newVgroup.vnodeGid[2]) != 0) return -1;
if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pNewDb, &newVgroup, newVgroup.vnodeGid[0].dnodeId) != 0)
return -1;
if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pNewDb, &newVgroup) != 0) return -1;
if (mndAddCreateVnodeAction(pMnode, pTrans, pNewDb, &newVgroup, &newVgroup.vnodeGid[2]) != 0) return -1;
if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pNewDb, &newVgroup) != 0) return -1;
} else if (newVgroup.replica == 3 && pNewDb->cfg.replications == 1) {
mInfo("db:%s, vgId:%d, will remove 2 vnodes, vn:0 dnode:%d vn:1 dnode:%d vn:2 dnode:%d", pVgroup->dbName,
pVgroup->vgId, pVgroup->vnodeGid[0].dnodeId, pVgroup->vnodeGid[1].dnodeId, pVgroup->vnodeGid[2].dnodeId);
......
......@@ -127,8 +127,27 @@ if $data[0][8] != follower then
goto step4
endi
print ============= step5: stop dnode 2
print ============= step5: result
$i = 0
while $i < 1000
$i = $i + 1
sleep 1000
sql show db.vgroups
print ===> loop: $i | v0: $data03 $data04 | v1: $data05 $data06 | v2: $data07 $data08
if $data[0][4] != leader then
return -1
endi
if $data[0][6] != follower then
return -1
endi
if $data[0][8] != follower then
return -1
endi
endw
print ============= step5: stop dnode 2
sql select * from db.stb
if $rows != 1 then
return -1
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册