summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jstests/disk/wt_missing_file_errors.js6
-rw-r--r--src/mongo/db/catalog/collection_impl.cpp2
-rw-r--r--src/mongo/db/concurrency/write_conflict_exception.cpp4
-rw-r--r--src/mongo/db/repl/oplog.cpp4
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp6
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp11
6 files changed, 15 insertions, 18 deletions
diff --git a/jstests/disk/wt_missing_file_errors.js b/jstests/disk/wt_missing_file_errors.js
index 626974bbc30..3a9c783aad6 100644
--- a/jstests/disk/wt_missing_file_errors.js
+++ b/jstests/disk/wt_missing_file_errors.js
@@ -23,7 +23,7 @@
MongoRunner.stopMongod(mongod);
jsTestLog("deleting collection file: " + testCollFile);
removeFile(testCollFile);
- }, "Fatal Assertion 50883");
+ }, "Fatal Assertion 50882");
/**
* Test 2. Delete the _mdb_catalog.
@@ -35,7 +35,7 @@
let mdbCatalogFile = dbpath + "_mdb_catalog.wt";
jsTestLog("deleting catalog file: " + mdbCatalogFile);
removeFile(mdbCatalogFile);
- }, "Fatal Assertion 50883");
+ }, "Fatal Assertion 50882");
/**
* Test 3. Delete the WiredTiger.wt.
@@ -73,6 +73,6 @@
testColl.insert({a: 1});
});
},
- "Fatal Assertion 50883");
+ "Fatal Assertion 50882");
})();
diff --git a/src/mongo/db/catalog/collection_impl.cpp b/src/mongo/db/catalog/collection_impl.cpp
index c7b6427d777..e03e01599b9 100644
--- a/src/mongo/db/catalog/collection_impl.cpp
+++ b/src/mongo/db/catalog/collection_impl.cpp
@@ -323,7 +323,7 @@ Status CollectionImpl::insertDocumentsForOplog(OperationContext* opCtx,
const DocWriter* const* docs,
Timestamp* timestamps,
size_t nDocs) {
- dassert(opCtx->lockState()->isCollectionLockedForMode(ns().toString(), MODE_IX));
+ dassert(opCtx->lockState()->isWriteLocked());
// Since this is only for the OpLog, we can assume these for simplicity.
// This also means that we do not need to forward this object to the OpObserver, which is good
diff --git a/src/mongo/db/concurrency/write_conflict_exception.cpp b/src/mongo/db/concurrency/write_conflict_exception.cpp
index 202f17cf392..9ec06e31cec 100644
--- a/src/mongo/db/concurrency/write_conflict_exception.cpp
+++ b/src/mongo/db/concurrency/write_conflict_exception.cpp
@@ -59,8 +59,10 @@ void WriteConflictException::logAndBackoff(int attempt, StringData operation, St
sleepmillis(1);
} else if (attempt < 100) {
sleepmillis(5);
- } else {
+ } else if (attempt < 200) {
sleepmillis(10);
+ } else {
+ sleepmillis(100);
}
}
diff --git a/src/mongo/db/repl/oplog.cpp b/src/mongo/db/repl/oplog.cpp
index 2ad84d776e9..d3f48954cd1 100644
--- a/src/mongo/db/repl/oplog.cpp
+++ b/src/mongo/db/repl/oplog.cpp
@@ -440,8 +440,6 @@ OpTime logOp(OperationContext* opCtx,
return {};
}
- Lock::DBLock lk(opCtx, NamespaceString::kLocalDb, MODE_IX);
- Lock::CollectionLock lock(opCtx->lockState(), _oplogCollectionName, MODE_IX);
auto const oplog = _localOplogCollection;
OplogSlot slot;
@@ -495,8 +493,6 @@ std::vector<OpTime> logInsertOps(OperationContext* opCtx,
std::vector<OplogDocWriter> writers;
writers.reserve(count);
Collection* oplog = _localOplogCollection;
- Lock::DBLock lk(opCtx, "local", MODE_IX);
- Lock::CollectionLock lock(opCtx->lockState(), _oplogCollectionName, MODE_IX);
WriteUnitOfWork wuow(opCtx);
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp
index 930cdba82c3..ae5962ac3b5 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp
@@ -533,12 +533,6 @@ WiredTigerCursor::WiredTigerCursor(const std::string& uri,
_ru = WiredTigerRecoveryUnit::get(opCtx);
_session = _ru->getSession();
_cursor = _session->getCursor(uri, tableId, forRecordStore);
- if (!_cursor) {
- // It could be an index file or a data file here.
- error() << "Failed to get the cursor for uri: " << uri;
- error() << "This may be due to missing data files. " << kWTRepairMsg;
- fassertFailedNoTrace(50883);
- }
}
WiredTigerCursor::~WiredTigerCursor() {
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp
index f617759d5dc..aaf59bdc5c3 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp
@@ -37,6 +37,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"
@@ -124,14 +125,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 data corruption. " << kWTRepairMsg;
fassertFailedNoTrace(50882);
}
- if (c)
- _cursorsOut++;
+ _cursorsOut++;
return c;
}