diff options
author | Alex <alex@adnab.me> | 2024-03-05 21:56:17 +0000 |
---|---|---|
committer | Alex <alex@adnab.me> | 2024-03-05 21:56:17 +0000 |
commit | 603604cdfc76d9ae86c02f25d49b7c845d138262 (patch) | |
tree | 6cfad4bd68493aa2038b60f7f2005ec91bcc0509 /src/table/replication | |
parent | bbde9bc91225ac41ea6e8def61c5b7044bb186a0 (diff) | |
parent | 6760895926c23112583dfc53a01ecbcfad02a276 (diff) | |
download | garage-603604cdfc76d9ae86c02f25d49b7c845d138262.tar.gz garage-603604cdfc76d9ae86c02f25d49b7c845d138262.zip |
Merge pull request 'refactor: remove max_write_errors and max_faults' (#760) from yuka/garage:remove-max-write-errors into next-0.10
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/760
Diffstat (limited to 'src/table/replication')
-rw-r--r-- | src/table/replication/fullcopy.rs | 12 | ||||
-rw-r--r-- | src/table/replication/parameters.rs | 1 | ||||
-rw-r--r-- | src/table/replication/sharded.rs | 3 |
3 files changed, 5 insertions, 11 deletions
diff --git a/src/table/replication/fullcopy.rs b/src/table/replication/fullcopy.rs index 30122f39..1e52bb47 100644 --- a/src/table/replication/fullcopy.rs +++ b/src/table/replication/fullcopy.rs @@ -21,8 +21,6 @@ use crate::replication::*; pub struct TableFullReplication { /// The membership manager of this node pub system: Arc<System>, - /// Max number of faults allowed while replicating a record - pub max_faults: usize, } impl TableReplication for TableFullReplication { @@ -45,15 +43,15 @@ impl TableReplication for TableFullReplication { } fn write_quorum(&self) -> usize { let nmembers = self.system.cluster_layout().current().all_nodes().len(); - if nmembers > self.max_faults { - nmembers - self.max_faults + + let max_faults = if nmembers > 1 { 1 } else { 0 }; + + if nmembers > max_faults { + nmembers - max_faults } else { 1 } } - fn max_write_errors(&self) -> usize { - self.max_faults - } fn partition_of(&self, _hash: &Hash) -> Partition { 0u16 diff --git a/src/table/replication/parameters.rs b/src/table/replication/parameters.rs index 78470f35..682c1ea6 100644 --- a/src/table/replication/parameters.rs +++ b/src/table/replication/parameters.rs @@ -20,7 +20,6 @@ pub trait TableReplication: Send + Sync + 'static { fn write_sets(&self, hash: &Hash) -> Self::WriteSets; /// Responses needed to consider a write succesfull in each set fn write_quorum(&self) -> usize; - fn max_write_errors(&self) -> usize; // Accessing partitions, for Merkle tree & sync /// Get partition for data with given hash diff --git a/src/table/replication/sharded.rs b/src/table/replication/sharded.rs index 8ba3700f..e0245949 100644 --- a/src/table/replication/sharded.rs +++ b/src/table/replication/sharded.rs @@ -44,9 +44,6 @@ impl TableReplication for TableShardedReplication { fn write_quorum(&self) -> usize { self.write_quorum } - fn max_write_errors(&self) -> usize { - self.replication_factor - self.write_quorum - } fn partition_of(&self, hash: &Hash) -> Partition { self.system.cluster_layout().current().partition_of(hash) |