- 
    Type:
Improvement
 - 
    Resolution: Fixed
 - 
    Priority:
Major - P3
 - 
    Affects Version/s: 5.0.0-rc1
 - 
    Component/s: Sharding
 
- 
        Fully Compatible
 - 
        v5.0
 - 
        Sharding EMEA 2021-07-26, Sharding EMEA 2021-08-09
 - 
        None
 
- 
        None
 - 
        None
 - 
        None
 - 
        None
 - 
        None
 - 
        None
 
As discovered during the investigation of SERVER-57309, the update of config.chunks entries during setFCV - happening under the chunk operations lock - may block migrations for long periods in presence of a lot of chunks.
Following, the results of some simple downgrade/upgrade experiments with different number of chunks (executed on the virtual workstation):
| downgrade | downgrade | upgrade | upgrade | |
|---|---|---|---|---|
| update operation number of chunks  | 
$set ns | $unset uuid & timestamp | $set uuid & timestamp | $unset ns | 
| 100K | 32 s | 27 s | 22 s | 31 s | 
| 500K | 180 s | 164 s | 117 s | 144 s | 
| 1M | 324 s | 313 s | 211 s | 271 s | 
A possible improvement to reduce the window in which balancing is not allowed would be to perform the $unset operations outside such lock, but still during setFCV.