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 2017/06/27 07:41:26 UTC

[1/2] jena git commit: Improvements to TDB internal tools

Repository: jena
Updated Branches:
  refs/heads/master 107bd57f2 -> 0fb71223c


Improvements to TDB internal tools

Dump node table without causing a journal recovery.
Expand the range of BPTs dumpbpt can cope with. 

Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/beb52d4d
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/beb52d4d
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/beb52d4d

Branch: refs/heads/master
Commit: beb52d4d2dcb01e46b6284b9af3e3f95b0a6ee05
Parents: 107bd57
Author: Andy Seaborne <an...@apache.org>
Authored: Mon Jun 26 18:01:28 2017 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Mon Jun 26 18:02:18 2017 +0100

----------------------------------------------------------------------
 jena-cmds/src/main/java/tdb/tools/dumpbpt.java  |  34 +++-
 .../src/main/java/tdb/tools/dumpjournal.java    |  81 ++++++++
 .../src/main/java/tdb/tools/dumpnodetable.java  |  68 +++----
 .../src/main/java/tdb/tools/dumpnodetable1.java | 184 +++++++++++++++++++
 .../jena/tdb/transaction/JournalControl.java    |  17 +-
 .../jena/tdb/transaction/JournalEntry.java      |  19 +-
 6 files changed, 354 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/beb52d4d/jena-cmds/src/main/java/tdb/tools/dumpbpt.java
----------------------------------------------------------------------
diff --git a/jena-cmds/src/main/java/tdb/tools/dumpbpt.java b/jena-cmds/src/main/java/tdb/tools/dumpbpt.java
index 269150e..611c7b2 100644
--- a/jena-cmds/src/main/java/tdb/tools/dumpbpt.java
+++ b/jena-cmds/src/main/java/tdb/tools/dumpbpt.java
@@ -22,7 +22,9 @@ import java.io.PrintStream ;
 import java.util.Arrays ;
 import java.util.Iterator ;
 import java.util.List ;
+import java.util.Objects ;
 
+import org.apache.jena.atlas.lib.Bytes ;
 import org.apache.jena.atlas.lib.Lib ;
 import org.apache.jena.atlas.lib.tuple.Tuple ;
 import org.apache.jena.atlas.logging.LogCtl ;
