mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-08-18 17:26:16 +00:00
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:
+4
-1
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user