[Javadocs] add to o.o.cluster (#3170)
Adds javadocs to classes in the o.o.cluster package. Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
This commit is contained in:
parent
c76a4c9014
commit
40024fcf71
|
@ -41,6 +41,8 @@ import java.io.IOException;
|
|||
/**
|
||||
* Abstract diffable object with simple diffs implementation that sends the entire object if object has changed or
|
||||
* nothing if object remained the same.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public abstract class AbstractDiffable<T extends Diffable<T>> implements Diffable<T> {
|
||||
|
||||
|
|
|
@ -43,6 +43,8 @@ import java.io.IOException;
|
|||
/**
|
||||
* Abstract diffable object with simple diffs implementation that sends the entire object if object has changed or
|
||||
* nothing is object remained the same. Comparing to AbstractDiffable, this class also works with NamedWriteables
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public abstract class AbstractNamedDiffable<T extends NamedDiffable<T>> implements Diffable<T>, NamedWriteable {
|
||||
|
||||
|
|
|
@ -35,6 +35,11 @@ import org.opensearch.cluster.node.DiscoveryNode;
|
|||
import org.opensearch.common.Nullable;
|
||||
import org.opensearch.common.unit.TimeValue;
|
||||
|
||||
/**
|
||||
* Listener when cluster state task is acknowledged
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public interface AckedClusterStateTaskListener extends ClusterStateTaskListener {
|
||||
|
||||
/**
|
||||
|
|
|
@ -41,6 +41,8 @@ import org.opensearch.common.unit.TimeValue;
|
|||
/**
|
||||
* An extension interface to {@link ClusterStateUpdateTask} that allows to be notified when
|
||||
* all the nodes have acknowledged a cluster state update request
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public abstract class AckedClusterStateUpdateTask<Response> extends ClusterStateUpdateTask implements AckedClusterStateTaskListener {
|
||||
|
||||
|
|
|
@ -53,6 +53,8 @@ import java.util.stream.Collectors;
|
|||
|
||||
/**
|
||||
* An event received by the local node, signaling that the cluster state has changed.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class ClusterChangedEvent {
|
||||
|
||||
|
|
|
@ -55,6 +55,8 @@ import java.util.Objects;
|
|||
* and a map of shard ids to shard sizes, see
|
||||
* <code>InternalClusterInfoService.shardIdentifierFromRouting(String)</code>
|
||||
* for the key used in the shardSizes map
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class ClusterInfo implements ToXContentFragment, Writeable {
|
||||
private final ImmutableOpenMap<String, DiskUsage> leastAvailableSpaceUsage;
|
||||
|
|
|
@ -36,6 +36,8 @@ import java.util.function.Consumer;
|
|||
|
||||
/**
|
||||
* Interface for a class used to gather information about a cluster periodically.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface ClusterInfoService {
|
||||
|
|
|
@ -110,6 +110,8 @@ import java.util.function.Supplier;
|
|||
|
||||
/**
|
||||
* Configures classes and services that affect the entire cluster.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class ClusterModule extends AbstractModule {
|
||||
|
||||
|
|
|
@ -42,6 +42,11 @@ import java.io.IOException;
|
|||
import java.util.Objects;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
/**
|
||||
* Cluster Name
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class ClusterName implements Writeable {
|
||||
|
||||
public static final Setting<ClusterName> CLUSTER_NAME_SETTING = new Setting<>("cluster.name", "opensearch", (s) -> {
|
||||
|
|
|
@ -97,6 +97,8 @@ import static org.opensearch.cluster.coordination.Coordinator.ZEN1_BWC_TERM;
|
|||
* make sure that the correct diffs are applied. If uuids don’t match, the {@link ClusterStateDiff#apply} method
|
||||
* throws the {@link IncompatibleClusterStateVersionException}, which causes the publishing mechanism to send
|
||||
* a full version of the cluster state to the node on which this exception was thrown.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class ClusterState implements ToXContentFragment, Diffable<ClusterState> {
|
||||
|
||||
|
|
|
@ -37,6 +37,8 @@ import org.opensearch.cluster.service.ClusterService;
|
|||
/**
|
||||
* A component that is in charge of applying an incoming cluster state to the node internal data structures.
|
||||
* The single apply method is called before the cluster state becomes visible via {@link ClusterService#state()}.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public interface ClusterStateApplier {
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ package org.opensearch.cluster;
|
|||
/**
|
||||
* A listener to be notified when a cluster state changes.
|
||||
*
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public interface ClusterStateListener {
|
||||
|
||||
|
|
|
@ -50,6 +50,8 @@ import java.util.function.Supplier;
|
|||
* A utility class which simplifies interacting with the cluster state in cases where
|
||||
* one tries to take action based on the current state but may want to wait for a new state
|
||||
* and retry upon failure.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class ClusterStateObserver {
|
||||
|
||||
|
|
|
@ -37,6 +37,8 @@ import org.opensearch.common.unit.TimeValue;
|
|||
|
||||
/**
|
||||
* Cluster state update task configuration for timeout and priority
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public interface ClusterStateTaskConfig {
|
||||
/**
|
||||
|
|
|
@ -37,6 +37,11 @@ import java.util.IdentityHashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Interface that updates the cluster state based on the task
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public interface ClusterStateTaskExecutor<T> {
|
||||
/**
|
||||
* Update the cluster state based on the current state and the given tasks. Return the *same instance* if no state
|
||||
|
|
|
@ -35,6 +35,11 @@ import org.opensearch.cluster.service.MasterService;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Interface to implement a cluster state change listener
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public interface ClusterStateTaskListener {
|
||||
|
||||
/**
|
||||
|
|
|
@ -40,6 +40,8 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* A task that can update the cluster state.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public abstract class ClusterStateUpdateTask
|
||||
implements
|
||||
|
|
|
@ -36,6 +36,8 @@ import org.opensearch.common.io.stream.Writeable;
|
|||
|
||||
/**
|
||||
* Represents difference between states of cluster state parts
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public interface Diff<T> extends Writeable {
|
||||
|
||||
|
|
|
@ -36,6 +36,8 @@ import org.opensearch.common.io.stream.Writeable;
|
|||
|
||||
/**
|
||||
* Cluster state part, changes in which can be serialized
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public interface Diffable<T> extends Writeable {
|
||||
|
||||
|
|
|
@ -53,6 +53,11 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Utility class for a diffable
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public final class DiffableUtils {
|
||||
private DiffableUtils() {}
|
||||
|
||||
|
|
|
@ -45,6 +45,8 @@ import java.util.Objects;
|
|||
|
||||
/**
|
||||
* Encapsulation class used to represent the amount of disk used on a node.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class DiskUsage implements ToXContentFragment, Writeable {
|
||||
final String nodeId;
|
||||
|
|
|
@ -36,6 +36,8 @@ import java.util.function.Consumer;
|
|||
|
||||
/**
|
||||
* {@link ClusterInfoService} that provides empty maps for disk usage and shard sizes
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class EmptyClusterInfoService implements ClusterInfoService {
|
||||
public static final EmptyClusterInfoService INSTANCE = new EmptyClusterInfoService();
|
||||
|
|
|
@ -39,6 +39,8 @@ import java.io.IOException;
|
|||
|
||||
/**
|
||||
* Thrown by {@link Diff#apply} method
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class IncompatibleClusterStateVersionException extends OpenSearchException {
|
||||
public IncompatibleClusterStateVersionException(String msg) {
|
||||
|
|
|
@ -83,6 +83,8 @@ import java.util.function.Consumer;
|
|||
*
|
||||
* Every time the timer runs, gathers information about the disk usage and
|
||||
* shard sizes across the cluster.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class InternalClusterInfoService implements ClusterInfoService, ClusterStateListener {
|
||||
|
||||
|
|
|
@ -39,6 +39,8 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* Used to apply state updates on nodes that are not necessarily cluster-manager
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public abstract class LocalClusterUpdateTask
|
||||
implements
|
||||
|
|
|
@ -34,6 +34,8 @@ 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
|
||||
*/
|
||||
public interface LocalNodeMasterListener extends ClusterStateListener {
|
||||
|
||||
|
|
|
@ -36,6 +36,11 @@ import org.opensearch.cluster.node.DiscoveryNode;
|
|||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
/**
|
||||
* Utility class to build a predicate that accepts cluster state changes
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public final class MasterNodeChangePredicate {
|
||||
|
||||
private MasterNodeChangePredicate() {
|
||||
|
|
|
@ -40,6 +40,8 @@ import org.opensearch.cluster.metadata.Metadata;
|
|||
* Custom metadata can be merged using {@link #merge(Metadata.Custom)}.
|
||||
*
|
||||
* @param <T> type of custom meta data
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public interface MergableCustomMetadata<T extends Metadata.Custom> {
|
||||
|
||||
|
|
|
@ -37,6 +37,8 @@ import org.opensearch.common.io.stream.NamedWriteable;
|
|||
|
||||
/**
|
||||
* Diff that also support NamedWriteable interface
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public interface NamedDiff<T extends Diffable<T>> extends Diff<T>, NamedWriteable {
|
||||
/**
|
||||
|
|
|
@ -36,5 +36,7 @@ import org.opensearch.common.io.stream.VersionedNamedWriteable;
|
|||
|
||||
/**
|
||||
* Diff that also support {@link VersionedNamedWriteable} interface
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public interface NamedDiffable<T> extends Diffable<T>, VersionedNamedWriteable {}
|
||||
|
|
|
@ -39,6 +39,8 @@ import java.io.IOException;
|
|||
|
||||
/**
|
||||
* Value Serializer for named diffables
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class NamedDiffableValueSerializer<T extends NamedDiffable<T>> extends DiffableUtils.DiffableValueSerializer<String, T> {
|
||||
|
||||
|
|
|
@ -80,6 +80,8 @@ import static org.opensearch.common.settings.Setting.positiveTimeSetting;
|
|||
* <p>
|
||||
* This component does not block on disconnections at all, because a disconnection might need to wait for an ongoing (background) connection
|
||||
* attempt to complete first.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class NodeConnectionsService extends AbstractLifecycleComponent {
|
||||
private static final Logger logger = LogManager.getLogger(NodeConnectionsService.class);
|
||||
|
|
|
@ -40,6 +40,8 @@ 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
|
||||
*/
|
||||
public class NotMasterException extends OpenSearchException {
|
||||
|
||||
|
|
|
@ -45,6 +45,11 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Information passed during repository cleanup
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public final class RepositoryCleanupInProgress extends AbstractNamedDiffable<ClusterState.Custom> implements ClusterState.Custom {
|
||||
|
||||
public static final RepositoryCleanupInProgress EMPTY = new RepositoryCleanupInProgress(Collections.emptyList());
|
||||
|
|
|
@ -54,6 +54,8 @@ import java.util.UUID;
|
|||
|
||||
/**
|
||||
* Meta data about restore processes that are currently executing
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class RestoreInProgress extends AbstractNamedDiffable<Custom> implements Custom, Iterable<RestoreInProgress.Entry> {
|
||||
|
||||
|
|
|
@ -57,6 +57,8 @@ import java.util.Set;
|
|||
|
||||
/**
|
||||
* A class that represents the snapshot deletions that are in progress in the cluster.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class SnapshotDeletionsInProgress extends AbstractNamedDiffable<Custom> implements Custom {
|
||||
|
||||
|
|
|
@ -71,6 +71,8 @@ import static org.opensearch.snapshots.SnapshotInfo.METADATA_FIELD_INTRODUCED;
|
|||
|
||||
/**
|
||||
* Meta data about snapshots that are currently executing
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class SnapshotsInProgress extends AbstractNamedDiffable<Custom> implements Custom {
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.opensearch.common.unit.TimeValue;
|
|||
/**
|
||||
* An exception to cluster state listener that allows for timeouts and for post added notifications.
|
||||
*
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public interface TimeoutClusterStateListener extends ClusterStateListener {
|
||||
|
||||
|
|
|
@ -36,6 +36,8 @@ import org.opensearch.common.unit.TimeValue;
|
|||
|
||||
/**
|
||||
* Identifies a cluster state update request with acknowledgement support
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public interface AckedRequest {
|
||||
|
||||
|
|
|
@ -37,6 +37,8 @@ import org.opensearch.common.unit.TimeValue;
|
|||
/**
|
||||
* Base class to be used when needing to update the cluster state
|
||||
* Contains the basic fields that are always needed
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public abstract class ClusterStateUpdateRequest<T extends ClusterStateUpdateRequest<T>> implements AckedRequest {
|
||||
|
||||
|
|
|
@ -34,6 +34,8 @@ package org.opensearch.cluster.ack;
|
|||
|
||||
/**
|
||||
* Base response returned after a cluster state update
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class ClusterStateUpdateResponse {
|
||||
|
||||
|
|
|
@ -34,6 +34,8 @@ package org.opensearch.cluster.ack;
|
|||
|
||||
/**
|
||||
* A cluster state update response with specific fields for index creation.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class CreateIndexClusterStateUpdateResponse extends ClusterStateUpdateResponse {
|
||||
|
||||
|
|
|
@ -35,6 +35,8 @@ import org.opensearch.index.Index;
|
|||
|
||||
/**
|
||||
* Base cluster state update request that allows to execute update against multiple indices
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public abstract class IndicesClusterStateUpdateRequest<T extends IndicesClusterStateUpdateRequest<T>> extends ClusterStateUpdateRequest<T> {
|
||||
|
||||
|
|
|
@ -33,6 +33,8 @@ package org.opensearch.cluster.ack;
|
|||
|
||||
/**
|
||||
* A cluster state update response with specific fields for index opening.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class OpenIndexClusterStateUpdateResponse extends ClusterStateUpdateResponse {
|
||||
|
||||
|
|
|
@ -58,6 +58,8 @@ import java.util.concurrent.Semaphore;
|
|||
/**
|
||||
* Called by shards in the cluster when their mapping was dynamically updated and it needs to be updated
|
||||
* in the cluster state meta data (and broadcast to all members).
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class MappingUpdatedAction {
|
||||
|
||||
|
|
|
@ -53,6 +53,11 @@ import org.opensearch.transport.TransportService;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Transport action for refreshing the Node Mapping
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class NodeMappingRefreshAction {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(NodeMappingRefreshAction.class);
|
||||
|
|
|
@ -87,6 +87,11 @@ import java.util.Set;
|
|||
import java.util.function.Predicate;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* Transport action for retrieving the shard state
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class ShardStateAction {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(ShardStateAction.class);
|
||||
|
|
|
@ -45,6 +45,11 @@ import java.util.EnumSet;
|
|||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Blocks the cluster for concurrency
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class ClusterBlock implements Writeable, ToXContentFragment {
|
||||
|
||||
private final int id;
|
||||
|
|
|
@ -46,6 +46,11 @@ import java.util.stream.Collectors;
|
|||
|
||||
import static java.util.Collections.unmodifiableSet;
|
||||
|
||||
/**
|
||||
* Internal exception on obtaining a cluster block
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class ClusterBlockException extends OpenSearchException {
|
||||
private final Set<ClusterBlock> blocks;
|
||||
|
||||
|
|
|
@ -34,6 +34,11 @@ package org.opensearch.cluster.block;
|
|||
|
||||
import java.util.EnumSet;
|
||||
|
||||
/**
|
||||
* What level to block the cluster
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public enum ClusterBlockLevel {
|
||||
READ,
|
||||
WRITE,
|
||||
|
|
|
@ -59,6 +59,8 @@ import static java.util.stream.Collectors.toSet;
|
|||
|
||||
/**
|
||||
* Represents current cluster level blocks to block dirty operations done against the cluster.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class ClusterBlocks extends AbstractDiffable<ClusterBlocks> {
|
||||
public static final ClusterBlocks EMPTY_CLUSTER_BLOCK = new ClusterBlocks(emptySet(), ImmutableOpenMap.of());
|
||||
|
|
|
@ -41,6 +41,8 @@ import java.io.IOException;
|
|||
* A cluster-manager node sends this request to its peers to inform them that it could commit the
|
||||
* cluster state with the given term and version. Peers that have accepted the given cluster
|
||||
* state will then consider it as committed and proceed to apply the state locally.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class ApplyCommitRequest extends TermVersionRequest {
|
||||
|
||||
|
|
|
@ -69,6 +69,11 @@ import static org.opensearch.discovery.DiscoveryModule.LEGACY_DISCOVERY_HOSTS_PR
|
|||
import static org.opensearch.discovery.SettingsBasedSeedHostsProvider.DISCOVERY_SEED_HOSTS_SETTING;
|
||||
import static org.opensearch.discovery.SettingsBasedSeedHostsProvider.LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING;
|
||||
|
||||
/**
|
||||
* Service for bootstrapping the OpenSearch cluster
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class ClusterBootstrapService {
|
||||
|
||||
public static final Setting<List<String>> INITIAL_MASTER_NODES_SETTING = Setting.listSetting(
|
||||
|
|
|
@ -59,6 +59,11 @@ import java.util.stream.StreamSupport;
|
|||
import static org.opensearch.cluster.coordination.ClusterBootstrapService.INITIAL_CLUSTER_MANAGER_NODES_SETTING;
|
||||
import static org.opensearch.monitor.StatusInfo.Status.UNHEALTHY;
|
||||
|
||||
/**
|
||||
* Helper for cluster failure events
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class ClusterFormationFailureHelper {
|
||||
private static final Logger logger = LogManager.getLogger(ClusterFormationFailureHelper.class);
|
||||
|
||||
|
|
|
@ -37,6 +37,11 @@ import org.opensearch.cluster.node.DiscoveryNode;
|
|||
import org.opensearch.common.Nullable;
|
||||
import org.opensearch.common.unit.TimeValue;
|
||||
|
||||
/**
|
||||
* Publishes the cluster state
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public interface ClusterStatePublisher {
|
||||
/**
|
||||
* Publish all the changes to the cluster from the cluster-manager (can be called just by the cluster-manager). The publish
|
||||
|
|
|
@ -52,6 +52,11 @@ import java.util.Objects;
|
|||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Metadata for cluster coordination
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class CoordinationMetadata implements Writeable, ToXContentFragment {
|
||||
|
||||
public static final CoordinationMetadata EMPTY_METADATA = builder().build();
|
||||
|
|
|
@ -53,6 +53,8 @@ import static org.opensearch.cluster.coordination.Coordinator.ZEN1_BWC_TERM;
|
|||
/**
|
||||
* The core class of the cluster state coordination algorithm, directly implementing the
|
||||
* <a href="https://github.com/elastic/elasticsearch-formal-models/blob/master/ZenWithTerms/tla/ZenWithTerms.tla">formal model</a>
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class CoordinationState {
|
||||
|
||||
|
|
|
@ -43,6 +43,8 @@ import java.io.IOException;
|
|||
* Occurrences of this exception don't always signal failures, but can often be just caused by the
|
||||
* asynchronous, distributed nature of the system. They will, for example, naturally happen during
|
||||
* leader election, if multiple nodes are trying to become leader at the same time.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class CoordinationStateRejectedException extends OpenSearchException {
|
||||
public CoordinationStateRejectedException(String msg, Object... args) {
|
||||
|
|
|
@ -110,6 +110,11 @@ import static org.opensearch.gateway.ClusterStateUpdaters.hideStateIfNotRecovere
|
|||
import static org.opensearch.gateway.GatewayService.STATE_NOT_RECOVERED_BLOCK;
|
||||
import static org.opensearch.monitor.StatusInfo.Status.UNHEALTHY;
|
||||
|
||||
/**
|
||||
* The main lifecycle resource coordinator
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class Coordinator extends AbstractLifecycleComponent implements Discovery {
|
||||
|
||||
public static final long ZEN1_BWC_TERM = 0;
|
||||
|
|
|
@ -41,6 +41,11 @@ import org.opensearch.gateway.PersistedClusterStateService;
|
|||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
|
||||
/**
|
||||
* Command to detach a node from the cluster
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class DetachClusterCommand extends OpenSearchNodeCommand {
|
||||
|
||||
static final String NODE_DETACHED_MSG = "Node was successfully detached from the cluster";
|
||||
|
|
|
@ -56,6 +56,8 @@ import java.util.concurrent.atomic.AtomicLong;
|
|||
* randomly at reasonably high frequency and backing off (linearly) until one of them succeeds. We also place an upper bound on the backoff
|
||||
* so that if elections are failing due to a network partition that lasts for a long time then when the partition heals there is an election
|
||||
* attempt reasonably quickly.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class ElectionSchedulerFactory {
|
||||
|
||||
|
|
|
@ -38,6 +38,8 @@ import org.opensearch.cluster.node.DiscoveryNode;
|
|||
/**
|
||||
* Allows plugging in a custom election strategy, restricting the notion of an election quorum.
|
||||
* Custom additional quorum restrictions can be defined by implementing the {@link #satisfiesAdditionalQuorumConstraints} method.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public abstract class ElectionStrategy {
|
||||
|
||||
|
|
|
@ -38,6 +38,8 @@ import java.io.IOException;
|
|||
|
||||
/**
|
||||
* Thrown when failing to publish a cluster state. See {@link ClusterStatePublisher} for more details.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class FailedToCommitClusterStateException extends OpenSearchException {
|
||||
|
||||
|
|
|
@ -76,6 +76,8 @@ import static org.opensearch.monitor.StatusInfo.Status.UNHEALTHY;
|
|||
* follower has failed the leader will remove it from the cluster. We are fairly lenient, possibly allowing multiple checks to fail before
|
||||
* considering a follower to be faulty, to allow for a brief network partition or a long GC cycle to occur without triggering the removal of
|
||||
* a node and the consequent shard reallocation.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class FollowersChecker {
|
||||
|
||||
|
|
|
@ -33,6 +33,11 @@ package org.opensearch.cluster.coordination;
|
|||
|
||||
import org.opensearch.cluster.ClusterState;
|
||||
|
||||
/**
|
||||
* Persist state in memory
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class InMemoryPersistedState implements CoordinationState.PersistedState {
|
||||
|
||||
private long currentTerm;
|
||||
|
|
|
@ -46,6 +46,8 @@ import java.io.IOException;
|
|||
* information about the current state of the node that provided the vote, so that
|
||||
* the receiver of the vote can determine if it has a more up-to-date state than the
|
||||
* source node.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class Join implements Writeable {
|
||||
private final DiscoveryNode sourceNode;
|
||||
|
|
|
@ -84,6 +84,11 @@ import java.util.function.Supplier;
|
|||
|
||||
import static org.opensearch.monitor.StatusInfo.Status.UNHEALTHY;
|
||||
|
||||
/**
|
||||
* Helper utility class for joining the cluster
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class JoinHelper {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(JoinHelper.class);
|
||||
|
|
|
@ -41,6 +41,11 @@ import java.io.IOException;
|
|||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Request for a node to join the cluster
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class JoinRequest extends TransportRequest {
|
||||
|
||||
/**
|
||||
|
|
|
@ -62,6 +62,11 @@ import java.util.stream.Collectors;
|
|||
|
||||
import static org.opensearch.gateway.GatewayService.STATE_NOT_RECOVERED_BLOCK;
|
||||
|
||||
/**
|
||||
* Main executor for Nodes joining the OpenSearch cluster
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class JoinTaskExecutor implements ClusterStateTaskExecutor<JoinTaskExecutor.Task> {
|
||||
|
||||
private final AllocationService allocationService;
|
||||
|
|
|
@ -56,6 +56,8 @@ import static org.opensearch.common.util.concurrent.ConcurrentCollections.newCon
|
|||
* A publication can succeed and complete before all nodes have applied the published state and acknowledged it; however we need every node
|
||||
* eventually either to apply the published state (or a later state) or be removed from the cluster. This component achieves this by
|
||||
* removing any lagging nodes from the cluster after a timeout.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class LagDetector {
|
||||
|
||||
|
|
|
@ -75,6 +75,8 @@ import static org.opensearch.monitor.StatusInfo.Status.UNHEALTHY;
|
|||
* fairly lenient, possibly allowing multiple checks to fail before considering the leader to be faulty, to allow for the leader to
|
||||
* temporarily stand down on occasion, e.g. if it needs to move to a higher term. On deciding that the leader has failed a follower will
|
||||
* become a candidate and attempt to become a leader itself.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class LeaderChecker {
|
||||
|
||||
|
|
|
@ -41,6 +41,11 @@ import org.opensearch.rest.RestStatus;
|
|||
|
||||
import java.util.EnumSet;
|
||||
|
||||
/**
|
||||
* Service to block the master node
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class NoMasterBlockService {
|
||||
public static final int NO_MASTER_BLOCK_ID = 2;
|
||||
public static final ClusterBlock NO_MASTER_BLOCK_WRITES = new ClusterBlock(
|
||||
|
|
|
@ -40,6 +40,8 @@ import java.io.IOException;
|
|||
/**
|
||||
* This exception is thrown if the File system is reported unhealthy by @{@link org.opensearch.monitor.fs.FsHealthService}
|
||||
* and this nodes needs to be removed from the cluster
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
|
||||
public class NodeHealthCheckFailureException extends OpenSearchException {
|
||||
|
|
|
@ -43,6 +43,11 @@ import org.opensearch.persistent.PersistentTasksCustomMetadata;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Update cluster state when node is removed from the cluster
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class NodeRemovalClusterStateTaskExecutor
|
||||
implements
|
||||
ClusterStateTaskExecutor<NodeRemovalClusterStateTaskExecutor.Task>,
|
||||
|
|
|
@ -44,6 +44,12 @@ import org.opensearch.env.OverrideNodeVersionCommand;
|
|||
// Even if we avoid making a static reference to Logger class, there is no nice way to avoid declaring
|
||||
// UNSAFE_BOOTSTRAP, which depends on ClusterService, which in turn has static Logger.
|
||||
// TODO execute CommandLoggingConfigurator.configureLoggingWithoutConfig() in the constructor of commands, not in beforeMain
|
||||
|
||||
/**
|
||||
* Command Line Interface tool for Nodes
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class NodeToolCli extends MultiCommand {
|
||||
|
||||
public NodeToolCli() {
|
||||
|
|
|
@ -70,6 +70,11 @@ import java.util.EnumSet;
|
|||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Main set of node commands
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public abstract class OpenSearchNodeCommand extends EnvironmentAwareCommand {
|
||||
private static final Logger logger = LogManager.getLogger(OpenSearchNodeCommand.class);
|
||||
protected static final String DELIMITER = "------------------------------------------------------------------------\n";
|
||||
|
|
|
@ -42,6 +42,11 @@ import java.util.List;
|
|||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Response from peer nodes
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class PeersResponse extends TransportResponse {
|
||||
private final Optional<DiscoveryNode> clusterManagerNode;
|
||||
private final List<DiscoveryNode> knownPeers;
|
||||
|
|
|
@ -42,6 +42,8 @@ import java.io.IOException;
|
|||
|
||||
/**
|
||||
* Class encapsulating stats about the PendingClusterStatsQueue
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class PendingClusterStateStats implements Writeable, ToXContentFragment {
|
||||
|
||||
|
|
|
@ -58,6 +58,11 @@ import java.util.stream.StreamSupport;
|
|||
import static org.opensearch.common.util.concurrent.ConcurrentCollections.newConcurrentMap;
|
||||
import static org.opensearch.monitor.StatusInfo.Status.UNHEALTHY;
|
||||
|
||||
/**
|
||||
* Collects information prior to a promotion vote
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class PreVoteCollector {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(PreVoteCollector.class);
|
||||
|
|
|
@ -40,6 +40,11 @@ import org.opensearch.transport.TransportRequest;
|
|||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Requests pre vote information collection
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class PreVoteRequest extends TransportRequest {
|
||||
|
||||
private final DiscoveryNode sourceNode;
|
||||
|
|
|
@ -39,6 +39,11 @@ import org.opensearch.transport.TransportResponse;
|
|||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Response for a PreVoteRequest
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class PreVoteResponse extends TransportResponse {
|
||||
private final long currentTerm;
|
||||
private final long lastAcceptedTerm;
|
||||
|
|
|
@ -52,6 +52,11 @@ import java.util.Set;
|
|||
import java.util.function.LongSupplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Publication task
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public abstract class Publication {
|
||||
|
||||
protected final Logger logger = LogManager.getLogger(getClass());
|
||||
|
|
|
@ -72,6 +72,11 @@ import java.util.function.BiConsumer;
|
|||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* Transport handler for publication
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class PublicationTransportHandler {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(PublicationTransportHandler.class);
|
||||
|
|
|
@ -42,6 +42,8 @@ import java.io.IOException;
|
|||
|
||||
/**
|
||||
* Class encapsulating stats about the PublishClusterStateAction
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class PublishClusterStateStats implements Writeable, ToXContentObject {
|
||||
|
||||
|
|
|
@ -38,6 +38,8 @@ import java.util.Objects;
|
|||
/**
|
||||
* Request which is used by the cluster-manager node to publish cluster state changes.
|
||||
* Actual serialization of this request is done by {@link PublicationTransportHandler}
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class PublishRequest {
|
||||
|
||||
|
|
|
@ -40,6 +40,8 @@ import java.io.IOException;
|
|||
/**
|
||||
* Response to a {@link PublishRequest}, carrying the term and version of the request.
|
||||
* Typically wrapped in a {@link PublishWithJoinResponse}.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class PublishResponse implements Writeable {
|
||||
|
||||
|
|
|
@ -41,6 +41,8 @@ import java.util.Optional;
|
|||
/**
|
||||
* Response to a {@link PublishRequest}. Encapsulates both a {@link PublishResponse}
|
||||
* and an optional {@link Join}.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class PublishWithJoinResponse extends TransportResponse {
|
||||
private final PublishResponse publishResponse;
|
||||
|
|
|
@ -47,6 +47,8 @@ import java.util.stream.Collectors;
|
|||
|
||||
/**
|
||||
* Computes the optimal configuration of voting nodes in the cluster.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class Reconfigurator {
|
||||
|
||||
|
|
|
@ -48,6 +48,11 @@ import java.io.IOException;
|
|||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Removes custom metadata
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class RemoveCustomsCommand extends OpenSearchNodeCommand {
|
||||
|
||||
static final String CUSTOMS_REMOVED_MSG = "Customs were successfully removed from the cluster state";
|
||||
|
|
|
@ -48,6 +48,11 @@ import java.io.IOException;
|
|||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Removes custom settings
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class RemoveSettingsCommand extends OpenSearchNodeCommand {
|
||||
|
||||
static final String SETTINGS_REMOVED_MSG = "Settings were successfully removed from the cluster state";
|
||||
|
|
|
@ -41,6 +41,8 @@ import java.io.IOException;
|
|||
/**
|
||||
* Represents the action of requesting a join vote (see {@link Join}) from a node.
|
||||
* The source node represents the node that is asking for join votes.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class StartJoinRequest extends TransportRequest {
|
||||
|
||||
|
|
|
@ -39,6 +39,11 @@ import org.opensearch.transport.TransportRequest;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Get's the version of a term
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
abstract class TermVersionRequest extends TransportRequest implements Writeable {
|
||||
protected final DiscoveryNode sourceNode;
|
||||
protected final long term;
|
||||
|
|
|
@ -54,6 +54,11 @@ import java.util.Collections;
|
|||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Tool to run an unsafe bootstrap
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class UnsafeBootstrapMasterCommand extends OpenSearchNodeCommand {
|
||||
|
||||
static final String CLUSTER_STATE_TERM_VERSION_MSG_FORMAT = "Current node cluster state (term, version) pair is (%s, %s)";
|
||||
|
|
|
@ -38,6 +38,11 @@ import org.opensearch.transport.TransportRequest;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Transport request to validate node join
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class ValidateJoinRequest extends TransportRequest {
|
||||
private ClusterState state;
|
||||
|
||||
|
|
|
@ -38,6 +38,11 @@ import org.opensearch.common.io.stream.Writeable;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Cluster health status
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public enum ClusterHealthStatus implements Writeable {
|
||||
GREEN((byte) 0),
|
||||
YELLOW((byte) 1),
|
||||
|
|
|
@ -58,6 +58,11 @@ import static org.opensearch.common.xcontent.ConstructingObjectParser.constructo
|
|||
import static org.opensearch.common.xcontent.ConstructingObjectParser.optionalConstructorArg;
|
||||
import static org.opensearch.common.xcontent.XContentParserUtils.ensureExpectedToken;
|
||||
|
||||
/**
|
||||
* Cluster Index Health Information
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public final class ClusterIndexHealth implements Iterable<ClusterShardHealth>, Writeable, ToXContentFragment {
|
||||
private static final String STATUS = "status";
|
||||
private static final String NUMBER_OF_SHARDS = "number_of_shards";
|
||||
|
|
|
@ -54,6 +54,11 @@ import java.util.Objects;
|
|||
import static org.opensearch.common.xcontent.ConstructingObjectParser.constructorArg;
|
||||
import static org.opensearch.common.xcontent.XContentParserUtils.ensureExpectedToken;
|
||||
|
||||
/**
|
||||
* Cluster shard health information
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public final class ClusterShardHealth implements Writeable, ToXContentFragment {
|
||||
private static final String STATUS = "status";
|
||||
private static final String ACTIVE_SHARDS = "active_shards";
|
||||
|
|
|
@ -49,6 +49,11 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Cluster state health information
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public final class ClusterStateHealth implements Iterable<ClusterIndexHealth>, Writeable {
|
||||
|
||||
private final int numberOfNodes;
|
||||
|
|
|
@ -38,6 +38,8 @@ import org.opensearch.common.Strings;
|
|||
|
||||
/**
|
||||
* Individual operation to perform on the cluster state as part of an {@link IndicesAliasesRequest}.
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public abstract class AliasAction {
|
||||
private final String index;
|
||||
|
|
|
@ -58,6 +58,11 @@ import java.util.Set;
|
|||
|
||||
import static java.util.Collections.emptySet;
|
||||
|
||||
/**
|
||||
* Metadata for index aliases
|
||||
*
|
||||
* @opensearch.internal
|
||||
*/
|
||||
public class AliasMetadata extends AbstractDiffable<AliasMetadata> implements ToXContentFragment {
|
||||
|
||||
private final String alias;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue