You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by afs <gi...@git.apache.org> on 2015/12/14 14:20:01 UTC

[GitHub] jena pull request: Introduce interface TransactionalComponent.

GitHub user afs opened a pull request:

    https://github.com/apache/jena/pull/109

    Introduce interface TransactionalComponent.

    Mantis has a more general concept of transaction.  As part of that, it differentiates between `Transactional` (the view from users of a transaction system) and `TransactionalComponent` (units of code that participate in providing transactionality).
    
    See [the code for TransactionalComponent](https://github.com/afs/mantis/blob/master/dboe-transaction/src/main/java/org/seaborne/dboe/transaction/txn/TransactionalComponent.java) -- for example, that has a explicit `Transaction` object and only the upper layers manage the `Transaction` by thread.
    
    For the in-memory dataset, the difference is currently small but introducing this now prepares for more complex setups, without disturbing `Transactional`.  It also removes the need for components to know whether they are in a transaction or not; that is a concept of the coordinator function currently in `DatasetGraphInMemory`.  During times of state change, some components may be in different states to others, making the idea of a component being "in a transaction" imprecise. It also removes 11 ThreadLocals that were not used except in testing. The testing is adapted.
    
    To use individual components on their own (if ever needed) then a simple wrapper that provides `Transactional` over a single component is a better design as it separates the roles of collection and component. Included is `TransactionalOfOne` but that is just illustrative and not for inclusion.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/afs/jena txnmem

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/jena/pull/109.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 #109
    
----
commit 39cf986fee9347c1920354b3fbddfed298bee8be
Author: Andy Seaborne <an...@seaborne.org>
Date:   2015-12-14T12:47:24Z

    Use counting inside and outside a transaction to see what's happened.

commit a086675b27d0875126493bdd9f1e4247b87a2bb2
Author: Andy Seaborne <an...@seaborne.org>
Date:   2015-12-14T12:48:18Z

    Introduce interface TransactionalComponent.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jena pull request: Introduce interface TransactionalComponent.

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/jena/pull/109


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jena pull request: Introduce interface TransactionalComponent.

Posted by ajs6f <gi...@git.apache.org>.
Github user ajs6f commented on the pull request:

    https://github.com/apache/jena/pull/109#issuecomment-164436772
  
    I think this is basically awesome. Separating different views of the things-that-are-transacting is good, and it gets us a little further down the road to having a proper `Transaction` object, which would be great.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jena pull request: Introduce interface TransactionalComponent.

Posted by ajs6f <gi...@git.apache.org>.
Github user ajs6f commented on a diff in the pull request:

    https://github.com/apache/jena/pull/109#discussion_r47496526
  
    --- Diff: jena-arq/src/test/java/org/apache/jena/sparql/core/mem/AbstractTestTupleTable.java ---
    @@ -42,71 +43,68 @@
     
     	protected static final Set<TupleSlot> allWildcardQuery = of();
     
    +	protected long transactionalCount() {
    +	    table().begin(READ);
    +	    long x = rawCount() ;
    --- End diff --
    
    Could this not be
    ```
    table().begin(READ);
    try { return rawCount(); }
    finally { table().end(); }
    ```
    That seems more readable to me, but maybe that's just my taste.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jena pull request: Introduce interface TransactionalComponent.

Posted by afs <gi...@git.apache.org>.
Github user afs commented on the pull request:

    https://github.com/apache/jena/pull/109#issuecomment-164471467
  
    I would not be confident yet that all the machinery in Mantis is right - it has not been used enough to know and may be too complicated.  One test is to use it with transactions involving Lucene (weak transactions) and TDB2. But components was one thing I had trouble with until introducing the difference between a component and the overall transaction.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jena pull request: Introduce interface TransactionalComponent.

Posted by ajs6f <gi...@git.apache.org>.
Github user ajs6f commented on the pull request:

    https://github.com/apache/jena/pull/109#issuecomment-164756367
  
    I suppose it's early days in that sense. But if (as seems at least possible) Jena acquires more and more kinds of indexes (text, geospatial, etc.) and more and more "pluggability" (SPIs) in the index layer, this could really be an important point. Also, won't multi-thread transactions pretty much demand something like a proper `Transaction` object? 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---