Fixes #2579 - #2580
Open
fredrik-persson wants to merge 3 commits into
Open
Fixes #2579#2580fredrik-persson wants to merge 3 commits into
fredrik-persson wants to merge 3 commits into
Conversation
perf.yang declares no defaults and no when conditions, and test_validate passes NULL for the diff, so lyd_val_diff_add() is never reached and the cost of building a validation diff is not measured anywhere. Add perf_dflt.yang, where every list instance offers four alternative sets of defaults gated on the same leaf, so only one set can ever apply. Two cases validate that data, one asking for a diff and one not.
…diff lyd_val_diff_add() is called once per node created or deleted by validation. It built a standalone one-node diff and merged that into the accumulating diff, which duplicated the node's whole ancestor chain on every call. lyd_diff_add() already reuses the ancestors present in the target diff, so append straight into it when the node has no entry there yet. The merge is only needed when an operation on that very node already exists, to reconcile the two. lyd_diff_add() leaves out an operation that a parent already states, so add it back to keep the diff shape unchanged.
When a when condition turns out false, the default nodes created speculatively before it was resolved are auto-deleted again. Recording that deletion went through lyd_diff_merge_all(), which duplicated the deleted subtree and reconciled it node by node, only for the entries to end up as "none" and be dropped as redundant. Recognise the case directly: if the diff already holds a create for the node, and nothing in that subtree was set explicitly, the create and the delete cancel out, so remove the subtree together with any ancestor left without a change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #2579
Three commits: the first adds performance test that exercise validation with a diff, then two fix commits as described in the issue.