-
Notifications
You must be signed in to change notification settings - Fork 11.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[5/x][lamport] Remove SequenceNumber::decrement and ::increment (#6163)
`SequenceNumber::decrement` is used primarily to revert state updates (e.g. when an update crosses an epoch or configuration change and then needs to be rolled back). With the introduction of lamport timestamps, this will no longer be feasible with decrement, because a transaction can increment an object's version by an arbitrary amount (not always one), depending on the versions of other input objects. This commit re-implements `revert_state_update` to rely on a list of initial versions for modified inputs that gets stored in `TransactionEffects` and gets rid of the `decrement` API altogether. `increment` is replaced by two pieces: - `SequenceNumber::lamport_increment` to calculate a lamport timestamp. - `SequenceNumber::increment_to` to increment to a number that should be strictly greater than the current version. And now, rather than objects being incremented when they are modified, versions are updated as follows: - Shared object scheduling pre-computes their new versions based on the transaction's inputs. - The `TemporaryStore` is aware of the lamport timestamp for the transaction it's serving, and assigns all modified objects (this includes inputs and child objects) this version when committing modifications to effects. - We also remember the versions modified and deleted objects had, in case we need to revert -- we can't rely solely on the information from the certificate for this, because we could have dynamically loaded child objects which need to be reverted as well. Gateway also needs some special support in order to replay certificates: Previously it took the objects that were indicated as modified in effects and replayed those modifications into a store, but new protections that this commit introduces to ensure that all objects get incremented would complain (because the objects in the effects come with thei post-modified version), so before replaying the modifications, the gateway will decrement an object's version to their pre-modified state, as specified by `modified_at_versions` in effects, using a new `SequenceNumber::decrement_to` API.
- Loading branch information
Showing
26 changed files
with
494 additions
and
403 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.