forked from opensearch-project/OpenSearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add DecommissionService and helper to execute awareness attribute dec…
…ommissioning (opensearch-project#4084) * Add Executor to decommission node attribute * Decommission service implementation with cluster metadata * Master abdication changes to decommission local awareness leader * Update join validator changes to validate decommissioned node join request Signed-off-by: Rishab Nahata <[email protected]> Signed-off-by: Vishal Sarda <[email protected]>
- Loading branch information
Showing
20 changed files
with
2,226 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
server/src/main/java/org/opensearch/cluster/decommission/DecommissionAttribute.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
package org.opensearch.cluster.decommission; | ||
|
||
import org.opensearch.common.io.stream.StreamInput; | ||
import org.opensearch.common.io.stream.StreamOutput; | ||
import org.opensearch.common.io.stream.Writeable; | ||
|
||
import java.io.IOException; | ||
import java.util.Objects; | ||
|
||
/** | ||
* {@link DecommissionAttribute} encapsulates information about decommissioned node attribute like attribute name, attribute value. | ||
* | ||
* @opensearch.internal | ||
*/ | ||
public final class DecommissionAttribute implements Writeable { | ||
private final String attributeName; | ||
private final String attributeValue; | ||
|
||
/** | ||
* Constructs new decommission attribute name value pair | ||
* | ||
* @param attributeName attribute name | ||
* @param attributeValue attribute value | ||
*/ | ||
public DecommissionAttribute(String attributeName, String attributeValue) { | ||
this.attributeName = attributeName; | ||
this.attributeValue = attributeValue; | ||
} | ||
|
||
/** | ||
* Returns attribute name | ||
* | ||
* @return attributeName | ||
*/ | ||
public String attributeName() { | ||
return this.attributeName; | ||
} | ||
|
||
/** | ||
* Returns attribute value | ||
* | ||
* @return attributeValue | ||
*/ | ||
public String attributeValue() { | ||
return this.attributeValue; | ||
} | ||
|
||
public DecommissionAttribute(StreamInput in) throws IOException { | ||
attributeName = in.readString(); | ||
attributeValue = in.readString(); | ||
} | ||
|
||
/** | ||
* Writes decommission attribute name value to stream output | ||
* | ||
* @param out stream output | ||
*/ | ||
@Override | ||
public void writeTo(StreamOutput out) throws IOException { | ||
out.writeString(attributeName); | ||
out.writeString(attributeValue); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
|
||
DecommissionAttribute that = (DecommissionAttribute) o; | ||
|
||
if (!attributeName.equals(that.attributeName)) return false; | ||
return attributeValue.equals(that.attributeValue); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(attributeName, attributeValue); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "DecommissionAttribute{" + "attributeName='" + attributeName + '\'' + ", attributeValue='" + attributeValue + '\'' + '}'; | ||
} | ||
} |
Oops, something went wrong.