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/11/20 21:12:59 UTC

svn commit: r1204230 - /incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/NodeTableTrans.java

Author: andy
Date: Sun Nov 20 20:12:59 2011
New Revision: 1204230

URL: http://svn.apache.org/viewvc?rev=1204230&view=rev
Log:
Add some debug assist code

Modified:
    incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/NodeTableTrans.java

Modified: incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/NodeTableTrans.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/NodeTableTrans.java?rev=1204230&r1=1204229&r2=1204230&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/NodeTableTrans.java (original)
+++ incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/NodeTableTrans.java Sun Nov 20 20:12:59 2011
@@ -175,10 +175,38 @@ public class NodeTableTrans implements N
             // This does the write.
             NodeId nodeId2 = base.getAllocateNodeId(node) ;
             if ( ! nodeId2.equals(mapFromJournal(nodeId)) )
-                throw new TDBException(String.format("Different ids for %s: allocated: expected %s, got %s", node, mapFromJournal(nodeId), nodeId2)) ; 
+            {
+                String msg = String.format("Different ids for %s: allocated: expected %s, got %s", node, mapFromJournal(nodeId), nodeId2) ;
+                System.err.println() ;
+                System.err.println() ;
+                System.err.println(msg) ;
+                dump() ;   
+                System.err.println() ;
+                throw new TDBException(msg) ;
+            }
         }
     }
     
+    private void dump()
+    {
+        System.err.println("label = "+label) ;
+        System.err.println("txn = "+txn) ;
+        System.err.println("offset = "+offset) ;
+        
+        Iterator<Pair<NodeId, Node>> iter = nodeTableJournal.all() ;
+        for ( ; iter.hasNext() ; )
+        {
+            Pair<NodeId, Node> x = iter.next() ;
+            NodeId nodeId = x.getLeft() ;
+            Node node = x.getRight() ;
+            NodeId mapped = mapFromJournal(nodeId) ;
+            //debug("append: %s -> %s", x, mapFromJournal(nodeId)) ;
+            // This does the write.
+            NodeId nodeId2 = base.getAllocateNodeId(node) ;
+            System.err.println(x + "  mapped=" + mapped + " getAlloc="+nodeId2) ;
+        }                
+    }
+    
     @Override
     public void commitPrepare(Transaction txn)
     {