Details
-
Task
-
Resolution: Fixed
-
Major - P3
-
None
-
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.