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

Avoid corrupting documents when tracking destroy #1

Closed
wants to merge 6 commits into from

Conversation

dgknght
Copy link

@dgknght dgknght commented Nov 24, 2020

If an embedded document has its version incremented, but an ancester
is flagged for destroy and the root document is not, then this causes
conflicts, which are written to the otherwise empty embedded document,
leaving a corrupt document in storage.

Note that this only happens with the parent document cascades
callbacks.

@cgriego
Copy link

cgriego commented Nov 24, 2020

The way I read this change is that we stop recording history records when deleting nested records, which isn't functionality we should remove. Is there an existing test showing that we still record these?

@cgriego
Copy link

cgriego commented Nov 24, 2020

This looks better. My final concern is that we're now recording history tracks with the same version when something is destroyed. The library expects these to be unique/sequential and it uses these for sorting and for the undo/redo functionality. I think we can appease that by ensuring we write an incremented value on destroy without incrementing the version field on the original document.

Copy link

@cgriego cgriego left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This functionality looks right to me. May want to enhances the tests some.

Doug Knight added 6 commits November 25, 2020 10:42
If an embedded document has its version incremented, but an ancester
is flagged for destroy and the root document is not, then this causes
conflicts, which are written to the otherwise empty embedded document,
leaving a corrupt document in storage.

Note that this only happends with the parent document cascades
callbacks.
@dgknght dgknght force-pushed the avoid-corrupt-documents branch from 4203f4e to 8880418 Compare November 25, 2020 16:44
@dgknght
Copy link
Author

dgknght commented Nov 25, 2020

Moving to a new PR for the upstream repo

@dgknght dgknght closed this Nov 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants