summaryrefslogtreecommitdiff
path: root/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp')
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
index 46dadad3467..593fd2d8bca 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
@@ -91,6 +91,7 @@ bool shouldUseOplogHack(OperationContext* opCtx, const std::string& uri) {
} // namespace
MONGO_FP_DECLARE(WTWriteConflictException);
+MONGO_FP_DECLARE(WTWriteConflictExceptionForReads);
MONGO_FP_DECLARE(WTPausePrimaryOplogDurabilityLoop);
const std::string kWiredTigerEngineName = "wiredTiger";
@@ -453,7 +454,7 @@ public:
// Nothing after the next line can throw WCEs.
// Note that an unpositioned (or eof) WT_CURSOR returns the first/last entry in the
// table when you call next/prev.
- int advanceRet = WT_OP_CHECK(_forward ? c->next(c) : c->prev(c));
+ int advanceRet = WT_READ_CHECK(_forward ? c->next(c) : c->prev(c));
if (advanceRet == WT_NOTFOUND) {
_eof = true;
return {};
@@ -492,7 +493,7 @@ public:
WT_CURSOR* c = _cursor->get();
c->set_key(c, _makeKey(id));
// Nothing after the next line can throw WCEs.
- int seekRet = WT_OP_CHECK(c->search(c));
+ int seekRet = WT_READ_CHECK(c->search(c));
if (seekRet == WT_NOTFOUND) {
_eof = true;
return {};
@@ -541,7 +542,7 @@ public:
c->set_key(c, _makeKey(_lastReturnedId));
int cmp;
- int ret = WT_OP_CHECK(c->search_near(c, &cmp));
+ int ret = WT_READ_CHECK(c->search_near(c, &cmp));
if (ret == WT_NOTFOUND) {
_eof = true;
return !_rs._isCapped;
@@ -645,7 +646,7 @@ public:
}
boost::optional<Record> next() final {
- int advanceRet = WT_OP_CHECK(_cursor->next(_cursor));
+ int advanceRet = WT_READ_CHECK(_cursor->next(_cursor));
if (advanceRet == WT_NOTFOUND)
return {};
invariantWTOK(advanceRet);
@@ -945,7 +946,7 @@ RecordData WiredTigerRecordStore::dataFor(OperationContext* opCtx, const RecordI
WT_CURSOR* c = curwrap.get();
invariant(c);
c->set_key(c, _makeKey(id));
- int ret = WT_OP_CHECK(c->search(c));
+ int ret = WT_READ_CHECK(c->search(c));
massert(28556, "Didn't find RecordId in WiredTigerRecordStore", ret != WT_NOTFOUND);
invariantWTOK(ret);
return _getData(curwrap);
@@ -958,7 +959,7 @@ bool WiredTigerRecordStore::findRecord(OperationContext* opCtx,
WT_CURSOR* c = curwrap.get();
invariant(c);
c->set_key(c, _makeKey(id));
- int ret = WT_OP_CHECK(c->search(c));
+ int ret = WT_READ_CHECK(c->search(c));
if (ret == WT_NOTFOUND) {
return false;
}
@@ -976,7 +977,7 @@ void WiredTigerRecordStore::deleteRecord(OperationContext* opCtx, const RecordId
cursor.assertInActiveTxn();
WT_CURSOR* c = cursor.get();
c->set_key(c, _makeKey(id));
- int ret = WT_OP_CHECK(c->search(c));
+ int ret = WT_READ_CHECK(c->search(c));
invariantWTOK(ret);
WT_ITEM old_value;
@@ -1083,7 +1084,7 @@ int64_t WiredTigerRecordStore::cappedDeleteAsNeeded_inlock(OperationContext* opC
if (_cappedFirstRecord != RecordId()) {
int64_t key = _makeKey(_cappedFirstRecord);
truncateEnd->set_key(truncateEnd, key);
- ret = WT_OP_CHECK(truncateEnd->search(truncateEnd));
+ ret = WT_READ_CHECK(truncateEnd->search(truncateEnd));
if (ret == 0) {
positioned = true;
savedFirstKey = key;
@@ -1092,7 +1093,7 @@ int64_t WiredTigerRecordStore::cappedDeleteAsNeeded_inlock(OperationContext* opC
// Advance the cursor truncateEnd until we find a suitable end point for our truncate
while ((sizeSaved < sizeOverCap || docsRemoved < docsOverCap) && (docsRemoved < 20000) &&
- (positioned || (ret = WT_OP_CHECK(truncateEnd->next(truncateEnd))) == 0)) {
+ (positioned || (ret = WT_READ_CHECK(truncateEnd->next(truncateEnd))) == 0)) {
positioned = false;
int64_t key;
invariantWTOK(truncateEnd->get_key(truncateEnd, &key));
@@ -1127,7 +1128,7 @@ int64_t WiredTigerRecordStore::cappedDeleteAsNeeded_inlock(OperationContext* opC
if (docsRemoved > 0) {
// if we scanned to the end of the collection or past our insert, go back one
if (ret == WT_NOTFOUND || newestIdToDelete >= justInserted) {
- ret = WT_OP_CHECK(truncateEnd->prev(truncateEnd));
+ ret = WT_READ_CHECK(truncateEnd->prev(truncateEnd));
}
invariantWTOK(ret);
@@ -1418,7 +1419,7 @@ Status WiredTigerRecordStore::updateRecord(OperationContext* opCtx,
WT_CURSOR* c = curwrap.get();
invariant(c);
c->set_key(c, _makeKey(id));
- int ret = WT_OP_CHECK(c->search(c));
+ int ret = WT_READ_CHECK(c->search(c));
invariantWTOK(ret);
WT_ITEM old_value;
@@ -1504,7 +1505,7 @@ std::vector<std::unique_ptr<RecordCursor>> WiredTigerRecordStore::getManyCursors
Status WiredTigerRecordStore::truncate(OperationContext* opCtx) {
WiredTigerCursor startWrap(_uri, _tableId, true, opCtx);
WT_CURSOR* start = startWrap.get();
- int ret = WT_OP_CHECK(start->next(start));
+ int ret = WT_READ_CHECK(start->next(start));
// Empty collections don't have anything to truncate.
if (ret == WT_NOTFOUND) {
return Status::OK();
@@ -1784,7 +1785,7 @@ boost::optional<RecordId> WiredTigerRecordStore::oplogStartHack(
int cmp;
c->set_key(c, _makeKey(startingPosition));
- int ret = WT_OP_CHECK(c->search_near(c, &cmp));
+ int ret = WT_READ_CHECK(c->search_near(c, &cmp));
if (ret == 0 && cmp > 0)
ret = c->prev(c); // landed one higher than startingPosition
if (ret == WT_NOTFOUND)