lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sha...@apache.org
Subject [10/28] lucene-solr:feature/autoscaling: LUCENE-7868: fix race condition when reader pooling is disabled
Date Fri, 07 Jul 2017 04:24:22 GMT
LUCENE-7868: fix race condition when reader pooling is disabled


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/7c704d52
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/7c704d52
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/7c704d52

Branch: refs/heads/feature/autoscaling
Commit: 7c704d5258b3be8c383ccb96bf4a30be441f091c
Parents: f0cc376
Author: Mike McCandless <mikemccand@apache.org>
Authored: Wed Jul 5 16:53:05 2017 -0400
Committer: Mike McCandless <mikemccand@apache.org>
Committed: Wed Jul 5 16:53:05 2017 -0400

----------------------------------------------------------------------
 lucene/core/src/java/org/apache/lucene/index/IndexWriter.java | 2 +-
 .../src/java/org/apache/lucene/index/ReadersAndUpdates.java   | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/7c704d52/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java b/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
index c2cded7..05608b4 100644
--- a/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
+++ b/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
@@ -3758,7 +3758,6 @@ public class IndexWriter implements Closeable, TwoPhaseCommit, Accountable
{
       // and re-resolve against the newly merged segment:
       
       Map<String,List<DocValuesFieldUpdates>> mergingDVUpdates = rld.getMergingDVUpdates();
-
       for (Map.Entry<String,List<DocValuesFieldUpdates>> ent : mergingDVUpdates.entrySet())
{
 
         String field = ent.getKey();
@@ -4356,6 +4355,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit, Accountable
{
         // Hold onto the "live" reader; we will use this to
         // commit merged deletes
         final ReadersAndUpdates rld = readerPool.get(info, true);
+        rld.setIsMerging();
 
         SegmentReader reader = rld.getReaderForMerge(context);
         int delCount = reader.numDeletedDocs();

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/7c704d52/lucene/core/src/java/org/apache/lucene/index/ReadersAndUpdates.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/index/ReadersAndUpdates.java b/lucene/core/src/java/org/apache/lucene/index/ReadersAndUpdates.java
index dd49fcb..0e32256 100644
--- a/lucene/core/src/java/org/apache/lucene/index/ReadersAndUpdates.java
+++ b/lucene/core/src/java/org/apache/lucene/index/ReadersAndUpdates.java
@@ -811,9 +811,10 @@ class ReadersAndUpdates {
   synchronized public void setIsMerging() {
     // This ensures any newly resolved doc value updates while we are merging are
     // saved for re-applying after this segment is done merging:
-    isMerging = true;
-
-    assert mergingDVUpdates.isEmpty();
+    if (isMerging == false) {
+      isMerging = true;
+      assert mergingDVUpdates.isEmpty();
+    }
   }
 
   /** Returns a reader for merge, with the latest doc values updates and deletions. */


Mime
View raw message