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

Rename and deprecate public methods that contains 'master' in the name in 'server' directory #3647

Merged

Conversation

tlfeng
Copy link
Collaborator

@tlfeng tlfeng commented Jun 22, 2022

Description

To support inclusive language, the master terminology is going to be replaced by cluster manager in the code base.
This PR deprecate public and protected methods that contains master terminology in the name in server directory, except those covered by issue #3542 and #3543. Then alternative methods are created.

List of public methods that contain master in name that will be deprecated in this PR:

In directory - OpenSearch.server.main  (totally 28 method definitions)
public boolean hasDiscoveredMaster() {
public boolean localNodeMaster() {
public void updateMappingOnMaster(Index index, Mapping mappingUpdate, ActionListener<Void> listener) {
public boolean isBecomeMasterTask() {
public Optional<DiscoveryNode> getMasterNode() {
public PutRequest masterTimeout(TimeValue masterTimeout) {
public RemoveRequest masterTimeout(TimeValue masterTimeout) {
public static boolean isMasterNode(Settings settings) {
public boolean isMasterNode() {
public boolean isLocalNodeElectedMaster() {
public ImmutableOpenMap<String, DiscoveryNode> getMasterNodes() {
public ImmutableOpenMap<String, DiscoveryNode> getMasterAndDataNodes() {
public Stream<DiscoveryNode> mastersFirstStream() {
public String getMasterNodeId() {
public DiscoveryNode getMasterNode() {
public boolean masterNodeChanged() {
public DiscoveryNode previousMasterNode() {
public DiscoveryNode newMasterNode() {
public Builder masterNodeId(String clusterManagerNodeId) {
public boolean isLocalNodeElectedMaster() {
protected void assertClusterOrMasterStateThread() {
public void addLocalNodeMasterListener(LocalNodeMasterListener listener)
public MasterService getMasterService() (not changed in this PR)
public static boolean assertClusterOrMasterStateThread()
void connectToRemoteMasterNode(TransportAddress transportAddress, ActionListener<DiscoveryNode> listener); (in interface, and not changed in this PR)
TimeValue masterNodeTimeout() (in interface, and not changed in this PR)
public synchronized void updateFromMaster()
public ClusterState joinNodesAndBecomeMaster(ClusterState clusterState, List<DiscoveryNode> nodes)

The below test classes will not be renamed, because they are used to test the deprecated master node behavior.

public void testDoesNothingByDefaultIfMasterNodesConfigured() {
public void testDoesNotBootstrapsOnNonMasterNode() {
public void testDoesNotBootstrapsIfLocalNodeNotInInitialMasterNodes() {
public void testFailBootstrapWithBothSingleNodeDiscoveryAndInitialMasterNodes() {
public void testFailBootstrapNonMasterEligibleNodeWithSingleNodeDiscovery() {
public void testIsMasterNode() {

Other changes:

  • Changed 2 references of JoinTaskExecutor.newBecomeMasterTask() to use JoinTaskExecutor.newBecomeClusterManagerTask()

Issues Resolved

A part of #3544

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.

Tianli Feng added 7 commits June 16, 2022 21:38
Signed-off-by: Tianli Feng <ftianli@amazon.com>
Signed-off-by: Tianli Feng <ftianli@amazon.com>
Signed-off-by: Tianli Feng <ftianli@amazon.com>
Signed-off-by: Tianli Feng <ftianli@amazon.com>
Signed-off-by: Tianli Feng <ftianli@amazon.com>
Signed-off-by: Tianli Feng <ftianli@amazon.com>
Signed-off-by: Tianli Feng <ftianli@amazon.com>
@tlfeng tlfeng added enhancement Enhancement or improvement to existing feature or request deprecate v2.1.0 Issues and PRs related to version 2.1.0 v3.0.0 Issues and PRs related to version 3.0.0 backport 2.x Backport to 2.x branch labels Jun 22, 2022
@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Check success f80ce3f
Log 6212

Reports 6212

@tlfeng tlfeng added v2.2.0 and removed v2.1.0 Issues and PRs related to version 2.1.0 labels Jun 24, 2022
Tianli Feng added 6 commits June 27, 2022 20:56
Signed-off-by: Tianli Feng <ftianli@amazon.com>
Signed-off-by: Tianli Feng <ftianli@amazon.com>

# Conflicts:
#	server/src/main/java/org/opensearch/cluster/ClusterStateTaskListener.java
#	server/src/main/java/org/opensearch/cluster/action/shard/ShardStateAction.java
#	server/src/main/java/org/opensearch/cluster/service/ClusterApplierService.java
#	server/src/main/java/org/opensearch/cluster/service/ClusterManagerService.java
#	server/src/main/java/org/opensearch/cluster/service/ClusterService.java
#	server/src/test/java/org/opensearch/cluster/coordination/NodeJoinTests.java
#	server/src/test/java/org/opensearch/cluster/service/ClusterApplierServiceTests.java
#	server/src/test/java/org/opensearch/cluster/service/ClusterManagerServiceTests.java
Signed-off-by: Tianli Feng <ftianli@amazon.com>
Signed-off-by: Tianli Feng <ftianli@amazon.com>

# Conflicts:
#	server/src/main/java/org/opensearch/cluster/service/ClusterService.java
#	server/src/test/java/org/opensearch/cluster/coordination/NodeJoinTests.java
#	server/src/test/java/org/opensearch/cluster/service/MasterServiceTests.java
Signed-off-by: Tianli Feng <ftianli@amazon.com>
… JoinTaskExecutor.newBecomeClusterManagerTask()

Signed-off-by: Tianli Feng <ftianli@amazon.com>
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

Signed-off-by: Tianli Feng <ftianli@amazon.com>
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

Signed-off-by: Tianli Feng <ftianli@amazon.com>
@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 #3647 (e9b6385) into main (07775ff) will increase coverage by 0.01%.
The diff coverage is 65.72%.

@@             Coverage Diff              @@
##               main    #3647      +/-   ##
============================================
+ Coverage     70.57%   70.59%   +0.01%     
- Complexity    56679    56780     +101     
============================================
  Files          4563     4573      +10     
  Lines        272755   273307     +552     
  Branches      40040    40081      +41     
============================================
+ Hits         192505   192931     +426     
- Misses        64014    64129     +115     
- Partials      16236    16247      +11     
Impacted Files Coverage Δ
...ark/time/NanoTimeVsCurrentTimeMillisBenchmark.java 0.00% <ø> (ø)
...h/client/indices/GetComponentTemplatesRequest.java 0.00% <0.00%> (ø)
...ent/indices/GetComposableIndexTemplateRequest.java 0.00% <0.00%> (ø)
...a/org/opensearch/painless/antlr/PainlessLexer.java 68.18% <ø> (ø)
.../org/opensearch/painless/antlr/PainlessParser.java 68.43% <ø> (ø)
...n/cluster/health/TransportClusterHealthAction.java 47.75% <ø> (ø)
...settings/TransportClusterUpdateSettingsAction.java 51.72% <0.00%> (+5.17%) ⬆️
...min/cluster/state/TransportClusterStateAction.java 53.94% <0.00%> (ø)
...min/cluster/stats/TransportClusterStatsAction.java 70.83% <0.00%> (ø)
...earch/action/search/PitSearchContextIdForNode.java 0.00% <0.00%> (ø)
... and 598 more

@tlfeng tlfeng marked this pull request as ready for review July 20, 2022 01:07
@tlfeng tlfeng requested review from a team and reta as code owners July 20, 2022 01:07
…OUT"

This reverts commit e9b6385.

Signed-off-by: Tianli Feng <ftianli@amazon.com>
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@tlfeng tlfeng merged commit 1510b94 into opensearch-project:main Jul 20, 2022
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 1

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-3647-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 1510b942bc05a89928e576300119f62871e5a1fd
# Push it to GitHub
git push --set-upstream origin backport/backport-3647-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 base branch is 2.x and the compare/head branch is backport/backport-3647-to-2.x.

@tlfeng tlfeng deleted the deprecate-master-method-variable-1 branch July 20, 2022 22:28
tlfeng pushed a commit to tlfeng/OpenSearch that referenced this pull request Jul 20, 2022
…e in 'server' directory (opensearch-project#3647)

Signed-off-by: Tianli Feng <ftianli@amazon.com>
tlfeng pushed a commit that referenced this pull request Jul 21, 2022
…e in 'server' directory (#3647) (#3964)

Signed-off-by: Tianli Feng <ftianli@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Backport to 2.x branch deprecate enhancement Enhancement or improvement to existing feature or request v2.2.0 v3.0.0 Issues and PRs related to version 3.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants