summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVesselina Ratcheva <vesselina.ratcheva@mongodb.com>2019-11-28 02:49:08 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-02-27 03:54:36 +0000
commit33dd896011bef747aa2302f63eebb0bca7b981e3 (patch)
tree9d751b080767887916104477accd0fa00792dc14
parentf74e24b16ec0cae0d1521c34379a0e0854cd4607 (diff)
downloadmongo-33dd896011bef747aa2302f63eebb0bca7b981e3.tar.gz
SERVER-43867 Move check_log.js inside src/mongo/shell/ SERVER-43867 Work around unrecoverability of rollback via refetch in tests
(cherry picked from commit 7bb6711e9df7f135af19cd4f371ab21c60c026ed) (cherry picked from commit 7c42573b96ecfa43fbf76aa01cd659ee00fc6103)
-rw-r--r--jstests/core/txns/kill_op_on_txn_expiry.js1
-rw-r--r--jstests/core/txns/speculative_snapshot_includes_all_writes.js2
-rw-r--r--jstests/core/txns/timestamped_reads_wait_for_prepare_oplog_visibility.js1
-rw-r--r--jstests/libs/kill_sessions.js1
-rw-r--r--jstests/libs/write_concern_util.js2
-rw-r--r--jstests/noPassthrough/aggregation_log_namespace.js1
-rw-r--r--jstests/noPassthrough/characterize_index_builds_on_restart.js1
-rw-r--r--jstests/noPassthrough/commit_quorum.js1
-rw-r--r--jstests/noPassthrough/dropdatabase_respect_maxtimems.js2
-rw-r--r--jstests/noPassthrough/flow_control_logging.js2
-rw-r--r--jstests/noPassthrough/hybrid_index_build_on_state_transition.js2
-rw-r--r--jstests/noPassthrough/hybrid_index_with_updates.js2
-rw-r--r--jstests/noPassthrough/hybrid_unique_index_with_updates.js2
-rw-r--r--jstests/noPassthrough/indexbg2.js2
-rw-r--r--jstests/noPassthrough/indexbg_shutdown.js1
-rw-r--r--jstests/noPassthrough/initial_sync_wt_cache_full.js1
-rw-r--r--jstests/noPassthrough/latency_includes_lock_acquisition_time.js1
-rw-r--r--jstests/noPassthrough/log_find_getmore.js1
-rw-r--r--jstests/noPassthrough/log_format_slowms_samplerate_loglevel.js1
-rw-r--r--jstests/noPassthrough/profile_interrupted_op.js2
-rw-r--r--jstests/noPassthrough/recovery_wt_cache_full.js1
-rw-r--r--jstests/noPassthrough/step_down_during_drop_database.js2
-rw-r--r--jstests/noPassthrough/transaction_write_with_snapshot_unavailable.js1
-rw-r--r--jstests/noPassthrough/upgrade_unfinished_unique_indexes.js1
-rw-r--r--jstests/noPassthroughWithMongod/create_indexes_waits_for_already_in_progress.js1
-rw-r--r--jstests/replsets/abort_in_progress_transactions_on_step_up.js1
-rw-r--r--jstests/replsets/avg_num_catchup_ops.js1
-rw-r--r--jstests/replsets/awaitdata_getmore_new_last_committed_optime.js1
-rw-r--r--jstests/replsets/catchup.js1
-rw-r--r--jstests/replsets/change_stream_speculative_majority_lastApplied_lag.js1
-rw-r--r--jstests/replsets/change_stream_speculative_majority_secondary_batch_application.js1
-rw-r--r--jstests/replsets/create_drop_database_different_casing.js2
-rw-r--r--jstests/replsets/ddl_op_behind_transaction_fails_in_shutdown.js1
-rw-r--r--jstests/replsets/disallow_adding_initialized_node1.js1
-rw-r--r--jstests/replsets/disallow_adding_initialized_node2.js1
-rw-r--r--jstests/replsets/disconnect_on_legacy_write_to_secondary.js2
-rw-r--r--jstests/replsets/do_not_advance_commit_point_beyond_last_applied_term.js1
-rw-r--r--jstests/replsets/drop_collections_two_phase_rename_drop_target.js1
-rw-r--r--jstests/replsets/drop_collections_two_phase_write_concern.js1
-rw-r--r--jstests/replsets/drop_databases_two_phase.js1
-rw-r--r--jstests/replsets/initial_sync_applier_error.js1
-rw-r--r--jstests/replsets/initial_sync_capped_index.js1
-rw-r--r--jstests/replsets/initial_sync_drop_collection.js1
-rw-r--r--jstests/replsets/initial_sync_during_stepdown.js1
-rw-r--r--jstests/replsets/initial_sync_fcv.js1
-rw-r--r--jstests/replsets/initial_sync_fetch_from_oldest_active_transaction_timestamp_no_oplog_application.js1
-rw-r--r--jstests/replsets/initial_sync_oplog_hole.js1
-rw-r--r--jstests/replsets/initial_sync_oplog_rollover.js1
-rw-r--r--jstests/replsets/initial_sync_read_concern_no_oplog.js1
-rw-r--r--jstests/replsets/initial_sync_replSetGetStatus.js1
-rw-r--r--jstests/replsets/initial_sync_replicates_prepare_received_during_another_initial_sync.js1
-rw-r--r--jstests/replsets/initial_sync_test_fixture_test.js1
-rw-r--r--jstests/replsets/initial_sync_update_missing_doc1.js1
-rw-r--r--jstests/replsets/initial_sync_update_missing_doc2.js1
-rw-r--r--jstests/replsets/initial_sync_update_missing_doc3.js1
-rw-r--r--jstests/replsets/initial_sync_update_missing_doc_with_prepare.js1
-rw-r--r--jstests/replsets/initial_sync_update_reinsert_missing_doc_with_prepare.js1
-rw-r--r--jstests/replsets/kill_reads_with_prepare_conflicts_during_step_down.js1
-rw-r--r--jstests/replsets/kill_reads_with_prepare_conflicts_during_step_up.js1
-rw-r--r--jstests/replsets/kill_ttl_on_stepdown.js2
-rw-r--r--jstests/replsets/last_error_reported_after_stepdown.js2
-rw-r--r--jstests/replsets/libs/election_handoff.js1
-rw-r--r--jstests/replsets/libs/initial_sync_test.js1
-rw-r--r--jstests/replsets/libs/rollback_test.js32
-rw-r--r--jstests/replsets/libs/two_phase_drops.js1
-rw-r--r--jstests/replsets/log_secondary_oplog_application.js1
-rw-r--r--jstests/replsets/majority_writes_wait_for_all_durable_timestamp.js2
-rw-r--r--jstests/replsets/mr_nonrepl_coll_in_local_db.js2
-rw-r--r--jstests/replsets/no_flapping_during_network_partition.js2
-rw-r--r--jstests/replsets/not_master_unacknowledged_write.js3
-rw-r--r--jstests/replsets/read_after_optime.js1
-rw-r--r--jstests/replsets/read_committed_stale_history.js1
-rw-r--r--jstests/replsets/read_operations_during_step_down.js1
-rw-r--r--jstests/replsets/read_operations_during_step_up.js1
-rw-r--r--jstests/replsets/reconfig_during_election.js1
-rw-r--r--jstests/replsets/reconstruct_prepared_transactions_initial_sync_index_build.js1
-rw-r--r--jstests/replsets/reconstruct_prepared_transactions_initial_sync_no_oplog_application.js1
-rw-r--r--jstests/replsets/recovery_preserves_active_txns.js1
-rw-r--r--jstests/replsets/rollback_drop_database.js1
-rw-r--r--jstests/replsets/rollback_remote_cursor_retry.js1
-rw-r--r--jstests/replsets/rollback_unprepared_transactions.js1
-rw-r--r--jstests/replsets/rollback_via_refetch_survives_nonexistent_collection_drop.js1
-rw-r--r--jstests/replsets/rollback_waits_for_bgindex_completion.js1
-rw-r--r--jstests/replsets/rollback_with_socket_error_then_steady_state.js1
-rw-r--r--jstests/replsets/startup_without_fcv_document_succeeds_if_initial_sync_flag_set.js1
-rw-r--r--jstests/replsets/step_down_during_draining2.js1
-rw-r--r--jstests/replsets/step_down_on_secondary.js1
-rw-r--r--jstests/replsets/transient_txn_error_labels_with_write_concern.js1
-rw-r--r--jstests/replsets/trigger_initial_stable_checkpoint.js2
-rw-r--r--jstests/replsets/unconditional_step_down.js2
-rw-r--r--jstests/replsets/unrecoverable_rollback_early_exit.js72
-rw-r--r--jstests/sharding/change_streams_establishment_finds_new_shards.js1
-rw-r--r--src/mongo/scripting/engine.cpp2
-rw-r--r--src/mongo/shell/SConscript1
-rw-r--r--src/mongo/shell/check_log.js (renamed from jstests/libs/check_log.js)0
-rw-r--r--src/mongo/shell/replsettest.js49
96 files changed, 154 insertions, 113 deletions
diff --git a/jstests/core/txns/kill_op_on_txn_expiry.js b/jstests/core/txns/kill_op_on_txn_expiry.js
index b725f4a6b75..a6b5ff4813d 100644
--- a/jstests/core/txns/kill_op_on_txn_expiry.js
+++ b/jstests/core/txns/kill_op_on_txn_expiry.js
@@ -3,7 +3,6 @@
(function() {
"use strict";
-load("jstests/libs/check_log.js");
load("jstests/libs/fail_point_util.js");
load('jstests/libs/parallelTester.js');
diff --git a/jstests/core/txns/speculative_snapshot_includes_all_writes.js b/jstests/core/txns/speculative_snapshot_includes_all_writes.js
index efeefdfa889..a3ef68bdcb3 100644
--- a/jstests/core/txns/speculative_snapshot_includes_all_writes.js
+++ b/jstests/core/txns/speculative_snapshot_includes_all_writes.js
@@ -6,8 +6,6 @@
(function() {
"use strict";
-load("jstests/libs/check_log.js");
-
const dbName = "test";
const collName = "speculative_snapshot_includes_all_writes_1";
const collName2 = "speculative_snapshot_includes_all_writes_2";
diff --git a/jstests/core/txns/timestamped_reads_wait_for_prepare_oplog_visibility.js b/jstests/core/txns/timestamped_reads_wait_for_prepare_oplog_visibility.js
index f15d3d39f2e..fce4e205d88 100644
--- a/jstests/core/txns/timestamped_reads_wait_for_prepare_oplog_visibility.js
+++ b/jstests/core/txns/timestamped_reads_wait_for_prepare_oplog_visibility.js
@@ -38,7 +38,6 @@ TestData.otherDocFilter = {
* certain reads and that prepare conflicts block other types of reads.
*/
const readThreadFunc = function(readFunc, _collName, timesEntered) {
- load("jstests/libs/check_log.js");
load("jstests/libs/fail_point_util.js");
// Do not start reads until we are blocked in 'prepareTransaction'.
diff --git a/jstests/libs/kill_sessions.js b/jstests/libs/kill_sessions.js
index 2bd939c6511..b56554d02c4 100644
--- a/jstests/libs/kill_sessions.js
+++ b/jstests/libs/kill_sessions.js
@@ -1,5 +1,4 @@
load("jstests/libs/parallelTester.js");
-load("jstests/libs/check_log.js");
/**
* Implements a kill session test helper
diff --git a/jstests/libs/write_concern_util.js b/jstests/libs/write_concern_util.js
index ed2678ff3f0..90832a858d8 100644
--- a/jstests/libs/write_concern_util.js
+++ b/jstests/libs/write_concern_util.js
@@ -2,8 +2,6 @@
* Utilities for testing writeConcern.
*/
-load("jstests/libs/check_log.js");
-
// Shards a collection with 'numDocs' documents and creates 2 chunks, one on each of two shards.
function shardCollectionWithChunks(st, coll, numDocs) {
var _db = coll.getDB();
diff --git a/jstests/noPassthrough/aggregation_log_namespace.js b/jstests/noPassthrough/aggregation_log_namespace.js
index a45a3a96597..274bbc3d0d0 100644
--- a/jstests/noPassthrough/aggregation_log_namespace.js
+++ b/jstests/noPassthrough/aggregation_log_namespace.js
@@ -5,7 +5,6 @@
'use strict';
load("jstests/aggregation/extras/merge_helpers.js"); // For withEachKindOfWriteStage.
-load("jstests/libs/check_log.js"); // For checkLogs.containsWithCount.
// Runs the given 'pipeline' and verifies that the namespace is correctly logged in the global
// log for the aggregate command. The 'comment' parameter is used to match a log entry against
diff --git a/jstests/noPassthrough/characterize_index_builds_on_restart.js b/jstests/noPassthrough/characterize_index_builds_on_restart.js
index ed055059bbf..4939dc4c369 100644
--- a/jstests/noPassthrough/characterize_index_builds_on_restart.js
+++ b/jstests/noPassthrough/characterize_index_builds_on_restart.js
@@ -10,7 +10,6 @@
(function() {
'use strict';
-load("jstests/libs/check_log.js");
load("jstests/replsets/rslib.js");
const dbName = "testDb";
diff --git a/jstests/noPassthrough/commit_quorum.js b/jstests/noPassthrough/commit_quorum.js
index fd37f23fb2f..02797f367d6 100644
--- a/jstests/noPassthrough/commit_quorum.js
+++ b/jstests/noPassthrough/commit_quorum.js
@@ -5,7 +5,6 @@
*/
(function() {
load("jstests/noPassthrough/libs/index_build.js");
-load("jstests/libs/check_log.js");
const replSet = new ReplSetTest({
nodes: [
diff --git a/jstests/noPassthrough/dropdatabase_respect_maxtimems.js b/jstests/noPassthrough/dropdatabase_respect_maxtimems.js
index a6f16456a7a..d3b6e194458 100644
--- a/jstests/noPassthrough/dropdatabase_respect_maxtimems.js
+++ b/jstests/noPassthrough/dropdatabase_respect_maxtimems.js
@@ -39,8 +39,6 @@ const waitForCommand = function(waitingFor, opFilter) {
})();
(function assertDatabaseDropCanBeInterrupted() {
- load("jstests/libs/check_log.js");
-
assert.commandWorked(dropDB.bar.insert({}));
assert.commandWorked(rst.getPrimary().adminCommand(
diff --git a/jstests/noPassthrough/flow_control_logging.js b/jstests/noPassthrough/flow_control_logging.js
index bd3478aa7dd..b2bf68fc674 100644
--- a/jstests/noPassthrough/flow_control_logging.js
+++ b/jstests/noPassthrough/flow_control_logging.js
@@ -10,8 +10,6 @@
(function() {
"use strict";
-load("jstests/libs/check_log.js");
-
const replSet = new ReplSetTest({name: "flow_control_logging", nodes: 3});
replSet.startSet({
setParameter: {
diff --git a/jstests/noPassthrough/hybrid_index_build_on_state_transition.js b/jstests/noPassthrough/hybrid_index_build_on_state_transition.js
index fe093daa669..07c3316dc28 100644
--- a/jstests/noPassthrough/hybrid_index_build_on_state_transition.js
+++ b/jstests/noPassthrough/hybrid_index_build_on_state_transition.js
@@ -14,7 +14,7 @@
*
* @tags: [uses_transactions, uses_prepare_transaction]
*/
-load("jstests/libs/check_log.js");
+
load("jstests/replsets/rslib.js");
load("jstests/core/txns/libs/prepare_helpers.js");
diff --git a/jstests/noPassthrough/hybrid_index_with_updates.js b/jstests/noPassthrough/hybrid_index_with_updates.js
index 3b9c2d89f7a..4786cc0d3f2 100644
--- a/jstests/noPassthrough/hybrid_index_with_updates.js
+++ b/jstests/noPassthrough/hybrid_index_with_updates.js
@@ -7,8 +7,6 @@
(function() {
"use strict";
-load("jstests/libs/check_log.js");
-
let conn = MongoRunner.runMongod();
let testDB = conn.getDB('test');
diff --git a/jstests/noPassthrough/hybrid_unique_index_with_updates.js b/jstests/noPassthrough/hybrid_unique_index_with_updates.js
index 38a83b30a37..4674ac784a7 100644
--- a/jstests/noPassthrough/hybrid_unique_index_with_updates.js
+++ b/jstests/noPassthrough/hybrid_unique_index_with_updates.js
@@ -8,8 +8,6 @@
(function() {
"use strict";
-load("jstests/libs/check_log.js");
-
let replSetTest = new ReplSetTest({name: "hybrid_updates", nodes: 2});
replSetTest.startSet();
replSetTest.initiate();
diff --git a/jstests/noPassthrough/indexbg2.js b/jstests/noPassthrough/indexbg2.js
index c7a119048ec..4ad1f3dd898 100644
--- a/jstests/noPassthrough/indexbg2.js
+++ b/jstests/noPassthrough/indexbg2.js
@@ -4,8 +4,6 @@
(function() {
"use strict";
-load("jstests/libs/check_log.js");
-
const conn = MongoRunner.runMongod({nojournal: ""});
assert.neq(null, conn, "mongod failed to start.");
diff --git a/jstests/noPassthrough/indexbg_shutdown.js b/jstests/noPassthrough/indexbg_shutdown.js
index 88007a29e1a..9336a2ba063 100644
--- a/jstests/noPassthrough/indexbg_shutdown.js
+++ b/jstests/noPassthrough/indexbg_shutdown.js
@@ -9,7 +9,6 @@
(function() {
"use strict";
-load('jstests/libs/check_log.js');
load('jstests/noPassthrough/libs/index_build.js');
var dbname = 'bgIndexSec';
diff --git a/jstests/noPassthrough/initial_sync_wt_cache_full.js b/jstests/noPassthrough/initial_sync_wt_cache_full.js
index 90d19a172ab..8b34997dbd5 100644
--- a/jstests/noPassthrough/initial_sync_wt_cache_full.js
+++ b/jstests/noPassthrough/initial_sync_wt_cache_full.js
@@ -4,7 +4,6 @@
*/
(function() {
'use strict';
-load('jstests/libs/check_log.js');
const rst = new ReplSetTest({
nodes: [
diff --git a/jstests/noPassthrough/latency_includes_lock_acquisition_time.js b/jstests/noPassthrough/latency_includes_lock_acquisition_time.js
index 5b1757188e7..7752947f568 100644
--- a/jstests/noPassthrough/latency_includes_lock_acquisition_time.js
+++ b/jstests/noPassthrough/latency_includes_lock_acquisition_time.js
@@ -24,7 +24,6 @@ function runWithWait(millis, func) {
}));
}
-load("jstests/libs/check_log.js");
load("jstests/libs/profiler.js");
let hangMillis = 200;
diff --git a/jstests/noPassthrough/log_find_getmore.js b/jstests/noPassthrough/log_find_getmore.js
index dc7f6d83c91..0aabdb1bd35 100644
--- a/jstests/noPassthrough/log_find_getmore.js
+++ b/jstests/noPassthrough/log_find_getmore.js
@@ -7,7 +7,6 @@
"use strict";
// For checkLog and getLatestProfilerEntry.
-load("jstests/libs/check_log.js");
load("jstests/libs/profiler.js");
function assertLogLineContains(conn, parts) {
diff --git a/jstests/noPassthrough/log_format_slowms_samplerate_loglevel.js b/jstests/noPassthrough/log_format_slowms_samplerate_loglevel.js
index 0b4cda5794e..1292148619b 100644
--- a/jstests/noPassthrough/log_format_slowms_samplerate_loglevel.js
+++ b/jstests/noPassthrough/log_format_slowms_samplerate_loglevel.js
@@ -12,7 +12,6 @@
TestData.disableImplicitSessions = true;
load("jstests/libs/fixture_helpers.js"); // For FixtureHelpers.
-load("jstests/libs/check_log.js"); // For formatAsLogLine.
// Prevent the mongo shell from gossiping its cluster time, since this will increase the amount
// of data logged for each op. For some of the testcases below, including the cluster time would
diff --git a/jstests/noPassthrough/profile_interrupted_op.js b/jstests/noPassthrough/profile_interrupted_op.js
index f49a126731d..f0fff91b734 100644
--- a/jstests/noPassthrough/profile_interrupted_op.js
+++ b/jstests/noPassthrough/profile_interrupted_op.js
@@ -8,8 +8,6 @@
(function() {
"use strict";
-load("jstests/libs/check_log.js"); // For checkLog.
-
//
// Start mongo with profiling disabled, create an empty database, and populate it with a
// collection that has one document.
diff --git a/jstests/noPassthrough/recovery_wt_cache_full.js b/jstests/noPassthrough/recovery_wt_cache_full.js
index 7d7dc171296..099f848d3d7 100644
--- a/jstests/noPassthrough/recovery_wt_cache_full.js
+++ b/jstests/noPassthrough/recovery_wt_cache_full.js
@@ -5,7 +5,6 @@
*/
(function() {
'use strict';
-load('jstests/libs/check_log.js');
const rst = new ReplSetTest({
nodes: [
diff --git a/jstests/noPassthrough/step_down_during_drop_database.js b/jstests/noPassthrough/step_down_during_drop_database.js
index 5480605b1c3..b1b1fbfdf42 100644
--- a/jstests/noPassthrough/step_down_during_drop_database.js
+++ b/jstests/noPassthrough/step_down_during_drop_database.js
@@ -8,8 +8,6 @@
(function() {
"use strict";
-load("jstests/libs/check_log.js");
-
const dbName = "test";
const collName = "coll";
diff --git a/jstests/noPassthrough/transaction_write_with_snapshot_unavailable.js b/jstests/noPassthrough/transaction_write_with_snapshot_unavailable.js
index 48de0c880c8..65ec2a0f9a0 100644
--- a/jstests/noPassthrough/transaction_write_with_snapshot_unavailable.js
+++ b/jstests/noPassthrough/transaction_write_with_snapshot_unavailable.js
@@ -10,7 +10,6 @@
*/
(function() {
"use strict";
-load("jstests/libs/check_log.js");
const name = "transaction_write_with_snapshot_unavailable";
const replTest = new ReplSetTest({name: name, nodes: 1});
diff --git a/jstests/noPassthrough/upgrade_unfinished_unique_indexes.js b/jstests/noPassthrough/upgrade_unfinished_unique_indexes.js
index ea9cb0cea80..96320952097 100644
--- a/jstests/noPassthrough/upgrade_unfinished_unique_indexes.js
+++ b/jstests/noPassthrough/upgrade_unfinished_unique_indexes.js
@@ -13,7 +13,6 @@
"use strict";
load('jstests/noPassthrough/libs/index_build.js');
-load('jstests/libs/check_log.js');
const dbname = 'bgIndexSec';
const collection = 'bgIndexShutdown';
diff --git a/jstests/noPassthroughWithMongod/create_indexes_waits_for_already_in_progress.js b/jstests/noPassthroughWithMongod/create_indexes_waits_for_already_in_progress.js
index 08c3b26f5c4..b5704d2e84c 100644
--- a/jstests/noPassthroughWithMongod/create_indexes_waits_for_already_in_progress.js
+++ b/jstests/noPassthroughWithMongod/create_indexes_waits_for_already_in_progress.js
@@ -25,7 +25,6 @@
(function() {
"use strict";
-load("jstests/libs/check_log.js");
load("jstests/libs/parallel_shell_helpers.js");
load('jstests/libs/test_background_ops.js');
diff --git a/jstests/replsets/abort_in_progress_transactions_on_step_up.js b/jstests/replsets/abort_in_progress_transactions_on_step_up.js
index a47baee071a..9ff277cb7b4 100644
--- a/jstests/replsets/abort_in_progress_transactions_on_step_up.js
+++ b/jstests/replsets/abort_in_progress_transactions_on_step_up.js
@@ -6,7 +6,6 @@
(function() {
"use strict";
load("jstests/replsets/rslib.js"); // For reconnect()
-load("jstests/libs/check_log.js");
function getTxnTableEntry(db) {
let txnTableEntries = db.getSiblingDB("config")["transactions"].find().toArray();
diff --git a/jstests/replsets/avg_num_catchup_ops.js b/jstests/replsets/avg_num_catchup_ops.js
index cd9828e7630..5a3bd488722 100644
--- a/jstests/replsets/avg_num_catchup_ops.js
+++ b/jstests/replsets/avg_num_catchup_ops.js
@@ -5,7 +5,6 @@
(function() {
"use strict";
-load("jstests/libs/check_log.js");
load("jstests/libs/write_concern_util.js");
load("jstests/replsets/libs/election_metrics.js");
load("jstests/replsets/rslib.js");
diff --git a/jstests/replsets/awaitdata_getmore_new_last_committed_optime.js b/jstests/replsets/awaitdata_getmore_new_last_committed_optime.js
index 0f76df2dfe5..9f79df71499 100644
--- a/jstests/replsets/awaitdata_getmore_new_last_committed_optime.js
+++ b/jstests/replsets/awaitdata_getmore_new_last_committed_optime.js
@@ -5,7 +5,6 @@
(function() {
'use strict';
load('jstests/replsets/rslib.js');
-load('jstests/libs/check_log.js');
const name = 'awaitdata_getmore_new_last_committed_optime';
const replSet = new ReplSetTest({name: name, nodes: 5, settings: {chainingAllowed: false}});
diff --git a/jstests/replsets/catchup.js b/jstests/replsets/catchup.js
index 2ae5e09e732..d565fa2b5d5 100644
--- a/jstests/replsets/catchup.js
+++ b/jstests/replsets/catchup.js
@@ -3,7 +3,6 @@
(function() {
"use strict";
-load("jstests/libs/check_log.js");
load("jstests/libs/write_concern_util.js");
load("jstests/replsets/libs/election_metrics.js");
load("jstests/replsets/rslib.js");
diff --git a/jstests/replsets/change_stream_speculative_majority_lastApplied_lag.js b/jstests/replsets/change_stream_speculative_majority_lastApplied_lag.js
index 88e3bfa47a7..78054fe707a 100644
--- a/jstests/replsets/change_stream_speculative_majority_lastApplied_lag.js
+++ b/jstests/replsets/change_stream_speculative_majority_lastApplied_lag.js
@@ -9,7 +9,6 @@
"use strict";
load('jstests/libs/change_stream_util.js'); // For ChangeStreamTest.
-load("jstests/libs/check_log.js"); // For checkLog.
load("jstests/libs/parallelTester.js"); // for ScopedThread.
const name = "change_stream_speculative_majority_lastApplied_lag";
diff --git a/jstests/replsets/change_stream_speculative_majority_secondary_batch_application.js b/jstests/replsets/change_stream_speculative_majority_secondary_batch_application.js
index 29beca07a26..7b83178933d 100644
--- a/jstests/replsets/change_stream_speculative_majority_secondary_batch_application.js
+++ b/jstests/replsets/change_stream_speculative_majority_secondary_batch_application.js
@@ -9,7 +9,6 @@
"use strict";
load("jstests/libs/write_concern_util.js"); // for [stop|restart]ServerReplication.
-load("jstests/libs/check_log.js"); // for checkLog.
const name = "speculative_majority_secondary";
const replTest = new ReplSetTest({
diff --git a/jstests/replsets/create_drop_database_different_casing.js b/jstests/replsets/create_drop_database_different_casing.js
index 6ba4465d8da..954450248b0 100644
--- a/jstests/replsets/create_drop_database_different_casing.js
+++ b/jstests/replsets/create_drop_database_different_casing.js
@@ -16,8 +16,6 @@
(function() {
'use strict';
-load("jstests/libs/check_log.js");
-
const rst = new ReplSetTest({nodes: [{}, {rsConfig: {priority: 0}}]});
rst.startSet();
rst.initiate();
diff --git a/jstests/replsets/ddl_op_behind_transaction_fails_in_shutdown.js b/jstests/replsets/ddl_op_behind_transaction_fails_in_shutdown.js
index 2577744902e..735735ec8e6 100644
--- a/jstests/replsets/ddl_op_behind_transaction_fails_in_shutdown.js
+++ b/jstests/replsets/ddl_op_behind_transaction_fails_in_shutdown.js
@@ -19,7 +19,6 @@
"use strict";
load("jstests/core/txns/libs/prepare_helpers.js");
-load("jstests/libs/check_log.js");
load("jstests/libs/parallel_shell_helpers.js");
load('jstests/libs/test_background_ops.js');
diff --git a/jstests/replsets/disallow_adding_initialized_node1.js b/jstests/replsets/disallow_adding_initialized_node1.js
index 7123070bf92..d9b953d874a 100644
--- a/jstests/replsets/disallow_adding_initialized_node1.js
+++ b/jstests/replsets/disallow_adding_initialized_node1.js
@@ -6,7 +6,6 @@
(function() {
'use strict';
-load("jstests/libs/check_log.js");
var name = 'disallow_adding_initialized_node1';
var replSetA = new ReplSetTest({
diff --git a/jstests/replsets/disallow_adding_initialized_node2.js b/jstests/replsets/disallow_adding_initialized_node2.js
index 12de734b411..63817f6ca49 100644
--- a/jstests/replsets/disallow_adding_initialized_node2.js
+++ b/jstests/replsets/disallow_adding_initialized_node2.js
@@ -11,7 +11,6 @@
(function() {
'use strict';
-load("jstests/libs/check_log.js");
var name = 'disallow_adding_initialized_node2';
var replSetA = new ReplSetTest({
diff --git a/jstests/replsets/disconnect_on_legacy_write_to_secondary.js b/jstests/replsets/disconnect_on_legacy_write_to_secondary.js
index 9a5474e190c..59999435f62 100644
--- a/jstests/replsets/disconnect_on_legacy_write_to_secondary.js
+++ b/jstests/replsets/disconnect_on_legacy_write_to_secondary.js
@@ -4,8 +4,6 @@
(function() {
"use strict";
-load("jstests/libs/check_log.js");
-
const rst = new ReplSetTest({nodes: [{}, {rsConfig: {priority: 0}}]});
rst.startSet();
rst.initiate();
diff --git a/jstests/replsets/do_not_advance_commit_point_beyond_last_applied_term.js b/jstests/replsets/do_not_advance_commit_point_beyond_last_applied_term.js
index bceff6a1cfa..3fc65f1396a 100644
--- a/jstests/replsets/do_not_advance_commit_point_beyond_last_applied_term.js
+++ b/jstests/replsets/do_not_advance_commit_point_beyond_last_applied_term.js
@@ -7,7 +7,6 @@
(function() {
"use strict";
-load("jstests/libs/check_log.js");
load("jstests/libs/write_concern_util.js"); // for [stop|restart]ServerReplication.
const dbName = "test";
diff --git a/jstests/replsets/drop_collections_two_phase_rename_drop_target.js b/jstests/replsets/drop_collections_two_phase_rename_drop_target.js
index c5bf302e321..444f33a7360 100644
--- a/jstests/replsets/drop_collections_two_phase_rename_drop_target.js
+++ b/jstests/replsets/drop_collections_two_phase_rename_drop_target.js
@@ -7,7 +7,6 @@
'use strict';
load('jstests/replsets/libs/two_phase_drops.js'); // For TwoPhaseDropCollectionTest.
-load('jstests/libs/check_log.js'); // For checkLog.contains().
// Return a list of all indexes for a given collection. Use 'args' as the
// 'listIndexes' command arguments.
diff --git a/jstests/replsets/drop_collections_two_phase_write_concern.js b/jstests/replsets/drop_collections_two_phase_write_concern.js
index e7b60eb18fb..12ae7b4fc93 100644
--- a/jstests/replsets/drop_collections_two_phase_write_concern.js
+++ b/jstests/replsets/drop_collections_two_phase_write_concern.js
@@ -6,7 +6,6 @@
(function() {
'use strict';
-load('jstests/libs/check_log.js');
load('jstests/replsets/libs/two_phase_drops.js'); // For TwoPhaseDropCollectionTest.
// Alias to logging function in two_phase_drops.js
diff --git a/jstests/replsets/drop_databases_two_phase.js b/jstests/replsets/drop_databases_two_phase.js
index 2a03bde98ad..094d5439c27 100644
--- a/jstests/replsets/drop_databases_two_phase.js
+++ b/jstests/replsets/drop_databases_two_phase.js
@@ -18,7 +18,6 @@
"use strict";
load('jstests/replsets/libs/two_phase_drops.js'); // For TwoPhaseDropCollectionTest.
-load('jstests/libs/check_log.js');
load("jstests/replsets/rslib.js");
// Returns a list of all collections in a given database. Use 'args' as the
diff --git a/jstests/replsets/initial_sync_applier_error.js b/jstests/replsets/initial_sync_applier_error.js
index 2bd65f51e12..df78fcea696 100644
--- a/jstests/replsets/initial_sync_applier_error.js
+++ b/jstests/replsets/initial_sync_applier_error.js
@@ -11,7 +11,6 @@
(function() {
"use strict";
-load("jstests/libs/check_log.js");
var name = 'initial_sync_applier_error';
var replSet = new ReplSetTest({
diff --git a/jstests/replsets/initial_sync_capped_index.js b/jstests/replsets/initial_sync_capped_index.js
index dfec1f5637d..c287e7a017e 100644
--- a/jstests/replsets/initial_sync_capped_index.js
+++ b/jstests/replsets/initial_sync_capped_index.js
@@ -26,7 +26,6 @@
(function() {
"use strict";
-load("jstests/libs/check_log.js");
load("jstests/replsets/rslib.js"); // for waitForState
/**
diff --git a/jstests/replsets/initial_sync_drop_collection.js b/jstests/replsets/initial_sync_drop_collection.js
index c68e9288a1f..18e3f655c76 100644
--- a/jstests/replsets/initial_sync_drop_collection.js
+++ b/jstests/replsets/initial_sync_drop_collection.js
@@ -6,7 +6,6 @@
// Skip db hash check because secondary cannot complete initial sync.
TestData.skipCheckDBHashes = true;
-load("jstests/libs/check_log.js");
load('jstests/replsets/libs/two_phase_drops.js');
load("jstests/libs/uuid_util.js");
diff --git a/jstests/replsets/initial_sync_during_stepdown.js b/jstests/replsets/initial_sync_during_stepdown.js
index a1e0033d709..3ac43545d9c 100644
--- a/jstests/replsets/initial_sync_during_stepdown.js
+++ b/jstests/replsets/initial_sync_during_stepdown.js
@@ -4,7 +4,6 @@
(function() {
"use strict";
-load("jstests/libs/check_log.js");
load("jstests/libs/curop_helpers.js"); // for waitForCurOpByFailPoint().
const testName = "initialSyncDuringStepDown";
diff --git a/jstests/replsets/initial_sync_fcv.js b/jstests/replsets/initial_sync_fcv.js
index 9e8a32a9149..0aa95d6ec1c 100644
--- a/jstests/replsets/initial_sync_fcv.js
+++ b/jstests/replsets/initial_sync_fcv.js
@@ -7,7 +7,6 @@
(function() {
'use strict';
-load('jstests/libs/check_log.js');
load("jstests/libs/fail_point_util.js");
load("jstests/libs/feature_compatibility_version.js");
diff --git a/jstests/replsets/initial_sync_fetch_from_oldest_active_transaction_timestamp_no_oplog_application.js b/jstests/replsets/initial_sync_fetch_from_oldest_active_transaction_timestamp_no_oplog_application.js
index 9a4ed0368a5..0d278aa01cb 100644
--- a/jstests/replsets/initial_sync_fetch_from_oldest_active_transaction_timestamp_no_oplog_application.js
+++ b/jstests/replsets/initial_sync_fetch_from_oldest_active_transaction_timestamp_no_oplog_application.js
@@ -20,7 +20,6 @@
(function() {
"use strict";
-load("jstests/libs/check_log.js");
load("jstests/core/txns/libs/prepare_helpers.js");
const replTest = new ReplSetTest({nodes: [{}, {rsConfig: {priority: 0, votes: 0}}]});
diff --git a/jstests/replsets/initial_sync_oplog_hole.js b/jstests/replsets/initial_sync_oplog_hole.js
index 190099cd571..61d04451aec 100644
--- a/jstests/replsets/initial_sync_oplog_hole.js
+++ b/jstests/replsets/initial_sync_oplog_hole.js
@@ -6,7 +6,6 @@
(function() {
"use strict";
-load("jstests/libs/check_log.js");
load("jstests/replsets/rslib.js");
// Set up replica set. Disallow chaining so nodes always sync from primary.
diff --git a/jstests/replsets/initial_sync_oplog_rollover.js b/jstests/replsets/initial_sync_oplog_rollover.js
index 7ffe8c98dd4..0d8e60e5501 100644
--- a/jstests/replsets/initial_sync_oplog_rollover.js
+++ b/jstests/replsets/initial_sync_oplog_rollover.js
@@ -9,7 +9,6 @@
(function() {
"use strict";
-load("jstests/libs/check_log.js");
var name = 'initial_sync_oplog_rollover';
var replSet = new ReplSetTest({
diff --git a/jstests/replsets/initial_sync_read_concern_no_oplog.js b/jstests/replsets/initial_sync_read_concern_no_oplog.js
index 6ad3974cea3..9a63398b5d4 100644
--- a/jstests/replsets/initial_sync_read_concern_no_oplog.js
+++ b/jstests/replsets/initial_sync_read_concern_no_oplog.js
@@ -2,7 +2,6 @@
// created its oplog, the node returns an error rather than crashing.
(function() {
'use strict';
-load('jstests/libs/check_log.js');
const replSet = new ReplSetTest({nodes: 1});
diff --git a/jstests/replsets/initial_sync_replSetGetStatus.js b/jstests/replsets/initial_sync_replSetGetStatus.js
index 415f4b5cddb..57289816d51 100644
--- a/jstests/replsets/initial_sync_replSetGetStatus.js
+++ b/jstests/replsets/initial_sync_replSetGetStatus.js
@@ -5,7 +5,6 @@
(function() {
"use strict";
-load("jstests/libs/check_log.js");
var name = 'initial_sync_replSetGetStatus';
var replSet = new ReplSetTest({
diff --git a/jstests/replsets/initial_sync_replicates_prepare_received_during_another_initial_sync.js b/jstests/replsets/initial_sync_replicates_prepare_received_during_another_initial_sync.js
index 4c147802fbd..80012cab607 100644
--- a/jstests/replsets/initial_sync_replicates_prepare_received_during_another_initial_sync.js
+++ b/jstests/replsets/initial_sync_replicates_prepare_received_during_another_initial_sync.js
@@ -16,7 +16,6 @@
(function() {
"use strict";
load("jstests/core/txns/libs/prepare_helpers.js");
-load("jstests/libs/check_log.js");
load("jstests/replsets/rslib.js");
/**
diff --git a/jstests/replsets/initial_sync_test_fixture_test.js b/jstests/replsets/initial_sync_test_fixture_test.js
index c112bc58ef7..7d7b2e93698 100644
--- a/jstests/replsets/initial_sync_test_fixture_test.js
+++ b/jstests/replsets/initial_sync_test_fixture_test.js
@@ -16,7 +16,6 @@
"use strict";
load("jstests/core/txns/libs/prepare_helpers.js");
-load("jstests/libs/check_log.js");
load("jstests/replsets/libs/initial_sync_test.js");
/**
diff --git a/jstests/replsets/initial_sync_update_missing_doc1.js b/jstests/replsets/initial_sync_update_missing_doc1.js
index 02576960290..7f595aa2e61 100644
--- a/jstests/replsets/initial_sync_update_missing_doc1.js
+++ b/jstests/replsets/initial_sync_update_missing_doc1.js
@@ -13,7 +13,6 @@
(function() {
load("jstests/replsets/libs/initial_sync_update_missing_doc.js");
-load("jstests/libs/check_log.js");
const name = 'initial_sync_update_missing_doc1';
const replSet = new ReplSetTest({
diff --git a/jstests/replsets/initial_sync_update_missing_doc2.js b/jstests/replsets/initial_sync_update_missing_doc2.js
index bd3b2d8957a..b8ec6b6c3ad 100644
--- a/jstests/replsets/initial_sync_update_missing_doc2.js
+++ b/jstests/replsets/initial_sync_update_missing_doc2.js
@@ -14,7 +14,6 @@
(function() {
load("jstests/replsets/libs/initial_sync_update_missing_doc.js");
-load("jstests/libs/check_log.js");
var name = 'initial_sync_update_missing_doc2';
var replSet = new ReplSetTest({
diff --git a/jstests/replsets/initial_sync_update_missing_doc3.js b/jstests/replsets/initial_sync_update_missing_doc3.js
index dadc0f32d9b..3782aedb6aa 100644
--- a/jstests/replsets/initial_sync_update_missing_doc3.js
+++ b/jstests/replsets/initial_sync_update_missing_doc3.js
@@ -14,7 +14,6 @@
*/
(function() {
-load("jstests/libs/check_log.js");
load("jstests/replsets/libs/initial_sync_update_missing_doc.js");
load("jstests/replsets/libs/two_phase_drops.js"); // For TwoPhaseDropCollectionTest.
diff --git a/jstests/replsets/initial_sync_update_missing_doc_with_prepare.js b/jstests/replsets/initial_sync_update_missing_doc_with_prepare.js
index e9840f7baa7..77ddc5eae16 100644
--- a/jstests/replsets/initial_sync_update_missing_doc_with_prepare.js
+++ b/jstests/replsets/initial_sync_update_missing_doc_with_prepare.js
@@ -16,7 +16,6 @@
(function() {
load("jstests/core/txns/libs/prepare_helpers.js");
load("jstests/replsets/libs/initial_sync_update_missing_doc.js");
-load("jstests/libs/check_log.js");
function doTest(doTransactionWork, numDocuments) {
const name = 'initial_sync_update_missing_doc_with_prepare';
diff --git a/jstests/replsets/initial_sync_update_reinsert_missing_doc_with_prepare.js b/jstests/replsets/initial_sync_update_reinsert_missing_doc_with_prepare.js
index 5df204812d4..a7d16070ba1 100644
--- a/jstests/replsets/initial_sync_update_reinsert_missing_doc_with_prepare.js
+++ b/jstests/replsets/initial_sync_update_reinsert_missing_doc_with_prepare.js
@@ -16,7 +16,6 @@
(function() {
load("jstests/core/txns/libs/prepare_helpers.js");
load("jstests/replsets/libs/initial_sync_update_missing_doc.js");
-load("jstests/libs/check_log.js");
function doTest(doTransactionWork, numDocuments) {
const name = 'initial_sync_update_missing_doc_with_prepare';
diff --git a/jstests/replsets/kill_reads_with_prepare_conflicts_during_step_down.js b/jstests/replsets/kill_reads_with_prepare_conflicts_during_step_down.js
index 016f05fd5ea..63ad468cd38 100644
--- a/jstests/replsets/kill_reads_with_prepare_conflicts_during_step_down.js
+++ b/jstests/replsets/kill_reads_with_prepare_conflicts_during_step_down.js
@@ -9,7 +9,6 @@
"use strict";
load("jstests/core/txns/libs/prepare_helpers.js");
-load("jstests/libs/check_log.js");
// Start one of the nodes with priority: 0 to avoid elections.
const rst = new ReplSetTest({nodes: [{}, {rsConfig: {priority: 0}}]});
diff --git a/jstests/replsets/kill_reads_with_prepare_conflicts_during_step_up.js b/jstests/replsets/kill_reads_with_prepare_conflicts_during_step_up.js
index 3b0b0b49e8b..36a38fce4b7 100644
--- a/jstests/replsets/kill_reads_with_prepare_conflicts_during_step_up.js
+++ b/jstests/replsets/kill_reads_with_prepare_conflicts_during_step_up.js
@@ -9,7 +9,6 @@
"use strict";
load("jstests/core/txns/libs/prepare_helpers.js");
-load("jstests/libs/check_log.js");
const rst = new ReplSetTest({nodes: 2});
rst.startSet();
diff --git a/jstests/replsets/kill_ttl_on_stepdown.js b/jstests/replsets/kill_ttl_on_stepdown.js
index 18738a3e7ff..56528b87893 100644
--- a/jstests/replsets/kill_ttl_on_stepdown.js
+++ b/jstests/replsets/kill_ttl_on_stepdown.js
@@ -7,8 +7,6 @@
(function() {
"use strict";
-load("jstests/libs/check_log.js");
-
const dbName = "kill_ttl_on_stepdown";
const rst = new ReplSetTest({
diff --git a/jstests/replsets/last_error_reported_after_stepdown.js b/jstests/replsets/last_error_reported_after_stepdown.js
index bfd0e43bb8a..0947473aed1 100644
--- a/jstests/replsets/last_error_reported_after_stepdown.js
+++ b/jstests/replsets/last_error_reported_after_stepdown.js
@@ -5,8 +5,6 @@
(function() {
"use strict";
-load("jstests/libs/check_log.js");
-
const rst = new ReplSetTest({nodes: [{}, {rsConfig: {priority: 0}}]});
rst.startSet();
rst.initiate();
diff --git a/jstests/replsets/libs/election_handoff.js b/jstests/replsets/libs/election_handoff.js
index f05e6b702d7..255ebbd0e6f 100644
--- a/jstests/replsets/libs/election_handoff.js
+++ b/jstests/replsets/libs/election_handoff.js
@@ -5,7 +5,6 @@
*/
var ElectionHandoffTest = (function() {
- load("jstests/libs/check_log.js");
load("jstests/replsets/rslib.js");
const kStepDownPeriodSecs = 30;
diff --git a/jstests/replsets/libs/initial_sync_test.js b/jstests/replsets/libs/initial_sync_test.js
index 7ec45729173..001738baa2b 100644
--- a/jstests/replsets/libs/initial_sync_test.js
+++ b/jstests/replsets/libs/initial_sync_test.js
@@ -14,7 +14,6 @@
"use strict";
-load("jstests/libs/check_log.js");
load('jstests/replsets/rslib.js');
/**
diff --git a/jstests/replsets/libs/rollback_test.js b/jstests/replsets/libs/rollback_test.js
index feb20d1baa7..f6c3de6f7ab 100644
--- a/jstests/replsets/libs/rollback_test.js
+++ b/jstests/replsets/libs/rollback_test.js
@@ -86,6 +86,8 @@ function RollbackTest(name = "RollbackTest", replSet) {
const kNumDataBearingNodes = 3;
const kElectableNodes = 2;
+ let awaitSecondaryNodesForRollbackTimeout;
+
let rst;
let curPrimary;
let curSecondary;
@@ -268,7 +270,26 @@ function RollbackTest(name = "RollbackTest", replSet) {
// Allow replication temporarily so the following checks succeed.
restartServerReplication(tiebreakerNode);
- rst.awaitSecondaryNodes();
+ // If the rollback node has {enableMajorityReadConcern:false} set, it will use the
+ // rollbackViaRefetch algorithm. That can lead to unrecoverable rollbacks, particularly
+ // in unclean shutdown suites, as it it is possible in rare cases for the sync source to
+ // lose the entry corresponding to the optime the rollback node chose as its minValid.
+ try {
+ rst.awaitSecondaryNodesForRollbackTest(
+ awaitSecondaryNodesForRollbackTimeout,
+ [curSecondary, tiebreakerNode],
+ curSecondary /* connToCheckForUnrecoverableRollback */);
+ } catch (e) {
+ if (e.unrecoverableRollbackDetected) {
+ log(`Detected unrecoverable rollback on ${curSecondary.host}. Ending test.`,
+ true /* important */);
+ TestData.skipCheckDBHashes = true;
+ rst.stopSet();
+ quit();
+ }
+ // Re-throw the original exception in all other cases.
+ throw e;
+ }
rst.awaitReplication();
log(`Rollback on ${curSecondary.host} (if needed) and awaitReplication completed`, true);
@@ -506,4 +527,13 @@ function RollbackTest(name = "RollbackTest", replSet) {
this.getTestFixture = function() {
return rst;
};
+
+ /**
+ * Use this to control the timeout being used in the awaitSecondaryNodesForRollbackTest call
+ * in transitionToSteadyStateOperations.
+ * For use only in tests that expect unrecoverable rollbacks.
+ */
+ this.setAwaitSecondaryNodesForRollbackTimeout = function(timeoutMillis) {
+ awaitSecondaryNodesForRollbackTimeout = timeoutMillis;
+ };
}
diff --git a/jstests/replsets/libs/two_phase_drops.js b/jstests/replsets/libs/two_phase_drops.js
index bb772012fdb..e2b4beea82f 100644
--- a/jstests/replsets/libs/two_phase_drops.js
+++ b/jstests/replsets/libs/two_phase_drops.js
@@ -16,7 +16,6 @@
*/
"use strict";
-load("jstests/libs/check_log.js"); // For 'checkLog'.
load("jstests/libs/fixture_helpers.js"); // For 'FixtureHelpers'.
load("jstests/aggregation/extras/utils.js"); // For 'arrayEq'.
diff --git a/jstests/replsets/log_secondary_oplog_application.js b/jstests/replsets/log_secondary_oplog_application.js
index 90a8025a9a1..86626181f5b 100644
--- a/jstests/replsets/log_secondary_oplog_application.js
+++ b/jstests/replsets/log_secondary_oplog_application.js
@@ -7,7 +7,6 @@
(function() {
"use strict";
-load("jstests/libs/check_log.js");
let name = "log_secondary_oplog_application";
let rst = ReplSetTest({name: name, nodes: 2});
diff --git a/jstests/replsets/majority_writes_wait_for_all_durable_timestamp.js b/jstests/replsets/majority_writes_wait_for_all_durable_timestamp.js
index 5d0d962cda8..055ddcd234c 100644
--- a/jstests/replsets/majority_writes_wait_for_all_durable_timestamp.js
+++ b/jstests/replsets/majority_writes_wait_for_all_durable_timestamp.js
@@ -8,8 +8,6 @@
(function() {
"use strict";
-load("jstests/libs/check_log.js");
-
function assertWriteConcernTimeout(result) {
assert.writeErrorWithCode(result, ErrorCodes.WriteConcernFailed);
assert(result.hasWriteConcernError(), tojson(result));
diff --git a/jstests/replsets/mr_nonrepl_coll_in_local_db.js b/jstests/replsets/mr_nonrepl_coll_in_local_db.js
index 8348b65e09a..e1488bec811 100644
--- a/jstests/replsets/mr_nonrepl_coll_in_local_db.js
+++ b/jstests/replsets/mr_nonrepl_coll_in_local_db.js
@@ -9,8 +9,6 @@
(function() {
"use strict";
-load("jstests/libs/check_log.js");
-
const name = "mr_nonrepl_coll_in_local_db";
const replSet = new ReplSetTest({name: name, nodes: 2});
replSet.startSet();
diff --git a/jstests/replsets/no_flapping_during_network_partition.js b/jstests/replsets/no_flapping_during_network_partition.js
index e6f705c5a4a..1303e6baf2a 100644
--- a/jstests/replsets/no_flapping_during_network_partition.js
+++ b/jstests/replsets/no_flapping_during_network_partition.js
@@ -13,8 +13,6 @@
(function() {
"use strict";
-load("jstests/libs/check_log.js");
-
var name = "no_flapping_during_network_partition";
var replTest = new ReplSetTest({name: name, nodes: 3, useBridge: true});
diff --git a/jstests/replsets/not_master_unacknowledged_write.js b/jstests/replsets/not_master_unacknowledged_write.js
index ac7b4cf2ef5..087361c8bc3 100644
--- a/jstests/replsets/not_master_unacknowledged_write.js
+++ b/jstests/replsets/not_master_unacknowledged_write.js
@@ -5,8 +5,6 @@
(function() {
"use strict";
-load("jstests/libs/check_log.js");
-
function getNotMasterUnackWritesCounter() {
return assert.commandWorked(primaryDB.adminCommand({serverStatus: 1}))
.metrics.repl.network.notMasterUnacknowledgedWrites;
@@ -55,7 +53,6 @@ assert.commandWorked(primaryDB.adminCommand({
var command =
`
- load("jstests/libs/check_log.js");
checkLog.contains(db.getMongo(), "hangAfterCollectionInserts fail point enabled");
db.adminCommand({replSetStepDown: 60, force: true});`;
diff --git a/jstests/replsets/read_after_optime.js b/jstests/replsets/read_after_optime.js
index dad48acd925..ec284d59528 100644
--- a/jstests/replsets/read_after_optime.js
+++ b/jstests/replsets/read_after_optime.js
@@ -2,7 +2,6 @@
(function() {
"use strict";
-load("jstests/libs/check_log.js");
var replTest = new ReplSetTest({nodes: 2});
replTest.startSet();
diff --git a/jstests/replsets/read_committed_stale_history.js b/jstests/replsets/read_committed_stale_history.js
index f40841575f4..0727a5b8383 100644
--- a/jstests/replsets/read_committed_stale_history.js
+++ b/jstests/replsets/read_committed_stale_history.js
@@ -5,7 +5,6 @@
(function() {
'use strict';
-load("jstests/libs/check_log.js");
load("jstests/libs/write_concern_util.js");
load("jstests/replsets/rslib.js");
diff --git a/jstests/replsets/read_operations_during_step_down.js b/jstests/replsets/read_operations_during_step_down.js
index 2b0de53ebc7..bf888e4d368 100644
--- a/jstests/replsets/read_operations_during_step_down.js
+++ b/jstests/replsets/read_operations_during_step_down.js
@@ -2,7 +2,6 @@
* Test that the read operations are not killed and their connections are also not
* closed during step down.
*/
-load("jstests/libs/check_log.js");
load('jstests/libs/parallelTester.js');
load("jstests/libs/curop_helpers.js"); // for waitForCurOpByFailPoint().
load("jstests/replsets/rslib.js");
diff --git a/jstests/replsets/read_operations_during_step_up.js b/jstests/replsets/read_operations_during_step_up.js
index f778790821f..54ab8bde447 100644
--- a/jstests/replsets/read_operations_during_step_up.js
+++ b/jstests/replsets/read_operations_during_step_up.js
@@ -2,7 +2,6 @@
* Test that the read operations are not killed and their connections are also not
* closed during step up.
*/
-load("jstests/libs/check_log.js");
load('jstests/libs/parallelTester.js');
load("jstests/libs/curop_helpers.js"); // for waitForCurOpByFailPoint().
load("jstests/replsets/rslib.js");
diff --git a/jstests/replsets/reconfig_during_election.js b/jstests/replsets/reconfig_during_election.js
index 20e67a483c8..b73303bd60d 100644
--- a/jstests/replsets/reconfig_during_election.js
+++ b/jstests/replsets/reconfig_during_election.js
@@ -5,7 +5,6 @@
(function() {
"use strict";
load("jstests/replsets/libs/election_handoff.js");
-load("jstests/libs/check_log.js");
const rst = ReplSetTest({nodes: 2});
const nodes = rst.startSet();
diff --git a/jstests/replsets/reconstruct_prepared_transactions_initial_sync_index_build.js b/jstests/replsets/reconstruct_prepared_transactions_initial_sync_index_build.js
index a9f35921e8e..b80a89644e7 100644
--- a/jstests/replsets/reconstruct_prepared_transactions_initial_sync_index_build.js
+++ b/jstests/replsets/reconstruct_prepared_transactions_initial_sync_index_build.js
@@ -9,7 +9,6 @@
(function() {
"use strict";
-load("jstests/libs/check_log.js");
load("jstests/core/txns/libs/prepare_helpers.js");
const replTest = new ReplSetTest({nodes: 2});
diff --git a/jstests/replsets/reconstruct_prepared_transactions_initial_sync_no_oplog_application.js b/jstests/replsets/reconstruct_prepared_transactions_initial_sync_no_oplog_application.js
index cf388620e20..dbc2c05dfff 100644
--- a/jstests/replsets/reconstruct_prepared_transactions_initial_sync_no_oplog_application.js
+++ b/jstests/replsets/reconstruct_prepared_transactions_initial_sync_no_oplog_application.js
@@ -11,7 +11,6 @@
(function() {
"use strict";
-load("jstests/libs/check_log.js");
load("jstests/core/txns/libs/prepare_helpers.js");
const replTest = new ReplSetTest({nodes: 2});
diff --git a/jstests/replsets/recovery_preserves_active_txns.js b/jstests/replsets/recovery_preserves_active_txns.js
index 005286cf152..80c6070928f 100644
--- a/jstests/replsets/recovery_preserves_active_txns.js
+++ b/jstests/replsets/recovery_preserves_active_txns.js
@@ -13,7 +13,6 @@
(function() {
"use strict";
load("jstests/core/txns/libs/prepare_helpers.js");
-load("jstests/libs/check_log.js");
// A new replica set for both the commit and abort tests to ensure the same clean state.
function doTest(commitOrAbort) {
diff --git a/jstests/replsets/rollback_drop_database.js b/jstests/replsets/rollback_drop_database.js
index 2e3c883b747..da7d24a10af 100644
--- a/jstests/replsets/rollback_drop_database.js
+++ b/jstests/replsets/rollback_drop_database.js
@@ -11,7 +11,6 @@
(function() {
load("jstests/replsets/libs/rollback_test.js");
-load("jstests/libs/check_log.js");
const testName = "rollback_drop_database";
const oldDbName = "oldDatabase";
diff --git a/jstests/replsets/rollback_remote_cursor_retry.js b/jstests/replsets/rollback_remote_cursor_retry.js
index 2e2db8c5df6..1be860a7b35 100644
--- a/jstests/replsets/rollback_remote_cursor_retry.js
+++ b/jstests/replsets/rollback_remote_cursor_retry.js
@@ -8,7 +8,6 @@
(function() {
"use strict";
load("jstests/replsets/libs/rollback_test.js");
-load("jstests/libs/check_log.js");
const testName = "rollback_remote_cursor_retry";
const dbName = testName;
diff --git a/jstests/replsets/rollback_unprepared_transactions.js b/jstests/replsets/rollback_unprepared_transactions.js
index b2bfaa76405..777f70dd245 100644
--- a/jstests/replsets/rollback_unprepared_transactions.js
+++ b/jstests/replsets/rollback_unprepared_transactions.js
@@ -5,7 +5,6 @@
(function() {
'use strict';
-load('jstests/libs/check_log.js');
load('jstests/replsets/libs/rollback_test.js');
load('jstests/replsets/libs/rollback_files.js');
diff --git a/jstests/replsets/rollback_via_refetch_survives_nonexistent_collection_drop.js b/jstests/replsets/rollback_via_refetch_survives_nonexistent_collection_drop.js
index 3c8bd73da51..bd229838a62 100644
--- a/jstests/replsets/rollback_via_refetch_survives_nonexistent_collection_drop.js
+++ b/jstests/replsets/rollback_via_refetch_survives_nonexistent_collection_drop.js
@@ -11,7 +11,6 @@
(function() {
"use strict";
-load("jstests/libs/check_log.js");
load("jstests/replsets/libs/rollback_test.js");
const dbName = "test";
diff --git a/jstests/replsets/rollback_waits_for_bgindex_completion.js b/jstests/replsets/rollback_waits_for_bgindex_completion.js
index e6433d558e6..ff9f21a9e8a 100644
--- a/jstests/replsets/rollback_waits_for_bgindex_completion.js
+++ b/jstests/replsets/rollback_waits_for_bgindex_completion.js
@@ -7,7 +7,6 @@
(function() {
'use strict';
-load('jstests/libs/check_log.js');
load("jstests/replsets/rslib.js");
load('jstests/replsets/libs/rollback_test.js');
diff --git a/jstests/replsets/rollback_with_socket_error_then_steady_state.js b/jstests/replsets/rollback_with_socket_error_then_steady_state.js
index 713658e1b5f..e773de09dd5 100644
--- a/jstests/replsets/rollback_with_socket_error_then_steady_state.js
+++ b/jstests/replsets/rollback_with_socket_error_then_steady_state.js
@@ -6,7 +6,6 @@
(function() {
'use strict';
-load("jstests/libs/check_log.js");
load("jstests/replsets/rslib.js");
var collName = "test.coll";
diff --git a/jstests/replsets/startup_without_fcv_document_succeeds_if_initial_sync_flag_set.js b/jstests/replsets/startup_without_fcv_document_succeeds_if_initial_sync_flag_set.js
index 3b83bda0888..365fd2ac817 100644
--- a/jstests/replsets/startup_without_fcv_document_succeeds_if_initial_sync_flag_set.js
+++ b/jstests/replsets/startup_without_fcv_document_succeeds_if_initial_sync_flag_set.js
@@ -4,7 +4,6 @@
*/
(function() {
-load("jstests/libs/check_log.js");
load("jstests/libs/feature_compatibility_version.js");
rst = new ReplSetTest({nodes: 1});
diff --git a/jstests/replsets/step_down_during_draining2.js b/jstests/replsets/step_down_during_draining2.js
index 25c1597d5c4..db37db7aada 100644
--- a/jstests/replsets/step_down_during_draining2.js
+++ b/jstests/replsets/step_down_during_draining2.js
@@ -14,7 +14,6 @@
"use strict";
load("jstests/replsets/rslib.js");
-load("jstests/libs/check_log.js");
var replSet = new ReplSetTest({name: 'testSet', nodes: 3});
var nodes = replSet.nodeList();
diff --git a/jstests/replsets/step_down_on_secondary.js b/jstests/replsets/step_down_on_secondary.js
index 1dc13940439..9f62465ec41 100644
--- a/jstests/replsets/step_down_on_secondary.js
+++ b/jstests/replsets/step_down_on_secondary.js
@@ -16,7 +16,6 @@
load('jstests/libs/parallelTester.js');
load("jstests/libs/curop_helpers.js"); // for waitForCurOpByFailPoint().
load("jstests/core/txns/libs/prepare_helpers.js");
-load("jstests/libs/check_log.js");
const dbName = "test";
const collName = "coll";
diff --git a/jstests/replsets/transient_txn_error_labels_with_write_concern.js b/jstests/replsets/transient_txn_error_labels_with_write_concern.js
index 54ad4f9044a..db88e68baba 100644
--- a/jstests/replsets/transient_txn_error_labels_with_write_concern.js
+++ b/jstests/replsets/transient_txn_error_labels_with_write_concern.js
@@ -3,7 +3,6 @@
(function() {
"use strict";
-load("jstests/libs/check_log.js");
load("jstests/libs/write_concern_util.js");
load("jstests/replsets/rslib.js");
diff --git a/jstests/replsets/trigger_initial_stable_checkpoint.js b/jstests/replsets/trigger_initial_stable_checkpoint.js
index 42feeb53e3a..fd8b4c55289 100644
--- a/jstests/replsets/trigger_initial_stable_checkpoint.js
+++ b/jstests/replsets/trigger_initial_stable_checkpoint.js
@@ -5,8 +5,6 @@
*/
(function() {
-load("jstests/libs/check_log.js");
-
const rst = new ReplSetTest({
nodes: 1,
nodeOptions: {
diff --git a/jstests/replsets/unconditional_step_down.js b/jstests/replsets/unconditional_step_down.js
index 4d5e37821db..d15e8ea6230 100644
--- a/jstests/replsets/unconditional_step_down.js
+++ b/jstests/replsets/unconditional_step_down.js
@@ -89,8 +89,6 @@ function runStepDownTest({testMsg, stepDownFn, toRemovedState}) {
}, primary.port);
const joinUnblockStepDown = startSafeParallelShell(() => {
- load("jstests/libs/check_log.js");
-
jsTestLog("Wait for step down to start killing operations");
checkLog.contains(db, "Starting to kill user operations");
diff --git a/jstests/replsets/unrecoverable_rollback_early_exit.js b/jstests/replsets/unrecoverable_rollback_early_exit.js
new file mode 100644
index 00000000000..c709820eaa6
--- /dev/null
+++ b/jstests/replsets/unrecoverable_rollback_early_exit.js
@@ -0,0 +1,72 @@
+/**
+ * This test exercises an unrecoverable rollback using rollback_test.js, expecting it to terminate
+ * cleanly early instead of failing.
+ * An unrecoverable rollback can happen with EMRC:false, as it is possible for rollback via refetch
+ * to set a minValid based on oplog entries that the sync source may have failed to recover after
+ * an unclean shutdown. The rollback node will need to sync and apply oplog entries up to minValid
+ * to be consistent, but if those oplog entries no longer exist, then it will be stuck in sync
+ * source selection and unable to complete recovery.
+ * This test reproduces this scenario in a simpler form by modifying the minValid on the rollback
+ * node very far forward, so that we do not have to simulate anything happening to the sync source.
+ */
+
+(function() {
+"use strict";
+
+load("jstests/libs/fail_point_util.js");
+load("jstests/replsets/libs/rollback_test.js");
+
+function tsToDate(ts) {
+ return new Date(ts.getTime() * 1000);
+}
+
+const testName = jsTestName();
+
+const rst = new ReplSetTest({
+ name: testName,
+ nodes: [{}, {}, {rsConfig: {priority: 0}}],
+ useBridge: true,
+ settings: {chainingAllowed: false},
+ nodeOptions: {enableMajorityReadConcern: "false"}
+});
+rst.startSet();
+rst.initiateWithHighElectionTimeout();
+
+const rollbackTest = new RollbackTest(testName, rst);
+const rollbackNode = rollbackTest.transitionToRollbackOperations();
+
+rollbackTest.transitionToSyncSourceOperationsBeforeRollback();
+
+const failpoint = configureFailPoint(rollbackNode, "rollbackHangBeforeFinish");
+
+rollbackTest.transitionToSyncSourceOperationsDuringRollback();
+
+assert.soonNoExcept(function() {
+ // Rollback will cause the node to close connections.
+ failpoint.wait();
+ return true;
+});
+
+const farFutureTS = new Timestamp(
+ Math.floor(new Date().getTime() / 1000) + (60 * 60 * 24 * 5 /* in five days*/), 0);
+
+jsTest.log("future TS: " + tojson(farFutureTS) + ", date:" + tsToDate(farFutureTS));
+
+const mMinvalid = rollbackNode.getDB("local").getCollection("replset.minvalid");
+
+const minValidUpdate = {
+ $set: {ts: farFutureTS}
+};
+jsTestLog("Current minValid is " + tojson(mMinvalid.findOne()));
+jsTestLog("Updating minValid to: " + tojson(minValidUpdate));
+printjson(assert.commandWorked(mMinvalid.update({}, minValidUpdate)));
+
+failpoint.off();
+
+rollbackTest.setAwaitSecondaryNodesForRollbackTimeout(5 * 1000);
+
+// We will detect an unrecoverable rollback here.
+rollbackTest.transitionToSteadyStateOperations();
+
+rollbackTest.stop();
+})(); \ No newline at end of file
diff --git a/jstests/sharding/change_streams_establishment_finds_new_shards.js b/jstests/sharding/change_streams_establishment_finds_new_shards.js
index 146fc166d50..753d8f8154c 100644
--- a/jstests/sharding/change_streams_establishment_finds_new_shards.js
+++ b/jstests/sharding/change_streams_establishment_finds_new_shards.js
@@ -44,7 +44,6 @@ assert.commandWorked(mongos.adminCommand(
// While opening the cursor, wait for the failpoint and add the new shard.
const awaitNewShard = startParallelShell(`
- load("jstests/libs/check_log.js");
checkLog.contains(db,
"clusterAggregateHangBeforeEstablishingShardCursors fail point enabled");
assert.commandWorked(
diff --git a/src/mongo/scripting/engine.cpp b/src/mongo/scripting/engine.cpp
index 676b20c6f18..2e5a0e2abd0 100644
--- a/src/mongo/scripting/engine.cpp
+++ b/src/mongo/scripting/engine.cpp
@@ -296,6 +296,7 @@ ScriptingFunction Scope::createFunction(const char* code) {
namespace JSFiles {
extern const JSFile collection;
+extern const JSFile check_log;
extern const JSFile crud_api;
extern const JSFile db;
extern const JSFile explain_query;
@@ -322,6 +323,7 @@ void Scope::execCoreFiles() {
execSetup(JSFiles::query);
execSetup(JSFiles::bulk_api);
execSetup(JSFiles::error_codes);
+ execSetup(JSFiles::check_log);
execSetup(JSFiles::collection);
execSetup(JSFiles::crud_api);
execSetup(JSFiles::explain_query);
diff --git a/src/mongo/shell/SConscript b/src/mongo/shell/SConscript
index 78a88004b2f..f83d615678f 100644
--- a/src/mongo/shell/SConscript
+++ b/src/mongo/shell/SConscript
@@ -36,6 +36,7 @@ js_header = env.JSHeader(
source=[
"assert.js",
"bulk_api.js",
+ "check_log.js",
"collection.js",
"crud_api.js",
"db.js",
diff --git a/jstests/libs/check_log.js b/src/mongo/shell/check_log.js
index c21a885c2db..c21a885c2db 100644
--- a/jstests/libs/check_log.js
+++ b/src/mongo/shell/check_log.js
diff --git a/src/mongo/shell/replsettest.js b/src/mongo/shell/replsettest.js
index 76d2f23171a..8c2ac8f1673 100644
--- a/src/mongo/shell/replsettest.js
+++ b/src/mongo/shell/replsettest.js
@@ -601,8 +601,8 @@ var ReplSetTest = function(opts) {
var ready = true;
for (var i = 0; i < len; i++) {
- var isMaster = slavesToCheck[i].getDB("admin").runCommand({ismaster: 1});
- var arbiter = (isMaster.arbiterOnly == undefined ? false : isMaster.arbiterOnly);
+ var isMaster = slavesToCheck[i].adminCommand({ismaster: 1});
+ var arbiter = (isMaster.arbiterOnly === undefined ? false : isMaster.arbiterOnly);
ready = ready && (isMaster.secondary || arbiter);
}
@@ -611,6 +611,51 @@ var ReplSetTest = function(opts) {
};
/**
+ * A special version of awaitSecondaryNodes() used exclusively by rollback_test.js.
+ * Wraps around awaitSecondaryNodes() itself and checks for an unrecoverable rollback
+ * if it throws.
+ */
+ this.awaitSecondaryNodesForRollbackTest = function(
+ timeout, slaves, connToCheckForUnrecoverableRollback) {
+ try {
+ this.awaitSecondaryNodes(timeout, slaves);
+ } catch (originalEx) {
+ // There is a special case where we expect the (rare) possibility of unrecoverable
+ // rollbacks with EMRC:false in rollback suites with unclean shutdowns.
+ jsTestLog("Exception in 'awaitSecondaryNodes', checking for unrecoverable rollback");
+ if (connToCheckForUnrecoverableRollback) {
+ const conn = connToCheckForUnrecoverableRollback;
+
+ const statusRes = assert.commandWorked(conn.adminCommand({replSetGetStatus: 1}));
+ const isRecovering = (statusRes.myState === ReplSetTest.State.RECOVERING);
+ const hasNoSyncSource = (statusRes.syncSourceId === -1);
+
+ const cmdLineOptsRes = assert.commandWorked(conn.adminCommand("getCmdLineOpts"));
+ const hasEMRCFalse =
+ (cmdLineOptsRes.parsed.replication.enableMajorityReadConcern === false);
+
+ if (isRecovering && hasNoSyncSource && hasEMRCFalse) {
+ try {
+ const n = this.getNodeId(conn);
+ const connToCheck = _useBridge ? _unbridgedNodes[n] : this.nodes[n];
+ // Confirm that the node is unable to recover after rolling back.
+ checkLog.contains(
+ connToCheck,
+ "remote oplog does not contain entry with optime matching our required optime ",
+ 60 * 1000);
+ } catch (checkLogEx) {
+ throw originalEx;
+ }
+ // Add this info to the original exception.
+ originalEx.unrecoverableRollbackDetected = true;
+ }
+ }
+ // Re-throw the original exception in all cases.
+ throw originalEx;
+ }
+ };
+
+ /**
* Blocks until the specified node says it's syncing from the given upstream node.
*/
this.awaitSyncSource = function(node, upstreamNode, timeout) {