Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-66715

Avoid using AllowLockAcquisitionOnTimestampedUnitOfWork for the change collection

    • Fully Compatible
    • QE 2023-02-06, QE 2023-02-20, QE 2023-03-06, QE 2023-03-20, QE 2023-04-03, QE 2023-04-17
    • 135

      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.

            Assignee:
            mindaugas.malinauskas@mongodb.com Mindaugas Malinauskas
            Reporter:
            rishab.joshi@mongodb.com Rishab Joshi (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: