[SERVER-38384] More verbose sh.shardCollection command Created: 04/Dec/18  Updated: 06/Dec/22  Resolved: 23/Sep/19

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

Type: Improvement Priority: Major - P3
Reporter: Miguel Angel Nieto Assignee: [DO NOT USE] Backlog - Sharding Team
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Sharding
Participants:
Case:

 Description   

Hello,

There are cases when sh.shardCollection takes a very long time. During that time the MongoDB Shell is hung.

This is a bad user experience, since there is no information on what is happening and no estimates. Also, closing the window by mistake could probably cancel the operation after a very long wait.

To provide a better user experience the sh.shardCollection should:

  • Provide verbose output of the different steps and remaining time.

or

  • If that is not possible, return the shell prompt, inform the user that the operation is in progress and let the process run. Then, make the progress of the operation and its result available in sh.status output.

Regards.



 Comments   
Comment by Randolph Tan [ 11/Dec/18 ]

Notes:

Shard coll summary (as of 4.1.6):

1. Get distLocks for db and coll.
2. Check if any index is compatible with shard key and doesn't violate uniqueness.
3. Check every document whether the contain the full shard key with checkShardingIndex command.
4. Check zones.
5. Get uuid from primary shard.
6. Update config.collections.
7. Create initial chunks.

The checkShardingIndex command by far has the potential to take a long time, since it had to scan every single document.

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