diff options
author | Jack Mulrow <jack.mulrow@mongodb.com> | 2017-07-17 16:54:00 -0400 |
---|---|---|
committer | Jack Mulrow <jack.mulrow@mongodb.com> | 2017-07-24 17:18:31 -0400 |
commit | 7a6151bd1f56c1fab96457f2e60206f106608508 (patch) | |
tree | 1d5dbac49617a839239c8572319df51a0efc6828 /src/mongo/db/session.cpp | |
parent | 65bd8a5cb7898cff64e78ed34c084481c070a889 (diff) | |
download | mongo-7a6151bd1f56c1fab96457f2e60206f106608508.tar.gz |
SERVER-28918 Make CRUD paths retryable
Diffstat (limited to 'src/mongo/db/session.cpp')
-rw-r--r-- | src/mongo/db/session.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mongo/db/session.cpp b/src/mongo/db/session.cpp index 844f80f81d1..0811996eb8f 100644 --- a/src/mongo/db/session.cpp +++ b/src/mongo/db/session.cpp @@ -179,4 +179,21 @@ TransactionHistoryIterator Session::getWriteHistory(OperationContext* opCtx) con return TransactionHistoryIterator(getLastWriteOpTimeTs()); } +boost::optional<repl::OplogEntry> Session::checkStatementExecuted(OperationContext* opCtx, + StmtId stmtId) { + if (!opCtx->getTxnNumber()) { + return boost::none; + } + + auto it = getWriteHistory(opCtx); + while (it.hasNext()) { + auto entry = it.next(opCtx); + if (entry.getStatementId() == stmtId) { + return entry; + } + } + + return boost::none; +} + } // namespace mongo |