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/08/30 16:28:25 UTC
svn commit: r1163229 - in /incubator/jena/Experimental/TxTDB/trunk:
src-dev/tx/ src/main/java/com/hp/hpl/jena/tdb/base/file/
src/main/java/com/hp/hpl/jena/tdb/nodetable/
src/main/java/com/hp/hpl/jena/tdb/transaction/
Author: andy
Date: Tue Aug 30 14:28:24 2011
New Revision: 1163229
URL: http://svn.apache.org/viewvc?rev=1163229&view=rev
Log:
Use the storage memory for an in-memory object file (not an array of byte buffers). This is a more accurate simulation of a disk.
Modified:
incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/Report_JENA91.java
incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/FileFactory.java
incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableCache.java
incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableInline.java
incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableNative.java
incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableWrapper.java
incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/NodeTableTrans.java
Modified: incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/Report_JENA91.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/Report_JENA91.java?rev=1163229&r1=1163228&r2=1163229&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/Report_JENA91.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/Report_JENA91.java Tue Aug 30 14:28:24 2011
@@ -20,6 +20,7 @@ package tx;
import java.util.Iterator;
+import org.openjena.atlas.lib.FileOps ;
import org.openjena.atlas.lib.Pair;
import com.hp.hpl.jena.graph.Node;
@@ -32,7 +33,17 @@ import com.hp.hpl.jena.tdb.store.NodeId;
public class Report_JENA91 {
- private static StoreConnection sConn = StoreConnection.make(Location.mem()) ;
+ static Location LOC = Location.mem() ; // new Location("tmp/J91") ;
+
+ static {
+ if ( ! LOC.isMem() )
+ FileOps.clearDirectory(LOC.getDirectoryPath()) ;
+ }
+
+ // Make sure you have "false" in FileFactory.createObjectFileMem
+ // Later: go back and flip to get old mem specific failure.
+
+ private static StoreConnection sConn = StoreConnection.make(LOC) ;
private static Node g = Node.createURI("g") ;
private static Node s = Node.createURI("s") ;
private static Node p = Node.createURI("p") ;
@@ -47,22 +58,23 @@ public class Report_JENA91 {
DatasetGraphTxn dsgW1 = sConn.begin(ReadWrite.WRITE) ;
dsgW1.add(g, s, p, o1) ;
dsgW1.commit() ;
- // dumpNodeTable("W1", dsgW1) ;
- // dumpNodeTable("R1", dsgR1) ;
+ dumpNodeTable("W1", dsgW1) ;
+ dumpNodeTable("R1", dsgR1) ;
DatasetGraphTxn dsgW2 = sConn.begin(ReadWrite.WRITE) ;
dsgW2.add(g, s, p, o2) ;
dsgW2.commit() ;
- // dumpNodeTable("W2", dsgW2) ;
- // dumpNodeTable("R1", dsgR1) ;
+ dumpNodeTable("W2", dsgW2) ;
+ dumpNodeTable("R1", dsgR1) ;
DatasetGraphTxn dsgW3 = sConn.begin(ReadWrite.WRITE) ;
dsgW3.add(g, s, p, o3) ;
- // dumpNodeTable("W3", dsgW3) ;
- // dumpNodeTable("R1", dsgR1) ;
+ dumpNodeTable("W3", dsgW3) ;
+ dumpNodeTable("R1", dsgR1) ;
dsgW3.commit() ;
dsgR1.close() ;
+ System.out.println("DONE") ;
}
private static void dumpNodeTable (String label, DatasetGraphTxn dsg) {
@@ -71,6 +83,7 @@ public class Report_JENA91 {
System.out.println("---------------[ " + label + " ]---------------") ;
while ( iter.hasNext() ) { System.out.println(iter.next()) ; }
System.out.println("------------------------------------\n") ;
+ System.out.flush() ;
}
}
Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/FileFactory.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/FileFactory.java?rev=1163229&r1=1163228&r2=1163229&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/FileFactory.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/file/FileFactory.java Tue Aug 30 14:28:24 2011
@@ -28,7 +28,7 @@ public class FileFactory
public static ObjectFile createObjectFileMem()
{
- if ( true )
+ if ( false )
// Older code.
return new ObjectFileMem() ;
else
Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableCache.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableCache.java?rev=1163229&r1=1163228&r2=1163229&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableCache.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableCache.java Tue Aug 30 14:28:24 2011
@@ -192,6 +192,9 @@ public class NodeTableCache implements N
{
return baseTable.all() ;
}
+
+ @Override
+ public String toString() { return "Cache("+baseTable.toString()+")" ; }
}
/*
* (c) Copyright 2008, 2009 Hewlett-Packard Development Company, LP
Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableInline.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableInline.java?rev=1163229&r1=1163228&r2=1163229&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableInline.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableInline.java Tue Aug 30 14:28:24 2011
@@ -1,5 +1,6 @@
/*
* (c) Copyright 2009 Hewlett-Packard Development Company, LP
+ * (c) Copyright 2011 Epimorphics Ltd.
* All rights reserved.
* [See end of file]
*/
@@ -54,10 +55,14 @@ public class NodeTableInline extends Nod
return n ;
return super.getNodeForNodeId(id) ;
}
+
+ @Override
+ public String toString() { return "Inline("+nodeTable.toString()+")" ; }
}
/*
* (c) Copyright 2009 Hewlett-Packard Development Company, LP
+ * (c) Copyright 2011 Epimorphics Ltd.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableNative.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableNative.java?rev=1163229&r1=1163228&r2=1163229&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableNative.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableNative.java Tue Aug 30 14:28:24 2011
@@ -239,6 +239,9 @@ public class NodeTableNative implements
{
return objects;
}
+
+ @Override
+ public String toString() { return objects.getLabel() ; }
}
/*
* (c) Copyright 2008, 2009 Hewlett-Packard Development Company, LP
Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableWrapper.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableWrapper.java?rev=1163229&r1=1163228&r2=1163229&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableWrapper.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableWrapper.java Tue Aug 30 14:28:24 2011
@@ -18,7 +18,7 @@ import com.hp.hpl.jena.tdb.store.NodeId
public class NodeTableWrapper implements NodeTable
{
- private final NodeTable nodeTable ;
+ protected final NodeTable nodeTable ;
protected NodeTableWrapper(NodeTable nodeTable)
{
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=1163229&r1=1163228&r2=1163229&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 Tue Aug 30 14:28:24 2011
@@ -58,6 +58,8 @@ public class NodeTableTrans implements N
this.nodeIndex = nodeIndex ;
this.journal = journal ;
this.label = label ;
+ // Show the way tables are wired up
+ // log.info(String.format("NTT[%s #%s] %s", label, Integer.toHexString(hashCode()), sub)) ;
}
public void setPassthrough(boolean v) { passthrough = v ; }
@@ -146,7 +148,7 @@ public class NodeTableTrans implements N
Node node = x.getRight() ;
NodeId nodeId2 = base.getAllocateNodeId(node) ;
if ( ! nodeId2.equals(mapFromJournal(nodeId)) )
- throw new TDBException(String.format("Different ids allocated: expected %s, got %s\n", mapFromJournal(nodeId), nodeId2)) ;
+ throw new TDBException(String.format("Different ids for %s: allocated: expected %s, got %s\n", node, mapFromJournal(nodeId), nodeId2)) ;
}
}
@@ -229,7 +231,7 @@ public class NodeTableTrans implements N
}
@Override
- public String toString() { return "NodeTableTrans:"+label ; }
+ public String toString() { return "NodeTableTrans:"+label+"(#"+Integer.toHexString(super.hashCode())+")" ; }
private void debug(String fmt, Object... args)
{