fix transfer node meta err (#22441)

Signed-off-by: Wei Liu <wei.liu@zilliz.com>
pull/22464/head
wei liu 2023-02-28 11:11:47 +08:00 committed by GitHub
parent f36310abfb
commit dfa407ed38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -590,7 +590,7 @@ func (rm *ResourceManager) transferNodeInStore(from string, to string, numNode i
} }
toCapacity := rm.groups[to].GetCapacity() toCapacity := rm.groups[to].GetCapacity()
if from != DefaultResourceGroupName { if to != DefaultResourceGroupName {
// default rg capacity won't be changed // default rg capacity won't be changed
toCapacity = rm.groups[to].GetCapacity() + numNode toCapacity = rm.groups[to].GetCapacity() + numNode
} }

View File

@ -196,8 +196,10 @@ func (suite *ResourceManagerSuite) TestRecover() {
err = suite.manager.AddResourceGroup("rg2") err = suite.manager.AddResourceGroup("rg2")
suite.NoError(err) suite.NoError(err)
suite.manager.AssignNode("rg1", 1) suite.manager.AssignNode(DefaultResourceGroupName, 1)
suite.manager.AssignNode("rg2", 2) suite.manager.TransferNode(DefaultResourceGroupName, "rg1", 1)
suite.manager.AssignNode(DefaultResourceGroupName, 2)
suite.manager.TransferNode(DefaultResourceGroupName, "rg2", 1)
suite.manager.AssignNode(DefaultResourceGroupName, 3) suite.manager.AssignNode(DefaultResourceGroupName, 3)
suite.manager.AssignNode(DefaultResourceGroupName, 4) suite.manager.AssignNode(DefaultResourceGroupName, 4)
@ -214,7 +216,6 @@ func (suite *ResourceManagerSuite) TestRecover() {
suite.NoError(err) suite.NoError(err)
suite.Equal(1, rg.GetCapacity()) suite.Equal(1, rg.GetCapacity())
suite.True(suite.manager.ContainsNode("rg1", 1)) suite.True(suite.manager.ContainsNode("rg1", 1))
print(suite.manager.GetNodes("rg1"))
rg, err = suite.manager.GetResourceGroup("rg2") rg, err = suite.manager.GetResourceGroup("rg2")
suite.NoError(err) suite.NoError(err)