Skip to content

Commit

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

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

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
  • Loading branch information
rleungx and ti-chi-bot[bot] committed May 11, 2024
1 parent 78cb081 commit 204dcbb
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 @@ -453,11 +453,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 !manager.IsExistNode(node) {
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 @@ -298,7 +298,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 204dcbb

Please sign in to comment.