Enumerate the unique node IDs that hold any vShard right now. In single-node mode (no routing table) returns `[self.node_id]`, which may be 0 — that's fine; the section's origin_node_id is only carried for traceability/debugging, not for routing.
(state: &SharedState)
| 159 | /// which may be 0 — that's fine; the section's origin_node_id is |
| 160 | /// only carried for traceability/debugging, not for routing. |
| 161 | fn unique_origin_nodes(state: &SharedState) -> Vec<u64> { |
| 162 | let Some(routing) = state.cluster_routing.as_ref() else { |
| 163 | return vec![state.node_id]; |
| 164 | }; |
| 165 | let table = routing.read().expect("routing table poisoned"); |
| 166 | let mut set = BTreeSet::new(); |
| 167 | for info in table.group_members().values() { |
| 168 | if info.leader != 0 { |
| 169 | set.insert(info.leader); |
| 170 | } |
| 171 | for &m in &info.members { |
| 172 | set.insert(m); |
| 173 | } |
| 174 | } |
| 175 | if set.is_empty() { |
| 176 | vec![state.node_id] |
| 177 | } else { |
| 178 | set.into_iter().collect() |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | fn is_self(state: &SharedState, node_id: u64) -> bool { |
| 183 | node_id == state.node_id || node_id == 0 || state.cluster_transport.is_none() |
no test coverage detected