You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2011/07/08 13:16:23 UTC

svn commit: r1144262 - in /incubator/jena: Experimental/TxTDB/trunk/src-dev/tx/ Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/sys/ Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/ Experimental/TxTDB/trunk/src/test/ja...

Author: andy
Date: Fri Jul  8 11:16:23 2011
New Revision: 1144262

URL: http://svn.apache.org/viewvc?rev=1144262&view=rev
Log: (empty)

Modified:
    incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/DevTx.java
    incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/Replay.java
    incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/TxMain.java
    incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/sys/FileRef.java
    incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/sys/SystemTDB.java
    incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/DatasetBuilderTxn.java
    incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/Journal.java
    incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/NodeTableTrans.java
    incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/Transaction.java
    incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/TransactionManager.java
    incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/transaction/AbstractTestNodeTableTrans.java
    incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/transaction/AbstractTestObjectFileTrans.java
    incubator/jena/Jena2/ARQ/trunk/src/org/openjena/atlas/lib/FileOps.java
    incubator/jena/Jena2/ARQ/trunk/update.ru

Modified: incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/DevTx.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/DevTx.java?rev=1144262&r1=1144261&r2=1144262&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/DevTx.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/DevTx.java Fri Jul  8 11:16:23 2011
@@ -19,8 +19,6 @@ public class DevTx
     
     // Every sync hits the NodeTupleTable sync the node table repeatedly - keep dirty flag? 
     
-    // In-memory datasets.
-    
     // Config
     //   One config file?
     //   Cache sizes
@@ -61,15 +59,6 @@ public class DevTx
      *   better setup.
      */
 
