ccstm
ccstm copied to clipboard
true nesting
To properly support retry/orElse we must implement partial rollback, at least when rolling back with retry. There are several components
- child vs. top-level commit and rollback handlers
- dynamic lookup of the parent txn (see #3)
- capture of the partial read set during partial rollback for retry
- capture or release of locks whose handle is removed from the write buffer during partial rollback
It would also be nice to generate partial rollback on conflict when possible.
Note that true nesting is also required to properly implement rollback without retry on exception.
How will this affect TxnLocal
?
It seems that maybe we don't need any additional handlers. beforeCommit
and afterCommit
should always refer to globally visible effects, hence they need only report top-level commit. afterRollback
should report when writes performed by the particular nesting level have been undone, which may be a partial rollback.
ReadResource
s from a child txn may be discarded on partial rollback.
WriteResource
s from a child txn may be discarded on partial rollback after their performRollback
method has been called.
Hmm. Maybe we should include enough hooks that they could implement TxnLocal
. Alternately, we could let them override the required hooks in a TxnLocal
instance?
Either partial rollback and partial retry both remove the current invariant that a txn that is no longer Active
can never again be Active
, or a pending partial rollback should not be encoded as the transaction status.