activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r828761 - in /activemq/sandbox/activemq-apollo/hawtdb/src: main/java/org/apache/hawtdb/api/ main/java/org/apache/hawtdb/internal/index/ main/java/org/apache/hawtdb/internal/io/ main/java/org/apache/hawtdb/internal/page/ test/java/org/apache...
Date Thu, 22 Oct 2009 15:55:09 GMT
Author: chirino
Date: Thu Oct 22 15:55:08 2009
New Revision: 828761

URL: http://svn.apache.org/viewvc?rev=828761&view=rev
Log:
still working on benchmark tests.. helped me squash a few bugs in deffered marshalling and
memory mapped buffer allocation.


Modified:
    activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/api/EncoderDecoder.java
    activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/index/BTreeNode.java
    activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/index/HashIndex.java
    activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/io/MemoryMappedFile.java
    activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/page/Extent.java
    activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/page/HawtPageFile.java
    activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/page/HawtPageFileFactory.java
    activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/page/HawtTransaction.java
    activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/page/PageFileFactory.java
    activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/page/SimpleAllocator.java
    activemq/sandbox/activemq-apollo/hawtdb/src/test/java/org/apache/hawtdb/internal/index/BTreeIndexBenchmark.java
    activemq/sandbox/activemq-apollo/hawtdb/src/test/java/org/apache/hawtdb/internal/index/HashIndexBenchmark.java
    activemq/sandbox/activemq-apollo/hawtdb/src/test/java/org/apache/hawtdb/internal/index/IndexBenchmark.java
    activemq/sandbox/activemq-apollo/hawtdb/src/test/java/org/apache/hawtdb/internal/page/ConcurrentPageFileTest.java
    activemq/sandbox/activemq-apollo/hawtdb/src/test/java/org/apache/hawtdb/internal/page/TransactionBenchmarker.java

Modified: activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/api/EncoderDecoder.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/api/EncoderDecoder.java?rev=828761&r1=828760&r2=828761&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/api/EncoderDecoder.java
(original)
+++ activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/api/EncoderDecoder.java
Thu Oct 22 15:55:08 2009
@@ -67,5 +67,5 @@
      * @param paged
      * @param page
      */
-    void remove(Paged paged, int page);
+    List<Integer> remove(Paged paged, int page);
 }
\ No newline at end of file

Modified: activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/index/BTreeNode.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/index/BTreeNode.java?rev=828761&r1=828760&r2=828761&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/index/BTreeNode.java
(original)
+++ activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/index/BTreeNode.java
Thu Oct 22 15:55:08 2009
@@ -277,8 +277,8 @@
 
         }
 
-        public void remove(Paged paged, int page) {
-            Extent.freeLinked(paged, page);
+        public List<Integer> remove(Paged paged, int page) {
+            return Extent.freeLinked(paged, page);
         }
 
     }

Modified: activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/index/HashIndex.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/index/HashIndex.java?rev=828761&r1=828760&r2=828761&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/index/HashIndex.java
(original)
+++ activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/index/HashIndex.java
Thu Oct 22 15:55:08 2009
@@ -184,6 +184,7 @@
         this.initialBucketCapacity = factory.getBucketCapacity();
         this.BIN_FACTORY.setKeyMarshaller(factory.getKeyMarshaller());
         this.BIN_FACTORY.setValueMarshaller(factory.getValueMarshaller());
+        this.BIN_FACTORY.setDeferredEncoding(false);
     }
 
     public HashIndex<Key, Value> create() {

Modified: activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/io/MemoryMappedFile.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/io/MemoryMappedFile.java?rev=828761&r1=828760&r2=828761&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/io/MemoryMappedFile.java
(original)
+++ activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/io/MemoryMappedFile.java
Thu Oct 22 15:55:08 2009
@@ -214,7 +214,10 @@
 		MappedByteBuffer buffer = buffers.get(index);
 		if (buffer == null) {
 			try {
-                buffer = channel.map(MapMode.READ_WRITE, index*bufferSize, bufferSize);
+                long position = ((long)index)*bufferSize;
+                buffer = channel.map(MapMode.READ_WRITE, position, bufferSize);
+            } catch (IllegalArgumentException e) {
+                throw new IOPagingException(e);
             } catch (IOException e) {
                 throw new IOPagingException(e);
             }

Modified: activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/page/Extent.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/page/Extent.java?rev=828761&r1=828760&r2=828761&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/page/Extent.java
(original)
+++ activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/page/Extent.java
Thu Oct 22 15:55:08 2009
@@ -18,6 +18,8 @@
 
 import java.nio.ByteBuffer;
 import java.nio.IntBuffer;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.apache.activemq.util.buffer.Buffer;
 import org.apache.hawtdb.api.IOPagingException;
@@ -184,14 +186,14 @@
      * @param paged
      * @param page
      */
-    public static void freeLinked(Paged paged, int page) {
-        freeLinked(paged, page, DEFAULT_MAGIC);
+    public static List<Integer> freeLinked(Paged paged, int page) {
+        return freeLinked(paged, page, DEFAULT_MAGIC);
     }
     
-    public static void freeLinked(Paged paged, int page, Buffer magic) {
+    public static List<Integer> freeLinked(Paged paged, int page, Buffer magic) {
         Extent extent = new Extent(paged, page, magic);
         extent.readHeader();
-        free(paged, extent.getNext());
+        return free(paged, extent.getNext());
     }    
     
     /**
@@ -200,21 +202,26 @@
      * @param paged
      * @param page
      */
-    public static void free(Paged paged, int page) {
-        free(paged, page, DEFAULT_MAGIC);
+    public static List<Integer> free(Paged paged, int page) {
+        return free(paged, page, DEFAULT_MAGIC);
     }    
-    public static void free(Paged paged, int page, Buffer magic) {
+    public static List<Integer> free(Paged paged, int page, Buffer magic) {
+        ArrayList<Integer> rc = new ArrayList<Integer>();
         while( page>=0 ) {
             Extent extent = new Extent(paged, page, magic);
             extent.readHeader();
             try {
                 int pagesInExtent = paged.pages(extent.getLength());
                 paged.allocator().free(page, pagesInExtent);
+                for( int i=0; i < pagesInExtent; i++) {
+                    rc.add(page+i);
+                }
                 page=extent.getNext();
             } finally {
                 extent.readClose();
             }
         }
+        return rc;
     }
 
     /**

Modified: activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/page/HawtPageFile.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/page/HawtPageFile.java?rev=828761&r1=828760&r2=828761&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/page/HawtPageFile.java
(original)
+++ activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/page/HawtPageFile.java
Thu Oct 22 15:55:08 2009
@@ -259,7 +259,13 @@
                 this.updates.putAll(updates);
             }
             if( deferredUpdates!=null ) {
-                this.deferredUpdates.putAll(deferredUpdates);
+                for (Entry<Integer, DeferredUpdate> entry : deferredUpdates.entrySet())
{
+                    if( entry.getValue().value == null ) {
+                        this.deferredUpdates.remove(entry.getKey(), entry.getValue());
+                    } else {
+                        this.deferredUpdates.put(entry.getKey(), entry.getValue());
+                    }
+                }
             }
         }
 
@@ -502,6 +508,7 @@
     final SimpleAllocator allocator;
     final PageFile pageFile;
     private static final int updateBatchSize = 1024;
+    private final boolean synch;
 
 
     /** The header structure of the file */
@@ -546,8 +553,9 @@
      */
     private Ranges baseRevisionFreePages = new Ranges();
     
-    public HawtPageFile(PageFile pageFile) {
-        this.pageFile = pageFile;
+    public HawtPageFile(HawtPageFileFactory factory) {
+        this.pageFile = factory.getPageFile();
+        this.synch = factory.isSync();
         this.file = pageFile.getFile();
         this.allocator = pageFile.allocator();
         ByteBuffer slice = file.slice(false, 0, FILE_HEADER_SIZE);
@@ -756,11 +764,20 @@
         if( redo.deferredUpdates != null ) {
             for (Entry<Integer, DeferredUpdate> entry : redo.deferredUpdates.entrySet())
{
                 DeferredUpdate cu = entry.getValue();
-                List<Integer> allocatedPages = cu.store(pageFile);
-                for (Integer page : allocatedPages) {
-                    // add any allocated pages to the update list so that the free 
-                    // list gets properly adjusted.
-                    redo.updates.put(page, PAGE_ALLOCATED);
+                if( cu.value == null ) {
+                    List<Integer> freePages = cu.marshaller.remove(pageFile, cu.page);
+                    for (Integer page : freePages) {
+                        // add any allocated pages to the update list so that the free 
+                        // list gets properly adjusted.
+                        redo.updates.put(page, PAGE_FREED);
+                    }
+                } else {
+                    List<Integer> allocatedPages = cu.store(pageFile);
+                    for (Integer page : allocatedPages) {
+                        // add any allocated pages to the update list so that the free 
+                        // list gets properly adjusted.
+                        redo.updates.put(page, PAGE_ALLOCATED);
+                    }
                 }
             }
         }
@@ -788,7 +805,9 @@
     private void syncRedos() {
 
         // This is a slow operation..
-        file.sync();
+        if( synch ) {
+            file.sync();
+        }
         Header h = header();
 
         // Update the base_revision with the last performed revision.
@@ -1089,9 +1108,9 @@
     }
     
     static class DeferredUpdate {
-        private final int page;
-        private Object value;
-        private EncoderDecoder<?> marshaller;
+        final int page;
+        Object value;
+        EncoderDecoder<?> marshaller;
 
         public DeferredUpdate(int page, Object value, EncoderDecoder<?> marshaller)
{
             this.page = page;

Modified: activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/page/HawtPageFileFactory.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/page/HawtPageFileFactory.java?rev=828761&r1=828760&r2=828761&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/page/HawtPageFileFactory.java
(original)
+++ activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/page/HawtPageFileFactory.java
Thu Oct 22 15:55:08 2009
@@ -25,6 +25,7 @@
     private HawtPageFile concurrentPageFile;
     
     protected boolean drainOnClose;
+    protected boolean sync = true;
 
     public HawtPageFile getConcurrentPageFile() {
         return concurrentPageFile;
@@ -46,7 +47,7 @@
         boolean existed = file.isFile();
         super.open();
         if (concurrentPageFile == null) {
-            concurrentPageFile = new HawtPageFile(getPageFile());
+            concurrentPageFile = new HawtPageFile(this);
             if( existed ) {
                 concurrentPageFile.recover();
             } else {
@@ -63,6 +64,16 @@
             concurrentPageFile=null;
         }
         super.close();
-    }    
+    }
+
+    public boolean isSync() {
+        return sync;
+    }
+
+    public void setSync(boolean sync) {
+        this.sync = sync;
+    }
+    
+    
     
 }

Modified: activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/page/HawtTransaction.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/page/HawtTransaction.java?rev=828761&r1=828760&r2=828761&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/page/HawtTransaction.java
(original)
+++ activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/page/HawtTransaction.java
Thu Oct 22 15:55:08 2009
@@ -133,7 +133,17 @@
     }
 
     public <T> void remove(EncoderDecoder<T> marshaller, int page) {
-        marshaller.remove(this, page);
+        DeferredUpdate deferredUpdate = getCacheUpdates().remove(page);
+        if( deferredUpdate==null ) {
+            // add a deferred update to remove the value.
+            getCacheUpdates().put(page, new DeferredUpdate(page, null, marshaller));
+        } else {
+            if( deferredUpdate.value == null ) {
+                // undo.. user error.
+                getCacheUpdates().put(deferredUpdate.page, deferredUpdate);
+                throw new PagingException("You should never try to remove a page that has
been removed.");
+            }
+        }
     }
     
     public Allocator allocator() {

Modified: activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/page/PageFileFactory.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/page/PageFileFactory.java?rev=828761&r1=828760&r2=828761&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/page/PageFileFactory.java
(original)
+++ activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/page/PageFileFactory.java
Thu Oct 22 15:55:08 2009
@@ -88,5 +88,8 @@
     public void setMaxPages(int maxPages) {
         this.maxPages = maxPages;
     }
+    public void setMaxFileSize(long size) {
+        setMaxPages( (int)((size-getHeaderSize())/getPageSize()) );
+    }
     
 }

Modified: activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/page/SimpleAllocator.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/page/SimpleAllocator.java?rev=828761&r1=828760&r2=828761&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/page/SimpleAllocator.java
(original)
+++ activemq/sandbox/activemq-apollo/hawtdb/src/main/java/org/apache/hawtdb/internal/page/SimpleAllocator.java
Thu Oct 22 15:55:08 2009
@@ -34,9 +34,9 @@
     private final Ranges freeRanges = new Ranges();
     private int limit;
 
-    public SimpleAllocator(int max) {
-        this.limit = max;
-        freeRanges.add(0, max);
+    public SimpleAllocator(int limit) {
+        this.limit = limit;
+        freeRanges.add(0, limit);
     }
 
     /**

Modified: activemq/sandbox/activemq-apollo/hawtdb/src/test/java/org/apache/hawtdb/internal/index/BTreeIndexBenchmark.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo/hawtdb/src/test/java/org/apache/hawtdb/internal/index/BTreeIndexBenchmark.java?rev=828761&r1=828760&r2=828761&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo/hawtdb/src/test/java/org/apache/hawtdb/internal/index/BTreeIndexBenchmark.java
(original)
+++ activemq/sandbox/activemq-apollo/hawtdb/src/test/java/org/apache/hawtdb/internal/index/BTreeIndexBenchmark.java
Thu Oct 22 15:55:08 2009
@@ -30,14 +30,14 @@
 public class BTreeIndexBenchmark extends IndexBenchmark {
 
     public BTreeIndexBenchmark() {
-        this.benchmark.setSamples(30);
+        this.benchmark.setSamples(5);
     }
     
     protected Index<Long, Buffer> createIndex(Transaction tx) {
         BTreeIndexFactory<Long, Buffer> factory = new BTreeIndexFactory<Long, Buffer>();
         factory.setKeyMarshaller(LongMarshaller.INSTANCE);
         factory.setValueMarshaller(new FixedBufferMarshaller(DATA.length));
-        factory.setDeferredEncoding(false);
+        factory.setDeferredEncoding(true);
         return factory.create(tx, tx.allocator().alloc(1));
     }
 

Modified: activemq/sandbox/activemq-apollo/hawtdb/src/test/java/org/apache/hawtdb/internal/index/HashIndexBenchmark.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo/hawtdb/src/test/java/org/apache/hawtdb/internal/index/HashIndexBenchmark.java?rev=828761&r1=828760&r2=828761&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo/hawtdb/src/test/java/org/apache/hawtdb/internal/index/HashIndexBenchmark.java
(original)
+++ activemq/sandbox/activemq-apollo/hawtdb/src/test/java/org/apache/hawtdb/internal/index/HashIndexBenchmark.java
Thu Oct 22 15:55:08 2009
@@ -31,7 +31,7 @@
 public class HashIndexBenchmark extends IndexBenchmark {
 
     public HashIndexBenchmark() {
-        this.benchmark.setSamples(3);
+        this.benchmark.setSamples(5);
     }
     
     protected Index<Long, Buffer> createIndex(Transaction tx) {

Modified: activemq/sandbox/activemq-apollo/hawtdb/src/test/java/org/apache/hawtdb/internal/index/IndexBenchmark.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo/hawtdb/src/test/java/org/apache/hawtdb/internal/index/IndexBenchmark.java?rev=828761&r1=828760&r2=828761&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo/hawtdb/src/test/java/org/apache/hawtdb/internal/index/IndexBenchmark.java
(original)
+++ activemq/sandbox/activemq-apollo/hawtdb/src/test/java/org/apache/hawtdb/internal/index/IndexBenchmark.java
Thu Oct 22 15:55:08 2009
@@ -16,14 +16,17 @@
  */
 package org.apache.hawtdb.internal.index;
 
+import java.io.File;
 import java.util.Random;
 
 import org.apache.activemq.util.buffer.Buffer;
 import org.apache.hawtdb.api.Index;
+import org.apache.hawtdb.api.OutOfSpaceException;
 import org.apache.hawtdb.api.Transaction;
 import org.apache.hawtdb.internal.Action;
 import org.apache.hawtdb.internal.Benchmarker.BenchmarkAction;
 import org.apache.hawtdb.internal.page.HawtPageFile;
+import org.apache.hawtdb.internal.page.HawtPageFileFactory;
 import org.apache.hawtdb.internal.page.TransactionActor;
 import org.apache.hawtdb.internal.page.TransactionBenchmarker;
 import org.junit.Test;
@@ -34,11 +37,15 @@
  */
 public abstract class IndexBenchmark {
     
-    static final public byte[] DATA = new byte[8];
+    private static final int KEY_SPACE = 10000;
+    private static final int VALUE_SIZE = 8;
+    
+    static final public byte[] DATA = new byte[VALUE_SIZE];
 
     class IndexActor extends TransactionActor<IndexActor> {
         public Random random;
         public Index<Long, Buffer> index;
+        long counter=0;
         
         public void setName(String name) {
             super.setName(name);
@@ -50,6 +57,30 @@
             super.setTx(tx);
             index = createIndex(tx);
         }
+        
+        public void benchmarkIndex() throws InterruptedException {
+            // Transaction retry loop.
+            while( true ) {
+                try {
+                    
+                    index.put(counter++, new Buffer(DATA));
+                    if( (counter%KEY_SPACE)==0 ) {
+                        counter=0;
+                    }
+                    
+                    // Transaction succeeded.. break out of retry loop. 
+                    break;
+                    
+                } catch (OutOfSpaceException e) {
+                    counter--;
+                    tx().rollback();
+                    System.out.println("OutOfSpaceException occurred.. waiting for space
to free up..");
+                    Thread.sleep(500);
+                } finally {
+                    tx().commit();
+                }
+            }
+        }
     }
     
     TransactionBenchmarker<IndexActor> benchmark = new TransactionBenchmarker<IndexActor>()
{
@@ -58,16 +89,20 @@
         };
     };
 
+    public IndexBenchmark() {
+        HawtPageFileFactory hawtPageFileFactory = new HawtPageFileFactory();
+        hawtPageFileFactory.setFile(new File("target/test-data/" + getClass().getName() +
".db"));
+        hawtPageFileFactory.setSync(false);
+         // Limit file growth to 1 Gig.
+        hawtPageFileFactory.setMaxFileSize(1024*1024*1024); 
+        benchmark.setHawtPageFileFactory(hawtPageFileFactory);
+    }
     
     @Test
     public void insert() throws Exception {
-        Thread.sleep(3000);
         benchmark.benchmark(1, new BenchmarkAction<IndexActor>("insert") {
-            long counter=0;
-            @Override
-            protected void execute(IndexActor actor) {
-                actor.index.put(counter++, new Buffer(DATA));
-                actor.tx().commit();
+            protected void execute(IndexActor actor) throws InterruptedException {
+                actor.benchmarkIndex();
             }
         });
     }

Modified: activemq/sandbox/activemq-apollo/hawtdb/src/test/java/org/apache/hawtdb/internal/page/ConcurrentPageFileTest.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo/hawtdb/src/test/java/org/apache/hawtdb/internal/page/ConcurrentPageFileTest.java?rev=828761&r1=828760&r2=828761&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo/hawtdb/src/test/java/org/apache/hawtdb/internal/page/ConcurrentPageFileTest.java
(original)
+++ activemq/sandbox/activemq-apollo/hawtdb/src/test/java/org/apache/hawtdb/internal/page/ConcurrentPageFileTest.java
Thu Oct 22 15:55:08 2009
@@ -117,7 +117,8 @@
             ConcurrentPageFileTest.this.store(paged, page, value);
             return Collections.emptyList();
         }
-        public void remove(Paged paged, int page) {
+        public List<Integer> remove(Paged paged, int page) {
+            return Collections.emptyList();
         }
     }
 

Modified: activemq/sandbox/activemq-apollo/hawtdb/src/test/java/org/apache/hawtdb/internal/page/TransactionBenchmarker.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo/hawtdb/src/test/java/org/apache/hawtdb/internal/page/TransactionBenchmarker.java?rev=828761&r1=828760&r2=828761&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo/hawtdb/src/test/java/org/apache/hawtdb/internal/page/TransactionBenchmarker.java
(original)
+++ activemq/sandbox/activemq-apollo/hawtdb/src/test/java/org/apache/hawtdb/internal/page/TransactionBenchmarker.java
Thu Oct 22 15:55:08 2009
@@ -41,10 +41,10 @@
     private Callback tearDown;
     private int samples = 3;
     private int period = 1000*5;
+    private HawtPageFileFactory hawtPageFileFactory;
     
     public void benchmark(int actorCount, BenchmarkAction<A> action) throws Exception
{
-        HawtPageFileFactory pff = new HawtPageFileFactory();
-        pff.setFile(new File("target/test-data/" + getClass().getName() + ".db"));
+        HawtPageFileFactory pff = getHawtPageFileFactory();
         pff.getFile().delete();
         pff.open();
         try {
@@ -124,6 +124,16 @@
     public void setPeriod(int period) {
         this.period = period;
     }
-    
+
+    public void setHawtPageFileFactory(HawtPageFileFactory hawtPageFileFactory) {
+        this.hawtPageFileFactory = hawtPageFileFactory;
+    }
+    public HawtPageFileFactory getHawtPageFileFactory() {
+        if( hawtPageFileFactory==null ) {
+            hawtPageFileFactory = new HawtPageFileFactory();
+            hawtPageFileFactory.setFile(new File("target/test-data/" + getClass().getName()
+ ".db"));
+        }
+        return hawtPageFileFactory;
+    }    
     
 }



Mime
View raw message