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()); } diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 6b342fc6437..3f7b96c493c 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 ---------------------- @@ -467,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. @@ -1351,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 ---------------------- 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; 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; 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/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; 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); } /**