[SERVER-36961] createIndexes command should check if index already exists with weak lock Created: 31/Aug/18  Updated: 29/Oct/23  Resolved: 18/Sep/18

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: None
Fix Version/s: 3.6.9, 4.0.3, 4.1.4

Type: Improvement Priority: Critical - P2
Reporter: Asya Kamsky Assignee: Louis Williams
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Problem/Incident
causes SERVER-36921 Transaction lock timeout errors when ... Closed
Related
related to SERVER-47268 noop_createIndexes_not_blocked_by_txn... Closed
is related to SERVER-36954 server keeps trying to create an inde... Closed
Backwards Compatibility: Fully Compatible
Backport Requested:
v4.0, v3.6
Sprint: Storage NYC 2018-09-24
Participants:
Linked BF Score: 8

 Description   

Currently createIndexes command takes the locks it needs to actual create an index.  If the index already exists (as is the case in a lot of scenarios where "just in case" createIndex is sent periodically or before running some process) concurrency could benefit significantly from checking if the index already exists under a weak lock.

This would benefit cases where the index exists as is (success returned) or the index exists but with different options (failure returned) - neither of these would contribute to command requiring a strong lock.



 Comments   
Comment by Githook User [ 10/Oct/18 ]

Author:

{'name': 'Louis Williams', 'email': 'louis.williams@mongodb.com', 'username': 'louiswilliams'}

Message: SERVER-36961 createIndexes command should check if indexes already exist with weak lock

(cherry picked from commit 44c1dcf0e962bda6c37c02c9e8bebcc4fa6e447e)
Branch: v3.6
https://github.com/mongodb/mongo/commit/f6aab22aec3bd04f0a28cfa2dfb55c6911321a99

Comment by Eric Milkie [ 09/Oct/18 ]

It looks like the backport will be clean so I'll approve it.

Comment by Blake Oler [ 05/Oct/18 ]

Requesting a 3.6 backport via JIRA. This should be treated with the same priority as the original ticket so that the LogicalSessionCache can be stabilized on 3.6. CC milkie

Comment by Blake Oler [ 03/Oct/18 ]

It'd be great if we could backport this to 3.6. That would help us prevent lock timeout issues in the LogicalSessionCache. Is this possible louis.williams?

Comment by Githook User [ 21/Sep/18 ]

Author:

{'name': 'Louis Williams', 'email': 'louis.williams@mongodb.com', 'username': 'louiswilliams'}

Message: SERVER-36961 createIndexes command should check if indexes already exist with weak lock

(cherry picked from commit 44c1dcf0e962bda6c37c02c9e8bebcc4fa6e447e)
Branch: v4.0
https://github.com/mongodb/mongo/commit/135950154d1d319217cd544ea3e3f067213f9645

Comment by Githook User [ 18/Sep/18 ]

Author:

{'name': 'Louis Williams', 'email': 'louis.williams@mongodb.com', 'username': 'louiswilliams'}

Message: SERVER-36961 createIndexes command should check if indexes already exist with weak lock
Branch: master
https://github.com/mongodb/mongo/commit/44c1dcf0e962bda6c37c02c9e8bebcc4fa6e447e

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