mongo/jstests/sharding/txn_two_phase_commit_server_status.js
Zac 591928c619 SERVER-108478 JS formatted by prettier and remove clang-format (#39656)
GitOrigin-RevId: 6c8f6aded47f260aa4f7c231b17dae3302cb1e04
2025-08-21 17:27:09 +00:00

20 lines
1.1 KiB
JavaScript

// Basic test that the two-phase commit coordinator metrics fields appear in serverStatus output.
import {ShardingTest} from "jstests/libs/shardingtest.js";
const st = new ShardingTest({shards: 1});
const res = assert.commandWorked(st.shard0.adminCommand({serverStatus: 1}));
assert.neq(null, res.twoPhaseCommitCoordinator);
assert.hasFields(res.twoPhaseCommitCoordinator, ["totalCreated"]);
assert.hasFields(res.twoPhaseCommitCoordinator, ["totalStartedTwoPhaseCommit"]);
assert.hasFields(res.twoPhaseCommitCoordinator, ["totalCommittedTwoPhaseCommit"]);
assert.hasFields(res.twoPhaseCommitCoordinator, ["totalAbortedTwoPhaseCommit"]);
assert.neq(null, res.twoPhaseCommitCoordinator.currentInSteps);
assert.hasFields(res.twoPhaseCommitCoordinator.currentInSteps, ["writingParticipantList"]);
assert.hasFields(res.twoPhaseCommitCoordinator.currentInSteps, ["waitingForVotes"]);
assert.hasFields(res.twoPhaseCommitCoordinator.currentInSteps, ["writingDecision"]);
assert.hasFields(res.twoPhaseCommitCoordinator.currentInSteps, ["waitingForDecisionAcks"]);
assert.hasFields(res.twoPhaseCommitCoordinator.currentInSteps, ["deletingCoordinatorDoc"]);
st.stop();