[SERVER-34960] Add a way to enter a failpoint without decrementing 'times' or 'skip' Created: 11/May/18  Updated: 08/Jan/24  Resolved: 16/May/18

Status: Closed
Project: Core Server
Component/s: Testing Infrastructure
Affects Version/s: None
Fix Version/s: 4.0.0-rc0

Type: Task Priority: Major - P3
Reporter: Spencer Brody (Inactive) Assignee: Mira Carey
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-35004 Add functionality to only fail specif... Closed
Related
related to SERVER-34943 failCommand failpoint should ignore c... Closed
Backwards Compatibility: Fully Compatible
Sprint: Platforms 2018-05-21
Participants:

 Description   

The 'failCommand' failpoint needs to perform a check outside of the body of the failpoint to decide whether or not the failpoint should be active.  It needs to happen outside the body of the failpoint so that if the check decides that the failpoint should not activate, it doesn't decrement the 'skip' or 'times' configuration for the failpoint.  This means that there is work being done associated with the failpoint, even if production builds where the entire failpoint system has been disabled, which goes against the philosophy that failpoints should have 0 impact when they are disabled.  It would be better if we could move that check into the failpoint body, but when we decide to do nothing reset the 'times' and 'skip' counters.


I ended up solving this by adding an observer parameter to shouldFail, shouldFailOpenBlock and a new macro called MONGO_FAIL_POINT_BLOCK_IF.  All of them take a callable which is invoked only if the fail point is enabled.  They also receive the fail point payload, and can control whether times and skip are manipulated



 Comments   
Comment by Githook User [ 16/May/18 ]

Author:

{'email': 'jcarey@argv.me', 'username': 'hanumantmk', 'name': 'Jason Carey'}

Message: SERVER-34960 Add MONGO_FAIL_POINT_BLOCK_IF

It's sometimes useful to be able to check a pre-condition on a fail
point without manipulating the fail point state (decrementing nTimes for
instance).

Adding a callable to shouldFailOpenBlock and shouldFail, and threading
that through a new block macro MONGO_FAIL_POINT_BLOCK_IF, allows for
observation of the fail point payload and a chance to abort without
extra overhead if the fail point is disabled.
Branch: master
https://github.com/mongodb/mongo/commit/066b3749d946e435c7b8d95f0b7cd0d71903c0bc

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