incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject git commit: Test was still failing with assertions enabled.
Date Tue, 16 Jun 2015 18:33:25 GMT
Repository: incubator-blur
Updated Branches:
  refs/heads/master 6a5867c25 -> b50880d67


Test was still failing with assertions enabled.


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

Branch: refs/heads/master
Commit: b50880d67660f5871c2026ad1fb42053757dba23
Parents: 6a5867c
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Tue Jun 16 14:33:13 2015 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Tue Jun 16 14:33:13 2015 -0400

----------------------------------------------------------------------
 .../apache/lucene/index/BlurIndexWriter.java    |  7 ++++++
 .../blur/lucene/index/BlurIndexWriterTest.java  | 24 ++++++++++----------
 2 files changed, 19 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b50880d6/blur-store/src/main/java/org/apache/lucene/index/BlurIndexWriter.java
----------------------------------------------------------------------
diff --git a/blur-store/src/main/java/org/apache/lucene/index/BlurIndexWriter.java b/blur-store/src/main/java/org/apache/lucene/index/BlurIndexWriter.java
index 309489e..05b40be 100644
--- a/blur-store/src/main/java/org/apache/lucene/index/BlurIndexWriter.java
+++ b/blur-store/src/main/java/org/apache/lucene/index/BlurIndexWriter.java
@@ -54,6 +54,7 @@ public class BlurIndexWriter extends org.apache.lucene.index.IndexWriter
{
       throw new RuntimeException("Could not get the write lock instance.", e);
     }
     _makeReaderExitable = makeReaderExitable;
+    deleteUnusedFiles();
   }
 
   private static Directory fence(Directory directory) {
@@ -69,6 +70,12 @@ public class BlurIndexWriter extends org.apache.lucene.index.IndexWriter
{
   }
 
   @Override
+  public synchronized void deleteUnusedFiles() throws IOException {
+    deleter.refresh();
+    super.deleteUnusedFiles();
+  }
+
+  @Override
   DirectoryReader getReader() throws IOException {
     return wrap(super.getReader());
   }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b50880d6/blur-store/src/test/java/org/apache/blur/lucene/index/BlurIndexWriterTest.java
----------------------------------------------------------------------
diff --git a/blur-store/src/test/java/org/apache/blur/lucene/index/BlurIndexWriterTest.java
b/blur-store/src/test/java/org/apache/blur/lucene/index/BlurIndexWriterTest.java
index a18a72e..f2c2025 100644
--- a/blur-store/src/test/java/org/apache/blur/lucene/index/BlurIndexWriterTest.java
+++ b/blur-store/src/test/java/org/apache/blur/lucene/index/BlurIndexWriterTest.java
@@ -62,29 +62,29 @@ public class BlurIndexWriterTest {
     Thread thread1 = new Thread(new Runnable() {
       @Override
       public void run() {
-        BlurIndexWriter writer1 = null;
+        BlurIndexWriter writer = null;
         try {
           BlurLockFactory blurLockFactory = new BlurLockFactory(_configuration, hdfsDirPath,
"node1", "1");
           directory.setLockFactory(blurLockFactory);
           IndexWriterConfig conf = new IndexWriterConfig(Version.LUCENE_43, new KeywordAnalyzer());
           conf.setInfoStream(getInfoStream());
-          writer1 = new BlurIndexWriter(directory, conf);
-          writer1.addIndexes(addDir("1"));
+          writer = new BlurIndexWriter(directory, conf);
+          writer.addIndexes(addDir("1"));
           waitToLooseLock();
-          writer1.prepareCommit();
+          writer.prepareCommit();
           fail1.set(true);
         } catch (IOException e) {
           e.printStackTrace();
-          if (writer1 != null) {
+          if (writer != null) {
             try {
-              writer1.rollback();
+              writer.rollback();
             } catch (IOException e1) {
               e1.printStackTrace();
             }
           }
-          if (writer1 != null) {
+          if (writer != null) {
             try {
-              writer1.close();
+              writer.close();
             } catch (IOException e1) {
               e1.printStackTrace();
             }
@@ -102,11 +102,11 @@ public class BlurIndexWriterTest {
           directory.setLockFactory(blurLockFactory);
           IndexWriterConfig conf = new IndexWriterConfig(Version.LUCENE_43, new KeywordAnalyzer());
           conf.setInfoStream(getInfoStream());
-          BlurIndexWriter writer1 = new BlurIndexWriter(directory, conf);
+          BlurIndexWriter writer = new BlurIndexWriter(directory, conf);
           obtainLock();
-          writer1.addIndexes(addDir("2"));
-          writer1.commit();
-          writer1.close();
+          writer.addIndexes(addDir("2"));
+          writer.commit();
+          writer.close();
         } catch (IOException e) {
           e.printStackTrace();
           fail2.set(true);


Mime
View raw message