jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1137401 - in /incubator/jena/Experimental/TxTDB/trunk: ./ src-dev/tx/ src/main/java/com/hp/hpl/jena/tdb/base/block/ src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ src/main/java/com/hp/hpl/jena/tdb/base/page/ src/main/java/com/hp/hpl/je...
Date Sun, 19 Jun 2011 18:25:13 GMT
Author: andy
Date: Sun Jun 19 18:25:13 2011
New Revision: 1137401

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

Added:
    incubator/jena/Experimental/TxTDB/trunk/D1.ttl   (with props)
    incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileLogger.java
  (with props)
    incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableLogger.java
  (with props)
Modified:
    incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/DevTx.java
    incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/TxMain.java
    incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/block/Block.java
    incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFile.java
    incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileStorage.java
    incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/page/Page.java
    incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/page/PageBase.java
    incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/page/PageBlockMgr.java
    incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/recordbuffer/RecordBufferPage.java
    incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/recordbuffer/RecordBufferPageBase.java
    incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/bplustree/BPTreeNode.java
    incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/bplustree/BPTreeNodeMgr.java
    incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/bplustree/BPTreeRecords.java
    incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/ext/HashBucket.java
    incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/store/bulkloader2/CmdNodeTableBuilder.java
    incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/store/bulkloader2/RecordsFromInput.java
    incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/BlockMgrJournal.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/ObjectFileTrans.java
    incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/transaction/AbstractTestObjectFileTrans.java

Added: incubator/jena/Experimental/TxTDB/trunk/D1.ttl
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/D1.ttl?rev=1137401&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/jena/Experimental/TxTDB/trunk/D1.ttl
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

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=1137401&r1=1137400&r2=1137401&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/DevTx.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/DevTx.java Sun Jun 19 18:25:13 2011
@@ -7,6 +7,13 @@ public class DevTx
     
     // Delete BlockMgrFile.
     
+    // Config
+    //   One config file?
+    //   Cache sizes
+    //   Index names
+    //   Length of NodeId?
+    //   Setting of content properties.
+    
     // Building a dataset.
     //   Commit and reply?
     //   Reattach a journal?

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=1137401&r1=1137400&r2=1137401&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/TxMain.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src-dev/tx/TxMain.java Sun Jun 19 18:25:13 2011
@@ -22,7 +22,6 @@ import org.openjena.atlas.logging.Log ;
 import org.openjena.atlas.test.Gen ;
 import org.slf4j.Logger ;
 import org.slf4j.LoggerFactory ;
-import setup.DatasetBuilder ;
 import tx.base.FileRef ;
 
 import com.hp.hpl.jena.query.DatasetFactory ;
@@ -106,19 +105,22 @@ public class TxMain
 
         //SystemTDB.setFileMode(FileMode.direct) ;
         DatasetGraphTDB dsg0 = build() ;
-        load("D.ttl", dsg0) ;
-        query("SELECT * { ?s ?p ?o }", dsg0) ;
-//        exit(0) ;
-        
-        dsg0.sync() ;
+//        load("D.ttl", dsg0) ;
+//        query("SELECT * { ?s ?p ?o }", dsg0) ;
+////        exit(0) ;
+//        dsg0.sync() ;
         
         System.out.println("Txn") ;
         DatasetGraphTxnTDB dsg = buildTx(dsg0) ;
-        //load("D.ttl", dsg) ;
+        load("D.ttl", dsg) ;
+        
         //dsg.commit() ;
         //query("SELECT (Count(*) AS ?c) { ?s ?p ?o }", dsg) ;
         System.out.println("Query 1") ;
         query("SELECT * { ?s ?p ?o }", dsg) ;
