[SERVER-78167] analyzeShardKey command doesn't always throw an error when the collection becomes empty during the command Created: 16/Jun/23  Updated: 29/Oct/23  Resolved: 20/Jun/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.1.0-rc0, 7.0.0-rc6

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
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v7.0
Sprint: Sharding NYC 2023-06-26
Participants:
Linked BF Score: 35

 Description   

Currently, if the collection becomes empty after the initial check at the start the calculation of the characteristics about the shard key, and the supporting the index for the shard key is a unique index, the analyzeShardKey would return the following metrics instead of failing with an IllegalOperation error it would in the case where the index is not unique.

{  "numDocs" : NumberLong(0),  "isUnique" : true,  "numDistinctValues" : NumberLong(0),  "mostCommonValues" : [ ],  "monotonicity" : {  "recordIdCorrelationCoefficient" : 0,  "type" : "not monotonic" },  "avgDocSizeBytes" : NumberLong(0),  "readDistribution" : {  "sampleSize" : {  "total" : NumberLong(0),  "find" : NumberLong(0),  "aggregate" : NumberLong(0),  "count" : NumberLong(0),  "distinct" : NumberLong(0) } },  "writeDistribution" : {  "sampleSize" : {  "total" : NumberLong(0),  "update" : NumberLong(0),  "delete" : NumberLong(0),  "findAndModify" : NumberLong(0) } },  "ok" : 1,  "$clusterTime" : {  "clusterTime" : Timestamp(1686168499, 3549),  "signature" : {  "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),  "keyId" : NumberLong(0) } },  "operationTime" : Timestamp(1686168499, 3549) }



 Comments   
Comment by Githook User [ 21/Jun/23 ]

Author:

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

Message: SERVER-78167 Make sure analyzeShardKey command always throws an error when the collection becomes empty during the command

(cherry picked from commit 05cb8dd2bba6db13e4f08fc93d07f5ae97c876a2)
Branch: v7.0
https://github.com/mongodb/mongo/commit/45050ea8d388610cf6c120d8083abb286de47cf7

Comment by Githook User [ 20/Jun/23 ]

Author:

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

Message: SERVER-78167 Make sure analyzeShardKey command always throws an error when the collection becomes empty during the command
Branch: master
https://github.com/mongodb/mongo/commit/05cb8dd2bba6db13e4f08fc93d07f5ae97c876a2

Generated at Thu Feb 08 06:37:37 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.