[SERVER-64613] Periodically wake up when waiting for prepare conflicts Created: 17/Mar/22  Updated: 06/Dec/22  Resolved: 22/Mar/22

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

Type: Bug Priority: Major - P3
Reporter: Louis Williams Assignee: Backlog - Storage Execution Team
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to WT-8975 Eviction is triggered with prepared t... Closed
is related to SERVER-65106 Don't perform eviction after prepared... Closed
Assigned Teams:
Storage Execution
Operating System: ALL
Participants:
Linked BF Score: 10

 Description   

When MongoDB encounters a prepare conflict in WiredTiger, we wait until an active MongoDB WriteUnitOfWork commits or aborts.

There is a deadlock caused by this approach that can be described as follows:

  • A prepared transaction has updated a document.
  • A concurrent operation tries to read that document, but it hits a prepare conflict. It waits until the prepared transactions commits or aborts (via a notification). While it waits, its cursor remains positioned, preventing the page from being evicted.
  • The prepared transaction aborts or commits, but after the transition rolls-back, it is recruited for bonus eviction. It cannot evict anything because the page is pinned by the reader. So even though the transaction has been successfully rolled back in the storage engine, cannot make progress to signal the reader to continue. The reader is waiting for a notification, which would unpin the page.

This is only a bug in a system with one prepared transaction, since any transactions committing or aborting would wake the reader.

To break this cycle, we could add a periodic wakeup when waiting for prepared transactions to commit or abort. Something like 100ms. This would allow the reader to make progress and unpin the problematic page.



 Comments   
Comment by Louis Williams [ 23/Mar/22 ]

etienne.petrel if WT-8975 doesn't work for some reason, we can reopen this ticket. I expect we'll want to take a different solution than the one proposed, however. We will want to have MongoDB use "operation_timeout_ms" so that WiredTiger does not perform eviction when rolling back prepared transactions.

Comment by Etienne Petrel [ 22/Mar/22 ]

louis.williams, we will need to be careful as after trying a quick implementation of WT-8975, it did not fix the issue seen in BF-24461. The quick implementation might have been wrong

Comment by Louis Williams [ 22/Mar/22 ]

We are closing this in favor of WT-8975, which would make it so that prepared transactions never perform eviction when they roll back or commit.

Generated at Thu Feb 08 06:00:44 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.