+        
+        exit(0) ;
+        
         //query("SELECT * { ?s ?p ?o }", dsg0) ;
 
         load("D1.ttl", dsg0) ;

Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/block/Block.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/block/Block.java?rev=1137401&r1=1137400&r2=1137401&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/block/Block.java
(original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/block/Block.java
Sun Jun 19 18:25:13 2011
@@ -95,7 +95,7 @@ public final class Block
     public String toString()
     {
         ByteBuffer bb = getByteBuffer() ;
-        return String.format("Block: %d  : (posn=%d, limit=%d, cap=%d)", id, bb.position(),
bb.limit(), bb.capacity()) ;
+        return String.format("Block: %d (posn=%d, limit=%d, cap=%d)", id, bb.position(),
bb.limit(), bb.capacity()) ;
     }
     
     /** Deep copy, including ByteBuffer contents. */

Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFile.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFile.java?rev=1137401&r1=1137400&r2=1137401&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFile.java
(original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFile.java
Sun Jun 19 18:25:13 2011
@@ -48,6 +48,9 @@ public interface ObjectFile extends Sync
     
     /** All the bytebuffers - debugging aid */
     public Iterator<Pair<Long, ByteBuffer>> all() ;
+    
+//    /** return a useful short display string */ 
+//    public String getLabel() ;
 }
 
 /*

Added: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileLogger.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileLogger.java?rev=1137401&view=auto
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileLogger.java
(added)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileLogger.java
Sun Jun 19 18:25:13 2011
@@ -0,0 +1,128 @@
+/*
+ * (c) Copyright 2011 Epimorphics Ltd.
+ * All rights reserved.
+ * [See end of file]
+ */
+
+package com.hp.hpl.jena.tdb.base.objectfile;
+
+import java.nio.ByteBuffer ;
+import java.util.Iterator ;
+
+import org.openjena.atlas.lib.Pair ;
+import org.slf4j.Logger ;
+import org.slf4j.LoggerFactory ;
+
+import com.hp.hpl.jena.tdb.base.block.Block ;
+
+public class ObjectFileLogger implements ObjectFile
+{
+    protected final ObjectFile other ;
+    private static Logger defaultLogger = LoggerFactory.getLogger(ObjectFile.class) ; 
+    private final Logger log ;
+    private final String label  ;
+
+    public ObjectFileLogger(String label, ObjectFile other)
+    {
+        this.other = other ;
+        this.label = label ;
+        log = defaultLogger ;
+    }
+
+    @Override
+    public Block allocWrite(int maxBytes)
+    {
+        Block blk = other.allocWrite(maxBytes) ;
+        info("allocWrite("+maxBytes+") -> "+blk.getId()) ;
+        return blk ;
+    }
+
+    @Override
+    public void completeWrite(Block buffer)
+    {
+        info("completeWrite("+buffer.getId()+")") ;
+        other.completeWrite(buffer) ;
+    }
+
+    @Override
+    public long write(ByteBuffer buffer)
+    {
+        info("write"+buffer) ;
+        return other.write(buffer) ;
+    }
+
+    @Override
+    public void reposition(long id)
+    {
+        info("reposition("+id+")") ;
+        other.reposition(id) ;
+    }
+
+    @Override
+    public ByteBuffer read(long id)
+    {
+        info("read("+id+")") ;
+        return other.read(id) ;
+    }
+
+    @Override
+    public Iterator<Pair<Long, ByteBuffer>> all()
+    {
+        info("all()") ;
+        return other.all() ;
+    }
+
+    @Override
+    public void sync()
+    {
+        info("sync") ;
+        other.sync() ;
+    }
+
+    @Override
+    public void close()
+    {
+        info("close") ;
+        other.close() ;
+    }
+
+    @Override
+    public long length()
+    {
+        info("") ;
+        return other.length() ;
+    }
+    
+    private void info(String string)
+    {
+        if ( label != null )
+            string = label+": "+string ;
+        log.info(string) ; 
+    }
+}
+/*
+ * (c) Copyright 2011 Epimorphics Ltd.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
\ No newline at end of file

Propchange: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileLogger.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileStorage.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileStorage.java?rev=1137401&r1=1137400&r2=1137401&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileStorage.java
(original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/objectfile/ObjectFileStorage.java
Sun Jun 19 18:25:13 2011
@@ -214,7 +214,7 @@ public class ObjectFileStorage implement
         
         // Maybe it's in the in the write buffer.
         // Maybe the write buffer should keep more structure? 
-        if ( loc >= filesize )
+        if ( loc > filesize )
         {
             if ( loc >= filesize+writeBuffer.position() )
                 throw new IllegalArgumentException("ObjectFile.read: Bad read: "+loc) ;

Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/page/Page.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/page/Page.java?rev=1137401&r1=1137400&r2=1137401&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/page/Page.java
(original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/page/Page.java
Sun Jun 19 18:25:13 2011
@@ -19,6 +19,11 @@ public interface Page extends Printable
     
     /** Return the block associated with this page */ 
     public Block getBackingBlock() ;
+    
+    /** The underlying block for this page has changed (e.g. it's been promoted and 
+     * the promotion may have caused something to chnage */ 
+    public abstract void reset(Block block) ;
+
 }
 
 /*

Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/page/PageBase.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/page/PageBase.java?rev=1137401&r1=1137400&r2=1137401&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/page/PageBase.java
(original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/page/PageBase.java
Sun Jun 19 18:25:13 2011
@@ -28,6 +28,9 @@ public abstract class PageBase implement
     }
     
     @Override
+    public abstract void reset(Block block) ;
+
+    @Override
     final public Block getBackingBlock()    { return block ; }
 
     @Override

Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/page/PageBlockMgr.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/page/PageBlockMgr.java?rev=1137401&r1=1137400&r2=1137401&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/page/PageBlockMgr.java
(original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/page/PageBlockMgr.java
Sun Jun 19 18:25:13 2011
@@ -100,9 +100,15 @@ public class PageBlockMgr<T extends Page
     
     public void promote(Page page)
     { 
+        // Replace, reset Block in page.
         Block block = page.getBackingBlock() ;
-        blockMgr.promote(block) ;
-        block.setModified(true) ;
+        Block block2 = blockMgr.promote(block) ;
+        if ( block2 != block )
+        {        
+            block2.setModified(true) ;
+            // Change - reset Block in page.
+            page.reset(block2) ;
+        }
     }
     
     public boolean valid(int id)        { return blockMgr.valid(id) ; }

Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/recordbuffer/RecordBufferPage.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/recordbuffer/RecordBufferPage.java?rev=1137401&r1=1137400&r2=1137401&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/recordbuffer/RecordBufferPage.java
(original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/recordbuffer/RecordBufferPage.java
Sun Jun 19 18:25:13 2011
@@ -6,6 +6,8 @@
 
 package com.hp.hpl.jena.tdb.base.recordbuffer;
 
+import org.openjena.atlas.lib.NotImplemented ;
+
 import com.hp.hpl.jena.tdb.base.block.Block ;
 import com.hp.hpl.jena.tdb.base.page.Page ;
 import com.hp.hpl.jena.tdb.base.record.RecordFactory ;
@@ -41,6 +43,10 @@ public final class RecordBufferPage exte
         getBackingBlock().getByteBuffer().putInt(LINK, link) ;
     }
     
+    @Override
+    public void reset(Block block)
+    { throw new NotImplemented("reset") ; }
+
     public static int calcRecordSize(RecordFactory factory, int blkSize)
     { return RecordBufferPageBase.calcRecordSize(factory, blkSize, FIELD_LENGTH) ; }
     

Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/recordbuffer/RecordBufferPageBase.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/recordbuffer/RecordBufferPageBase.java?rev=1137401&r1=1137400&r2=1137401&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/recordbuffer/RecordBufferPageBase.java
(original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/base/recordbuffer/RecordBufferPageBase.java
Sun Jun 19 18:25:13 2011
@@ -23,7 +23,7 @@ import com.hp.hpl.jena.tdb.sys.SystemTDB
  * This must be compatible with B+Tree records nodes and hashbuckets.
  */
 
