pd
pd copied to clipboard
primary changed twice when pdms rolling update
Bug Report
What did you do?
1、update the config of tso
What did you expect to see?
the primary changed once when tso rolling update
What did you see instead?
the primary changed twice when tso rolling update
What version of PD are you using (pd-server -V
)?
./pd-server -V Release Version: v8.0.0-alpha Edition: Community Git Commit Hash: bc92c13c26bb7abbe8f332cacdb5817a509391c9 Git Branch: heads/refs/tags/v8.0.0-alpha UTC Build Time: 2024-03-27 11:37:04 2024-03-28T15:26:29.929+0800
/type bug /severity major /assign HuSharp
For tiup
- When we have 3 pdms, pdms-0/pdms-1/pdms-2, and pdms-2 is primary
- upgrade pdms-2 firstly maybe transfer primary to pdms-0
- uprade pdms-0 will transfer primary again
We can upgrade pdms primary in last place(named defer feature) can avoid unnecessary primary transfer
Ref https://github.com/pingcap/tiup/pull/2414
For operator
tidb-operator does not have the ability to defer feature
, it can only upgrade the pods in order.
Furthermore, Thinking about this situation:
- When we have 3 pdms, pdms-0/pdms-1/pdms-2, and pdms-2 is primary
- upgrade pdms-2 firstly maybe transfer primary to pdms-1
- upgrade pdms-1 maybe transfer primary to pdms-0.
To fix it, Assume that current primary ordinal is x, and range is [0, n]
- Find the max suitable ordinal in (x, n], because they have been upgraded
- If no suitable ordinal, find the min suitable ordinal in [0, x) to reduce the count of transfer
Ref https://github.com/pingcap/tidb-operator/pull/5643