summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/retryable_writes_mmap.js
blob: 7efac46e625c25da32b2d8b313f40d24d52c4021 (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
/*
 * Verify that retryable writes aren't allowed on mmapv1, because it doesn't have document-level
 * locking.
 * @tags: [requires_sharding]
 */
(function() {
    "use strict";

    if (jsTest.options().storageEngine !== "mmapv1") {
        jsTestLog("Storage engine is not mmapv1, skipping test");
        return;
    }

    const rst = new ReplSetTest({nodes: 1});
    rst.startSet();
    rst.initiate();

    let testDB = rst.getPrimary().startSession({retryWrites: true}).getDatabase("test");

    assert.commandFailedWithCode(
        testDB.foo.insert({x: 1}),
        ErrorCodes.IllegalOperation,
        "expected command with txnNumber to fail without document-level locking");

    rst.stopSet();

    const st = new ShardingTest({shards: {rs0: {nodes: 1}}});

    testDB = st.s.startSession({retryWrites: true}).getDatabase("test");

    assert.commandFailedWithCode(
        testDB.foo.insert({x: 1}),
        ErrorCodes.IllegalOperation,
        "expected command with txnNumber to fail without document-level locking");

    st.stop();
}());