diff options
author | Mathias Stearn <mathias@10gen.com> | 2015-02-13 17:04:25 -0500 |
---|---|---|
committer | Ramon Fernandez <ramon.fernandez@mongodb.com> | 2015-02-17 12:23:04 -0500 |
commit | 5189c2d2e386c28b56ce8ae6ba630d98abee25bb (patch) | |
tree | 7bb4bf3458c710337ff5bae61deed856c3c972e1 | |
parent | 5363aaf371338880c1f9518a6cc86817cc92d3b9 (diff) | |
download | mongo-5189c2d2e386c28b56ce8ae6ba630d98abee25bb.tar.gz |
SERVER-17141 Don't abort if ENOENT is returned from session->truncate()
(cherry picked from commit d47529bb1ad51e65f5262ace4efcaff96062e028)
-rw-r--r-- | src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp index 8d853163711..61c908b387b 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp @@ -508,10 +508,18 @@ namespace { ret = WT_OP_CHECK(start->next(start)); invariantWTOK(ret); - invariantWTOK(session->truncate(session, NULL, start, c, NULL)); - _changeNumRecords(txn, -docsRemoved); - _increaseDataSize(txn, -sizeSaved); - wuow.commit(); + ret = session->truncate(session, NULL, start, c, NULL); + if (ret == ENOENT) { + // TODO we should remove this case once SERVER-17141 is resolved + log() << "Got ENOENT truncating capped collection. Will try again later."; + docsRemoved = 0; + } + else { + invariantWTOK(ret); + _changeNumRecords(txn, -docsRemoved); + _increaseDataSize(txn, -sizeSaved); + wuow.commit(); + } } } catch ( const WriteConflictException& wce ) { |