[
https://issues.apache.org/jira/browse/JENA-1458?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16307534#comment-16307534
]
ASF GitHub Bot commented on JENA-1458:
--------------------------------------
GitHub user afs opened a pull request:
https://github.com/apache/jena/pull/336
JENA-1458: Transaction promotion
This PR provides promotion (read mode goes to write mode as needed) for
TIM, TDB1 and TDB2.
Transactions have a type (new) and a current mode.
* TxnMode (enum `ReadWrite` - name retained for compatibility)
* `TxnType` - `WRITE`, `READ`, `READ_PROMOTE`, `READ_COMMITTED_PROMOTE`
Transactions can go from "read" to "write", if their initial setup allows
it, when an update operation is attempted (implicit promotion) or if the app
asks for the transaction to be promoted (explicit promotion).
`Transactional` and hence the DatasetGraph/Dataset interfaces get new
operations:
WRITE and READ are the same as the previous use of ReadWrite for W and R
transactions.
The two different types of promote differ in whether strict transaction
isolation is
maintained (`READ_PROMOTE`) and no changes from other writers
are seen during the transaction, or (`READ_COMMITTED_PROMOTE`) whether at
the point of promotion, changes become visible.
`READ_PROMOTE` can fail (implicit promote - transaction aborts; explicit
promote, `promote()` returns false) whereas `READ_COMMITTED_PROMOTE` does not
fail - it's like ending a READ transaction and starting a fresh WRITE
transaction; changes from other writers can be seen across the change.
The new operations are:
```
public void begin()
public void begin(TxnType type)
public boolean promote()
public ReadWrite transactionMode();
public TxnMode transactionType();
```
and `public void begin(ReadWrite mode)` remains with the same semantics as
before. No application needs to change.
`begin()` is `begin(TxnType.READ_PROMOTE)`, which can cause a system abort.
This is a choice - it could be `begin(TxnType.READ_COMMITTED_PROMOTE)`
which does not cause system aborts but any reads before the promote point are
not no longer guaranteed to be the state of the data (the transaction is "read
committed", not strong isolation properties) leading to possible inconsistent
data update.
Graph transactions handlers call `begin()`.
To do:
* Update `Txn`
* More checking
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/afs/jena promotion
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/jena/pull/336.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #336
----
commit 74808450e635418cca758a564288fc80994b3ad6
Author: Andy Seaborne <andy@...>
Date: 2017-12-29T18:56:57Z
Remove duplicate ThreadTxn from DBOE.
commit 143ac13b69a26b91d0f6f97991794231c4edd0cd
Author: Andy Seaborne <andy@...>
Date: 2017-12-30T12:30:35Z
JENA-1458: Promotion API and convert TIM
commit ee7507df9fe24abcf076e449807dc8d056699392
Author: Andy Seaborne <andy@...>
Date: 2017-12-30T22:57:06Z
JENA-1458: Use TxnType, replacing ReadWrite mode
commit 64f6357c25494a961f77db670cbe5b2d4cc35eab
Author: Andy Seaborne <andy@...>
Date: 2017-12-30T22:57:46Z
JENA-1458: Promotion API integration for TDB
commit d6770eaf62f13d60bc5f414cfa6b2f3a50fca445
Author: Andy Seaborne <andy@...>
Date: 2017-12-31T17:15:04Z
JENA-1458: Promotion API integration for TDB2
commit 55983cdae25a2a9d23b695486e4488f76fd94786
Author: Andy Seaborne <andy@...>
Date: 2017-12-31T20:49:18Z
Fix to work with tests. Cleanup.
----
> Transaction promotion
> ---------------------
>
> Key: JENA-1458
> URL: https://issues.apache.org/jira/browse/JENA-1458
> Project: Apache Jena
> Issue Type: Improvement
> Affects Versions: Jena 3.6.0
> Reporter: Andy Seaborne
> Assignee: Andy Seaborne
>
> Expose the transaction promotion capabilities of TIM, TDB, and TDB2.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)