summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeert Bosch <geert@mongodb.com>2019-01-18 14:26:01 -0500
committerGeert Bosch <geert@mongodb.com>2019-01-30 11:01:51 -0500
commitd6b229e0f926e5a36758b811e284daf3b116ea08 (patch)
tree0ab1affe4d446596a677c47f68f35956a3b6f806
parent02a532609f5e4b5c7cde64a4f0444cb5dc0dcb3e (diff)
downloadmongo-d6b229e0f926e5a36758b811e284daf3b116ea08.tar.gz
SERVER-39193 Invariant instead of throwing WCE if locked incorrectly for reading oplog
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
index befcd1952b6..fde4bdb01bb 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
@@ -2060,10 +2060,8 @@ std::unique_ptr<SeekableRecordCursor> StandardWiredTigerRecordStore::getCursor(
WiredTigerRecoveryUnit* wru = WiredTigerRecoveryUnit::get(opCtx);
// If we already have a snapshot we don't know what it can see, unless we know no one
// else could be writing (because we hold an exclusive lock).
- if (wru->inActiveTxn() && !opCtx->lockState()->isNoop() &&
- !opCtx->lockState()->isCollectionLockedForMode(_ns, MODE_X)) {
- throw WriteConflictException();
- }
+ invariant(!wru->inActiveTxn() ||
+ opCtx->lockState()->isCollectionLockedForMode(_ns, MODE_X));
wru->setIsOplogReader();
}
@@ -2113,10 +2111,8 @@ std::unique_ptr<SeekableRecordCursor> PrefixedWiredTigerRecordStore::getCursor(
WiredTigerRecoveryUnit* wru = WiredTigerRecoveryUnit::get(opCtx);
// If we already have a snapshot we don't know what it can see, unless we know no one
// else could be writing (because we hold an exclusive lock).
- if (wru->inActiveTxn() && !opCtx->lockState()->isNoop() &&
- !opCtx->lockState()->isCollectionLockedForMode(_ns, MODE_X)) {
- throw WriteConflictException();
- }
+ invariant(!wru->inActiveTxn() ||
+ opCtx->lockState()->isCollectionLockedForMode(_ns, MODE_X));
wru->setIsOplogReader();
}