summaryrefslogtreecommitdiff
path: root/jstests/core/txns
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/core/txns')
-rw-r--r--jstests/core/txns/abort_expired_transaction.js13
-rw-r--r--jstests/core/txns/aggregation_in_transaction.js2
-rw-r--r--jstests/core/txns/out_not_blocked_by_txn.js44
-rw-r--r--jstests/core/txns/prepare_conflict_aggregation_behavior.js7
-rw-r--r--jstests/core/txns/transaction_too_large_for_cache.js85
5 files changed, 2 insertions, 149 deletions
diff --git a/jstests/core/txns/abort_expired_transaction.js b/jstests/core/txns/abort_expired_transaction.js
index 54418596967..b211ef7b132 100644
--- a/jstests/core/txns/abort_expired_transaction.js
+++ b/jstests/core/txns/abort_expired_transaction.js
@@ -33,11 +33,6 @@ try {
const session = db.getMongo().startSession(sessionOptions);
const sessionDb = session.getDatabase(testDBName);
- // Number of passes made by the "abortExpiredTransactions" thread before the transaction
- // expires.
- const abortExpiredTransactionsPassesPreAbort =
- db.serverStatus().metrics.abortExpiredTransactions.passes;
-
let txnNumber = 0;
jsTest.log("Insert a document starting a transaction.");
@@ -69,14 +64,6 @@ try {
"currentOp reports that the idle transaction still exists, it has not been " +
"aborted as expected.");
- assert.soon(() => {
- // For this expired transaction to abort, the "abortExpiredTransactions" thread has to
- // perform at least one pass.
- const serverStatus = db.serverStatus();
- return abortExpiredTransactionsPassesPreAbort <
- serverStatus.metrics.abortExpiredTransactions.passes;
- });
-
jsTest.log(
"Attempt to do a write in the transaction, which should fail because the transaction " +
"was aborted");
diff --git a/jstests/core/txns/aggregation_in_transaction.js b/jstests/core/txns/aggregation_in_transaction.js
index 40d7030fe1f..ec1c62133bb 100644
--- a/jstests/core/txns/aggregation_in_transaction.js
+++ b/jstests/core/txns/aggregation_in_transaction.js
@@ -1,5 +1,5 @@
// Tests that aggregation is supported in transactions.
-// @tags: [uses_transactions, uses_snapshot_read_concern, references_foreign_collection]
+// @tags: [uses_transactions, uses_snapshot_read_concern]
(function() {
"use strict";
diff --git a/jstests/core/txns/out_not_blocked_by_txn.js b/jstests/core/txns/out_not_blocked_by_txn.js
deleted file mode 100644
index a48097c9eab..00000000000
--- a/jstests/core/txns/out_not_blocked_by_txn.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * Test that renaming a collection through $out takes database IX lock and will not be blocked by
- * transactions. This test is created to ensure that the scenario occuring in the case linked in
- * SERVER-72703, where a compact operation (which took an IX DB lock) blocked a rename with $out,
- * which required an exclusive DB lock. Now that $out should take an IX DB lock, renaming with
- * $out should not be blocked by operations taking an IX lock. Renaming with $out across
- * different databases still takes an X lock.
- *
- * @tags: [uses_transactions, requires_db_locking, assumes_unsharded_collection]
- */
-let dbName = jsTestName();
-let mydb = db.getSiblingDB(dbName);
-
-// Drop the collections that we will be using in this test, both for the transaction and for the
-// rename operation, and wait for majority confirmation.
-mydb.txn.drop({writeConcern: {w: "majority"}});
-mydb.a.drop({writeConcern: {w: "majority"}});
-mydb.b.drop({writeConcern: {w: "majority"}});
-mydb.c.drop({writeConcern: {w: "majority"}});
-
-// Populate our collections.
-assert.commandWorked(mydb.txn.insert({x: 1}));
-assert.commandWorked(mydb.a.insert([{x: 1}]));
-assert.commandWorked(mydb.c.insert({x: 1}));
-
-// Begin a session for our transaction.
-const session = mydb.getMongo().startSession();
-const sessionDb = session.getDatabase(dbName);
-
-session.startTransaction();
-// This holds a database IX lock and a collection IX lock on "test.txn".
-sessionDb.t.insert({y: 1});
-
-// $out should now also only require an IX lock.
-// Test the scenario where we rename collection 'a' to collection 'b', which doesn't exist.
-assert.commandWorked(
- mydb.runCommand({aggregate: "a", pipeline: [{$out: {db: dbName, coll: "b"}}], cursor: {}}));
-// Now test the scenario where we rename collection 'b' to collection 'c', which does exist.
-// This should drop collection 'c'.
-assert.commandWorked(
- mydb.runCommand({aggregate: "b", pipeline: [{$out: {db: dbName, coll: "c"}}], cursor: {}}));
-
-// Now commit the transaction.
-assert.commandWorked(session.commitTransaction_forTesting());
diff --git a/jstests/core/txns/prepare_conflict_aggregation_behavior.js b/jstests/core/txns/prepare_conflict_aggregation_behavior.js
index c07f96e2b54..c62b7370dc6 100644
--- a/jstests/core/txns/prepare_conflict_aggregation_behavior.js
+++ b/jstests/core/txns/prepare_conflict_aggregation_behavior.js
@@ -3,12 +3,7 @@
* should not block on prepare conflicts, but writing out to a collection as a part of an aggregate
* pipeline should block on prepare conflicts.
*
- * The test runs commands that are not allowed with security token: endSession, prepareTransaction.
- * @tags: [
- * references_foreign_collection,
- * uses_transactions,
- * uses_prepare_transaction,
- * ]
+ * @tags: [uses_transactions, uses_prepare_transaction]
*/
(function() {
"use strict";
diff --git a/jstests/core/txns/transaction_too_large_for_cache.js b/jstests/core/txns/transaction_too_large_for_cache.js
deleted file mode 100644
index 47171a0ee73..00000000000
--- a/jstests/core/txns/transaction_too_large_for_cache.js
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * Tests a multi-document transaction requiring more cache than available fails with the expected
- * error code instead of a generic WriteConflictException.
- *
- * @tags: [
- * does_not_support_config_fuzzer,
- * requires_fcv_60,
- * requires_persistence,
- * requires_non_retryable_writes,
- * requires_wiredtiger,
- * uses_transactions,
- * ]
- */
-
-(function() {
-load("jstests/libs/fixture_helpers.js"); // For FixtureHelpers.
-load('jstests/libs/transactions_util.js');
-
-function getWtCacheSizeBytes() {
- let serverStatus;
- if (FixtureHelpers.isReplSet(db) || FixtureHelpers.isMongos(db)) {
- serverStatus = FixtureHelpers.getPrimaries(db)[0].getDB('admin').serverStatus();
- } else {
- serverStatus = db.serverStatus();
- }
-
- assert.commandWorked(serverStatus);
- return serverStatus.wiredTiger.cache["maximum bytes configured"];
-}
-
-const doc1 = {
- x: []
-};
-for (var j = 0; j < 100000; j++) {
- doc1.x.push("" + Math.random() + Math.random());
-}
-
-const session = db.getMongo().startSession();
-const sessionDb = session.getDatabase(db.getName());
-const coll = sessionDb[jsTestName()];
-coll.drop();
-
-// Scale the load in proportion to WT cache size, to reduce test run time.
-// A single collection can only have up to 64 indexes. Cap at _id + 1 text index + 62 indexes.
-const nIndexes = Math.min(Math.ceil(getWtCacheSizeBytes() * 2 / (1024 * 1024 * 1024)), 62);
-assert.commandWorked(coll.createIndex({x: "text"}));
-for (let i = 0; i < nIndexes; i++) {
- assert.commandWorked(coll.createIndex({x: 1, ["field" + i]: 1}));
-}
-
-// Retry the transaction until we eventually hit the TransactionTooLargeForCache. Only retry on
-// WriteConflict error, which is the only expected error besides TransactionTooLargeForCache.
-assert.soon(() => {
- session.startTransaction();
-
- // Keep inserting documents in the transaction until we eventually hit the cache limit.
- let insertCount = 0;
- let result;
- try {
- while (true) {
- try {
- ++insertCount;
- result = coll.insert(doc1);
- assert.commandWorked(result);
- } catch (e) {
- session.abortTransaction();
- assert.commandFailedWithCode(result, ErrorCodes.TransactionTooLargeForCache);
- break;
- }
- }
- } catch (e) {
- assert.commandFailedWithCode(result, ErrorCodes.WriteConflict);
- return false;
- }
-
- // The error should not have a transient transaction error label. At this point the error must
- // have been TransactionTooLargeForCache. We do this check here to avoid having to check
- // exception types in the outermost catch, in case this assertion fires.
- assert(!TransactionsUtil.isTransientTransactionError(result), result);
-
- jsTestLog("Iterations until TransactionTooLargeForCache occured: " + insertCount);
-
- return true;
-}, "Expected a transaction to eventually fail with TransactionTooLargeForCache error.");
-}());