-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Compatibility issue with plugins about class 'org.opensearch.action.support.master.AcknowledgedResponse' #3663
Comments
The problem will be resolved for now after the backport PR #3670 merged. |
Since Java doesn't really offer a clean way to change only the return type of a method in a non-breaking way, it's my opinion that we can probably do this as a breaking change. We'll have to proactively reach out to all the plugins in opensearch-project, but it should be as simple as a find-and-replace in the import statement, i.e. replace
with
At a minimum we should identify all usages across all repos and open issues, or even just open PRs with the renamed import statement. |
There are other 3 classes that have relationship with the class
Reason:
Because class The below is the class definition of OpenSearch/server/src/main/java/org/opensearch/action/support/master/AcknowledgedRequestBuilder.java Lines 43 to 49 in 82ff463
Lines 46 to 51 in 6462a54
The solution to deprecate other classes in this package is to make the class with old (non-inclusive) name be a subclass of the class with new (inclusive) name, so that maintaining one class implementation can support 2 the classes simultaneously, such as MasterNodeRequest: OpenSearch/server/src/main/java/org/opensearch/action/support/master/MasterNodeRequest.java Line 47 in 82ff463
The above solution is not applicable to class OpenSearch/server/src/main/java/org/opensearch/action/support/master/AcknowledgedRequest.java Line 49 in 54364a5
I tried to let |
As mentioned above, the 4 classes |
@tlfeng How will these other deprecations be handled - is there an issue tracking them? |
@peternied Unfortunately there's not a good way to do this change in a backward compatible way, so the approach is that these classes will be deprecated in 2.x and then renamed for 3.0. This means there will be a breaking change for 3.0 that will require a trivial update in any plugin that imports these classes. |
Resolving this issue again. The inclusive naming deprecation high level approach is detailed in the blog post here: https://opensearch.org/blog/technical-post/2022/10/Adopting-inclusive-language-across-OpenSearch/ |
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
inmaster
packageextends
the same name class inclustermanager
classhttps://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 inmaster
package.To Reproduce
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:
AcknowledgedResponse
frompackage org.opensearch.action.support.master
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)The text was updated successfully, but these errors were encountered: