Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't remove orphan peer if the peer count doesn't satisfy the replica requirement #7584

Closed
bufferflies opened this issue Dec 20, 2023 · 2 comments · Fixed by #7581
Closed
Assignees
Labels
affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.5 This bug affects the 7.5.x(LTS) versions. report/customer Customers have encountered this bug. severity/major type/bug The issue is confirmed as a bug.

Comments

@bufferflies
Copy link
Contributor

bufferflies commented Dec 20, 2023

Bug Report

The distribution of the tikv is defined as below:
instance label
tikv-1 zone:z1
tikv-2 zone:z1
tikv-3 zone:z1
tikv-4 zone:z2
tikv-5 zone:z2
tikv-6 zone:z2

AegionA located in [tikv-1,tikv-2,tikv3]
Then I build new rule to move regionA into the z2,
The first operator is remove orphan peer.

The unit test:

func (suite *ruleCheckerTestSuite) TestRemoveOrphanPeer() {
	suite.cluster.AddLabelsStore(1, 1, map[string]string{"zone": "z1", "host": "h1"})
	suite.cluster.AddLabelsStore(2, 1, map[string]string{"zone": "z1", "host": "h1"})
	suite.cluster.AddLabelsStore(3, 1, map[string]string{"zone": "z1", "host": "h1"})
	suite.cluster.AddLabelsStore(4, 1, map[string]string{"zone": "z2", "host": "h1"})
	suite.cluster.AddLabelsStore(5, 1, map[string]string{"zone": "z2", "host": "h2"})
	suite.cluster.AddLabelsStore(6, 1, map[string]string{"zone": "z2", "host": "h2"})
	rule := &placement.Rule{
		GroupID: "pd",
		ID:      "test2",
		Role:    placement.Voter,
		Count:   3,
		LabelConstraints: []placement.LabelConstraint{
			{
				Key:    "zone",
				Op:     placement.In,
				Values: []string{"z2"},
			},
		},
	}
	suite.ruleManager.SetRule(rule)
	suite.ruleManager.DeleteRule("pd", "default")

	suite.cluster.AddLeaderRegionWithRange(1, "200", "300", 1, 2, 3)
	op := suite.rc.Check(suite.cluster.GetRegion(1))
	suite.NotNil(op)
	suite.Equal("add-rule-peer", op.Desc())

	suite.cluster.AddLeaderRegionWithRange(2, "300", "400", 1, 2, 3, 4)
	op = suite.rc.Check(suite.cluster.GetRegion(2))
	suite.NotNil(op)
	suite.Equal("remove-orphan-peer", op.Desc())
}

What did you do?

What did you expect to see?

Add peer first and then remove orphan peer

What did you see instead?

What version of PD are you using (pd-server -V)?

6.5.4 master

@bufferflies bufferflies added type/bug The issue is confirmed as a bug. affects-7.1 This bug affects the 7.1.x(LTS) versions. labels Dec 20, 2023
@bufferflies bufferflies added the affects-6.5 This bug affects the 6.5.x(LTS) versions. label Dec 20, 2023
@bufferflies bufferflies self-assigned this Dec 20, 2023
@bufferflies bufferflies added the affects-7.5 This bug affects the 7.5.x(LTS) versions. label Dec 20, 2023
@bufferflies
Copy link
Contributor Author

related #6573

ti-chi-bot bot added a commit that referenced this issue Dec 20, 2023
…e count (#7581)

close #7584

The healthy orphan peer should be the last one to be removed only if there are extra peers to keep the high availablility.

Signed-off-by: bufferflies <1045931706@qq.com>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
ti-chi-bot pushed a commit to ti-chi-bot/pd that referenced this issue Dec 20, 2023
close tikv#7584

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
ti-chi-bot bot pushed a commit that referenced this issue Dec 20, 2023
…e count (#7581) (#7591)

close #7584

The healthy orphan peer should be the last one to be removed only if there are extra peers to keep the high availablility.

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
Signed-off-by: bufferflies <1045931706@qq.com>

Co-authored-by: tongjian <1045931706@qq.com>
Co-authored-by: bufferflies <1045931706@qq.com>
ti-chi-bot bot pushed a commit that referenced this issue Dec 21, 2023
…e count (#7581) (#7592)

close #7584

The healthy orphan peer should be the last one to be removed only if there are extra peers to keep the high availablility.

Signed-off-by: bufferflies <1045931706@qq.com>

Co-authored-by: bufferflies <1045931706@qq.com>
ti-chi-bot bot pushed a commit that referenced this issue Feb 1, 2024
…e count (#7581) (#7590)

close #7584

The healthy orphan peer should be the last one to be removed only if there are extra peers to keep the high availablility.

Signed-off-by: bufferflies <1045931706@qq.com>

Co-authored-by: bufferflies <1045931706@qq.com>
@seiya-annie
Copy link

/found customer

@ti-chi-bot ti-chi-bot bot added the report/customer Customers have encountered this bug. label Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.5 This bug affects the 7.5.x(LTS) versions. report/customer Customers have encountered this bug. severity/major type/bug The issue is confirmed as a bug.
Projects
Development

Successfully merging a pull request may close this issue.

2 participants