@@ -84,19 +86,37 @@ public class dumpbpt extends CmdARQ {
         // The name is the order.
         for ( String indexName : super.getPositional() ) {
             String primary ;
+            
             if ( indexName.length() == 3 ) {
                 primary = Names.primaryIndexTriples ;
             } else if ( indexName.length() == 4 ) {
                 primary = Names.primaryIndexQuads ;
+            } else if ( Objects.equals(indexName, Names.indexNode2Id) ) {
+                primary = Names.indexNode2Id;
             } else {
                 cmdError("Wrong length: " + indexName) ;
                 primary = null ;
             }
+            
+            //prefix2id
+            //prefixIdx : GPU
 
             int keySubLen = SystemTDB.SizeOfNodeId ;
             int keyUnitLen = indexName.length() ;
             int keyLength = keySubLen * keyUnitLen ;
             int valueLength = 0 ;
+            
+            // Node table indexes.
+            if ( Objects.equals(indexName, Names.indexNode2Id) || Objects.equals(indexName, Names.prefixNode2Id) ) {
+                keySubLen = SystemTDB.LenNodeHash;
+                keyUnitLen = 1 ;
+                keyLength = SystemTDB.LenNodeHash;
+                valueLength = SystemTDB.SizeOfNodeId;
+            }
+            // Prefixes
+            if ( Objects.equals(indexName, Names.indexPrefix) ) {
+                primary = Names.primaryIndexPrefix;
+            }
 
             RecordFactory rf = new RecordFactory(keyLength, valueLength) ;
             RangeIndex rIndex = IndexFactory.buildRangeIndex(loc, indexName, rf) ;
@@ -105,6 +125,7 @@ public class dumpbpt extends CmdARQ {
             if ( false ) {
                 System.out.println("---- Index structure") ;
                 bpt.dump() ;
+                
             }
             if ( true ) {
                 System.out.println("---- Index contents") ;
@@ -168,11 +189,20 @@ public class dumpbpt extends CmdARQ {
             // Print in chunks
             int k = i * keySubLen ;
             for ( int j = k ; j < k + keySubLen ; j++ )
-                out.printf("%02x", r.getKey()[j]) ;
+                out.printf("%02X", r.getKey()[j]) ;
 
             // long x = Bytes.getLong(r.getKey(), i*SystemTDB.SizeOfNodeId) ;
-            // System.out.printf("%016x", x) ;
+            // System.out.printf("%016X", x) ;
+        }
+        
+        if ( r.getValue() != null &&  r.getValue().length != 0 ) {
+            out.print(" -> ");
+            String s = Bytes.asHexUC(r.getValue());
+            out.print(s);
         }
+
+
+        
         out.println() ;
     }
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/beb52d4d/jena-cmds/src/main/java/tdb/tools/dumpjournal.java
----------------------------------------------------------------------
diff --git a/jena-cmds/src/main/java/tdb/tools/dumpjournal.java b/jena-cmds/src/main/java/tdb/tools/dumpjournal.java
new file mode 100644
index 0000000..1f3b110
--- /dev/null
+++ b/jena-cmds/src/main/java/tdb/tools/dumpjournal.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tdb.tools ;
+
+import java.io.PrintStream ;
+
+import arq.cmdline.CmdARQ;
+import jena.cmd.CmdException ;
+import org.apache.jena.atlas.lib.Lib ;
+import org.apache.jena.atlas.logging.LogCtl ;
+import org.apache.jena.tdb.base.file.Location ;
+import org.apache.jena.tdb.transaction.Journal ;
+import org.apache.jena.tdb.transaction.JournalControl ;
+import tdb.cmdline.ModLocation ;
+
+public class dumpjournal extends CmdARQ {
+    ModLocation modLocation = new ModLocation() ;
+
+    static public void main(String... argv) {
+        LogCtl.setLog4j() ;
+        new dumpjournal(argv).mainRun() ;
+    }
+
+    protected dumpjournal(String[] argv) {
+        super(argv) ;
+        super.addModule(modLocation) ;
+    }
+
+    @Override
+    protected void exec() {
+        Location loc = modLocation.getLocation() ;
+        Journal journal =  determineJournal(loc);
+        dump(System.out, journal) ;
+    }
+    
+    private void dump(PrintStream out, Journal journal) {
+        JournalControl.print(journal);
+    }
+
+    private Journal determineJournal(Location loc) {
+        // Directly open the jounral.
+        if ( ! Journal.exists(loc) )
+            throw new CmdException("No journal file in "+loc);
+        return Journal.create(loc); 
+    }
+
+    @Override
+    protected void processModulesAndArgs() {
+        if ( modVersion.getVersionFlag() )
+            modVersion.printVersionAndExit() ;
+        if ( modLocation.getLocation() == null )
+            cmdError("Location required") ;
+    }
+
+    @Override
+    protected String getSummary() {
+        return getCommandName() + " --loc=DIR IndexName" ;
+    }
+
+    @Override
+    protected String getCommandName() {
+        return Lib.className(this) ;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/beb52d4d/jena-cmds/src/main/java/tdb/tools/dumpnodetable.java
----------------------------------------------------------------------
diff --git a/jena-cmds/src/main/java/tdb/tools/dumpnodetable.java b/jena-cmds/src/main/java/tdb/tools/dumpnodetable.java
index 31f6309..c163e8d 100644
--- a/jena-cmds/src/main/java/tdb/tools/dumpnodetable.java
+++ b/jena-cmds/src/main/java/tdb/tools/dumpnodetable.java
@@ -19,11 +19,13 @@
 package tdb.tools ;
 
 import java.io.OutputStream ;
-import java.util.Arrays ;
+import java.nio.ByteBuffer ;
 import java.util.Iterator ;
-import java.util.List ;
+import java.util.function.Function ;
 
+import arq.cmdline.CmdARQ;
 import org.apache.jena.atlas.io.IndentedWriter ;
+import org.apache.jena.atlas.iterator.Iter ;
 import org.apache.jena.atlas.lib.Lib ;
 import org.apache.jena.atlas.lib.Pair ;
 import org.apache.jena.atlas.logging.Log ;
@@ -31,16 +33,14 @@ import org.apache.jena.atlas.logging.LogCtl ;
 import org.apache.jena.graph.Node ;
 import org.apache.jena.graph.Node_Literal ;
 import org.apache.jena.sparql.util.FmtUtils ;
-import org.apache.jena.tdb.StoreConnection ;
+import org.apache.jena.tdb.base.file.FileFactory ;
+import org.apache.jena.tdb.base.file.FileSet ;
 import org.apache.jena.tdb.base.file.Location ;
-import org.apache.jena.tdb.setup.Build ;
-import org.apache.jena.tdb.store.DatasetGraphTDB ;
+import org.apache.jena.tdb.base.objectfile.ObjectFile ;
+import org.apache.jena.tdb.lib.NodeLib ;
+import org.apache.jena.tdb.setup.StoreParams ;
 import org.apache.jena.tdb.store.NodeId ;
-import org.apache.jena.tdb.store.nodetable.NodeTable ;
 import org.apache.jena.tdb.sys.Names ;
-import org.apache.jena.tdb.sys.SystemTDB ;
-
-import arq.cmdline.CmdARQ;
 import tdb.cmdline.ModLocation ;
 
 public class dumpnodetable extends CmdARQ {
@@ -53,14 +53,20 @@ public class dumpnodetable extends CmdARQ {
 
     @Override
     protected void exec() {
-        List<String> tripleIndexes = Arrays.asList(Names.tripleIndexes) ;
-        List<String> quadIndexes = Arrays.asList(Names.quadIndexes) ;
         Location loc = modLocation.getLocation() ;
 
-        StoreConnection sConn = StoreConnection.make(loc) ;
-        DatasetGraphTDB dsg = sConn.getBaseDataset() ;
-        NodeTable nodeTable = dsg.getQuadTable().getNodeTupleTable().getNodeTable() ;
-        dump(System.out, nodeTable) ;
+        ObjectFile objFile = determineNodeTable(loc);
+        dump(System.out, objFile) ;
+    }
+    
+    private ObjectFile determineNodeTable(Location loc) {
+        // Directly open the nodes.dat file.
+        StoreParams storeParams = StoreParams.getDftStoreParams();
+        FileSet fsId2Node = new FileSet(loc, storeParams.getIndexId2Node()) ;
+        
+        String file = fsId2Node.filename(Names.extNodeData);
+        ObjectFile objFile = FileFactory.createObjectFileDisk(file);
+        return objFile;
     }
 
     protected dumpnodetable(String[] argv) {
@@ -68,26 +74,22 @@ public class dumpnodetable extends CmdARQ {
         super.addModule(modLocation) ;
     }
 
-    public static void dumpNodes(OutputStream w, String location) {
-        dump(w, location, Names.indexNode2Id, SystemTDB.Node2NodeIdCacheSize, Names.indexId2Node, SystemTDB.NodeId2NodeCacheSize,
-             SystemTDB.NodeMissCacheSize) ;
-    }
-
-    public static void dumpPrefixes(OutputStream w, String location) {
-        dump(w, location, Names.prefixNode2Id, 100, Names.prefixId2Node, 100, 10) ;
+    // Taken from NodeTableNative.
+    private static Iterator<Pair<NodeId, Node>> all(ObjectFile objFile)
+    {
+        Iterator<Pair<Long, ByteBuffer>> objs = objFile.all() ; 
+        Function<Pair<Long, ByteBuffer>, Pair<NodeId, Node>> transform = item -> {
+            NodeId id = NodeId.create(item.car().longValue());
+            ByteBuffer bb = item.cdr();
+            Node n = NodeLib.decode(bb);
+            return new Pair<>(id, n);
+        };
+        return Iter.map(objs, transform) ;
     }
-
-    public static void dump(OutputStream w, String location, String indexNode2Id, int node2NodeIdCacheSize, String indexId2Node,
-                            int nodeId2NodeCacheSize, //
-
-                            int sizeNodeMissCacheSize) {
-        NodeTable nodeTable = Build.makeNodeTable(Location.create(location), indexNode2Id, node2NodeIdCacheSize, indexId2Node,
-                                                  nodeId2NodeCacheSize, sizeNodeMissCacheSize) ;
-    }
-
-    public static void dump(OutputStream w, NodeTable nodeTable) {
+    
+    public static void dump(OutputStream w, ObjectFile objFile) {
         // Better to hack the indexes?
-        Iterator<Pair<NodeId, Node>> iter = nodeTable.all() ;
+        Iterator<Pair<NodeId, Node>> iter = all(objFile) ;
         long count = 0 ;
         try (IndentedWriter iw = new IndentedWriter(w)) {
             for ( ; iter.hasNext() ; ) {

http://git-wip-us.apache.org/repos/asf/jena/blob/beb52d4d/jena-cmds/src/main/java/tdb/tools/dumpnodetable1.java
----------------------------------------------------------------------
diff --git a/jena-cmds/src/main/java/tdb/tools/dumpnodetable1.java b/jena-cmds/src/main/java/tdb/tools/dumpnodetable1.java
new file mode 100644
index 0000000..05f6da2
--- /dev/null
+++ b/jena-cmds/src/main/java/tdb/tools/dumpnodetable1.java
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tdb.tools ;
+
+import java.io.OutputStream ;
+import java.util.Iterator ;
+
+import arq.cmdline.CmdARQ;
+import org.apache.jena.atlas.io.IndentedWriter ;
+import org.apache.jena.atlas.lib.Lib ;
+import org.apache.jena.atlas.lib.Pair ;
+import org.apache.jena.atlas.logging.Log ;
+import org.apache.jena.atlas.logging.LogCtl ;
+import org.apache.jena.graph.Node ;
+import org.apache.jena.graph.Node_Literal ;
+import org.apache.jena.sparql.util.FmtUtils ;
+import org.apache.jena.tdb.StoreConnection ;
+import org.apache.jena.tdb.base.file.Location ;
+import org.apache.jena.tdb.setup.Build ;
+import org.apache.jena.tdb.store.DatasetGraphTDB ;
+import org.apache.jena.tdb.store.NodeId ;
+import org.apache.jena.tdb.store.nodetable.NodeTable ;
+import org.apache.jena.tdb.sys.Names ;
+import org.apache.jena.tdb.sys.SystemTDB ;
+import tdb.cmdline.ModLocation ;
+
+public class dumpnodetable1 extends CmdARQ {
+    ModLocation modLocation = new ModLocation() ;
+
+    static public void main(String... argv) {
+        LogCtl.setLog4j() ;
+        new dumpnodetable1(argv).mainRun() ;
+    }
+
+    @Override
+    protected void exec() {
+        Location loc = modLocation.getLocation() ;
+        NodeTable nodeTable = determineNodeTable(loc);
+        dump(System.out, nodeTable) ;
+    }
+    
+
+
+    private NodeTable determineNodeTable(Location loc) {
+        // Causes recovery.
+        StoreConnection sConn = StoreConnection.make(loc) ;
+        DatasetGraphTDB dsg = sConn.getBaseDataset() ;
+        NodeTable nodeTable = dsg.getQuadTable().getNodeTupleTable().getNodeTable() ;
+        return nodeTable;
+    }
+
+    protected dumpnodetable1(String[] argv) {
+        super(argv) ;
+        super.addModule(modLocation) ;
+    }
+
+    public static void dumpNodes(OutputStream w, String location) {
+        dump(w, location, Names.indexNode2Id, SystemTDB.Node2NodeIdCacheSize, Names.indexId2Node, SystemTDB.NodeId2NodeCacheSize,
+             SystemTDB.NodeMissCacheSize) ;
+    }
+
+    public static void dumpPrefixes(OutputStream w, String location) {
+        dump(w, location, Names.prefixNode2Id, 100, Names.prefixId2Node, 100, 10) ;
+    }
+
+    public static void dump(OutputStream w, String location, String indexNode2Id, int node2NodeIdCacheSize, String indexId2Node,
+                            int nodeId2NodeCacheSize, //
+
+                            int sizeNodeMissCacheSize) {
+        NodeTable nodeTable = Build.makeNodeTable(Location.create(location), indexNode2Id, node2NodeIdCacheSize, indexId2Node,
+                                                  nodeId2NodeCacheSize, sizeNodeMissCacheSize) ;
+    }
+
+    public static void dump(OutputStream w, NodeTable nodeTable) {
+        // Better to hack the indexes?
+        Iterator<Pair<NodeId, Node>> iter = nodeTable.all() ;
+        long count = 0 ;
+        try (IndentedWriter iw = new IndentedWriter(w)) {
+            for ( ; iter.hasNext() ; ) {
+                Pair<NodeId, Node> pair = iter.next() ;
+                iw.print(pair.car().toString()) ;
+                iw.print(" : ") ;
+                // iw.print(pair.cdr()) ;
+                Node n = pair.cdr() ;
+                String $ = stringForNode(n) ;
+                iw.print($) ;
+                iw.println() ;
+                count++ ;
+            }
+            iw.println() ;
+            iw.printf("Total: " + count) ;
+            iw.println() ;
+            iw.flush() ;
+        }
+    }
+
+    private static String stringForNode(Node n) {
+        if ( n == null )
+            return "<<null>>" ;
+
+        if ( n.isBlank() )
+            return "_:" + n.getBlankNodeLabel() ;
+
+        if ( n.isLiteral() )
+            return stringForLiteral((Node_Literal)n) ;
+
+        if ( n.isURI() ) {
+            String uri = n.getURI() ;
+            return stringForURI(uri) ;
+        }
+
+        if ( n.isVariable() )
+            return "?" + n.getName() ;
+
+        if ( n.equals(Node.ANY) )
+            return "ANY" ;
+
+        Log.warn(FmtUtils.class, "Failed to turn a node into a string: " + n) ;
+        return n.toString() ;
+    }
+
+    public static String stringForURI(String uri) {
+        return "<" + uri + ">" ;
+    }
+
+    public static String stringForLiteral(Node_Literal literal) {
+        String datatype = literal.getLiteralDatatypeURI() ;
+        String lang = literal.getLiteralLanguage() ;
+        String s = literal.getLiteralLexicalForm() ;
+
+        StringBuilder sbuff = new StringBuilder() ;
+        sbuff.append("\"") ;
+        FmtUtils.stringEsc(sbuff, s, true) ;
+        sbuff.append("\"") ;
+
+        // Format the language tag
+        if ( lang != null && lang.length() > 0 ) {
+            sbuff.append("@") ;
+            sbuff.append(lang) ;
+        }
+
+        if ( datatype != null ) {
+            sbuff.append("^^") ;
+            sbuff.append(stringForURI(datatype)) ;
+        }
+
+        return sbuff.toString() ;
+    }
+
+    @Override
+    protected void processModulesAndArgs() {
+        if ( modVersion.getVersionFlag() )
+            modVersion.printVersionAndExit() ;
+        if ( modLocation.getLocation() == null )
+            cmdError("Location required") ;
+    }
+
+    @Override
+    protected String getSummary() {
+        return getCommandName() + " --loc=DIR IndexName" ;
+    }
+
+    @Override
+    protected String getCommandName() {
+        return Lib.className(this) ;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/beb52d4d/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/JournalControl.java
----------------------------------------------------------------------
diff --git a/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/JournalControl.java b/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/JournalControl.java
index ec9b5fa..a2282c6 100644
--- a/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/JournalControl.java
+++ b/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/JournalControl.java
@@ -66,10 +66,16 @@ public class JournalControl
         System.out.println("Size: "+journal.size()) ;
         Iterator<JournalEntry> iter = journal.entries() ; 
         
-        for (  ; iter.hasNext() ; )
+        for ( ; ; )
         {
+            long posn0 = journal.position();
+            if ( ! iter.hasNext() )
+                break;
             JournalEntry e = iter.next() ;
-            System.out.println("Posn: "+journal.position()+" : ("+(journal.size()-journal.position())+")") ;
+            long posn1 = journal.position();
+            long size = posn1 - posn0;
+            System.out.printf("Posn: (%d, %d) Len=%d  reverse %d\n", posn0, posn1, size, (journal.size()-journal.position())) ;
+            System.out.print("  ");
             System.out.println(JournalEntry.format(e)) ;
         }
     }
@@ -137,11 +143,12 @@ public class JournalControl
             recoverSegment(jrnl, posn, x, sConf) ;
             posn = x ;
         }
-
+        
+        // Sync database.
+        syncAll(sConf) ;
         // We have replayed the journals - clean up.
         jrnl.truncate(0) ;
         jrnl.sync() ;
-        syncAll(sConf) ;
         return true ;
     }
 
@@ -170,6 +177,8 @@ public class JournalControl
      */
     private static void recoverSegment(Journal jrnl, long startPosn, long endPosn, StorageConfig sConf)
     {
+        //System.out.printf("Segment: %d %d\n", startPosn, endPosn);
+        
         Iterator<JournalEntry> iter = jrnl.entries(startPosn) ;
         iter = jrnl.entries(startPosn) ;
         try {

http://git-wip-us.apache.org/repos/asf/jena/blob/beb52d4d/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/JournalEntry.java
----------------------------------------------------------------------
diff --git a/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/JournalEntry.java b/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/JournalEntry.java
index 7f9a532..8b1b021 100644
--- a/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/JournalEntry.java
+++ b/jena-tdb/src/main/java/org/apache/jena/tdb/transaction/JournalEntry.java
@@ -88,16 +88,15 @@ public class JournalEntry
 
     static public String format(JournalEntryType type, ByteBuffer byteBuffer, Block block, FileRef fileRef)
     {
-        StringBuilder sbuff = new StringBuilder() ;
-        
-        sbuff.append("Entry: \n") ;
-        if ( byteBuffer != null )
-            sbuff.append("  "+byteBuffer) ;
-        if ( block != null )
-            sbuff.append("  "+block) ;
-        sbuff.append("  "+fileRef) ;
-        sbuff.append("  "+type) ;
-        return sbuff.toString() ;
+        return String.format("Entry: %-6s  blk=%d  %s", type, block.getId(), fileRef.getFilename());
+//        StringBuilder sbuff = new StringBuilder() ;
+//        sbuff.append("Entry: "+type+"\n") ;
+//        if ( byteBuffer != null )
+//            sbuff.append("  "+byteBuffer) ;
+//        if ( block != null )
+//            sbuff.append("  "+block) ;
+//        sbuff.append("  "+fileRef) ;
+//        return sbuff.toString() ;
     }
 
 }


[2/2] jena git commit: Fix error message

Posted by an...@apache.org.
Fix error message

Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/0fb71223
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/0fb71223
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/0fb71223

Branch: refs/heads/master
Commit: 0fb71223ca22b266df07d691e46cdef5ebcec259
Parents: beb52d4
Author: Andy Seaborne <an...@apache.org>
Authored: Mon Jun 26 18:03:41 2017 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Mon Jun 26 18:03:41 2017 +0100

----------------------------------------------------------------------
 .../main/java/org/apache/jena/tdb/setup/DatasetBuilderStd.java   | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/0fb71223/jena-tdb/src/main/java/org/apache/jena/tdb/setup/DatasetBuilderStd.java
----------------------------------------------------------------------
diff --git a/jena-tdb/src/main/java/org/apache/jena/tdb/setup/DatasetBuilderStd.java b/jena-tdb/src/main/java/org/apache/jena/tdb/setup/DatasetBuilderStd.java
index cc6b77f..1319e0e 100644
--- a/jena-tdb/src/main/java/org/apache/jena/tdb/setup/DatasetBuilderStd.java
+++ b/jena-tdb/src/main/java/org/apache/jena/tdb/setup/DatasetBuilderStd.java
@@ -246,12 +246,10 @@ public class DatasetBuilderStd implements DatasetBuilder {
 
         TupleIndex prefixIndexes[] = makeTupleIndexes(location, primary, indexes, new String[]{params.getIndexPrefix()}, params) ;
         if ( prefixIndexes.length != 1 )
-            error(log, "Wrong number of triple table tuples indexes: " + prefixIndexes.length) ;
+            error(log, "Wrong number of prefix table tuples indexes: " + prefixIndexes.length) ;
 
         String pnNode2Id = params.getPrefixNode2Id() ;
         String pnId2Node = params.getPrefixId2Node() ;
-
-        
         
         // No cache - the prefix mapping is a cache
         NodeTable prefixNodes = makeNodeTableNoCache(location, pnNode2Id, pnId2Node, params) ;