summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVishnu Kaushik <vishnu.kaushik@mongodb.com>2021-04-25 00:08:46 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-05-14 19:50:22 +0000
commit68c231b5657ff128b773de115467245f52311d40 (patch)
tree0642f27ff4c21887bd3458bbfb56decef80068c8
parent923c41a78246fe99e3a6605946cf1f6d7cd82395 (diff)
downloadmongo-68c231b5657ff128b773de115467245f52311d40.tar.gz
SERVER-56325 Wait for failpoint in server_transaction_metrics.js to be hit so that a valid serverStatus is received
-rw-r--r--jstests/noPassthrough/server_transaction_metrics.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/jstests/noPassthrough/server_transaction_metrics.js b/jstests/noPassthrough/server_transaction_metrics.js
index 402e72da964..90a387f2391 100644
--- a/jstests/noPassthrough/server_transaction_metrics.js
+++ b/jstests/noPassthrough/server_transaction_metrics.js
@@ -2,6 +2,7 @@
// @tags: [uses_transactions]
(function() {
"use strict";
+load("jstests/libs/fail_point_util.js"); // For configureFailPoint
// Verifies that the server status response has the fields that we expect.
function verifyServerStatusFields(serverStatusResponse) {
@@ -152,8 +153,7 @@ verifyServerStatusChange(initialStatus.transactions, newStatus.transactions, "cu
// Hang the transaction on a failpoint in the middle of an operation to check active and
// inactive counters while operation is running inside a transaction.
jsTest.log("Start a transaction that will hang in the middle of an operation due to a fail point.");
-assert.commandWorked(
- testDB.adminCommand({configureFailPoint: 'hangDuringBatchUpdate', mode: 'alwaysOn'}));
+const fpHangDuringBatchUpdate = configureFailPoint(primary, 'hangDuringBatchUpdate');
const transactionFn = function() {
const collName = 'server_transactions_metrics';
@@ -176,6 +176,10 @@ assert.soon(function() {
};
return 1 === adminDB.aggregate([{$currentOp: {}}, {$match: transactionFilter}]).itcount();
});
+
+jsTestLog("Wait until the operation is in the middle of executing.");
+fpHangDuringBatchUpdate.wait();
+
newStatus = assert.commandWorked(testDB.adminCommand({serverStatus: 1}));
verifyServerStatusFields(newStatus);
// Verify that the open transaction counter is incremented while inside the transaction.
@@ -185,8 +189,7 @@ verifyServerStatusChange(initialStatus.transactions, newStatus.transactions, "cu
verifyServerStatusChange(initialStatus.transactions, newStatus.transactions, "currentInactive", 0);
// Now the transaction can proceed.
-assert.commandWorked(
- testDB.adminCommand({configureFailPoint: 'hangDuringBatchUpdate', mode: 'off'}));
+fpHangDuringBatchUpdate.off();
transactionProcess();
newStatus = assert.commandWorked(testDB.adminCommand({serverStatus: 1}));
verifyServerStatusFields(newStatus);