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

Make writes call MigratingTenantAccessBlocker::checkIfCanWriteOrBlock in a migrationConflictRetry loop

    XMLWordPrintableJSON

Details

    • Fully Compatible

    Description

      Writes, or more specifically commands that can write, should call checkIfCanWriteOrBlock in a loop as described in migrating_tenant_access_blocker.h:

        template <typename F>
        auto migrationConflictRetry(OperationContext* opCtx, const Database* db, F&& f) {
            while (true) {
                try {
                    return f();
                } catch (const MigrationConflictException&) {
                    MigratingTenantAccessBlocker::get(db).checkIfCanWriteOrBlock(opCtx);
                }
            }
        }
      

      The loop should be above any database or collection locks.

      The loop might look slightly different (e.g., not take a 'F' argument and instead wrap some existing code) depending on the implementation.

      This ticket should also test that all writes block if the "start blocking" write has occurred.

      Attachments

        Activity

          People

            cheahuychou.mao@mongodb.com Cheahuychou Mao
            esha.maharishi@mongodb.com Esha Maharishi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: