From cb14da3b120ee8436a98c60142eac731b2a93469 Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Fri, 8 Dec 2017 14:10:35 +0100 Subject: [PATCH 1/2] TEST: Stabelize TestIndexWriter#testCheckPendingFlushPostUpdate --- .../apache/lucene/index/TestIndexWriter.java | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java index 76a81727f6e..bbedc202aa3 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java @@ -2900,7 +2900,7 @@ public class TestIndexWriter extends LuceneTestCase { .setMaxBufferedDocs(Integer.MAX_VALUE) .setRAMBufferSizeMB(IndexWriterConfig.DISABLE_AUTO_FLUSH)); AtomicBoolean done = new AtomicBoolean(false); - int numThreads = 1 + random().nextInt(3); + int numThreads = 2 + random().nextInt(3); CountDownLatch latch = new CountDownLatch(numThreads); Set indexingThreads = new HashSet<>(); Thread[] threads = new Thread[numThreads]; @@ -2929,7 +2929,7 @@ public class TestIndexWriter extends LuceneTestCase { try { int numIters = rarely() ? 1 + random().nextInt(5) : 1; for (int i = 0; i < numIters; i++) { - waitForDocs(w); + waitForDocsInBuffers(w, Math.min(2, threads.length)); w.commit(); assertTrue(flushingThreads.toString(), flushingThreads.contains(Thread.currentThread().getName())); flushingThreads.retainAll(indexingThreads); @@ -2939,7 +2939,7 @@ public class TestIndexWriter extends LuceneTestCase { numIters = 0; while (true) { assertFalse("should finish in less than 100 iterations", numIters++ >= 100); - waitForDocs(w); + waitForDocsInBuffers(w, Math.min(2, threads.length)); w.flush(); flushingThreads.retainAll(indexingThreads); if (flushingThreads.isEmpty() == false) { @@ -2955,10 +2955,25 @@ public class TestIndexWriter extends LuceneTestCase { } } - private static void waitForDocs(IndexWriter w) { - int numDocsInRam = w.numRamDocs(); + private static void waitForDocsInBuffers(IndexWriter w, int buffersWithDocs) { + // wait until at least N threadstates have a doc in order to observe + // who flushes the segments. while(true) { - if (numDocsInRam != w.numRamDocs()) { + int numStatesWithDocs = 0; + DocumentsWriterPerThreadPool perThreadPool = w.docWriter.perThreadPool; + for (int i = 0; i < perThreadPool.getActiveThreadStateCount(); i++) { + DocumentsWriterPerThreadPool.ThreadState threadState = perThreadPool.getThreadState(i); + threadState.lock(); + try { + DocumentsWriterPerThread dwpt = threadState.dwpt; + if (dwpt != null && dwpt.getNumDocsInRAM() > 1) { + numStatesWithDocs++; + } + } finally { + threadState.unlock(); + } + } + if (numStatesWithDocs >= buffersWithDocs) { return; } } From 3a7f1071644ffe11ee74c96cfd4946204b6544b5 Mon Sep 17 00:00:00 2001 From: Scott Blum Date: Fri, 8 Dec 2017 14:25:44 -0500 Subject: [PATCH 2/2] SOLR-11423: fix solr/CHANGES.txt, fixed in 7.2 not 7.1 --- solr/CHANGES.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 148b069da83..1218171f7f3 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -160,6 +160,8 @@ New Features Bug Fixes ---------------------- +* SOLR-11423: Overseer queue needs a hard cap (maximum size) that clients respect (Scott Blum, Joshua Humphries, Noble Paul) + * SOLR-11445: Overseer should not hang when process bad message. (Cao Manh Dat, shalin) * SOLR-11447: ZkStateWriter should process commands in atomic. (Cao Manh Dat, shalin) @@ -443,8 +445,6 @@ New Features Bug Fixes ---------------------- -* SOLR-11423: Overseer queue needs a hard cap (maximum size) that clients respect (Scott Blum, Joshua Humphries, Noble Paul) - * SOLR-10602: Triggers should be able to restore state from old instances when taking over. (shalin) * SOLR-10714: OverseerTriggerThread does not start triggers on overseer start until autoscaling