diff options
Diffstat (limited to 'src/mongo/db/transaction_participant.h')
-rw-r--r-- | src/mongo/db/transaction_participant.h | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/mongo/db/transaction_participant.h b/src/mongo/db/transaction_participant.h index a3673ef544d..6d05089b284 100644 --- a/src/mongo/db/transaction_participant.h +++ b/src/mongo/db/transaction_participant.h @@ -796,22 +796,29 @@ private: */ class OplogSlotReserver { public: - OplogSlotReserver(OperationContext* opCtx); + OplogSlotReserver(OperationContext* opCtx, int numSlotsToReserve = 1); ~OplogSlotReserver(); /** - * Returns the oplog slot reserved at construction. + * Returns the latest oplog slot reserved at construction. */ - OplogSlot getReservedOplogSlot() const { - invariant(!_oplogSlot.opTime.isNull()); - return _oplogSlot; + OplogSlot getLastSlot() { + invariant(!_oplogSlots.empty()); + invariant(!_oplogSlots.back().opTime.isNull()); + return getSlots().back(); + } + + std::vector<OplogSlot>& getSlots() { + invariant(!_oplogSlots.empty()); + invariant(!_oplogSlots.back().opTime.isNull()); + return _oplogSlots; } private: OperationContext* _opCtx; std::unique_ptr<Locker> _locker; std::unique_ptr<RecoveryUnit> _recoveryUnit; - OplogSlot _oplogSlot; + std::vector<OplogSlot> _oplogSlots; }; friend std::ostream& operator<<(std::ostream& s, TransactionState txnState) { |