[YANGTOOLS-500] DataTree: write/write/merge combo may lose data Created: 10/Sep/15  Updated: 10/Apr/22  Resolved: 16/Nov/15

Status: Resolved
Project: yangtools
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Robert Varga Assignee: Robert Varga
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


Issue Links:
Blocks
blocks YANGTOOLS-501 DataTree: lazy merge operations Resolved
External issue ID: 4288

 Description   

Code review of OperationWithModification.recursiveMerge() will propagate the pre-existing WRITE node's children downwards to preserve the data items which were written.

This unfortunately fails to check if there are nested nodes (introduced after the write which is being replaced), thus losing them.

The specific problem comes from the following set of operations being done on a DataTreeModification:

write(A, data1);
write(A/B, data2);
merge(A, data3);

if data1 overlaps with data2, the merge to A will push data1's version of data2 into A/B, hence the result will look as if the second write never happened.



 Comments   
Comment by Robert Varga [ 10/Sep/15 ]

Be: https://git.opendaylight.org/gerrit/26781

Needs to be expanded with a unit test for this particular scenario.

Comment by Robert Varga [ 10/Sep/15 ]

Looking at the code a bit more, we also have a problem when data3 should overwrite data2, as the merge operation does not clear write(A/B) in case of overlap.

Even with the provided patch, the apply logic will think that the merge happened before write(A/B).

Comment by Robert Varga [ 10/Nov/15 ]

https://git.opendaylight.org/gerrit/29499

Generated at Wed Feb 07 20:53:26 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.