| 126 | |
| 127 | |
| 128 | void LogProcess::finalize() |
| 129 | { |
| 130 | if (recovering.isSome()) { |
| 131 | // Stop the recovery if it is still pending. |
| 132 | Future<Owned<Replica>> future = recovering.get(); |
| 133 | future.discard(); |
| 134 | } |
| 135 | |
| 136 | // If there exist operations that are gated by the recovery, we fail |
| 137 | // all of them because the log is being deleted. |
| 138 | foreach (process::Promise<Shared<Replica>>* promise, promises) { |
| 139 | promise->fail("Log is being deleted"); |
| 140 | delete promise; |
| 141 | } |
| 142 | promises.clear(); |
| 143 | |
| 144 | delete group; |
| 145 | |
| 146 | // Wait for the shared pointers 'network' and 'replica' to become |
| 147 | // unique (i.e., no other reference to them). These calls should not |
| 148 | // be blocking for too long because at this moment, all operations |
| 149 | // should have been cancelled or are being cancelled. We do this |
| 150 | // because we want to make sure that after the log is deleted, all |
| 151 | // operations associated with this log are terminated. |
| 152 | network.own().await(); |
| 153 | replica.own().await(); |
| 154 | } |
| 155 | |
| 156 | |
| 157 | Future<Shared<Replica>> LogProcess::recover() |