ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Дмитрий Рябов <somefire...@gmail.com>
Subject Re: [Review] IGNITE-4188: Savepoints support inside of Ignite Transactions
Date Fri, 02 Feb 2018 08:41:39 GMT
Hello! Semen, can you continue to review this ticket [1]?

About my realisation:

I added `savepoint()`, `rollbackToSavepoint()` and
'releaseSavepoint()' methods to `Transaction` interface. Savepoints
are stored in `txState` of transaction on the initiator node and
contain every change made since last created savepoint or tx started
(for the first savepoint).
When user calls `savepoint()` during a transaction - its `txState`
will create savepoint with current state.
When user calls `rollbackToSavepoint()` - `txState` will replace
current state to snapshot from chosen savepoint. For pessimistic
transactions, we wait here for request/response to unlock all rolled
back keys.
When user calls 'releaseSavepoint()' - `txState` will remove snapshot
for this and consequent savepoints.

Savepoints are good if you have multiple operations inside one long
transaction and they can fail, but you still need to commit nonfailed
operations. Savepoints allow you to rollback a piece of the
transaction if you want to remain some changes. For example, we have 3
caches: "accounts" with some data, "actions" cache with data about
actions for specific accounts and "bans" with data about banned
accounts. We need to update "accounts" and "actions" caches in the
same pessimistic transaction and this update shouldn't be seen until
done. We update in next sequence: we update account first and then its
actions. After updating actions we have check that this account is
still available and not banned in the third cache (it may be banned
during our transaction). And when we see that account isn't available
– we rollback to savepoint before this account and mark it as banned
in the "account" cache instead of updating its actions.

[1] JIRA ticket: https://issues.apache.org/jira/browse/IGNITE-4188
GitHub PR: https://github.com/apache/ignite/pull/1815
Upsource PR: https://reviews.ignite.apache.org/ignite/review/IGNT-CR-186

2017-05-24 11:08 GMT+03:00 Дмитрий Рябов <somefireone@gmail.com>:
> Can anyone review it?
> Upsource here - http://reviews.ignite.apache.org/ignite/review/IGNT-CR-186
> 2017-04-20 1:30 GMT+03:00 Denis Magda <dmagda@apache.org>:
>> Hi Dmitriy,
>> Thanks a lot for the contribution. Please move the ticket to the patch
>> available state.
>> Our Tx gurus like Sam or Alex G. should be able to review after the
>> community finalizes all Apache Ignite 2.0 related activity. We’re pretty
>> packed with this release for now, sorry for the delay.
>> —
>> Denis
>> > On Apr 19, 2017, at 3:23 AM, Дмитрий Рябов <somefireone@gmail.com>
>> > wrote:
>> >
>> > Hello, igniters. Can you look it? My solution is to save a snapshot of
>> > txState when user calls tx.savepoint("id") and replace current txState
>> > with
>> > saved state when user calls tx.rollbackToSavepoint("id").
>> >
>> > JIRA: https://issues.apache.org/jira/browse/IGNITE-4188
>> >
>> > PR: https://github.com/apache/ignite/pull/1815/files

View raw message