aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/model/garage.rs1
-rw-r--r--src/rpc/replication_mode.rs7
-rw-r--r--src/table/replication/fullcopy.rs12
-rw-r--r--src/table/replication/parameters.rs1
-rw-r--r--src/table/replication/sharded.rs3
5 files changed, 5 insertions, 19 deletions
diff --git a/src/model/garage.rs b/src/model/garage.rs
index fe38a760..561aca8f 100644
--- a/src/model/garage.rs
+++ b/src/model/garage.rs
@@ -247,7 +247,6 @@ impl Garage {
let control_rep_param = TableFullReplication {
system: system.clone(),
- max_faults: replication_mode.control_write_max_faults(),
};
info!("Initialize block manager...");
diff --git a/src/rpc/replication_mode.rs b/src/rpc/replication_mode.rs
index 2f7e2fec..b142ea10 100644
--- a/src/rpc/replication_mode.rs
+++ b/src/rpc/replication_mode.rs
@@ -21,13 +21,6 @@ impl ReplicationMode {
}
}
- pub fn control_write_max_faults(&self) -> usize {
- match self {
- Self::None => 0,
- _ => 1,
- }
- }
-
pub fn replication_factor(&self) -> usize {
match self {
Self::None => 1,
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)