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

Deprecate public methods and variables that contain 'master' terminology in 'test/framework' directory #3978

Merged
merged 5 commits into from
Jul 22, 2022

Conversation

tlfeng
Copy link
Collaborator

@tlfeng tlfeng commented Jul 21, 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/variable that contains master terminology in the name in test/framework directory, and create alternatives.

List of public methods in test/framework directory that renamed in this PR:

public static String blockMasterFromFinalizingSnapshotOnIndexFile(final String repositoryName) {
public static String blockMasterOnWriteIndexFile(final String repositoryName) {
public static void blockMasterFromDeletingIndexNFile(String repositoryName) {
public static String blockMasterFromFinalizingSnapshotOnSnapFile(final String repositoryName) {
public Client masterClient() {
public Client nonMasterClient() {
public boolean isMasterEligible() {
public synchronized <T> T getCurrentMasterNodeInstance(Class<T> clazz) {
public <T> Iterable<T> getDataOrMasterNodeInstances(Class<T> clazz) {
public <T> T getMasterNodeInstance(Class<T> clazz) {
public synchronized void stopCurrentMasterNode() throws IOException {
public synchronized void stopRandomNonMasterNode() throws IOException {
public String getMasterName() {
public String getMasterName(@Nullable String viaNode) {
public List<String> startMasterOnlyNodes(int numNodes) {
public List<String> startMasterOnlyNodes(int numNodes, Settings settings) {
public int numMasterNodes() {
public static Settings masterNode()
public static Settings masterNode(final Settings settings)
public static Settings masterOnlyNode()
public static Settings masterOnlyNode(final Settings settings)
public static Settings nonMasterNode()
public static Settings nonMasterNode(final Settings settings)
public Version masterVersion()

List of public variables in test/framework directory that renamed in this PR:
(all in org.opensearch.test.InternalTestCluster)

public static final int DEFAULT_LOW_NUM_MASTER_NODES
public static final int DEFAULT_HIGH_NUM_MASTER_NODES
public static final int REMOVED_MINIMUM_MASTER_NODES

public that not renamed in this PR:

public static MasterService createMasterService(ThreadPool threadPool, ClusterState initialClusterState)
public static MasterService createMasterService(ThreadPool threadPool, DiscoveryNode localNode)
public abstract int numDataAndMasterNodes();

Reason for the above are not deprecated and renamed:

  1. The class MasterService is not deprecated, and needs to find a solution to deal with deprecating this class in the return value.
  2. abstract methods will be deprecated in a separate PR.

Issues Resolved

A part of issue #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 4 commits July 21, 2022 14:32
Signed-off-by: Tianli Feng <ftianli@amazon.com>
Signed-off-by: Tianli Feng <ftianli@amazon.com>
Signed-off-by: Tianli Feng <ftianli@amazon.com>
…Node

Signed-off-by: Tianli Feng <ftianli@amazon.com>
@tlfeng tlfeng requested review from a team and reta as code owners July 21, 2022 23:54
@tlfeng tlfeng marked this pull request as draft July 21, 2022 23:54
@tlfeng tlfeng added enhancement Enhancement or improvement to existing feature or request deprecate v3.0.0 Issues and PRs related to version 3.0.0 backport 2.x Backport to 2.x branch v2.2.0 labels Jul 21, 2022
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

…tCluster

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

Gradle Check (Jenkins) Run Completed with:

@tlfeng
Copy link
Collaborator Author

tlfeng commented Jul 22, 2022

In build 901:

REPRODUCE WITH: ./gradlew ':server:test' --tests "org.opensearch.indices.replication.SegmentReplicationTargetServiceTests.testReplicationOnDone" -Dtests.seed=4F4E8AB47EE2BD5 -Dtests.security.manager=true -Dtests.jvm.argline="-XX:TieredStopAtLevel=1 -XX:ReservedCodeCacheSize=64m" -Dtests.locale=sr -Dtests.timezone=Cuba -Druntime.java=17

org.opensearch.indices.replication.SegmentReplicationTargetServiceTests > testReplicationOnDone FAILED
    org.mockito.exceptions.verification.TooFewActualInvocations: 
    segmentReplicationTargetService.onNewCheckpoint(
        ReplicationCheckpoint{shardId=[index][0], primaryTerm=54, segmentsGen=3, seqNo=-1, version=9},
        <any>
    );
    Wanted 2 times:
    -> at org.opensearch.indices.replication.SegmentReplicationTargetServiceTests.testReplicationOnDone(SegmentReplicationTargetServiceTests.java:236)
    But was 1 time:
    -> at org.opensearch.indices.replication.SegmentReplicationTargetServiceTests.testReplicationOnDone(SegmentReplicationTargetServiceTests.java:230)
        at __randomizedtesting.SeedInfo.seed([4F4E8AB47EE2BD5:1E3A38668D12C477]:0)
        at app//org.opensearch.indices.replication.SegmentReplicationTargetServiceTests.testReplicationOnDone(SegmentReplicationTargetServiceTests.java:236)
> Task :server:test

REPRODUCE WITH: ./gradlew ':server:test' --tests "org.opensearch.search.CreatePitMultiNodeTests.testCreatePitWhileNodeDropWithAllowPartialCreationFalse" -Dtests.seed=4F4E8AB47EE2BD5 -Dtests.security.manager=true -Dtests.jvm.argline="-XX:TieredStopAtLevel=1 -XX:ReservedCodeCacheSize=64m" -Dtests.locale=es-DO -Dtests.timezone=Asia/Aden -Druntime.java=17

org.opensearch.search.CreatePitMultiNodeTests > testCreatePitWhileNodeDropWithAllowPartialCreationFalse FAILED
    java.lang.AssertionError
        at __randomizedtesting.SeedInfo.seed([4F4E8AB47EE2BD5:9F63A7CD07EDAF64]:0)
        at org.junit.Assert.fail(Assert.java:87)
        at org.junit.Assert.assertTrue(Assert.java:42)
        at org.junit.Assert.assertTrue(Assert.java:53)
        at org.opensearch.search.CreatePitMultiNodeTests$1.onNodeStopped(CreatePitMultiNodeTests.java:70)
        at org.opensearch.test.InternalTestCluster$NodeAndClient.closeForRestart(InternalTestCluster.java:1028)
        at org.opensearch.test.InternalTestCluster.restartNode(InternalTestCluster.java:1931)
        at org.opensearch.test.InternalTestCluster.restartRandomDataNode(InternalTestCluster.java:1879)
        at org.opensearch.search.CreatePitMultiNodeTests.testCreatePitWhileNodeDropWithAllowPartialCreationFalse(CreatePitMultiNodeTests.java:64)

Not reproducible locally.

@tlfeng tlfeng marked this pull request as ready for review July 22, 2022 06:17
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@codecov-commenter
Copy link

Codecov Report

Merging #3978 (b00b5d0) into main (b08a2b8) will increase coverage by 0.02%.
The diff coverage is 29.76%.

@@             Coverage Diff              @@
##               main    #3978      +/-   ##
============================================
+ Coverage     70.56%   70.58%   +0.02%     
+ Complexity    56780    56774       -6     
============================================
  Files          4573     4573              
  Lines        273323   273360      +37     
  Branches      40086    40086              
============================================
+ Hits         192859   192962     +103     
+ Misses        64239    64150      -89     
- Partials      16225    16248      +23     
Impacted Files Coverage Δ
...arch/repositories/blobstore/BlobStoreTestUtil.java 76.21% <0.00%> (ø)
...earch/snapshots/AbstractSnapshotIntegTestCase.java 0.00% <0.00%> (ø)
...a/org/opensearch/test/OpenSearchIntegTestCase.java 58.22% <0.00%> (+1.22%) ⬆️
...ch/test/disruption/BlockMasterServiceOnMaster.java 0.00% <0.00%> (ø)
...h/test/disruption/BusyMasterServiceDisruption.java 0.00% <0.00%> (ø)
...pensearch/test/rest/yaml/ClientYamlTestClient.java 0.00% <0.00%> (ø)
...test/rest/yaml/ClientYamlTestExecutionContext.java 30.55% <0.00%> (-0.44%) ⬇️
...k/src/main/java/org/opensearch/test/NodeRoles.java 75.38% <33.33%> (-7.67%) ⬇️
.../java/org/opensearch/test/InternalTestCluster.java 60.89% <36.36%> (-1.59%) ⬇️
...re/OpenSearchBlobStoreRepositoryIntegTestCase.java 91.36% <100.00%> (+2.69%) ⬆️
... and 506 more

Help us with your feedback. Take ten seconds to tell us how you rate us.

@tlfeng
Copy link
Collaborator Author

tlfeng commented Jul 22, 2022

@kotwanikunal Thank you so much for reviewing this large PR! 👍👍

@tlfeng tlfeng merged commit 5db75c1 into opensearch-project:main Jul 22, 2022
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jul 22, 2022
…ogy in 'test/framework' directory (#3978)

* Deprecate methods with 'master' name mainly in class 'InternalTestCluster', 'NodeRoles', and 'AbstractSnapshotIntegTestCase'

* Deprecate variables contain 'master' in the name in class 'InternalTestCluster'

Signed-off-by: Tianli Feng <ftianli@amazon.com>
(cherry picked from commit 5db75c1)
tlfeng pushed a commit that referenced this pull request Jul 22, 2022
…ogy in 'test/framework' directory (#3978) (#3987)

* Deprecate methods with 'master' name mainly in class 'InternalTestCluster', 'NodeRoles', and 'AbstractSnapshotIntegTestCase'

* Deprecate variables contain 'master' in the name in class 'InternalTestCluster'

Signed-off-by: Tianli Feng <ftianli@amazon.com>
(cherry picked from commit 5db75c1)

Co-authored-by: Tianli Feng <ftianli@amazon.com>

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/variable that contains `master` terminology in the name in `test/framework` directory, and create alternatives.

List of public methods in `test/framework` directory that renamed in this PR:
```
public static String blockMasterFromFinalizingSnapshotOnIndexFile(final String repositoryName) {
public static String blockMasterOnWriteIndexFile(final String repositoryName) {
public static void blockMasterFromDeletingIndexNFile(String repositoryName) {
public static String blockMasterFromFinalizingSnapshotOnSnapFile(final String repositoryName) {
public Client masterClient() {
public Client nonMasterClient() {
public boolean isMasterEligible() {
public synchronized <T> T getCurrentMasterNodeInstance(Class<T> clazz) {
public <T> Iterable<T> getDataOrMasterNodeInstances(Class<T> clazz) {
public <T> T getMasterNodeInstance(Class<T> clazz) {
public synchronized void stopCurrentMasterNode() throws IOException {
public synchronized void stopRandomNonMasterNode() throws IOException {
public String getMasterName() {
public String getMasterName(@nullable String viaNode) {
public List<String> startMasterOnlyNodes(int numNodes) {
public List<String> startMasterOnlyNodes(int numNodes, Settings settings) {
public int numMasterNodes() {
public static Settings masterNode()
public static Settings masterNode(final Settings settings)
public static Settings masterOnlyNode()
public static Settings masterOnlyNode(final Settings settings)
public static Settings nonMasterNode()
public static Settings nonMasterNode(final Settings settings)
public Version masterVersion()
```

List of public variables in `test/framework` directory that renamed in this PR:
(all in `org.opensearch.test.InternalTestCluster`)
```
public static final int DEFAULT_LOW_NUM_MASTER_NODES
public static final int DEFAULT_HIGH_NUM_MASTER_NODES
public static final int REMOVED_MINIMUM_MASTER_NODES
```
 
public that not renamed in this PR:
```
public static MasterService createMasterService(ThreadPool threadPool, ClusterState initialClusterState)
public static MasterService createMasterService(ThreadPool threadPool, DiscoveryNode localNode)
public abstract int numDataAndMasterNodes();
```
Reason for the above are not deprecated and renamed:
1. The class `MasterService` is not deprecated, and needs to find a solution to deal with deprecating this class in the return value.
2. abstract methods will be deprecated in a separate PR.
@tlfeng tlfeng deleted the deprecate-master-method-test branch August 4, 2022 05:57
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.

3 participants