MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / drop_replica

Method drop_replica

src/storage-controller/src/instance.rs:198–234  ·  view source on GitHub ↗

Removes the identified replica from this storage instance.

(&mut self, id: ReplicaId)

Source from the content-addressed store, hash-verified

196
197 /// Removes the identified replica from this storage instance.
198 pub fn drop_replica(&mut self, id: ReplicaId) {
199 let replica = self.replicas.remove(&id);
200
201 let mut needs_rescheduling = false;
202 for (ingestion_id, ingestion) in self.active_ingestions.iter_mut() {
203 let was_running = ingestion.active_replicas.remove(&id);
204 if was_running {
205 tracing::debug!(
206 %ingestion_id,
207 replica_id = %id,
208 "ingestion was running on dropped replica, updating scheduling decisions"
209 );
210 needs_rescheduling = true;
211 }
212 }
213 for (export_id, export) in self.active_exports.iter_mut() {
214 let was_running = export.active_replicas.remove(&id);
215 if was_running {
216 tracing::debug!(
217 %export_id,
218 replica_id = %id,
219 "export was running on dropped replica, updating scheduling decisions"
220 );
221 needs_rescheduling = true;
222 }
223 }
224
225 tracing::info!(%id, %needs_rescheduling, "dropped replica");
226
227 if needs_rescheduling {
228 self.update_scheduling(true);
229 }
230
231 if replica.is_some() && self.replicas.is_empty() {
232 self.update_paused_statuses();
233 }
234 }
235
236 /// Rehydrates any failed replicas of this storage instance.
237 pub fn rehydrate_failed_replicas(&mut self) {

Callers

nothing calls this directly

Calls 5

update_schedulingMethod · 0.80
is_someMethod · 0.80
removeMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected