diff options
author | Eric Milkie <milkie@10gen.com> | 2018-08-23 17:50:46 -0400 |
---|---|---|
committer | Eric Milkie <milkie@10gen.com> | 2018-08-24 11:38:27 -0400 |
commit | 5c1a3ec728a71bca81629f99be782ac305a6ad4b (patch) | |
tree | 5e0af4cb4cd2ffbfa8ef80f21210cc56ecf191b3 /src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp | |
parent | f7c2600036ce876bb389f3eb3adc8eada6932d8b (diff) | |
download | mongo-5c1a3ec728a71bca81629f99be782ac305a6ad4b.tar.gz |
SERVER-36534 don't acquire locks on oplog when writing oplog entries
Diffstat (limited to 'src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp')
-rw-r--r-- | src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp index 32511e88408..8021fafd771 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp @@ -36,6 +36,7 @@ #include "mongo/db/storage/wiredtiger/wiredtiger_session_cache.h" #include "mongo/base/error_codes.h" +#include "mongo/db/concurrency/write_conflict_exception.h" #include "mongo/db/global_settings.h" #include "mongo/db/repl/repl_settings.h" #include "mongo/db/server_parameters.h" @@ -123,14 +124,18 @@ WT_CURSOR* WiredTigerSession::getCursor(const std::string& uri, uint64_t id, boo WT_CURSOR* c = NULL; int ret = _session->open_cursor( _session, uri.c_str(), NULL, forRecordStore ? "" : "overwrite=false", &c); - if (ret != ENOENT && ret != 0) { + if (ret == EBUSY) { + // This can only happen when trying to open a cursor on the oplog and it is currently locked + // by a verify or salvage, because we don't employ database locks to protect the oplog. + throw WriteConflictException(); + } + if (ret != 0) { error() << "Failed to open a WiredTiger cursor: " << uri; error() << "This may be due to metadata corruption. " << kWTRepairMsg; fassertFailedNoTrace(50882); } - if (c) - _cursorsOut++; + _cursorsOut++; return c; } |