[SERVER-61487] Investigate retryability of the createIndexes command in mongos Created: 15/Nov/21  Updated: 18/Nov/21  Resolved: 18/Nov/21

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

Type: Task Priority: Major - P3
Reporter: Pavithra Vetriselvan Assignee: Gabriel Marks
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Sprint: Execution Team 2021-11-29
Participants:

 Description   

In sharded configurations, indexes are copied during chunk migrations. If there are no migrations, then there's no automatic mechanism to make indexes consistent across shards.

There's a background thread that we can use to detect missing indexes. If there are, we'd need to re-run the same createIndex command.

This ticket should investigate whether mongos needs to internally retry the createIndexes on NotPrimary-esque errors or whether that should be left to the replicator.



 Comments   
Comment by Gabriel Marks [ 18/Nov/21 ]

We have come to the conclusion that the best plan is not to add any retry logic to mongos for now, but rather add the retry logic to the replicator. The reason for this is that we would have to add the retry logic to the replicator anyways, and also that there are plans (see scope of PM-2583) to build a DDL coordinator on a primary-only service for createIndexes in the near future which would handle this retrying more reliably than mongos.

Comment by Kaloian Manassiev [ 15/Nov/21 ]

There is no right answer here with how createIndexes works currently. It does not synchronise with other create indexes or with moveChunk at a global level. Automatically retrying from MongoS is probably better customer experience, although it may cause some (poorly written) concurrency tests to fail based on what they were expecting previously with respect to failures.

Also see PM-2583.

Generated at Thu Feb 08 05:52:33 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.