From 254ee5c72fd655dc3364dac1f196cd7783ff3c0f Mon Sep 17 00:00:00 2001 From: Ivan Druzhitskiy Date: Thu, 25 Jan 2024 14:37:12 +0300 Subject: [PATCH 1/2] 861 remove allocation in most cases --- bob-backend/src/pearl/disk_controller.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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()) } From c7c2e49a20d13469f766b6ee4e7d1b4057aaa3c1 Mon Sep 17 00:00:00 2001 From: Ivan Druzhitskiy Date: Thu, 25 Jan 2024 14:37:34 +0300 Subject: [PATCH 2/2] 861 update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) 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)