New version of the algorithm that calculate the layout.

It takes as paramters the replication factor and the zone redundancy, computes the
largest partition size reachable with these constraints, and among the possible
assignation with this partition size, it computes the one that moves the least number
of partitions compared to the previous assignation.
This computation uses graph algorithms defined in graph_algo.rs
This commit is contained in:
Mendes
2022-09-21 14:39:59 +02:00
parent c4adbeed51
commit 7f3249a237
9 changed files with 918 additions and 690 deletions
+4 -1
View File
@@ -97,6 +97,7 @@ pub struct System {
kubernetes_discovery: Option<KubernetesDiscoveryParam>,
replication_factor: usize,
zone_redundancy: usize,
/// The ring
pub ring: watch::Receiver<Arc<Ring>>,
@@ -192,6 +193,7 @@ impl System {
network_key: NetworkKey,
background: Arc<BackgroundRunner>,
replication_factor: usize,
zone_redundancy: usize,
config: &Config,
) -> Arc<Self> {
let node_key =
@@ -211,7 +213,7 @@ impl System {
"No valid previous cluster layout stored ({}), starting fresh.",
e
);
ClusterLayout::new(replication_factor)
ClusterLayout::new(replication_factor, zone_redundancy)
}
};
@@ -285,6 +287,7 @@ impl System {
rpc: RpcHelper::new(netapp.id.into(), fullmesh, background.clone(), ring.clone()),
system_endpoint,
replication_factor,
zone_redundancy,
rpc_listen_addr: config.rpc_bind_addr,
rpc_public_addr,
bootstrap_peers: config.bootstrap_peers.clone(),