[SERVER-55551] Remove drop index from create collection path Created: 26/Mar/21  Updated: 29/Oct/23  Resolved: 19/Apr/21

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 5.0.0-rc0

Type: Task Priority: Major - P3
Reporter: Marcos José Grillo Ramirez Assignee: Marcos José Grillo Ramirez
Resolution: Fixed Votes: 0
Labels: PM-1965-Milestone-1
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-54587 Make create collection resilient to s... Closed
depends on SERVER-55494 Retake the collection critical sectio... Closed
is depended on by SERVER-55969 Stop checking for DisableIncompleteSh... Closed
Duplicate
is duplicated by SERVER-55485 Add create collection parameters when... Closed
Problem/Incident
causes SERVER-56342 Throw an exception if the update on c... Closed
Backwards Compatibility: Fully Compatible
Sprint: Sharding 2021-04-05, Sharding EMEA 2021-05-03
Participants:

 Description   

If we are creating a collection the following scenario might happen:

  • We start sharding an empty collection with a hashed key index
  • There is a stepdown
  • A write sneaks in before resuming the coordinator
  • The new primary starts the phase two, but we cannot shard the collection with a hashed index that already has data so the shard collection fails

In order to ensure there is no leftover data at command termination, a drop index was added to the create collection path that will be executed only if the index was not already on the collection and we are recovering from a step down, however, this might generate the following scenario:

Imagine we have a 10TB collection and we try to shard the collection:

  • The request would block for 15 min in the critical section to create an index
  • The server is overwhelmed with parked network requests which block on the CS and crashes
  • The server comes back up and resumes shard collection, same thing happens over and over, because we drop the index and then recreate it again.

We must remove this drop index operation, in order to do so, we could, for example, use the same approach of resharding, by preventing writes on the collections on step up.



 Comments   
Comment by Githook User [ 19/Apr/21 ]

Author:

{'name': 'Marcos José Grillo Ramirez', 'email': 'marcos.grillo@mongodb.com', 'username': 'm4nti5'}

Message: SERVER-55551 Add recoverable critical section in create collection path
Branch: master
https://github.com/mongodb/mongo/commit/0e14fe6935ef5b044deea74d0354356cc84f0fa6

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