diff options
author | David Storch <david.storch@10gen.com> | 2016-09-14 18:02:10 -0400 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2016-09-20 17:40:43 -0400 |
commit | 2ac0e07e7f82406e989fa272c68d1205ced81d78 (patch) | |
tree | eece2e1323d243c48e10304181a8678884035acd /src/mongo/rpc/object_check.h | |
parent | 585edf79040ed44db42e174b8659ca7290fa48cf (diff) | |
download | mongo-2ac0e07e7f82406e989fa272c68d1205ced81d78.tar.gz |
SERVER-25969 make slaves and secondaries always use BSON 1.1 validation
This allows secondaries and slaves to sync NumberDecimal even while
in featureCompatibilityVersion:"3.2" mode.
Diffstat (limited to 'src/mongo/rpc/object_check.h')
-rw-r--r-- | src/mongo/rpc/object_check.h | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/mongo/rpc/object_check.h b/src/mongo/rpc/object_check.h index c4f999fde20..7c7741ada62 100644 --- a/src/mongo/rpc/object_check.h +++ b/src/mongo/rpc/object_check.h @@ -45,10 +45,19 @@ class Status; template <> struct Validator<BSONObj> { inline static BSONVersion enabledBSONVersion() { - return serverGlobalParams.featureCompatibilityVersion.load() == - ServerGlobalParams::FeatureCompatibilityVersion_34 - ? BSONVersion::kV1_1 - : BSONVersion::kV1_0; + // If we're in the primary/master role accepting writes, but our feature compatibility + // version is 3.2, then we want to reject insertion of the decimal data type. Therefore, we + // perform BSON 1.0 validation. + if (serverGlobalParams.featureCompatibility.validateFeaturesAsMaster.load() && + serverGlobalParams.featureCompatibility.version.load() == + ServerGlobalParams::FeatureCompatibility::Version::k32) { + return BSONVersion::kV1_0; + } + + // Except for the special case above, we want to accept any BSON version which we know + // about. For instance, if we are a slave/secondary syncing from a primary/master and we are + // in 3.2 feature compatibility mode, we still want to be able to sync NumberDecimal data. + return BSONVersion::kV1_1; } inline static Status validateLoad(const char* ptr, size_t length) { |