-
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
Deprecate public class names with master terminology #3871
Deprecate public class names with master terminology #3871
Conversation
Signed-off-by: Tianli Feng <ftianli@amazon.com>
Gradle Check (Jenkins) Run Completed with:
|
In build 479:
|
Signed-off-by: Tianli Feng <ftianli@amazon.com>
Signed-off-by: Tianli Feng <ftianli@amazon.com>
Gradle Check (Jenkins) Run Completed with:
|
In build 486:
|
…ist in ExceptionSerializationTests Signed-off-by: Tianli Feng <ftianli@amazon.com>
Gradle Check (Jenkins) Run Completed with:
|
Codecov Report
@@ Coverage Diff @@
## main #3871 +/- ##
============================================
- Coverage 71.10% 70.47% -0.63%
+ Complexity 57060 56663 -397
============================================
Files 4557 4567 +10
Lines 272681 272709 +28
Branches 40038 40038
============================================
- Hits 193884 192193 -1691
- Misses 62773 64299 +1526
- Partials 16024 16217 +193
Continue to review full report at Codecov.
|
Gradle Check (Jenkins) Run Completed with:
|
Note: The above build 483 didn't run the test for the latest commit, so it can be ignored. |
…erListener Signed-off-by: Tianli Feng <ftianli@amazon.com>
…eprecated master setting Signed-off-by: Tianli Feng <ftianli@amazon.com>
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
In build 559:
The below is reported in issue #3872
|
Hi @reta, thanks a lot for your review! It really helps me push the process forward! |
// TODO: add final keyword to the class and private keyword to the default constructor, | ||
// after removing the deprecated class MasterNodeChangePredicate. | ||
// Removed the final keyword temporarily only for making the class MasterNodeChangePredicate as a subclass, | ||
// so that preserving the both class names by maintaining one class implementation for backwards compatibility. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this class only exists as a container for a single static method. Assuming that's right, the less intrusive approach may be just to do the following in the other class (as opposed to using inheritance):
@Deprecated
public final class MasterNodeChangePredicate {
private MasterNodeChangePredicate() { }
public static Predicate<ClusterState> build(ClusterState currentState) {
return ClusterManagerNodeChangePredicate.build(clusterState);
}
}
Because it means you don't have to change this class at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for providing the suggestion to me! Let me check this approach. 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This must be the "delegation" approach. Thanks for showing me the code. I updated in the commit d10fec2
…sterService to keep backwards compatibility Signed-off-by: Tianli Feng <ftianli@amazon.com>
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
public MasterService(Settings settings, ClusterSettings clusterSettings, ThreadPool threadPool) { | ||
super(settings, clusterSettings, threadPool); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is one problem, the return value of getMasterService()
should be the old MasterService
class, otherwise there will be down-casting problem for the existing classes that uses the return value.
https://github.com/tlfeng/OpenSearch/blob/951af92cb316bf0d9f1b56338fd0bec90d029375/server/src/main/java/org/opensearch/cluster/service/ClusterService.java#L221
public ClusterManagerService getMasterService() {
return clusterManagerService;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finally I reverted renaming the class MasterService
in this PR (in commit 50a322b).
Gradle Check (Jenkins) Run Completed with:
|
Signed-off-by: Tianli Feng <ftianli@amazon.com>
Gradle Check (Jenkins) Run Completed with:
|
This reverts commit 694d876. Signed-off-by: Tianli Feng <ftianli@amazon.com>
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Signed-off-by: Tianli Feng <ftianli@amazon.com>
Signed-off-by: Tianli Feng <ftianli@amazon.com>
…eDisruption Signed-off-by: Tianli Feng <ftianli@amazon.com>
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Signed-off-by: Tianli Feng <ftianli@amazon.com>
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
#3870) * Rename public classes with 'Master' to 'ClusterManager' (#3619) Replace master terminology by cluster manager in the public Java APIs to support inclusive language. The PR deal with the public class name in the repository (except for those covered in issue #3542). * Replace `Master` to `ClusterManager` in most of the class names (except `MasterService` class), including all the references to the classes. The next PR will be #3871, adding back the classes in old name for backwards compatibility. List of classes that renamed in this PR: `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 <ftianli@amazon.com> (cherry picked from commit a7e113a)
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.x 2.x
# Navigate to the new working tree
cd .worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-3871-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 0e96a878a5ab1ffec3ee04f15fe976d34c9905dc
# Push it to GitHub
git push --set-upstream origin backport/backport-3871-to-2.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.x Then, create a pull request where the |
…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 <ftianli@amazon.com>
…3914) * Deprecate public class names with master terminology (#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 #3619 / commit 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()` (#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 <ftianli@amazon.com>
Description
A step of replacing
master
terminology bycluster manager
in the public Java APIs to support inclusive language.LocalNodeMasterListener
remains.MasterService
,FakeThreadPoolMasterService
,BlockMasterServiceOnMaster
andBusyMasterServiceDisruption
, as well as instance variable names of classMasterService
.Because I couldn't solve the compatibility problem of a public method
public ClusterManagerService getMasterService()
(Deprecate public class names with master terminology #3871 (comment))Note:
LocalNodeClusterManagerListener
(new name) /LocalNodeMasterListener
(old name) is used as the return value for the public methodnewHashPublisher()
. SinceLocalNodeClusterManagerListener
is the superclass ofLocalNodeMasterListener
, 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 nameLocalNodeMasterListener
.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 classesNotMasterException
andMasterNotDiscoveredException
, since there are new classesNotClusterManagerException
andClusterManagerNotDiscoveredException
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 not renamed:
sever
directory:MasterService
test/framework
directory:FakeThreadPoolMasterService
BlockMasterServiceOnMaster
BusyMasterServiceDisruption
Issues Resolved
The second step to resolve issue #3543
Check List
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.