add error case for layout not ready, and fail earlier in many places

This commit is contained in:
Alex Auvolat
2025-09-13 20:24:19 +02:00
parent 4758d8881f
commit 4c139bcbca
23 changed files with 323 additions and 244 deletions
+1 -1
View File
@@ -227,7 +227,7 @@ impl<'a> BucketHelper<'a> {
.0
.system
.cluster_layout()
.all_nongateway_nodes()
.all_nongateway_nodes()?
.to_vec();
let k2vindexes = self
.0
+4 -5
View File
@@ -84,17 +84,16 @@ impl<T: CountedItem> Entry<T::CP, T::CS> for CounterEntry<T> {
impl<T: CountedItem> CounterEntry<T> {
pub fn filtered_values(&self, layout: &LayoutHelper) -> HashMap<String, i64> {
let nodes = layout.all_nongateway_nodes();
self.filtered_values_with_nodes(&nodes)
self.filtered_values_internal(layout.all_nongateway_nodes().ok())
}
pub fn filtered_values_with_nodes(&self, nodes: &[Uuid]) -> HashMap<String, i64> {
fn filtered_values_internal(&self, nodes_opt: Option<&[Uuid]>) -> HashMap<String, i64> {
let mut ret = HashMap::new();
for (name, vals) in self.values.iter() {
let new_vals = vals
.node_values
.iter()
.filter(|(n, _)| nodes.contains(n))
.filter(|(n, _)| nodes_opt.map(|nodes| nodes.contains(n)).unwrap_or(true))
.map(|(_, (_, v))| *v)
.collect::<Vec<_>>();
if !new_vals.is_empty() {
@@ -153,7 +152,7 @@ impl<T: CountedItem> TableSchema for CounterTable<T> {
}
let is_tombstone = entry
.filtered_values_with_nodes(&filter.1[..])
.filtered_values_internal(Some(&filter.1[..]))
.iter()
.all(|(_, v)| *v == 0);
filter.0.apply(is_tombstone)
+6 -6
View File
@@ -126,7 +126,7 @@ impl K2VRpcHandler {
.item_table
.data
.replication
.storage_nodes(&partition.hash());
.storage_nodes(&partition.hash())?;
who.sort();
self.system
@@ -165,7 +165,7 @@ impl K2VRpcHandler {
.item_table
.data
.replication
.storage_nodes(&partition.hash());
.storage_nodes(&partition.hash())?;
who.sort();
call_list.entry(who).or_default().push(InsertedItem {
@@ -222,7 +222,7 @@ impl K2VRpcHandler {
.item_table
.data
.replication
.storage_nodes(&poll_key.partition.hash());
.storage_nodes(&poll_key.partition.hash())?;
let rpc = self.system.rpc_helper().try_call_many(
&self.endpoint,
@@ -233,7 +233,7 @@ impl K2VRpcHandler {
timeout_msec,
},
RequestStrategy::with_priority(PRIO_NORMAL)
.with_quorum(self.item_table.data.replication.read_quorum())
.with_quorum(self.item_table.data.replication.read_quorum()?)
.send_all_at_once(true)
.without_timeout(),
);
@@ -283,8 +283,8 @@ impl K2VRpcHandler {
.item_table
.data
.replication
.storage_nodes(&range.partition.hash());
let quorum = self.item_table.data.replication.read_quorum();
.storage_nodes(&range.partition.hash())?;
let quorum = self.item_table.data.replication.read_quorum()?;
let msg = K2VRpc::PollRange {
range,
seen_str,