Description
Is your feature request related to a problem? Please describe.
A part of issue #1684.
To support inclusive language, the master
terminology is going to be replaced by cluster manager
in the code base.
The goal for this issue is:
- Deprecate the public/protected methods and variables that have "master" in the names. The involved methods and variables are located in
server
,client/rest
,client/rest-high-level
andtest/framework
directories, and the deprecated items will be removed in the next major version (3.0) - Have alternative methods and variables aside, which replaced the non-inclusive name "master" and have the same functionality with the deprecated items.
Describe the solution you'd like
For overall solution to replace "master" in public Java APIs: #1684 (comment)
Key points:
- Any public/protected method or variable with "master" in the name will directly call the renamed method to maintain only one method/variable while supporting the old ones.
In detail:
- Copy the code of method/variable definition and keep it in another place.
- Replace
master
word withclusterManager
in the method or variable name. This is done by the Rename refactoring feature of IntelliJ IDEA, so that both the definition and reference can be renamed. - Paste the original code of
master
method/vairable definition back. - Remove all the existing implementation in the old method, and directly call the new renamed method with the same parameters.
- Add
@Deprecated
annotation and@deprecated
Javadoc tag for the method/variable that contains "master" in the name. - Backport all the changes to 2.x branch.
Describe alternatives you've considered
None.
Additional context
The regex to filter the lines with public or protected method/variable definition contains "master" terminology:
method: (public|protected)(.)+[Mm]aster(\w)*\(
variable: (public|protected)(.)+(MASTER|master)(.)*=
Totally 195 methods and 21 variables.
The above number need excluding:
- There are 15 method definitions and 7 variables that are covered by issue Deprecate package 'org.opensearch.action.support.master' #3542 and Deprecate public or protected class that contains "master" terminology in 'server' and 'test/framework' directory #3543.
- 75
masterOperation()
overrides which will be resolved by Deprecate package 'org.opensearch.action.support.master' #3542
List of public methods to be renamed:
in sever
directory:
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)
TimeValue masterNodeTimeout()
public synchronized void updateFromMaster()
public ClusterState joinNodesAndBecomeMaster(ClusterState clusterState, List<DiscoveryNode> nodes)
In client
directory:
public void setMasterTimeout(TimeValue clusterManagerTimeout)
public TimeValue masterNodeTimeout()
public TimeValue getMasterNodeTimeout()
public void setMasterNodeTimeout(@Nullable TimeValue clusterManagerNodeTimeout)
public void setMasterNodeTimeout(String clusterManagerNodeTimeout)
public boolean isMasterEligible()
In test/framework
directory:
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 static MasterService createMasterService(ThreadPool threadPool, ClusterState initialClusterState) {
public static MasterService createMasterService(ThreadPool threadPool, DiscoveryNode localNode) {
public abstract int numDataAndMasterNodes();
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 to be renamed:
In client
directory:
public static final TimeValue DEFAULT_MASTER_NODE_TIMEOUT
In test/framework
directory:
(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