[SERVER-44748] Do not suppress WriteConflictExceptions in debug builds when checking IndexCatalog::numIndexesTotal Created: 20/Nov/19  Updated: 29/Oct/23  Resolved: 07/Jan/20

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

Type: Bug Priority: Major - P3
Reporter: Louis Williams Assignee: Eric Milkie
Resolution: Fixed Votes: 0
Labels: groomed
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Execution Team 2020-01-13, Execution Team 2019-12-30
Participants:
Linked BF Score: 17

 Description   

In SERVER-42123, we started suppressing WriteConflicts in debug builds when calling numIndexesTotal(), which reads from the durable catalog.

Unfortunately it is not correct to ignore WriteConflicts. The storage engine may choose to abort a transaction at any time, often due to cache pressure. When the storage engine does abort an operation, it throws a WriteConflictException. If an operation ignores this error, it will continue to commit the operation instead. This will lead to the following error from WiredTiger:

WiredTiger error (22) [1573582080:566402][25006:0x7f3c19192700], WT_SESSION.commit_transaction: __session_commit_transaction, 1649: failed transaction requires rollback: oldest transaction ID rolled back for eviction

We should solve the original problem described in SERVER-42123 in a different way. This may involve reverting the original code.



 Comments   
Comment by Githook User [ 07/Jan/20 ]

Author:

{'name': 'Eric Milkie', 'email': 'milkie@mongodb.com', 'username': 'milkie'}

Message: SERVER-44748 do not ignore write conflict exceptions for write transactions

In debug mode, we check that the catalog is consistent when fetching the total number of indexes. This check might encounter a WT_ROLLBACK, so suppress such WCE's. We can only safely do this for read transactions, since such transactions cannot be subsequently committed, due to the rollback error.
Branch: master
https://github.com/mongodb/mongo/commit/7543397e4fd0ecc16572bea381174265e38d15c2

Comment by Githook User [ 27/Dec/19 ]

Author:

{'name': 'Eric Milkie', 'email': 'milkie@mongodb.com', 'username': 'milkie'}

Message: SERVER-44748 Revert 'SERVER-42123 Skip dassert check in IndexCatalogImpl::numIndexesTotal() if it throws a WriteConflictException in debug builds'

This reverts commit 458defe182cdd3fc6abedc53c6109b54d9192539.
Branch: master
https://github.com/mongodb/mongo/commit/901e85b067316fa7b967fe00bdef4cf501a1e4e9

Comment by Eric Milkie [ 27/Dec/19 ]

I am considering two options:
1. Look at the currently held lock and suppress the WCE for S-locks but not for X-locks. This is making an assumption that any transactions with S or IS locks will end with a call to rollback_transaction.
2. Handle WCE's in read transactions, at a higher level.

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