incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cr...@apache.org
Subject [14/27] git commit: All unit tests for new block cache are testing with all features enabled. Any potental memory leaks with the Unsafe allocations have been plugged. Once some burn tests are complete, I think we can deem this code ready for production u
Date Wed, 16 Oct 2013 03:32:57 GMT
All unit tests for new block cache are testing with all features enabled. Any potental memory
leaks with the Unsafe allocations have been plugged. Once some burn tests are complete, I
think we can deem this code ready for production use.


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/28470cd6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/28470cd6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/28470cd6

Branch: refs/heads/blur-console-v2
Commit: 28470cd67e632a476025ce91d3a1f2b8e243f687
Parents: 766544c
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Thu Oct 10 12:42:19 2013 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Thu Oct 10 12:42:36 2013 -0400

----------------------------------------------------------------------
 .../blur/store/blockcache_v2/BaseCache.java     |   7 +-
 .../store/blockcache_v2/CacheIndexInput.java    |  31 +-
 .../cachevalue/BaseCacheValue.java              |   7 +
 .../cachevalue/ByteArrayCacheValue.java         |   3 +-
 .../cachevalue/UnsafeCacheValue.java            |  10 +-
 .../blur/store/BaseDirectoryTestSuite.java      | 283 ++++++++++++++++++-
 .../blur/store/CacheDirectoryTestSuite.java     |  11 +-
 .../blur/store/HdfsDirectoryTestSuite.java      |   5 +-
 .../store/SoftlinkHdfsDirectoryTestSuite.java   |   5 +-
 9 files changed, 332 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/28470cd6/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/BaseCache.java
----------------------------------------------------------------------
diff --git a/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/BaseCache.java b/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/BaseCache.java
index 9dd1a29..d403778 100644
--- a/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/BaseCache.java
+++ b/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/BaseCache.java
@@ -25,6 +25,8 @@ import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicLong;
 
+import org.apache.blur.log.Log;
+import org.apache.blur.log.LogFactory;
 import org.apache.blur.store.blockcache_v2.cachevalue.ByteArrayCacheValue;
 import org.apache.blur.store.blockcache_v2.cachevalue.UnsafeCacheValue;
 import org.apache.lucene.store.IOContext;
