You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ds...@apache.org on 2026/09/08 01:32:12 UTC
(solr) branch branch_9x updated (0be15c9c1f0 -> 997a39ea30d)
This is an automated email from the ASF dual-hosted git repository.
dsmiley pushed a change to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git
from 0be15c9c1f0 Update dependency com.lmax:disruptor to v4 (branch_9x) (#4857)
new fde3380d0c5 SOLR-18399: Ship ui-grid icon fonts with the Admin UI (#4802)
new af1c5bcbf32 SOLR-18343: SolrJ now uses POST for suitable v1 admin requests (#4861)
new aab1c71f0ec SlowCompositeReaderWrapper: fix index sort and hasBlocks (#4825)
new 997a39ea30d SOLR-18413: Handle deleted MIGRATE routing targets (#4862)
The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
...owCompositeReaderWrapper-sort-hasblocks-fix.yml | 6 +
.../fix-dangling-routing-rule-target.yml | 8 +
.../solr-18343-explicit-admin-methods.yml | 8 +
.../solr/index/SlowCompositeReaderWrapper.java | 39 ++--
.../processor/DistributedZkUpdateProcessor.java | 95 +++++-----
.../org/apache/solr/cloud/MigrateRouteKeyTest.java | 53 ++++++
.../solr/util/tracing/TestDistributedTracing.java | 8 +-
.../solrj/request/CollectionAdminRequest.java | 200 ++++++++++++++-------
.../solrj/request/ConfigSetAdminRequest.java | 37 +++-
.../client/solrj/request/CoreAdminRequest.java | 42 +++--
.../solrj/request/TestCollectionAdminRequest.java | 20 +++
.../solrj/request/TestConfigSetAdminRequest.java | 9 +
.../solr/client/solrj/request/TestCoreAdmin.java | 9 +
solr/webapp/web/css/angular/fonts/ui-grid.eot | Bin 0 -> 10319 bytes
solr/webapp/web/css/angular/fonts/ui-grid.svg | Bin 0 -> 9087 bytes
solr/webapp/web/css/angular/fonts/ui-grid.ttf | Bin 0 -> 10155 bytes
solr/webapp/web/css/angular/fonts/ui-grid.woff | Bin 0 -> 5728 bytes
17 files changed, 398 insertions(+), 136 deletions(-)
create mode 100644 changelog/unreleased/SlowCompositeReaderWrapper-sort-hasblocks-fix.yml
create mode 100644 changelog/unreleased/fix-dangling-routing-rule-target.yml
create mode 100644 changelog/unreleased/solr-18343-explicit-admin-methods.yml
create mode 100644 solr/webapp/web/css/angular/fonts/ui-grid.eot
create mode 100644 solr/webapp/web/css/angular/fonts/ui-grid.svg
create mode 100644 solr/webapp/web/css/angular/fonts/ui-grid.ttf
create mode 100644 solr/webapp/web/css/angular/fonts/ui-grid.woff
(solr) 02/04: SOLR-18343: SolrJ now uses POST for suitable v1 admin requests (#4861)
Posted by ds...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
dsmiley pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git
commit af1c5bcbf3269cc6ab697234530e8ae9b9bfbb9c
Author: Xinyao Zhang <43...@users.noreply.github.com>
AuthorDate: Thu Sep 3 20:16:18 2026 -0400
SOLR-18343: SolrJ now uses POST for suitable v1 admin requests (#4861)
SolrJ v1 admin requests now use appropriate HTTP verbs -- mostly POST, some GET.
Observability note: hurts since useful request params are no longer in the URL. Addressing separately.
(cherry picked from commit 22620db37328e1f8794574daad661542ed0ab98d)
---
.../solr-18343-explicit-admin-methods.yml | 8 +
.../solr/util/tracing/TestDistributedTracing.java | 8 +-
.../solrj/request/CollectionAdminRequest.java | 200 ++++++++++++++-------
.../solrj/request/ConfigSetAdminRequest.java | 37 +++-
.../client/solrj/request/CoreAdminRequest.java | 42 +++--
.../solrj/request/TestCollectionAdminRequest.java | 20 +++
.../solrj/request/TestConfigSetAdminRequest.java | 9 +
.../solr/client/solrj/request/TestCoreAdmin.java | 9 +
8 files changed, 254 insertions(+), 79 deletions(-)
diff --git a/changelog/unreleased/solr-18343-explicit-admin-methods.yml b/changelog/unreleased/solr-18343-explicit-admin-methods.yml
new file mode 100644
index 00000000000..3f88523466e
--- /dev/null
+++ b/changelog/unreleased/solr-18343-explicit-admin-methods.yml
@@ -0,0 +1,8 @@
+title: >
+ SolrJ v1 admin requests now use appropriate HTTP verbs -- mostly POST, some GET
+type: changed
+authors:
+ - name: Xinyao Zhang
+links:
+ - name: SOLR-18343
+ url: https://issues.apache.org/jira/browse/SOLR-18343
diff --git a/solr/core/src/test/org/apache/solr/util/tracing/TestDistributedTracing.java b/solr/core/src/test/org/apache/solr/util/tracing/TestDistributedTracing.java
index a039511af63..6ddb021546c 100644
--- a/solr/core/src/test/org/apache/solr/util/tracing/TestDistributedTracing.java
+++ b/solr/core/src/test/org/apache/solr/util/tracing/TestDistributedTracing.java
@@ -203,7 +203,7 @@ public class TestDistributedTracing extends SolrCloudTestCase {
assertEquals(0, r1.getStatus());
// Expecting 8 spans:
- // 1. api call 'operationName:"create:/admin/collections"',
+ // 1. api call 'operationName:"post:/admin/collections"',
// db.instance=testInternalCollectionApiCommands
// - unique traceId unrelated to the internal trace id generated for the operation
// 2. internal CollectionApiCommand 'operationName:"CreateCollectionCmd"'
@@ -223,7 +223,7 @@ public class TestDistributedTracing extends SolrCloudTestCase {
var finishedSpans = getAndClearSpans();
var s0 = finishedSpans.remove(0);
assertDbInstanceColl(s0, collection);
- assertEquals("create:/admin/collections", s0.operationName());
+ assertEquals("post:/admin/collections", s0.operationName());
Map<String, Integer> ops = new HashMap<>();
assertEquals(7, finishedSpans.size());
@@ -251,7 +251,7 @@ public class TestDistributedTracing extends SolrCloudTestCase {
assertEquals(0, r1.getStatus());
// Expecting 6 spans:
- // 1. api call 'operationName:"delete:/admin/collections"',
+ // 1. api call 'operationName:"post:/admin/collections"',
// db.instance=testInternalCollectionApiCommands
// - unique traceId unrelated to the internal trace id generated for the operation
// 2. internal CollectionApiCommand 'operationName:"DeleteCollectionCmd"'
@@ -267,7 +267,7 @@ public class TestDistributedTracing extends SolrCloudTestCase {
var finishedSpans = getAndClearSpans();
var s0 = finishedSpans.remove(0);
assertDbInstanceColl(s0, collection);
- assertEquals("delete:/admin/collections", s0.operationName());
+ assertEquals("post:/admin/collections", s0.operationName());
Map<String, Integer> ops = new HashMap<>();
assertEquals(5, finishedSpans.size());
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionAdminRequest.java b/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionAdminRequest.java
index 9afdd3d579a..38d25dba71b 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionAdminRequest.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionAdminRequest.java
@@ -79,13 +79,29 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
@Deprecated public static String PROPERTY_PREFIX = CollectionAdminParams.PROPERTY_PREFIX;
+ public CollectionAdminRequest(METHOD method, CollectionAction action) {
+ this(method, "/admin/collections", action);
+ }
+
+ public CollectionAdminRequest(METHOD method, String path, CollectionAction action) {
+ super(method, path);
+ this.action = checkNotNull(CoreAdminParams.ACTION, action);
+ }
+
+ /**
+ * @deprecated Use {@link #CollectionAdminRequest(METHOD, CollectionAction)}.
+ */
+ @Deprecated(since = "11.0")
public CollectionAdminRequest(CollectionAction action) {
- this("/admin/collections", action);
+ this(METHOD.POST, action);
}
+ /**
+ * @deprecated Use {@link #CollectionAdminRequest(METHOD, String, CollectionAction)}.
+ */
+ @Deprecated(since = "11.0")
public CollectionAdminRequest(String path, CollectionAction action) {
- super(METHOD.GET, path);
- this.action = checkNotNull(CoreAdminParams.ACTION, action);
+ this(METHOD.POST, path, action);
}
@Override
@@ -149,8 +165,16 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
protected String asyncId = null;
protected boolean waitForFinalState = false;
+ public AsyncCollectionAdminRequest(METHOD method, CollectionAction action) {
+ super(method, action);
+ }
+
+ /**
+ * @deprecated Use {@link #AsyncCollectionAdminRequest(METHOD, CollectionAction)}.
+ */
+ @Deprecated(since = "11.0")
public AsyncCollectionAdminRequest(CollectionAction action) {
- super(action);
+ this(METHOD.POST, action);
}
@Override
@@ -251,11 +275,21 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
protected String collection;
protected Boolean followAliases;
- public AsyncCollectionSpecificAdminRequest(CollectionAction action, String collection) {
- super(action);
+ public AsyncCollectionSpecificAdminRequest(
+ METHOD method, CollectionAction action, String collection) {
+ super(method, action);
this.collection = checkNotNull(CoreAdminParams.COLLECTION, collection);
}
+ /**
+ * @deprecated Use {@link #AsyncCollectionSpecificAdminRequest(METHOD, CollectionAction,
+ * String)}.
+ */
+ @Deprecated(since = "11.0")
+ public AsyncCollectionSpecificAdminRequest(CollectionAction action, String collection) {
+ this(METHOD.POST, action, collection);
+ }
+
public String getCollectionName() {
return collection;
}
@@ -280,12 +314,22 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
protected String shard;
public AsyncShardSpecificAdminRequest(
- CollectionAction action, String collection, String shard) {
- super(action);
+ METHOD method, CollectionAction action, String collection, String shard) {
+ super(method, action);
this.collection = checkNotNull(CoreAdminParams.COLLECTION, collection);
this.shard = checkNotNull(CoreAdminParams.SHARD, shard);
}
+ /**
+ * @deprecated Use {@link #AsyncShardSpecificAdminRequest(METHOD, CollectionAction, String,
+ * String)}.
+ */
+ @Deprecated(since = "11.0")
+ public AsyncShardSpecificAdminRequest(
+ CollectionAction action, String collection, String shard) {
+ this(METHOD.POST, action, collection, shard);
+ }
+
@Override
public SolrParams getParams() {
ModifiableSolrParams params = new ModifiableSolrParams(super.getParams());
@@ -301,12 +345,21 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
protected String collection;
protected String shard;
- public ShardSpecificAdminRequest(CollectionAction action, String collection, String shard) {
- super(action);
+ public ShardSpecificAdminRequest(
+ METHOD method, CollectionAction action, String collection, String shard) {
+ super(method, action);
this.collection = checkNotNull(CoreAdminParams.COLLECTION, collection);
this.shard = checkNotNull(CoreAdminParams.SHARD, shard);
}
+ /**
+ * @deprecated Use {@link #ShardSpecificAdminRequest(METHOD, CollectionAction, String, String)}.
+ */
+ @Deprecated(since = "11.0")
+ public ShardSpecificAdminRequest(CollectionAction action, String collection, String shard) {
+ this(METHOD.POST, action, collection, shard);
+ }
+
@Override
public SolrParams getParams() {
ModifiableSolrParams params = new ModifiableSolrParams(super.getParams());
@@ -330,12 +383,22 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
protected String node;
protected String role;
- public CollectionAdminRoleRequest(CollectionAction action, String node, String role) {
- super(action);
+ public CollectionAdminRoleRequest(
+ METHOD method, CollectionAction action, String node, String role) {
+ super(method, action);
this.role = checkNotNull(CollectionAdminParams.ROLE, role);
this.node = checkNotNull(CoreAdminParams.NODE, node);
}
+ /**
+ * @deprecated Use {@link #CollectionAdminRoleRequest(METHOD, CollectionAction, String,
+ * String)}.
+ */
+ @Deprecated(since = "11.0")
+ public CollectionAdminRoleRequest(CollectionAction action, String node, String role) {
+ this(METHOD.POST, action, node, role);
+ }
+
public String getNode() {
return this.node;
}
@@ -524,7 +587,10 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
Integer numNrtReplicas,
Integer numTlogReplicas,
Integer numPullReplicas) {
- super(CollectionAction.CREATE, SolrIdentifierValidator.validateCollectionName(collection));
+ super(
+ METHOD.POST,
+ CollectionAction.CREATE,
+ SolrIdentifierValidator.validateCollectionName(collection));
// NOTE: there's very little we can assert about the args because nothing but "collection" is
// required by the server
if ((null != shards) && (null != numShards)) {
@@ -721,7 +787,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
public static class Reload extends AsyncCollectionSpecificAdminRequest {
private Reload(String collection) {
- super(CollectionAction.RELOAD, collection);
+ super(METHOD.POST, CollectionAction.RELOAD, collection);
}
}
@@ -733,7 +799,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
String target;
public Rename(String collection, String target) {
- super(CollectionAction.RENAME, collection);
+ super(METHOD.POST, CollectionAction.RENAME, collection);
this.target = target;
}
@@ -757,7 +823,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
* @param node The node to be deleted
*/
public DeleteNode(String node) {
- super(CollectionAction.DELETENODE);
+ super(METHOD.POST, CollectionAction.DELETENODE);
this.node = checkNotNull("node", node);
}
@@ -778,7 +844,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
* @param target node where the new replicas are to be created
*/
public ReplaceNode(String source, String target) {
- super(CollectionAction.REPLACENODE);
+ super(METHOD.POST, CollectionAction.REPLACENODE);
this.sourceNode = checkNotNull(CollectionParams.SOURCE_NODE, source);
this.targetNode = target;
}
@@ -812,7 +878,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
protected int timeout = -1;
public MoveReplica(String collection, String replica, String targetNode) {
- super(CollectionAction.MOVEREPLICA);
+ super(METHOD.POST, CollectionAction.MOVEREPLICA);
this.collection = checkNotNull(CoreAdminParams.COLLECTION, collection);
this.replica = checkNotNull(CoreAdminParams.REPLICA, replica);
this.targetNode = checkNotNull(CollectionParams.TARGET_NODE, targetNode);
@@ -820,7 +886,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
}
public MoveReplica(String collection, String shard, String sourceNode, String targetNode) {
- super(CollectionAction.MOVEREPLICA);
+ super(METHOD.POST, CollectionAction.MOVEREPLICA);
this.collection = checkNotNull(CoreAdminParams.COLLECTION, collection);
this.shard = checkNotNull(CoreAdminParams.SHARD, shard);
this.sourceNode = checkNotNull(CollectionParams.SOURCE_NODE, sourceNode);
@@ -887,7 +953,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
}
public RebalanceLeaders(String collection) {
- super(CollectionAction.REBALANCELEADERS);
+ super(METHOD.POST, CollectionAction.REBALANCELEADERS);
this.collection = checkNotNull(CoreAdminParams.COLLECTION, collection);
}
@@ -928,7 +994,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
Map<String, Object> collectionParams = new HashMap<>();
private ReindexCollection(String collection) {
- super(CollectionAction.REINDEXCOLLECTION, collection);
+ super(METHOD.POST, CollectionAction.REINDEXCOLLECTION, collection);
}
/** Target collection name (null if the same). */
@@ -1021,12 +1087,12 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
protected Float rawSizeSamplingPercent = null;
private ColStatus(String collection) {
- super(CollectionAction.COLSTATUS);
+ super(METHOD.GET, CollectionAction.COLSTATUS);
this.collection = collection;
}
private ColStatus() {
- super(CollectionAction.COLSTATUS);
+ super(METHOD.GET, CollectionAction.COLSTATUS);
}
public ColStatus setWithSegments(boolean withSegments) {
@@ -1094,7 +1160,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
public static class Delete extends AsyncCollectionSpecificAdminRequest {
private Delete(String collection) {
- super(CollectionAction.DELETE, collection);
+ super(METHOD.POST, CollectionAction.DELETE, collection);
}
}
@@ -1115,7 +1181,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
protected Properties extraProperties;
public Backup(String collection, String name) {
- super(CollectionAction.BACKUP, collection);
+ super(METHOD.POST, CollectionAction.BACKUP, collection);
this.name = name;
this.repositoryName = Optional.empty();
}
@@ -1261,7 +1327,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
protected Integer backupId;
public Restore(String collection, String backupName) {
- super(CollectionAction.RESTORE, collection);
+ super(METHOD.POST, CollectionAction.RESTORE, collection);
this.backupName = backupName;
}
@@ -1449,7 +1515,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
protected String location;
public InstallShard(String collection, String shard, String location, String backupRepository) {
- super(CollectionAction.INSTALLSHARDDATA, collection, shard);
+ super(METHOD.POST, CollectionAction.INSTALLSHARDDATA, collection, shard);
this.repositoryName = backupRepository;
this.location = location;
@@ -1481,7 +1547,10 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
protected final String commitName;
public CreateSnapshot(String collection, String commitName) {
- super(CollectionAction.CREATESNAPSHOT, checkNotNull(CoreAdminParams.COLLECTION, collection));
+ super(
+ METHOD.POST,
+ CollectionAction.CREATESNAPSHOT,
+ checkNotNull(CoreAdminParams.COLLECTION, collection));
this.commitName = checkNotNull(CoreAdminParams.COMMIT_NAME, commitName);
}
@@ -1508,7 +1577,10 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
protected final String commitName;
public DeleteSnapshot(String collection, String commitName) {
- super(CollectionAction.DELETESNAPSHOT, checkNotNull(CoreAdminParams.COLLECTION, collection));
+ super(
+ METHOD.POST,
+ CollectionAction.DELETESNAPSHOT,
+ checkNotNull(CoreAdminParams.COLLECTION, collection));
this.commitName = checkNotNull(CoreAdminParams.COMMIT_NAME, commitName);
}
@@ -1533,7 +1605,10 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
@SuppressWarnings("serial")
public static class ListSnapshots extends AsyncCollectionSpecificAdminRequest {
public ListSnapshots(String collection) {
- super(CollectionAction.LISTSNAPSHOTS, checkNotNull(CoreAdminParams.COLLECTION, collection));
+ super(
+ METHOD.GET,
+ CollectionAction.LISTSNAPSHOTS,
+ checkNotNull(CoreAdminParams.COLLECTION, collection));
}
@Override
@@ -1580,6 +1655,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
private CreateShard(String collection, String shard) {
super(
+ METHOD.POST,
CollectionAction.CREATESHARD,
collection,
SolrIdentifierValidator.validateShardName(shard));
@@ -1609,7 +1685,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
protected String sleep;
private MockCollTask(String collection) {
- super(CollectionAction.MOCK_COLL_TASK);
+ super(METHOD.POST, CollectionAction.MOCK_COLL_TASK);
this.collection = checkNotNull(CoreAdminParams.COLLECTION, collection);
}
@@ -1647,7 +1723,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
protected String createNodeSet;
private SplitShard(String collection) {
- super(CollectionAction.SPLITSHARD);
+ super(METHOD.POST, CollectionAction.SPLITSHARD);
this.collection = checkNotNull(CoreAdminParams.COLLECTION, collection);
}
@@ -1771,7 +1847,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
private Boolean deleteDataDir;
private DeleteShard(String collection, String shard) {
- super(CollectionAction.DELETESHARD, collection, shard);
+ super(METHOD.POST, CollectionAction.DELETESHARD, collection, shard);
}
public Boolean getDeleteInstanceDir() {
@@ -1818,7 +1894,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
// FORCELEADER request
public static class ForceLeader extends ShardSpecificAdminRequest {
private ForceLeader(String collection, String shard) {
- super(CollectionAction.FORCELEADER, collection, shard);
+ super(METHOD.POST, CollectionAction.FORCELEADER, collection, shard);
}
}
@@ -1851,7 +1927,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
protected String requestId = null;
private RequestStatus(String requestId) {
- super(CollectionAction.REQUESTSTATUS);
+ super(METHOD.GET, CollectionAction.REQUESTSTATUS);
this.requestId = checkNotNull("requestId", requestId);
}
@@ -1912,7 +1988,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
protected Boolean flush = null;
private DeleteStatus(String requestId, Boolean flush) {
- super(CollectionAction.DELETESTATUS);
+ super(METHOD.POST, CollectionAction.DELETESTATUS);
if (requestId == null && flush == null)
throw new IllegalArgumentException(
"Either requestid or flush parameter must be specified.");
@@ -1963,7 +2039,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
private Map<String, String> properties = new HashMap<>();
public SetAliasProperty(String aliasName) {
- super(CollectionAction.ALIASPROP);
+ super(METHOD.POST, CollectionAction.ALIASPROP);
this.aliasName = SolrIdentifierValidator.validateAliasName(aliasName);
}
@@ -2002,7 +2078,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
protected String aliasedCollections;
private CreateAlias(String aliasName, String aliasedCollections) {
- super(CollectionAction.CREATEALIAS);
+ super(METHOD.POST, CollectionAction.CREATEALIAS);
this.aliasName = SolrIdentifierValidator.validateAliasName(aliasName);
this.aliasedCollections = checkNotNull("aliasedCollections", aliasedCollections);
}
@@ -2076,7 +2152,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
String start,
String interval,
Create createCollTemplate) {
- super(CollectionAction.CREATEALIAS);
+ super(METHOD.POST, CollectionAction.CREATEALIAS);
this.aliasName = aliasName;
this.start = start;
this.interval = interval;
@@ -2202,7 +2278,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
public CreateCategoryRoutedAlias(
String aliasName, String routerField, int maxCardinality, Create createCollTemplate) {
- super(CollectionAction.CREATEALIAS);
+ super(METHOD.POST, CollectionAction.CREATEALIAS);
this.aliasName = aliasName;
this.routerField = routerField;
this.maxCardinality = maxCardinality;
@@ -2308,7 +2384,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
public DimensionalRoutedAlias(
String aliasName, Create createCollTemplate, RoutedAliasAdminRequest... dims) {
- super(CollectionAction.CREATEALIAS);
+ super(METHOD.POST, CollectionAction.CREATEALIAS);
this.aliasName = aliasName;
this.createCollTemplate = createCollTemplate;
this.dims = dims;
@@ -2392,7 +2468,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
protected String aliasName;
private DeleteAlias(String aliasName) {
- super(CollectionAction.DELETEALIAS);
+ super(METHOD.POST, CollectionAction.DELETEALIAS);
this.aliasName = checkNotNull("aliasName", aliasName);
}
@@ -2447,7 +2523,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
protected String createNodeSet;
private AddReplica(String collection, String shard, String routeKey, Replica.Type type) {
- super(CollectionAction.ADDREPLICA);
+ super(METHOD.POST, CollectionAction.ADDREPLICA);
this.collection = checkNotNull(CoreAdminParams.COLLECTION, collection);
this.shard = shard;
this.routeKey = routeKey;
@@ -2648,19 +2724,19 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
private Integer count;
private DeleteReplica(String collection, String shard, String replica) {
- super(CollectionAction.DELETEREPLICA, collection);
+ super(METHOD.POST, CollectionAction.DELETEREPLICA, collection);
this.shard = shard;
this.replica = replica;
}
private DeleteReplica(String collection, String shard, int count) {
- super(CollectionAction.DELETEREPLICA, collection);
+ super(METHOD.POST, CollectionAction.DELETEREPLICA, collection);
this.shard = shard;
this.count = count;
}
private DeleteReplica(String collection, int count) {
- super(CollectionAction.DELETEREPLICA, collection);
+ super(METHOD.POST, CollectionAction.DELETEREPLICA, collection);
this.count = count;
}
@@ -2747,7 +2823,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
private String propertyValue;
private ClusterProp(String propertyName, String propertyValue) {
- super(CollectionAction.CLUSTERPROP);
+ super(METHOD.POST, CollectionAction.CLUSTERPROP);
this.propertyName = checkNotNull("propertyName", propertyName);
this.propertyValue = propertyValue;
}
@@ -2787,7 +2863,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
private String propertyValue;
private CollectionProp(String collection, String propertyName, String propertyValue) {
- super(CollectionAction.COLLECTIONPROP, collection);
+ super(METHOD.POST, CollectionAction.COLLECTIONPROP, collection);
this.propertyName = checkNotNull("propertyName", propertyName);
this.propertyValue = propertyValue;
}
@@ -2830,7 +2906,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
private Properties properties;
private Migrate(String collection, String targetCollection, String splitKey) {
- super(CollectionAction.MIGRATE);
+ super(METHOD.POST, CollectionAction.MIGRATE);
this.collection = checkNotNull(CoreAdminParams.COLLECTION, collection);
this.targetCollection = checkNotNull("targetCollection", targetCollection);
this.splitKey = checkNotNull("split.key", splitKey);
@@ -2891,7 +2967,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
// ADDROLE request
public static class AddRole extends CollectionAdminRoleRequest {
private AddRole(String node, String role) {
- super(CollectionAction.ADDROLE, node, role);
+ super(METHOD.POST, CollectionAction.ADDROLE, node, role);
}
}
@@ -2903,7 +2979,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
// REMOVEROLE request
public static class RemoveRole extends CollectionAdminRoleRequest {
private RemoveRole(String node, String role) {
- super(CollectionAction.REMOVEROLE, node, role);
+ super(METHOD.POST, CollectionAction.REMOVEROLE, node, role);
}
}
@@ -2916,7 +2992,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
public static class OverseerStatus extends AsyncCollectionAdminRequest {
public OverseerStatus() {
- super(CollectionAction.OVERSEERSTATUS);
+ super(METHOD.GET, CollectionAction.OVERSEERSTATUS);
}
}
@@ -2925,7 +3001,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
extends CollectionAdminRequest<RequestApiDistributedProcessingResponse> {
public RequestApiDistributedProcessing() {
- super(CollectionAction.DISTRIBUTEDAPIPROCESSING);
+ super(METHOD.GET, CollectionAction.DISTRIBUTEDAPIPROCESSING);
}
@Override
@@ -2954,7 +3030,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
protected String routeKey = null;
public ClusterStatus() {
- super(CollectionAction.CLUSTERSTATUS);
+ super(METHOD.GET, CollectionAction.CLUSTERSTATUS);
}
public ClusterStatus setCollectionName(String collectionName) {
@@ -3009,7 +3085,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
public static class ListAliases extends CollectionAdminRequest<CollectionAdminResponse> {
public ListAliases() {
- super(CollectionAction.LISTALIASES);
+ super(METHOD.GET, CollectionAction.LISTALIASES);
}
@Override
@@ -3029,7 +3105,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
// LIST request
public static class List extends CollectionAdminRequest<CollectionAdminResponse> {
public List() {
- super(CollectionAction.LIST);
+ super(METHOD.GET, CollectionAction.LIST);
}
@Override
@@ -3102,7 +3178,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
private Boolean purgeUnused;
private DeleteBackup(String backupName) {
- super(CollectionAction.DELETEBACKUP);
+ super(METHOD.POST, CollectionAction.DELETEBACKUP);
this.name = backupName;
}
@@ -3205,7 +3281,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
private String repositoryName;
private ListBackup(String backupName) {
- super(CollectionAction.LISTBACKUP);
+ super(METHOD.GET, CollectionAction.LISTBACKUP);
this.backupName = backupName;
}
@@ -3267,7 +3343,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
String replica,
String propertyName,
String propertyValue) {
- super(CollectionAction.ADDREPLICAPROP, collection, shard);
+ super(METHOD.POST, CollectionAction.ADDREPLICAPROP, collection, shard);
this.replica = checkNotNull(CoreAdminParams.REPLICA, replica);
this.propertyName = checkNotNull("propertyName", propertyName);
this.propertyValue = checkNotNull("propertyValue", propertyValue);
@@ -3323,7 +3399,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
private DeleteReplicaProp(
String collection, String shard, String replica, String propertyName) {
- super(CollectionAction.DELETEREPLICAPROP, collection, shard);
+ super(METHOD.POST, CollectionAction.DELETEREPLICAPROP, collection, shard);
this.replica = checkNotNull(CoreAdminParams.REPLICA, replica);
this.propertyName = checkNotNull("propertyName", propertyName);
}
@@ -3359,7 +3435,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
protected Boolean shardUnique;
private BalanceShardUnique(String collection, String propertyName) {
- super(CollectionAction.BALANCESHARDUNIQUE);
+ super(METHOD.POST, CollectionAction.BALANCESHARDUNIQUE);
this.collection = checkNotNull(CoreAdminParams.COLLECTION, collection);
this.propertyName = checkNotNull("propertyName", propertyName);
}
@@ -3407,7 +3483,7 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
protected Map<String, Object> attributes;
private Modify(String collection, Map<String, Object> attributes) {
- super(CollectionAction.MODIFYCOLLECTION, collection);
+ super(METHOD.POST, CollectionAction.MODIFYCOLLECTION, collection);
this.attributes = attributes;
}
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/request/ConfigSetAdminRequest.java b/solr/solrj/src/java/org/apache/solr/client/solrj/request/ConfigSetAdminRequest.java
index 4c21ce6c776..117265606f2 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/request/ConfigSetAdminRequest.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/request/ConfigSetAdminRequest.java
@@ -51,12 +51,28 @@ public abstract class ConfigSetAdminRequest<
return this;
}
+ public ConfigSetAdminRequest(METHOD method) {
+ this(method, "/admin/configs");
+ }
+
+ public ConfigSetAdminRequest(METHOD method, String path) {
+ super(method, path);
+ }
+
+ /**
+ * @deprecated Use {@link #ConfigSetAdminRequest(METHOD)}.
+ */
+ @Deprecated(since = "11.0")
public ConfigSetAdminRequest() {
- super(METHOD.GET, "/admin/configs");
+ this(METHOD.POST);
}
+ /**
+ * @deprecated Use {@link #ConfigSetAdminRequest(METHOD, String)}.
+ */
+ @Deprecated(since = "11.0")
public ConfigSetAdminRequest(String path) {
- super(METHOD.GET, path);
+ this(METHOD.POST, path);
}
protected abstract Q getThis();
@@ -79,6 +95,18 @@ public abstract class ConfigSetAdminRequest<
extends ConfigSetAdminRequest<T, ConfigSetAdminResponse> {
protected String configSetName = null;
+ protected ConfigSetSpecificAdminRequest(METHOD method) {
+ super(method);
+ }
+
+ /**
+ * @deprecated Use {@link #ConfigSetSpecificAdminRequest(METHOD)}.
+ */
+ @Deprecated(since = "11.0")
+ protected ConfigSetSpecificAdminRequest() {
+ this(METHOD.POST);
+ }
+
public final T setConfigSetName(String configSetName) {
this.configSetName = configSetName;
return getThis();
@@ -127,8 +155,8 @@ public abstract class ConfigSetAdminRequest<
protected Boolean cleanup;
public Upload() {
+ super(METHOD.POST);
action = ConfigSetAction.UPLOAD;
- setMethod(SolrRequest.METHOD.POST);
}
@Override
@@ -260,6 +288,7 @@ public abstract class ConfigSetAdminRequest<
protected Properties properties;
public Create() {
+ super(METHOD.POST);
action = ConfigSetAction.CREATE;
}
@@ -305,6 +334,7 @@ public abstract class ConfigSetAdminRequest<
// DELETE request
public static class Delete extends ConfigSetSpecificAdminRequest<Delete> {
public Delete() {
+ super(METHOD.POST);
action = ConfigSetAction.DELETE;
}
@@ -317,6 +347,7 @@ public abstract class ConfigSetAdminRequest<
// LIST request
public static class List extends ConfigSetAdminRequest<List, ConfigSetAdminResponse.List> {
public List() {
+ super(METHOD.GET);
action = ConfigSetAction.LIST;
}
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/request/CoreAdminRequest.java b/solr/solrj/src/java/org/apache/solr/client/solrj/request/CoreAdminRequest.java
index d31b5651fbe..ecdb3ba5fb8 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/request/CoreAdminRequest.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/request/CoreAdminRequest.java
@@ -67,6 +67,7 @@ public class CoreAdminRequest extends SolrRequest<CoreAdminResponse> {
private String collectionConfigName;
public Create() {
+ super(METHOD.POST);
action = CoreAdminAction.CREATE;
}
@@ -261,6 +262,7 @@ public class CoreAdminRequest extends SolrRequest<CoreAdminResponse> {
protected Boolean onlyIfLeaderActive;
public WaitForState() {
+ super(METHOD.POST);
action = CoreAdminAction.PREPRECOVERY;
}
@@ -358,6 +360,7 @@ public class CoreAdminRequest extends SolrRequest<CoreAdminResponse> {
public static class RequestRecovery extends CoreAdminRequest {
public RequestRecovery() {
+ super(METHOD.POST);
action = CoreAdminAction.REQUESTRECOVERY;
}
@@ -380,6 +383,7 @@ public class CoreAdminRequest extends SolrRequest<CoreAdminResponse> {
private String collection;
public RequestSyncShard() {
+ super(METHOD.POST);
action = CoreAdminAction.REQUESTSYNCSHARD;
}
@@ -447,6 +451,7 @@ public class CoreAdminRequest extends SolrRequest<CoreAdminResponse> {
protected List<String> srcCores;
public MergeIndexes() {
+ super(METHOD.POST);
action = CoreAdminAction.MERGEINDEXES;
}
@@ -494,6 +499,7 @@ public class CoreAdminRequest extends SolrRequest<CoreAdminResponse> {
protected boolean deleteInstanceDir;
public Unload(boolean deleteIndex) {
+ super(METHOD.POST);
action = CoreAdminAction.UNLOAD;
this.deleteIndex = deleteIndex;
}
@@ -536,7 +542,7 @@ public class CoreAdminRequest extends SolrRequest<CoreAdminResponse> {
private String commitName;
public CreateSnapshot(String commitName) {
- super();
+ super(METHOD.POST);
this.action = CoreAdminAction.CREATESNAPSHOT;
if (commitName == null) {
throw new NullPointerException("Please specify non null value for commitName parameter.");
@@ -560,7 +566,7 @@ public class CoreAdminRequest extends SolrRequest<CoreAdminResponse> {
private String commitName;
public DeleteSnapshot(String commitName) {
- super();
+ super(METHOD.POST);
this.action = CoreAdminAction.DELETESNAPSHOT;
if (commitName == null) {
@@ -583,17 +589,33 @@ public class CoreAdminRequest extends SolrRequest<CoreAdminResponse> {
public static class ListSnapshots extends CoreAdminRequest {
public ListSnapshots() {
- super();
+ super(METHOD.GET);
this.action = CoreAdminAction.LISTSNAPSHOTS;
}
}
+ public CoreAdminRequest(METHOD method) {
+ this(method, "/admin/cores");
+ }
+
+ public CoreAdminRequest(METHOD method, String path) {
+ super(method, path);
+ }
+
+ /**
+ * @deprecated Use {@link #CoreAdminRequest(METHOD)}.
+ */
+ @Deprecated(since = "11.0")
public CoreAdminRequest() {
- super(METHOD.GET, "/admin/cores");
+ this(METHOD.POST);
}
+ /**
+ * @deprecated Use {@link #CoreAdminRequest(METHOD, String)}.
+ */
+ @Deprecated(since = "11.0")
public CoreAdminRequest(String path) {
- super(METHOD.GET, path);
+ this(METHOD.POST, path);
}
public void setCoreName(String coreName) {
@@ -650,7 +672,7 @@ public class CoreAdminRequest extends SolrRequest<CoreAdminResponse> {
public static CoreAdminResponse reloadCore(String name, SolrClient client)
throws SolrServerException, IOException {
- CoreAdminRequest req = new CoreAdminRequest();
+ CoreAdminRequest req = new CoreAdminRequest(METHOD.POST);
req.setCoreName(name);
req.setAction(CoreAdminAction.RELOAD);
return req.process(client);
@@ -682,7 +704,7 @@ public class CoreAdminRequest extends SolrRequest<CoreAdminResponse> {
*/
public static CoreAdminResponse renameCore(String coreName, String newName, SolrClient client)
throws SolrServerException, IOException {
- CoreAdminRequest req = new CoreAdminRequest();
+ CoreAdminRequest req = new CoreAdminRequest(METHOD.POST);
req.setCoreName(coreName);
req.setOtherCoreName(SolrIdentifierValidator.validateCoreName(newName));
req.setAction(CoreAdminAction.RENAME);
@@ -701,7 +723,7 @@ public class CoreAdminRequest extends SolrRequest<CoreAdminResponse> {
*/
public static CoreAdminResponse swapCore(String core1, String core2, SolrClient client)
throws SolrServerException, IOException {
- CoreAdminRequest req = new CoreAdminRequest();
+ CoreAdminRequest req = new CoreAdminRequest(METHOD.POST);
req.setCoreName(core1);
req.setOtherCoreName(core2);
req.setAction(CoreAdminAction.SWAP);
@@ -715,7 +737,7 @@ public class CoreAdminRequest extends SolrRequest<CoreAdminResponse> {
public static CoreStatus getCoreStatus(String coreName, boolean getIndexInfo, SolrClient client)
throws SolrServerException, IOException {
- CoreAdminRequest req = new CoreAdminRequest();
+ CoreAdminRequest req = new CoreAdminRequest(METHOD.GET);
req.setAction(CoreAdminAction.STATUS);
req.setIndexInfoNeeded(getIndexInfo);
return new CoreStatus(req.process(client).getCoreStatus(coreName));
@@ -723,7 +745,7 @@ public class CoreAdminRequest extends SolrRequest<CoreAdminResponse> {
public static CoreAdminResponse getStatus(String name, SolrClient client)
throws SolrServerException, IOException {
- CoreAdminRequest req = new CoreAdminRequest();
+ CoreAdminRequest req = new CoreAdminRequest(METHOD.GET);
req.setCoreName(name);
req.setAction(CoreAdminAction.STATUS);
return req.process(client);
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestCollectionAdminRequest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestCollectionAdminRequest.java
index 3963b5866a3..9f9ddade79f 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestCollectionAdminRequest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestCollectionAdminRequest.java
@@ -17,14 +17,34 @@
package org.apache.solr.client.solrj.request;
import org.apache.solr.SolrTestCase;
+import org.apache.solr.client.solrj.SolrClient;
+import org.apache.solr.client.solrj.SolrRequest.METHOD;
import org.apache.solr.client.solrj.request.CollectionAdminRequest.CreateAlias;
import org.apache.solr.client.solrj.request.CollectionAdminRequest.CreateShard;
+import org.apache.solr.client.solrj.response.CollectionAdminResponse;
import org.apache.solr.common.SolrException;
+import org.apache.solr.common.params.CollectionParams.CollectionAction;
import org.junit.Test;
/** Unit tests for {@link CollectionAdminRequest}. */
public class TestCollectionAdminRequest extends SolrTestCase {
+ @Test
+ @SuppressWarnings("deprecation")
+ public void testAdminRequestsChooseExplicitHttpMethods() {
+ CollectionAdminRequest<CollectionAdminResponse> legacyRequest =
+ new CollectionAdminRequest<>(CollectionAction.CREATE) {
+ @Override
+ protected CollectionAdminResponse createResponse(SolrClient client) {
+ return new CollectionAdminResponse();
+ }
+ };
+ assertEquals(METHOD.POST, legacyRequest.getMethod());
+ assertEquals(
+ METHOD.POST, CollectionAdminRequest.createCollection("collection", null, 1, 1).getMethod());
+ assertEquals(METHOD.GET, new CollectionAdminRequest.List().getMethod());
+ }
+
@Test
public void testInvalidCollectionNameRejectedWhenCreatingCollection() {
final SolrException e =
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestConfigSetAdminRequest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestConfigSetAdminRequest.java
index 794129d34b4..f9b3fd33a7b 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestConfigSetAdminRequest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestConfigSetAdminRequest.java
@@ -19,6 +19,7 @@ package org.apache.solr.client.solrj.request;
import java.io.File;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.client.solrj.SolrClient;
+import org.apache.solr.client.solrj.SolrRequest.METHOD;
import org.apache.solr.client.solrj.response.ConfigSetAdminResponse;
import org.apache.solr.common.params.ConfigSetParams;
import org.junit.Test;
@@ -26,6 +27,14 @@ import org.junit.Test;
/** Basic error checking of ConfigSetAdminRequests. */
public class TestConfigSetAdminRequest extends SolrTestCaseJ4 {
+ @Test
+ @SuppressWarnings("deprecation")
+ public void testAdminRequestsChooseExplicitHttpMethods() {
+ assertEquals(METHOD.POST, new MyConfigSetAdminRequest().getMethod());
+ assertEquals(METHOD.POST, new ConfigSetAdminRequest.Create().getMethod());
+ assertEquals(METHOD.GET, new ConfigSetAdminRequest.List().getMethod());
+ }
+
@Test
public void testNoAction() {
MyConfigSetAdminRequest request = new MyConfigSetAdminRequest();
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestCoreAdmin.java b/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestCoreAdmin.java
index d8630d016ff..d5a8c36b173 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestCoreAdmin.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestCoreAdmin.java
@@ -30,6 +30,7 @@ import org.apache.commons.io.FileUtils;
import org.apache.lucene.tests.util.LuceneTestCase;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrQuery;
+import org.apache.solr.client.solrj.SolrRequest.METHOD;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.embedded.AbstractEmbeddedSolrServerTestCase;
import org.apache.solr.client.solrj.request.CoreAdminRequest.Create;
@@ -48,6 +49,14 @@ import org.junit.Test;
public class TestCoreAdmin extends AbstractEmbeddedSolrServerTestCase {
+ @Test
+ @SuppressWarnings("deprecation")
+ public void testAdminRequestsChooseExplicitHttpMethods() {
+ assertEquals(METHOD.POST, new CoreAdminRequest().getMethod());
+ assertEquals(METHOD.POST, new CoreAdminRequest.Create().getMethod());
+ assertEquals(METHOD.GET, new CoreAdminRequest.ListSnapshots().getMethod());
+ }
+
@Test
public void testConfigSet() throws Exception {
(solr) 04/04: SOLR-18413: Handle deleted MIGRATE routing targets (#4862)
Posted by ds...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
dsmiley pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git
commit 997a39ea30df63fd5af0917990b079b1fae134ad
Author: Zhenyu Li <48...@users.noreply.github.com>
AuthorDate: Sun Sep 6 00:14:34 2026 -0400
SOLR-18413: Handle deleted MIGRATE routing targets (#4862)
Problem fixed: Say the target of a MIGRATE collection is deleted, yet the source collection exists and receives an update request. The request reports failure after partially applying the mutation, leaving replicas of the source shard inconsistent. No update request is sent to the source replica. Therefore, SolrCmdDistributor does not observe a replica failure. Consequently, this request does not lower the replica's shard term or directly trigger recovery.
(cherry picked from commit 465859177153921cd0c09fb9f6c4d643d2f30d41)
---
.../fix-dangling-routing-rule-target.yml | 8 ++
.../processor/DistributedZkUpdateProcessor.java | 95 ++++++++++++----------
.../org/apache/solr/cloud/MigrateRouteKeyTest.java | 53 ++++++++++++
3 files changed, 115 insertions(+), 41 deletions(-)
diff --git a/changelog/unreleased/fix-dangling-routing-rule-target.yml b/changelog/unreleased/fix-dangling-routing-rule-target.yml
new file mode 100644
index 00000000000..a3ba20b78bc
--- /dev/null
+++ b/changelog/unreleased/fix-dangling-routing-rule-target.yml
@@ -0,0 +1,8 @@
+title: Prevent partial writes when a collection referenced by a MIGRATE routing rule has been deleted
+type: fixed
+authors:
+ - name: ZhenyuLi
+ nick: JHSUYU
+links:
+ - name: SOLR-18413
+ url: https://issues.apache.org/jira/browse/SOLR-18413
diff --git a/solr/core/src/java/org/apache/solr/update/processor/DistributedZkUpdateProcessor.java b/solr/core/src/java/org/apache/solr/update/processor/DistributedZkUpdateProcessor.java
index 35d96a7c14a..39724447530 100644
--- a/solr/core/src/java/org/apache/solr/update/processor/DistributedZkUpdateProcessor.java
+++ b/solr/core/src/java/org/apache/solr/update/processor/DistributedZkUpdateProcessor.java
@@ -1007,7 +1007,17 @@ public class DistributedZkUpdateProcessor extends DistributedUpdateProcessor {
int hash = compositeIdRouter.sliceHash(id, doc, null, coll);
for (DocRouter.Range range : ranges) {
if (range.includes(hash)) {
- DocCollection targetColl = cstate.getCollection(rule.getTargetCollectionName());
+ DocCollection targetColl =
+ cstate.getCollectionOrNull(rule.getTargetCollectionName());
+ if (targetColl == null) {
+ if (log.isInfoEnabled()) {
+ log.info(
+ "Removing shard update routing rule because the target collection {} doesn't exist",
+ rule.getTargetCollectionName());
+ }
+ removeRoutingRule(myShardId, routeKey);
+ break;
+ }
Collection<Slice> activeSlices =
targetColl.getRouter().getSearchSlicesSingle(id, null, targetColl);
if (activeSlices == null || activeSlices.isEmpty()) {
@@ -1027,46 +1037,8 @@ public class DistributedZkUpdateProcessor extends DistributedUpdateProcessor {
}
}
} else {
- ReentrantLock ruleExpiryLock = req.getCore().getRuleExpiryLock();
- if (!ruleExpiryLock.isLocked()) {
- try {
- if (ruleExpiryLock.tryLock(10, TimeUnit.MILLISECONDS)) {
- log.info("Going to expire routing rule");
- try {
- Map<String, Object> map =
- Map.of(
- Overseer.QUEUE_OPERATION,
- OverseerAction.REMOVEROUTINGRULE.toLower(),
- ZkStateReader.COLLECTION_PROP,
- collection,
- ZkStateReader.SHARD_ID_PROP,
- myShardId,
- "routeKey",
- routeKey + "!");
- if (distributedClusterStateUpdater.isDistributedStateUpdate()) {
- ZkNodeProps message = new ZkNodeProps(map);
- distributedClusterStateUpdater.doSingleStateUpdate(
- DistributedClusterStateUpdater.MutatingCommand.SliceRemoveRoutingRule,
- message,
- zkController.getOverseer().getSolrCloudManager(),
- zkController.getOverseer().getZkStateReader());
- } else {
- zkController.getOverseer().offerStateUpdate(Utils.toJSON(map));
- }
- } catch (KeeperException e) {
- log.warn(
- "Exception while removing routing rule for route key: {}", routeKey, e);
- } catch (Exception e) {
- log.error(
- "Exception while removing routing rule for route key: {}", routeKey, e);
- } finally {
- ruleExpiryLock.unlock();
- }
- }
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- }
- }
+ log.info("Removing shard update routing rule because it has expired");
+ removeRoutingRule(myShardId, routeKey);
}
}
}
@@ -1075,6 +1047,47 @@ public class DistributedZkUpdateProcessor extends DistributedUpdateProcessor {
return nodes;
}
+ private void removeRoutingRule(String shardId, String routeKey) {
+ ReentrantLock ruleExpiryLock = req.getCore().getRuleExpiryLock();
+ if (ruleExpiryLock.isLocked()) {
+ return;
+ }
+ try {
+ if (ruleExpiryLock.tryLock(10, TimeUnit.MILLISECONDS)) {
+ try {
+ Map<String, Object> map =
+ Map.of(
+ Overseer.QUEUE_OPERATION,
+ OverseerAction.REMOVEROUTINGRULE.toLower(),
+ ZkStateReader.COLLECTION_PROP,
+ collection,
+ ZkStateReader.SHARD_ID_PROP,
+ shardId,
+ "routeKey",
+ routeKey + "!");
+ if (distributedClusterStateUpdater.isDistributedStateUpdate()) {
+ ZkNodeProps message = new ZkNodeProps(map);
+ distributedClusterStateUpdater.doSingleStateUpdate(
+ DistributedClusterStateUpdater.MutatingCommand.SliceRemoveRoutingRule,
+ message,
+ zkController.getOverseer().getSolrCloudManager(),
+ zkController.getOverseer().getZkStateReader());
+ } else {
+ zkController.getOverseer().offerStateUpdate(Utils.toJSON(map));
+ }
+ } catch (KeeperException e) {
+ log.warn("Exception while removing routing rule for route key: {}", routeKey, e);
+ } catch (Exception e) {
+ log.error("Exception while removing routing rule for route key: {}", routeKey, e);
+ } finally {
+ ruleExpiryLock.unlock();
+ }
+ }
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ }
+ }
+
private void doDefensiveChecks(DistribPhase phase, UpdateCommand updateCommand) {
boolean isReplayOrPeersync =
(updateCommand.getFlags() & (UpdateCommand.REPLAY | UpdateCommand.PEER_SYNC)) != 0;
diff --git a/solr/core/src/test/org/apache/solr/cloud/MigrateRouteKeyTest.java b/solr/core/src/test/org/apache/solr/cloud/MigrateRouteKeyTest.java
index f883adee31b..e2257b67257 100644
--- a/solr/core/src/test/org/apache/solr/cloud/MigrateRouteKeyTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/MigrateRouteKeyTest.java
@@ -100,6 +100,59 @@ public class MigrateRouteKeyTest extends SolrCloudTestCase {
assertTrue(remoteSolrException.getMessage().contains("split.key cannot be null or empty"));
}
+ @Test
+ public void updateSucceedsAfterMigrateTargetIsDeleted() throws Exception {
+ String sourceCollection = "deletedMigrateTarget-source";
+ CollectionAdminRequest.createCollection(sourceCollection, "conf", 1, 2)
+ .process(cluster.getSolrClient());
+ String targetCollection = "deletedMigrateTarget-target";
+ CollectionAdminRequest.createCollection(targetCollection, "conf", 1, 1)
+ .process(cluster.getSolrClient());
+
+ cluster.getSolrClient().add(sourceCollection, new SolrInputDocument("id", "a!1"));
+ cluster.getSolrClient().commit(sourceCollection);
+
+ invokeCollectionMigration(
+ CollectionAdminRequest.migrateData(sourceCollection, targetCollection, "a!")
+ .setForwardTimeout(45));
+ waitForState(
+ "Expected to find routing rule for split key a",
+ sourceCollection,
+ c -> {
+ if (c == null) return false;
+ Map<String, RoutingRule> routingRules = c.getSlice("shard1").getRoutingRules();
+ return routingRules != null && routingRules.containsKey("a!");
+ });
+
+ CollectionAdminRequest.deleteCollection(targetCollection).process(cluster.getSolrClient());
+ waitForState("Expected target collection deletion", targetCollection, c -> c == null);
+
+ cluster.getSolrClient().add(sourceCollection, new SolrInputDocument("id", "a!2"));
+ cluster.getSolrClient().commit(sourceCollection);
+
+ DocCollection sourceState = getCollectionState(sourceCollection);
+ assertEquals(2, sourceState.getSlice("shard1").getReplicas().size());
+ for (Replica replica : sourceState.getSlice("shard1")) {
+ try (SolrClient replicaClient = getHttpSolrClient(replica)) {
+ SolrQuery query = new SolrQuery("id:\"a!2\"");
+ query.set("distrib", false);
+ assertEquals(
+ "Document missing from replica " + replica.getName(),
+ 1,
+ replicaClient.query(query).getResults().getNumFound());
+ }
+ }
+
+ waitForState(
+ "Expected dangling routing rule removal",
+ sourceCollection,
+ c -> {
+ if (c == null) return false;
+ Map<String, RoutingRule> routingRules = c.getSlice("shard1").getRoutingRules();
+ return routingRules == null || !routingRules.containsKey("a!");
+ });
+ }
+
@Test
public void multipleShardMigrateTest() throws Exception {
(solr) 03/04: SlowCompositeReaderWrapper: fix index sort and hasBlocks (#4825)
Posted by ds...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
dsmiley pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git
commit aab1c71f0eca891261b5aed97e882085948596fa
Author: David Smiley <ds...@apache.org>
AuthorDate: Sun Sep 6 00:05:39 2026 -0400
SlowCompositeReaderWrapper: fix index sort and hasBlocks (#4825)
minor fixes; not seen in a realistic setting.
(cherry picked from commit c78158b9811417543c4f7cdf99faed8d25c5943b)
---
...owCompositeReaderWrapper-sort-hasblocks-fix.yml | 6 ++++
.../solr/index/SlowCompositeReaderWrapper.java | 39 +++++++++++++---------
2 files changed, 29 insertions(+), 16 deletions(-)
diff --git a/changelog/unreleased/SlowCompositeReaderWrapper-sort-hasblocks-fix.yml b/changelog/unreleased/SlowCompositeReaderWrapper-sort-hasblocks-fix.yml
new file mode 100644
index 00000000000..c1f98f684cc
--- /dev/null
+++ b/changelog/unreleased/SlowCompositeReaderWrapper-sort-hasblocks-fix.yml
@@ -0,0 +1,6 @@
+# See https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc
+title: SlowCompositeReaderWrapper no longer misreports the index sort and hasBlocks of a multi-segment composite view; both were previously taken from the first segment only, which is wrong whenever there is more than one segment.
+type: fixed # added, changed, fixed, deprecated, removed, dependency_update, security, other
+authors:
+ - name: David Smiley
+links:
diff --git a/solr/core/src/java/org/apache/solr/index/SlowCompositeReaderWrapper.java b/solr/core/src/java/org/apache/solr/index/SlowCompositeReaderWrapper.java
index cdfbb181671..30cd59034fd 100644
--- a/solr/core/src/java/org/apache/solr/index/SlowCompositeReaderWrapper.java
+++ b/solr/core/src/java/org/apache/solr/index/SlowCompositeReaderWrapper.java
@@ -51,6 +51,7 @@ import org.apache.lucene.index.StoredFields;
import org.apache.lucene.index.TermVectors;
import org.apache.lucene.index.Terms;
import org.apache.lucene.search.KnnCollector;
+import org.apache.lucene.search.Sort;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.Version;
import org.apache.lucene.util.packed.PackedInts;
@@ -84,7 +85,7 @@ public final class SlowCompositeReaderWrapper extends LeafReader {
* This method is sugar for getting an {@link LeafReader} from an {@link IndexReader} of any kind.
* If the reader is already atomic, it is returned unchanged, otherwise wrapped by this class.
*/
- public static LeafReader wrap(IndexReader reader) throws IOException {
+ public static LeafReader wrap(IndexReader reader) {
if (reader instanceof CompositeReader) {
return new SlowCompositeReaderWrapper((CompositeReader) reader);
} else {
@@ -93,29 +94,35 @@ public final class SlowCompositeReaderWrapper extends LeafReader {
}
}
- SlowCompositeReaderWrapper(CompositeReader reader) throws IOException {
+ SlowCompositeReaderWrapper(CompositeReader reader) {
in = reader;
in.registerParentReader(this);
- if (reader.leaves().isEmpty()) {
+ List<LeafReaderContext> leaves = reader.leaves();
+ if (leaves.isEmpty()) {
metaData = new LeafMetaData(Version.LATEST.major, Version.LATEST, null, false);
} else {
Version minVersion = Version.LATEST;
- for (LeafReaderContext leafReaderContext : reader.leaves()) {
- Version leafVersion = leafReaderContext.reader().getMetaData().getMinVersion();
- if (leafVersion == null) {
- minVersion = null;
- break;
- } else if (minVersion.onOrAfter(leafVersion)) {
- minVersion = leafVersion;
+ boolean hasBlocks = false;
+ for (LeafReaderContext leafReaderContext : leaves) {
+ LeafMetaData leafMetaData = leafReaderContext.reader().getMetaData();
+ if (minVersion != null) {
+ Version leafVersion = leafMetaData.getMinVersion();
+ if (leafVersion == null) {
+ minVersion = null;
+ } else if (minVersion.onOrAfter(leafVersion)) {
+ minVersion = leafVersion;
+ }
}
+ // A block (child/nested docs), once written, is never split across segments, so the
+ // composite view has blocks as soon as any one of its segments does.
+ hasBlocks |= leafMetaData.hasBlocks();
}
- LeafMetaData leafMetaData = reader.leaves().get(0).reader().getMetaData();
+ LeafMetaData firstLeafMetaData = leaves.get(0).reader().getMetaData();
+ // The composite view is only actually sorted in the trivial single-leaf case: concatenating
+ // multiple segments does not preserve their shared per-segment sort as a sort of the whole.
+ Sort sort = leaves.size() == 1 ? firstLeafMetaData.getSort() : null;
metaData =
- new LeafMetaData(
- leafMetaData.getCreatedVersionMajor(),
- minVersion,
- leafMetaData.getSort(),
- leafMetaData.hasBlocks());
+ new LeafMetaData(firstLeafMetaData.getCreatedVersionMajor(), minVersion, sort, hasBlocks);
}
fieldInfos = FieldInfos.getMergedFieldInfos(in);
}
(solr) 01/04: SOLR-18399: Ship ui-grid icon fonts with the Admin UI (#4802)
Posted by ds...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
dsmiley pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git
commit fde3380d0c5747d0a0094d4c271b5fa7b076fc07
Author: Jan Høydahl <ja...@apache.org>
AuthorDate: Tue Sep 1 00:25:36 2026 +0200
SOLR-18399: Ship ui-grid icon fonts with the Admin UI (#4802)
(cherry picked from commit aa75ab54b04470e719cc7ede4a06672e7a5720c4)
---
solr/webapp/web/css/angular/fonts/ui-grid.eot | Bin 0 -> 10319 bytes
solr/webapp/web/css/angular/fonts/ui-grid.svg | Bin 0 -> 9087 bytes
solr/webapp/web/css/angular/fonts/ui-grid.ttf | Bin 0 -> 10155 bytes
solr/webapp/web/css/angular/fonts/ui-grid.woff | Bin 0 -> 5728 bytes
4 files changed, 0 insertions(+), 0 deletions(-)
diff --git a/solr/webapp/web/css/angular/fonts/ui-grid.eot b/solr/webapp/web/css/angular/fonts/ui-grid.eot
new file mode 100644
index 00000000000..59cf0aed25b
Binary files /dev/null and b/solr/webapp/web/css/angular/fonts/ui-grid.eot differ
diff --git a/solr/webapp/web/css/angular/fonts/ui-grid.svg b/solr/webapp/web/css/angular/fonts/ui-grid.svg
new file mode 100644
index 00000000000..9d2e03c0e3a
Binary files /dev/null and b/solr/webapp/web/css/angular/fonts/ui-grid.svg differ
diff --git a/solr/webapp/web/css/angular/fonts/ui-grid.ttf b/solr/webapp/web/css/angular/fonts/ui-grid.ttf
new file mode 100644
index 00000000000..b1a4b061164
Binary files /dev/null and b/solr/webapp/web/css/angular/fonts/ui-grid.ttf differ
diff --git a/solr/webapp/web/css/angular/fonts/ui-grid.woff b/solr/webapp/web/css/angular/fonts/ui-grid.woff
new file mode 100644
index 00000000000..426c611501c
Binary files /dev/null and b/solr/webapp/web/css/angular/fonts/ui-grid.woff differ