[GCU] Optimizing moves by adding generators for keys/tables #2120
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What I did
Fixes #2099
Grouping all fields under tables/keys to be added/deleted in 1 JsonChange.
BEFORE how did we generate moves to try?
UpperLevelMoveExtender
The diagram below shows:
AFTER
In this PR, we introduce a different kind of generator. The non-extendable generators i.e. generators that their moves do not get extended using the extenders. We added 2 generators:
Only enabled KeyLevelGenerator, to enable TableLevelGenerator we have to confirm with Renuka if it is possible to update a whole table at once in the
ChangeApplier
(instead of just keys like it is today). We have to be able to update a table as a whole because within the table there can be internal dependencies between the object, so we have to guarantee all objects are deleted together. For the keys it is guaranteed for the whole key to be updated at once according to theChangeApplier
.Why non-extendable generators?
Calling the non-extendable generators precedes the extendable ones, it is like checking for the low hanging fruits. If we use the same extenders for these new generators we will always go up the config tree. Imaging a move that tries to update a key but fails, then we call the extenders on this move. What will happen is the extenders will go up the config tree to the table level, will first try to replace the table, then try to delete the table. Deleting the table is a problem because it affects multiple more than intended and thus violates the minimum disruption guarantee. We decided to leave the extenders only for the LowLevelGenerator thus making sure we try all possible moves from the lowest levels and go up from there.
Another way to look at it is like this:
How I did it
Modifying the
MoveWrapper.Generate
method to allow for different type of move generatorsHow to verify it
Unit-test
Please check
tests/generic_config_updater/files/patch_sorter_test_success.json
to see how the moved generated got much compacted.Previous command output (if the output of a command-line utility has changed)
New command output (if the output of a command-line utility has changed)