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

Support special atomic storage operations on keys #1466

Open
bennetyee opened this issue Feb 14, 2019 · 0 comments
Open

Support special atomic storage operations on keys #1466

bennetyee opened this issue Feb 14, 2019 · 0 comments
Labels
c:storage Category: storage

Comments

@bennetyee
Copy link
Contributor

To avoid excessive read/write and write/write conflicts on account balances, we should have the ability to treat such nodes in the global merkle tree as a non-negative counter to which values are added and subtracted. The only reason for an abort is if a subtraction would result in a negative value.

Details

A CRDT (https://en.wikipedia.org/wiki/Conflict-free_replicated_data_type) might work, though might be overkill.

We have transactions within a batch adding and subtracting values to account balances, possibly aborting one (or more) transaction within the batch if their execution would have taken an account balance negative -- relative to the balance at the root used for all batches executing in parallel. In order to serialize batches, we record the net change to all account balances as delta values, and furthermore we need to know the lowest value that account balances might reach as a delta value relative to the starting balance. With a max excursion, we can determine if merging batches in a certain order would result in a serial view where one or more account balances would have been negative.

We have at least three possible design choices:

  • remove batches that would cause one or more account balances to go negative, so those transactions are reverted

  • look for a permutation of batches that minimizes the number of batches that need to be reverted

  • allow account balances to go temporarily negative, as long as the final value after all transactions are merged are non-negative, i.e., free loans are available since the loans are risk-free.

Acceptance Criteria

  • A design for how to reduce conflicts for non-negative counters (account balances).
@ryscheng ryscheng added the epic Epic (costed tracking issue) label Feb 25, 2019
@kostko kostko removed the epic Epic (costed tracking issue) label Apr 12, 2019
@kostko kostko added the c:storage Category: storage label Sep 10, 2019
@kostko kostko changed the title Special case account balance handling to reduce conflicts Support special atomic storage operations on keys Sep 17, 2019
@kostko kostko assigned kostko and unassigned kostko Sep 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c:storage Category: storage
Projects
None yet
Development

No branches or pull requests

3 participants