[SERVER-66835] [test-only bug] Compare number of chunks in balancing_based_on_size.js Created: 27/May/22  Updated: 29/Oct/23  Resolved: 01/Jun/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.0.3, 6.1.0-rc0

Type: Bug Priority: Major - P3
Reporter: Pierlauro Sciarelli Assignee: Pierlauro Sciarelli
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:
v6.0
Sprint: Sharding EMEA 2022-06-13
Participants:
Linked BF Score: 21

 Description   

Change this data size comparison with a comparison on number of chunks: this is equivalent because that part of the test simply needs to verify that no move has happened due to expected no-op balancing rounds.

Long explanation (from a build failure)

When a range deletion happens:
1. The documents in range are deleted.
2. The counter of orphans is updated, triggering also an update of the orphans counter on the BalancerStatsRegistry.

Note that points 1-2 are not happening in the same storage transaction, and - even if they would - the update of the in-memory stats registry would still not happen atomically.

The test uses the get stats for balancing command that - when invoked for a namespace:
A. Retrieves the total data size for the collection from the storage stats.
B. Retrieves the number of orphans for the collection from the BalancerStatsRegistry.

The test is doing the following:

According to the failure, the actual data size on the donor was 6 before the no-op rounds and became 7 after the no-op rounds. However, no move has happened and the rounds really resulted in no-ops.

The only viable explanation is that the following flow interleaving happened: 1 - A - 2 - B. Basically the balancer stats registry retrieved the data size after an orphaned document was deleted but before the number of orphans was updated. This resulted in an off-by-one.



 Comments   
Comment by Githook User [ 14/Oct/22 ]

Author:

{'name': 'Pierlauro Sciarelli', 'email': 'pierlauro.sciarelli@mongodb.com', 'username': 'pierlauro'}

Message: SERVER-66835 Compare number of chunks in balancing_based_on_size.js
Branch: v6.0
https://github.com/mongodb/mongo/commit/dc846d69a62b3f6ef7218df06dd5f7a15d0e3264

Comment by Githook User [ 01/Jun/22 ]

Author:

{'name': 'Pierlauro Sciarelli', 'email': 'pierlauro.sciarelli@mongodb.com', 'username': 'pierlauro'}

Message: SERVER-66835 Compare number of chunks in balancing_based_on_size.js
Branch: master
https://github.com/mongodb/mongo/commit/0f1053354a132f8259e740f927dc9e67a2c64cea

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