[SERVER-38189] check if prepareStartTime is set before calculating getPreparedDuration Created: 16/Nov/18  Updated: 29/Oct/23  Resolved: 21/Nov/18

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: None
Fix Version/s: 4.1.6

Type: Bug Priority: Major - P3
Reporter: Jason Chan Assignee: Jason Chan
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Repl 2018-12-03
Participants:
Linked BF Score: 59

 Description   

When a transaction has been open for long enough, it will be considered a slow transaction and we will write a slow transaction log upon commit or an abort. For prepared transactions, we log the prepared duration in the slow transaction logs. If an exception is thrown in prepareTransaction in between setting the transaction state to "prepared" and TransactionMetricsObserver.onPrepare within a slow transaction, then system will crash with an invariant failure in getPreparedDuration since the prepareStartTime was never set to be larger than 0.



 Comments   
Comment by Githook User [ 21/Nov/18 ]

Author:

{'name': 'Jason Chan', 'email': 'jason.chan@mongodb.com'}

Message: SERVER-38189 check prepareStartTime before logging slow transaction info
Branch: master
https://github.com/mongodb/mongo/commit/88c46ca0364f3f6481320a6bcaff709b564ebaa3

Generated at Thu Feb 08 04:48:13 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.