jstests/replsets/tenant_migration_concurrent_writes_on_donor.js
/**
 * Tests that the donor blocks writes that are executed in the blocking state.
 */
Tests that the donor blocks writes that are executed in the blocking state.
Tests that the donor blocks writes that are executed in the blocking state .
function testBlockWritesAfterMigrationEnteredBlocking(testCase, testOpts) {
    const tenantId = testOpts.dbName.split('_')[0];
    const migrationOpts = {
        migrationIdString: extractUUIDFromObject(UUID()),
        tenantId,
    };
    let blockingFp =
        configureFailPoint(testOpts.primaryDB, "pauseTenantMigrationBeforeLeavingBlockingState");
    assert.commandWorked(
        tenantMigrationTest.startMigration(migrationOpts, {enableDonorStartMigrationFsync: true}));
    blockingFp.wait();
    testOpts.command.maxTimeMS = kMaxTimeMS;
    runCommand(testOpts, ErrorCodes.MaxTimeMSExpired);
    blockingFp.off();
    TenantMigrationTest.assertCommitted(tenantMigrationTest.waitForMigrationToComplete(
        migrationOpts, false ));
    testCase.assertCommandFailed(testOpts.primaryDB, testOpts.dbName, testOpts.collName);
    checkTenantMigrationAccessBlocker(testOpts.primaryDB, tenantId, {numBlockedWrites: 1});
    assert.commandWorked(tenantMigrationTest.forgetMigration(migrationOpts.migrationIdString));
    tenantMigrationTest.waitForMigrationGarbageCollection(migrationOpts.migrationIdString);
}
function testBlockWritesAfterMigrationEnteredBlocking ( testCase , testOpts ) { const tenantId = testOpts . dbName . split ( '_' ) [ 0 ] ; const migrationOpts = { migrationIdString : extractUUIDFromObject ( UUID ( ) ) , tenantId , } ; let blockingFp = configureFailPoint ( testOpts . primaryDB , "pauseTenantMigrationBeforeLeavingBlockingState" ) ; assert . commandWorked ( tenantMigrationTest . startMigration ( migrationOpts , { enableDonorStartMigrationFsync : true } ) ) ; blockingFp . wait ( ) ; testOpts . command . maxTimeMS = kMaxTimeMS ; runCommand ( testOpts , ErrorCodes . MaxTimeMSExpired ) ; blockingFp . off ( ) ; TenantMigrationTest . assertCommitted ( tenantMigrationTest . waitForMigrationToComplete ( migrationOpts , false ) ) ; testCase . assertCommandFailed ( testOpts . primaryDB , testOpts . dbName , testOpts . collName ) ; checkTenantMigrationAccessBlocker ( testOpts . primaryDB , tenantId , { numBlockedWrites : 1 } ) ; assert . commandWorked ( tenantMigrationTest . forgetMigration ( migrationOpts . migrationIdString ) ) ; tenantMigrationTest . waitForMigrationGarbageCollection ( migrationOpts . migrationIdString ) ; }
Tests that the donor blocks writes that are executed in the blocking state.
Tests that the donor blocks writes that are executed in the blocking state .
// Run the command after the migration enters the blocking state. // Allow the migration to complete. /* retryOnRetryableErrors */