diff --git a/CHANGELOG.md b/CHANGELOG.md index e0001e56..98b82659 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ Bob versions changelog - Save gRPC error when parsing status (#842) - Increased number and max delay of retries for Bob state checking in integration tests (#856) - Update writing logic for aliens integration tests to capture lost records problem (#851) +- Remove allocation on alien exist (#861) #### Fixed - Fix missing alien records due to multiple groups (#806) diff --git a/bob-backend/src/pearl/disk_controller.rs b/bob-backend/src/pearl/disk_controller.rs index 92cf861f..732285e4 100644 --- a/bob-backend/src/pearl/disk_controller.rs +++ b/bob-backend/src/pearl/disk_controller.rs @@ -519,18 +519,21 @@ impl DiskController { keys: &[BobKey], ) -> Result, Error> { if *self.state.read().await == GroupsState::Ready { - let mut result = vec![false; keys.len()]; + let mut result: Option> = None; for g in self.find_all_groups(&op).await { match g.exist(keys).await { Ok(r) => { - for i in 0..r.len() { - result[i] |= r[i]; - } + result = result.map(|mut result| { + for i in 0..r.len() { + result[i] |= r[i]; + } + result + }).or(Some(r)); }, Err(e) => debug!("error getting exist results for op {:?}: {:?}", op, e), } } - Ok(result) + Ok(result.unwrap_or_else(|| vec![false; keys.len()])) } else { Err(Error::dc_is_not_available()) }