Skip to content

Commit

Permalink
api: remove set node replica check (#8153) (#8467)
Browse files Browse the repository at this point in the history
ref #8154

Signed-off-by: Ryan Leung <[email protected]>

Co-authored-by: Ryan Leung <[email protected]>
Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 1, 2024
1 parent 18892e5 commit 52ec66d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
5 changes: 0 additions & 5 deletions server/apiv2/handlers/tso_keyspace_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,11 +461,6 @@ func SetNodesForKeyspaceGroup(c *gin.Context) {
c.AbortWithStatusJSON(http.StatusBadRequest, "keyspace group does not exist")
return
}
// check if nodes is less than default replica count
if len(setParams.Nodes) < utils.DefaultKeyspaceGroupReplicaCount {
c.AbortWithStatusJSON(http.StatusBadRequest, "invalid num of nodes")
return
}
// check if node exists
for _, node := range setParams.Nodes {
if exist, _ := manager.IsExistNode(node); !exist {
Expand Down
2 changes: 1 addition & 1 deletion tests/integrations/mcs/keyspace/tso_keyspace_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ func (suite *keyspaceGroupTestSuite) TestSetNodes() {
Nodes: []string{nodesList[0]},
}
_, code = suite.trySetNodesForKeyspaceGroup(re, id, params)
re.Equal(http.StatusBadRequest, code)
re.Equal(http.StatusOK, code)

// the keyspace group is not exist.
id = 2
Expand Down
2 changes: 1 addition & 1 deletion tools/pd-ctl/tests/keyspace/keyspace_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ func TestSetNodeAndPriorityKeyspaceGroup(t *testing.T) {
args := []string{"-u", pdAddr, "keyspace-group", "set-node", defaultKeyspaceGroupID, tsoAddrs[0]}
output, err := tests.ExecuteCommand(cmd, args...)
re.NoError(err)
re.Contains(string(output), "invalid num of nodes")
re.Contains(string(output), "Success!")
args = []string{"-u", pdAddr, "keyspace-group", "set-node", defaultKeyspaceGroupID, "", ""}
output, err = tests.ExecuteCommand(cmd, args...)
re.NoError(err)
Expand Down

0 comments on commit 52ec66d

Please sign in to comment.