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

Fix broken reference consistency check #3590

Merged
merged 1 commit into from
Feb 10, 2023

Conversation

eliandoran
Copy link
Collaborator

I have five notes which keep showing up under the root note.

Consistency issue fixed: Branch '8yc5SDQRrhss_4aKhk3oLjfnx' was set to root parent since it was referencing missing parent
note '8yc5SDQRrhss'
Consistency issue fixed: Branch 'g0UdmDhnHNiH_16FHE0bZt3pX' was set to root parent since it was referencing missing parent
note 'g0UdmDhnHNiH'
Consistency issue fixed: Branch 'g0UdmDhnHNiH_1PhkrImWtTcA' was set to root parent since it was referencing missing parent
note 'g0UdmDhnHNiH'
Consistency issue fixed: Branch 'g0UdmDhnHNiH_6QnjJ4hWGqRo' was set to root parent since it was referencing missing parent
note 'g0UdmDhnHNiH'
Consistency issue fixed: Branch 'sLHEyPuAseQD_vW4MhGZe1phE' was set to root parent since it was referencing missing parent
note 'sLHEyPuAseQD'

Solution:

If a branch was identified with a missing parent, the branch would be moved to root. However, the ID of the branch would be changed as a result of that, and this resulted in the creation of a new branch instead of updating the old one. Deleting the old one first solves the issue.

Root cause analysis:

Most likely broken by 0758c82 which "forces" the ID to parent_note format. As we were changing the parent branch, the ID was changed. This resulted in the old branch remaining indefinitely.

Full analysis:

A few notes keep appearing in the root at start-up.pdf

If a branch was identified with a missing parent, the branch would be
moved to root. However, the ID of the branch would be changed as a
result of that, and this resulted in the creation of a new branch
instead of updating the old one. Deleting the old one first solves the
issue.
@zadam
Copy link
Owner

zadam commented Feb 10, 2023

Hello, thank you for your detailed analysis and PR.

The only downside with this consistency check ( findBrokenReferenceIssues ) is that it does not seem to treat the situation where it finds a branch
with a bad parent, but that note has some other correct branches.
This is what happened here, the parent was removed by the sync at some point, but the branch (which was local to one of the devices) got stuck. In
this situation, removing the branch without recreating it at all would have worked, since the note was already placed in the right location.

That's correct and that was the case also before changes in 0.58.

I fixed that in ade22ea

@eliandoran eliandoran deleted the feature/fix_broken_reference_check branch February 10, 2023 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants