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

[adapter] Ignore deletions for objects that are always wrapped #7174

Merged
merged 1 commit into from
Jan 5, 2023

Conversation

amnn
Copy link
Contributor

@amnn amnn commented Jan 5, 2023

If an object has always existed in a wrapped state and is eventually deleted, don't included it among the deleted (and therefore modified) objects in the effects for the transaction that deletes its ID.

Test Plan

Updated an existing unit test to confirm the values for modified_at_versions after deleting an object that was always wrapped

If an object has always existed in a wrapped state and is eventually
deleted, don't included it among the deleted (and therefore modified)
objects in the effects for the transaction that deletes its ID.

Test Plan:

Updated an existing unit test to confirm the values for
`modified_at_versions` after deleting an object that was always
wrapped
@vercel
Copy link

vercel bot commented Jan 5, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Comments Updated
explorer-storybook ⬜️ Ignored (Inspect) Jan 5, 2023 at 10:38PM (UTC)
wallet-adapter ⬜️ Ignored (Inspect) Jan 5, 2023 at 10:38PM (UTC)

@amnn amnn self-assigned this Jan 5, 2023
@amnn amnn added rust Pull requests that update Rust code sui-core labels Jan 5, 2023
@amnn amnn enabled auto-merge (squash) January 5, 2023 22:40
SequenceNumber::new()
// This object was not created this transaction but has never existed in
// storage, skip it.
continue;
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't the Ok(Some(...)) case also questionable - if an object did exist in the store, and then was wrapped, and then deleted, is it approriate to use the last version that existed before being wrapped?

Copy link
Contributor

Choose a reason for hiding this comment

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

also, i'm slightly concerned about how this could mask a bug in which parent_sync isn't updated, but maybe there's not much we can do about that.

Copy link
Contributor Author

@amnn amnn Jan 5, 2023

Choose a reason for hiding this comment

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

I think there's an argument to be made that because wrapping is considered a form of deletion, if the object was not in by_value_objects, this deletion should be entirely ignored (i.e. advocating for getting rid of the use of parent sync altogether), but things are set-up this way because in practice, it's useful to know when the object is gone for good vs just hidden. That is a deeper subject than the thesis of this PR though.

Copy link
Contributor

Choose a reason for hiding this comment

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

isn't the Ok(Some(...)) case also questionable - if an object did exist in the store, and then was wrapped, and then deleted, is it approriate to use the last version that existed before being wrapped?

I'm not sure what else you would suggest?
IIRC correctly, we used to set it to MAX - 1 instead of previous_version, but that feels even more confusing.
If you conceptually think of the version as being a field of the object (even though that isn't the case in Move), the previous_version is the consistent behavior.
Though definitely open to suggestions here.

also, i'm slightly concerned about how this could mask a bug in which parent_sync isn't updated, but maybe there's not much we can do about that.

That is a potential issue, yes. One thing we have discussed doing is forming a write-ahead, crash-recovery log of Txn => ObjectID => Version which would indicate the version used as an input in this transaction in the case that this transaction is being reprocessed (for whatever reason). We could also populate that table for this parent sync case, which I think should help prevent any bugs with the parent_sync, but maybe

Copy link
Contributor

Choose a reason for hiding this comment

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

in the case that this transaction is being reprocessed

@tnowacki We won't have to worry about that - the current and future plan for execution recovery is that we only ever execute once, then right the temporary store + effects atomically to a recovery "log" before updating the store. If the store updates are interrupted, we re-read the recovery log rather than re-executing. Otherwise there is no way to be correct wrt dynamic child loading as far as I can see.

SequenceNumber::new()
// This object was not created this transaction but has never existed in
// storage, skip it.
continue;
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't the Ok(Some(...)) case also questionable - if an object did exist in the store, and then was wrapped, and then deleted, is it approriate to use the last version that existed before being wrapped?

I'm not sure what else you would suggest?
IIRC correctly, we used to set it to MAX - 1 instead of previous_version, but that feels even more confusing.
If you conceptually think of the version as being a field of the object (even though that isn't the case in Move), the previous_version is the consistent behavior.
Though definitely open to suggestions here.

also, i'm slightly concerned about how this could mask a bug in which parent_sync isn't updated, but maybe there's not much we can do about that.

That is a potential issue, yes. One thing we have discussed doing is forming a write-ahead, crash-recovery log of Txn => ObjectID => Version which would indicate the version used as an input in this transaction in the case that this transaction is being reprocessed (for whatever reason). We could also populate that table for this parent sync case, which I think should help prevent any bugs with the parent_sync, but maybe

@amnn amnn merged commit e5739c3 into MystenLabs:main Jan 5, 2023
@amnn amnn deleted the wrap-delete branch January 7, 2023 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rust Pull requests that update Rust code sui-core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants