| 596 | } |
| 597 | |
| 598 | void finished(const Future<bool>& future) |
| 599 | { |
| 600 | if (future.isDiscarded()) { |
| 601 | promise.discard(); |
| 602 | terminate(self()); |
| 603 | } else if (future.isFailed()) { |
| 604 | promise.fail(future.failure()); |
| 605 | terminate(self()); |
| 606 | } else if (!future.get()) { |
| 607 | // We add a random delay before each retry because we do not |
| 608 | // want to saturate the network/disk IO in some cases. The delay |
| 609 | // is chosen randomly to reduce the likelyhood of conflicts |
| 610 | // (i.e., a replica receives a recover request while it is |
| 611 | // changing its status). |
| 612 | static const Duration T = Milliseconds(500); |
| 613 | Duration d = T * (1.0 + (double) os::random() / RAND_MAX); |
| 614 | VLOG(2) << "Retrying recovery in " << stringify(d); |
| 615 | delay(d, self(), &Self::start); |
| 616 | } else { |
| 617 | promise.set(replica); |
| 618 | terminate(self()); |
| 619 | } |
| 620 | } |
| 621 | |
| 622 | const size_t quorum; |
| 623 | Owned<Replica> replica; |
nothing calls this directly
no test coverage detected