Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-17398: Link V1 collection operations to their V2 equivalents (#5053)

Serhiy Bzhezytskyy1d7a1e906273
diff --git a/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java
index 170d3b69b52..28d2e3af535 100644
--- a/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java
@@ -111,6 +111,11 @@ import java.util.concurrent.TimeoutException;
import org.apache.solr.api.AnnotatedApi;
import org.apache.solr.api.Api;
import org.apache.solr.api.JerseyResource;
+import org.apache.solr.client.api.endpoint.ClusterPropertyApis;
+import org.apache.solr.client.api.endpoint.ListAliasesApi;
+import org.apache.solr.client.api.endpoint.ListClusterNodesApi;
+import org.apache.solr.client.api.endpoint.ListCollectionsApi;
+import org.apache.solr.client.api.endpoint.RenameCollectionApi;
import org.apache.solr.client.api.model.AddReplicaPropertyRequestBody;
import org.apache.solr.client.api.model.CreateAliasRequestBody;
import org.apache.solr.client.api.model.CreateCollectionSnapshotRequestBody;
@@ -157,6 +162,7 @@ import org.apache.solr.core.CloudConfig;
import org.apache.solr.core.CoreContainer;
import org.apache.solr.core.snapshots.CollectionSnapshotMetaData;
import org.apache.solr.core.snapshots.SolrSnapshotManager;
+import org.apache.solr.handler.ClusterAPI;
import org.apache.solr.handler.RequestHandlerBase;
import org.apache.solr.handler.admin.api.AddReplicaProperty;
import org.apache.solr.handler.admin.api.AdminAPIBase;
@@ -533,6 +539,10 @@ public class CollectionsHandler extends RequestHandlerBase implements Permission
return null;
}),
+ /**
+ * V2 equivalent: {@link RenameCollectionApi} ({@code POST
+ * /collections/{collectionName}/rename}).
+ */
RENAME_OP(
RENAME,
(req, rsp, h) -> {
@@ -541,6 +551,7 @@ public class CollectionsHandler extends RequestHandlerBase implements Permission
return copy(req.getParams(), map, FOLLOW_ALIASES);
}),
+ /** No V2 equivalent yet. */
REINDEXCOLLECTION_OP(
REINDEXCOLLECTION,
(req, rsp, h) -> {
@@ -626,6 +637,10 @@ public class CollectionsHandler extends RequestHandlerBase implements Permission
V2ApiUtils.squashIntoSolrResponseWithoutHeader(rsp, getAliasesResponse);
return null;
}),
+ /**
+ * V2 equivalent: {@link SplitShardAPI} ({@code POST /collections/{collection}/shards} with the
+ * {@code split} command).
+ */
SPLITSHARD_OP(
SPLITSHARD,
DEFAULT_COLLECTION_OP_TIMEOUT * 5,
@@ -703,6 +718,10 @@ public class CollectionsHandler extends RequestHandlerBase implements Permission
DeleteReplica.invokeWithV1Params(h.coreContainer, req, rsp);
return null;
}),
+ /**
+ * V2 equivalent: {@link MigrateDocsAPI} ({@code POST /collections/{collection}} with the {@code
+ * migrate-docs} command).
+ */
MIGRATE_OP(
MIGRATE,
(req, rsp, h) -> {
@@ -769,7 +788,12 @@ public class CollectionsHandler extends RequestHandlerBase implements Permission
V2ApiUtils.squashIntoSolrResponseWithoutHeader(rsp, response);
return null;
}),
+ /**
+ * V2 equivalent: {@link ClusterAPI#getOverseerStatus} ({@code GET /cluster/overseer}), which
+ * calls this operation.
+ */
OVERSEERSTATUS_OP(OVERSEERSTATUS, (req, rsp, h) -> new LinkedHashMap<>()),
+ /** No V2 equivalent yet. */
DISTRIBUTEDAPIPROCESSING_OP(
DISTRIBUTEDAPIPROCESSING,
(req, rsp, h) -> {
@@ -794,6 +818,12 @@ public class CollectionsHandler extends RequestHandlerBase implements Permission
* Handle cluster status request. Can return status per specific collection/shard or per all
* collections.
*/
+ /**
+ * Superseded by V2, which splits it up: {@link ListCollectionsApi} ({@code GET
+ * /collections?detailed=true}) for the collections tree, {@link ListClusterNodesApi} ({@code
+ * GET /cluster/nodes}), {@link ListAliasesApi} ({@code GET /aliases}) and {@link
+ * ClusterPropertyApis} ({@code GET /cluster/properties}).
+ */
CLUSTERSTATUS_OP(
CLUSTERSTATUS,
(req, rsp, h) -> {
@@ -842,6 +872,10 @@ public class CollectionsHandler extends RequestHandlerBase implements Permission
BalanceShardUnique.invokeFromV1Params(h.coreContainer, req, rsp);
return null;
}),
+ /**
+ * V2 equivalent: {@link RebalanceLeadersAPI} ({@code POST /collections/{collection}} with the
+ * {@code rebalance-leaders} command).
+ */
REBALANCELEADERS_OP(
REBALANCELEADERS,
(req, rsp, h) -> {
@@ -849,6 +883,10 @@ public class CollectionsHandler extends RequestHandlerBase implements Permission
return null;
}),
// XXX should this command support followAliases?
+ /**
+ * V2 equivalent: {@link ModifyCollectionAPI} ({@code POST /collections/{collection}} with the
+ * {@code modify} command).
+ */
MODIFYCOLLECTION_OP(
MODIFYCOLLECTION,
(req, rsp, h) -> {
@@ -1003,6 +1041,10 @@ public class CollectionsHandler extends RequestHandlerBase implements Permission
V2ApiUtils.squashIntoSolrResponseWithoutHeader(rsp, replaceNodeResponse);
return null;
}),
+ /**
+ * V2 equivalent: {@link MoveReplicaAPI} ({@code POST /collections/{collection}} with the {@code
+ * move-replica} command).
+ */
MOVEREPLICA_OP(
MOVEREPLICA,
(req, rsp, h) -> {