Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

837 multiple replicas fixes #838

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Bob versions changelog


#### Fixed
- Fix multiple local replicas bugs (#837)


#### Updated
Expand Down
2 changes: 1 addition & 1 deletion bob/src/cluster/operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub(crate) async fn finish_at_least_handles<TRes: AffectedReplicasProvider, TErr
break;
}
}
warn!("ok_count/at_least: {}/{}", ok_count, at_least);
trace!("ok_count/at_least: {}/{}", ok_count, at_least);
(oks, errors)
}

Expand Down
13 changes: 10 additions & 3 deletions bob/src/cluster/quorum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -131,8 +132,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::default(), vec![], vec![])
}
}


Expand Down