Description
Describe the bug
Similar issue: #3683 and #3688
Introduced by PR #3593 / commit 223d472, which aims to resolve issue #3542
The change of class org.opensearch.action.support.master.AcknowledgedResponse
causes compatibility issue with plugins that uses this class.
For example:
This is the code in security that causes build failure:
https://github.com/opensearch-project/security/blob/f431ec2201e1466b7c12528347a1f54cf64387c9/src/main/java/org/opensearch/security/tools/SecurityAdmin.java#L518
The problem is the variable definition is in type of a subclass, while an object in superclass is assigned to the variable.
The current AcknowledgedResponse
in master
package extends
the same name class in clustermanager
class
https://github.com/opensearch-project/OpenSearch/blob/223d472e6d8ea4454cb05fba7271d213430a1a4e/server/src/main/java/org/opensearch/action/support/master/AcknowledgedResponse.java
In the meantime, I changed the return value type of "putSettings" method to the class in "cluster manager" package.
While security plugin is using the AcknowledgedResponse
class in master
package.
To Reproduce
- Build OpenSearch 2.1.0 Snapshot using the code https://github.com/opensearch-project/OpenSearch/tree/79cabafebc74e8379f7c854657693ca3b03a3247
- Build security plugin or k-NN plugin with the above OpenSearch build artifact.
- Plugins can't be built.
Expected behavior
The current plugins can be built correctly without making name change to OpenSearch Java API.
Additional context
A build failure in CCR plugin (comes from opensearch-project/cross-cluster-replication#398):
/home/runner/work/cross-cluster-replication/cross-cluster-replication/src/main/kotlin/org/opensearch/replication/action/autofollow/TransportAutoFollowClusterManagerNodeAction.kt: (48, 1): Class 'TransportAutoFollowClusterManagerNodeAction' is not abstract and does not implement abstract base class member protected/*protected and package*/ abstract fun clusterManagerOperation(p0: AutoFollowClusterManagerNodeRequest!, p1: ClusterState!, p2: ActionListener<AcknowledgedResponse!>!): Unit defined in org.opensearch.action.support.master.TransportMasterNodeAction
Solution:
Restore the change for this class to keep the compatibility.
To restore the class org.opensearch.action.support.master.AcknowledgedResponse
to its original appearance (https://github.com/opensearch-project/OpenSearch/blob/2.0.1/server/src/main/java/org/opensearch/action/support/master/AcknowledgedResponse.java)
I need to do in 2 PRs to keep the git history of the file:
- Remove the current class
AcknowledgedResponse
frompackage org.opensearch.action.support.master
- Move the class
AcknowledgedResponse
frompackage org.opensearch.action.support.clustermanager
toorg.opensearch.action.support.master
(https://github.com/opensearch-project/OpenSearch/blob/7005b9eb42f66912507b8f973b79734c260bdfe9/server/src/main/java/org/opensearch/action/support/clustermanager/AcknowledgedResponse.java)