From 11e80c65ca7ab1cff41a12cbfd23e3343af166f3 Mon Sep 17 00:00:00 2001 From: Ivan Druzhitskiy Date: Sat, 23 Sep 2023 14:28:58 +0300 Subject: [PATCH 1/5] fix log level --- bob/src/cluster/operations.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bob/src/cluster/operations.rs b/bob/src/cluster/operations.rs index 74ce28ff..f2789e6d 100644 --- a/bob/src/cluster/operations.rs +++ b/bob/src/cluster/operations.rs @@ -62,7 +62,7 @@ pub(crate) async fn finish_at_least_handles Date: Sat, 23 Sep 2023 14:41:14 +0300 Subject: [PATCH 2/5] remove put at least invocation for case with no remote nodes --- bob/src/cluster/quorum.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bob/src/cluster/quorum.rs b/bob/src/cluster/quorum.rs index 4667fc63..89dde284 100644 --- a/bob/src/cluster/quorum.rs +++ b/bob/src/cluster/quorum.rs @@ -131,8 +131,14 @@ impl Quorum { key, target_nodes.len(), ); - let target_nodes = target_nodes.iter().filter(|node| node.name() != local_node); - put_at_least(key, data, target_nodes, at_least, BobPutOptions::new_local(), affected_replicas_by_node).await + let remote_exists = target_nodes.iter().any(|n| n.name() != local_node); + if remote_exists { + let target_nodes = target_nodes.iter().filter(|node| node.name() != local_node); + put_at_least(key, data, target_nodes, at_least, + BobPutOptions::new_local(), affected_replicas_by_node).await + } else { + (FuturesUnordered::new(), vec![], vec![]) + } } From 4da0886c8032a38c079ec35895ebc0a2c9516616 Mon Sep 17 00:00:00 2001 From: Ivan Druzhitskiy Date: Sat, 23 Sep 2023 14:43:50 +0300 Subject: [PATCH 3/5] reduce at_least with local puts --- bob/src/cluster/quorum.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bob/src/cluster/quorum.rs b/bob/src/cluster/quorum.rs index 89dde284..bcd6f384 100644 --- a/bob/src/cluster/quorum.rs +++ b/bob/src/cluster/quorum.rs @@ -39,7 +39,8 @@ impl Quorum { let (tasks, oks, errors) = if let Some(paths) = disk_paths { let paths_len = paths.len(); - debug!("PUT[{}] ~~~PUT {} REPLICAS TO REMOTE NODES AND {} REPLICAS TO LOCAL NODE~~~", key, at_least - paths_len, paths_len); + let at_least = at_least - paths_len; + debug!("PUT[{}] ~~~PUT {} REPLICAS TO REMOTE NODES AND {} REPLICAS TO LOCAL NODE~~~", key, at_least, paths_len); let ((tasks, oks, errors), local_puts) = tokio::join!( self.put_remote_nodes(key, data, at_least, &affected_replicas_by_node), put_local_node_all(&self.backend, key, data, vdisk_id, paths)); From 09d823d5d35deb545450fb24491dbccd754b83cf Mon Sep 17 00:00:00 2001 From: Ivan Druzhitskiy Date: Sat, 23 Sep 2023 14:44:24 +0300 Subject: [PATCH 4/5] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 80aa0a0f..9edd2e34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ Bob versions changelog #### Fixed +- Fix multiple local replicas bugs (#837) #### Updated From 25cac6141c99a2ce62cf6898dcf28da6771d4856 Mon Sep 17 00:00:00 2001 From: Ivan Druzhitskiy Date: Sat, 23 Sep 2023 14:50:56 +0300 Subject: [PATCH 5/5] use default fu --- bob/src/cluster/quorum.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bob/src/cluster/quorum.rs b/bob/src/cluster/quorum.rs index bcd6f384..3a7e9f30 100644 --- a/bob/src/cluster/quorum.rs +++ b/bob/src/cluster/quorum.rs @@ -138,7 +138,7 @@ impl Quorum { put_at_least(key, data, target_nodes, at_least, BobPutOptions::new_local(), affected_replicas_by_node).await } else { - (FuturesUnordered::new(), vec![], vec![]) + (FuturesUnordered::default(), vec![], vec![]) } }