jstests/replsets/tenant_migration_concurrent_writes_on_donor.js
/**
 * Tests that the donor does not reject writes after the migration aborts.
 */
Tests that the donor does not reject writes after the migration aborts.
Tests that the donor does not reject writes after the migration aborts .
function testDoNotRejectWritesAfterMigrationAborted(testCase, testOpts) {
    const tenantId = testOpts.dbName.split('_')[0];
    const migrationOpts = {
        migrationIdString: extractUUIDFromObject(UUID()),
        tenantId,
    };
    let abortFp =
        configureFailPoint(testOpts.primaryDB, "abortTenantMigrationBeforeLeavingBlockingState");
    TenantMigrationTest.assertAborted(tenantMigrationTest.runMigration(migrationOpts, {
        retryOnRetryableErrors: false,
        automaticForgetMigration: false,
        enableDonorStartMigrationFsync: true
    }));
    abortFp.off();
    assert.soon(() => {
        const mtab = TenantMigrationUtil.getTenantMigrationAccessBlocker(
            {donorNode: testOpts.primaryDB, tenantId});
        return mtab.donor.state === TenantMigrationTest.DonorAccessState.kAborted;
    });
    runCommand(testOpts);
    testCase.assertCommandSucceeded(testOpts.primaryDB, testOpts.dbName, testOpts.collName);
    checkTenantMigrationAccessBlocker(
        testOpts.primaryDB, tenantId, {numTenantMigrationAbortedErrors: 0});
    assert.commandWorked(tenantMigrationTest.forgetMigration(migrationOpts.migrationIdString));
    tenantMigrationTest.waitForMigrationGarbageCollection(migrationOpts.migrationIdString);
}
function testDoNotRejectWritesAfterMigrationAborted ( testCase , testOpts ) { const tenantId = testOpts . dbName . split ( '_' ) [ 0 ] ; const migrationOpts = { migrationIdString : extractUUIDFromObject ( UUID ( ) ) , tenantId , } ; let abortFp = configureFailPoint ( testOpts . primaryDB , "abortTenantMigrationBeforeLeavingBlockingState" ) ; TenantMigrationTest . assertAborted ( tenantMigrationTest . runMigration ( migrationOpts , { retryOnRetryableErrors : false , automaticForgetMigration : false , enableDonorStartMigrationFsync : true } ) ) ; abortFp . off ( ) ; assert . soon ( ( ) => { const mtab = TenantMigrationUtil . getTenantMigrationAccessBlocker ( { donorNode : testOpts . primaryDB , tenantId } ) ; return mtab . donor . state === TenantMigrationTest . DonorAccessState . kAborted ; } ) ; runCommand ( testOpts ) ; testCase . assertCommandSucceeded ( testOpts . primaryDB , testOpts . dbName , testOpts . collName ) ; checkTenantMigrationAccessBlocker ( testOpts . primaryDB , tenantId , { numTenantMigrationAbortedErrors : 0 } ) ; assert . commandWorked ( tenantMigrationTest . forgetMigration ( migrationOpts . migrationIdString ) ) ; tenantMigrationTest . waitForMigrationGarbageCollection ( migrationOpts . migrationIdString ) ; }
Tests that the donor does not reject writes after the migration aborts.
Tests that the donor does not reject writes after the migration aborts .
// Wait until the in-memory migration state is updated after the migration has majority // committed the abort decision. Otherwise, the command below is expected to block and then get // rejected.