Close hostile recovery and concurrency gaps
This commit is contained in:
parent
696dae610a
commit
3f9b1b3543
1 changed files with 306 additions and 113 deletions
|
|
@ -212,17 +212,18 @@ pub fn run<B: ClientBackend>(
|
|||
let endpoint = match backend.observe().map_err(ClientError::Backend)? {
|
||||
DomainStatus::Ready(endpoint) => endpoint,
|
||||
DomainStatus::Starting => backend.wait_until_ready()?,
|
||||
DomainStatus::Stale => return Err(ClientError::StaleCoordinator),
|
||||
DomainStatus::Absent => match backend.acquire_bootstrap().map_err(ClientError::Backend)? {
|
||||
BootstrapAcquisition::Leader => match backend.bootstrap() {
|
||||
Ok(endpoint) => endpoint,
|
||||
Err(ClientError::BootstrapOwnerDisconnected) => {
|
||||
return Err(ClientError::BootstrapOwnerDisconnected);
|
||||
}
|
||||
Err(error) => return Err(error),
|
||||
},
|
||||
BootstrapAcquisition::Waiter => backend.wait_until_ready()?,
|
||||
},
|
||||
DomainStatus::Stale | DomainStatus::Absent => {
|
||||
match backend.acquire_bootstrap().map_err(ClientError::Backend)? {
|
||||
BootstrapAcquisition::Leader => match backend.bootstrap() {
|
||||
Ok(endpoint) => endpoint,
|
||||
Err(ClientError::BootstrapOwnerDisconnected) => {
|
||||
return Err(ClientError::BootstrapOwnerDisconnected);
|
||||
}
|
||||
Err(error) => return Err(error),
|
||||
},
|
||||
BootstrapAcquisition::Waiter => backend.wait_until_ready()?,
|
||||
}
|
||||
}
|
||||
};
|
||||
backend.execute(endpoint, &command.argv, stdout, stderr)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue