-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Sharding
-
None
-
Sharding
-
ALL
-
Suppose you have a collection "coll" sharded by some non-_id shard key, {shardKey: 1}. Users are allowed to run a mapReduce operation with the output option {replace: "coll", sharded: true}. This means that "coll" should be replaced by the output of the mapReduce, and that the new collection should be sharded.
New sharded collections created by mapReduce are sharded by {_id: 1}, an assumption which is made in several places in the code. During the replace, however, the collection is never re-sharded by {_id: 1}. Instead, the sharding metadata continues to show that the shard key is {shardKey: 1}.
The documents in the mapReduce output collection are of the form
{_id: <key>, value: <value>}
These documents are missing the shard key! The collection at this point is broken and queries against it can return incorrect results. See the repro steps for details.
- duplicates
-
SERVER-14324 MapReduce does not respect existing shard key on output:sharded
- Closed