[SERVER-47436] Make shards validate shardKey in dataSize command Created: 09/Apr/20 Updated: 29/Oct/23 Resolved: 14/Apr/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Sharding |
| Affects Version/s: | None |
| Fix Version/s: | 4.2.6, 4.0.19, 4.4.0-rc2, 4.7.0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Cheahuychou Mao | Assignee: | Cheahuychou Mao |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||
| Operating System: | ALL | ||||||||||||
| Backport Requested: |
v4.4, v4.2, v4.0, v3.6
|
||||||||||||
| Sprint: | Sharding 2020-04-20 | ||||||||||||
| Participants: | |||||||||||||
| Description |
|
Currently, the dataSize command can fail with BadValue error due to shard key validation if it is run on a stale mongos after the collection is resharded with a different shard key. This is because the mongos validates the command's keyPattern with its stale ChunkManager before sending requests to shards. Since the command fails with BadValue, nothing causes the mongos to refresh so the command continues to fail after that.
To resolve this, we should make each shard validate "shardKey", "min" and "max" by itself. That way, if the mongos is stale, the dataSize command would fail with StaleConfig (instead of BadValue) in the initial try. This error would cause the stale mongos to refresh and the command to succeed when the mongos retries .
|
| Comments |
| Comment by Githook User [ 14/Apr/20 ] |
|
Author: {'name': 'Cheahuychou Mao', 'email': 'cheahuychou.mao@mongodb.com', 'username': 'cheahuychou'}Message: |
| Comment by Githook User [ 14/Apr/20 ] |
|
Author: {'name': 'Cheahuychou Mao', 'email': 'cheahuychou.mao@mongodb.com', 'username': 'cheahuychou'}Message: (cherry picked from commit 59e005fea0e1ca575083ded8c02c518048fb8af0) |
| Comment by Githook User [ 14/Apr/20 ] |
|
Author: {'name': 'Cheahuychou Mao', 'email': 'cheahuychou.mao@mongodb.com', 'username': 'cheahuychou'}Message: (cherry picked from commit 59e005fea0e1ca575083ded8c02c518048fb8af0) |
| Comment by Githook User [ 14/Apr/20 ] |
|
Author: {'name': 'Cheahuychou Mao', 'email': 'cheahuychou.mao@mongodb.com', 'username': 'cheahuychou'}Message: (cherry picked from commit 59e005fea0e1ca575083ded8c02c518048fb8af0) |
| Comment by Githook User [ 14/Apr/20 ] |
|
Author: {'name': 'Cheahuychou Mao', 'email': 'cheahuychou.mao@mongodb.com', 'username': 'cheahuychou'}Message: |