@@ -34,6 +36,9 @@ import com.googlecode.concurrentlinkedhashmap.EvictionListener;
 import com.googlecode.concurrentlinkedhashmap.Weigher;
 
 public class BaseCache implements Cache {
+
+  private static final Log LOG = LogFactory.getLog(BaseCache.class);
+
   public enum STORE {
     ON_HEAP, OFF_HEAP
   }
@@ -78,7 +83,7 @@ public class BaseCache implements Cache {
         value.release();
         return;
       }
-      // @TODO create clean up queue
+      LOG.debug("CacheValue was not released [{0}]", value);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/28470cd6/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/CacheIndexInput.java
----------------------------------------------------------------------
diff --git a/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/CacheIndexInput.java
b/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/CacheIndexInput.java
index 0313fa6..344f598 100644
--- a/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/CacheIndexInput.java
+++ b/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/CacheIndexInput.java
@@ -30,11 +30,12 @@ public class CacheIndexInput extends IndexInput {
   private final int _bufferSize;
   private final CacheDirectory _directory;
   private final String _fileName;
-  private final IndexInput _indexInput;
   private final Cache _cache;
-  private final CacheKey _key = new CacheKey();
 
+  private IndexInput _indexInput;
+  private CacheKey _key = new CacheKey();
   private CacheValue _cacheValue;
+
   private long _position;
   private int _blockPosition;
 
@@ -99,8 +100,6 @@ public class CacheIndexInput extends IndexInput {
   }
 
   private void fill() throws IOException {
-//    System.out.println("Filling [" + _directory + "/" + _fileName + "] @ [" + getBlockId()
+ "] length [" + _fileLength
-//        + "]");
     _key.setBlockId(getBlockId());
     _cacheValue = _cache.get(_key);
     if (_cacheValue == null) {
@@ -117,6 +116,7 @@ public class CacheIndexInput extends IndexInput {
         len -= length;
         cachePosition += length;
       }
+      BufferStore.putBuffer(buffer);
     }
     _cache.put(_key.clone(), _cacheValue);
     _cacheValue.incRef();
@@ -143,6 +143,7 @@ public class CacheIndexInput extends IndexInput {
   @Override
   public void close() throws IOException {
     _indexInput.close();
+    releaseCache();
   }
 
   @Override
@@ -155,9 +156,18 @@ public class CacheIndexInput extends IndexInput {
     if (pos >= _fileLength) {
       throw new IOException("Can not seek past end of file [" + pos + "] filelength [" +
_fileLength + "]");
     }
+    if (_position == pos) {
+      // Seeking to same position
+      return;
+    }
     long oldBlockId = getBlockId();
+    if (_blockPosition == _cacheBlockSize) {
+      // If we are at the end of the current block, but haven't actually fetched
+      // the next block then we are really on the previous.
+      oldBlockId--;
+    }
     _position = pos;
-    long newBlockId = getBlockId(pos);
+    long newBlockId = getBlockId(_position);
     if (newBlockId == oldBlockId) {
       // need to set new block position
       _blockPosition = getBlockPosition();
@@ -171,4 +181,15 @@ public class CacheIndexInput extends IndexInput {
     return _fileLength;
   }
 
+  @Override
+  public IndexInput clone() {
+    CacheIndexInput clone = (CacheIndexInput) super.clone();
+    clone._key = _key.clone();
+    clone._indexInput = _indexInput.clone();
+    if (clone._cacheValue != null) {
+      clone._cacheValue.incRef();
+    }
+    return clone;
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/28470cd6/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/cachevalue/BaseCacheValue.java
----------------------------------------------------------------------
diff --git a/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/cachevalue/BaseCacheValue.java
b/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/cachevalue/BaseCacheValue.java
index a5e10a3..0f36086 100644
--- a/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/cachevalue/BaseCacheValue.java
+++ b/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/cachevalue/BaseCacheValue.java
@@ -25,6 +25,7 @@ import org.apache.blur.store.blockcache_v2.CacheValue;
 public abstract class BaseCacheValue extends AtomicLong implements CacheValue {
 
   private final int _length;
+  protected volatile boolean _released = false;
 
   public BaseCacheValue(int length) {
     _length = length;
@@ -80,4 +81,10 @@ public abstract class BaseCacheValue extends AtomicLong implements CacheValue
{
     return get();
   }
 
+  @Override
+  protected void finalize() throws Throwable {
+    if (!_released) {
+      release();
+    }
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/28470cd6/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/cachevalue/ByteArrayCacheValue.java
----------------------------------------------------------------------
diff --git a/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/cachevalue/ByteArrayCacheValue.java
b/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/cachevalue/ByteArrayCacheValue.java
index c4d84bf..5f4db4f 100644
--- a/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/cachevalue/ByteArrayCacheValue.java
+++ b/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/cachevalue/ByteArrayCacheValue.java
@@ -44,12 +44,11 @@ public class ByteArrayCacheValue extends BaseCacheValue {
 
   @Override
   public void release() {
-    // no op
+    _released = true;
   }
 
   @Override
   public int size() {
     return length();
   }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/28470cd6/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/cachevalue/UnsafeCacheValue.java
----------------------------------------------------------------------
diff --git a/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/cachevalue/UnsafeCacheValue.java
b/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/cachevalue/UnsafeCacheValue.java
index d8e1cad..c532f62 100644
--- a/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/cachevalue/UnsafeCacheValue.java
+++ b/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/cachevalue/UnsafeCacheValue.java
@@ -24,13 +24,12 @@ import sun.misc.Unsafe;
 @SuppressWarnings("serial")
 public class UnsafeCacheValue extends BaseCacheValue {
 
-//  private static final int MINIMUM_SIZE = 1024;
-
+  private static final String JAVA_NIO_BITS = "java.nio.Bits";
   private static final Unsafe _unsafe;
 
   static {
     try {
-      Class<?> clazz = Class.forName("java.nio.Bits");
+      Class<?> clazz = Class.forName(JAVA_NIO_BITS);
       Field field = clazz.getDeclaredField("unsafe");
       field.setAccessible(true);
       _unsafe = (Unsafe) field.get(null);
@@ -62,9 +61,6 @@ public class UnsafeCacheValue extends BaseCacheValue {
   }
 
   private int getCapacity(int length) {
-//    if (length < MINIMUM_SIZE) {
-//      return MINIMUM_SIZE;
-//    }
     return length;
   }
 
@@ -93,7 +89,6 @@ public class UnsafeCacheValue extends BaseCacheValue {
       _unsafe.freeMemory(_address);
       _released = true;
     } else {
-      System.out.println("released twice?");
       new Throwable().printStackTrace();
     }
   }
@@ -102,5 +97,4 @@ public class UnsafeCacheValue extends BaseCacheValue {
   public int size() {
     return _capacity;
   }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/28470cd6/blur-store/src/test/java/org/apache/blur/store/BaseDirectoryTestSuite.java
----------------------------------------------------------------------
diff --git a/blur-store/src/test/java/org/apache/blur/store/BaseDirectoryTestSuite.java b/blur-store/src/test/java/org/apache/blur/store/BaseDirectoryTestSuite.java
index 48364ca..300394e 100644
--- a/blur-store/src/test/java/org/apache/blur/store/BaseDirectoryTestSuite.java
+++ b/blur-store/src/test/java/org/apache/blur/store/BaseDirectoryTestSuite.java
@@ -64,6 +64,7 @@ public abstract class BaseDirectoryTestSuite {
   protected static final int MAX_NUMBER_OF_READS = 10000;
   protected Directory directory;
   protected File file;
+  protected File fileControl;
   protected long seed;
   protected Random random;
 
@@ -71,10 +72,12 @@ public abstract class BaseDirectoryTestSuite {
   public void setUp() throws IOException {
     BufferStore.init(128, 128);
     file = new File(TMPDIR, "hdfsdirectorytest");
+    fileControl = new File(TMPDIR, "hdfsdirectorytest-control");
     rm(file);
+    rm(fileControl);
     seed = new Random().nextLong();
     random = new Random(seed);
-    setupDirectory();
+    directory = setupDirectory();
   }
 
   @After
@@ -96,7 +99,7 @@ public abstract class BaseDirectoryTestSuite {
     }
   }
 
-  protected abstract void setupDirectory() throws IOException;
+  protected abstract Directory setupDirectory() throws IOException;
 
   @Test
   public void testWritingAndReadingAFile() throws IOException {
@@ -175,9 +178,14 @@ public abstract class BaseDirectoryTestSuite {
 
   @Test
   public void testCreateIndex() throws IOException {
+    long s = System.nanoTime();
     IndexWriterConfig conf = new IndexWriterConfig(LuceneVersionConstant.LUCENE_VERSION,
new KeywordAnalyzer());
-    IndexWriter writer = new IndexWriter(directory, conf);
-    int numDocs = 1000;
+    FSDirectory control = FSDirectory.open(fileControl);
+    Directory dir = getControlDir(control, directory);
+    // The serial merge scheduler can be useful for debugging.
+    // conf.setMergeScheduler(new SerialMergeScheduler());
+    IndexWriter writer = new IndexWriter(dir, conf);
+    int numDocs = 10000;
     DirectoryReader reader = null;
     for (int i = 0; i < 100; i++) {
       if (reader == null) {
@@ -200,6 +208,8 @@ public abstract class BaseDirectoryTestSuite {
     }
     writer.close(false);
     reader.close();
+    long e = System.nanoTime();
+    System.out.println("Total time [" + (e - s) / 1000000.0 + " ms]");
   }
 
   private void addDocuments(IndexWriter writer, int numDocs) throws IOException {
@@ -372,4 +382,269 @@ public abstract class BaseDirectoryTestSuite {
     }
   }
 
+  private Directory getControlDir(final Directory control, final Directory test) {
+    return new Directory() {
+
+      @Override
+      public Lock makeLock(String name) {
+        return control.makeLock(name);
+      }
+
+      @Override
+      public void clearLock(String name) throws IOException {
+        control.clearLock(name);
+      }
+
+      @Override
+      public void setLockFactory(LockFactory lockFactory) throws IOException {
+        control.setLockFactory(lockFactory);
+      }
+
+      @Override
+      public LockFactory getLockFactory() {
+        return control.getLockFactory();
+      }
+
+      @Override
+      public String getLockID() {
+        return control.getLockID();
+      }
+
+      @Override
+      public void copy(Directory to, String src, String dest, IOContext context) throws IOException
{
+        control.copy(to, src, dest, context);
+      }
+
+      @Override
+      public IndexInputSlicer createSlicer(String name, IOContext context) throws IOException
{
+        return control.createSlicer(name, context);
+      }
+
+      @Override
+      public IndexOutput createOutput(final String name, IOContext context) throws IOException
{
+        final IndexOutput testOutput = test.createOutput(name, context);
+        final IndexOutput controlOutput = control.createOutput(name, context);
+        return new IndexOutput() {
+
+          @Override
+          public void flush() throws IOException {
+            testOutput.flush();
+            controlOutput.flush();
+          }
+
+          @Override
+          public void close() throws IOException {
+            testOutput.close();
+            controlOutput.close();
+          }
+
+          @Override
+          public long getFilePointer() {
+            long filePointer = testOutput.getFilePointer();
+            long controlFilePointer = controlOutput.getFilePointer();
+            if (controlFilePointer != filePointer) {
+              System.err.println("Output Name [" + name + "] with filePointer [" + filePointer
+                  + "] and control filePointer [" + controlFilePointer + "] does not match");
+            }
+            return filePointer;
+          }
+
+          @SuppressWarnings("deprecation")
+          @Override
+          public void seek(long pos) throws IOException {
+            testOutput.seek(pos);
+            controlOutput.seek(pos);
+          }
+
+          @Override
+          public long length() throws IOException {
+            long length = testOutput.length();
+            long controlLength = controlOutput.length();
+            if (controlLength != length) {
+              System.err.println("Ouput Name [" + name + "] with length [" + length + "]
and control length ["
+                  + controlLength + "] does not match");
+            }
+            return length;
+          }
+
+          @Override
+          public void writeByte(byte b) throws IOException {
+            testOutput.writeByte(b);
+            controlOutput.writeByte(b);
+          }
+
+          @Override
+          public void writeBytes(byte[] b, int offset, int length) throws IOException {
+            testOutput.writeBytes(b, offset, length);
+            controlOutput.writeBytes(b, offset, length);
+          }
+
+        };
+      }
+
+      @Override
+      public IndexInput openInput(final String name, IOContext context) throws IOException
{
+        final IndexInput testInput = test.openInput(name, context);
+        final IndexInput controlInput = control.openInput(name, context);
+        return new IndexInputCompare(name, testInput, controlInput);
+      }
+
+      @Override
+      public String[] listAll() throws IOException {
+        return test.listAll();
+      }
+
+      @Override
+      public boolean fileExists(String name) throws IOException {
+        return test.fileExists(name);
+      }
+
+      @Override
+      public void deleteFile(String name) throws IOException {
+        test.deleteFile(name);
+        control.deleteFile(name);
+      }
+
+      @Override
+      public long fileLength(String name) throws IOException {
+        long fileLength = test.fileLength(name);
+        long controlFileLength = control.fileLength(name);
+        if (controlFileLength != fileLength) {
+          System.err.println("Input Name [" + name + "] with length [" + fileLength + "]
and control length ["
+              + controlFileLength + "] does not match");
+        }
+        return fileLength;
+      }
+
+      @Override
+      public void sync(Collection<String> names) throws IOException {
+        test.sync(names);
+        test.sync(names);
+      }
+
+      @Override
+      public void close() throws IOException {
+        test.close();
+        control.close();
+      }
+    };
+  }
+
+  static class IndexInputCompare extends IndexInput {
+
+    IndexInput testInput;
+    IndexInput controlInput;
+    String name;
+
+    protected IndexInputCompare(String name, IndexInput testInput, IndexInput controlInput)
{
+      super(name);
+      this.name = name;
+      this.testInput = testInput;
+      this.controlInput = controlInput;
+    }
+
+    @Override
+    public void readBytes(byte[] b, int offset, int len) throws IOException {
+      breakPoint();
+      long filePointer = getFilePointer();
+      testInput.readBytes(b, offset, len);
+      byte[] newbuf = new byte[b.length];
+      controlInput.readBytes(newbuf, offset, len);
+      compare(filePointer, b, newbuf, offset, len);
+      getFilePointer();
+    }
+
+    private void breakPoint() {
+      // if (name.equals("_1e_Lucene41_0.doc")) {
+      // if (controlInput.getFilePointer() > 123435) {
+      // System.out.println("break [" + controlInput.getFilePointer() + "] [" +
+      // controlInput.length() + "]");
+      // }
+      // }
+    }
+
+    @Override
+    public byte readByte() throws IOException {
+      breakPoint();
+      long length = controlInput.length();
+      long filePointer = getFilePointer();
+      byte readByte = testInput.readByte();
+      byte controlReadByte = controlInput.readByte();
+      if (readByte != controlReadByte) {
+        System.err.println("Input Name [" + name + "] at filePointer [" + filePointer + "]
byte [" + readByte
+            + "] does not match byte [" + controlReadByte + "] with length [" + length +
"]");
+        throw new RuntimeException("Input Name [" + name + "] at filePointer [" + filePointer
+ "] byte [" + readByte
+            + "] does not match byte [" + controlReadByte + "] with length [" + length +
"]");
+      }
+      getFilePointer();
+      return readByte;
+    }
+
+    private void compare(long filePointer, byte[] b1, byte[] b2, int offset, int len) {
+      int length = offset + len;
+      for (int i = offset; i < length; i++) {
+        if (b1[i] != b2[i]) {
+          System.err.println("Input Name [" + name + "] with at filePointer [" + filePointer
+ "] b1 [" + b1
+              + "] does not match b2 [" + b2 + "]");
+          throw new RuntimeException("Input Name [" + name + "] with at filePointer [" +
filePointer + "] b1 [" + b1
+              + "] does not match b2 [" + b2 + "]");
+        }
+      }
+    }
+
+    @Override
+    public void seek(long pos) throws IOException {
+      breakPoint();
+      getFilePointer();
+      testInput.seek(pos);
+      controlInput.seek(pos);
+      getFilePointer();
+    }
+
+    @Override
+    public long length() {
+      breakPoint();
+      long length = testInput.length();
+      long controlLength = controlInput.length();
+      if (length != controlLength) {
+        System.err.println("Input Name [" + name + "] with length [" + length + "] and control
length ["
+            + controlLength + "] does not match");
+        throw new RuntimeException("Input Name [" + name + "] with length [" + length + "]
and control length ["
+            + controlLength + "] does not match");
+      }
+      return length;
+    }
+
+    @Override
+    public long getFilePointer() {
+      long filePointer = testInput.getFilePointer();
+      long controlFilePointer = controlInput.getFilePointer();
+      if (filePointer != controlFilePointer) {
+        System.err.println("Input Name [" + name + "] with filePointer [" + filePointer +
"] and control filePointer ["
+            + controlFilePointer + "] does not match");
+        throw new RuntimeException("Input Name [" + name + "] with filePointer [" + filePointer
+            + "] and control filePointer [" + controlFilePointer + "] does not match");
+      }
+      return filePointer;
+    }
+
+    @Override
+    public void close() throws IOException {
+      controlInput.close();
+      testInput.close();
+    }
+
+    @Override
+    public IndexInput clone() {
+      IndexInputCompare clone = (IndexInputCompare) super.clone();
+      clone.controlInput = controlInput.clone();
+      clone.testInput = testInput.clone();
+      return clone;
+    }
+
+  }
+
+  public int numberBetween(int min, int max) {
+    return random.nextInt(max - min) + min;
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/28470cd6/blur-store/src/test/java/org/apache/blur/store/CacheDirectoryTestSuite.java
----------------------------------------------------------------------
diff --git a/blur-store/src/test/java/org/apache/blur/store/CacheDirectoryTestSuite.java b/blur-store/src/test/java/org/apache/blur/store/CacheDirectoryTestSuite.java
index 2085bd0..ae7c356 100644
--- a/blur-store/src/test/java/org/apache/blur/store/CacheDirectoryTestSuite.java
+++ b/blur-store/src/test/java/org/apache/blur/store/CacheDirectoryTestSuite.java
@@ -32,10 +32,10 @@ import org.apache.lucene.store.FSDirectory;
 public abstract class CacheDirectoryTestSuite extends BaseDirectoryTestSuite {
 
   @Override
-  protected void setupDirectory() throws IOException {
+  protected Directory setupDirectory() throws IOException {
     int totalNumberOfBytes = 1000000;
-    int fileBufferSize = 129;
-    final int blockSize = 137;
+    int fileBufferSize = numberBetween(113, 215);
+    final int blockSize = numberBetween(111, 251);
     FileNameBlockSize fileNameBlockSize = new FileNameBlockSize() {
       @Override
       public int getBlockSize(String directoryName, String fileName) {
@@ -51,8 +51,7 @@ public abstract class CacheDirectoryTestSuite extends BaseDirectoryTestSuite
{
     FileNameFilter readFilter = new FileNameFilter() {
       @Override
       public boolean accept(String directoryName, String fileName) {
-        // @TODO this needs to be enabled and issues resolved...
-        return false;
+        return true;
       }
     };
 
@@ -61,7 +60,7 @@ public abstract class CacheDirectoryTestSuite extends BaseDirectoryTestSuite
{
     Directory dir = FSDirectory.open(new File(file, "cache"));
 
     BufferStore.init(128, 128);
-    directory = new CacheDirectory("test", wrapLastModified(dir), cache);
+    return new CacheDirectory("test", wrapLastModified(dir), cache);
   }
 
   protected abstract STORE getStore();

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/28470cd6/blur-store/src/test/java/org/apache/blur/store/HdfsDirectoryTestSuite.java
----------------------------------------------------------------------
diff --git a/blur-store/src/test/java/org/apache/blur/store/HdfsDirectoryTestSuite.java b/blur-store/src/test/java/org/apache/blur/store/HdfsDirectoryTestSuite.java
index 7079c5c..e39147f 100644
--- a/blur-store/src/test/java/org/apache/blur/store/HdfsDirectoryTestSuite.java
+++ b/blur-store/src/test/java/org/apache/blur/store/HdfsDirectoryTestSuite.java
@@ -23,16 +23,17 @@ import java.net.URI;
 import org.apache.blur.store.hdfs.HdfsDirectory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
+import org.apache.lucene.store.Directory;
 import org.junit.Test;
 
 public class HdfsDirectoryTestSuite extends BaseDirectoryTestSuite {
 
   @Override
-  protected void setupDirectory() throws IOException {
+  protected Directory setupDirectory() throws IOException {
     URI uri = new File(file, "hdfs").toURI();
     Path hdfsDirPath = new Path(uri.toString());
     Configuration conf = new Configuration();
-    directory = new HdfsDirectory(conf, hdfsDirPath);
+    return new HdfsDirectory(conf, hdfsDirPath);
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/28470cd6/blur-store/src/test/java/org/apache/blur/store/SoftlinkHdfsDirectoryTestSuite.java
----------------------------------------------------------------------
diff --git a/blur-store/src/test/java/org/apache/blur/store/SoftlinkHdfsDirectoryTestSuite.java
b/blur-store/src/test/java/org/apache/blur/store/SoftlinkHdfsDirectoryTestSuite.java
index d6648cf..450afaf 100644
--- a/blur-store/src/test/java/org/apache/blur/store/SoftlinkHdfsDirectoryTestSuite.java
+++ b/blur-store/src/test/java/org/apache/blur/store/SoftlinkHdfsDirectoryTestSuite.java
@@ -23,18 +23,19 @@ import java.net.URI;
 import org.apache.blur.store.hdfs.SoftlinkHdfsDirectory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
+import org.apache.lucene.store.Directory;
 import org.junit.Test;
 
 public class SoftlinkHdfsDirectoryTestSuite extends BaseDirectoryTestSuite {
 
   @Override
-  protected void setupDirectory() throws IOException {
+  protected Directory setupDirectory() throws IOException {
     URI uri = new File(file, "hdfs").toURI();
     Path hdfsDirPath = new Path(uri.toString());
     Path store = new Path(hdfsDirPath, "store");
     Path link = new Path(hdfsDirPath, "link");
     Configuration conf = new Configuration();
-    directory = new SoftlinkHdfsDirectory(conf, store, link);
+    return new SoftlinkHdfsDirectory(conf, store, link);
   }
 
   @Test


Mime
View raw message