MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / apply_migration_abort

Function apply_migration_abort

nodedb-cluster/src/metadata_group/cache.rs:197–217  ·  view source on GitHub ↗

Apply a `MigrationAbort` entry against the shared state table and live routing table. Applies each compensation in order; any failure is fatal (no warn-and-continue — a partial abort is as broken as a partial commit). On success, removes the migration row from the state table.

(
    table: &SharedMigrationStateTable,
    routing: Option<&std::sync::Arc<std::sync::RwLock<RoutingTable>>>,
    migration_id: uuid::Uuid,
    reason: &str,
    compensations: &[Compensation],
)

Source from the content-addressed store, hash-verified

195/// warn-and-continue — a partial abort is as broken as a partial commit).
196/// On success, removes the migration row from the state table.
197pub fn apply_migration_abort(
198 table: &SharedMigrationStateTable,
199 routing: Option<&std::sync::Arc<std::sync::RwLock<RoutingTable>>>,
200 migration_id: uuid::Uuid,
201 reason: &str,
202 compensations: &[Compensation],
203) -> Result<(), ClusterError> {
204 info!(
205 migration_id = %migration_id,
206 reason,
207 steps = compensations.len(),
208 "applying migration abort"
209 );
210
211 for (step, comp) in compensations.iter().enumerate() {
212 apply_compensation(routing, step, migration_id, comp)?;
213 }
214
215 let mut guard = table.lock().unwrap_or_else(|p| p.into_inner());
216 guard.remove(&migration_id)
217}
218
219fn apply_compensation(
220 routing: Option<&std::sync::Arc<std::sync::RwLock<RoutingTable>>>,

Calls 4

apply_compensationFunction · 0.85
lockMethod · 0.80
iterMethod · 0.45
removeMethod · 0.45