[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:
Backports
Duplicate
is duplicated by SERVER-38219 dataSize, collStats diagnostic comman... Closed
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: SERVER-47436 Add requires_fcv_44 to mongos_dataSize.js
Branch: v4.4
https://github.com/mongodb/mongo/commit/ac237fc725e9ea3d9ec86ec49687506eab4d777d

Comment by Githook User [ 14/Apr/20 ]

Author:

{'name': 'Cheahuychou Mao', 'email': 'cheahuychou.mao@mongodb.com', 'username': 'cheahuychou'}

Message: SERVER-47436 Make shards validate shardKey in dataSize command

(cherry picked from commit 59e005fea0e1ca575083ded8c02c518048fb8af0)
(cherry picked from commit 20364840b8f1af16917e4c23c1b5f5efd8b352f8)
Branch: v4.0
https://github.com/mongodb/mongo/commit/2c23d00111f3f48c4e205da86b424987e3bc2b3b

Comment by Githook User [ 14/Apr/20 ]

Author:

{'name': 'Cheahuychou Mao', 'email': 'cheahuychou.mao@mongodb.com', 'username': 'cheahuychou'}

Message: SERVER-47436 Make shards validate shardKey in dataSize command

(cherry picked from commit 59e005fea0e1ca575083ded8c02c518048fb8af0)
Branch: v4.2
https://github.com/mongodb/mongo/commit/20364840b8f1af16917e4c23c1b5f5efd8b352f8

Comment by Githook User [ 14/Apr/20 ]

Author:

{'name': 'Cheahuychou Mao', 'email': 'cheahuychou.mao@mongodb.com', 'username': 'cheahuychou'}

Message: SERVER-47436 Make shards validate shardKey in dataSize command

(cherry picked from commit 59e005fea0e1ca575083ded8c02c518048fb8af0)
Branch: v4.4
https://github.com/mongodb/mongo/commit/1dd9047b77203ba0ae6437604343c1e73d07636e

Comment by Githook User [ 14/Apr/20 ]

Author:

{'name': 'Cheahuychou Mao', 'email': 'cheahuychou.mao@mongodb.com', 'username': 'cheahuychou'}

Message: SERVER-47436 Make shards validate shardKey in dataSize command
Branch: master
https://github.com/mongodb/mongo/commit/59e005fea0e1ca575083ded8c02c518048fb8af0

Generated at Thu Feb 08 05:14:11 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.