Skip to content
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

[2.x] Deprecate public class names with master terminology (#3871) #3914

Merged
merged 3 commits into from
Jul 15, 2022

Conversation

tlfeng
Copy link
Collaborator

@tlfeng tlfeng commented Jul 15, 2022

Description

Backport PR #3871 / commit 0e96a87

Note:

  1. The interface LocalNodeClusterManagerListener(new name) / LocalNodeMasterListener (old name) is used as the return value for the public method newHashPublisher(). Since LocalNodeClusterManagerListener is the superclass of LocalNodeMasterListener, changing the return value to a superclass will be a breaking change, it will lead to down-casting for others who assigning the return value to a variable, so I changed the return value back to the old class name LocalNodeMasterListener.
  2. A test in ExceptionSerializationTests requires all subclass of OpenSearchException must be registered in the Exception list (code: https://github.com/opensearch-project/OpenSearch/blob/2.1.0/server/src/test/java/org/opensearch/ExceptionSerializationTests.java#L237). I modified the test to ignore the deprecated exception classes NotMasterException and MasterNotDiscoveredException, since there are new classes NotClusterManagerException and ClusterManagerNotDiscoveredException as the replacement.

List of classes that renamed in previous PR:
In this PR, the usages of the old names should all be restored.
sever directory:
interface LocalNodeMasterListener -> LocalNodeClusterManagerListener
final class MasterNodeChangePredicate -> ClusterManagerNodeChangePredicate
NotMasterException -> NotClusterManagerException
NoMasterBlockService -> NoClusterManagerBlockService
UnsafeBootstrapMasterCommand - UnsafeBootstrapClusterManagerCommand
MasterNotDiscoveredException -> ClusterManagerNotDiscoveredException
RestMasterAction -> RestClusterManagerAction

List of classes that was not renamed:
sever directory:
MasterService
test/framework directory:
FakeThreadPoolMasterService
BlockMasterServiceOnMaster
BusyMasterServiceDisruption

Issues Resolved

The second step to resolve issue #3543

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

…ect#3871)

- Add back the usage of old names for some classes for backwards compatibility. Those public classes were renamed from "master" to "cluster manager" In PR opensearch-project#3619 / commit opensearch-project@a7e113a.
 - Add a unit test to validate the backwards compatibility of interface `LocalNodeMasterListener` remains.
 - Revert the renaming of class `MasterService`, `FakeThreadPoolMasterService`, `BlockMasterServiceOnMaster` and `BusyMasterServiceDisruption`, as well as instance variable names of class `MasterService`.
 Because I couldn't solve the compatibility problem of a public method `public ClusterManagerService getMasterService()` (opensearch-project#3871 (comment))

**List of classes that renamed in previous PR:**
In this PR, the usages of the old names should all be restored.
`sever` directory:
interface LocalNodeMasterListener -> LocalNodeClusterManagerListener
final class MasterNodeChangePredicate -> ClusterManagerNodeChangePredicate
NotMasterException -> NotClusterManagerException
NoMasterBlockService -> NoClusterManagerBlockService
UnsafeBootstrapMasterCommand - UnsafeBootstrapClusterManagerCommand
MasterNotDiscoveredException -> ClusterManagerNotDiscoveredException
RestMasterAction -> RestClusterManagerAction

**List of classes that not renamed:**
`sever` directory:
MasterService
`test/framework` directory:
FakeThreadPoolMasterService
BlockMasterServiceOnMaster
BusyMasterServiceDisruption

Signed-off-by: Tianli Feng <[email protected]>
@tlfeng tlfeng requested review from a team and reta as code owners July 15, 2022 00:18
@tlfeng tlfeng added enhancement Enhancement or improvement to existing feature or request backport PRs or issues specific to backporting features or enhancments v2.2.0 deprecate labels Jul 15, 2022
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

Comment on lines 10 to 16
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For new files, we don't need this part. This comment applies for all new files containing this licensing term.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your review! Because the file name doesn't change compared to before, so initially I didn't take them as new files. But it is reasonable to remove this part from license header.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed those license header in commit ebb2bc9. 😄

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of changing the backport PR for this change. Let's create a new one and change here

Copy link
Collaborator Author

@tlfeng tlfeng Jul 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@owaiskazi19 I will create a new PR to change the license header in main branch. Thanks for your advice!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created new PR to remove the part of license header in main branch #3924

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@codecov-commenter
Copy link

Codecov Report

Merging #3914 (8ce5bef) into 2.x (ea55054) will decrease coverage by 0.02%.
The diff coverage is 37.98%.

@@             Coverage Diff              @@
##                2.x    #3914      +/-   ##
============================================
- Coverage     70.64%   70.62%   -0.03%     
- Complexity    56398    56429      +31     
============================================
  Files          4520     4526       +6     
  Lines        271675   271706      +31     
  Branches      39974    39974              
============================================
- Hits         191932   191890      -42     
- Misses        63605    63724     +119     
+ Partials      16138    16092      -46     
Impacted Files Coverage Δ
...adle/testclusters/StandaloneRestIntegTestTask.java 0.00% <0.00%> (ø)
...erver/src/main/java/org/opensearch/Assertions.java 75.00% <ø> (ø)
.../main/java/org/opensearch/OpenSearchException.java 93.22% <ø> (+1.23%) ⬆️
...n/cluster/health/TransportClusterHealthAction.java 47.75% <0.00%> (ø)
...min/cluster/state/TransportClusterStateAction.java 53.94% <ø> (ø)
.../opensearch/cluster/MasterNodeChangePredicate.java 0.00% <0.00%> (-90.91%) ⬇️
...ava/org/opensearch/cluster/NotMasterException.java 0.00% <ø> (-100.00%) ⬇️
...rch/cluster/coordination/NoMasterBlockService.java 0.00% <0.00%> (-100.00%) ⬇️
...g/opensearch/cluster/coordination/NodeToolCli.java 0.00% <0.00%> (ø)
...dination/UnsafeBootstrapClusterManagerCommand.java 0.00% <0.00%> (ø)
... and 503 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 21c45a5...8ce5bef. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport PRs or issues specific to backporting features or enhancments deprecate enhancement Enhancement or improvement to existing feature or request v2.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants