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

Method send

src/compute-client/src/controller/instance.rs:1103–1129  ·  view source on GitHub ↗
(&mut self, cmd: ComputeCommand)

Source from the content-addressed store, hash-verified

1101 /// Sends a command to replicas of this instance.
1102 #[mz_ore::instrument(level = "debug")]
1103 fn send(&mut self, cmd: ComputeCommand) {
1104 // Record the command so that new replicas can be brought up to speed.
1105 // We record the *base* (un-specialized) command, so that the per-replica
1106 // dyncfg overrides are re-applied at replay time in `add_replica` rather
1107 // than baked into the shared history.
1108 self.history.push(cmd.clone());
1109
1110 let target_replica = self.target_replica(&cmd);
1111
1112 // Borrow the overrides and dyncfg separately from `self.replicas` so the per-replica
1113 // specialization below does not conflict with the mutable replica borrow.
1114 let overrides = &self.replica_dyncfg_overrides;
1115 let dyncfg = &self.dyncfg;
1116
1117 if let Some(rid) = target_replica {
1118 if let Some(replica) = self.replicas.get_mut(&rid) {
1119 let cmd = Self::specialize_command_for_replica(cmd, rid, overrides, dyncfg);
1120 let _ = replica.client.send(cmd);
1121 }
1122 } else {
1123 for (rid, replica) in self.replicas.iter_mut() {
1124 let cmd =
1125 Self::specialize_command_for_replica(cmd.clone(), *rid, overrides, dyncfg);
1126 let _ = replica.client.send(cmd);
1127 }
1128 }
1129 }
1130
1131 /// Specializes a command for a specific replica by merging that replica's dyncfg override into
1132 /// its configuration. For `UpdateConfiguration` the override is merged into the update. For

Callers 15

deliver_responseMethod · 0.45
runMethod · 0.45
update_configurationMethod · 0.45
allow_writesMethod · 0.45
add_replicaMethod · 0.45
create_dataflowMethod · 0.45
peekMethod · 0.45
finish_peekMethod · 0.45

Calls 4

target_replicaMethod · 0.80
pushMethod · 0.45
cloneMethod · 0.45
get_mutMethod · 0.45

Tested by

no test coverage detected