[SERVER-66584] sh.updateZoneKeyRange() does not support $minKey or $maxKey Created: 19/May/22 Updated: 27/Oct/23 Resolved: 19/May/22 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Frederic Vitzikam | Assignee: | Max Hirschhorn |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Sprint: | Sharding NYC 2022-05-30 | ||||||||||||
| Participants: | |||||||||||||
| Description |
|
The following commands do not seem to work on a sharded cluster, I ran them by hand through the shell:
as it complains about
I found https://jira.mongodb.org/browse/SERVER-32862, where there is a comment "Another interesting aspect is the following" about a similar bug (different from the main bug of that issue that was fixed).
Using MinKey/MaxKey like in https://www.mongodb.com/docs/manual/reference/method/sh.updateZoneKeyRange/ does work. |
| Comments |
| Comment by Max Hirschhorn [ 19/May/22 ] | ||||||||
The server erroring here is correct. The string "$minKey" is truly greater than the string "$maxKey". { "$minKey": 1 } and MinKey are not the same thing. It is only the mongo shell which confusingly displays them that way.
| ||||||||
| Comment by Frederic Vitzikam [ 19/May/22 ] | ||||||||
|
So it is not supposed to work ? | ||||||||
| Comment by Max Hirschhorn [ 19/May/22 ] | ||||||||
|
Hi frederic.vitzikam@mongodb.com, it looks like there may be some confusion due to how the mongo shell displays the MinKey and MaxKey values. { "$minKey": 1 } a BSON Object (type 0x03). MinKey is the literal MinKey value (type 0xFF). https://bsonspec.org/spec.html The literal object { "$minKey": 1 } compares greater than the literal object { "$maxKey": 1 } because 'i' comes after 'a'.
|