[SERVER-66715] Avoid using AllowLockAcquisitionOnTimestampedUnitOfWork for the change collection Created: 24/May/22  Updated: 29/Oct/23  Resolved: 12/Apr/23

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

Type: Task Priority: Major - P3
Reporter: Rishab Joshi (Inactive) Assignee: Mindaugas Malinauskas
Resolution: Fixed Votes: 1
Labels: pm-2334-followup, tech-debt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Gantt Dependency
has to be done before SERVER-71327 Get rid of using AllowLockAcquisition... Backlog
has to be done after SERVER-67267 Inject tenant Ids for change stream m... Closed
Problem/Incident
Related
is related to SERVER-66639 Write manager class for pre-image col... Closed
Backwards Compatibility: Fully Compatible
Sprint: QE 2023-02-06, QE 2023-02-20, QE 2023-03-06, QE 2023-03-20, QE 2023-04-03, QE 2023-04-17
Participants:
Linked BF Score: 135

 Description   

The change collection when writing documents takes AllowLockAcquisitionOnTimestampedUnitOfWork. The AllowLockAcquisitionOnTimestampedUnitOfWork has some implications, for eg. it stalls replications. This ticket is about exploring solutions to avoid using it.

One solution was to take the change collection within the context of the AutoGetCollection. This POC was done here but it was complicated and hard to reason for deadlocks.

Another solution is to use an atomic flag. The insertion code path takes the reader lock and the drop collection takes the writer lock. The insertion logic will not block each other because they are using the reader lock. The drop and insertion code path will be synchronized using the writer lock. It should be noted that the insertions to the change collection are happening within the context of the timestamped unit of work, so they themselves are synchronized.



 Comments   
Comment by Githook User [ 12/Apr/23 ]

Author:

{'name': 'Mindaugas Malinauskas', 'email': 'mindaugas.malinauskas@mongodb.com', 'username': ''}

Message: SERVER-66715 Add tenant lock
Branch: master
https://github.com/mongodb/mongo/commit/ed0d55f7e8686c7c71fe113554e7e2782d7ea6d8

Comment by Githook User [ 05/Apr/23 ]

Author:

{'name': 'Tommaso Tocci', 'email': 'tommaso.tocci@mongodb.com', 'username': 'toto-dev'}

Message: Revert "SERVER-66715 Add tenant lock"

This reverts commit b9d8a47872050ca5fe6c1b95fcb0534e6e0ebc3d.
Branch: master
https://github.com/mongodb/mongo/commit/f2df94329a61c09fddeb8007b184b900be22b774

Comment by Githook User [ 04/Apr/23 ]

Author:

{'name': 'Mindaugas Malinauskas', 'email': 'mindaugas.malinauskas@mongodb.com', 'username': ''}

Message: SERVER-66715 Add tenant lock
Branch: master
https://github.com/mongodb/mongo/commit/b9d8a47872050ca5fe6c1b95fcb0534e6e0ebc3d

Comment by Mindaugas Malinauskas [ 27/Oct/22 ]

Added a link to the ticket SERVER-67267 which is required to make certain tests pass.

Generated at Thu Feb 08 06:06:13 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.