Skip to content

Commit

Permalink
Deprecate public class names with master terminology
Browse files Browse the repository at this point in the history
Signed-off-by: Tianli Feng <[email protected]>
  • Loading branch information
Tianli Feng committed Jul 12, 2022
1 parent a7e113a commit d506fc7
Show file tree
Hide file tree
Showing 14 changed files with 557 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ public void onNoLongerMaster(String source) {
"stopped being cluster-manager while waiting for events with priority [{}]. retrying.",
request.waitForEvents()
);
// TransportClusterManagerNodeAction implements the retry logic, which is triggered by passing a
// NotClusterManagerException
// TransportClusterManagerNodeAction implements the retry logic,
// which is triggered by passing a NotClusterManagerException
listener.onFailure(new NotClusterManagerException("no longer cluster-manager. source: [" + source + "]"));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,13 @@
*
* @opensearch.internal
*/
public final class ClusterManagerNodeChangePredicate {
// 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.
public class ClusterManagerNodeChangePredicate {

private ClusterManagerNodeChangePredicate() {
ClusterManagerNodeChangePredicate() {

}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

/*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

package org.opensearch.cluster;

/**
* Enables listening to cluster-manager changes events of the local node (when the local node becomes the cluster-manager, and when the local
* node cease being a cluster-manager).
*
* @opensearch.internal
* @deprecated As of 2.2, because supporting inclusive language, replaced by {@link LocalNodeClusterManagerListener}
*/
@Deprecated
public interface LocalNodeMasterListener extends LocalNodeClusterManagerListener {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

/*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

package org.opensearch.cluster;

/**
* Utility class to build a predicate that accepts cluster state changes
*
* @opensearch.internal
* @deprecated As of 2.2, because supporting inclusive language, replaced by {@link ClusterManagerNodeChangePredicate}
*/
@Deprecated
public final class MasterNodeChangePredicate extends ClusterManagerNodeChangePredicate {

private MasterNodeChangePredicate() {

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

/*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

package org.opensearch.cluster;

import org.opensearch.common.io.stream.StreamInput;

import java.io.IOException;

/**
* Thrown when a node join request or a cluster-manager ping reaches a node which is not
* currently acting as a cluster-manager or when a cluster state update task is to be executed
* on a node that is no longer cluster-manager.
*
* @opensearch.internal
* @deprecated As of 2.2, because supporting inclusive language, replaced by {@link NotClusterManagerException}
*/
@Deprecated
public class NotMasterException extends NotClusterManagerException {

public NotMasterException(String msg) {
super(msg);
}

public NotMasterException(StreamInput in) throws IOException {
super(in);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

/*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

package org.opensearch.cluster.coordination;

import org.opensearch.common.settings.ClusterSettings;
import org.opensearch.common.settings.Settings;

/**
* Service to block the master node
*
* @opensearch.internal
* @deprecated As of 2.2, because supporting inclusive language, replaced by {@link NoClusterManagerBlockService}
*/
@Deprecated
public class NoMasterBlockService extends NoClusterManagerBlockService {

public NoMasterBlockService(Settings settings, ClusterSettings clusterSettings) {
super(settings, clusterSettings);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

/*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

package org.opensearch.cluster.coordination;

/**
* Tool to run an unsafe bootstrap
*
* @opensearch.internal
* @deprecated As of 2.2, because supporting inclusive language, replaced by {@link UnsafeBootstrapClusterManagerCommand}
*/
@Deprecated
public class UnsafeBootstrapMasterCommand extends UnsafeBootstrapClusterManagerCommand {

UnsafeBootstrapMasterCommand() {
super();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

/*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

package org.opensearch.cluster.service;

import org.opensearch.common.settings.ClusterSettings;
import org.opensearch.common.settings.Settings;
import org.opensearch.threadpool.ThreadPool;

/**
* Main Master Node Service
*
* @opensearch.internal
* @deprecated As of 2.1, because supporting inclusive language, replaced by {@link ClusterManagerService}
*/
@Deprecated
public class MasterService extends ClusterManagerService {

public MasterService(Settings settings, ClusterSettings clusterSettings, ThreadPool threadPool) {
super(settings, clusterSettings, threadPool);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import org.apache.logging.log4j.Logger;
import org.opensearch.cluster.ClusterState;
import org.opensearch.cluster.ClusterStateUpdateTask;
import org.opensearch.cluster.LocalNodeClusterManagerListener;
import org.opensearch.cluster.LocalNodeMasterListener;
import org.opensearch.cluster.metadata.Metadata;
import org.opensearch.cluster.service.ClusterService;
import org.opensearch.common.Priority;
Expand Down Expand Up @@ -88,10 +88,10 @@ public ConsistentSettingsService(Settings settings, ClusterService clusterServic
}

/**
* Returns a {@link LocalNodeClusterManagerListener} that will publish hashes of all the settings passed in the constructor. These hashes are
* Returns a {@link LocalNodeMasterListener} that will publish hashes of all the settings passed in the constructor. These hashes are
* published by the cluster-manager node only. Note that this is not designed for {@link SecureSettings} implementations that are mutable.
*/
public LocalNodeClusterManagerListener newHashPublisher() {
public LocalNodeMasterListener newHashPublisher() {
// eagerly compute hashes to be published
final Map<String, String> computedHashesOfConsistentSettings = computeHashesOfConsistentSecureSettings();
return new HashesPublisher(computedHashesOfConsistentSettings, clusterService);
Expand Down Expand Up @@ -246,7 +246,7 @@ private byte[] computeSaltedPBKDF2Hash(byte[] bytes, byte[] salt) {
}
}

static final class HashesPublisher implements LocalNodeClusterManagerListener {
static final class HashesPublisher implements LocalNodeMasterListener {

// eagerly compute hashes to be published
final Map<String, String> computedHashesOfConsistentSettings;
Expand Down
Loading

0 comments on commit d506fc7

Please sign in to comment.