[SERVER-32862] sh.addShardToZone() allows unusual (invalid?) chunks to be created Created: 23/Jan/18 Updated: 30/Oct/23 Resolved: 06/Feb/18 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Sharding |
| Affects Version/s: | 3.4.9, 3.7.1 |
| Fix Version/s: | 3.7.2 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Ronan Bohan | Assignee: | Blake Oler |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Backwards Compatibility: | Major Change | ||||||||||||||||
| Operating System: | ALL | ||||||||||||||||
| Steps To Reproduce: | Spin up a simple shared cluster with mlaunch:
Then run the following commands from the mongo shell:
|
||||||||||||||||
| Sprint: | Sharding 2018-02-12 | ||||||||||||||||
| Participants: | |||||||||||||||||
| Case: | (copied to CRM) | ||||||||||||||||
| Description |
|
(This issue may be related to SERVER-10987) Normally it's not possible to create a key which includes a $ symbol but the following somewhat bizarre (and admittedly contrived) command is accepted and generates really odd chunks:
What was meant of course was the following:
This second form fails as expected as MaxKey is greater than MinKey, but the first form matches more closely how chunks referencing MinKey and MaxKey are shown in, for example, the output of sh.status() Running the commands in the 'steps to reproduce' section results in the following 3 chunks being created:
And the output of sh.status() is as follows:
I have no idea how the balancer will react if it sees these chunk ranges... Another interesting aspect is the following:
In this case we're trying to set the range to MinKey -->> MaxKey but the validator rejects it (presumably because the min and max values are documents which are being compared in a binary manner and $minKey is alphabetically greater than $maxKey??) All of the above tested on MongoDB 3.4.9 |
| Comments |
| Comment by Max Hirschhorn [ 19/May/22 ] | ||||||
For posterity, the "min: { key: { $minKey: 1.0 } } should be less than max: { key: { $maxKey: 1.0 } }" error is expected because the literal object { "$minKey": 1 } compares greater than the literal object { "$maxKey": 1 }. { "$minKey": 1 } a BSON Object (type 0x03). MinKey is the literal MinKey value (type 0xFF). See also | ||||||
| Comment by Githook User [ 06/Feb/18 ] | ||||||
|
Author: {'email': 'blake.oler@mongodb.com', 'name': 'Blake Oler', 'username': 'BlakeIsBlake'}Message: |