summaryrefslogtreecommitdiff
path: root/jstests/sharding/internal_txns/retryable_writes_basic.js
blob: c95bb8c912124d981d2ea7db9d09129ce896a387 (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 insert, update and delete are retryable and
 * other kinds of transactions for insert, update and delete are not retryable.
 *
 * Exclude this test from large_txn variants because the variant enforces that the max transaction
 * oplog entry length is 2 operations, and the oplog length assertions in this test do not account
 * for this. We are not losing test coverage as this test inherently tests large transactions.
 *
 * @tags: [requires_fcv_60, uses_transactions, exclude_from_large_txns]
 */
(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.runInsertUpdateDeleteTests(lsid, testOptions);
}

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

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

transactionTest.stop();
})();