summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Gottlieb <daniel.gottlieb@mongodb.com>2020-05-19 12:13:47 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-05-19 20:42:41 +0000
commitec8ef5998028c6ea5e9e01c9780765d7c76b4f1e (patch)
tree8f17ccb28945dca1b750c237f6ecce1295dc5274
parent601c7011ae1be252bc9bfd0031022c6ccae846b3 (diff)
downloadmongo-ec8ef5998028c6ea5e9e01c9780765d7c76b4f1e.tar.gz
SERVER-48294: Have internal oplog readers be resilient to EBUSY on cursor open.
-rw-r--r--jstests/hooks/validate_collections.js3
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp9
2 files changed, 9 insertions, 3 deletions
diff --git a/jstests/hooks/validate_collections.js b/jstests/hooks/validate_collections.js
index cf7f1be9707..96c40a26497 100644
--- a/jstests/hooks/validate_collections.js
+++ b/jstests/hooks/validate_collections.js
@@ -41,7 +41,8 @@ function CollectionValidator() {
// Optionally skip collections.
if (Array.isArray(jsTest.options().skipValidationNamespaces) &&
jsTest.options().skipValidationNamespaces.length > 0) {
- let skippedCollections = [];
+ // SERVER-48294: Always skip validating the oplog in foreground validation.
+ let skippedCollections = ['local.oplog.rs'];
for (let ns of jsTest.options().skipValidationNamespaces) {
// Attempt to strip the name of the database we are about to validate off of the
// namespace we wish to skip. If the replace() function does find a match with the
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
index 5d024fd3f9d..5b307679f90 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
@@ -1532,7 +1532,9 @@ StatusWith<Timestamp> WiredTigerRecordStore::getLatestOplogTimestamp(
WiredTigerSessionCache* cache = WiredTigerRecoveryUnit::get(opCtx)->getSessionCache();
auto sessRaii = cache->getSession();
- WT_CURSOR* cursor = sessRaii->getCachedCursor(_uri, _tableId, nullptr);
+ WT_CURSOR* cursor = writeConflictRetry(opCtx, "getLatestOplogTimestamp", "local.oplog.rs", [&] {
+ return sessRaii->getCachedCursor(_uri, _tableId, nullptr);
+ });
ON_BLOCK_EXIT([&] { sessRaii->releaseCursor(_tableId, cursor); });
int ret = cursor->prev(cursor);
if (ret == WT_NOTFOUND) {
@@ -1554,7 +1556,10 @@ StatusWith<Timestamp> WiredTigerRecordStore::getEarliestOplogTimestamp(Operation
if (_cappedFirstRecord == RecordId()) {
WiredTigerSessionCache* cache = WiredTigerRecoveryUnit::get(opCtx)->getSessionCache();
auto sessRaii = cache->getSession();
- WT_CURSOR* cursor = sessRaii->getCachedCursor(_uri, _tableId, nullptr);
+ WT_CURSOR* cursor =
+ writeConflictRetry(opCtx, "getEarliestOplogTimestamp", "local.oplog.rs", [&] {
+ return sessRaii->getCachedCursor(_uri, _tableId, nullptr);
+ });
ON_BLOCK_EXIT([&] { sessRaii->releaseCursor(_tableId, cursor); });
auto ret = cursor->next(cursor);
if (ret == WT_NOTFOUND) {