-    /*
-     * Layers:
-     *   DatasetGraph
-     *   Indexes
-     *   Pages
-     *   Blocks
-     *   Storage = BlockAccess (a sequence of blocks) and BufferChannel  
-     */
-    
     /* 
      * Fast B+Tree creation: wrap an existsing BPTree with another that switches the block managers only.
      *    BPTree.attach with warpping BlockMgrs.

Modified: incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/Replay.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/Replay.java?rev=1144262&r1=1144261&r2=1144262&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/Replay.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/Replay.java Fri Jul  8 11:16:23 2011
@@ -6,23 +6,38 @@
 
 package tx;
 
+import static com.hp.hpl.jena.tdb.sys.SystemTDB.errlog ;
+import static com.hp.hpl.jena.tdb.sys.SystemTDB.syslog ;
+
+import java.io.File ;
 import java.nio.ByteBuffer ;
 import java.util.Map ;
 
-import org.slf4j.Logger ;
-import org.slf4j.LoggerFactory ;
+import org.openjena.atlas.lib.FileOps ;
 
 import com.hp.hpl.jena.shared.Lock ;
 import com.hp.hpl.jena.tdb.base.block.Block ;
 import com.hp.hpl.jena.tdb.base.block.BlockMgr ;
+import com.hp.hpl.jena.tdb.base.file.FileFactory ;
+import com.hp.hpl.jena.tdb.base.file.Location ;
+import com.hp.hpl.jena.tdb.base.objectfile.ObjectFile ;
+import com.hp.hpl.jena.tdb.base.record.RecordFactory ;
+import com.hp.hpl.jena.tdb.index.IndexMap ;
+import com.hp.hpl.jena.tdb.nodetable.NodeTable ;
 import com.hp.hpl.jena.tdb.store.DatasetGraphTDB ;
 import com.hp.hpl.jena.tdb.sys.FileRef ;
+import com.hp.hpl.jena.tdb.sys.Names ;
+import com.hp.hpl.jena.tdb.sys.SystemTDB ;
+import com.hp.hpl.jena.tdb.transaction.DatasetGraphTxnTDB ;
 import com.hp.hpl.jena.tdb.transaction.Journal ;
 import com.hp.hpl.jena.tdb.transaction.JournalEntry ;
+import com.hp.hpl.jena.tdb.transaction.JournalEntryType ;
+import com.hp.hpl.jena.tdb.transaction.NodeTableTrans ;
+import com.hp.hpl.jena.tdb.transaction.TDBTransactionException ;
 
 public class Replay
 {
-    private static Logger log = LoggerFactory.getLogger(Replay.class) ;
+    //private static Logger log = LoggerFactory.getLogger(Replay.class) ;
     
 
     public static void print(Journal journal)
@@ -41,8 +56,92 @@ public class Replay
         }
     }
 
+    public static void recovery(DatasetGraphTDB dsg)
+    {
+        if ( dsg instanceof DatasetGraphTxnTDB )
+            throw new TDBTransactionException("Reocery works on the base dataset, not a transactional one") ; 
+        
+        if ( dsg.getLocation().isMem() )
+            return ;
+        
+        for ( FileRef fileRef : dsg.getConfig().nodeTables.keySet() )
+            recoverNodeDat(dsg, fileRef) ;
+        
+        recoverSystemJournal(dsg) ;
+    }
+    
+    /** Recovery from the system journal.
+     *  Find is there is a commit record; if so, reply the journal.
+     */
+    private static void recoverSystemJournal(DatasetGraphTDB dsg)
+    {
+        Location loc = dsg.getLocation() ;
+        String journalFilename = loc.absolute(Names.journalFile) ;
+        File f = new File(journalFilename) ;
+        //if ( FileOps.exists(journalFilename)
+        if ( f.exists() && f.isFile() && f.length() > 0 )
+        {
+            Journal jrnl = new Journal(journalFilename) ;
+            // Scan for commit.
+            boolean committed = false ;
+            for ( JournalEntry e : jrnl )
+            {
+                if ( e.getType() == JournalEntryType.Commit )
+                    committed = true ;
+                else
+                {
+                    if ( committed )
+                    {
+                        errlog.warn("Extra journal entries ("+loc+")") ;
+                        break ;
+                    }
+                }
+            }
+            if ( committed )
+            {
+                syslog.info("Recovering committed transaction") ;
+                // The NodeTable Journal has already been done!
+                Replay.replay(jrnl, dsg) ;
+            }
+            jrnl.truncate(0) ;
+            jrnl.close();
+            dsg.sync() ;
+        }
+        
+        if ( f.exists() )
+            FileOps.delete(journalFilename) ;
+    }
+    
+    /** Recover a node data file (".dat").
+     *  Node data files are append-only so recovering, then not using the data is safe.
+     *  Node data file is a precursor for ful lrecovery that works from the master journal.
+     */
+    private static void recoverNodeDat(DatasetGraphTDB dsg, FileRef fileRef)
+    {
+        // See DatasetBuilderTxn - same name generation code.
+        // [TxTDB:TODO]
+        
+        RecordFactory recordFactory = new RecordFactory(SystemTDB.LenNodeHash, SystemTDB.SizeOfNodeId) ;
+        NodeTable baseNodeTable = dsg.getConfig().nodeTables.get(fileRef) ;
+        String objFilename = fileRef.getFilename()+"-"+Names.extJournal ;
+        objFilename = dsg.getLocation().absolute(objFilename) ;
+        File jrnlFile = new File(objFilename) ;
+        if ( jrnlFile.exists() && jrnlFile.length() > 0 )
+        {
+            syslog.info("Recovering node data: "+fileRef.getFilename()) ;
+            ObjectFile dataJrnl = FileFactory.createObjectFileDisk(objFilename) ;
+            NodeTableTrans ntt = new NodeTableTrans(baseNodeTable, new IndexMap(recordFactory), dataJrnl) ;
+            ntt.append() ;
+            ntt.close() ;
+            baseNodeTable.sync() ;
+        }
+        if ( jrnlFile.exists() )
+            FileOps.delete(objFilename) ;
+    }
+    
     public static void replay(Journal journal, DatasetGraphTDB dsg)
     {
+        journal.position(0) ;
         dsg.getLock().enterCriticalSection(Lock.WRITE) ;
         try {
         for ( JournalEntry e : journal )
@@ -51,7 +150,7 @@ public class Replay
         catch (RuntimeException ex)
         { 
             // Bad news travels fast.
-            log.error("Exception during journal replay", ex) ;
+            syslog.error("Exception during journal replay", ex) ;
             throw ex ;
         }
         finally { dsg.getLock().leaveCriticalSection() ; }
@@ -85,7 +184,7 @@ public class Replay
             case Buffer:
             case Object:
             case Checkpoint:
-                log.warn("Unexpect block type: "+e.getType()) ;
+                errlog.warn("Unexpected block type: "+e.getType()) ;
         }
         return false ;
     }

Modified: incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/TxMain.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/TxMain.java?rev=1144262&r1=1144261&r2=1144262&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/TxMain.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/TxMain.java Fri Jul  8 11:16:23 2011
@@ -25,8 +25,6 @@ import com.hp.hpl.jena.sparql.util.NodeF
 import com.hp.hpl.jena.sparql.util.QueryExecUtils ;
 import com.hp.hpl.jena.tdb.TDBFactory ;
 import com.hp.hpl.jena.tdb.base.block.FileMode ;
-import com.hp.hpl.jena.tdb.base.file.BufferChannel ;
-import com.hp.hpl.jena.tdb.base.file.BufferChannelFile ;
 import com.hp.hpl.jena.tdb.base.file.FileFactory ;
 import com.hp.hpl.jena.tdb.base.objectfile.ObjectFile ;
 import com.hp.hpl.jena.tdb.base.record.Record ;
@@ -38,12 +36,9 @@ import com.hp.hpl.jena.tdb.nodetable.Nod
 import com.hp.hpl.jena.tdb.setup.DatasetBuilderStd ;
 import com.hp.hpl.jena.tdb.store.DatasetGraphTDB ;
 import com.hp.hpl.jena.tdb.store.NodeId ;
-import com.hp.hpl.jena.tdb.sys.Names ;
 import com.hp.hpl.jena.tdb.sys.SystemTDB ;
 import com.hp.hpl.jena.tdb.transaction.DatasetGraphTxnTDB ;
 import com.hp.hpl.jena.tdb.transaction.Journal ;
-import com.hp.hpl.jena.tdb.transaction.JournalEntry ;
-import com.hp.hpl.jena.tdb.transaction.JournalEntryType ;
 import com.hp.hpl.jena.tdb.transaction.NodeTableTrans ;
 import com.hp.hpl.jena.tdb.transaction.TransactionManager ;
 import com.hp.hpl.jena.update.UpdateAction ;
@@ -79,51 +74,7 @@ public class TxMain
         //SystemTDB.setFileMode(FileMode.direct) ;
         SystemTDB.setFileMode(FileMode.mapped) ;
         DatasetGraphTDB dsg0 = build() ;
-        
-        //initFS() ;
-        // replay!
-        String journalFilename = dsg0.getLocation().absolute(Names.journalFile) ;
-        if ( FileOps.exists(journalFilename))
-        {
-            BufferChannel bc = new BufferChannelFile(journalFilename) ;
-            System.out.println("Journal found") ;
-            query("Before", "SELECT (Count(*) AS ?c1) { ?s ?p ?o }", dsg0) ;
-            Journal j0 = new Journal(bc) ;
-
-            // Scan for commit.
-            boolean committed = false ;
-            for ( JournalEntry e : j0 )
-            {
-                if ( e.getType() == JournalEntryType.Commit )
-                    committed = true ;
-                else
-                {
-                    if ( committed )
-                    {
-                        Log.warn(Journal.class, "Extra journal entries") ;
-                        break ;
-                    }
-                }
-
-            }
-            j0.position(0) ;
-            if ( committed )
-            {
-                System.out.println("Journal has transaction") ;
-                // NOTE
-                // The NodeTable Journal has already been done!
-                Replay.replay(j0, dsg0) ;
-            }
-            else
-                System.out.println("Journal has no cmmitted transaction") ;
-            j0.truncate(0) ;
-            System.out.println("after") ;
-            query("After", "SELECT (Count(*) AS ?c1) { ?s ?p ?o }", dsg0) ;
-            FileOps.delete(journalFilename) ;
-            exit(0) ;
-        }
-        
-        dsg0.sync() ;
+        Replay.recovery(dsg0) ;
         query("Initial state", "SELECT (Count(*) AS ?c0) { ?s ?p ?o }", dsg0) ;
         //exit(0) ;
         
