diff options
author | Cheahuychou Mao <cheahuychou.mao@mongodb.com> | 2019-12-03 15:51:38 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-12-03 15:51:38 +0000 |
commit | 966d9b880ad80b6d126f5bb4ad777312562cd93e (patch) | |
tree | 1b233ffe756892108717fe6543895c571d9b598f /src/mongo/util/fail_point.h | |
parent | a0831c75a97b935f30c2987a67a3ee6c92fab49c (diff) | |
download | mongo-966d9b880ad80b6d126f5bb4ad777312562cd93e.tar.gz |
SERVER-44775 Make pauseWhileSet increment _timesEntered once
Diffstat (limited to 'src/mongo/util/fail_point.h')
-rw-r--r-- | src/mongo/util/fail_point.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/mongo/util/fail_point.h b/src/mongo/util/fail_point.h index dd8bd8c9916..d0a0c4ea5d8 100644 --- a/src/mongo/util/fail_point.h +++ b/src/mongo/util/fail_point.h @@ -318,10 +318,12 @@ public: /** * Take 100msec pauses for as long as the FailPoint is active. - * This uses `shouldFail()` and therefore affects FailPoint counters. + * This calls `shouldFail()` with kFirstTimeEntered once and with kEnteredAlready thereafter, so + * affects FailPoint counters once. */ void pauseWhileSet() { - while (MONGO_unlikely(shouldFail(kEnteredAlready))) { + for (auto entryMode = kFirstTimeEntered; MONGO_unlikely(shouldFail(entryMode)); + entryMode = kEnteredAlready) { sleepmillis(100); } } @@ -332,7 +334,8 @@ public: * OperationContext). */ void pauseWhileSet(OperationContext* opCtx) { - while (MONGO_unlikely(shouldFail(kEnteredAlready))) { + for (auto entryMode = kFirstTimeEntered; MONGO_unlikely(shouldFail(entryMode)); + entryMode = kEnteredAlready) { opCtx->sleepFor(Milliseconds(100)); } } |