summaryrefslogtreecommitdiff
path: root/src/mongo/db/transaction_history_iterator.cpp
diff options
context:
space:
mode:
authorRandolph Tan <randolph@10gen.com>2017-09-26 17:45:15 -0400
committerRandolph Tan <randolph@10gen.com>2017-10-04 16:43:58 -0400
commit0ab7000e04e16813c1e1e3f131f02de102ddffba (patch)
tree07c771aa1229bc85755f952dcc9a157a8d4e2dd2 /src/mongo/db/transaction_history_iterator.cpp
parentd6267ee66b997af73fcfb095f03f655bb61c06dc (diff)
downloadmongo-0ab7000e04e16813c1e1e3f131f02de102ddffba.tar.gz
SERVER-31030 Use full OpTime instead of just Timestamps to refer to oplog entries
Diffstat (limited to 'src/mongo/db/transaction_history_iterator.cpp')
-rw-r--r--src/mongo/db/transaction_history_iterator.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/mongo/db/transaction_history_iterator.cpp b/src/mongo/db/transaction_history_iterator.cpp
index 4d66c0eadde..3220597dd61 100644
--- a/src/mongo/db/transaction_history_iterator.cpp
+++ b/src/mongo/db/transaction_history_iterator.cpp
@@ -38,11 +38,11 @@
namespace mongo {
-TransactionHistoryIterator::TransactionHistoryIterator(Timestamp startingOpTimeTs)
- : _nextOpTimeTs(std::move(startingOpTimeTs)) {}
+TransactionHistoryIterator::TransactionHistoryIterator(repl::OpTime startingOpTime)
+ : _nextOpTime(std::move(startingOpTime)) {}
bool TransactionHistoryIterator::hasNext() const {
- return !_nextOpTimeTs.isNull();
+ return !_nextOpTime.isNull();
}
repl::OplogEntry TransactionHistoryIterator::next(OperationContext* opCtx) {
@@ -50,26 +50,24 @@ repl::OplogEntry TransactionHistoryIterator::next(OperationContext* opCtx) {
DBDirectClient client(opCtx);
// TODO: SERVER-29843 oplogReplay option might be needed to activate fast ts search.
- auto oplogBSON =
- client.findOne(NamespaceString::kRsOplogNamespace.ns(),
- BSON(repl::OplogEntryBase::kTimestampFieldName << _nextOpTimeTs));
+ auto oplogBSON = client.findOne(NamespaceString::kRsOplogNamespace.ns(), _nextOpTime.asQuery());
uassert(ErrorCodes::IncompleteTransactionHistory,
str::stream() << "oplog no longer contains the complete write history of this "
- "transaction, log with ts "
- << _nextOpTimeTs.toBSON()
+ "transaction, log with opTime "
+ << _nextOpTime.toBSON()
<< " cannot be found",
!oplogBSON.isEmpty());
auto oplogEntry = uassertStatusOK(repl::OplogEntry::parse(oplogBSON));
- const auto& oplogPrevTsOption = oplogEntry.getPrevWriteTsInTransaction();
+ const auto& oplogPrevTsOption = oplogEntry.getPrevWriteOpTimeInTransaction();
uassert(
ErrorCodes::FailedToParse,
str::stream() << "Missing prevTs field on oplog entry of previous write in transcation: "
<< redact(oplogBSON),
oplogPrevTsOption);
- _nextOpTimeTs = oplogPrevTsOption.value();
+ _nextOpTime = oplogPrevTsOption.value();
return oplogEntry;
}