• Type: New Feature
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Server Programmability
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Problem

      The Failpoint API does not provide a non-blocking way to access the underlying _hitCount, so users must do extra work to poll a failpoint while doing another operation simultaneously.

      For example, the following code must use two threads to check a failpoint was entered while calling requestFlush():

       

      Atomic<bool> stop{false};
      FailPointEnableBlock fp("failDuringFlush");
      stdx::thread driver([&] {
          while (!stop.load()) {
              requestFlush();
          }
      });
      fp->waitForTimesEntered(fp.initialTimesEntered() + 1);
      stop.store(true);
      driver.join();
      

       

      Request

      Ideally, this code is much simpler:

       

      FailPointEnableBlock fp("failDuringFlush");
      while (fp->timesEntered() < fp.initialTimesEntered() + 1) {
              requestFlush();
      }

       

      My proposal is to add a Failpoint::timesEntered() member function that just returns _hitCount, but I am open to other solutions that address the underlying problem.

      There does exist a waitForTimesEntered(Interruptible* interruptible, EntryCountT targetTimesEntered) that can be interrupted, but this requires additional boilerplate in the form of an OperationContext deadline + a try-catch block.

       

            Assignee:
            Unassigned
            Reporter:
            Cedric Sirianni
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: