You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by si...@apache.org on 2020/04/11 17:54:16 UTC
[lucene-solr] branch branch_8x updated: LUCENE-9309: ensure
stopMerges is set under IW lock
This is an automated email from the ASF dual-hosted git repository.
simonw pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/branch_8x by this push:
new c54885f LUCENE-9309: ensure stopMerges is set under IW lock
c54885f is described below
commit c54885fb99c64d2f520b5a4a4bc10440c88317be
Author: Simon Willnauer <si...@apache.org>
AuthorDate: Sat Apr 11 19:53:21 2020 +0200
LUCENE-9309: ensure stopMerges is set under IW lock
---
lucene/core/src/java/org/apache/lucene/index/IndexWriter.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
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 ce058e2..eaca64c 100644
--- a/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
+++ b/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
@@ -2299,8 +2299,12 @@ public class IndexWriter implements Closeable, TwoPhaseCommit, Accountable,
}
try {
- stopMerges = true; // this disables merges forever
- abortMerges();
+ synchronized (this) {
+ // must be synced otherwise register merge might throw and exception if stopMerges
+ // changes concurrently, abortMerges is synced as well
+ stopMerges = true; // this disables merges forever
+ abortMerges();
+ }
if (infoStream.isEnabled("IW")) {
infoStream.message("IW", "rollback: done finish merges");
}