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

Make writes call MigratingTenantAccessBlocker::checkIfCanWriteOrBlock in a migrationConflictRetry loop

    XMLWordPrintable

    Details

      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

            Assignee:
            cheahuychou.mao Cheahuychou Mao
            Reporter:
            esha.maharishi Esha Maharishi
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: