summaryrefslogtreecommitdiff
path: root/src/mongo/db/ttl_collection_cache.cpp
diff options
context:
space:
mode:
authorGregory Wlodarek <gregory.wlodarek@mongodb.com>2020-03-13 17:15:58 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-03-13 21:30:48 +0000
commitdf0272716ae3a6767e33adf98392dddea494e587 (patch)
tree6f15569421a97277b180f902319a549326f86ff9 /src/mongo/db/ttl_collection_cache.cpp
parent7ce09a820efeceb4f0a3a70140748aaf88309452 (diff)
downloadmongo-df0272716ae3a6767e33adf98392dddea494e587.tar.gz
SERVER-46640 The TTLMonitor should not remove the cached index information from the TTLCollectionCache when a collection is not yet visible
Diffstat (limited to 'src/mongo/db/ttl_collection_cache.cpp')
-rw-r--r--src/mongo/db/ttl_collection_cache.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/mongo/db/ttl_collection_cache.cpp b/src/mongo/db/ttl_collection_cache.cpp
index d4d9ffe7694..e959c5096c3 100644
--- a/src/mongo/db/ttl_collection_cache.cpp
+++ b/src/mongo/db/ttl_collection_cache.cpp
@@ -27,6 +27,8 @@
* it in the license file.
*/
+#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kStorage
+
#include "mongo/platform/basic.h"
#include "mongo/db/ttl_collection_cache.h"
@@ -34,9 +36,13 @@
#include <algorithm>
#include "mongo/db/service_context.h"
+#include "mongo/logv2/log.h"
+#include "mongo/util/fail_point.h"
namespace mongo {
+MONGO_FAIL_POINT_DEFINE(hangTTLCollectionCacheAfterRegisteringInfo);
+
namespace {
const auto getTTLCollectionCache = ServiceContext::declareDecoration<TTLCollectionCache>();
}
@@ -46,8 +52,15 @@ TTLCollectionCache& TTLCollectionCache::get(ServiceContext* ctx) {
}
void TTLCollectionCache::registerTTLInfo(std::pair<UUID, std::string>&& ttlInfo) {
- stdx::lock_guard<Latch> lock(_ttlInfosLock);
- _ttlInfos.push_back(std::move(ttlInfo));
+ {
+ stdx::lock_guard<Latch> lock(_ttlInfosLock);
+ _ttlInfos.push_back(std::move(ttlInfo));
+ }
+
+ if (MONGO_unlikely(hangTTLCollectionCacheAfterRegisteringInfo.shouldFail())) {
+ LOGV2(4664000, "Hanging due to hangTTLCollectionCacheAfterRegisteringInfo fail point");
+ hangTTLCollectionCacheAfterRegisteringInfo.pauseWhileSet();
+ }
}
void TTLCollectionCache::deregisterTTLInfo(const std::pair<UUID, std::string>& ttlInfo) {