diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2017-12-28 16:46:30 -0500 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2018-01-16 17:35:24 -0500 |
commit | 7f4e454907f14a5a82195d15e6ee96cbcd6d4d5b (patch) | |
tree | fc2273384b46cde1722cccb62f892e4c09c5c564 | |
parent | 7d2f43adabb344f93ef8bec523efa3187bcf4ce6 (diff) | |
download | mongo-7f4e454907f14a5a82195d15e6ee96cbcd6d4d5b.tar.gz |
SERVER-32447 Add a mock CatalogCache::getCollectionRoutingInfoAt method
The added method always returns the routing information at the latest
timestamp.
-rw-r--r-- | src/mongo/s/catalog_cache.cpp | 6 | ||||
-rw-r--r-- | src/mongo/s/catalog_cache.h | 26 |
2 files changed, 27 insertions, 5 deletions
diff --git a/src/mongo/s/catalog_cache.cpp b/src/mongo/s/catalog_cache.cpp index 43f6880e30d..8deaeb3d617 100644 --- a/src/mongo/s/catalog_cache.cpp +++ b/src/mongo/s/catalog_cache.cpp @@ -126,6 +126,12 @@ StatusWith<CachedDatabaseInfo> CatalogCache::getDatabase(OperationContext* opCtx } } +StatusWith<CachedCollectionRoutingInfo> CatalogCache::getCollectionRoutingInfoAt( + OperationContext* opCtx, const NamespaceString& nss, Timestamp atClusterTime) { + // TODO (GPiTR): Implement retrieving collection routing info at time + return getCollectionRoutingInfo(opCtx, nss); +} + StatusWith<CachedCollectionRoutingInfo> CatalogCache::getCollectionRoutingInfo( OperationContext* opCtx, const NamespaceString& nss) { while (true) { diff --git a/src/mongo/s/catalog_cache.h b/src/mongo/s/catalog_cache.h index 82c8566be52..63d4056c30e 100644 --- a/src/mongo/s/catalog_cache.h +++ b/src/mongo/s/catalog_cache.h @@ -70,11 +70,27 @@ public: StatusWith<CachedDatabaseInfo> getDatabase(OperationContext* opCtx, StringData dbName); /** - * Blocking shortcut method to get a specific sharded collection from a given database using the - * complete namespace. If the collection is sharded returns a ScopedChunkManager initialized - * with ChunkManager. If the collection is not sharded, returns a ScopedChunkManager initialized - * with the primary shard for the specified database. If an error occurs loading the metadata - * returns a failed status. + * Blocking method to get the routing information for a specific collection at a given cluster + * time. + * + * If the collection is sharded, returns routing info initialized with a ChunkManager. If the + * collection is not sharded, returns routing info initialized with the primary shard for the + * specified database. If an error occurs while loading the metadata, returns a failed status. + * + * If the given atClusterTime is so far in the past that it is not possible to construct routing + * info, returns a StaleClusterTime error. + */ + StatusWith<CachedCollectionRoutingInfo> getCollectionRoutingInfoAt(OperationContext* opCtx, + const NamespaceString& nss, + Timestamp atClusterTime); + + /** + * Same as the getCollectionRoutingInfoAt call above, but returns the latest known routing + * information for the specified namespace. + * + * While this method may fail under the same circumstances as getCollectionRoutingInfoAt, it is + * guaranteed to never return StaleClusterTime, because the latest routing information should + * always be available. */ StatusWith<CachedCollectionRoutingInfo> getCollectionRoutingInfo(OperationContext* opCtx, const NamespaceString& nss); |