[SERVER-38471] Concurrent mapReduce to same output sharded collection can trigger invariant Created: 07/Dec/18  Updated: 06/Dec/22  Resolved: 21/Dec/18

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

Type: Bug Priority: Major - P3
Reporter: Randolph Tan 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

Issue Links:
Depends
Duplicate
duplicates SERVER-37679 Concurrent sharded fuzzers should not... Closed
Related
is related to SERVER-37679 Concurrent sharded fuzzers should not... Closed
Assigned Teams:
Sharding
Operating System: ALL
Participants:
Linked BF Score: 53

 Description   

Normal mapReduce finish flow:

1. shardCollection is run on outputColl. outputColl is created in the shard with UUIDA. UUIDFinal is stored in config.collections for outputColl.
2. mapReduce finish is sent to shard with UUIDFinal. Shard creates tempColl with UUIDFinal and outputs results to tempColl.
3. outputColl (created at step#1) is dropped.
4. tempColl is renamed to outputColl.

Case that will trigger invariant:
1. mr1 runs shardColl on outputColl. outputColl is created in the shard with UUIDA. UUIDFinal is stored in config.collections for outputColl.
2. mr2 runs shardColl on outputColl. outputColl is already sharded with UUIDFinal.
3. mr1 sends mapReduce finish to shard. tempColl1 gets created with UUIDFinal and becomes outputColl.
4. mr2 sends mapReduce finish to shard. tempColl2 gets created with UUIDFinal (which has the same UUID as outputColl because of step#3!).
5. mr2 drops outputColl which removes UUIDFinal from UUIDCatalog.
6. mr2 tries to rename tempColl2 to outputColl but can't find UUIDFinal from the catalog and triggers invariant.


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