diff options
Diffstat (limited to 'src/mongo/db')
-rw-r--r-- | src/mongo/db/catalog/collection_impl.cpp | 6 | ||||
-rw-r--r-- | src/mongo/db/catalog/collection_impl.h | 8 | ||||
-rw-r--r-- | src/mongo/db/catalog/index_catalog_entry_impl.cpp | 6 | ||||
-rw-r--r-- | src/mongo/db/catalog/index_catalog_entry_impl.h | 8 |
4 files changed, 22 insertions, 6 deletions
diff --git a/src/mongo/db/catalog/collection_impl.cpp b/src/mongo/db/catalog/collection_impl.cpp index c33b0748b9c..6a84b0716a5 100644 --- a/src/mongo/db/catalog/collection_impl.cpp +++ b/src/mongo/db/catalog/collection_impl.cpp @@ -550,6 +550,12 @@ Status CollectionImpl::_insertDocuments(OperationContext* opCtx, return status; } +void CollectionImpl::setMinimumVisibleSnapshot(Timestamp newMinimumVisibleSnapshot) { + if (!_minVisibleSnapshot || (newMinimumVisibleSnapshot > _minVisibleSnapshot.get())) { + _minVisibleSnapshot = newMinimumVisibleSnapshot; + } +} + bool CollectionImpl::haveCappedWaiters() { // Waiters keep a shared_ptr to '_cappedNotifier', so there are waiters if this CollectionImpl's // shared_ptr is not unique (use_count > 1). diff --git a/src/mongo/db/catalog/collection_impl.h b/src/mongo/db/catalog/collection_impl.h index 92d226ce81a..aedcfcc0c64 100644 --- a/src/mongo/db/catalog/collection_impl.h +++ b/src/mongo/db/catalog/collection_impl.h @@ -356,9 +356,11 @@ public: return _minVisibleSnapshot; } - void setMinimumVisibleSnapshot(Timestamp name) final { - _minVisibleSnapshot = name; - } + /** + * Updates the minimum visible snapshot. The 'newMinimumVisibleSnapshot' is ignored if it would + * set the minimum visible snapshot backwards in time. + */ + void setMinimumVisibleSnapshot(Timestamp newMinimumVisibleSnapshot) final; bool haveCappedWaiters() final; diff --git a/src/mongo/db/catalog/index_catalog_entry_impl.cpp b/src/mongo/db/catalog/index_catalog_entry_impl.cpp index cbb0fb6356d..e8cfc4fb970 100644 --- a/src/mongo/db/catalog/index_catalog_entry_impl.cpp +++ b/src/mongo/db/catalog/index_catalog_entry_impl.cpp @@ -228,6 +228,12 @@ MultikeyPaths IndexCatalogEntryImpl::getMultikeyPaths(OperationContext* opCtx) c // --- +void IndexCatalogEntryImpl::setMinimumVisibleSnapshot(Timestamp newMinimumVisibleSnapshot) { + if (!_minVisibleSnapshot || (newMinimumVisibleSnapshot > _minVisibleSnapshot.get())) { + _minVisibleSnapshot = newMinimumVisibleSnapshot; + } +} + void IndexCatalogEntryImpl::setIsReady(bool newIsReady) { _isReady = newIsReady; } diff --git a/src/mongo/db/catalog/index_catalog_entry_impl.h b/src/mongo/db/catalog/index_catalog_entry_impl.h index dfda831ac62..b95ca5b7eb6 100644 --- a/src/mongo/db/catalog/index_catalog_entry_impl.h +++ b/src/mongo/db/catalog/index_catalog_entry_impl.h @@ -163,9 +163,11 @@ public: return _minVisibleSnapshot; } - void setMinimumVisibleSnapshot(Timestamp name) final { - _minVisibleSnapshot = name; - } + /** + * Updates the minimum visible snapshot. The 'newMinimumVisibleSnapshot' is ignored if it would + * set the minimum visible snapshot backwards in time. + */ + void setMinimumVisibleSnapshot(Timestamp newMinimumVisibleSnapshot) final; private: class SetMultikeyChange; |