Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

diff BUGFIX check nodes before inserting after #2255

Closed
wants to merge 1 commit into from

Conversation

jeremie6wind
Copy link

The mode must be different and have the same schema.

Fixes: c80fcc9 ("diff BUGFIX diff merge userord node order")

The mode must be different and have the same schema.

Fixes: c80fcc9 ("diff BUGFIX diff merge userord node order")
@jeremie6wind
Copy link
Author

Hi,
I had some errors logs while calling:

  • lyd_insert_after with identical nodes
  • lyd_insert_after with nodes with different schemas

I am proposing this patch, because this fixes my problem, but you surely have a better solution.
Thx
BR
J.

@michalvasko
Copy link
Member

It would be best if you could provide (or at least describe in detail) the exact use-case so that I can reproduce it and add into the tests.

@jeremie6wind
Copy link
Author

jeremie6wind commented Jun 18, 2024

I attached a sysrepo patch with a sample yang module list-test.yang that I added with:
sysrepoctl --install list-test.yang

Then I started the sample:
application_changes_example list-test /list-test:state operational

Now I have 2 different sample to get the 2 cases:

  1. Error log when working on the same node
    ./push_in_list_example
    It gives the error message:

[ERR] Merging operation "create" failed.

In this sample I add a list that was previously not present.

  1. Error log when working on nodes with different schemas
    ./push_in_list_example2
    It gives the error messages:

[ERR] Cannot insert after a different schema node instance.
[ERR] Cannot insert after a different schema node instance.
[ERR] Merging operation "create" failed.

In this sample I change a field in the first list.

I hope it will help.
Many thanks
J.

0001-patch-to-reproduce.patch.txt

@michalvasko
Copy link
Member

Thanks but I do not understand the use-case. The problem appears only if you try to merge and discard the same nodes in a single edit (sr_apply_changes() call) but that is correct, I think (the error should be improved but is valid), this should not be supported, why should it?

@jlesk
Copy link

jlesk commented Jun 20, 2024

Hi Mishal,
Thanks for your reply,
This worked before the commit:
c80fcc9

I understand that this is a workaround, but I am using this to 'replace' some part of the operational data and this worked so far:
sr_edit_batch
sr_discard_items
sr_apply_changes

Also changing to this would not be unitary:
sr_discard_items
sr_apply_changes
sr_edit_batch
sr_apply_changes

BR
J.

michalvasko added a commit that referenced this pull request Jun 21, 2024
@michalvasko
Copy link
Member

Okay, the cause was a bug so I guess the use-case can be supported, should be fixed, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants