code: private CompletableFuture<Long> executeConditionallyOnce(Function<Duration, CompletableFuture<Long>> indexOperation, TimeoutTimer timer) {
          return Futures.exceptionallyCompose(
                  indexOperation.apply(timer.getRemaining()),
                  ex -> {
                      if (Exceptions.unwrap(ex) instanceof BadOffsetException) {
                          BadOffsetException boe = (BadOffsetException) Exceptions.unwrap(ex);
                          if (boe.getExpectedOffset() != this.index.getIndexLength()) {
                              log.warn("{}: Conditional Index Update failed (expected {}, given {}). Reinitializing index.",
                                      this.traceObjectId, boe.getExpectedOffset(), boe.getGivenOffset());
                              return this.index.initialize(timer.getRemaining())
                                               .thenCompose(v -> Futures.failedFuture(ex));
                          }
                      }
  
                      // Make sure the exception bubbles up.
                      return Futures.failedFuture(ex);
                  });
      }
docs: Executes the given Index Operation once, without performing retries. In case of failure with BadOffsetException
  (which indicates a conditional update failure), the BTreeIndex is reinitialized to the most up-to-date state.
  
  @param indexOperation A Function, that, when invoked, returns a CompletableFuture which indicates when the index
  operation completes.
  @param timer          Timer for the operation.
  @return A CompletableFuture that will indicate when the operation completes.