mongodb
sharding_error
ai_generated
true
MongoServerError: chunk too large to move: data size exceeds maximum chunk size
ID: mongodb/sharding-chunk-too-large
78%Fix Rate
83%Confidence
3Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 7 | active | — | — | — |
Root Cause
Chunk exceeds maximum size (default 128MB) and cannot be migrated. Caused by poor shard key choice leading to jumbo chunks.
genericWorkarounds
-
85% success Split the jumbo chunk manually
sh.splitAt('mydb.collection', { shardKeyField: splitPoint }) # find splitPoint with db.collection.find().sort({shardKey:1}).skip(N)Sources: https://www.mongodb.com/docs/manual/administration/
-
82% success Refine the shard key to increase cardinality (MongoDB 5.0+)
sh.refineCollectionShardKey('mydb.collection', { existingKey: 1, newField: 1 }) # adds suffix field -
78% success Clear the jumbo flag after manual splitting
db.adminCommand({ clearJumboFlag: 'mydb.collection', bounds: [{ key: MinKey }, { key: MaxKey }] })
Dead Ends
Common approaches that don't work:
-
Increase chunkSize to accommodate the large chunks
80% fail
Larger chunks reduce balancer effectiveness. The root issue is shard key cardinality, not chunk size.
-
Manually move the jumbo chunk with force flag
75% fail
Force-moving jumbo chunks can cause out-of-memory on the target shard during migration.