Apache Solr open-source search software
SOLR-18160: Deprecate ADDROLE and REMOVEROLE operations (#4627)
Abhishek Umarjikar69a632d9b5cd
diff --git a/changelog/unreleased/SOLR_18160_deprecate_addrole_removerole.yml b/changelog/unreleased/SOLR_18160_deprecate_addrole_removerole.ymlnew file mode 100644index 00000000000..89624c35305--- /dev/null+++ b/changelog/unreleased/SOLR_18160_deprecate_addrole_removerole.yml@@ -0,0 +1,8 @@+type: deprecated+title: Deprecate Overseer ADDROLE and REMOVEROLE Collection API operations+authors:+ - name: Abhishek Umarjikar+ nick: abumarjikar+links:+ - name: SOLR-18160+ url: https://issues.apache.org/jira/browse/SOLR-18160diff --git a/solr/core/src/java/org/apache/solr/cloud/api/collections/OverseerRoleCmd.java b/solr/core/src/java/org/apache/solr/cloud/api/collections/OverseerRoleCmd.javaindex af4ff42be66..f33e317f998 100644--- a/solr/core/src/java/org/apache/solr/cloud/api/collections/OverseerRoleCmd.java+++ b/solr/core/src/java/org/apache/solr/cloud/api/collections/OverseerRoleCmd.java@@ -32,6 +32,7 @@ import org.apache.solr.common.params.CollectionParams.CollectionAction;import org.apache.solr.common.util.CollectionUtil;import org.apache.solr.common.util.NamedList;import org.apache.solr.common.util.Utils;+import org.apache.solr.logging.DeprecationLog;import org.apache.zookeeper.CreateMode;import org.apache.zookeeper.data.Stat;import org.slf4j.Logger;@@ -87,9 +88,21 @@ public class OverseerRoleCmd implements CollApiCmds.CollectionApiCommand {List<String> nodeList = roles.computeIfAbsent(roleName, k -> new ArrayList<>());if (ADDROLE == operation) {+ DeprecationLog.log(+ "CollectionAPI-" + operation,+ "The "+ + operation+ + " API is deprecated and will be removed in Solr 11. "+ + "Please transition to using Node Roles (-Dsolr.node.roles) at startup instead.");log.info("Overseer role added to {}", node);if (!nodeList.contains(node)) nodeList.add(node);} else if (REMOVEROLE == operation) {+ DeprecationLog.log(+ "CollectionAPI-" + operation,+ "The "+ + operation+ + " API is deprecated and will be removed in Solr 11. "+ + "Please transition to using Node Roles (-Dsolr.node.roles) at startup instead.");log.info("Overseer role removed from {}", node);nodeList.remove(node);}diff --git a/solr/core/src/java/org/apache/solr/handler/ClusterAPI.java b/solr/core/src/java/org/apache/solr/handler/ClusterAPI.javaindex e8c36f4e8cc..13b2cb8a682 100644--- a/solr/core/src/java/org/apache/solr/handler/ClusterAPI.java+++ b/solr/core/src/java/org/apache/solr/handler/ClusterAPI.java@@ -258,6 +258,7 @@ public class ClusterAPI {@EndPoint(method = POST, path = "/cluster", permission = COLL_EDIT_PERM)public class Commands {@Command(name = "add-role")+ @Deprecated(since = "10.1")public void addRole(PayloadObj<RoleInfo> obj) throws Exception {RoleInfo info = obj.get();Map<String, Object> m = new SimpleOrderedMap<>(info);@@ -266,6 +267,7 @@ public class ClusterAPI {}@Command(name = "remove-role")+ @Deprecated(since = "10.1")public void removeRole(PayloadObj<RoleInfo> obj) throws Exception {RoleInfo info = obj.get();Map<String, Object> m = new SimpleOrderedMap<>(info);diff --git a/solr/core/src/java/org/apache/solr/handler/admin/ClusterStatus.java b/solr/core/src/java/org/apache/solr/handler/admin/ClusterStatus.javaindex cbc45803d80..cfd2377ebe6 100644--- a/solr/core/src/java/org/apache/solr/handler/admin/ClusterStatus.java+++ b/solr/core/src/java/org/apache/solr/handler/admin/ClusterStatus.java@@ -50,7 +50,10 @@ public class ClusterStatus {public static final String INCLUDE_ALL = "includeAll";public static final String LIVENODES_PROP = "liveNodes";public static final String CLUSTER_PROP = "clusterProperties";++ @Deprecated(since = "10.1")public static final String ROLES_PROP = "roles";+public static final String ALIASES_PROP = "aliases";/** Shard / collection health state. */diff --git a/solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-10.adoc b/solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-10.adocindex a9be79797a9..c7b1962ce03 100644--- a/solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-10.adoc+++ b/solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-10.adoc@@ -307,6 +307,8 @@ Nowadays, the HTTP request is available via internal APIs: `SolrQueryRequest.get* The deprecated `VMParamsAllAndReadonlyDigestZkACLProvider` class has been removed. Use a combination of `DigestZkACLProvider` and `VMParamsZkCredentialsInjector` instead. (SOLR-18122)+* The legacy V1 `ADDROLE` and `REMOVEROLE` commands (and their SolrJ client and experimental V2 counterparts) are deprecated as of 10.1 and scheduled for removal in Solr 11. Users must switch to **"node roles" (system properties)** (e.g., `-Dsolr.node.roles=data:on,overseer:preferred`) at startup. The `roles` field in `CLUSTERSTATUS` is also deprecated.+=== Security* There is no longer a distinction between trusted and untrusted configSets; all configSets are now considered trusted. To ensure security, Solr should be properly protected using authentication and authorization mechanisms, allowing only authorized users with administrative privileges to publish them.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.javaindex b67b665a551..0ac88ee3922 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@@ -2861,7 +2861,12 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>}}- /** Returns a SolrRequest to add a role to a node */+ /**+ * Returns a SolrRequest to add a role to a node+ *+ * @deprecated Use Node Roles ({@code -Dsolr.node.roles}) at startup instead.+ */+ @Deprecated(since = "10.1")public static AddRole addRole(String node, String role) {return new AddRole(node, role);}@@ -2873,7 +2878,12 @@ public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>}}- /** Returns a SolrRequest to remove a role from a node */+ /**+ * Returns a SolrRequest to remove a role from a node+ *+ * @deprecated Use Node Roles ({@code -Dsolr.node.roles}) at startup instead.+ */+ @Deprecated(since = "10.1")public static RemoveRole removeRole(String node, String role) {return new RemoveRole(node, role);}diff --git a/solr/solrj/src/java/org/apache/solr/common/params/CollectionParams.java b/solr/solrj/src/java/org/apache/solr/common/params/CollectionParams.javaindex a066ff1e89b..3e1d9745c93 100644--- a/solr/solrj/src/java/org/apache/solr/common/params/CollectionParams.java+++ b/solr/solrj/src/java/org/apache/solr/common/params/CollectionParams.java@@ -102,7 +102,9 @@ public interface CollectionParams {DELETEREPLICA(true, LockLevel.SHARD),FORCELEADER(true, LockLevel.SHARD),MIGRATE(true, LockLevel.COLLECTION),+ @Deprecated(since = "10.1")ADDROLE(true, LockLevel.NONE),+ @Deprecated(since = "10.1")REMOVEROLE(true, LockLevel.NONE),CLUSTERPROP(true, LockLevel.NONE),COLLECTIONPROP(true, LockLevel.NONE), // atomic; no lock