incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [2/3] git commit: Fixing a bug in the index closer. It would always close a reader reguardless if the reading was ready to be closer or not.
Date Thu, 06 Feb 2014 18:58:54 GMT
Fixing a bug in the index closer. It would always close a reader reguardless if the reading
was ready to be closer or not.


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

Branch: refs/heads/apache-blur-0.2
Commit: cfa3a070fc68bc7a188c8c533cbc3b478beced1e
Parents: 41e44e8
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Thu Feb 6 07:56:58 2014 -0500
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Thu Feb 6 07:56:58 2014 -0500

----------------------------------------------------------------------
 .../java/org/apache/blur/manager/writer/BlurIndexCloser.java    | 5 ++++-
 .../org/apache/blur/manager/writer/BlurIndexSimpleWriter.java   | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/cfa3a070/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexCloser.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexCloser.java b/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexCloser.java
index b31838d..f3aa777 100644
--- a/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexCloser.java
+++ b/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexCloser.java
@@ -86,11 +86,14 @@ public class BlurIndexCloser implements Runnable, Closeable {
       } else {
         LOG.debug("Could not close indexreader [" + reader + "] because of ref count [" +
reader.getRefCount() + "].");
       }
-      closeInternal(reader);
     }
   }
 
   private void closeInternal(final IndexReader reader) {
+    if (reader.getRefCount() == 0) {
+      // Already closed.
+      return;
+    }
     executorService.submit(new Runnable() {
       @Override
       public void run() {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/cfa3a070/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexSimpleWriter.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexSimpleWriter.java
b/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexSimpleWriter.java
index 3804f1a..26ecb34 100644
--- a/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexSimpleWriter.java
+++ b/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexSimpleWriter.java
@@ -72,7 +72,7 @@ public class BlurIndexSimpleWriter extends BlurIndex {
   private final Lock _writeLock = _lock.writeLock();
   private final ReadWriteLock _indexRefreshLock = new ReentrantReadWriteLock();
   private final Lock _indexRefreshWriteLock = _indexRefreshLock.writeLock();
-  private final Lock _indexRefreshReadLock = _indexRefreshLock.writeLock();
+  private final Lock _indexRefreshReadLock = _indexRefreshLock.readLock();
   private Thread _optimizeThread;
   private Thread _writerOpener;
   private final IndexDeletionPolicyReader _policy;


Mime
View raw message