From 6760895926c23112583dfc53a01ecbcfad02a276 Mon Sep 17 00:00:00 2001 From: Yureka Date: Mon, 4 Mar 2024 18:37:00 +0100 Subject: refactor: remove max_write_errors and max_faults --- src/table/replication/fullcopy.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/table/replication/fullcopy.rs') 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, - /// 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 -- cgit v1.2.3