summaryrefslogtreecommitdiff
path: root/jstests/sharding/internal_txns/retryable_findAndModify_basic.js
blob: 7221e192ac016e6a87d14e4302f95a6e016e6b67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
 * Tests that retryable internal transactions for findAndModify are retryable and other kinds of
 * transactions for findAndModify are not retryable.
 *
 * @tags: [requires_fcv_60, uses_transactions]
 */
(function() {
'use strict';

load('jstests/sharding/internal_txns/libs/retryable_internal_transaction_test.js');

const transactionTest = new RetryableInternalTransactionTest();

{
    jsTest.log("Test that non-internal transactions cannot be retried");
    const lsid = {id: UUID()};
    const testOptions = {expectRetryToSucceed: false};
    transactionTest.runFindAndModifyTestsEnableImageCollection(lsid, testOptions);
}

{
    jsTest.log("Test that non-retryable internal transactions cannot be retried");
    const lsid = {id: UUID(), txnUUID: UUID()};
    const testOptions = {expectRetryToSucceed: false};
    transactionTest.runFindAndModifyTestsEnableImageCollection(lsid, testOptions);
}

{
    jsTest.log("Test that retryable internal transactions can be retried");
    transactionTest.runTestsForAllRetryableInternalTransactionTypes(
        transactionTest.runFindAndModifyTestsEnableImageCollection,
        transactionTest.TestMode.kNonRecovery);
    transactionTest.runTestsForAllRetryableInternalTransactionTypes(
        transactionTest.runFindAndModifyTestsDisableImageCollection,
        transactionTest.TestMode.kNonRecovery);
}

transactionTest.stop();
})();