Skip to main content

fold_reconfiguration_target

Function fold_reconfiguration_target 

Source
fn fold_reconfiguration_target(
    in_flight: Option<&ReconfigurationTarget>,
    new_target: ReconfigurationTarget,
    unchanged: ReconfigurationDimensionsUnchanged,
) -> ReconfigurationTarget
Expand description

Fold a new ALTER onto an in-flight reconfiguration target.

new_target was built against the realized config, so any dimension the ALTER left Unchanged carries the realized (pre-reconfiguration) value. When a reconfiguration is in flight (in_flight is Some), the realized config is the pre-reconfiguration shape, so for each Unchanged dimension we instead keep the in-flight target’s value. Only dimensions the ALTER explicitly set re-target. With nothing in flight (in_flight is None) the target is exactly new_target. This is what keeps an ALTER that touches one dimension (e.g. AZ-only) from silently reverting the in-flight transition along every dimension it did not mention.

Replication factor folds the same way, but only matters for the nothing-in-flight case: a change to it while a reconfiguration is in flight is refused before an ALTER reaches here, so unchanged.replication_factor is always true when in_flight is Some.