summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/oplog_buffer_collection.cpp
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2016-10-14 14:18:34 -0400
committerBenety Goh <benety@mongodb.com>2016-10-17 15:22:08 -0400
commitbb7179c0aa703ee2df76acabdd425bcf1371d780 (patch)
treebc611f6d2217ff52cd42de1cb8349808ccfb9fbd /src/mongo/db/repl/oplog_buffer_collection.cpp
parent43583fddef7ac89222f9cdfa14bb1452c740e8c7 (diff)
downloadmongo-bb7179c0aa703ee2df76acabdd425bcf1371d780.tar.gz
SERVER-26631 Implement multiple document support for StorageInterface::findDocuments/deleteDocuments
Diffstat (limited to 'src/mongo/db/repl/oplog_buffer_collection.cpp')
-rw-r--r--src/mongo/db/repl/oplog_buffer_collection.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/mongo/db/repl/oplog_buffer_collection.cpp b/src/mongo/db/repl/oplog_buffer_collection.cpp
index 6e1be76806b..619c7131169 100644
--- a/src/mongo/db/repl/oplog_buffer_collection.cpp
+++ b/src/mongo/db/repl/oplog_buffer_collection.cpp
@@ -232,6 +232,8 @@ bool OplogBufferCollection::_pop_inlock(OperationContext* txn, Value* value) {
bool OplogBufferCollection::_peekOneSide_inlock(OperationContext* txn,
Value* value,
bool front) const {
+ invariant(_count > 0);
+
// If there is a sentinel, and it was pushed right after the last BSONObj to be popped was
// pushed, then we return an empty BSONObj for the sentinel.
if (!_sentinels.empty() && (_lastPoppedTimestamp == _sentinels.front())) {
@@ -251,16 +253,11 @@ bool OplogBufferCollection::_peekOneSide_inlock(OperationContext* txn,
boundInclusion = BoundInclusion::kIncludeEndKeyOnly;
}
- auto result = _storageInterface->findDocuments(
- txn, _nss, kIdIdxName, scanDirection, startKey, boundInclusion, 1U);
- if (!result.isOK()) {
- if (result != ErrorCodes::CollectionIsEmpty) {
- fassert(40163, result.getStatus());
- }
- return false;
- }
- auto&& docs = result.getValue();
- invariant(!docs.empty());
+ const auto docs =
+ fassertStatusOK(40163,
+ _storageInterface->findDocuments(
+ txn, _nss, kIdIdxName, scanDirection, startKey, boundInclusion, 1U));
+ invariant(1U == docs.size());
*value = extractEmbeddedOplogDocument(docs.front()).getOwned();
return true;
}