Skip to content
Merged
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
9 changes: 7 additions & 2 deletions .github/actions/prepare-for-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ runs:
using: "composite"
steps:
- name: Set up Java (${{ inputs.java-distribution }}, ${{ inputs.java-version }})"
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
with:
distribution: ${{ inputs.java-distribution }}
java-version: ${{ inputs.java-version }}
java-package: jdk

- name: Cache gradle-wrapper.jar
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: gradle/wrapper/gradle-wrapper.jar
key: gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.jar.sha256') }}
Expand All @@ -38,3 +38,8 @@ runs:
# increase expiry time for the temp. develocity token.
# https://github.com/gradle/actions/blob/main/docs/setup-gradle.md#increasing-the-expiry-time-for-develocity-access-tokens
develocity-token-expiry: 8
# the default omits "wrapper", so the distribution zip is downloaded on every run
gradle-home-cache-includes: |
caches
notifications
wrapper
5 changes: 5 additions & 0 deletions .github/workflows/docker-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ jobs:
uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0
with:
develocity-token-expiry: 8
# the default omits "wrapper", so the distribution zip is downloaded on every run
gradle-home-cache-includes: |
caches
notifications
wrapper

- name: Create custom gradle.properties
run: |
Expand Down
10 changes: 9 additions & 1 deletion gradle/java/javac.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@

// Configure Java project defaults.

// Projects that compile free of deprecation warnings and so can keep -Xlint:deprecation on.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I;'ve been mulling over creating a JIRA with subtasks per deprecation in hopes that folks would move on them... it's been annoying!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, and with this deprecationLintProjects someone can embrace a module, getting it deprecation free and add it to that list...

// Everywhere else javac prints an unsuppressable "uses or overrides a deprecated API" note
// instead; move a project here once its warnings are gone.
def deprecationLintProjects = [
":solr:api",
":solr:solrj",
]

