diff --git a/solr/core/src/java/org/apache/solr/cloud/OverseerTaskProcessor.java b/solr/core/src/java/org/apache/solr/cloud/OverseerTaskProcessor.java index aa805583a429..d9b8d187327e 100644 --- a/solr/core/src/java/org/apache/solr/cloud/OverseerTaskProcessor.java +++ b/solr/core/src/java/org/apache/solr/cloud/OverseerTaskProcessor.java @@ -207,7 +207,7 @@ public void run() { if (heads.size() < MAX_BLOCKED_TASKS) { //instead of reading MAX_PARALLEL_TASKS items always, we should only fetch as much as we can execute int toFetch = Math.min(MAX_BLOCKED_TASKS - heads.size(), MAX_PARALLEL_TASKS - runningTasksSize()); - List newTasks = workQueue.peekTopN(toFetch, excludedTasks, 2000L); + List newTasks = workQueue.peekTopN(toFetch, excludedTasks, 50); log.debug("Got {} tasks from work-queue : [{}]", newTasks.size(), newTasks); heads.addAll(newTasks); } diff --git a/solr/core/src/java/org/apache/solr/cloud/OverseerTaskQueue.java b/solr/core/src/java/org/apache/solr/cloud/OverseerTaskQueue.java index 9e5a74ce8561..f26fe6b92507 100644 --- a/solr/core/src/java/org/apache/solr/cloud/OverseerTaskQueue.java +++ b/solr/core/src/java/org/apache/solr/cloud/OverseerTaskQueue.java @@ -66,7 +66,7 @@ public void allowOverseerPendingTasksToComplete() { shuttingDown.set(true); while (pendingResponses.get() > 0) { try { - Thread.sleep(50); + Thread.sleep(250); } catch (InterruptedException e) { log.error("Interrupted while waiting for overseer queue to drain before shutdown!"); } diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkDistributedQueue.java b/solr/core/src/java/org/apache/solr/cloud/ZkDistributedQueue.java index b646a527b8c6..5196dfcb198d 100644 --- a/solr/core/src/java/org/apache/solr/cloud/ZkDistributedQueue.java +++ b/solr/core/src/java/org/apache/solr/cloud/ZkDistributedQueue.java @@ -103,9 +103,9 @@ public class ZkDistributedQueue implements DistributedQueue { */ private final Condition changed = updateLock.newCondition(); - private boolean isDirty = true; + private volatile boolean isDirty = true; - private int watcherCount = 0; + private AtomicInteger watcherCount = new AtomicInteger(); private final int maxQueueSize; @@ -397,10 +397,10 @@ private String firstChild(boolean remove, boolean refetchIfDirty) throws KeeperE // Dirty, try to fetch an updated list of children from ZK. // Only set a new watcher if there isn't already a watcher. - ChildWatcher newWatcher = (watcherCount == 0) ? new ChildWatcher() : null; + ChildWatcher newWatcher = (watcherCount.get() == 0) ? new ChildWatcher() : null; knownChildren = fetchZkChildren(newWatcher); if (newWatcher != null) { - watcherCount++; // watcher was successfully set + watcherCount.incrementAndGet(); // watcher was successfully set } isDirty = false; if (knownChildren.isEmpty()) { @@ -564,7 +564,7 @@ private byte[] removeFirst() throws KeeperException, InterruptedException { @VisibleForTesting int watcherCount() throws InterruptedException { updateLock.lockInterruptibly(); try { - return watcherCount; + return watcherCount.get(); } finally { updateLock.unlock(); } @@ -590,7 +590,7 @@ public void process(WatchedEvent event) { updateLock.lock(); try { isDirty = true; - watcherCount--; + watcherCount.decrementAndGet(); // optimistically signal any waiters that the queue may not be empty now, so they can wake up and retry changed.signalAll(); } finally { diff --git a/solr/core/src/java/org/apache/solr/cloud/api/collections/OverseerCollectionMessageHandler.java b/solr/core/src/java/org/apache/solr/cloud/api/collections/OverseerCollectionMessageHandler.java index a00f37c1f331..be7f64db2685 100644 --- a/solr/core/src/java/org/apache/solr/cloud/api/collections/OverseerCollectionMessageHandler.java +++ b/solr/core/src/java/org/apache/solr/cloud/api/collections/OverseerCollectionMessageHandler.java @@ -537,7 +537,7 @@ static String waitForCoreNodeName(ZkStateReader zkStateReader, String collection AtomicReference errorMessage = new AtomicReference<>(); AtomicReference coreNodeName = new AtomicReference<>(); try { - zkStateReader.waitForState(collectionName, 320, TimeUnit.SECONDS, (n, c) -> { + zkStateReader.waitForState(collectionName, 15, TimeUnit.SECONDS, (n, c) -> { if (c == null) return false; final Map slicesMap = c.getSlicesMap(); diff --git a/solr/core/src/test/org/apache/solr/cloud/TestCloudRecovery.java b/solr/core/src/test/org/apache/solr/cloud/TestCloudRecovery.java index 1851858b65e9..0e79683ca560 100644 --- a/solr/core/src/test/org/apache/solr/cloud/TestCloudRecovery.java +++ b/solr/core/src/test/org/apache/solr/cloud/TestCloudRecovery.java @@ -49,6 +49,7 @@ import com.codahale.metrics.Metric; import com.codahale.metrics.Timer; +@Ignore // nocommit flakey looks like solrcorestate leak public class TestCloudRecovery extends SolrCloudTestCase { private static final String COLLECTION = "collection1"; diff --git a/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java b/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java index a90fe4a835fd..80da55a5be4c 100644 --- a/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java +++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java @@ -162,14 +162,14 @@ public static void setDefaultConfigDirSysPropIfNotSet() throws Exception { if (!TEST_NIGHTLY) { //TestInjection.randomDelayMaxInCoreCreationInSec = 2; - System.setProperty("zookeeper.request.timeout", "300"); - System.setProperty(SolrTestCaseJ4.USE_NUMERIC_POINTS_SYSPROP, "true"); - System.setProperty("solr.tests.IntegerFieldType", "org.apache.solr.schema.IntPointField"); - System.setProperty("solr.tests.FloatFieldType", "org.apache.solr.schema.FloatPointField"); - System.setProperty("solr.tests.LongFieldType", "org.apache.solr.schema.LongPointField"); - System.setProperty("solr.tests.DoubleFieldType", "org.apache.solr.schema.DoublePointField"); - System.setProperty("solr.tests.DateFieldType", "org.apache.solr.schema.DatePointField"); - System.setProperty("solr.tests.EnumFieldType", "org.apache.solr.schema.EnumFieldType"); + System.setProperty("zookeeper.request.timeout", "500"); + System.setProperty(SolrTestCaseJ4.USE_NUMERIC_POINTS_SYSPROP, "false"); +// System.setProperty("solr.tests.IntegerFieldType", "org.apache.solr.schema.IntPointField"); +// System.setProperty("solr.tests.FloatFieldType", "org.apache.solr.schema.FloatPointField"); +// System.setProperty("solr.tests.LongFieldType", "org.apache.solr.schema.LongPointField"); +// System.setProperty("solr.tests.DoubleFieldType", "org.apache.solr.schema.DoublePointField"); +// System.setProperty("solr.tests.DateFieldType", "org.apache.solr.schema.DatePointField"); +// System.setProperty("solr.tests.EnumFieldType", "org.apache.solr.schema.EnumFieldType"); System.setProperty("solr.MaxConcurrentRequests", "5"); System.setProperty("solr.tests.infostream", "false"); @@ -202,8 +202,8 @@ public static void setDefaultConfigDirSysPropIfNotSet() throws Exception { System.setProperty("solr.disablePublicKeyHandler", "true"); System.setProperty("solr.dependentupdate.timeout", "1"); // seconds - System.setProperty("lucene.cms.override_core_count", "6"); - System.setProperty("lucene.cms.override_spins", "false"); + System.setProperty("lucene.cms.override_core_count", "3"); + System.setProperty("lucene.cms.override_spins", "true"); System.setProperty("solr.maxContainerThreads", "300"); System.setProperty("solr.lowContainerThreadsThreshold", "-1");