summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Mir <ali.mir@mongodb.com>2020-09-09 11:01:26 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-09-10 14:12:01 +0000
commit759787fd5a1a28ed3293a869e9e1b1e11cb6337a (patch)
tree973cdea8f8572bfb7a4912f70516688de71144c6
parent9dac088a96526c9f2854d09d55125c8a76e9de71 (diff)
downloadmongo-759787fd5a1a28ed3293a869e9e1b1e11cb6337a.tar.gz
SERVER-50416 Change notMasterLegacyUnacknowledgedWrites to notPrimaryLegacyUnacknowledgedWrites in serverStatus
-rw-r--r--etc/backports_required_for_multiversion_tests.yml2
-rw-r--r--jstests/replsets/disconnect_on_legacy_write_to_secondary.js8
-rw-r--r--src/mongo/db/service_entry_point_common.cpp10
3 files changed, 11 insertions, 9 deletions
diff --git a/etc/backports_required_for_multiversion_tests.yml b/etc/backports_required_for_multiversion_tests.yml
index 322f0dad785..753692e534f 100644
--- a/etc/backports_required_for_multiversion_tests.yml
+++ b/etc/backports_required_for_multiversion_tests.yml
@@ -66,6 +66,8 @@ all:
test_file: jstests/replsets/secondaryOk_slaveOk_aliases.js
- ticket: SERVER-43902
test_file: jstests/sharding/scaled_collection_stats.js
+ - ticket: SERVER-50416
+ test_file: jstests/replsets/disconnect_on_legacy_write_to_secondary.js
# Tests that should only be excluded from particular suites should be listed under that suite.
suites:
diff --git a/jstests/replsets/disconnect_on_legacy_write_to_secondary.js b/jstests/replsets/disconnect_on_legacy_write_to_secondary.js
index edf5950a62b..9678fc1a98e 100644
--- a/jstests/replsets/disconnect_on_legacy_write_to_secondary.js
+++ b/jstests/replsets/disconnect_on_legacy_write_to_secondary.js
@@ -52,16 +52,16 @@ const primaryDb = primaryDataConn.getDB("test");
const primaryColl = primaryDb[collname];
primaryDataConn.forceWriteMode('legacy');
-function getNotMasterLegacyUnackWritesCounter() {
+function getNotPrimaryLegacyUnackWritesCounter() {
return assert.commandWorked(primaryAdmin.adminCommand({serverStatus: 1}))
- .metrics.repl.network.notMasterLegacyUnacknowledgedWrites;
+ .metrics.repl.network.notPrimaryLegacyUnacknowledgedWrites;
}
function runStepDownTest({description, failpoint, operation}) {
jsTestLog("Enabling failpoint to block " + description + "s");
let failPoint = configureFailPoint(primaryAdmin, failpoint);
- let failedLegacyUnackWritesBefore = getNotMasterLegacyUnackWritesCounter();
+ let failedLegacyUnackWritesBefore = getNotPrimaryLegacyUnackWritesCounter();
jsTestLog("Trying legacy " + description + " on stepping-down primary");
operation();
@@ -77,7 +77,7 @@ function runStepDownTest({description, failpoint, operation}) {
// Validate the number of legacy unacknowledged writes failed due to step down resulted
// in network disconnection.
- let failedLegacyUnackWritesAfter = getNotMasterLegacyUnackWritesCounter();
+ let failedLegacyUnackWritesAfter = getNotPrimaryLegacyUnackWritesCounter();
assert.eq(failedLegacyUnackWritesAfter, failedLegacyUnackWritesBefore + 1);
// Allow the primary to be re-elected, and wait for it.
diff --git a/src/mongo/db/service_entry_point_common.cpp b/src/mongo/db/service_entry_point_common.cpp
index 2b6d515148a..3588e766364 100644
--- a/src/mongo/db/service_entry_point_common.cpp
+++ b/src/mongo/db/service_entry_point_common.cpp
@@ -113,10 +113,10 @@ MONGO_FAIL_POINT_DEFINE(waitAfterCommandFinishesExecution);
MONGO_FAIL_POINT_DEFINE(failWithErrorCodeInRunCommand);
// Tracks the number of times a legacy unacknowledged write failed due to
-// not master error resulted in network disconnection.
-Counter64 notMasterLegacyUnackWrites;
-ServerStatusMetricField<Counter64> displayNotMasterLegacyUnackWrites(
- "repl.network.notMasterLegacyUnacknowledgedWrites", &notMasterLegacyUnackWrites);
+// not primary error resulted in network disconnection.
+Counter64 notPrimaryLegacyUnackWrites;
+ServerStatusMetricField<Counter64> displayNotPrimaryLegacyUnackWrites(
+ "repl.network.notPrimaryLegacyUnacknowledgedWrites", &notPrimaryLegacyUnackWrites);
// Tracks the number of times an unacknowledged write failed due to not master error
// resulted in network disconnection.
@@ -1839,7 +1839,7 @@ DbResponse FireAndForgetOpRunner::run() {
// Either way, we want to throw an exception here, which will cause the client to be
// disconnected.
if (LastError::get(hr->client()).hadNotPrimaryError()) {
- notMasterLegacyUnackWrites.increment();
+ notPrimaryLegacyUnackWrites.increment();
uasserted(ErrorCodes::NotWritablePrimary,
str::stream() << "Not-master error while processing '"
<< networkOpToString(hr->op()) << "' operation on '"