diff options
author | Martin Bligh <mbligh@mongodb.com> | 2015-07-20 13:21:25 -0400 |
---|---|---|
committer | Martin Bligh <mbligh@mongodb.com> | 2015-07-20 13:21:25 -0400 |
commit | 750bc4a89e8f9a40cd641d03cbd8e05cec74933e (patch) | |
tree | ef51f00ed2abc7909d0c930d16814937742d556a | |
parent | 9baa685a5b73b3c608e25652ec67e287227f8477 (diff) | |
download | mongo-750bc4a89e8f9a40cd641d03cbd8e05cec74933e.tar.gz |
SERVER-17254: Throttle retry of failed drop attempts
-rw-r--r-- | src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp | 13 | ||||
-rw-r--r-- | src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h | 2 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp index 1dcedb91167..2d6f22789ab 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp @@ -48,6 +48,7 @@ #include "mongo/util/log.h" #include "mongo/util/processinfo.h" #include "mongo/util/scopeguard.h" +#include "mongo/util/time_support.h" #if !defined(__has_feature) #define __has_feature(x) 0 @@ -95,6 +96,8 @@ namespace mongo { } } + _previousCheckedDropsQueued = curTimeMillis64(); + std::stringstream ss; ss << "create,"; ss << "cache_size=" << cacheSizeGB << "G,"; @@ -350,10 +353,20 @@ namespace mongo { } bool WiredTigerKVEngine::haveDropsQueued() const { + int64_t now = curTimeMillis64(); + int64_t delta = now - _previousCheckedDropsQueued; + if ( _sizeStorerSyncTracker.intervalHasElapsed() ) { _sizeStorerSyncTracker.resetLastTime(); syncSizeInfo(false); } + + // We only want to check the queue max once per second or we'll thrash + // This is done in haveDropsQueued, not dropAllQueued so we skip the mutex + if (delta < 1000) + return false; + + _previousCheckedDropsQueued = now; boost::mutex::scoped_lock lk( _identToDropMutex ); return !_identToDrop.empty(); } diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h index 9e418dd64a5..cba8f284c85 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h @@ -153,6 +153,8 @@ namespace mongo { boost::scoped_ptr<WiredTigerSizeStorer> _sizeStorer; std::string _sizeStorerUri; mutable ElapsedTracker _sizeStorerSyncTracker; + + mutable int64_t _previousCheckedDropsQueued; }; } |