Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
title: Update Error Prone to v2.50.0
type: dependency_update
authors:
- name: solrbot
links:
- name: PR#4847
url: https://github.com/apache/solr/pull/4847
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ google-api-grpc-proto = "2.75.0"
# @keep for version alignment
google-autovalue = "1.11.1"
google-cloud-bom = "0.268.0"
google-errorprone = "2.41.0"
google-errorprone = "2.50.0"
# @keep for version alignment
google-gson = "2.14.0"
google-guava = "33.7.1-jre"
Expand Down
15 changes: 13 additions & 2 deletions gradle/validation/error-prone.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -589,11 +589,12 @@ allprojects {prj ->
}
}

// Exclude generated OpenAPI sources in solrj from Error Prone checks.
// Exclude generated OpenAPI sources and the vendored noggit JSON parser (org.noggit, not our
// code/conventions) in solrj from Error Prone checks.
configure(project(":solr:solrj")) {
plugins.withId(libs.plugins.ltgt.errorprone.get().pluginId) {
tasks.withType(JavaCompile) {
options.errorprone.excludedPaths = ".*/build/generated/.*"
options.errorprone.excludedPaths = ".*/build/generated/.*|.*/org/noggit/.*"
}
}
}
Expand All @@ -606,3 +607,13 @@ configure(project(":solr:core")) {
}
}
}

// Exclude vendored Tika sources (copied in to eliminate the Tika dependency) in
// solr:modules:extraction from Error Prone checks.
configure(project(":solr:modules:extraction")) {
plugins.withId(libs.plugins.ltgt.errorprone.get().pluginId) {
tasks.withType(JavaCompile) {
options.errorprone.excludedPaths = ".*/org/apache/solr/handler/extraction/fromtika/.*"
}
}
}
8 changes: 4 additions & 4 deletions solr/api/gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ com.github.kevinstern:software-and-algorithms:1.0=annotationProcessor,errorprone
com.google.auto.service:auto-service-annotations:1.0.1=annotationProcessor,errorprone,testAnnotationProcessor
com.google.auto.value:auto-value-annotations:1.11.1=annotationProcessor,errorprone,testAnnotationProcessor
com.google.auto:auto-common:1.2.2=annotationProcessor,errorprone,testAnnotationProcessor
com.google.errorprone:error_prone_annotation:2.41.0=annotationProcessor,errorprone,testAnnotationProcessor
com.google.errorprone:error_prone_annotation:2.50.0=annotationProcessor,errorprone,testAnnotationProcessor
com.google.errorprone:error_prone_annotations:2.50.0=annotationProcessor,errorprone,jarValidation,testAnnotationProcessor,testCompileClasspath,testRuntimeClasspath
com.google.errorprone:error_prone_check_api:2.41.0=annotationProcessor,errorprone,testAnnotationProcessor
com.google.errorprone:error_prone_core:2.41.0=annotationProcessor,errorprone,testAnnotationProcessor
com.google.googlejavaformat:google-java-format:1.27.0=annotationProcessor,errorprone,testAnnotationProcessor
com.google.errorprone:error_prone_check_api:2.50.0=annotationProcessor,errorprone,testAnnotationProcessor
com.google.errorprone:error_prone_core:2.50.0=annotationProcessor,errorprone,testAnnotationProcessor
com.google.googlejavaformat:google-java-format:1.35.0=annotationProcessor,errorprone,testAnnotationProcessor
com.google.guava:failureaccess:1.0.3=annotationProcessor,errorprone,jarValidation,testAnnotationProcessor,testCompileClasspath,testRuntimeClasspath
com.google.guava:guava:33.7.1-jre=annotationProcessor,errorprone,jarValidation,testAnnotationProcessor,testCompileClasspath,testRuntimeClasspath
com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=annotationProcessor,errorprone,jarValidation,testAnnotationProcessor,testCompileClasspath,testRuntimeClasspath
Expand Down
8 changes: 4 additions & 4 deletions solr/benchmark/gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ com.github.kevinstern:software-and-algorithms:1.0=annotationProcessor,errorprone
com.google.auto.service:auto-service-annotations:1.0.1=annotationProcessor,errorprone,testAnnotationProcessor
com.google.auto.value:auto-value-annotations:1.11.1=annotationProcessor,errorprone,testAnnotationProcessor
com.google.auto:auto-common:1.2.2=annotationProcessor,errorprone,testAnnotationProcessor
com.google.errorprone:error_prone_annotation:2.41.0=annotationProcessor,errorprone,testAnnotationProcessor
com.google.errorprone:error_prone_annotation:2.50.0=annotationProcessor,errorprone,testAnnotationProcessor
com.google.errorprone:error_prone_annotations:2.50.0=annotationProcessor,compileClasspath,errorprone,jarValidation,runtimeClasspath,testAnnotationProcessor,testCompileClasspath,testRuntimeClasspath
com.google.errorprone:error_prone_check_api:2.41.0=annotationProcessor,errorprone,testAnnotationProcessor
com.google.errorprone:error_prone_core:2.41.0=annotationProcessor,errorprone,testAnnotationProcessor
com.google.googlejavaformat:google-java-format:1.27.0=annotationProcessor,errorprone,testAnnotationProcessor
com.google.errorprone:error_prone_check_api:2.50.0=annotationProcessor,errorprone,testAnnotationProcessor
com.google.errorprone:error_prone_core:2.50.0=annotationProcessor,errorprone,testAnnotationProcessor
com.google.googlejavaformat:google-java-format:1.35.0=annotationProcessor,errorprone,testAnnotationProcessor
com.google.guava:failureaccess:1.0.3=annotationProcessor,compileClasspath,errorprone,jarValidation,runtimeClasspath,testAnnotationProcessor,testCompileClasspath,testRuntimeClasspath
com.google.guava:guava:33.7.1-jre=annotationProcessor,compileClasspath,errorprone,jarValidation,runtimeClasspath,testAnnotationProcessor,testCompileClasspath,testRuntimeClasspath
com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=annotationProcessor,compileClasspath,errorprone,jarValidation,runtimeClasspath,testAnnotationProcessor,testCompileClasspath,testRuntimeClasspath
Expand Down
8 changes: 4 additions & 4 deletions solr/core/gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ com.github.stephenc.jcip:jcip-annotations:1.0-1=compileClasspath,jarValidation
com.google.auto.service:auto-service-annotations:1.0.1=annotationProcessor,errorprone,testAnnotationProcessor
com.google.auto.value:auto-value-annotations:1.11.1=annotationProcessor,errorprone,testAnnotationProcessor
com.google.auto:auto-common:1.2.2=annotationProcessor,errorprone,testAnnotationProcessor
com.google.errorprone:error_prone_annotation:2.41.0=annotationProcessor,errorprone,testAnnotationProcessor
com.google.errorprone:error_prone_annotation:2.50.0=annotationProcessor,errorprone,testAnnotationProcessor
com.google.errorprone:error_prone_annotations:2.50.0=annotationProcessor,compileClasspath,errorprone,jarValidation,runtimeClasspath,runtimeLibs,testAnnotationProcessor,testCompileClasspath,testRuntimeClasspath
com.google.errorprone:error_prone_check_api:2.41.0=annotationProcessor,errorprone,testAnnotationProcessor
com.google.errorprone:error_prone_core:2.41.0=annotationProcessor,errorprone,testAnnotationProcessor
com.google.googlejavaformat:google-java-format:1.27.0=annotationProcessor,errorprone,testAnnotationProcessor
com.google.errorprone:error_prone_check_api:2.50.0=annotationProcessor,errorprone,testAnnotationProcessor
com.google.errorprone:error_prone_core:2.50.0=annotationProcessor,errorprone,testAnnotationProcessor
com.google.googlejavaformat:google-java-format:1.35.0=annotationProcessor,errorprone,testAnnotationProcessor
com.google.guava:failureaccess:1.0.3=annotationProcessor,compileClasspath,errorprone,jarValidation,runtimeClasspath,runtimeLibs,testAnnotationProcessor,testCompileClasspath,testRuntimeClasspath
com.google.guava:guava:33.7.1-jre=annotationProcessor,compileClasspath,errorprone,jarValidation,runtimeClasspath,runtimeLibs,testAnnotationProcessor,testCompileClasspath,testRuntimeClasspath
com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=annotationProcessor,compileClasspath,errorprone,jarValidation,runtimeClasspath,runtimeLibs,testAnnotationProcessor,testCompileClasspath,testRuntimeClasspath
Expand Down
2 changes: 2 additions & 0 deletions solr/core/src/java/org/apache/solr/cli/ExportTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,8 @@ private void addProducers(Map<String, Slice> m) {
}
}

