From b4c6bfafdb32127316b334ffdd195270e1077fbe Mon Sep 17 00:00:00 2001 From: Shalin Shekhar Mangar Date: Wed, 30 Aug 2017 22:59:30 +0530 Subject: [PATCH 1/6] SOLR-11278: Stopping CDCR should cancel a running bootstrap operation --- solr/CHANGES.txt | 2 ++ .../java/org/apache/solr/handler/CdcrReplicatorManager.java | 6 ++++++ .../java/org/apache/solr/handler/CdcrRequestHandler.java | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 6b342fc6437..c27e7cd4df8 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -114,6 +114,8 @@ Bug Fixes contrib/ltr OriginalScoreFeature issues in SolrCloud mode. (Yuki Yano, Jonathan Gonzalez, Ryan Yacyshyn, Christine Poerschke) +* SOLR-11278: Stopping CDCR should cancel a running bootstrap operation. (Amrit Sarkar, shalin) + Optimizations ---------------------- diff --git a/solr/core/src/java/org/apache/solr/handler/CdcrReplicatorManager.java b/solr/core/src/java/org/apache/solr/handler/CdcrReplicatorManager.java index 6f0d7040445..677f5d33e6e 100644 --- a/solr/core/src/java/org/apache/solr/handler/CdcrReplicatorManager.java +++ b/solr/core/src/java/org/apache/solr/handler/CdcrReplicatorManager.java @@ -23,6 +23,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.TimeUnit; @@ -142,6 +143,11 @@ class CdcrReplicatorManager implements CdcrStateManager.CdcrStateObserver { ExecutorUtil.shutdownAndAwaitTermination(bootstrapExecutor); } this.closeLogReaders(); + Callable callable = core.getSolrCoreState().getCdcrBootstrapCallable(); + if (callable != null) { + CdcrRequestHandler.BootstrapCallable bootstrapCallable = (CdcrRequestHandler.BootstrapCallable) callable; + IOUtils.closeQuietly(bootstrapCallable); + } } List getReplicatorStates() { diff --git a/solr/core/src/java/org/apache/solr/handler/CdcrRequestHandler.java b/solr/core/src/java/org/apache/solr/handler/CdcrRequestHandler.java index 65a4cec72a2..caf88f40852 100644 --- a/solr/core/src/java/org/apache/solr/handler/CdcrRequestHandler.java +++ b/solr/core/src/java/org/apache/solr/handler/CdcrRequestHandler.java @@ -713,7 +713,7 @@ public class CdcrRequestHandler extends RequestHandlerBase implements SolrCoreAw } } - private static class BootstrapCallable implements Callable, Closeable { + static class BootstrapCallable implements Callable, Closeable { private final String masterUrl; private final SolrCore core; private volatile boolean closed = false; From c4a1bd52e9b9bf47da1b621023590e0d012f43b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20H=C3=B8ydahl?= Date: Wed, 30 Aug 2017 15:43:30 +0200 Subject: [PATCH 2/6] SOLR-10628: Fix test failures due to global log level change --- .../org/apache/solr/util/StartupLoggingUtils.java | 14 ++++++++++++++ .../src/java/org/apache/solr/SolrTestCaseJ4.java | 6 +++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/solr/core/src/java/org/apache/solr/util/StartupLoggingUtils.java b/solr/core/src/java/org/apache/solr/util/StartupLoggingUtils.java index 4db6a42288e..c582eff4c08 100644 --- a/solr/core/src/java/org/apache/solr/util/StartupLoggingUtils.java +++ b/solr/core/src/java/org/apache/solr/util/StartupLoggingUtils.java @@ -112,4 +112,18 @@ public final class StartupLoggingUtils { log.warn("{} Dynamic log manipulation currently only supported for Log4j. " + "Please consult your logging framework of choice on how to configure the appropriate logging.", msg); } + + /** + * Return a string representing the current static ROOT logging level + * @return a string TRACE, DEBUG, WARN, ERROR or INFO representing current log level. Default is INFO + */ + public static String getLogLevelString() { + final Logger rootLogger = LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); + if (rootLogger.isTraceEnabled()) return "TRACE"; + else if (rootLogger.isDebugEnabled()) return "DEBUG"; + else if (rootLogger.isInfoEnabled()) return "INFO"; + else if (rootLogger.isWarnEnabled()) return "WARN"; + else if (rootLogger.isErrorEnabled()) return "ERROR"; + else return "INFO"; + } } diff --git a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java index 2f2f9cc9c9c..c35004ec395 100644 --- a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java +++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java @@ -122,6 +122,7 @@ import org.apache.solr.util.RandomizeSSL.SSLRandomizer; import org.apache.solr.util.RefCounted; import org.apache.solr.util.RevertDefaultThreadHandlerRule; import org.apache.solr.util.SSLTestConfig; +import org.apache.solr.util.StartupLoggingUtils; import org.apache.solr.util.TestHarness; import org.apache.solr.util.TestInjection; import org.apache.zookeeper.KeeperException; @@ -180,6 +181,8 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase { public static int DEFAULT_CONNECTION_TIMEOUT = 60000; // default socket connection timeout in ms + private static String initialRootLogLevel; + protected void writeCoreProperties(Path coreDirectory, String corename) throws IOException { Properties props = new Properties(); props.setProperty("name", corename); @@ -251,7 +254,7 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase { @BeforeClass public static void setupTestCases() { - + initialRootLogLevel = StartupLoggingUtils.getLogLevelString(); initClassLogLevels(); initCoreDataDir = createTempDir("init-core-data").toFile(); @@ -321,6 +324,7 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase { LogLevel.Configurer.restoreLogLevels(savedClassLogLevels); savedClassLogLevels.clear(); + StartupLoggingUtils.changeLogLevel(initialRootLogLevel); } /** From 4b7171bab5275d6a5eeb60d98b5f76757c9fa0fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20H=C3=B8ydahl?= Date: Wed, 30 Aug 2017 20:32:41 +0200 Subject: [PATCH 3/6] SOLR-11281: Fix precommit failures on unused imports --- .../apache/solr/metrics/reporters/SolrSlf4jReporter.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/solr/core/src/java/org/apache/solr/metrics/reporters/SolrSlf4jReporter.java b/solr/core/src/java/org/apache/solr/metrics/reporters/SolrSlf4jReporter.java index 8043a78d1ca..fdb0e2a1297 100644 --- a/solr/core/src/java/org/apache/solr/metrics/reporters/SolrSlf4jReporter.java +++ b/solr/core/src/java/org/apache/solr/metrics/reporters/SolrSlf4jReporter.java @@ -18,18 +18,10 @@ package org.apache.solr.metrics.reporters; import java.io.IOException; import java.lang.invoke.MethodHandles; -import java.util.SortedMap; import java.util.concurrent.TimeUnit; -import com.codahale.metrics.Counter; -import com.codahale.metrics.Gauge; -import com.codahale.metrics.Histogram; -import com.codahale.metrics.Meter; import com.codahale.metrics.MetricFilter; -import com.codahale.metrics.MetricRegistry; import com.codahale.metrics.Slf4jReporter; - -import com.codahale.metrics.Timer; import org.apache.solr.metrics.FilteringSolrMetricReporter; import org.apache.solr.metrics.SolrMetricManager; import org.slf4j.Logger; From d66e2ad614c4d44ded83ddcf50843dc16e391aa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20H=C3=B8ydahl?= Date: Wed, 30 Aug 2017 20:51:57 +0200 Subject: [PATCH 4/6] SOLR-11293: Fix precommit failures on unused imports --- solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java b/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java index e87a26b2eb9..cfdfb9dab4f 100644 --- a/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java @@ -30,7 +30,6 @@ import java.util.Properties; import java.util.Set; import java.util.concurrent.TimeUnit; -import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.util.LuceneTestCase.AwaitsFix; import org.apache.lucene.util.LuceneTestCase.Slow; import org.apache.solr.JSONTestUtil; From aa7394d27fa575a31c0ddee82ce3bc0bb7205a98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20H=C3=B8ydahl?= Date: Thu, 31 Aug 2017 09:53:15 +0200 Subject: [PATCH 5/6] SOLR-6671: Move changes entry to 7.0.0 --- solr/CHANGES.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index c27e7cd4df8..3f7b96c493c 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -469,6 +469,8 @@ New Features * SOLR-9910: Add solr/solr.cmd parameter to append jetty parameters to the start script. (Mano Kovacs via Mark Miller) +* SOLR-6671: Possible to set solr.data.home property as root dir for all data (janhoy, Shawn Heisey, Mark Miller) + Bug Fixes ---------------------- * SOLR-9262: Connection and read timeouts are being ignored by UpdateShardHandler after SOLR-4509. @@ -1353,8 +1355,6 @@ New Features parsers' behavior remains the same: queries will be split on whitespace before sending individual terms to analysis. (Steve Rowe) -* SOLR-6671: Possible to set solr.data.home property as root dir for all data (janhoy, Shawn Heisey, Mark Miller) - Bug Fixes ---------------------- From aa5dac04bdb5f49b75b95763e9b08065c47b8e52 Mon Sep 17 00:00:00 2001 From: Mike McCandless Date: Thu, 31 Aug 2017 06:03:25 -0400 Subject: [PATCH 6/6] LUCENE-7927: re-enable the low value optimization --- .../java/org/apache/lucene/facet/LongValueFacetCounts.java | 7 ------- 1 file changed, 7 deletions(-) diff --git a/lucene/facet/src/java/org/apache/lucene/facet/LongValueFacetCounts.java b/lucene/facet/src/java/org/apache/lucene/facet/LongValueFacetCounts.java index 3f7dbf4da2c..7d7a32bacd5 100644 --- a/lucene/facet/src/java/org/apache/lucene/facet/LongValueFacetCounts.java +++ b/lucene/facet/src/java/org/apache/lucene/facet/LongValueFacetCounts.java @@ -250,14 +250,11 @@ public class LongValueFacetCounts extends Facets { } private void increment(long value) { - /* if (value >= 0 && value < counts.length) { counts[(int) value]++; } else { hashCounts.add(value, 1); } - */ - hashCounts.add(value, 1); } @Override @@ -365,22 +362,18 @@ public class LongValueFacetCounts extends Facets { boolean countsAdded = false; for (int i = 0; i < upto; i++) { - /* if (countsAdded == false && hashCounts.values[i] >= counts.length) { countsAdded = true; appendCounts(labelValues); } - */ labelValues.add(new LabelAndValue(Long.toString(hashCounts.values[i]), hashCounts.counts[i])); } - /* if (countsAdded == false) { appendCounts(labelValues); } - */ return new FacetResult(field, new String[0], totCount, labelValues.toArray(new LabelAndValue[0]), labelValues.size()); }