diff options
author | Tess Avitabile <tess.avitabile@mongodb.com> | 2018-06-11 17:48:36 -0400 |
---|---|---|
committer | Tess Avitabile <tess.avitabile@mongodb.com> | 2018-06-14 10:26:16 -0400 |
commit | 7fb0ba7016a7af44532f49088bcf698ac3815860 (patch) | |
tree | a8b48a3bc20c5745b3088a07e455eaf84e842e7b /jstests | |
parent | 33ea303e386cef960015143e1ff396102b2bc5ac (diff) | |
download | mongo-7fb0ba7016a7af44532f49088bcf698ac3815860.tar.gz |
SERVER-35513 Forbid transactions on inMemory storage engine
(cherry picked from commit 0b103f9904fe7dfc88d8a1077cf01c30cdd330d0)
Diffstat (limited to 'jstests')
13 files changed, 24 insertions, 71 deletions
diff --git a/jstests/noPassthrough/afterClusterTime_committed_reads.js b/jstests/noPassthrough/afterClusterTime_committed_reads.js index 96091cf34f0..0f9bc1480c7 100644 --- a/jstests/noPassthrough/afterClusterTime_committed_reads.js +++ b/jstests/noPassthrough/afterClusterTime_committed_reads.js @@ -1,6 +1,6 @@ // Test that causally consistent majority-committed read-only transactions will wait for the // majority commit point to move past 'afterClusterTime' before they can commit. -// @tags: [requires_replication] +// @tags: [uses_transactions] (function() { "use strict"; @@ -67,13 +67,8 @@ })); } - if (assert.commandWorked(primaryDB.serverStatus()).storageEngine.supportsCommittedReads) { - testReadConcernLevel("majority"); - } - - if (assert.commandWorked(primaryDB.serverStatus()).storageEngine.supportsSnapshotReadConcern) { - testReadConcernLevel("snapshot"); - } + testReadConcernLevel("majority"); + testReadConcernLevel("snapshot"); rst.stopSet(); }()); diff --git a/jstests/noPassthrough/readConcern_atClusterTime_snapshot_selection.js b/jstests/noPassthrough/readConcern_atClusterTime_snapshot_selection.js index d42e0e90b31..91a754a595a 100644 --- a/jstests/noPassthrough/readConcern_atClusterTime_snapshot_selection.js +++ b/jstests/noPassthrough/readConcern_atClusterTime_snapshot_selection.js @@ -2,7 +2,7 @@ // to be majority committed. If 'atClusterTime' is older than the oldest available snapshot, the // error code SnapshotTooOld is returned. // -// @tags: [requires_replication] +// @tags: [uses_transactions] (function() { "use strict"; @@ -19,11 +19,6 @@ rst.getPrimary().getDB(dbName).getMongo().startSession({causalConsistency: false}); const primaryDB = primarySession.getDatabase(dbName); - if (!assert.commandWorked(primaryDB.serverStatus()).storageEngine.supportsSnapshotReadConcern) { - rst.stopSet(); - return; - } - const secondaryConns = rst.getSecondaries(); const secondaryConn0 = secondaryConns[0]; const secondaryConn1 = secondaryConns[1]; diff --git a/jstests/noPassthrough/readConcern_snapshot.js b/jstests/noPassthrough/readConcern_snapshot.js index 20e0aaa2bd9..8926d6fd72a 100644 --- a/jstests/noPassthrough/readConcern_snapshot.js +++ b/jstests/noPassthrough/readConcern_snapshot.js @@ -10,18 +10,27 @@ // Configurations. // - // readConcern 'snapshot' should fail on storage engines that do not support it. + // Transactions should fail on storage engines that do not support them. let rst = new ReplSetTest({nodes: 1}); rst.startSet(); rst.initiate(); let session = rst.getPrimary().getDB(dbName).getMongo().startSession({causalConsistency: false}); let sessionDb = session.getDatabase(dbName); - if (!sessionDb.serverStatus().storageEngine.supportsSnapshotReadConcern) { + if (!sessionDb.serverStatus().storageEngine.supportsSnapshotReadConcern || + !sessionDb.serverStatus().storageEngine.persistent) { + // Transactions with readConcern snapshot fail. session.startTransaction({readConcern: {level: "snapshot"}}); assert.commandFailedWithCode(sessionDb.runCommand({find: collName}), ErrorCodes.IllegalOperation); session.abortTransaction(); + + // Transactions without readConcern snapshot fail. + session.startTransaction(); + assert.commandFailedWithCode(sessionDb.runCommand({find: collName}), + ErrorCodes.IllegalOperation); + session.abortTransaction(); + rst.stopSet(); return; } diff --git a/jstests/noPassthrough/read_concern_snapshot_aggregation.js b/jstests/noPassthrough/read_concern_snapshot_aggregation.js index d55598de40e..482af9a4688 100644 --- a/jstests/noPassthrough/read_concern_snapshot_aggregation.js +++ b/jstests/noPassthrough/read_concern_snapshot_aggregation.js @@ -1,7 +1,7 @@ /** * Tests for the aggregate command's support for readConcern level "snapshot". * - * @tags: [requires_replication] + * @tags: [uses_transactions] */ (function() { "use strict"; @@ -19,10 +19,6 @@ let session = rst.getPrimary().getDB(kDBName).getMongo().startSession({causalConsistency: false}); let sessionDB = session.getDatabase(kDBName); - if (!sessionDB.serverStatus().storageEngine.supportsSnapshotReadConcern) { - rst.stopSet(); - return; - } let txnNumber = NumberLong(0); assert.commandWorked(sessionDB.runCommand({create: kCollName, writeConcern: {w: "majority"}})); diff --git a/jstests/noPassthrough/read_concern_snapshot_catalog_invalidation.js b/jstests/noPassthrough/read_concern_snapshot_catalog_invalidation.js index 759217356ab..942e1cc54d8 100644 --- a/jstests/noPassthrough/read_concern_snapshot_catalog_invalidation.js +++ b/jstests/noPassthrough/read_concern_snapshot_catalog_invalidation.js @@ -1,6 +1,6 @@ // Tests that snapshot reads return an error when accessing a collection whose metadata is invalid // for the snapshot's point in time. -// @tags: [requires_replication] +// @tags: [uses_transactions] (function() { "use strict"; @@ -12,10 +12,6 @@ rst.initiate(); const testDB = rst.getPrimary().getDB(kDbName); - if (!testDB.serverStatus().storageEngine.supportsSnapshotReadConcern) { - rst.stopSet(); - return; - } const adminDB = testDB.getSiblingDB("admin"); const coll = testDB.getCollection(kCollName); diff --git a/jstests/noPassthrough/read_concern_snapshot_yielding.js b/jstests/noPassthrough/read_concern_snapshot_yielding.js index c7f8cf3ffbe..3792b3bb655 100644 --- a/jstests/noPassthrough/read_concern_snapshot_yielding.js +++ b/jstests/noPassthrough/read_concern_snapshot_yielding.js @@ -1,7 +1,7 @@ // Test that the read concern level 'snapshot' exhibits the correct yielding behavior. That is, // operations performed at read concern level snapshot check for interrupt but do not yield locks or // storage engine resources. -// @tags: [requires_replication] +// @tags: [uses_transactions] (function() { "use strict"; @@ -24,11 +24,6 @@ const coll = db.coll; TestData.numDocs = 4; - if (!db.serverStatus().storageEngine.supportsSnapshotReadConcern) { - rst.stopSet(); - return; - } - // Set 'internalQueryExecYieldIterations' to 2 to ensure that commands yield on the second try // (i.e. after they have established a snapshot but before they have returned any documents). assert.commandWorked(db.adminCommand({setParameter: 1, internalQueryExecYieldIterations: 2})); diff --git a/jstests/noPassthrough/read_majority.js b/jstests/noPassthrough/read_majority.js index 2310e4ccfeb..a8e1b9f4221 100644 --- a/jstests/noPassthrough/read_majority.js +++ b/jstests/noPassthrough/read_majority.js @@ -10,8 +10,6 @@ * - 'local'-only commands should error on majority-committed levels, and accept 'local' level. * - An aggregation with '$out' should fail with majority-committed levels. * - * Tests are run for both majority-committed read concern levels: "majority" and "snapshot". - * * All of this requires support for committed reads, so this test will be skipped if the storage * engine does not support them. */ @@ -231,8 +229,6 @@ load("jstests/libs/analyze_plan.js"); const db = conn.getDB("test"); const supportsCommittedReads = assert.commandWorked(db.serverStatus()).storageEngine.supportsCommittedReads; - const supportsSnapshotReadConcern = - assert.commandWorked(db.serverStatus()).storageEngine.supportsSnapshotReadConcern; MongoRunner.stopMongod(conn); if (supportsCommittedReads) { diff --git a/jstests/noPassthrough/snapshot_cursor_integrity.js b/jstests/noPassthrough/snapshot_cursor_integrity.js index d5d0678a641..859dd713ad5 100644 --- a/jstests/noPassthrough/snapshot_cursor_integrity.js +++ b/jstests/noPassthrough/snapshot_cursor_integrity.js @@ -1,6 +1,6 @@ // Tests that a cursor is iterated in a transaction/session iff it was created in that // transaction/session. Specifically tests this in the context of snapshot cursors. -// @tags: [requires_replication] +// @tags: [uses_transactions] (function() { "use strict"; @@ -12,10 +12,6 @@ rst.initiate(); const primaryDB = rst.getPrimary().getDB(dbName); - if (!primaryDB.serverStatus().storageEngine.supportsSnapshotReadConcern) { - rst.stopSet(); - return; - } const session1 = primaryDB.getMongo().startSession(); const sessionDB1 = session1.getDatabase(dbName); diff --git a/jstests/noPassthrough/snapshot_cursor_shutdown_stepdown.js b/jstests/noPassthrough/snapshot_cursor_shutdown_stepdown.js index 8d60e290d7d..ec2cbfd5254 100644 --- a/jstests/noPassthrough/snapshot_cursor_shutdown_stepdown.js +++ b/jstests/noPassthrough/snapshot_cursor_shutdown_stepdown.js @@ -1,5 +1,5 @@ // Tests that stashed transaction resources are destroyed at shutdown and stepdown. -// @tags: [requires_replication] +// @tags: [uses_transactions] (function() { "use strict"; @@ -15,10 +15,6 @@ rst.initiate(); let primaryDB = rst.getPrimary().getDB(dbName); - if (!primaryDB.serverStatus().storageEngine.supportsSnapshotReadConcern) { - rst.stopSet(); - return; - } let session = primaryDB.getMongo().startSession(); let sessionDB = session.getDatabase(dbName); diff --git a/jstests/noPassthrough/snapshot_reads.js b/jstests/noPassthrough/snapshot_reads.js index 3c2555ab4b5..91e0fce616d 100644 --- a/jstests/noPassthrough/snapshot_reads.js +++ b/jstests/noPassthrough/snapshot_reads.js @@ -1,5 +1,5 @@ // Tests snapshot isolation on readConcern level snapshot read. -// @tags: [requires_replication] +// @tags: [uses_transactions] (function() { "use strict"; @@ -14,10 +14,6 @@ rst.initiate(conf); const primaryDB = rst.getPrimary().getDB(dbName); - if (!primaryDB.serverStatus().storageEngine.supportsSnapshotReadConcern) { - rst.stopSet(); - return; - } function parseCursor(cmdResult) { if (cmdResult.hasOwnProperty("cursor")) { diff --git a/jstests/replsets/dbhash_at_cluster_time.js b/jstests/replsets/dbhash_at_cluster_time.js index 3a77217fdd9..d2a77899003 100644 --- a/jstests/replsets/dbhash_at_cluster_time.js +++ b/jstests/replsets/dbhash_at_cluster_time.js @@ -1,5 +1,6 @@ /** * Tests that "atClusterTime" is supported by the "dbHash" command. + * @tags: [uses_transactions] */ (function() { "use strict"; @@ -18,11 +19,6 @@ const db = session.getDatabase("test"); let txnNumber = 0; - if (!db.serverStatus().storageEngine.supportsSnapshotReadConcern) { - rst.stopSet(); - return; - } - // We force 'secondary' to sync from 'primary' using the "forceSyncSourceCandidate" failpoint to // ensure that an intermittent connectivity issue doesn't lead to the secondary not advancing // its belief of the majority commit point. This avoids any complications that would arise due diff --git a/jstests/replsets/dbhash_lock_acquisition.js b/jstests/replsets/dbhash_lock_acquisition.js index e8b7ff9cbad..8c14e159e24 100644 --- a/jstests/replsets/dbhash_lock_acquisition.js +++ b/jstests/replsets/dbhash_lock_acquisition.js @@ -1,6 +1,7 @@ /** * Tests that the dbHash command acquires IX mode locks on the global, database, and collection * resources when running inside a multi-statement transaction. + * @tags: [uses_transactions] */ (function() { "use strict"; @@ -12,11 +13,6 @@ const primary = rst.getPrimary(); const db = primary.getDB("test"); - if (!db.serverStatus().storageEngine.supportsSnapshotReadConcern) { - rst.stopSet(); - return; - } - const session = primary.startSession({causalConsistency: false}); const sessionDB = session.getDatabase(db.getName()); diff --git a/jstests/sharding/aggregation_currentop.js b/jstests/sharding/aggregation_currentop.js index d58daaa1aa2..9ae97ef6949 100644 --- a/jstests/sharding/aggregation_currentop.js +++ b/jstests/sharding/aggregation_currentop.js @@ -13,7 +13,7 @@ * applicable. * * This test requires replica set configuration and user credentials to persist across a restart. - * @tags: [requires_persistence] + * @tags: [requires_persistence, uses_transactions] */ // Restarts cause issues with authentication for awaiting replication. @@ -90,15 +90,6 @@ TestData.skipAwaitingReplicationOnShardsBeforeCheckingUUIDs = true; createUsers(shardConn); createUsers(mongosConn); - // Gate this test to transaction supporting engines only as it uses txnNumber. - assert(shardAdminDB.auth("admin", "pwd")); - if (!shardAdminDB.serverStatus().storageEngine.supportsSnapshotReadConcern) { - jsTestLog("Do not run on storage engine that does not support transactions"); - st.stop(); - return; - } - shardAdminDB.logout(); - // Create a test database and some dummy data on rs0. assert(clusterAdminDB.auth("admin", "pwd")); |