@SuppressWarnings(
"ReferenceEquality") // EOFDOC is a unique sentinel; identity check is intentional
private void addConsumer(CountDownLatch consumerlatch) {
consumerThreadpool.execute(
() -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,8 @@ public boolean isCollectionCreation() {
}

@Override
@SuppressWarnings(
"ReferenceEquality") // NO_OP is a unique sentinel; identity check is intentional
public void computeUpdates(ClusterState clusterState, SolrZkClient client) {
boolean hasJsonUpdates = false;
List<PerReplicaStatesOps> perReplicaStateOps = new ArrayList<>();
Expand Down Expand Up @@ -912,6 +914,8 @@ public boolean isCollectionCreation() {
}

@Override
@SuppressWarnings(
"ReferenceEquality") // NO_OP is a unique sentinel; identity check is intentional
public void computeUpdates(ClusterState clusterState, SolrZkClient client) {
final DocCollection docCollection = clusterState.getCollectionOrNull(collectionName);
Optional<ZkWriteCommand> result =
Expand Down
2 changes: 2 additions & 0 deletions solr/core/src/java/org/apache/solr/cloud/LockTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ boolean isLocked() {
return false;
}

@SuppressWarnings(
"ReferenceEquality") // releasing only the exact lock instance held, by identity
boolean unlock(LockImpl lockObject) {
if (--refCount > 0) {
return false;
Expand Down
3 changes: 0 additions & 3 deletions solr/core/src/java/org/apache/solr/cloud/Overseer.java
Original file line number Diff line number Diff line change
Expand Up @@ -782,9 +782,6 @@ public synchronized void start(String id) {
assert ObjectReleaseTracker.track(this);
}

/** Start {@link ClusterSingleton} plugins when we become the leader. */

/** Stop {@link ClusterSingleton} plugins when we lose leadership. */
public Stats getStats() {
return stats;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ public ReplicateFromLeader(CoreContainer cc, String coreName) {
* @param switchTransactionLog if true, ReplicationHandler will rotate the transaction log once
* the replication is done
*/
@SuppressWarnings(
"ReferenceEquality") // IndexFetchResult constants are singletons; identity check is
// intentional
public void startReplication(boolean switchTransactionLog) {
try (SolrCore core = cc.getCore(coreName)) {
if (core == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ public class CategoryRoutedAlias extends RoutedAlias {
}

@Override
@SuppressWarnings(
"ReferenceEquality") // Aliases is replaced wholesale, so identity means "possibly changed"
public boolean updateParsedCollectionAliases(ZkStateReader zkStateReader, boolean contextualize) {
final Aliases aliases =
zkStateReader.getAliases(); // note: might be different from last request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ protected String getHeadCollectionIfOrdered(AddUpdateCommand cmd) {
* @return A list of actions across the DRA.
*/
@Override
@SuppressWarnings(
"ReferenceEquality") // RoutedAlias dimension identity, not equality, is what matters here
protected List<Action> calculateActions(String targetCol) {
String[] routeValues = SEP_MATCHER.split(targetCol);
// remove the alias name to avoid all manner of off by one errors...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,8 @@ private static void checkMillis(Instant date) {
}

@Override
@SuppressWarnings(
"ReferenceEquality") // Aliases is replaced wholesale, so identity means "possibly changed"
public boolean updateParsedCollectionAliases(ZkStateReader zkStateReader, boolean contextualize) {
final Aliases aliases = zkStateReader.getAliases();
if (this.parsedCollectionsAliases != aliases) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ public void updateClusterState(Function<ClusterState, ClusterState> fun) {
* a {@link org.apache.zookeeper.KeeperException.BadVersionException} this instance becomes
* unusable and must be discarded
*/
@SuppressWarnings(
"ReferenceEquality") // NO_OP is a unique sentinel; identity check is intentional
public ClusterState enqueueUpdate(
ClusterState prevState, List<ZkWriteCommand> cmds, ZkWriteCallback callback)
throws IllegalStateException, Exception {
Expand Down Expand Up @@ -189,6 +191,8 @@ public ClusterState enqueueUpdate(
return clusterState;
}

@SuppressWarnings(
"ReferenceEquality") // NO_OP is a unique sentinel; identity check is intentional
private boolean isNoOps(List<ZkWriteCommand> cmds) {
for (ZkWriteCommand cmd : cmds) {
if (cmd != NO_OP) return false;
Expand Down Expand Up @@ -229,6 +233,8 @@ public ClusterState writePendingUpdates() throws KeeperException, InterruptedExc
* @throws KeeperException if any ZooKeeper operation results in an error
* @throws InterruptedException if the current thread is interrupted
*/
@SuppressWarnings(
"ReferenceEquality") // detecting "same map instance passed back in" means "flush all"
public ClusterState writePendingUpdates(
Map<String, ZkWriteCommand> updates, boolean resetPendingUpdateCounters)
throws IllegalStateException, KeeperException, InterruptedException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public ZkWriteCommand(String name, DocCollection collection) {
}

@Override
@SuppressWarnings(
"ReferenceEquality") // NO_OP is a unique sentinel; identity check is intentional
public String toString() {
return getClass().getSimpleName() + ": " + (this == NO_OP ? "no-op" : name + "=" + collection);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ private void removeFromCache(CacheValue v) {

// be sure the method is called with the sync lock on this object
// returns true if we closed the cacheValue, false if it will be closed later
@SuppressWarnings("ReferenceEquality") // CacheValue identity, not equality, is what matters here
private boolean closeCacheValue(CacheValue cacheValue, Set<CacheValue> deferRemove) {
log.debug("looking to close {} {}", cacheValue.path, cacheValue.closeEntries);
List<CloseListener> listeners = closeListeners.remove(cacheValue.directory);
Expand Down Expand Up @@ -300,6 +301,7 @@ private static Iterable<CacheValue> sorted(Set<CacheValue> vals) {
return vals.stream().sorted((a, b) -> b.path.compareTo(a.path)).collect(Collectors.toList());
}

@SuppressWarnings("ReferenceEquality") // CacheValue identity, not equality, is what matters here
private boolean maybeDeferClose(CacheValue maybeDefer) {
assert maybeDefer.deleteOnClose;
for (CacheValue maybeChildPath : byPathCache.values()) {
Expand Down Expand Up @@ -381,6 +383,8 @@ public boolean exists(String path) throws IOException {
* java.lang.String, boolean)
*/
@Override
@SuppressWarnings(
"ReferenceEquality") // same instance back from filterDirectory means "unfiltered"
public final Directory get(String path, DirContext dirContext, String rawLockType)
throws IOException {
String fullPath = normalize(path);
Expand Down
1 change: 1 addition & 0 deletions solr/core/src/java/org/apache/solr/core/CoreContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -1445,6 +1445,7 @@ public CoreSorter getCoreSorter() {
return coreSorter;
}

@SuppressWarnings("ReferenceEquality") // SolrCore identity, not equality, is what matters here
protected SolrCore registerCore(
CoreDescriptor cd, SolrCore core, boolean registerInZk, boolean skipRecovery) {
if (core == null) {
Expand Down
5 changes: 4 additions & 1 deletion solr/core/src/java/org/apache/solr/core/PluginBag.java
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,10 @@ public T put(String name, T plugin) {
return old == null ? null : old.get();
}

@SuppressWarnings({"unchecked"})
@SuppressWarnings({
"unchecked",
"ReferenceEquality" // detecting the same plugin instance re-registered vs. a real swap
})
public PluginHolder<T> put(String name, PluginHolder<T> plugin) {
Boolean registerApi = null; // i.e. register for V2
Boolean disableV1 = null; // i.e. do *not* register for v1
Expand Down
6 changes: 6 additions & 0 deletions solr/core/src/java/org/apache/solr/core/SolrCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -2328,6 +2328,8 @@ public RefCounted<SolrIndexSearcher> getSearcher(
*
* <p>This method acquires openSearcherLock - do not call with searchLock held!
*/
@SuppressWarnings(
"ReferenceEquality") // schema is only ever replaced wholesale, so identity is correct here
public RefCounted<SolrIndexSearcher> openNewSearcher(
boolean updateHandlerReopens, boolean realtime) {
if (isClosed()) { // catch some errors quicker
Expand Down Expand Up @@ -2544,6 +2546,8 @@ public RefCounted<SolrIndexSearcher> openNewSearcher(
* SolrIndexSearcher}.
*/
// TODO waitSearcher should be an AtomicReference or something that is a more clear API
@SuppressWarnings(
"ReferenceEquality") // SolrIndexSearcher identity, not equality, is what matters here
public RefCounted<SolrIndexSearcher> getSearcher(
boolean forceNew,
boolean returnSearcher,
Expand Down Expand Up @@ -2830,6 +2834,8 @@ public boolean isReloaded() {
//
// onDeckSearchers will also be decremented (it should have been incremented
// as a result of opening a new searcher).
@SuppressWarnings(
"ReferenceEquality") // detecting re-registration of the exact same searcher holder
private void registerSearcher(RefCounted<SolrIndexSearcher> newSearcherHolder) {
synchronized (searcherLock) {
try {
Expand Down
2 changes: 2 additions & 0 deletions solr/core/src/java/org/apache/solr/core/SolrPaths.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ public AllowPathBuilder addPath(String path) {
* Adds an allowed path. Detects "_ALL_" which means all paths are allowed. Does not detect "*"
* (not supported as a {@link Path} on Windows), see {@link #addPath(String)}.
*/
@SuppressWarnings(
"ReferenceEquality") // ALL_PATHS is a unique sentinel; identity check is intentional
public AllowPathBuilder addPath(Path path) {
if (path == null) {
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ public SolrResourceLoader(Path instanceDir, ClassLoader parent) {
*
* @param urls the URLs of files to add
*/
@SuppressWarnings(
"ReferenceEquality") // ClassLoader has no value-equality; identity check is intentional
synchronized void addToClassLoader(List<URL> urls) {
URLClassLoader newLoader = addURLsToClassLoader(classLoader, urls);
if (newLoader == classLoader) {
Expand Down Expand Up @@ -483,6 +485,8 @@ public <T> Class<? extends T> findClass(String cname, Class<T> expectedType) {
* @param subpackages the packages to be tried if the cname starts with solr.
* @return the loaded class. An exception is thrown if it fails
*/
@SuppressWarnings(
"ReferenceEquality") // detecting the default `packages` array vs. a caller-supplied one
public <T> Class<? extends T> findClass(
String cname, Class<T> expectedType, String... subpackages) {
if (subpackages == null || subpackages.length == 0 || subpackages == packages) {
Expand Down Expand Up @@ -694,13 +698,18 @@ public <T> boolean addToCoreAware(T obj) {
}
}

@SuppressWarnings(
"ReferenceEquality") // detecting whether the same SolrConfig instance is being re-associated
protected final void setSolrConfig(SolrConfig config) {
if (this.config != null && this.config != config) {
throw new IllegalStateException("SolrConfig instance is already associated with this loader");
}
this.config = config;
}

@SuppressWarnings(
"ReferenceEquality") // detecting whether the same CoreContainer instance is being
// re-associated
protected final void setCoreContainer(CoreContainer coreContainer) {
if (this.coreContainer != null && this.coreContainer != coreContainer) {
throw new IllegalStateException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,8 @@ static Long getCheckSum(Checksum checksum, Path f) {

private volatile IndexFetcher currentIndexFetcher;

@SuppressWarnings(
"ReferenceEquality") // detecting the shared pollingIndexFetcher vs. a one-off, by identity
public IndexFetchResult doFetch(SolrParams solrParams, boolean forceReplication) {
String leaderUrl = solrParams.get(LEADER_URL, null);
if (!indexFetchLock.tryLock()) return IndexFetchResult.LOCK_OBTAIN_FAILED;
Expand Down Expand Up @@ -1446,6 +1448,8 @@ public void preClose(SolrCore core) {
}

@Override
@SuppressWarnings(
"ReferenceEquality") // detecting the shared pollingIndexFetcher vs. a one-off
public void postClose(SolrCore core) {
if (pollingIndexFetcher != null) {
pollingIndexFetcher.destroy();
Expand Down Expand Up @@ -1493,7 +1497,7 @@ public void shutdown() {
*/
private SolrEventListener getEventListener(final boolean snapshoot, final boolean getCommit) {
return new SolrEventListener() {
/**
/*
* This refreshes the latest replicateable index commit and optionally can create Snapshots as
* well
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,8 @@ public void submitAsyncTask(TaskObject taskObject) throws SolrException {
}
}

@SuppressWarnings(
"ReferenceEquality") // detecting a cache-computed instance vs. our own taskObject
private void addTask(TaskObject taskObject) {
// Ensure task ID is not already in use
TaskObject taskInCache =
Expand Down
Loading
Loading