diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2019-03-11 17:04:54 -0400 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2019-03-12 16:23:23 -0400 |
commit | 6df770b3a6dc44170389050a4063ffb027357b46 (patch) | |
tree | c394928b4f7ff3dbace2e1367265993b02c26be7 /src/mongo/db/s | |
parent | a6123ee9c73bb00c9a3ef11878ccbd8b361014f3 (diff) | |
download | mongo-6df770b3a6dc44170389050a4063ffb027357b46.tar.gz |
SERVER-40010 Make only FCV 4.0 secondaries ask the primary to flush the database cache
Diffstat (limited to 'src/mongo/db/s')
-rw-r--r-- | src/mongo/db/s/shard_server_catalog_cache_loader.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mongo/db/s/shard_server_catalog_cache_loader.cpp b/src/mongo/db/s/shard_server_catalog_cache_loader.cpp index 52bba0249c9..880ae109ddf 100644 --- a/src/mongo/db/s/shard_server_catalog_cache_loader.cpp +++ b/src/mongo/db/s/shard_server_catalog_cache_loader.cpp @@ -41,6 +41,7 @@ #include "mongo/db/repl/replication_coordinator.h" #include "mongo/db/s/shard_metadata_util.h" #include "mongo/db/s/sharding_state.h" +#include "mongo/db/server_options.h" #include "mongo/s/catalog/type_shard_collection.h" #include "mongo/s/catalog/type_shard_database.h" #include "mongo/s/client/shard_registry.h" @@ -440,6 +441,16 @@ std::shared_ptr<Notification<void>> ShardServerCatalogCacheLoader::getChunksSinc void ShardServerCatalogCacheLoader::getDatabase( StringData dbName, stdx::function<void(OperationContext*, StatusWith<DatabaseType>)> callbackFn) { + // If the FCV version has not been fully upgraded to 4.0, fetch the database entries directly + // from the config server, regardless of whether the shard is running as a primary or secondary. + // This matches the behaviour of v3.6 and ensures that v4.0 secondaries do not ask a potentially + // v3.6 primary to flush its database cache (which is not supported) + if (serverGlobalParams.featureCompatibility.getVersion() < + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo40) { + _configServerLoader->getDatabase(dbName, callbackFn); + return; + } + long long currentTerm; bool isPrimary; |