Attempt to start Phase 3: Atomic Cut-over. Returns `Err` if the estimated pause would exceed the budget.
(&mut self, estimated_pause_us: u64)
| 159 | /// |
| 160 | /// Returns `Err` if the estimated pause would exceed the budget. |
| 161 | pub fn start_cutover(&mut self, estimated_pause_us: u64) -> crate::Result<()> { |
| 162 | if estimated_pause_us > self.write_pause_budget_us { |
| 163 | warn!( |
| 164 | vshard = self.vshard_id, |
| 165 | estimated_us = estimated_pause_us, |
| 166 | budget_us = self.write_pause_budget_us, |
| 167 | "refusing cut-over: pause exceeds budget" |
| 168 | ); |
| 169 | return Err(crate::ClusterError::MigrationPauseBudgetExceeded { |
| 170 | estimated_us: estimated_pause_us, |
| 171 | budget_us: self.write_pause_budget_us, |
| 172 | }); |
| 173 | } |
| 174 | |
| 175 | self.phase = MigrationPhase::AtomicCutOver { |
| 176 | pause_start_us: estimated_pause_us, |
| 177 | }; |
| 178 | info!( |
| 179 | vshard = self.vshard_id, |
| 180 | estimated_pause_us, "starting atomic cut-over" |
| 181 | ); |
| 182 | Ok(()) |
| 183 | } |
| 184 | |
| 185 | /// Complete the migration. |
| 186 | pub fn complete(&mut self, actual_pause_us: u64) { |
no outgoing calls