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

Cannot undo an insertion after undoing a later update to same document #75

Open
mattmccutchen opened this issue Feb 9, 2017 · 1 comment

Comments

@mattmccutchen
Copy link
Collaborator

If a document is inserted in one transaction and updated in a second transaction, and then I try to undo both transactions in reverse order, the undo of the insertion will fail because the transaction_id of the doc doesn't match. Test case.

In my app, I disabled this check because the app enforces a linear undo history. I'm not sure what would be an appropriate fix in general. One idea: keep a list of all transaction IDs that have updated the document after it was inserted. When one of those transactions is undone, remove it from the list. When attempting to undo the insertion, check that the list is empty. But this list could grow indefinitely, which could become a problem.

@JackAdams
Copy link
Owner

I don't have a good solution for this. The list of transaction id values would work but, like you say, it would blow out the size of documents with lots of writes done on them via transactions.

We could control the indefinite growth of transaction_id arrays by cleaning up old transactions with a cron job and removing transaction_id values from documents affected by the transactions being removed. Not ideal.

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

No branches or pull requests

2 participants