Commit 71f0350
AppVersion.CompareTo missing else if breaks comparison symmetry (#8051)
The second condition in the rest-string comparison was an 'if' instead
of 'else if', causing the first branch's result (diff = 1) to be
immediately overwritten by the else branch. This made release versions
appear less than their pre-release counterparts (e.g. '1.2.0' <
'1.2.0-M1'),
violating IComparable<T> symmetry.
This could cause non-deterministic shard allocation ordering during
rolling updates from pre-release to release versions via
AbstractLeastShardAllocationStrategy.
Added regression test for the reverse comparison direction.
Co-authored-by: Aaron Stannard <aaron@petabridge.com>1 parent 2226305 commit 71f0350
2 files changed
Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
70 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
71 | 74 | | |
72 | 75 | | |
73 | 76 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
232 | | - | |
| 232 | + | |
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
| |||
0 commit comments