diff options
author | Cheahuychou Mao <cheahuychou.mao@mongodb.com> | 2020-02-18 14:57:28 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-02-19 18:01:40 +0000 |
commit | 59bd268916dec96d5ff5b4a283481f63776359bf (patch) | |
tree | ecfd807e9417e6ba418d0ae2d560810505417453 /src/mongo/client/read_preference_test.cpp | |
parent | ec4ed7fe732ed1db3c27c8d5840071678b7b1657 (diff) | |
download | mongo-59bd268916dec96d5ff5b4a283481f63776359bf.tar.gz |
SERVER-46234 Remove the code for computing hedging delay and add maxTimeMSForHedgedReads serverParameter
Diffstat (limited to 'src/mongo/client/read_preference_test.cpp')
-rw-r--r-- | src/mongo/client/read_preference_test.cpp | 38 |
1 files changed, 4 insertions, 34 deletions
diff --git a/src/mongo/client/read_preference_test.cpp b/src/mongo/client/read_preference_test.cpp index 5352cb203c2..3599478dbea 100644 --- a/src/mongo/client/read_preference_test.cpp +++ b/src/mongo/client/read_preference_test.cpp @@ -119,7 +119,6 @@ TEST(ReadPreferenceSetting, ParseHedgingMode) { ASSERT_TRUE(rps.pref == ReadPreference::Nearest); ASSERT_TRUE(rps.hedgingMode.has_value()); ASSERT_TRUE(rps.hedgingMode->getEnabled()); - ASSERT_TRUE(rps.hedgingMode->getDelay()); // Default hedging mode. rpsObj = BSON("mode" @@ -129,54 +128,32 @@ TEST(ReadPreferenceSetting, ParseHedgingMode) { ASSERT_TRUE(rps.pref == ReadPreference::PrimaryPreferred); ASSERT_TRUE(rps.hedgingMode.has_value()); ASSERT_TRUE(rps.hedgingMode->getEnabled()); - ASSERT_TRUE(rps.hedgingMode->getDelay()); - - rpsObj = BSON("mode" - << "secondary" - << "hedge" << BSON("enabled" << true)); - rps = parse(rpsObj); - ASSERT_TRUE(rps.pref == ReadPreference::SecondaryOnly); - ASSERT_TRUE(rps.hedgingMode.has_value()); - ASSERT_TRUE(rps.hedgingMode->getEnabled()); - ASSERT_TRUE(rps.hedgingMode->getDelay()); - - rpsObj = BSON("mode" - << "secondaryPreferred" - << "hedge" << BSON("delay" << false)); - rps = parse(rpsObj); - ASSERT_TRUE(rps.pref == ReadPreference::SecondaryPreferred); - ASSERT_TRUE(rps.hedgingMode.has_value()); - ASSERT_TRUE(rps.hedgingMode->getEnabled()); - ASSERT_FALSE(rps.hedgingMode->getDelay()); // Input hedging mode. rpsObj = BSON("mode" << "nearest" - << "hedge" << BSON("enabled" << true << "delay" << false)); + << "hedge" << BSON("enabled" << true)); rps = parse(rpsObj); ASSERT_TRUE(rps.pref == ReadPreference::Nearest); ASSERT_TRUE(rps.hedgingMode.has_value()); ASSERT_TRUE(rps.hedgingMode->getEnabled()); - ASSERT_FALSE(rps.hedgingMode->getDelay()); rpsObj = BSON("mode" << "nearest" - << "hedge" << BSON("enabled" << false << "delay" << false)); + << "hedge" << BSON("enabled" << false)); rps = parse(rpsObj); ASSERT_TRUE(rps.pref == ReadPreference::Nearest); ASSERT_TRUE(rps.hedgingMode.has_value()); ASSERT_FALSE(rps.hedgingMode->getEnabled()); - ASSERT_FALSE(rps.hedgingMode->getDelay()); rpsObj = BSON("mode" << "primary" - << "hedge" << BSON("enabled" << false << "delay" << false)); + << "hedge" << BSON("enabled" << false)); rps = parse(rpsObj); ASSERT_TRUE(rps.pref == ReadPreference::PrimaryOnly); ASSERT_TRUE(rps.hedgingMode.has_value()); ASSERT_FALSE(rps.hedgingMode->getEnabled()); - ASSERT_FALSE(rps.hedgingMode->getDelay()); } void checkParseFails(const BSONObj& rpsObj) { @@ -202,7 +179,7 @@ TEST(ReadPreferenceSetting, NonEquality) { << BSON("foo" << "bar"))); auto hedgingMode = HedgingMode(); - hedgingMode.setDelay(false); + hedgingMode.setEnabled(false); auto rps = ReadPreferenceSetting(ReadPreference::Nearest, tagSet, kMinMaxStaleness, hedgingMode); @@ -274,12 +251,6 @@ TEST(ReadPreferenceSetting, ParseInvalid) { << "hedge" << BSONObj()), ErrorCodes::InvalidOptions); - // Cannot enable staggering without enabling hedging. - checkParseFailsWithError(BSON("mode" - << "primaryPreferred" - << "hedge" << BSON("enabled" << false << "delay" << true)), - ErrorCodes::InvalidOptions); - checkParseContainerFailsWithError(BSON("$query" << BSON("pang" << "pong") << "$readPreference" << 2), @@ -316,7 +287,6 @@ TEST(ReadPreferenceSetting, Roundtrip) { kMinMaxStaleness)); auto hedgingMode = HedgingMode(); - hedgingMode.setDelay(false); checkRoundtrip(ReadPreferenceSetting(ReadPreference::Nearest, TagSet(BSON_ARRAY(BSON("dc" << "ca") |