-public class RecordBufferPageBase extends PageBase //implements Page
+public abstract class RecordBufferPageBase extends PageBase //implements Page
 {
     // Field offsets
     final public static int COUNT           = 0 ;

Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/bplustree/BPTreeNode.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/bplustree/BPTreeNode.java?rev=1137401&r1=1137400&r2=1137401&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/bplustree/BPTreeNode.java
(original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/bplustree/BPTreeNode.java
Sun Jun 19 18:25:13 2011
@@ -36,7 +36,7 @@ public final class BPTreeNode extends BP
 
     private static Logger log = LoggerFactory.getLogger(BPTreeNode.class) ;
     
-    final private Block block ;
+    private Block block ;
     private int id ;
     private short blockState = READ ;  
     
@@ -46,7 +46,8 @@ public final class BPTreeNode extends BP
     // "Leaf" of the BPTree is the lowest level of ptr/key splits, not the data blocks.
     // We need to know this to know which block manager the block pointers refer to.
     boolean isLeaf ;        
-    RecordBuffer records ;
+    private RecordBuffer records ;
+    void setRecordBuffer(RecordBuffer r) { records = r ; }
     PtrBuffer ptrs ;
 
     /* B+Tree
@@ -122,6 +123,12 @@ public final class BPTreeNode extends BP
         this.block = block ;
         this.id = block.getId().intValue() ;
     }
+
+    @Override
+    public void reset(Block block) 
+    { 
+        this.block = block ;
+    }
     
     // [TxTDB:PATCH-UP] REMOVE
     //private BPTreePage get(int idx) { return get(idx, WRITE) ; }
@@ -358,16 +365,16 @@ public final class BPTreeNode extends BP
     public final int getId()                { return id ; }
 
     @Override
-    final void write()             { bpTree.getNodeManager().write(this) ; } 
+    final void write()          { bpTree.getNodeManager().write(this) ; } 
     
     @Override
-    final void promote()         { bpTree.getNodeManager().promote(this) ; }
+    final void promote()        { bpTree.getNodeManager().promote(this) ; }
 
     @Override
-    final void release()         { bpTree.getNodeManager().release(this) ; } 
+    final void release()        { bpTree.getNodeManager().release(this) ; } 
 
     @Override
-    final void free()            { bpTree.getNodeManager().free(this) ; } 
+    final void free()           { bpTree.getNodeManager().free(this) ; } 
     
     
     // ============ SEARCH

Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/bplustree/BPTreeNodeMgr.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/bplustree/BPTreeNodeMgr.java?rev=1137401&r1=1137400&r2=1137401&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/bplustree/BPTreeNodeMgr.java
(original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/bplustree/BPTreeNodeMgr.java
Sun Jun 19 18:25:13 2011
@@ -236,7 +236,7 @@ public final class BPTreeNodeMgr extends
         byteBuffer.limit(rStart+recBuffLen) ;
         ByteBuffer bbr = byteBuffer.slice() ;
         //bbr.limit(recBuffLen) ;
-        n.records = new RecordBuffer(bbr, n.getParams().keyFactory, n.getCount()) ;
+        n.setRecordBuffer(new RecordBuffer(bbr, n.getParams().keyFactory, n.getCount()))
;
 
         // -- Pointers area
         byteBuffer.position(pStart) ;

Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/bplustree/BPTreeRecords.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/bplustree/BPTreeRecords.java?rev=1137401&r1=1137400&r2=1137401&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/bplustree/BPTreeRecords.java
(original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/bplustree/BPTreeRecords.java
Sun Jun 19 18:25:13 2011
@@ -11,6 +11,7 @@ import static com.hp.hpl.jena.tdb.index.
 import static java.lang.String.format ;
 import static org.openjena.atlas.lib.Alg.decodeIndex ;
 import org.openjena.atlas.io.IndentedWriter ;
+import org.openjena.atlas.lib.NotImplemented ;
 import org.slf4j.Logger ;
 import org.slf4j.LoggerFactory ;
 
@@ -46,6 +47,10 @@ public final class BPTreeRecords extends
     {
         return rBuffPage.getBackingBlock() ;
     }
+    
+    @Override
+    public void reset(Block block)
+    { throw new NotImplemented("reset") ; }
 
     int getLink()
     { return rBuffPage.getLink() ; }

Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/ext/HashBucket.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/ext/HashBucket.java?rev=1137401&r1=1137400&r2=1137401&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/ext/HashBucket.java
(original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/ext/HashBucket.java
Sun Jun 19 18:25:13 2011
@@ -7,6 +7,7 @@
 package com.hp.hpl.jena.tdb.index.ext;
 
 import static org.openjena.atlas.lib.Alg.decodeIndex ;
+import org.openjena.atlas.lib.NotImplemented ;
 
 import com.hp.hpl.jena.tdb.base.StorageException ;
 import com.hp.hpl.jena.tdb.base.block.Block ;
@@ -96,6 +97,10 @@ public final class HashBucket extends Re
         return true ;         
     }
     
+    @Override
+    public void reset(Block block)
+    { throw new NotImplemented("reset") ; }
+
     public final boolean isFull()
     {
         return getRecordBuffer().isFull() ;

Added: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableLogger.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableLogger.java?rev=1137401&view=auto
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableLogger.java
(added)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableLogger.java
Sun Jun 19 18:25:13 2011
@@ -0,0 +1,116 @@
+/*
+ * (c) Copyright 2009 Hewlett-Packard Development Company, LP
+ * (c) Copyright 2011 Epimorphics Ltd.
+ * All rights reserved.
+ * [See end of file]
+ */
+
+package com.hp.hpl.jena.tdb.nodetable;
+
+import java.util.Iterator ;
+
+import org.openjena.atlas.lib.Pair ;
+import org.slf4j.Logger ;
+import org.slf4j.LoggerFactory ;
+
+import com.hp.hpl.jena.graph.Node ;
+import com.hp.hpl.jena.tdb.store.NodeId ;
+
+public class NodeTableLogger implements NodeTable
+{
+    private static Logger defaultLogger = LoggerFactory.getLogger(NodeTable.class) ; 
+    private final Logger log ;
+    private final String label  ;
+
+    private final NodeTable nodeTable ;
+    
+    public NodeTableLogger(String label, NodeTable nodeTable)
+    {
+        this.nodeTable = nodeTable ;
+        this.label = label ;
+        log = defaultLogger ;
+    }
+    
+    @Override
+    public NodeId getAllocateNodeId(Node node)
+    {
+        info("getAllocateNodeId("+node+") =>") ;
+        NodeId nId = nodeTable.getAllocateNodeId(node) ;
+        info("getAllocateNodeId("+node+") => "+nId) ;
+        return nId ;
+    }
+
+    @Override
+    public NodeId getNodeIdForNode(Node node)
+    {
+        info("getNodeIdForNode("+node+") =>") ;
+        NodeId nId = nodeTable.getNodeIdForNode(node) ;
+        info("getNodeIdForNode("+node+") => "+nId) ;
+        return nId ;
+    }
+
+    @Override
+    public Node getNodeForNodeId(NodeId id)
+    {
+        info("getNodeForNodeId("+id+") =>") ;
+        Node n = nodeTable.getNodeForNodeId(id) ;
+        info("getNodeIdForNode("+id+") => "+n) ;
+        return n ;
+    }
+    
+    @Override
+    public Iterator<Pair<NodeId, Node>> all()
+    {
+        info("all()") ;
+        return nodeTable.all();
+    }
+
+    @Override
+    public void sync()
+    {
+        info("sync()") ;
+        nodeTable.sync() ; 
+    } 
+
+    @Override
+    public void close()
+    {
+        info("close()") ; ;
+        nodeTable.close() ;
+    }
+
+    private void info(String string)
+    {
+        if ( label != null )
+            string = label+": "+string ;
+        log.info(string) ; 
+    }
+}
+
+/*
+ * (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
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
\ No newline at end of file

Propchange: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableLogger.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/store/bulkloader2/CmdNodeTableBuilder.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/store/bulkloader2/CmdNodeTableBuilder.java?rev=1137401&r1=1137400&r2=1137401&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/store/bulkloader2/CmdNodeTableBuilder.java
(original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/store/bulkloader2/CmdNodeTableBuilder.java
Sun Jun 19 18:25:13 2011
@@ -13,6 +13,7 @@ import java.io.FileNotFoundException ;
 import java.io.FileOutputStream ;
 import java.io.InputStream ;
 import java.io.OutputStream ;
+import java.util.Arrays ;
 import java.util.List ;
 
 import org.openjena.atlas.AtlasException ;
@@ -96,7 +97,10 @@ public class CmdNodeTableBuilder extends
         if ( Lib.equal(dataFileTriples, dataFileQuads) )
             cmdError("Triples and Quads work files are the same") ;
         
-        datafiles  = super.getPositional() ;
+        //datafiles  = getPositionalOrStdin() ;
+        datafiles  = getPositional() ;
+        if ( datafiles.isEmpty() )
+            datafiles = Arrays.asList("-") ;
         
         // ---- Checking.
 //        if ( false ) 

Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/store/bulkloader2/RecordsFromInput.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/store/bulkloader2/RecordsFromInput.java?rev=1137401&r1=1137400&r2=1137401&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/store/bulkloader2/RecordsFromInput.java
(original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/store/bulkloader2/RecordsFromInput.java
Sun Jun 19 18:25:13 2011
@@ -21,7 +21,8 @@ import com.hp.hpl.jena.tdb.base.record.R
 import com.hp.hpl.jena.tdb.base.record.RecordFactory ;
 import com.hp.hpl.jena.tdb.sys.SystemTDB ;
 
-class RecordsFromInput implements Iterator<Record> 
+final
+public class RecordsFromInput implements Iterator<Record> 
 {
     private final InputStream input ;
     private Record slot = null ;
@@ -35,16 +36,16 @@ class RecordsFromInput implements Iterat
     private final int itemsPerRow ;
     private final ColumnMap colMap ;
 
-    RecordsFromInput(InputStream input, int length, ColumnMap colMap, int rowBlockSize)
+    public RecordsFromInput(InputStream input, int itemsPerRow, ColumnMap colMap, int rowBlockSize)
     { 
         this.input = input ;
-        this.itemsPerRow = length ;
+        this.itemsPerRow = itemsPerRow ;
         this.colMap = colMap ;
         this.rowLength = itemsPerRow*16 + itemsPerRow ;   // Length in bytes of a row.
         this.rowBlockSize = rowBlockSize ; 
         this.buffer = new byte[rowLength*rowBlockSize] ;
         this.idx = -1 ;
-        this.recordFactory = new RecordFactory(length*SystemTDB.SizeOfNodeId, 0) ;
+        this.recordFactory = new RecordFactory(itemsPerRow*SystemTDB.SizeOfNodeId, 0) ;
     }
     
     @Override

Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/BlockMgrJournal.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/BlockMgrJournal.java?rev=1137401&r1=1137400&r2=1137401&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/BlockMgrJournal.java
(original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/BlockMgrJournal.java
Sun Jun 19 18:25:13 2011
@@ -13,11 +13,13 @@ import java.util.Iterator ;
 import java.util.Map ;
 import java.util.Set ;
 
+import org.openjena.atlas.lib.ByteBufferLib ;
 import org.openjena.atlas.lib.NotImplemented ;
 import org.openjena.atlas.logging.Log ;
 import tx.base.FileRef ;
 
 import com.hp.hpl.jena.tdb.base.block.Block ;
+import com.hp.hpl.jena.tdb.base.block.BlockException ;
 import com.hp.hpl.jena.tdb.base.block.BlockMgr ;
 
 public class BlockMgrJournal implements BlockMgr, Transactional
@@ -113,10 +115,14 @@ public class BlockMgrJournal implements 
     @Override
     public Block getReadIterator(long id)
     {
+        logState() ;
+        
         checkIfClosed() ;
         Block block = localBlock(id) ;
         if ( block == null )
             block = blockMgr.getReadIterator(id) ;
+        if ( block == null )
+            throw new BlockException("No such block: "+getLabel()+" "+id) ;
         iteratorBlocks.add(block.getId()) ;
         return block ;
     }
@@ -147,6 +153,7 @@ public class BlockMgrJournal implements 
     public Block promote(Block block)
     {
         checkIfClosed() ;
+        if ( true ) throw new NotImplemented("promote=>reset") ; 
         if ( writeBlocks.containsKey(block.getId()) )
             return block ;
         return _promote(block) ;
@@ -154,8 +161,9 @@ public class BlockMgrJournal implements 
 
     private Block _promote(Block block)
     {
-        checkIfClosed() ;
+        ByteBufferLib.print(block.getByteBuffer()) ;
         block = block.replicate() ;
+        ByteBufferLib.print(block.getByteBuffer()) ;
         writeBlocks.put(block.getId(), block) ;
         return block ;
     }
@@ -251,6 +259,15 @@ public class BlockMgrJournal implements 
         journal.writeJournal(entry) ;
     }
     
+    private void logState()
+    {
+        Log.info(this, "state: "+getLabel()) ;
+        Log.info(this, "  readBlocks:      "+readBlocks) ;
+        Log.info(this, "  writeBlocks:     "+writeBlocks) ;
+        Log.info(this, "  iteratorBlocks:  "+iteratorBlocks) ;
+        Log.info(this, "  freedBlocks:     "+freedBlocks) ;
+    }
+    
     @Override
     public void beginRead()             { checkIfClosed() ; blockMgr.beginRead() ; }
 

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=1137401&r1=1137400&r2=1137401&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
Sun Jun 19 18:25:13 2011
@@ -8,6 +8,7 @@ package com.hp.hpl.jena.tdb.transaction 
 
 import java.util.Properties ;
 
+import org.openjena.atlas.lib.FileOps ;
 import setup.BlockMgrBuilder ;
 import setup.DatasetBuilderStd ;
 import setup.IndexBuilder ;
@@ -15,7 +16,6 @@ import setup.NodeTableBuilder ;
 import setup.ObjectFileBuilder ;
 import setup.RangeIndexBuilder ;
 import setup.TupleIndexBuilder ;
-import setup.DatasetBuilderStd.RangeIndexBuilderStd ;
 import tx.base.FileRef ;
 
 import com.hp.hpl.jena.tdb.base.block.BlockMgr ;
@@ -27,8 +27,9 @@ import com.hp.hpl.jena.tdb.base.file.Fil
 import com.hp.hpl.jena.tdb.base.file.FileSet ;
 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.Index ;
+import com.hp.hpl.jena.tdb.base.objectfile.ObjectFileLogger ;
+import com.hp.hpl.jena.tdb.nodetable.NodeTable ;
+import com.hp.hpl.jena.tdb.nodetable.NodeTableLogger ;
 import com.hp.hpl.jena.tdb.store.DatasetGraphTDB ;
 
 public class DatasetBuilderTxn extends DatasetBuilderStd
@@ -65,10 +66,21 @@ public class DatasetBuilderTxn extends D
         // Add track(...) to log.
         IndexBuilder indexBuilder = new IndexBuilderStd(blockMgrBuilder, blockMgrBuilder)
;
         
-        //RangeIndexBuilder rangeIndexBuilder = new RangeIndexBuilderStd(blockMgrBuilder,
track(blockMgrBuilder)) ;
-        RangeIndexBuilder rangeIndexBuilder = new RangeIndexBuilderStd(blockMgrBuilder, blockMgrBuilder)
;
+        RangeIndexBuilder rangeIndexBuilder = new RangeIndexBuilderStd(blockMgrBuilder, track(blockMgrBuilder))
;
+        //RangeIndexBuilder rangeIndexBuilder = new RangeIndexBuilderStd(blockMgrBuilder,
blockMgrBuilder) ;
 
-        NodeTableBuilder nodeTableBuilder = new NodeTableBuilderStd(indexBuilder, objectFileBuilder)
;
+        NodeTableBuilder nodeTableBuilder = new NodeTableBuilderStd(indexBuilder, objectFileBuilder)
+        {
+            @Override
+            public NodeTable buildNodeTable(FileSet fsIndex, FileSet fsObjectFile, int sizeNode2NodeIdCache,
int sizeNodeId2NodeCache)
+            {
+                NodeTable nt = super.buildNodeTable(fsIndex, fsObjectFile, sizeNode2NodeIdCache,
sizeNodeId2NodeCache) ;
+                if ( true )
+                    nt = new NodeTableLogger(fsObjectFile.getBasename(), nt) ;
+                return nt ;
+                
+            }
+        } ;
         TupleIndexBuilder tupleIndexBuilder = new TupleIndexBuilderStd(rangeIndexBuilder)
;
         set(nodeTableBuilder, tupleIndexBuilder, indexBuilder, rangeIndexBuilder, blockMgrBuilder,
objectFileBuilder) ;
     }
@@ -115,7 +127,13 @@ public class DatasetBuilderTxn extends D
 
             ObjectFileTrans objFileTrans = new ObjectFileTrans(txn, main, backing) ;
             txn.add(objFileTrans) ;
-            return objFileTrans ;
+            ObjectFile objFile = objFileTrans ;
+            if ( true )
+            {
+                String fn = FileOps.basename(fileSet.filename(ext)) ;
+                objFile = new ObjectFileLogger(fn, objFile) ;
+            }
+            return objFile ;
         }
     }
 
@@ -128,7 +146,7 @@ public class DatasetBuilderTxn extends D
             BlockMgr baseMgr = base.buildBlockMgr(fileSet, ext, blockSize) ;
             FileRef ref = FileRef.create(fileSet.filename(ext)) ;
             BlockMgrJournal blkMg = new BlockMgrJournal(txn, ref, baseMgr, journal) ;
-            // Add to transaction.
+            // [TxTDB:TODO]
             return blkMg ;
         }
     }
@@ -136,9 +154,7 @@ public class DatasetBuilderTxn extends D
     /** Add transactions to an existing datatset */
     public static DatasetGraphTDB enhance(DatasetGraphTDB dsg)
     {
-
         return dsg ;
-
     }
 
 }

Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/ObjectFileTrans.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/ObjectFileTrans.java?rev=1137401&r1=1137400&r2=1137401&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/ObjectFileTrans.java
(original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/ObjectFileTrans.java
Sun Jun 19 18:25:13 2011
@@ -135,7 +135,9 @@ public class ObjectFileTrans implements 
     {
         if ( passthrough ) { return base.write(buffer) ; } 
         // Write to auxillary
+        System.out.println("Write") ;
         long x = other.write(buffer) ;
+        System.out.println("Write -> "+x+" ("+alloc+")") ;
         return alloc+x ;
     }
 

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=1137401&r1=1137400&r2=1137401&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
Sun Jun 19 18:25:13 2011
@@ -132,7 +132,6 @@ public abstract class AbstractTestObject
         file.abort(txn) ;
         contains(file1, "ABC", "123") ;
     }
-
 }
 
 /*



Mime
View raw message