summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Mir <ali.mir@mongodb.com>2020-09-09 11:24:36 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-09-10 18:44:30 +0000
commit0927e74e9d5dfb47c4f02d21029f68a3b17764b7 (patch)
treefc64499441f95ed95e84dcc793745211162a43cd
parent11c68393df88a6f1ea4855e6ac15e54ca9f9d976 (diff)
downloadmongo-0927e74e9d5dfb47c4f02d21029f68a3b17764b7.tar.gz
SERVER-50417 Change notMasterUnacknowledgedWrites to notPrimaryUnacknowledgedWrites in serverStatus
-rw-r--r--etc/backports_required_for_multiversion_tests.yml8
-rw-r--r--jstests/replsets/no_disconnect_on_stepdown.js2
-rw-r--r--jstests/replsets/not_master_unacknowledged_write.js16
-rw-r--r--jstests/replsets/read_operations_during_step_down.js2
-rw-r--r--jstests/replsets/read_operations_during_step_up.js6
-rw-r--r--src/mongo/db/service_entry_point_common.cpp10
6 files changed, 26 insertions, 18 deletions
diff --git a/etc/backports_required_for_multiversion_tests.yml b/etc/backports_required_for_multiversion_tests.yml
index 753692e534f..ae045bcedf4 100644
--- a/etc/backports_required_for_multiversion_tests.yml
+++ b/etc/backports_required_for_multiversion_tests.yml
@@ -68,6 +68,14 @@ all:
test_file: jstests/sharding/scaled_collection_stats.js
- ticket: SERVER-50416
test_file: jstests/replsets/disconnect_on_legacy_write_to_secondary.js
+ - ticket: SERVER-50417
+ test_file: jstests/replsets/no_disconnect_on_stepdown.js
+ - ticket: SERVER-50417
+ test_file: jstests/replsets/not_master_unacknowledged_write.js
+ - ticket: SERVER-50417
+ test_file: jstests/replsets/read_operations_during_step_down.js
+ - ticket: SERVER-50417
+ test_file: jstests/replsets/read_operations_during_step_up.js
# Tests that should only be excluded from particular suites should be listed under that suite.
suites:
diff --git a/jstests/replsets/no_disconnect_on_stepdown.js b/jstests/replsets/no_disconnect_on_stepdown.js
index 68877c6fc64..77a5526c50b 100644
--- a/jstests/replsets/no_disconnect_on_stepdown.js
+++ b/jstests/replsets/no_disconnect_on_stepdown.js
@@ -73,7 +73,7 @@ function runStepDownTest({description, failpoint, operation, errorCode}) {
assert.commandWorked(primaryAdmin.adminCommand({serverStatus: 1})).metrics.repl;
assert.eq(replMetrics.stateTransition.lastStateTransition, "stepDown");
assert.eq(replMetrics.stateTransition.userOperationsKilled, 1);
- assert.eq(replMetrics.network.notMasterUnacknowledgedWrites, 0);
+ assert.eq(replMetrics.network.notPrimaryUnacknowledgedWrites, 0);
// Allow the primary to be re-elected, and wait for it.
assert.commandWorked(primaryAdmin.adminCommand({replSetFreeze: 0}));
diff --git a/jstests/replsets/not_master_unacknowledged_write.js b/jstests/replsets/not_master_unacknowledged_write.js
index a1570de931a..1fc65ddb7ba 100644
--- a/jstests/replsets/not_master_unacknowledged_write.js
+++ b/jstests/replsets/not_master_unacknowledged_write.js
@@ -5,12 +5,12 @@
(function() {
"use strict";
-function getNotMasterUnackWritesCounter() {
+function getNotPrimaryUnackWritesCounter() {
return assert.commandWorked(primaryDB.adminCommand({serverStatus: 1}))
- .metrics.repl.network.notMasterUnacknowledgedWrites;
+ .metrics.repl.network.notPrimaryUnacknowledgedWrites;
}
-const collName = "not_master_unacknowledged_write";
+const collName = "not_primary_unacknowledged_write";
var rst = new ReplSetTest({nodes: [{}, {rsConfig: {priority: 0}}]});
rst.startSet();
@@ -22,8 +22,8 @@ var secondaryDB = secondary.getDB("test");
var primaryColl = primaryDB[collName];
var secondaryColl = secondaryDB[collName];
-// Verify that reading from secondaries does not impact `notMasterUnacknowledgedWrites`.
-const preReadingCounter = getNotMasterUnackWritesCounter();
+// Verify that reading from secondaries does not impact `notPrimaryUnacknowledgedWrites`.
+const preReadingCounter = getNotPrimaryUnackWritesCounter();
jsTestLog("Reading from secondary ...");
[{name: "findOne", fn: () => secondaryColl.findOne()},
{name: "distinct", fn: () => secondaryColl.distinct("item")},
@@ -32,7 +32,7 @@ jsTestLog("Reading from secondary ...");
assert.doesNotThrow(fn);
assert.eq(assert.commandWorked(secondary.getDB("admin").isMaster()).ismaster, false);
});
-const postReadingCounter = getNotMasterUnackWritesCounter();
+const postReadingCounter = getNotPrimaryUnackWritesCounter();
assert.eq(preReadingCounter, postReadingCounter);
jsTestLog("Primary on port " + primary.port + " hangs up on unacknowledged writes");
@@ -71,7 +71,7 @@ var command =
var awaitShell = startParallelShell(command, primary.port);
-let failedUnackWritesBefore = getNotMasterUnackWritesCounter();
+let failedUnackWritesBefore = getNotPrimaryUnackWritesCounter();
jsTestLog("Beginning unacknowledged insert");
primaryColl.insertOne({}, {writeConcern: {w: 0}});
@@ -87,7 +87,7 @@ assert.includes(result.toString(), "network error while attempting to run comman
// Validate the number of unacknowledged writes failed due to step down resulted in network
// disconnection.
-let failedUnackWritesAfter = getNotMasterUnackWritesCounter();
+let failedUnackWritesAfter = getNotPrimaryUnackWritesCounter();
assert.eq(failedUnackWritesAfter, failedUnackWritesBefore + 1);
rst.stopSet();
diff --git a/jstests/replsets/read_operations_during_step_down.js b/jstests/replsets/read_operations_during_step_down.js
index 96fa2651237..4909c7a9177 100644
--- a/jstests/replsets/read_operations_during_step_down.js
+++ b/jstests/replsets/read_operations_during_step_down.js
@@ -113,7 +113,7 @@ assert.eq(replMetrics.stateTransition.lastStateTransition, "stepDown");
assert.eq(replMetrics.stateTransition.userOperationsKilled, 0);
// Should account for find and getmore commands issued before step down.
assert.gte(replMetrics.stateTransition.userOperationsRunning, 2);
-assert.eq(replMetrics.network.notMasterUnacknowledgedWrites, 0);
+assert.eq(replMetrics.network.notPrimaryUnacknowledgedWrites, 0);
rst.stopSet();
})();
diff --git a/jstests/replsets/read_operations_during_step_up.js b/jstests/replsets/read_operations_during_step_up.js
index ef666bd4611..86ea4a3c0d6 100644
--- a/jstests/replsets/read_operations_during_step_up.js
+++ b/jstests/replsets/read_operations_during_step_up.js
@@ -36,10 +36,10 @@ assert.commandWorked(
        primaryColl.insert({_id: 0}, {"writeConcern": {"w": "majority"}}));
rst.awaitReplication();
-// It's possible for notMasterUnacknowledgedWrites to be non-zero because of mirrored reads during
+// It's possible for notPrimaryUnacknowledgedWrites to be non-zero because of mirrored reads during
// initial sync.
let replMetrics = assert.commandWorked(secondaryAdmin.adminCommand({serverStatus: 1})).metrics.repl;
-const startingNumNotMasterErrors = replMetrics.network.notMasterUnacknowledgedWrites;
+const startingNumNotMasterErrors = replMetrics.network.notPrimaryUnacknowledgedWrites;
// Open a cursor on secondary.
const cursorIdToBeReadAfterStepUp =
@@ -127,7 +127,7 @@ assert.eq(replMetrics.stateTransition.lastStateTransition, "stepUp");
assert.eq(replMetrics.stateTransition.userOperationsKilled, 0);
// Should account for find and getmore commands issued before step up.
assert.gte(replMetrics.stateTransition.userOperationsRunning, 2);
-assert.eq(replMetrics.network.notMasterUnacknowledgedWrites, startingNumNotMasterErrors);
+assert.eq(replMetrics.network.notPrimaryUnacknowledgedWrites, startingNumNotMasterErrors);
rst.stopSet();
})();
diff --git a/src/mongo/db/service_entry_point_common.cpp b/src/mongo/db/service_entry_point_common.cpp
index 3588e766364..f01218bba70 100644
--- a/src/mongo/db/service_entry_point_common.cpp
+++ b/src/mongo/db/service_entry_point_common.cpp
@@ -118,11 +118,11 @@ Counter64 notPrimaryLegacyUnackWrites;
ServerStatusMetricField<Counter64> displayNotPrimaryLegacyUnackWrites(
"repl.network.notPrimaryLegacyUnacknowledgedWrites", &notPrimaryLegacyUnackWrites);
-// Tracks the number of times an unacknowledged write failed due to not master error
+// Tracks the number of times an unacknowledged write failed due to not primary error
// resulted in network disconnection.
-Counter64 notMasterUnackWrites;
-ServerStatusMetricField<Counter64> displayNotMasterUnackWrites(
- "repl.network.notMasterUnacknowledgedWrites", &notMasterUnackWrites);
+Counter64 notPrimaryUnackWrites;
+ServerStatusMetricField<Counter64> displayNotPrimaryUnackWrites(
+ "repl.network.notPrimaryUnacknowledgedWrites", &notPrimaryUnackWrites);
namespace {
@@ -1479,7 +1479,7 @@ DbResponse receivedCommands(OperationContext* opCtx,
// Close the connection to get client to go through server selection again.
if (LastError::get(opCtx->getClient()).hadNotPrimaryError()) {
if (c && c->getReadWriteType() == Command::ReadWriteType::kWrite)
- notMasterUnackWrites.increment();
+ notPrimaryUnackWrites.increment();
uasserted(ErrorCodes::NotWritablePrimary,
str::stream()
<< "Not-master error while processing '" << request.getCommandName()