allprojects {
plugins.withType(JavaPlugin) {
java {
Expand All @@ -38,7 +46,7 @@ allprojects {
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
options.compilerArgs += [
"-Xlint:-deprecation",
deprecationLintProjects.contains(project.path) ? "-Xlint:deprecation" : "-Xlint:-deprecation",
"-Xlint:-serial",
"-Xlint:cast",
"-Xlint:classfile",
Expand Down
17 changes: 12 additions & 5 deletions gradle/testing/randomization/policies/solr-tests.policy
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,12 @@ grant {
permission java.net.NetPermission "requestPasswordAuthentication";

// for java.net.http.HttpClient. See HttpJdkSolrClientTest
permission "java.net.URLPermission" "http://127.0.0.1:*/solr/-", "HEAD,GET,PUT,POST:*";
permission "java.net.URLPermission" "https://127.0.0.1:*/solr/-", "HEAD,GET,PUT,POST:*";
permission "java.net.URLPermission" "socket://127.0.0.1:*", "CONNECT:*";
// JDK-8305346: a URLPermission with a numeric IPv4 host cannot be parsed while the policy is
// bootstrapping, so such a grant is dropped with a warning; the SocketPermissions above are what

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shorten, but yeah.

// actually confine these to loopback, so the host is a wildcard here.
permission "java.net.URLPermission" "http://*:*/solr/-", "HEAD,GET,PUT,POST:*";
permission "java.net.URLPermission" "https://*:*/solr/-", "HEAD,GET,PUT,POST:*";
permission "java.net.URLPermission" "socket://*:*", "CONNECT:*";

permission "java.net.URLPermission" "http://localhost:*/solr/-", "HEAD,GET,PUT,POST:*";
permission "java.net.URLPermission" "https://localhost:*/solr/-", "HEAD,GET,PUT,POST:*";
Expand All @@ -202,8 +205,8 @@ grant {
permission "java.net.URLPermission" "socket://[::1]:*", "CONNECT:*";

// for java.net.http.HttpClient. See ConcurrentUpdateJdkSolrClientTest
permission "java.net.URLPermission" "http://127.0.0.1:*/noOneThere/-", "HEAD,GET,PUT,POST:*";
permission "java.net.URLPermission" "https://127.0.0.1:*/noOneThere/-", "HEAD,GET,PUT,POST:*";
permission "java.net.URLPermission" "http://*:*/noOneThere/-", "HEAD,GET,PUT,POST:*";
permission "java.net.URLPermission" "https://*:*/noOneThere/-", "HEAD,GET,PUT,POST:*";
permission "java.net.URLPermission" "http://localhost:*/noOneThere/-", "HEAD,GET,PUT,POST:*";
permission "java.net.URLPermission" "https://localhost:*/noOneThere/-", "HEAD,GET,PUT,POST:*";
permission "java.net.URLPermission" "http://[::1]:*/noOneThere/-", "HEAD,GET,PUT,POST:*";
Expand Down Expand Up @@ -292,4 +295,8 @@ grant {

grant {
permission jdk.jfr.FlightRecorderPermission "accessFlightRecorder";
// OtelRuntimeJvmMetrics opens a JFR recording stream for the JVM metrics
permission jdk.jfr.FlightRecorderPermission "registerEvent";
permission java.lang.RuntimePermission "accessClassInPackage.jdk.jfr.internal.event";
permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.event";
};
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@
public class AddPackageVersionRequestBody {

@JsonProperty("version")
@Schema(description = "The version string for this package version.", required = true)
@Schema(
description = "The version string for this package version.",
requiredMode = Schema.RequiredMode.REQUIRED)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, saw this recently too!

public String version;

@JsonProperty("files")
@Schema(
description = "File paths from the file store to include in this version.",
required = true)
requiredMode = Schema.RequiredMode.REQUIRED)
public List<String> files;

@JsonProperty("manifest")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ public AddReplicaPropertyRequestBody(String value) {
this.value = value;
}

@Schema(description = "The value to assign to the property.", required = true)
@Schema(
description = "The value to assign to the property.",
requiredMode = Schema.RequiredMode.REQUIRED)
@JsonProperty("value")
public String value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
import io.swagger.v3.oas.annotations.media.Schema;

public class RenameCoreRequestBody {
@Schema(description = "The new name for the Solr core.", required = true)
@Schema(
description = "The new name for the Solr core.",
requiredMode = Schema.RequiredMode.REQUIRED)
@JsonProperty
public String to;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@ private synchronized boolean maybeTryHeadRequestSync(URI uriNoQueryParams) {
return headSucceeded;
}

@SuppressWarnings("deprecation") // getContext() has no replacement yet; see SOLR-14720
private void decorateRequest(HttpRequest.Builder reqb, SolrRequest<?> solrRequest) {
reqb.timeout(Duration.of(requestTimeoutMillis, ChronoUnit.MILLIS));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ public RequestStatusState processAndWait(String asyncId, SolrClient client, long
}

@Override
@SuppressWarnings("deprecation") // the parameter itself is on its way out; see SOLR-17712
public SolrParams getParams() {
ModifiableSolrParams params = new ModifiableSolrParams(super.getParams());
if (asyncId != null) {
Expand Down
2 changes: 2 additions & 0 deletions solr/solrj/src/resources/java-template/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ public class {{classname}} {
* @param {{name}} {{description}}
*/
{{/description}}
// the model field this writes to may itself be deprecated
@SuppressWarnings("deprecation")
public void {{setter}}({{{dataType}}} {{name}}) {
this.requestBody.{{name}} = {{name}};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1155,6 +1155,7 @@ public void testStatistics() throws Exception {
}

@Test
@SuppressWarnings("deprecation") // covers the deprecated ping()
public void testPingHandler() throws Exception {
SolrClient client = getSolrClient();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.junit.Test;

/** Test properties in configuration files. */
@SuppressWarnings("deprecation") // the embedded base class is deprecated, not this test
public class TestSolrProperties extends AbstractEmbeddedSolrServerTestCase {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,8 @@ public void testShardReplicationFactors() throws Exception {
CollectionAdminRequest.createCollection(collection, "conf", 2, 1).process(client);
cluster.waitForActiveCollection(collection, 2, 2);

DocCollection col = client.getClusterState().getCollection(collection);
DocCollection col =
client.getClusterStateProvider().getClusterState().getCollection(collection);
String shard1Url = col.getSlice("shard1").getLeader().getCoreUrl();
String shard2Url = col.getSlice("shard2").getLeader().getCoreUrl();
NamedList<NamedList<?>> routeResponses = new NamedList<>();
Expand Down Expand Up @@ -482,7 +483,7 @@ public void testRouting() throws Exception {
// Test that queries with _route_ params are routed by the client

// Track request counts on each node before query calls
ClusterState clusterState = cluster.getSolrClient().getClusterState();
ClusterState clusterState = cluster.getSolrClient().getClusterStateProvider().getClusterState();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this deserves a cluster.getClusterState() if there isn't one already

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DocCollection col = clusterState.getCollection("routing_collection");
Map<String, Double> requestCountsMap = new HashMap<>();
for (Slice slice : col.getSlices()) {
Expand Down Expand Up @@ -853,7 +854,12 @@ public void stateVersionParamTest() throws Exception {
.process(cluster.getSolrClient());
cluster.waitForActiveCollection(COLLECTION, 2, 2);

DocCollection coll = cluster.getSolrClient().getClusterState().getCollection(COLLECTION);
DocCollection coll =
cluster
.getSolrClient()
.getClusterStateProvider()
.getClusterState()
.getCollection(COLLECTION);
Replica r = coll.getSlices().iterator().next().getReplicas().iterator().next();

SolrQuery q = new SolrQuery().setQuery("*:*");
Expand Down Expand Up @@ -896,7 +902,8 @@ public void stateVersionParamTest() throws Exception {
}
}
String theNode = null;
Set<String> liveNodes = cluster.getSolrClient().getClusterState().getLiveNodes();
Set<String> liveNodes =
cluster.getSolrClient().getClusterStateProvider().getClusterState().getLiveNodes();
for (String s : liveNodes) {
String n = cluster.getZkStateReader().getBaseUrlForNodeName(s);
if (!allNodesOfColl.contains(n)) {
Expand Down Expand Up @@ -1069,7 +1076,12 @@ public void testRetryUpdatesWhenClusterStateIsStale() throws Exception {

// determine the coreNodeName of only current replica
Collection<Slice> slices =
cluster.getSolrClient().getClusterState().getCollection(COL).getSlices();
cluster
.getSolrClient()
.getClusterStateProvider()
.getClusterState()
.getCollection(COL)
.getSlices();
assertEquals(1, slices.size()); // sanity check
Slice slice = slices.iterator().next();
assertEquals(1, slice.getReplicas().size()); // sanity check
Expand Down Expand Up @@ -1125,7 +1137,12 @@ public void testRetryUpdatesWhenClusterStateIsStale() throws Exception {

/** Asserts that each doc is on the leader of the shard it routes to, querying that core alone. */
private static void assertDocsOnShardLeaders(String collection, String... ids) throws Exception {
DocCollection col = cluster.getSolrClient().getClusterState().getCollection(collection);
DocCollection col =
cluster
.getSolrClient()
.getClusterStateProvider()
.getClusterState()
.getCollection(collection);
for (String id : ids) {
String coreUrl =
col.getRouter().getTargetSlice(id, null, null, null, col).getLeader().getCoreUrl();
Expand All @@ -1144,7 +1161,11 @@ private static void checkSingleServer(NamedList<Object> response) {
NamedList<?> rfByRoute = (NamedList<?>) header.get(CloudSolrClient.REPFACT_BY_ROUTE);
assertNotNull("no per-route rf in " + header, rfByRoute);
DocCollection col =
cluster.getSolrClient().getClusterState().getCollection("routing_collection");
cluster
.getSolrClient()
.getClusterStateProvider()
.getClusterState()
.getCollection("routing_collection");
Set<String> leaderUrls = new HashSet<>();
for (Slice slice : col.getSlices()) {
leaderUrls.add(slice.getLeader().getCoreUrl());
Expand Down Expand Up @@ -1263,6 +1284,7 @@ private void queryWithPreferReplicaTypes(
}

@Test
@SuppressWarnings("deprecation") // covers the deprecated ping()
public void testPing() throws Exception {
final String testCollection = "ping_test";
CollectionAdminRequest.createCollection(testCollection, "conf", 2, 1)
Expand All @@ -1275,6 +1297,7 @@ public void testPing() throws Exception {
assertEquals("This should be OK", 0, response.getStatus());
}

@SuppressWarnings("deprecation") // covers the deprecated ping()
public void testPerReplicaStateCollection() throws Exception {
String collection = getSaferTestName();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,7 @@ public void testCookieHandlerSettingHonored() throws Exception {
}

@Test
@SuppressWarnings("deprecation") // covers the deprecated ping()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, when we deprecate something we need to be better about removing it from main so it doesn't linger.

public void testPing() throws Exception {
try (HttpJdkSolrClient client = builder(solrTestRule.getBaseUrl()).build()) {
SolrPingResponse spr = client.ping("collection1");
Expand Down
Loading
Loading