[SERVER-31715] createIndexes (and dropIndexes) may not create index (or leave index around) if migration happens concurrently Created: 25/Oct/17  Updated: 27/Oct/23  Resolved: 01/Nov/20

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

Type: Bug Priority: Major - P3
Reporter: Esha Maharishi (Inactive) Assignee: [DO NOT USE] Backlog - Sharding Team
Resolution: Gone away Votes: 3
Labels: gm-ack
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Duplicate
is duplicated by SERVER-36125 Race in moveChunk and createIndex can... Closed
Related
related to SERVER-31485 Race between move chunks and dropInde... Closed
related to SERVER-33234 dropIndexes on mongos should ignore I... Closed
Assigned Teams:
Sharding
Participants:
Case:
Linked BF Score: 15

 Description   

Bug #1: It's possible to get ok:1 from createIndexes, but not have the index propagated to all shards if a migration happens in between the recipient and donor shards processing the createIndexes.

In this case, the raw response for the createIndex from each shard will contain either CannotImplicitlyCreateCollection or ok:1, and the overall createIndexes command will return ok:1.

Today, to remedy this, createIndexes can be re-run against against the mongos. This second createIndexes will return ok:1, since createIndexes is idempotent.

Bug #2: It's possible to get ok:1 from dropIndexes, but have the index get created afterwards on some shard if a migration happens in between the recipient and donor shards processing the dropIndexes.

In this case, the raw responses for the dropIndex from each shard will contain either NamespaceNotFound or ok:1, and the overall dropIndexes command response will be ok:1.

Today, to remedy this, dropIndexes can be re-run against the mongos. This second dropIndexes will return ok:0, since dropIndexes is not idempotent, but the index will get dropped from any shards that had the index.



 Comments   
Comment by Esha Maharishi (Inactive) [ 01/Nov/20 ]

This was fixed in 4.4 by the "Each Shard Has Correct Indexes" project.

Comment by David Zacchi [ 22/Jul/19 ]

This issue impacts our Production system and prevents having several mongoS targeted by the application which is a single point of failure.

We need this fixed as soon as possible, thanks !

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