diff --git a/build.gradle b/build.gradle index aa2389cec04..bc93b1098c4 100644 --- a/build.gradle +++ b/build.gradle @@ -19,15 +19,15 @@ import java.time.ZonedDateTime import java.time.format.DateTimeFormatter plugins { - id "base" - id "com.palantir.consistent-versions" version "2.16.0" - id "org.owasp.dependencycheck" version "8.0.1" - id 'ca.cutterslade.analyze' version "1.9.0" + id 'base' + id 'com.palantir.consistent-versions' version '2.16.0' + id 'org.owasp.dependencycheck' version '8.4.0' + id 'ca.cutterslade.analyze' version '1.9.1' id 'de.thetaphi.forbiddenapis' version '3.6' apply false - id "de.undercouch.download" version "5.2.0" apply false - id "net.ltgt.errorprone" version "3.0.1" apply false - id 'com.diffplug.spotless' version "6.5.2" apply false - id 'com.github.node-gradle.node' version '3.4.0' apply false + id 'de.undercouch.download' version '5.5.0' apply false + id 'net.ltgt.errorprone' version '3.1.0' apply false + id 'com.diffplug.spotless' version '6.5.2' apply false + id 'com.github.node-gradle.node' version '7.0.1' apply false } apply from: file('gradle/globals.gradle') diff --git a/buildSrc/scriptDepVersions.gradle b/buildSrc/scriptDepVersions.gradle index 802aa2a6275..a1d2bc9467d 100644 --- a/buildSrc/scriptDepVersions.gradle +++ b/buildSrc/scriptDepVersions.gradle @@ -21,11 +21,11 @@ ext { scriptDepVersions = [ - "apache-rat": "0.14", - "commons-codec": "1.15", - "ecj": "3.30.0", + "apache-rat": "0.15", + "commons-codec": "1.16.0", + "ecj": "3.33.0", "javacc": "7.0.12", - "jgit": "5.13.1.202206130422-r", - "flexmark": "0.64.0", + "jgit": "6.7.0.202309050840-r", + "flexmark": "0.64.8", ] } diff --git a/dev-tools/doap/solr.rdf b/dev-tools/doap/solr.rdf index 7ad4861d183..e0a1c43a3ab 100644 --- a/dev-tools/doap/solr.rdf +++ b/dev-tools/doap/solr.rdf @@ -68,6 +68,13 @@ + + + solr-9.4.0 + 2023-10-14 + 9.4.0 + + solr-9.3.0 diff --git a/dev-tools/scripts/addVersion.py b/dev-tools/scripts/addVersion.py index 30964b72dcf..53a5f02e777 100755 --- a/dev-tools/scripts/addVersion.py +++ b/dev-tools/scripts/addVersion.py @@ -44,7 +44,7 @@ def edit(buffer, match, line): print('done' if changed else 'uptodate') def update_solrversion_class(new_version): - filename = 'solr/core/src/java/org/apache/solr/util/SolrVersion.java' + filename = 'solr/api/src/java/org/apache/solr/client/api/util/SolrVersion.java' print(' changing version to %s...' % new_version.dot, end='', flush=True) constant_prefix = 'public static final String LATEST_STRING = "(.*?)"' matcher = re.compile(constant_prefix) @@ -104,7 +104,7 @@ def edit(buffer, match, line): def check_solr_version_class_tests(): print(' checking solr version tests...', end='', flush=True) - run('./gradlew -p solr/core test --tests TestSolrVersion') + run('./gradlew -p solr/api test --tests TestSolrVersion') print('ok') def check_lucene_match_version_tests(): diff --git a/dev-tools/scripts/releaseWizard.yaml b/dev-tools/scripts/releaseWizard.yaml index eafd4cd1621..ddc7f744bbe 100644 --- a/dev-tools/scripts/releaseWizard.yaml +++ b/dev-tools/scripts/releaseWizard.yaml @@ -205,7 +205,7 @@ groups: title: Prerequisites description: | Releasing software requires thorough understanding of the process and careful execution, - as it is easy to make mistakes. It also requires an environtment and tools such as gpg + as it is easy to make mistakes. It also requires an environment and tools such as gpg correctly setup. This section makes sure you're in good shape for the job! todos: - !Todo @@ -526,7 +526,7 @@ groups: - major - minor links: - - https://cwiki.apache.org/confluence/display/LUCENEJAVA/JenkinsReleaseBuilds + - https://cwiki.apache.org/confluence/display/SOLR/JenkinsReleaseBuilds+-+Solr - !Todo id: inform_devs title: Inform Devs of the new Release Branch @@ -544,7 +544,7 @@ groups: NOTICE: - Branch {{ release_branch }} has been cut and versions updated to {{ release_version_major }}.{{ release_version_minor + 1 }} on stable branch. + Branch {{ release_branch }} has been cut and versions updated to {{ release_version_major }}.{{ release_version_minor + 1 }} on the stable branch. Please observe the normal rules: @@ -636,7 +636,7 @@ groups: Ask on dev@ for input. Ideally the timing of this request mostly coincides with the release branch creation. It's a good idea to remind the devs of this later in the release too. - NOTE: Do not add every single JIRA issue, but distill the Release note into important changes! + NOTE: Do not add every single JIRA issue, but distill the release notes into important changes! links: - https://cwiki.apache.org/confluence/display/SOLR/Release+Notes - !Todo @@ -660,7 +660,7 @@ groups: description: |- To make sure a new release is not announced before the reference guide is complete, add a new Blocker JIRA issue for version {{ release_version }} with subject - "Complete Major changes and Upgrade Notes in RefGudie for {{ release_version }}". + "Complete Major changes and Upgrade Notes in RefGuide for {{ release_version }}". Note that this does not block the RC and voting process, but will block announcing the release. types: - major @@ -1588,6 +1588,7 @@ groups: Fill in the same date that you used for the release in previous steps. Do not use a product name prefix for the version, as this is the main release of the Solr PMC. Just use the version of this release: {{ release_version }} + Note: you have to be a member of the Solr PMC to be able to complete this step. links: - https://reporter.apache.org/addrelease.html?solr - !TodoGroup diff --git a/gradle/validation/error-prone.gradle b/gradle/validation/error-prone.gradle index d2800242425..de8ee8d1de0 100644 --- a/gradle/validation/error-prone.gradle +++ b/gradle/validation/error-prone.gradle @@ -305,6 +305,7 @@ allprojects { prj -> // '-Xep:DoNotMockAutoValue:OFF', // we don't use autovalue // '-Xep:DoNotUseRuleChain:OFF', // todo could be fixed but not easy // '-Xep:DoubleCheckedLocking:OFF', // todo check if useful or comment why not + '-Xep:DuplicateDateFormatField:WARN', '-Xep:EmptyBlockTag:WARN', // '-Xep:EmptyCatch:OFF', // todo check if useful or comment why not - might be handled by ECJ? // '-Xep:EmptySetMultibindingContributions:OFF', // we don't use this annotation @@ -420,6 +421,7 @@ allprojects { prj -> // '-Xep:NonAtomicVolatileUpdate:OFF', // todo check if useful or comment why not '-Xep:NonCanonicalType:WARN', '-Xep:NonOverridingEquals:WARN', + //'-Xep:NonFinalStaticField:WARN', // todo there are problems that should be fixed '-Xep:NotJavadoc:WARN', '-Xep:NullOptional:WARN', // '-Xep:NullableConstructor:OFF', // we don't use this annotation @@ -464,7 +466,10 @@ allprojects { prj -> // '-Xep:StreamResourceLeak:OFF', // todo check if useful or comment why not '-Xep:StreamToIterable:WARN', // '-Xep:StringCaseLocaleUsage:OFF', // we have forbiddenapis for that + '-Xep:StringCharset:WARN', + '-Xep:StringFormatWithLiteral:WARN', // '-Xep:StringSplitter:OFF', // todo check if useful or comment why not - might be able to use forbidden-apis for this? + '-Xep:SuperEqualsIsObjectEquals:WARN', // '-Xep:SwigMemoryLeak:OFF', // we don't use swig // '-Xep:SynchronizeOnNonFinalField:OFF', // todo check if useful or comment why not // '-Xep:ThreadJoinLoop:OFF', // todo check if useful or comment why not diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index c8dad544cc7..83389922a52 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -8,7 +8,8 @@ https://github.com/apache/solr/blob/main/solr/solr-ref-guide/modules/upgrade-not New Features --------------------- -(No changes) + +* SOLR-16943: Extend Solr client tracing coverage to both Jetty Client and Apache HttpClient (Alex Deparvu, David Smiley) Improvements --------------------- @@ -25,7 +26,7 @@ Optimizations Bug Fixes --------------------- -(No changes) + Deprecation Removals ---------------------- @@ -42,6 +43,8 @@ Deprecation Removals * SOLR-16893: Remove bin/solr create_core and create_collection commands in favour of bin/solr create command. (Eric Pugh) +* SOLR-17042: Remove deprecated `V2RequestSupport` and associated `SolrRequest` methods `setUseV2` and `setUseBinaryV2`. (Jason Gerlowski) + Dependency Upgrades --------------------- (No changes) @@ -65,25 +68,30 @@ Other Changes * SOLR-16911: Establish /solr as the only host context supported by Solr, removing legacy ability to change this. Solr paths will only be either /solr or /api now. (Eric Pugh) +* SOLR-16995: Add a ReplicaCount class to keep track of replicas per type (Vincent Primault) + ================== 9.5.0 ================== New Features --------------------- -(No changes) +* SOLR-14496: Solr CLI commands now can interact with a Solr secured using Basic Authentication. (Eric Pugh) + +* SOLR-17006: Collection creation & adding replicas: User-defined properties are persisted to state.json and + applied to new replicas, available for use as property substitution in configuration files. (Vincent Primault) Improvements --------------------- * SOLR-16924: RESTORECORE now sets the UpdateLog to ACTIVE state instead of requiring a separate REQUESTAPPLYUPDATES call in Collection restore. (Julia Lamoine, David Smiley) -* SOLR-17019: ZkCli should create chroot when necessary (Houston Putman) - Optimizations --------------------- (No changes) Bug Fixes --------------------- -(No changes) +* SOLR-6853: Allow '/' characters in the text managed by Managed Resources API. (Nikita Rusetskii via Eric Pugh) + +* SOLR-17039: Entropy calculation in bin/solr script fails in Docker due to missing 'bc' cmd (janhoy) Dependency Upgrades --------------------- @@ -93,7 +101,7 @@ Dependency Upgrades Other Changes --------------------- -(No changes) +* SOLR-17024: Remove support for the long-defunct "collectionDefaults" clusterprops key (Jason Gerlowski) ================== 9.4.0 ================== New Features diff --git a/solr/benchmark/src/java/org/apache/solr/bench/BaseBenchState.java b/solr/benchmark/src/java/org/apache/solr/bench/BaseBenchState.java index 4db40c05112..e3b5012366b 100644 --- a/solr/benchmark/src/java/org/apache/solr/bench/BaseBenchState.java +++ b/solr/benchmark/src/java/org/apache/solr/bench/BaseBenchState.java @@ -41,11 +41,9 @@ @State(Scope.Benchmark) public class BaseBenchState { - private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + private static final long RANDOM_SEED = System.nanoTime(); - private static final long RANDOM_SEED = 6624420638116043983L; - - private static final SplittableRandom random = new SplittableRandom(getInitRandomeSeed()); + private static final SplittableRandom random = new SplittableRandom(getInitRandomSeed()); /** * Gets random seed. @@ -137,13 +135,14 @@ public static void dumpHeap(BenchmarkParams benchmarkParams) throws IOException } } - private static Long getInitRandomeSeed() { + private static Long getInitRandomSeed() { Long seed = Long.getLong("solr.bench.seed"); if (seed == null) { seed = RANDOM_SEED; } + log(""); log("benchmark random seed: " + seed); return seed; diff --git a/solr/benchmark/src/java/org/apache/solr/bench/CircularIterator.java b/solr/benchmark/src/java/org/apache/solr/bench/CircularIterator.java new file mode 100644 index 00000000000..529d5812442 --- /dev/null +++ b/solr/benchmark/src/java/org/apache/solr/bench/CircularIterator.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.solr.bench; + +import java.util.Collection; +import java.util.Iterator; +import java.util.Objects; +import java.util.concurrent.atomic.AtomicInteger; + +public class CircularIterator implements Iterator { + + private final Object[] collection; + private final AtomicInteger idx; + + public CircularIterator(Collection collection) { + this.collection = Objects.requireNonNull(collection).toArray(); + if (this.collection.length == 0) { + throw new IllegalArgumentException("This iterator doesn't support empty collections"); + } + this.idx = new AtomicInteger(); + } + + @Override + public boolean hasNext() { + return true; + } + + @SuppressWarnings("unchecked") + @Override + public T next() { + return (T) collection[idx.incrementAndGet() % collection.length]; + } + + public int cycles() { + return ((idx.get() - 1) / collection.length) + 1; + } +} diff --git a/solr/benchmark/src/java/org/apache/solr/bench/Docs.java b/solr/benchmark/src/java/org/apache/solr/bench/Docs.java index cfaca270571..5c3b889c7a6 100644 --- a/solr/benchmark/src/java/org/apache/solr/bench/Docs.java +++ b/solr/benchmark/src/java/org/apache/solr/bench/Docs.java @@ -18,7 +18,6 @@ import static org.apache.solr.bench.BaseBenchState.log; -import java.lang.invoke.MethodHandles; import java.util.Collections; import java.util.Date; import java.util.Iterator; @@ -38,8 +37,6 @@ import org.apache.solr.common.util.SuppressForbidden; import org.quicktheories.core.Gen; import org.quicktheories.impl.BenchmarkRandomSource; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * A tool to generate controlled random data for a benchmark. {@link SolrInputDocument}s are created @@ -50,8 +47,6 @@ * them via {@link #generatedDocsIterator}. */ public class Docs { - private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - private final ThreadLocal random; private final Queue docs = new ConcurrentLinkedQueue<>(); @@ -104,7 +99,7 @@ private Docs(Long seed) { */ @SuppressForbidden(reason = "This module does not need to deal with logging context") public Iterator preGenerate(int numDocs) throws InterruptedException { - log("preGenerate docs " + numDocs + " ..."); + log("preGenerate docs=" + numDocs + " ..."); docs.clear(); executorService = Executors.newFixedThreadPool( @@ -114,14 +109,7 @@ public Iterator preGenerate(int numDocs) throws InterruptedEx for (int i = 0; i < numDocs; i++) { executorService.submit( () -> { - try { - SolrInputDocument doc = Docs.this.inputDocument(); - docs.add(doc); - } catch (Exception e) { - log.error("error adding doc", e); - executorService.shutdownNow(); - throw new RuntimeException(e); - } + docs.add(Docs.this.inputDocument()); }); } @@ -144,7 +132,7 @@ public Iterator preGenerate(int numDocs) throws InterruptedEx } /** - * Generated docs iterator iterator. + * Generated docs iterator. * * @return the iterator */ @@ -152,6 +140,15 @@ public Iterator generatedDocsIterator() { return docs.iterator(); } + /** + * Generated docs circular iterator. + * + * @return the iterator that never ends + */ + public CircularIterator generatedDocsCircularIterator() { + return new CircularIterator<>(docs); + } + /** * Input document solr input document. * diff --git a/solr/benchmark/src/java/org/apache/solr/bench/MiniClusterState.java b/solr/benchmark/src/java/org/apache/solr/bench/MiniClusterState.java index dd1c0afe639..5a793448c5c 100755 --- a/solr/benchmark/src/java/org/apache/solr/bench/MiniClusterState.java +++ b/solr/benchmark/src/java/org/apache/solr/bench/MiniClusterState.java @@ -24,7 +24,6 @@ import java.io.IOException; import java.io.OutputStream; import java.io.PrintStream; -import java.lang.invoke.MethodHandles; import java.lang.management.ManagementFactory; import java.net.URL; import java.nio.charset.StandardCharsets; @@ -61,21 +60,14 @@ import org.openjdk.jmh.annotations.TearDown; import org.openjdk.jmh.infra.BenchmarkParams; import org.openjdk.jmh.infra.Control; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** The base class for Solr JMH benchmarks that operate against a {@code MiniSolrCloudCluster}. */ public class MiniClusterState { - /** The constant DEBUG_OUTPUT. */ - public static final boolean DEBUG_OUTPUT = false; - /** The constant PROC_COUNT. */ public static final int PROC_COUNT = ManagementFactory.getOperatingSystemMXBean().getAvailableProcessors(); - private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - /** The type Mini cluster bench state. */ @State(Scope.Benchmark) public static class MiniClusterBenchState { @@ -118,7 +110,7 @@ public static class MiniClusterBenchState { private SplittableRandom random; private String workDir; - private boolean useHttp1 = false; + private boolean useHttp1 = Boolean.getBoolean("solr.http1"); /** * Tear down. @@ -163,14 +155,30 @@ public void checkWarmUp(Control control) throws Exception { @TearDown(Level.Trial) public void shutdownMiniCluster(BenchmarkParams benchmarkParams, BaseBenchState baseBenchState) throws Exception { - - log.info("MiniClusterState tear down - baseBenchState is {}", baseBenchState); - BaseBenchState.dumpHeap(benchmarkParams); - if (DEBUG_OUTPUT) log("closing client and shutting down minicluster"); IOUtils.closeQuietly(client); cluster.shutdown(); + logClusterDirectorySize(); + } + + private void logClusterDirectorySize() throws IOException { + log(""); + Files.list(miniClusterBaseDir.toAbsolutePath()) + .forEach( + (node) -> { + try { + long clusterSize = + Files.walk(node) + .filter(Files::isRegularFile) + .map(Path::toFile) + .mapToLong(File::length) + .sum(); + log("mini cluster node size (bytes) " + node + " " + clusterSize); + } catch (IOException e) { + throw new RuntimeException(e); + } + }); } /** @@ -191,7 +199,6 @@ public void doSetup(BenchmarkParams benchmarkParams, BaseBenchState baseBenchSta workDir = System.getProperty("workBaseDir", "build/work"); - log(""); Path currentRelativePath = Paths.get(""); String s = currentRelativePath.toAbsolutePath().toString(); log("current relative path is: " + s); @@ -373,9 +380,7 @@ public void index(String collection, Docs docs, int docCount, boolean parallel) queryRequest.setBasePath(nodes.get(random.nextInt(cluster.getJettySolrRunners().size()))); NamedList result = client.request(queryRequest, collection); - - if (DEBUG_OUTPUT) log("result: " + result); - + log("sanity check of single row query result: " + result); log(""); log("Dump Core Info"); @@ -443,7 +448,7 @@ private void indexBatch(String collection, Docs docs, int docCount, int batchSiz throws SolrServerException, IOException { Meter meter = new Meter(); List batch = new ArrayList<>(batchSize); - for (int i = 0; i < docCount; i++) { + for (int i = 1; i <= docCount; i++) { batch.add(docs.inputDocument()); if (i % batchSize == 0) { UpdateRequest updateRequest = new UpdateRequest(); @@ -452,7 +457,7 @@ private void indexBatch(String collection, Docs docs, int docCount, int batchSiz client.request(updateRequest, collection); meter.mark(batch.size()); batch.clear(); - log(meter.getCount() + " docs at " + meter.getMeanRate() + " doc/s"); + log(meter.getCount() + " docs at " + (long) meter.getMeanRate() + " doc/s"); } } if (!batch.isEmpty()) { @@ -463,7 +468,7 @@ private void indexBatch(String collection, Docs docs, int docCount, int batchSiz meter.mark(batch.size()); batch = null; } - log(meter.getCount() + " docs at " + meter.getMeanRate() + " doc/s"); + log(meter.getCount() + " docs at " + (long) meter.getMeanRate() + " doc/s"); } /** diff --git a/solr/benchmark/src/java/org/apache/solr/bench/index/CloudIndexing.java b/solr/benchmark/src/java/org/apache/solr/bench/index/CloudIndexing.java index 981ce0dc455..820f2130a60 100755 --- a/solr/benchmark/src/java/org/apache/solr/bench/index/CloudIndexing.java +++ b/solr/benchmark/src/java/org/apache/solr/bench/index/CloudIndexing.java @@ -23,6 +23,7 @@ import java.util.Iterator; import java.util.concurrent.TimeUnit; +import org.apache.solr.bench.Docs; import org.apache.solr.bench.MiniClusterState; import org.apache.solr.client.solrj.request.UpdateRequest; import org.apache.solr.common.SolrInputDocument; @@ -37,19 +38,15 @@ import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; import org.openjdk.jmh.annotations.State; -import org.openjdk.jmh.annotations.TearDown; import org.openjdk.jmh.annotations.Threads; -import org.openjdk.jmh.annotations.Timeout; import org.openjdk.jmh.annotations.Warmup; -import org.openjdk.jmh.infra.BenchmarkParams; @BenchmarkMode(Mode.Throughput) @OutputTimeUnit(TimeUnit.SECONDS) -@Threads(4) -@Warmup(time = 10, iterations = 3) -@Measurement(time = 20, iterations = 4) +@Threads(16) +@Warmup(time = 15, iterations = 2) +@Measurement(time = 60, iterations = 4) @Fork(value = 1) -@Timeout(time = 60) // A benchmark to experiment with the performance of distributed indexing. public class CloudIndexing { @@ -58,32 +55,26 @@ public static class BenchState { static final String COLLECTION = "testCollection"; - @Param({"1"}) - public int scale; - @Param("4") int nodeCount; - @Param("5") + @Param("4") int numShards; @Param({"1", "3"}) int numReplicas; - @Param({"0", "15", "30", "70", "100", "500", "1000"}) - int useStringUtf8Over; - @Param({"true", "false"}) - boolean directBuffer; + boolean useSmallDocs; - private final org.apache.solr.bench.Docs largeDocs; - private Iterator largeDocIterator; + @Param({"50000"}) + int preGenerate; - private final org.apache.solr.bench.Docs smallDocs; - private Iterator smallDocIterator; + private final Docs largeDocs; + private final Docs smallDocs; + private Iterator docIterator; public BenchState() { - largeDocs = docs() .field("id", integers().incrementing()) @@ -94,81 +85,51 @@ public BenchState() { .field(integers().all()) .field(longs().all()) .field(longs().all()); + smallDocs = + docs() + .field("id", integers().incrementing()) + .field("text", strings().basicLatinAlphabet().multi(2).ofLengthBetween(20, 32)) + .field("int1_i", integers().all()) + .field("int2_i", integers().all()) + .field("long1_l", longs().all()); + } - try { - largeDocIterator = largeDocs.preGenerate(50000); - - smallDocs = - docs() - .field("id", integers().incrementing()) - .field("text", strings().basicLatinAlphabet().multi(2).ofLengthBetween(20, 32)) - .field("int1_i", integers().all()) - .field("int2_i", integers().all()) - .field("long1_l", longs().all()); + private SolrInputDocument getNextDoc() { + return docIterator.next(); + } - smallDocIterator = smallDocs.preGenerate(50000); + private void preGenerate() { + try { + if (useSmallDocs) { + smallDocs.preGenerate(preGenerate); + docIterator = smallDocs.generatedDocsCircularIterator(); + } else { + largeDocs.preGenerate(preGenerate); + docIterator = largeDocs.generatedDocsCircularIterator(); + } } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); } } - public SolrInputDocument getLargeDoc() { - if (!largeDocIterator.hasNext()) { - largeDocIterator = largeDocs.generatedDocsIterator(); - } - return largeDocIterator.next(); - } - - public SolrInputDocument getSmallDoc() { - if (!smallDocIterator.hasNext()) { - smallDocIterator = smallDocs.generatedDocsIterator(); - } - return smallDocIterator.next(); - } - @Setup(Level.Trial) public void doSetup(MiniClusterState.MiniClusterBenchState miniClusterState) throws Exception { - System.setProperty("useStringUtf8Over", Integer.toString(useStringUtf8Over)); - System.setProperty("httpClientDirectBuffer", Boolean.toString(directBuffer)); + preGenerate(); System.setProperty("mergePolicyFactory", "org.apache.solr.index.NoMergePolicyFactory"); miniClusterState.startMiniCluster(nodeCount); miniClusterState.createCollection(COLLECTION, numShards, numReplicas); } - - @TearDown(Level.Trial) - public void doTearDown( - MiniClusterState.MiniClusterBenchState miniClusterState, BenchmarkParams benchmarkParams) - throws Exception { - - // miniClusterState.shutdownMiniCluster(benchmarkParams); - } - } - - @Benchmark - @Timeout(time = 300) - public Object indexLargeDoc( - MiniClusterState.MiniClusterBenchState miniClusterState, BenchState state) throws Exception { - UpdateRequest updateRequest = new UpdateRequest(); - updateRequest.setBasePath( - miniClusterState.nodes.get(miniClusterState.getRandom().nextInt(state.nodeCount))); - SolrInputDocument doc = state.getLargeDoc(); - updateRequest.add(doc); - - return miniClusterState.client.request(updateRequest, BenchState.COLLECTION); } @Benchmark - @Timeout(time = 300) - public Object indexSmallDoc( - MiniClusterState.MiniClusterBenchState miniClusterState, BenchState state) throws Exception { + public Object indexDoc(MiniClusterState.MiniClusterBenchState miniClusterState, BenchState state) + throws Exception { UpdateRequest updateRequest = new UpdateRequest(); updateRequest.setBasePath( miniClusterState.nodes.get(miniClusterState.getRandom().nextInt(state.nodeCount))); - SolrInputDocument doc = state.getSmallDoc(); - updateRequest.add(doc); - + updateRequest.add(state.getNextDoc()); return miniClusterState.client.request(updateRequest, BenchState.COLLECTION); } } diff --git a/solr/benchmark/src/java/org/apache/solr/bench/search/NumericSearch.java b/solr/benchmark/src/java/org/apache/solr/bench/search/NumericSearch.java index a96a714ebef..3c7a72385f9 100644 --- a/solr/benchmark/src/java/org/apache/solr/bench/search/NumericSearch.java +++ b/solr/benchmark/src/java/org/apache/solr/bench/search/NumericSearch.java @@ -21,13 +21,11 @@ import static org.apache.solr.bench.generators.SourceDSL.strings; import java.io.IOException; -import java.util.Collection; import java.util.HashSet; import java.util.Iterator; -import java.util.Objects; import java.util.Set; -import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; +import org.apache.solr.bench.CircularIterator; import org.apache.solr.bench.Docs; import org.apache.solr.bench.MiniClusterState; import org.apache.solr.bench.generators.SolrGen; @@ -177,31 +175,6 @@ QueryRequest setQuery(String field) { q.setBasePath(basePath); return q; } - - private static class CircularIterator implements Iterator { - - private final Object[] collection; - private final AtomicInteger idx; - - CircularIterator(Collection collection) { - this.collection = Objects.requireNonNull(collection).toArray(); - if (this.collection.length == 0) { - throw new IllegalArgumentException("This iterator doesn't support empty collections"); - } - this.idx = new AtomicInteger(); - } - - @Override - public boolean hasNext() { - return true; - } - - @SuppressWarnings("unchecked") - @Override - public T next() { - return (T) collection[idx.incrementAndGet() % collection.length]; - } - } } @Benchmark diff --git a/solr/bin/solr b/solr/bin/solr index 30c3e3aa52b..3db7f1c7731 100644 --- a/solr/bin/solr +++ b/solr/bin/solr @@ -1926,10 +1926,10 @@ function start_solr() { # Check if entropy is available and pool size is non-zero if [[ $entropy_avail -gt 0 && $pool_size -ne 0 ]]; then # Compute the ratio of entropy available to pool size - ratio=$(awk -v ea="$entropy_avail" -v ps="$pool_size" 'BEGIN {print (ea/ps)*100}') + ratio=$(awk -v ea="$entropy_avail" -v ps="$pool_size" 'BEGIN {print int((ea/ps)*100)}') # Check if the ratio is less than 25% - if (( $(echo "$ratio < 25" | bc -l) )); then + if (( ratio < 25 )); then echo "Warning: Available entropy is low. As a result, use of the UUIDField, SSL, or any other features that require" echo "RNG might not work properly. To check for the amount of available entropy, use 'cat /proc/sys/kernel/random/entropy_avail'." fi diff --git a/solr/core/src/java/org/apache/solr/cli/ApiTool.java b/solr/core/src/java/org/apache/solr/cli/ApiTool.java index 8ecfcd36a40..2b760cc7f76 100644 --- a/solr/core/src/java/org/apache/solr/cli/ApiTool.java +++ b/solr/core/src/java/org/apache/solr/cli/ApiTool.java @@ -57,7 +57,8 @@ public List