diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2017-09-11 11:13:08 -0400 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2017-09-14 07:46:46 -0400 |
commit | b0abd3f0b318e61837c2853a21b0ffde0bf8639f (patch) | |
tree | cc6ae8ca405766d44799c93667990bf7a8da25ed /src/mongo/util/fail_point.h | |
parent | b15fb2303c5c9ef72b64061c4b931bf7d39cdfab (diff) | |
download | mongo-b0abd3f0b318e61837c2853a21b0ffde0bf8639f.tar.gz |
SERVER-29606 Add a 'skip' failpoint option
This option allows the failpoint's effect to be skipped for up to a
certain amount of checks.
Diffstat (limited to 'src/mongo/util/fail_point.h')
-rw-r--r-- | src/mongo/util/fail_point.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/mongo/util/fail_point.h b/src/mongo/util/fail_point.h index 77bb9ab882a..a5fc58d21d5 100644 --- a/src/mongo/util/fail_point.h +++ b/src/mongo/util/fail_point.h @@ -69,7 +69,7 @@ class FailPoint { public: typedef AtomicUInt32::WordType ValType; - enum Mode { off, alwaysOn, random, nTimes }; + enum Mode { off, alwaysOn, random, nTimes, skip }; enum RetCode { fastOff = 0, slowOff, slowOn }; /** @@ -136,6 +136,9 @@ public: * activate. * - nTimes: the number of times this fail point will be active when * #shouldFail or #shouldFailOpenBlock is called. + * - skip: the number of times this failpoint will be inactive when + * #shouldFail or #shouldFailOpenBlock is called. After this number is reached, the + * failpoint will always be active. * * @param extra arbitrary BSON object that can be stored to this fail point * that can be referenced afterwards with #getData. Defaults to an empty @@ -155,11 +158,11 @@ private: // Bit layout: // 31: tells whether this fail point is active. // 0~30: unsigned ref counter for active dynamic instances. - AtomicUInt32 _fpInfo; + AtomicUInt32 _fpInfo{0}; // Invariant: These should be read only if ACTIVE_BIT of _fpInfo is set. - Mode _mode; - AtomicInt32 _timesOrPeriod; + Mode _mode{off}; + AtomicInt32 _timesOrPeriod{0}; BSONObj _data; // protects _mode, _timesOrPeriod, _data |