[SERVER-49181] Make writes call MigratingTenantAccessBlocker::checkIfCanWriteOrBlock in a migrationConflictRetry loop Created: 29/Jun/20  Updated: 29/Oct/23  Resolved: 03/Aug/20

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: None
Fix Version/s: 4.7.0

Type: Task Priority: Major - P3
Reporter: Esha Maharishi (Inactive) Assignee: Cheahuychou Mao
Resolution: Fixed Votes: 0
Labels: pm-1791_milestone-A
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Participants:

 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.



 Comments   
Comment by Githook User [ 03/Aug/20 ]

Author:

{'name': 'Cheahuychou Mao', 'email': 'cheahuychou.mao@mongodb.com', 'username': 'cheahuychou'}

Message: SERVER-49181 Make writes call MigratingTenantAccessBlocker::checkIfCanWriteOrBlock in a migrationConflictRetry loop
Branch: master
https://github.com/mongodb/mongo/commit/5dbb79146a7f1b0770a7d3f65e5e9079229f593f

Generated at Thu Feb 08 05:19:10 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.