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

Remove check for shouldConflictWithSecondaryBatchApplication() in isCollectionLockedForMode()

    XMLWordPrintable

Details

    • Task
    • Status: Backlog
    • Major - P3
    • Resolution: Unresolved
    • None
    • None
    • None

    Description

      isCollectionLockedForMode() has a special case where it always returns true if shouldConflictWithSecondaryBatchApplication returns false:
      https://github.com/mongodb/mongo/blob/1522b29e65bffd4c438756e5202aef062410864d/src/mongo/db/concurrency/lock_state.cpp#L630-L631

      While we might not need to hold locks in this special mode it causes seemingly confusing behavior where the locker reports that locks are held.

      We have invariants throughout the codebase that checks if Collections are locked in certain modes. Here are a few that would start firing in certain conditions if the shouldConflictWithSecondaryBatchApplication check is removed from isCollectionLockedForMode

      https://github.com/mongodb/mongo/blob/3a4dda6f0dc7f32e91310b9256cd3b499f7715d2/src/mongo/db/pipeline/pipeline_d.cpp#L110-L112

      https://github.com/mongodb/mongo/blob/bc41e7992d3c4e84a532e3833623b8e237a281e4/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp#L2458-L2460

      https://github.com/mongodb/mongo/blob/bc41e7992d3c4e84a532e3833623b8e237a281e4/src/mongo/db/s/collection_sharding_state.cpp#L120-L121

      https://github.com/mongodb/mongo/blob/bc41e7992d3c4e84a532e3833623b8e237a281e4/src/mongo/db/catalog/database_impl.cpp#L529-L530

      Attachments

        Issue Links

          Activity

            People

              backlog-server-execution Backlog - Storage Execution Team
              henrik.edin@mongodb.com Henrik Edin
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: