You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by bu...@apache.org on 2018/03/22 15:04:33 UTC

svn commit: r1027137 - in /websites/staging/jena/trunk/content: ./ documentation/txn/index.html documentation/txn/transactions_api.html documentation/txn/transactions_tdb.html

Author: buildbot
Date: Thu Mar 22 15:04:33 2018
New Revision: 1027137

Log:
Staging update by buildbot for jena

Modified:
    websites/staging/jena/trunk/content/   (props changed)
    websites/staging/jena/trunk/content/documentation/txn/index.html
    websites/staging/jena/trunk/content/documentation/txn/transactions_api.html
    websites/staging/jena/trunk/content/documentation/txn/transactions_tdb.html

Propchange: websites/staging/jena/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Thu Mar 22 15:04:33 2018
@@ -1 +1 @@
-1827490
+1827504

Modified: websites/staging/jena/trunk/content/documentation/txn/index.html
==============================================================================
--- websites/staging/jena/trunk/content/documentation/txn/index.html (original)
+++ websites/staging/jena/trunk/content/documentation/txn/index.html Thu Mar 22 15:04:33 2018
@@ -171,7 +171,7 @@ on the basic API using Java8 features.</
 threads. The properties of transactions are <a href="https://en.wikipedia.org/wiki/ACID">ACID</a>
 - Atomic, Consistent, Isolation, Durable -
 meaning that groups of changes are made visible to other transactions
-in a single unit or all changes are not at all, and when made changes are not
+in a single unit or no changes become visible, and when made changes are not
 reversed, or the case of persistent storage, not lost or the database corrupted.</p>
 <p>Jena provides transaction on datasets and provides "serializable transactions".
 Any application code reading data sees all changes made elsewhere,
@@ -179,7 +179,7 @@ not parts of changes.  In particular, SP
 correct and do not see partial changes due to other transactions.</p>
 <p>The exact details are dependent on the implementation.</p>
 <p>Transactions can not be <a href="https://en.wikipedia.org/wiki/Nested_transaction">nested</a>
-(a transaction happening inside an outertransaction results in chnages visible only
+(a transaction happening inside an outer transaction results in changes visible only
 to the outer transaction until that commits).</p>
 <p>Transactions are "per thread". Actions by different threads on the same dataset are
 always inside different transactions.</p>
@@ -208,6 +208,11 @@ better concurrency with MR+SW (multiple-
 <td><code>TDBFactory.create</code></td>
 </tr>
 <tr>
+<td>TDB2</td>
+<td>MR+SW, persistent</td>
+<td><code>TDB2Factory.create</code></td>
+</tr>
+<tr>
 <td>General</td>
 <td>MRSW</td>
 <td><code>DatasetFactory.create</code></td>

Modified: websites/staging/jena/trunk/content/documentation/txn/transactions_api.html
==============================================================================
--- websites/staging/jena/trunk/content/documentation/txn/transactions_api.html (original)
+++ websites/staging/jena/trunk/content/documentation/txn/transactions_api.html Thu Mar 22 15:04:33 2018
@@ -221,7 +221,7 @@ operations to change a dataset may consu
 needs to start a new transaction to perform further operations on the
 dataset.</p>
 <div class="codehilite"><pre> <span class="n">Dataset</span> <span class="n">dataset</span> <span class="p">=</span> <span class="p">...</span> <span class="p">;</span>
- <span class="n">dataset</span><span class="p">.</span><span class="n">begin</span><span class="p">(</span><span class="n">ReadWrite</span><span class="p">.</span><span class="n">WRITE</span><span class="p">)</span> <span class="p">;</span>
+ <span class="n">dataset</span><span class="p">.</span><span class="n">begin</span><span class="p">(</span><span class="n">TxnType</span><span class="p">.</span><span class="n">WRITE</span><span class="p">)</span> <span class="p">;</span>
 
  <span class="k">try</span> <span class="p">{</span>
      <span class="n">Model</span> <span class="n">model</span> <span class="p">=</span> <span class="n">dataset</span><span class="p">.</span><span class="n">getDefaultModel</span><span class="p">()</span> <span class="p">;</span>
@@ -258,6 +258,25 @@ dataset.</p>
 </pre></div>
 
 
+<h2 id="transaction-types-modes-and-promotion">Transaction Types, Modes and Promotion.<a class="headerlink" href="#transaction-types-modes-and-promotion" title="Permanent link">&para;</a></h2>
+<p>Transaction hava type (enum <code>TxnType</code>) and a mode (enum <code>ReadWrite</code>).
+<code>TxnType.READ</code> and <code>TxnType.Write</code> strart the transaction in
+that mode and it is fixed fro the transaction's lifetime. A <code>READ</code>
+trasnaction can never update the data of the transactional object it is
+acting on.</p>
+<p>Transactiosn can have type <code>TxnType.READ_PROMOTE</code> and
+<code>TxnType.READ_COMMITTED_PROMOTE</code>. These start in mode <code>READ</code> but can
+become mode <code>WRITE</code>, either implicitly by attempting an update, or
+explicitly by calling <code>promote</code>.</p>
+<p><code>READ_PROMOTE</code> only succeeds if no writer has made any changes since
+this transaction started. It gives full isolation.</p>
+<p><code>READ_COMMITTED_PROMOTE</code> always succeeds because it changes the view of
+the data to include any changes made up to that point (it is "read
+committed"). Applicationd should be aware that data they have read up
+until the point of promotion (the first call or <code>.promote</code> or first
+update made) may now be invalid. For this reason, <code>READ_PROMOTE</code> is preferred.</p>
+<p><code>begin()</code>, the method with no arguments, is equivalent to
+<code>begin(TxnType.READ_PROMOTE)</code>.</p>
 <h2 id="multi-threaded-use">Multi-threaded use<a class="headerlink" href="#multi-threaded-use" title="Permanent link">&para;</a></h2>
 <p>Each dataset object has one transaction active at a time per thread.
 A dataset object can be used by different threads, with independent transactions.</p>
@@ -270,7 +289,7 @@ one dataset, and so there is one transac
 
 
 <p>Thread 1:</p>
-<div class="codehilite"><pre> <span class="n">dataset</span><span class="p">.</span><span class="n">begin</span><span class="p">(</span><span class="n">ReadWrite</span><span class="p">.</span><span class="n">WRITE</span><span class="p">)</span> <span class="p">;</span>
+<div class="codehilite"><pre> <span class="n">dataset</span><span class="p">.</span><span class="n">begin</span><span class="p">(</span><span class="n">TxnType</span><span class="p">.</span><span class="n">WRITE</span><span class="p">)</span> <span class="p">;</span>
  <span class="k">try</span> <span class="p">{</span>
    <span class="p">...</span>
    <span class="n">dataset</span><span class="p">.</span><span class="n">commit</span><span class="p">()</span> <span class="p">;</span>
@@ -279,7 +298,7 @@ one dataset, and so there is one transac
 
 
 <p>Thread 2:</p>
-<div class="codehilite"><pre> <span class="n">dataset</span><span class="p">.</span><span class="n">begin</span><span class="p">(</span><span class="n">ReadWrite</span><span class="p">.</span><span class="n">READ</span><span class="p">)</span> <span class="p">;</span>
+<div class="codehilite"><pre> <span class="n">dataset</span><span class="p">.</span><span class="n">begin</span><span class="p">(</span><span class="n">TxnType</span><span class="p">.</span><span class="n">READ</span><span class="p">)</span> <span class="p">;</span>
  <span class="k">try</span> <span class="p">{</span>
    <span class="p">...</span>
  <span class="p">}</span> <span class="n">finally</span> <span class="p">{</span> <span class="n">dataset</span><span class="p">.</span><span class="k">end</span><span class="p">()</span> <span class="p">;</span> <span class="p">}</span>
@@ -289,7 +308,7 @@ one dataset, and so there is one transac
 <p>It is possible (in TDB) to create different dataset objects to the same location.</p>
 <p>Thread 1:</p>
 <div class="codehilite"><pre> <span class="n">Dataset</span> <span class="n">dataset</span> <span class="p">=</span> <span class="n">TDBFactory</span><span class="p">.</span><span class="n">createDataset</span><span class="p">(</span><span class="n">location</span><span class="p">)</span> <span class="p">;</span>
- <span class="n">dataset</span><span class="p">.</span><span class="n">begin</span><span class="p">(</span><span class="n">ReadWrite</span><span class="p">.</span><span class="n">WRITE</span><span class="p">)</span> <span class="p">;</span>
+ <span class="n">dataset</span><span class="p">.</span><span class="n">begin</span><span class="p">(</span><span class="n">TxnType</span><span class="p">.</span><span class="n">WRITE</span><span class="p">)</span> <span class="p">;</span>
  <span class="k">try</span> <span class="p">{</span>
    <span class="p">...</span>
    <span class="n">dataset</span><span class="p">.</span><span class="n">commit</span><span class="p">()</span> <span class="p">;</span>
@@ -299,7 +318,7 @@ one dataset, and so there is one transac
 
 <p>Thread 2:</p>
 <div class="codehilite"><pre> <span class="n">Dataset</span> <span class="n">dataset</span> <span class="p">=</span> <span class="n">TDBFactory</span><span class="p">.</span><span class="n">createDataset</span><span class="p">(</span><span class="n">location</span><span class="p">)</span> <span class="p">;</span>
- <span class="n">dataset</span><span class="p">.</span><span class="n">begin</span><span class="p">(</span><span class="n">ReadWrite</span><span class="p">.</span><span class="n">READ</span><span class="p">)</span> <span class="p">;</span>
+ <span class="n">dataset</span><span class="p">.</span><span class="n">begin</span><span class="p">(</span><span class="n">TxnType</span><span class="p">.</span><span class="n">READ</span><span class="p">)</span> <span class="p">;</span>
  <span class="k">try</span> <span class="p">{</span>
    <span class="p">...</span>
  <span class="p">}</span> <span class="n">finally</span> <span class="p">{</span> <span class="n">dataset</span><span class="p">.</span><span class="k">end</span><span class="p">()</span> <span class="p">;</span> <span class="p">}</span>

Modified: websites/staging/jena/trunk/content/documentation/txn/transactions_tdb.html
==============================================================================
--- websites/staging/jena/trunk/content/documentation/txn/transactions_tdb.html (original)
+++ websites/staging/jena/trunk/content/documentation/txn/transactions_tdb.html Thu Mar 22 15:04:33 2018
@@ -157,7 +157,17 @@
 }
 h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink, dt:hover > .elementid-permalink { visibility: visible }</style>
 <h2 id="api-for-transactions">API for Transactions<a class="headerlink" href="#api-for-transactions" title="Permanent link">&para;</a></h2>
-<h2 id="overview-from-tdb-doc">Overview from TDB doc<a class="headerlink" href="#overview-from-tdb-doc" title="Permanent link">&para;</a></h2>
+<h2 id="tdb1-and-tdb2">TDB1 and TDB2<a class="headerlink" href="#tdb1-and-tdb2" title="Permanent link">&para;</a></h2>
+<p><a href="/documentation/tdb">TDB1</a>, the original native TDB database for Apache
+Jena, and <a href="documentation/tdb2">TDB2</a> are related but different systems.
+Their transaction systems both provide
+<a href="http://en.wikipedia.org/wiki/Isolation_%28database_systems%29#SERIALIZABLE">Serializable</a>
+transactions, the highest
+<a href="http://en.wikipedia.org/wiki/Isolation_%28database_systems%29">isolation level</a>.
+with one active write transaction and multiple read
+transactions at the same time.</p>
+<p>TDB2 does not have the transaction size limitations of TDB1.</p>
+<h2 id="tdb1">TDB1<a class="headerlink" href="#tdb1" title="Permanent link">&para;</a></h2>
 <p>The transaction mechanism in TDB is based on
 <a href="http://en.wikipedia.org/wiki/Write-ahead_logging">write-ahead-logging</a>.
 All changes made inside a write-transaction are written to
@@ -174,16 +184,12 @@ visible, whether fully propagates back t
 There can be active read transactions seeing the state of the
 database before the updates, and read transactions seeing the state
 of the database after the updates running at the same time.</p>
-<p>Transactional TDB works with SPARQL Query, SPARQL Update, SPARQL
-Graph Store Update as well as the full Jena API.</p>
 <p>TDB provides
 <a href="http://en.wikipedia.org/wiki/Isolation_%28database_systems%29#SERIALIZABLE">Serializable</a>
 transactions, the highest
 <a href="http://en.wikipedia.org/wiki/Isolation_%28database_systems%29">isolation level</a>.</p>
 <h2 id="limitations">Limitations<a class="headerlink" href="#limitations" title="Permanent link">&para;</a></h2>
-<p>(some of these limitations may be removed in later versions)</p>
 <ul>
-<li>Bulk loads: the TDB bulk loader is not transactional</li>
 <li><a href="http://en.wikipedia.org/wiki/Nested_transaction">Nested transactions</a> are not supported.</li>
 <li>Some active transaction state is held exclusively in-memory,
     limiting scalability.</li>
@@ -193,6 +199,19 @@ transactions, the highest
 <p>If a single read transaction runs for a long time when there are
 many updates, the system will consume a lot of temporary
 resources.</p>
+<h2 id="tdb2">TDB2<a class="headerlink" href="#tdb2" title="Permanent link">&para;</a></h2>
+<p>The transaction mechanism in TDB2 is based on
+<a href="https://en.wikipedia.org/wiki/Multiversion_concurrency_control">MVCC</a>
+using immutable datastructrures, which are known as <a href="https://en.wikipedia.org/wiki/Persistent_data_structure">"persistent data
+structures"</a>
+(although this name, for the functional programming community, is
+slightly confusing).</p>
+<h2 id="limitations_1">Limitations<a class="headerlink" href="#limitations_1" title="Permanent link">&para;</a></h2>
+<p>(some of these limitations may be removed in later versions)</p>
+<ul>
+<li>Bulk loads: the TDB2 bulk loader is not transactional</li>
+<li><a href="http://en.wikipedia.org/wiki/Nested_transaction">Nested transactions</a> are not supported.</li>
+</ul>
   </div>
 </div>