diff options
author | Marcos José Grillo Ramírez <marcos.grillo@mongodb.com> | 2020-09-05 15:01:13 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-09-09 22:27:23 +0000 |
commit | 377b8fe43916ff2c4e2ed35cb80548aeb8ba8c8d (patch) | |
tree | e2036dd117f4b5f2255faedc1ef02853d879ae2c /src/mongo/db/pipeline | |
parent | f9d4a15397585a8f00ea0afa9864531e1f4ed5fb (diff) | |
download | mongo-377b8fe43916ff2c4e2ed35cb80548aeb8ba8c8d.tar.gz |
SERVER-46199 Make the collection CatalogCache support causal consistency
This change implements the collection CatalogCache on top of the
ReadThroughCache, giving it the ability to support causal consistency.
As part of this change, the 'forceRefreshFromThisThread' flag has been
removed from the shard's refresh methods.
Co-authored-by: Tommaso Tocci <tommaso.tocci@mongodb.com>
Co-authored-by: Pierlauro Sciarelli <pierlauro.sciarelli@mongodb.com>
Co-authored-by: Kaloian Manassiev <kaloian.manassiev@mongodb.com>
Diffstat (limited to 'src/mongo/db/pipeline')
-rw-r--r-- | src/mongo/db/pipeline/process_interface/common_process_interface.cpp | 14 | ||||
-rw-r--r-- | src/mongo/db/pipeline/sharded_agg_helpers.h | 8 |
2 files changed, 7 insertions, 15 deletions
diff --git a/src/mongo/db/pipeline/process_interface/common_process_interface.cpp b/src/mongo/db/pipeline/process_interface/common_process_interface.cpp index 330ef41693e..b6b304c348b 100644 --- a/src/mongo/db/pipeline/process_interface/common_process_interface.cpp +++ b/src/mongo/db/pipeline/process_interface/common_process_interface.cpp @@ -184,15 +184,11 @@ bool CommonProcessInterface::keyPatternNamesExactPaths(const BSONObj& keyPattern boost::optional<ChunkVersion> CommonProcessInterface::refreshAndGetCollectionVersion( const boost::intrusive_ptr<ExpressionContext>& expCtx, const NamespaceString& nss) const { - const bool forceRefreshFromThisThread = false; - auto cm = uassertStatusOK( - Grid::get(expCtx->opCtx) - ->catalogCache() - ->getCollectionRoutingInfoWithRefresh(expCtx->opCtx, nss, forceRefreshFromThisThread)); - if (cm.isSharded()) { - return cm.getVersion(); - } - return boost::none; + const auto cm = uassertStatusOK(Grid::get(expCtx->opCtx) + ->catalogCache() + ->getCollectionRoutingInfoWithRefresh(expCtx->opCtx, nss)); + + return cm.isSharded() ? boost::make_optional(cm.getVersion()) : boost::none; } std::vector<FieldPath> CommonProcessInterface::_shardKeyToDocumentKeyFields( diff --git a/src/mongo/db/pipeline/sharded_agg_helpers.h b/src/mongo/db/pipeline/sharded_agg_helpers.h index 13a20fee607..c63ac997a32 100644 --- a/src/mongo/db/pipeline/sharded_agg_helpers.h +++ b/src/mongo/db/pipeline/sharded_agg_helpers.h @@ -245,13 +245,9 @@ auto shardVersionRetry(OperationContext* opCtx, str::stream() << "StaleConfig error on unexpected namespace. Expected " << nss << ", received " << staleInfo->getNss()); catalogCache->invalidateShardOrEntireCollectionEntryForShardedCollection( - opCtx, - nss, - staleInfo->getVersionWanted(), - staleInfo->getVersionReceived(), - staleInfo->getShardId()); + nss, staleInfo->getVersionWanted(), staleInfo->getShardId()); } else { - catalogCache->onEpochChange(nss); + catalogCache->invalidateCollectionEntry_LINEARIZABLE(nss); } if (!logAndTestMaxRetries(e)) { throw; |