[SERVER-57034] Provide better context in multi-timestamp invariant Created: 18/May/21  Updated: 09/Sep/21  Resolved: 09/Sep/21

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

Type: Improvement Priority: Major - P3
Reporter: Daniel Gottlieb (Inactive) Assignee: Dan Larkin-York
Resolution: Done Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Sprint: Execution Team 2021-08-23, Execution Team 2021-09-06, Execution Team 2021-09-20
Participants:

 Description   

When a developer observes the multi-timestamp constraint invariant fire, the first step is (unfortunately) add a bunch of logging to better understand the code path of how we entered into this dangerous state.

If we could automagically give some better context (in testing) that might help us save a step. I file this ticket with a (self-proclaimed) clever proposal:

  1. In production builds – fire the invariant/fassert as-is today. On debug builds (or with a hidden setParameter) flip a bit on the WTRecoveryUnit.
  2. Then throw a WriteConflictException
  3. Instrument calls to WTRecordStore::insert/update/delete + WTIndex + setTimestamp (probably using our existing wt cursor helpers) to add debugging information to some member state when observing the "context bit" being flipped on.
  4. When committing the transaction again, we either:
    • Hit the fassert again – see that the "add context" bit was already flipped to true – print out the debugging information then crash.
    • Don't hit the fassert again – see that the "add context" bit was flipped – crash because we should have the first time.

I also imagine we'd have to make sure to only try this when retrying WCE's internally. I'm not positive how multi-statement transactions behave, but presumably this idea wouldn't be applicable. Multi-statement transactions also have less worrying surface area in my experience as they (by design) only have a commit single timestamp associated with them.



 Comments   
Comment by Githook User [ 09/Sep/21 ]

Author:

{'name': 'Dan Larkin-York', 'email': 'dan.larkin-york@mongodb.com', 'username': 'dhly-etc'}

Message: SERVER-57034 Provide better context in multi-timestamp invariant
Branch: master
https://github.com/mongodb/mongo/commit/e1517972ad00351a79030fce12a62d9cee5f8cce

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