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/05/19 12:25:46 UTC
svn commit: r1124668 [2/2] - in /incubator/jena/Experimental/TxTDB/trunk: ./
bin-test/ resources2/ src-dev/test/ src-dev/tx/
src/main/java/com/hp/hpl/jena/tdb/base/block/
src/main/java/com/hp/hpl/jena/tdb/base/file/
src/main/java/com/hp/hpl/jena/tdb/ba...
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=1124668&r1=1124667&r2=1124668&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 Thu May 19 10:25:44 2011
@@ -15,12 +15,8 @@ import static com.hp.hpl.jena.tdb.index.
import static com.hp.hpl.jena.tdb.index.bplustree.BPlusTreeParams.DumpTree ;
import static java.lang.String.format ;
import static org.openjena.atlas.lib.Alg.decodeIndex ;
-
-import java.util.Iterator ;
-
import org.openjena.atlas.io.IndentedLineBuffer ;
import org.openjena.atlas.io.IndentedWriter ;
-import org.openjena.atlas.iterator.Iter ;
import org.slf4j.Logger ;
import org.slf4j.LoggerFactory ;
@@ -28,8 +24,6 @@ import com.hp.hpl.jena.tdb.base.block.Bl
import com.hp.hpl.jena.tdb.base.buffer.PtrBuffer ;
import com.hp.hpl.jena.tdb.base.buffer.RecordBuffer ;
import com.hp.hpl.jena.tdb.base.record.Record ;
-import com.hp.hpl.jena.tdb.base.recordbuffer.RecordBufferPage ;
-import com.hp.hpl.jena.tdb.base.recordbuffer.RecordRangeIterator ;
import com.hp.hpl.jena.tdb.sys.SystemTDB ;
public final class BPTreeNode extends BPTreePage
@@ -246,6 +240,41 @@ public final class BPTreeNode extends BP
}
return v ;
}
+
+ /** Returns the id of the records buffer page for this record. Records Buffer Page NOT read; record may not exist */
+ static int recordsPageId(BPTreeNode node, Record fromRec)
+ {
+ // Walk down the B+tree part of the structure ...
+ while ( !node.isLeaf() )
+ {
+ BPTreePage page = (fromRec == null ) ? node.get(0, READ) : node.findHere(fromRec) ;
+ // Not a leaf so we can cast safely.
+ BPTreeNode n = (BPTreeNode)page ;
+ // Release if not root.
+ if ( ! node.isRoot() )
+ node.release() ;
+ node = n ;
+ } ;
+ // ... then find the id of the next step down, but do not touch the records buffer page.
+ int id ;
+ if ( fromRec == null )
+ {
+ // Just get the lowest starting place.
+ id = node.getPtrBuffer().getLow() ;
+ }
+ else
+ {
+ // Get the right id based on starting record.
+ int idx = node.findSlot(fromRec) ;
+ idx = convert(idx) ;
+ id = node.getPtrBuffer().get(idx) ;
+ }
+ if ( ! node.isRoot() )
+ node.release() ;
+ return id ;
+ }
+
+
@Override
protected Record maxRecord()
@@ -265,28 +294,29 @@ public final class BPTreeNode extends BP
return r ;
}
- @Override
- protected BPTreeRecords findPage(Record rec)
- {
- if ( CheckingNode ) internalCheckNode() ;
-
- BPTreePage page = findHere(rec) ;
- if ( page == null )
- return null ;
- BPTreeRecords bpr = page.findPage(rec) ;
- page.release() ;
- return bpr ;
- }
-
- // Find first page.
- @Override
- BPTreeRecords findFirstPage()
- {
- BPTreePage page = get(0, READ) ;
- BPTreeRecords records = page.findFirstPage() ;
- page.release() ;
- return records ;
- }
+// @Override
+// protected BPTreeRecords findPage(Record rec)
+// {
+// if ( CheckingNode ) internalCheckNode() ;
+//
+// BPTreePage page = findHere(rec) ;
+// if ( page == null )
+// return null ;
+// BPTreeRecords bpr = page.findPage(rec) ;
+// page.release() ;
+// return bpr ;
+// }
+//
+// // Find first page.
+// @Override
+// BPTreeRecords findFirstPage()
+// {
+// BPTreePage page = get(0, READ) ;
+// BPTreeRecords records = page.findFirstPage() ;
+// page.release() ;
+// // Err - records is released!
+// return records ;
+// }
@Override final
Record getLowRecord()
@@ -1091,7 +1121,7 @@ public final class BPTreeNode extends BP
return x ;
}
- private final boolean isRoot()
+ final boolean isRoot()
{
if ( bpTree.root == this ) return true ;
return this.id == BPlusTreeParams.RootId ;
@@ -1144,28 +1174,6 @@ public final class BPTreeNode extends BP
return count <= min ;
}
-
- /** Iterate over a range of fromRec (inclusive) to toRec (exclusive) */
- Iterator<Record> iterator(Record fromRec, Record toRec)
- {
- BPTreeRecords btr = null ;
- if ( fromRec == null )
- btr = findFirstPage() ;
- else
- btr = findPage(fromRec) ;
-
- if ( btr == null )
- return Iter.nullIter() ;
-
- RecordBufferPage page = btr.getRecordBufferPage() ;
- return RecordRangeIterator.iterator(page, fromRec, toRec, bpTree.getRecordsMgr().getRecordBufferPageMgr()) ;
- }
-
- Iterator<Record> iterator()
- {
- return iterator(null, null) ;
- }
-
// ========== Other
@Override
Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/bplustree/BPTreePage.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/bplustree/BPTreePage.java?rev=1124668&r1=1124667&r2=1124668&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/bplustree/BPTreePage.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/bplustree/BPTreePage.java Thu May 19 10:25:44 2011
@@ -70,11 +70,11 @@ abstract public class BPTreePage impleme
/** Find a record; return null if not found */
abstract Record internalSearch(Record rec) ;
- /** Find the page for the record (bottom-most page) */
- abstract BPTreeRecords findPage(Record rec) ;
-
- /** Find the first page (supports iterators) */
- abstract BPTreeRecords findFirstPage() ;
+// /** Find the page for the record (bottom-most page) */
+// abstract BPTreeRecords findPage(Record rec) ;
+//
+// /** Find the first page (supports iterators) */
+// abstract BPTreeRecords findFirstPage() ;
/** Insert a record - return existing value if any, else null - put back modifed blocks */
abstract Record internalInsert(Record record) ;
Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/bplustree/BPTreePageMgr.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/bplustree/BPTreePageMgr.java?rev=1124668&r1=1124667&r2=1124668&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/bplustree/BPTreePageMgr.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/bplustree/BPTreePageMgr.java Thu May 19 10:25:44 2011
@@ -9,9 +9,8 @@ package com.hp.hpl.jena.tdb.index.bplust
import com.hp.hpl.jena.tdb.base.block.BlockConverter ;
import com.hp.hpl.jena.tdb.base.block.BlockMgr ;
import com.hp.hpl.jena.tdb.base.page.PageBlockMgr ;
-import com.hp.hpl.jena.tdb.sys.Session ;
-abstract class BPTreePageMgr<T extends BPTreePage> extends PageBlockMgr<T> implements Session
+abstract class BPTreePageMgr<T extends BPTreePage> extends PageBlockMgr<T>
{
// BPTreeRecordMgr works on a RecordBufferPageMgr
// BPTreeNodeMgr works on a BPTreeNodeMgr
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=1124668&r1=1124667&r2=1124668&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 Thu May 19 10:25:44 2011
@@ -79,20 +79,20 @@ public final class BPTreeRecords extends
return rBuff.get(i) ;
}
- @Override
- public BPTreeRecords findPage(Record record)
- {
- if ( rBuff.size() == 0 )
- return this ;
-
- // Not true if above the last record.
- if ( this.getLink() != RecordBufferPage.NO_ID && Record.keyGT(record, maxRecord()) )
- error("Record [%s] not in this page: %s", record , this) ;
- return this ;
- }
-
- @Override
- public BPTreeRecords findFirstPage() { return this ; }
+// @Override
+// public BPTreeRecords findPage(Record record)
+// {
+// if ( rBuff.size() == 0 )
+// return this ;
+//
+// // Not true if above the last record.
+// if ( this.getLink() != RecordBufferPage.NO_ID && Record.keyGT(record, maxRecord()) )
+// error("Record [%s] not in this page: %s", record , this) ;
+// return this ;
+// }
+//
+// @Override
+// public BPTreeRecords findFirstPage() { return this ; }
@Override final
public void write() { bpTree.getRecordsMgr().write(this) ; }
Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/bplustree/BPlusTree.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/bplustree/BPlusTree.java?rev=1124668&r1=1124667&r2=1124668&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/bplustree/BPlusTree.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/bplustree/BPlusTree.java Thu May 19 10:25:44 2011
@@ -25,9 +25,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.base.recordbuffer.RecordBufferPage ;
import com.hp.hpl.jena.tdb.base.recordbuffer.RecordBufferPageMgr ;
+import com.hp.hpl.jena.tdb.base.recordbuffer.RecordRangeIterator ;
import com.hp.hpl.jena.tdb.index.RangeIndex ;
-import com.hp.hpl.jena.tdb.index.btree.BTreeParams ;
-import com.hp.hpl.jena.tdb.sys.Session ;
/** B-Tree converted to B+Tree
*
@@ -62,7 +61,7 @@ import com.hp.hpl.jena.tdb.sys.Session ;
* The root is always the same block.
*/
-public class BPlusTree implements Iterable<Record>, RangeIndex, Session
+public class BPlusTree implements Iterable<Record>, RangeIndex
{
/*
* Insertion:
@@ -205,7 +204,7 @@ public class BPlusTree implements Iterab
if ( CheckingNode )
{
- BPTreeNode root = nodeManager.getRead(rootIdx, BTreeParams.RootParent) ;
+ BPTreeNode root = nodeManager.getRead(rootIdx, BPlusTreeParams.RootParent) ;
root.checkNodeDeep() ;
root.release() ;
}
@@ -344,9 +343,9 @@ public class BPlusTree implements Iterab
{
startReadBlkMgr() ;
BPTreeNode root = getRoot() ;
- Iterator<Record> iter = root.iterator() ;
+ Iterator<Record> iter = iterator(root) ;
releaseRoot(root) ;
- finishReadBlkMgr() ; // WRONG!
+ finishReadBlkMgr() ;
return iter ;
}
@@ -355,28 +354,32 @@ public class BPlusTree implements Iterab
{
startReadBlkMgr() ;
BPTreeNode root = getRoot() ;
- Iterator<Record> iter = root.iterator(fromRec, toRec) ;
+ Iterator<Record> iter = iterator(root, fromRec, toRec) ;
releaseRoot(root) ;
finishReadBlkMgr() ; // WRONG!
+
+ // Add a checkign wrapper via:
+ // ConcurrencyPolicyMRSW
return iter ;
}
- @Override
- public void startRead()
- { }
-
- @Override
- public void finishRead()
- { }
-
- @Override
- public void startUpdate()
- { }
+ /** Iterate over a range of fromRec (inclusive) to toRec (exclusive) */
+ private static Iterator<Record> iterator(BPTreeNode node, Record fromRec, Record toRec)
+ {
+ // Look for starting RecordsBufferPage id.
+ int id = BPTreeNode.recordsPageId(node, fromRec) ;
+ if ( id < 0 )
+ return Iter.nullIter() ;
+ RecordBufferPageMgr pageMgr = node.getBPlusTree().getRecordsMgr().getRecordBufferPageMgr() ;
+ // No pages are active at this point.
+ return RecordRangeIterator.iterator(id, fromRec, toRec, pageMgr) ;
+ }
+
+ private static Iterator<Record> iterator(BPTreeNode node)
+ {
+ return iterator(node, null, null) ;
+ }
- @Override
- public void finishUpdate()
- { }
-
// Internal calls.
private void startReadBlkMgr()
{
@@ -401,7 +404,7 @@ public class BPlusTree implements Iterab
nodeManager.finishUpdate() ;
recordsMgr.finishUpdate() ;
}
-
+
@Override
public boolean isEmpty()
{
Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/bplustree/BPlusTreeRewriter.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/bplustree/BPlusTreeRewriter.java?rev=1124668&r1=1124667&r2=1124668&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/bplustree/BPlusTreeRewriter.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/bplustree/BPlusTreeRewriter.java Thu May 19 10:25:44 2011
@@ -27,7 +27,6 @@ import com.hp.hpl.jena.tdb.base.record.R
import com.hp.hpl.jena.tdb.base.record.RecordFactory ;
import com.hp.hpl.jena.tdb.base.recordbuffer.RecordBufferPage ;
import com.hp.hpl.jena.tdb.base.recordbuffer.RecordBufferPageMgr ;
-import com.hp.hpl.jena.tdb.index.btree.BTreeParams ;
public class BPlusTreeRewriter
{
@@ -309,8 +308,8 @@ public class BPlusTreeRewriter
protected Record rebalance(int id1, Record r1, int id2, Record r2)
{
BPTreeNodeMgr mgr = bpt.getNodeManager() ;
- BPTreeNode node1 = mgr.getWrite(id1, BTreeParams.NoParent) ;
- BPTreeNode node2 = mgr.getWrite(id2, BTreeParams.NoParent) ;
+ BPTreeNode node1 = mgr.getWrite(id1, BPlusTreeParams.NoParent) ;
+ BPTreeNode node2 = mgr.getWrite(id2, BPlusTreeParams.NoParent) ;
// rebalence
// ** Need rebalance of data leaf layer.
Modified: incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/store/GraphTDBBase.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/store/GraphTDBBase.java?rev=1124668&r1=1124667&r2=1124668&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/store/GraphTDBBase.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/main/java/com/hp/hpl/jena/tdb/store/GraphTDBBase.java Thu May 19 10:25:44 2011
@@ -149,8 +149,6 @@ public abstract class GraphTDBBase exten
/** Iterator over something that, when counted, is the graph size. */
protected abstract Iterator<?> countThis() ;
-
-
@Override
public void startRead() { dataset.startRead() ; }
Modified: incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/TS_Jena.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/TS_Jena.java?rev=1124668&r1=1124667&r2=1124668&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/TS_Jena.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/TS_Jena.java Thu May 19 10:25:44 2011
@@ -12,8 +12,6 @@ import org.junit.runners.Suite ;
import com.hp.hpl.jena.tdb.graph.basics.TestGraphBPlusTreeMem ;
import com.hp.hpl.jena.tdb.graph.basics.TestGraphBPlusTreeMemNew ;
-import com.hp.hpl.jena.tdb.graph.basics.TestGraphBTreeMem ;
-import com.hp.hpl.jena.tdb.graph.basics.TestGraphBTreeMemNew ;
import com.hp.hpl.jena.tdb.junit.Base_TS ;
// Tests using Jena graph tests
@@ -22,8 +20,6 @@ import com.hp.hpl.jena.tdb.junit.Base_TS
@Suite.SuiteClasses( {
TestGraphBPlusTreeMem.class
, TestGraphBPlusTreeMemNew.class
- , TestGraphBTreeMem.class
- , TestGraphBTreeMemNew.class
})
public class TS_Jena extends Base_TS
Modified: incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/block/TS_Block.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/block/TS_Block.java?rev=1124668&r1=1124667&r2=1124668&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/block/TS_Block.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/block/TS_Block.java Thu May 19 10:25:44 2011
@@ -11,7 +11,7 @@ import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses( {
- TestBlockMgr.class,
+ TestBlockMgrMem.class,
TestBlockMgrDirect.class,
TestBlockMgrMapped.class
})
Modified: incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/block/TestBlockMgrMapped.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/block/TestBlockMgrMapped.java?rev=1124668&r1=1124667&r2=1124668&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/block/TestBlockMgrMapped.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/base/block/TestBlockMgrMapped.java Thu May 19 10:25:44 2011
@@ -6,13 +6,15 @@
package com.hp.hpl.jena.tdb.base.block;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
+import org.junit.After ;
+import org.junit.AfterClass ;
+import org.junit.BeforeClass ;
import org.openjena.atlas.lib.FileOps ;
import org.openjena.atlas.logging.Log ;
-import com.hp.hpl.jena.tdb.ConfigTest;
+import com.hp.hpl.jena.tdb.ConfigTest ;
+import com.hp.hpl.jena.tdb.base.file.FileAccess ;
+import com.hp.hpl.jena.tdb.base.file.FileAccessMapped ;
public class TestBlockMgrMapped extends AbstractTestBlockMgr
{
@@ -43,7 +45,8 @@ public class TestBlockMgrMapped extends
protected BlockMgr make()
{
clearBlockMgr() ;
- return new BlockMgrMapped(filename, BlkSize) ;
+ FileAccess file = new FileAccessMapped(filename, BlkSize) ;
+ return new BlockMgrFileAccess(file, BlkSize) ;
}
}
Modified: incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/graph/basics/GraphTDBFactoryTesting.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/graph/basics/GraphTDBFactoryTesting.java?rev=1124668&r1=1124667&r2=1124668&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/graph/basics/GraphTDBFactoryTesting.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/graph/basics/GraphTDBFactoryTesting.java Thu May 19 10:25:44 2011
@@ -9,7 +9,6 @@ package com.hp.hpl.jena.tdb.graph.basics
import com.hp.hpl.jena.tdb.base.file.Location ;
import com.hp.hpl.jena.tdb.index.IndexBuilder ;
import com.hp.hpl.jena.tdb.index.factories.IndexFactoryBPlusTree ;
-import com.hp.hpl.jena.tdb.index.factories.IndexFactoryBTree ;
import com.hp.hpl.jena.tdb.store.GraphTriplesTDB ;
import com.hp.hpl.jena.tdb.sys.SystemTDB ;
@@ -19,14 +18,6 @@ class GraphTDBFactoryTesting
{
// This class and FactoryGraphTDB are old ways of making graphs and datasets
- /** Create a graph backed with storage at a location using and BTree (not B+Tree) indexes (testing) */
- public static GraphTriplesTDB createBTree(Location location)
- {
- IndexFactoryBTree idxFactory = new IndexFactoryBTree(SystemTDB.BlockSizeTest) ;
- IndexBuilder builder = new IndexBuilder(idxFactory,idxFactory) ;
- return FactoryGraphTDB.createGraph(builder, location) ;
- }
-
/** Create a graph backed with storage at a location using B+Tree indexes (testing) */
public static GraphTriplesTDB createBPlusTree(Location location)
{
@@ -42,15 +33,7 @@ class GraphTDBFactoryTesting
IndexBuilder builder = new IndexBuilder(idxFactory,idxFactory) ;
return FactoryGraphTDB.createGraphMem(builder) ;
}
-
- /** Create a graph backed with storage and B+Tree indexes in-memory (testing) */
- public static GraphTriplesTDB createBTreeMem()
- {
- IndexFactoryBTree idxFactory = new IndexFactoryBTree(SystemTDB.BlockSizeTestMem) ;
- IndexBuilder builder = new IndexBuilder(idxFactory,idxFactory) ;
- return FactoryGraphTDB.createGraphMem(builder) ;
- }
-}
+}
/*
* (c) Copyright 2008, 2009 Hewlett-Packard Development Company, LP
Modified: incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/index/IndexTestLib.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/index/IndexTestLib.java?rev=1124668&r1=1124667&r2=1124668&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/index/IndexTestLib.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/index/IndexTestLib.java Thu May 19 10:25:44 2011
@@ -6,13 +6,13 @@
package com.hp.hpl.jena.tdb.index;
-import static com.hp.hpl.jena.tdb.base.record.RecordLib.intToRecord;
-import static com.hp.hpl.jena.tdb.base.record.RecordLib.r;
-import static com.hp.hpl.jena.tdb.base.record.RecordLib.toIntList;
-import static java.lang.String.format;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
+import static com.hp.hpl.jena.tdb.base.record.RecordLib.intToRecord ;
+import static com.hp.hpl.jena.tdb.base.record.RecordLib.r ;
+import static com.hp.hpl.jena.tdb.base.record.RecordLib.toIntList ;
+import static java.lang.String.format ;
+import static org.junit.Assert.assertEquals ;
+import static org.junit.Assert.assertNotNull ;
+import static org.junit.Assert.fail ;
import static org.openjena.atlas.lib.ListUtils.asList ;
import static org.openjena.atlas.lib.ListUtils.unique ;
import static org.openjena.atlas.lib.RandomLib.random ;
@@ -20,17 +20,15 @@ import static org.openjena.atlas.test.Ge
import static org.openjena.atlas.test.Gen.rand ;
import static org.openjena.atlas.test.Gen.strings ;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.SortedSet;
-import java.util.TreeSet;
+import java.util.ArrayList ;
+import java.util.List ;
+import java.util.SortedSet ;
+import java.util.TreeSet ;
import org.openjena.atlas.junit.BaseTest ;
-
-
-import com.hp.hpl.jena.tdb.base.record.Record;
-import com.hp.hpl.jena.tdb.base.record.RecordLib;
+import com.hp.hpl.jena.tdb.base.record.Record ;
+import com.hp.hpl.jena.tdb.base.record.RecordLib ;
public class IndexTestLib
{
@@ -171,9 +169,13 @@ public class IndexTestLib
public static void add(Index index, int[] vals)
{
+ //System.out.println("Add: "+Arrays.toString(vals)) ;
List<Record> x = intToRecord(vals, RecordLib.TestRecordLength) ;
for ( Record r : x )
+ {
+ //System.out.println(" Add: "+r) ;
index.add(r) ;
+ }
}
public static void testIndexContents(Index index, int[] records)
Modified: incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/index/TS_Index.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/index/TS_Index.java?rev=1124668&r1=1124667&r2=1124668&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/index/TS_Index.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/index/TS_Index.java Thu May 19 10:25:44 2011
@@ -12,17 +12,11 @@ import org.junit.runners.Suite;
import com.hp.hpl.jena.tdb.index.bplustree.TestBPTreeRecords;
import com.hp.hpl.jena.tdb.index.bplustree.TestBPlusTree;
import com.hp.hpl.jena.tdb.index.bplustree.TestBPlusTreeRewriter ;
-import com.hp.hpl.jena.tdb.index.btree.TestBTree;
-import com.hp.hpl.jena.tdb.index.btree.TestBTreeLong;
import com.hp.hpl.jena.tdb.index.ext.TestExtHash;
@RunWith(Suite.class)
@Suite.SuiteClasses( {
-
- TestBTree.class,
- TestBTreeLong.class,
-
TestBPlusTree.class,
TestBPTreeRecords.class,
TestBPlusTreeRewriter.class,
Modified: incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/index/bplustree/TestBPlusTree.java
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/index/bplustree/TestBPlusTree.java?rev=1124668&r1=1124667&r2=1124668&view=diff
==============================================================================
--- incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/index/bplustree/TestBPlusTree.java (original)
+++ incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/index/bplustree/TestBPlusTree.java Thu May 19 10:25:44 2011
@@ -16,11 +16,11 @@ import com.hp.hpl.jena.tdb.sys.SystemTDB
public class TestBPlusTree extends TestRangeIndex
{
-
static boolean b ;
@BeforeClass public static void before()
{
- BPlusTreeParams.checkAll() ;
+ BPlusTreeParams.CheckingNode = true ;
+ //BPlusTreeParams.CheckingTree = true ; // Breaks with block tracking.
b = SystemTDB.NullOut ;
SystemTDB.NullOut = true ;
}
@@ -35,7 +35,13 @@ public class TestBPlusTree extends TestR
protected RangeIndex makeRangeIndex(int order, int minRecords)
{
BPlusTree bpt = BPlusTree.makeMem(order, minRecords, RecordLib.TestRecordLength, 0) ;
- //bpt = BPlusTree.addTracking(bpt) ;
+ if ( false )
+ {
+ // Breaks with CheckingTree = true ; because they deep reads the tree.
+ BPlusTreeParams.CheckingNode = true ;
+ BPlusTreeParams.CheckingTree = false ;
+ bpt = BPlusTree.addTracking(bpt) ;
+ }
return bpt ;
}
}