Description
Consider the following sequence for the hello_world job with 3 instances:
aurora job create devcluster/www-data/prod/hello aurora/examples/jobs/hello_world.aurora <change config to trigger update, e.g. change RAM> aurora update start devcluster/www-data/prod/hello/0 aurora/examples/jobs/hello_world.aurora aurora job kill devcluster/www-data/prod/hello/1 aurora update start devcluster/www-data/prod/hello/0,1 aurora/examples/jobs/hello_world.aurora
The expectation is to have all 3 instances on the same config. The result: instance 0 is killed with only instances 1 and 2 remaining.
The problem is that UpdateFactory iterates over scoped instances thus overriding the JobDiff results. This leads to InstanceUpdater killing any instances that are present in actual state but not present in the desired state.
These are the (correct) results produced by the JobDiff that should be used to drive the update instead:
"Unscoped diff contents:" Replaced: [2] Replacements: [1, 2] Unchanged: [0] "Scoped (final) diff contents:" Replaced: [] Replacements: [1] Unchanged: [2, 0]
The current behavior appears to be a leftover that should have been removed in this refactoring: https://reviews.apache.org/r/25969/.