[SERVER-71543] `sh.getShardDistribution` concatenates strings instead of summing number of docs Created: 22/Nov/22  Updated: 28/Nov/22  Resolved: 28/Nov/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Pierlauro Sciarelli Assignee: Jordi Serra Torrens
Resolution: Incomplete Votes: 0
Labels: sharding-wfbf-day
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to MONGOSH-1329 Bad arithmetic on getShardDistribution Closed
Operating System: ALL
Sprint: Sharding EMEA 2022-12-12
Participants:

 Description   

The total number of documents for a collection is expected to be returned as part of the output of getShardDistribution. However, currently the returned number is wrong as it concatenates strings representing the number of docs present on each shard rather than performing the actual sum.

This has been observed on a user cluster. Relevant part of the output:

Shard 0
 
{
  ....
  docs: 22558525,
  ....
}
 
---
 
Shard 1
{
  ....
  docs: Long("2533229933"),
  ....
}
 
---
 
Shard 2
 
{
  ....
  docs: Long("2543629431"),
  ....
}
 
---
 
Shard 3
 
{
  ....
  docs: Long("2601286991"),
  ....
}
 
---
 
Shard 4
 
{
  ....
  docs: Long("2639120994")
  ....
}
 
---
 
Totals
 
{
  docs: '225585252533229933254362943126012869912639120994',
....
}



 Comments   
Comment by Jordi Serra Torrens [ 28/Nov/22 ]

This output corresponds to MONGOSH's getShardDistribution, rather than the legacy shell. I've filed MONGOSH-1329 to address this.

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