[SERVER-41632] db.collection.getShardDistribution() shows NaN Created: 11/Jun/19  Updated: 29/Oct/23  Resolved: 01/Jul/19

Status: Closed
Project: Core Server
Component/s: Sharding, Shell
Affects Version/s: 3.6.3
Fix Version/s: 4.0.11, 4.2.0-rc5, 4.3.1

Type: Bug Priority: Minor - P4
Reporter: Gilad Peleg Assignee: Randolph Tan
Resolution: Fixed Votes: 0
Labels: neweng, sharding-wfbf-day
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.2, v4.0
Steps To Reproduce:
  1. Create a new collection
  2. Shard collection
  3. run `db.collection.getShardDistribution()`
  4. See `NaN` in aggregations
Participants:

 Description   

Running `db.collection.getShardDistribution()` when collection has no documents shows `NaN` in several aggregations:

 

 mongos> db.labels_ng_1_1.getShardDistribution()
 
Shard Prod-Shard_2 at Prod-Shard_2/shard:27018
 data : 0B docs : 0 chunks : 1
 estimated data per chunk : 0B
 estimated docs per chunk : 0Totals
 data : 0B docs : 0 chunks : 1
 Shard Prod-Shard_2 contains NaN% data, NaN% docs in cluster, avg obj size on shard : NaNGiB



 Comments   
Comment by Githook User [ 12/Jul/19 ]

Author:

{'name': 'Randolph Tan', 'email': 'randolph@10gen.com', 'username': 'renctan'}

Message: SERVER-41632 Fix division by zero in shell collStats helper

(cherry picked from commit 83a0d0d890e375dfafe0e464f3f56fbdedf5189e)
Branch: v4.0
https://github.com/mongodb/mongo/commit/86380492129440f1d150b804810207b079ee8285

Comment by Githook User [ 09/Jul/19 ]

Author:

{'name': 'Randolph Tan', 'username': 'renctan', 'email': 'randolph@10gen.com'}

Message: SERVER-41632 Fix division by zero in shell collStats helper

(cherry picked from commit 83a0d0d890e375dfafe0e464f3f56fbdedf5189e)
Branch: v4.2
https://github.com/mongodb/mongo/commit/40b6fd725ccb0464644b1b9f75b113ebf7ed6a74

Comment by Gilad Peleg [ 02/Jul/19 ]

Amazing job, thanks!

Comment by Githook User [ 01/Jul/19 ]

Author:

{'name': 'Randolph Tan', 'email': 'randolph@10gen.com', 'username': 'renctan'}

Message: SERVER-41632 Fix division by zero in shell collStats helper
Branch: master
https://github.com/mongodb/mongo/commit/83a0d0d890e375dfafe0e464f3f56fbdedf5189e

Comment by Danny Hatcher (Inactive) [ 11/Jun/19 ]

Hello Gilad,

Thanks for the report. I've forwarded it along to the appropriate team.

Danny

Generated at Thu Feb 08 04:58:16 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.