@@ -135,10 +86,10 @@ public class TxMain
         query("dsg1", "SELECT (Count(*) AS ?c1) { ?s ?p ?o }", dsg1) ;
         query("dsg0", "SELECT (Count(*) AS ?c0) { ?s ?p ?o }", dsg0) ;
         
-        
+
+        //dsg1.getTransaction().prepare() ;
         dsg1.commit() ;
-        
-//        dsg1.abort() ;
+        //dsg1.abort() ;
         
         //System.out.println("Replay") ;
         

Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/sys/FileRef.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/sys/FileRef.java?rev=1144262&r1=1144261&r2=1144262&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/sys/FileRef.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/sys/FileRef.java Fri Jul  8 11:16:23 2011
@@ -21,6 +21,7 @@ import com.hp.hpl.jena.tdb.base.file.Fil
 
 
 /** File references.  
+ *  These are not filenames - they are a per-database file id.
  */
 public class FileRef
 {

Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/sys/SystemTDB.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/sys/SystemTDB.java?rev=1144262&r1=1144261&r2=1144262&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/sys/SystemTDB.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/sys/SystemTDB.java Fri Jul  8 11:16:23 2011
@@ -34,6 +34,16 @@ public class SystemTDB
     // It's visibility is TDB, not really public. 
     private static final Logger log = LoggerFactory.getLogger(TDB.class) ;
     
+    /** TDB System log - use for general messages (a few) and warnings.
+     *  Generally, do not log events unless you want every user to see them every time.
+     *  TDB is an embedded database - libraries and embedded systsm shoudl be seen and not heard.
+     *  @see #errlog 
+     */
+    // This was added quite late in TDB so need to check it's used appropriately - check for Log.*
+    public static final Logger syslog = LoggerFactory.getLogger("TDB") ;
+    /** Send warnings and error */
+    public static final Logger errlog = LoggerFactory.getLogger("TDB") ;
+    
     public static final String TDB_NS = "http://jena.hpl.hp.com/TDB#" ;
     
     // ---- Constants that can't be changed without invalidating on-disk data.  

Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/DatasetBuilderTxn.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/DatasetBuilderTxn.java?rev=1144262&r1=1144261&r2=1144262&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/DatasetBuilderTxn.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/DatasetBuilderTxn.java Fri Jul  8 11:16:23 2011
@@ -44,7 +44,7 @@ public class DatasetBuilderTxn
     {
         blockMgrs = dsg.getConfig().blockMgrs ;
         nodeTables = dsg.getConfig().nodeTables ;
-        txn = txnMgr.createTransaction() ;
+        txn = txnMgr.createTransaction(dsg) ;
             
         BufferChannel chan ;
         if ( dsg.getLocation().isMem() )

Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/Journal.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/Journal.java?rev=1144262&r1=1144261&r2=1144262&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/Journal.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/Journal.java Fri Jul  8 11:16:23 2011
@@ -18,6 +18,7 @@ import org.openjena.atlas.lib.Sync ;
 
 import com.hp.hpl.jena.tdb.base.block.Block ;
 import com.hp.hpl.jena.tdb.base.file.BufferChannel ;
+import com.hp.hpl.jena.tdb.base.file.BufferChannelFile ;
 import com.hp.hpl.jena.tdb.sys.FileRef ;
 
 /** The Journal is slightly odd - it is append-only for write but random read.
@@ -47,6 +48,11 @@ class Journal implements Iterable<Journa
 //    ByteBuffer header = ByteBuffer.wrap(_buffer) ;
     ByteBuffer header = ByteBuffer.allocate(Overhead) ;
     
+    public Journal(String filename)
+    {
+        this(new BufferChannelFile(filename)) ;
+    }
+    
     public Journal(BufferChannel channel)
     {
         this.channel = channel ;

Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/NodeTableTrans.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/NodeTableTrans.java?rev=1144262&r1=1144261&r2=1144262&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/NodeTableTrans.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/NodeTableTrans.java Fri Jul  8 11:16:23 2011
@@ -38,7 +38,7 @@ public class NodeTableTrans implements N
     private long offset ;
     
     private NodeTable nodeTableJournal ;
-    private static int CacheSize = 10000 ;
+    private static int CacheSize = 10000 ;      // [TxTDB:TODO] Make configurable 
     private boolean passthrough = false ;
     private boolean inTransaction = false ;
     

Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/Transaction.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/Transaction.java?rev=1144262&r1=1144261&r2=1144262&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/Transaction.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/Transaction.java Fri Jul  8 11:16:23 2011
@@ -11,6 +11,9 @@ import java.util.Collections ;
 import java.util.Iterator ;
 import java.util.List ;
 
+import tx.Replay ;
+
+import com.hp.hpl.jena.tdb.store.DatasetGraphTDB ;
 import com.hp.hpl.jena.tdb.sys.FileRef ;
 
 /** A transaction handle */
@@ -21,16 +24,18 @@ public class Transaction
     private final TransactionManager txnMgr ;
     private final List<Iterator<?>> iterators ; 
     private Journal journal = null ;
-    private enum State { ACTIVE, COMMITED, ABORTED } 
+    private enum State { ACTIVE, PREPARING, COMMITED, ABORTED } 
     private State state ;
     
     private final List<NodeTableTrans> nodeTableTrans = new ArrayList<NodeTableTrans>() ;
     private final List<BlockMgrJournal> blkMgrs = new ArrayList<BlockMgrJournal>() ;
+    private DatasetGraphTDB basedsg ;
 
-    public Transaction(long id, TransactionManager txnMgr)
+    public Transaction(DatasetGraphTDB basedsg, long id, TransactionManager txnMgr)
     {
         this.id = id ;
         this.txnMgr = txnMgr ;
+        this.basedsg = basedsg ;
         //this.journal = journal ;
         this.iterators = new ArrayList<Iterator<?>>() ;
         state = State.ACTIVE ;
@@ -38,17 +43,33 @@ public class Transaction
 
     public void commit()
     {
+        prepare() ;
+        
+        JournalEntry entry = new JournalEntry(JournalEntryType.Commit, FileRef.Journal, null) ;
+        journal.writeJournal(entry) ;
+        journal.sync() ;        // Commit point.
+        // Attempt to play the journal into the dataset.
+        // This is idempotent and safe to partial replay.  
+        state = State.COMMITED ;
+        Replay.replay(journal, basedsg) ;
+    }
+    
+    public void prepare()
+    {
         if ( state != State.ACTIVE )
             throw new TDBTransactionException("Transaction has already committed or aborted") ; 
+        state = State.PREPARING ;
         
         for ( BlockMgrJournal x : blkMgrs )
             x.commit(this) ;
         for ( NodeTableTrans x : nodeTableTrans )
             x.commit(this) ;
-        
-        JournalEntry entry = new JournalEntry(JournalEntryType.Commit, FileRef.Journal, null) ;
-        journal.writeJournal(entry) ;
-        journal.sync() ;        // Commit point.
+    }
+
+    /** For testing - do things but do not write the commit record */
+    public void semiCommit()
+    {
+        prepare() ;
     }
     
     public void abort()
@@ -64,6 +85,7 @@ public class Transaction
         
         for ( NodeTableTrans x : nodeTableTrans )
             x.abort(this) ;
+        state = State.ABORTED ;
         
     }
     

Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/TransactionManager.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/TransactionManager.java?rev=1144262&r1=1144261&r2=1144262&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/TransactionManager.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/TransactionManager.java Fri Jul  8 11:16:23 2011
@@ -37,9 +37,9 @@ public class TransactionManager
     {
     }
     
-    public Transaction createTransaction()
+    public Transaction createTransaction(DatasetGraphTDB dsg)
     {
-        Transaction txn = new Transaction(transactionId++, this) ;
+        Transaction txn = new Transaction(dsg, transactionId++, this) ;
         return txn ;
     }
     

Modified: incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/transaction/AbstractTestNodeTableTrans.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/transaction/AbstractTestNodeTableTrans.java?rev=1144262&r1=1144261&r2=1144262&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/transaction/AbstractTestNodeTableTrans.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/transaction/AbstractTestNodeTableTrans.java Fri Jul  8 11:16:23 2011
@@ -47,7 +47,7 @@ public abstract class AbstractTestNodeTa
     @Test public void nodetrans_01()
     {
         NodeTableTrans ntt = create() ;
-        Transaction txn = new Transaction(11, null) ; 
+        Transaction txn = new Transaction(null, 11, null) ; 
         ntt.begin(txn) ;
         ntt.abort(txn) ;
     }
@@ -58,7 +58,7 @@ public abstract class AbstractTestNodeTa
         NodeTableTrans ntt = create() ;
         NodeTable nt0 = ntt.getBaseNodeTable() ;
         
-        Transaction txn = new Transaction(11, null) ; 
+        Transaction txn = new Transaction(null, 11, null) ; 
         ntt.begin(txn) ;
         // Add a node
         NodeId nodeId = ntt.getAllocateNodeId(node1) ;
@@ -79,7 +79,7 @@ public abstract class AbstractTestNodeTa
         NodeTableTrans ntt = create() ;
         NodeTable nt0 = ntt.getBaseNodeTable() ;
         
-        Transaction txn = new Transaction(11, null) ; 
+        Transaction txn = new Transaction(null, 11, null) ; 
         ntt.begin(txn) ;
         // Add a node
         NodeId nodeId = ntt.getAllocateNodeId(node1) ;
@@ -99,7 +99,7 @@ public abstract class AbstractTestNodeTa
     {
         NodeTableTrans ntt = create(node1) ;
         NodeTable nt0 = ntt.getBaseNodeTable() ;
-        Transaction txn = new Transaction(11, null) ; 
+        Transaction txn = new Transaction(null, 11, null) ; 
         ntt.begin(txn) ;
         // Add a node
         NodeId nodeId = ntt.getAllocateNodeId(node2) ;

Modified: incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/transaction/AbstractTestObjectFileTrans.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/transaction/AbstractTestObjectFileTrans.java?rev=1144262&r1=1144261&r2=1144262&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/transaction/AbstractTestObjectFileTrans.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/transaction/AbstractTestObjectFileTrans.java Fri Jul  8 11:16:23 2011
@@ -34,7 +34,7 @@ public abstract class AbstractTestObject
     @Before
     public void setup()
     {
-        txn = new Transaction(++count, null) ;
+        txn = new Transaction(null, ++count, null) ;
         file1 = createFile("base") ;
         file2 = createFile("log") ;
     }

Modified: incubator/jena/Jena2/ARQ/trunk/src/org/openjena/atlas/lib/FileOps.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src/org/openjena/atlas/lib/FileOps.java?rev=1144262&r1=1144261&r2=1144262&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/src/org/openjena/atlas/lib/FileOps.java (original)
+++ incubator/jena/Jena2/ARQ/trunk/src/org/openjena/atlas/lib/FileOps.java Fri Jul  8 11:16:23 2011
@@ -8,6 +8,7 @@ package org.openjena.atlas.lib;
 
 import java.io.File ;
 
+import org.openjena.atlas.AtlasException ;
 import org.openjena.atlas.logging.Log ;
 
 public class FileOps
@@ -72,6 +73,14 @@ public class FileOps
         File f = new File(path) ;
         return f.exists() ; 
     }
+    
+    public static boolean isEmpty(String filename)
+    {
+        File f = new File(filename) ;
+        if ( f.exists() ) return true ;
+        if ( f.isFile() ) return f.length() == 0 ;
+        throw new AtlasException("Not a file") ;
+    }
 
     public static void ensureDir(String dirname)
     {

Modified: incubator/jena/Jena2/ARQ/trunk/update.ru
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/update.ru?rev=1144262&r1=1144261&r2=1144262&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/update.ru (original)
+++ incubator/jena/Jena2/ARQ/trunk/update.ru Fri Jul  8 11:16:23 2011
@@ -2,7 +2,8 @@ PREFIX rdf:    <http://www.w3.org/1999/0
 PREFIX xsd:    <http://www.w3.org/2001/XMLSchema#>
 PREFIX :       <http://example/>
 
-CREATE GRAPH <http://example/g5> ;
-
-INSERT DATA { GRAPH <http://example/g5> { :s :p :o } }
+INSERT DATA { GRAPH :graph1 {:x a :C } } ;
 
+WITH :graph1
+INSERT { :x99 a ?C }
+WHERE { ?x a ?C }