Skip to content

Commit

Permalink
SOLR-16958: Fix spurious warning about LATEST luceneMatchVersion (apa…
Browse files Browse the repository at this point in the history
  • Loading branch information
colvinco authored Sep 1, 2023
1 parent 9d6db8c commit 8c0d1a0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions solr/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ Bug Fixes
* SOLR-16916: Use of the JSON Query DSL should ignore the defType parameter
(Christina Chortaria, Max Kadel, Ryan Laddusaw, Jane Sandberg, David Smiley)

* SOLR-16958: Fix spurious warning about LATEST luceneMatchVersion (Colvin Cowie)

Dependency Upgrades
---------------------

Expand Down
5 changes: 4 additions & 1 deletion solr/core/src/java/org/apache/solr/core/SolrConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@ private IndexSchemaFactory.VersionedConfig readXml(SolrResourceLoader loader, St

private static final AtomicBoolean versionWarningAlreadyLogged = new AtomicBoolean(false);

@SuppressWarnings("ReferenceEquality") // Use of == is intentional here
public static final Version parseLuceneVersionString(final String matchVersion) {
final Version version;
try {
Expand All @@ -420,7 +421,9 @@ public static final Version parseLuceneVersionString(final String matchVersion)
pe);
}

if (Objects.equals(version, Version.LATEST) && !versionWarningAlreadyLogged.getAndSet(true)) {
// The use of == is intentional here because the latest 'V.V.V' version will be equal() to
// Version.LATEST, but will not be == to Version.LATEST unless 'LATEST' was supplied.
if (version == Version.LATEST && !versionWarningAlreadyLogged.getAndSet(true)) {
log.warn(
"You should not use LATEST as luceneMatchVersion property: "
+ "if you use this setting, and then Solr upgrades to a newer release of Lucene, "
Expand Down

0 comments on commit 8c0d1a0

Please sign in to comment.