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

Service Layer changes for Recommission API #4320

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
8c38c53
Initial commit for recommission service level changes
pranikum Aug 27, 2022
40d739b
Remove commented changes from service class
pranikum Aug 29, 2022
32d1499
Update Service layer to handle removal of recommission zone attribute
pranikum Sep 1, 2022
79561e1
Merge branch 'main' into recommission-service-level-support
pranikum Sep 7, 2022
f3b8dd8
Merge branch 'main' into recommission-service-level-support
pranikum Sep 7, 2022
ace11fe
Add change log and address comment.
pranikum Sep 7, 2022
3988e2d
Fix EOL Errors
pranikum Sep 7, 2022
fe3f01a
Fix spotless check
pranikum Sep 7, 2022
7ffb650
Remove unwanted files
pranikum Sep 7, 2022
bf0af0a
Remove unwanted files
pranikum Sep 7, 2022
1972243
Add unwanted deletion
pranikum Sep 7, 2022
2584d51
Add the correct gradle jar
pranikum Sep 7, 2022
e9d50a6
Fix spotless java check
pranikum Sep 7, 2022
4c6273b
Merge with latest
pranikum Sep 21, 2022
0b56861
Merge branch 'main' into recommission-service-level-support
pranikum Sep 21, 2022
95c41ff
Update Changelog
pranikum Sep 21, 2022
6e2ae8f
Add call to set weights
pranikum Sep 23, 2022
eaeefa6
Fix spotless check
pranikum Sep 23, 2022
8ca49e7
Fix spotless java check
pranikum Sep 23, 2022
97c4d32
Fix logger check
pranikum Sep 23, 2022
2d83698
Remove unused class
pranikum Sep 23, 2022
e7946d8
Add package info
pranikum Sep 24, 2022
98b4ac8
Merge change log to latest
pranikum Sep 24, 2022
fcf36cf
Merge branch 'main' into recommission-service-level-support
pranikum Sep 24, 2022
4f6543b
Add to changelog
pranikum Sep 24, 2022
02a96ba
add new line to package info
pranikum Sep 24, 2022
b2bfb31
Resolve conflict with latest
pranikum Sep 28, 2022
f3582e3
Merge branch 'main' into recommission-service-level-support
pranikum Sep 28, 2022
fe8f3b1
Take latest and add recommission changes
pranikum Sep 28, 2022
d52d48e
Remove unused class
pranikum Sep 28, 2022
93ee423
Merge changelog
pranikum Sep 29, 2022
45b98d3
Merge branch 'main' into recommission-service-level-support
pranikum Sep 29, 2022
56eca8f
Update changelog. Address minor changes
pranikum Sep 29, 2022
4d04395
Remove setting of weights. Just delete the attribute
pranikum Sep 30, 2022
c7c9f35
Update test cases. Call clearVotingConfigExclusion
pranikum Sep 30, 2022
0cf8def
Merge with latest
pranikum Oct 3, 2022
e203a57
Merge branch 'main' into recommission-service-level-support
pranikum Oct 3, 2022
7c14326
Merge with latest
pranikum Oct 3, 2022
f281473
PR comments
pranikum Oct 3, 2022
f22307f
PR comments
pranikum Oct 3, 2022
22a1d5e
Update method name
pranikum Oct 3, 2022
5227538
Update method name
pranikum Oct 3, 2022
b0cfef5
PR comments
pranikum Oct 5, 2022
c16ac3a
Resolve conflict with main
pranikum Oct 5, 2022
1b3471b
Merge branch 'main' into recommission-service-level-support
pranikum Oct 5, 2022
b1cf7a5
Merge changelog with latest
pranikum Oct 5, 2022
22cd77c
Update logger message
pranikum Oct 5, 2022
b3930c5
Fix log messages
pranikum Oct 5, 2022
5228119
Merge with main
pranikum Oct 6, 2022
4f58513
Merge branch 'main' into recommission-service-level-support
pranikum Oct 6, 2022
224dad4
Change log changes
pranikum Oct 6, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*
pranikum marked this conversation as resolved.
Show resolved Hide resolved
* 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 {
pranikum marked this conversation as resolved.
Show resolved Hide resolved
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 + '\'' + '}';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
pranikum marked this conversation as resolved.
Show resolved Hide resolved
* 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.OpenSearchException;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;

import java.io.IOException;

/**
* This exception is thrown whenever a failure occurs in decommission request @{@link DecommissionService}
*
* @opensearch.internal
*/
public class DecommissionFailedException extends OpenSearchException {

private final DecommissionAttribute decommissionAttribute;

public DecommissionFailedException(DecommissionAttribute decommissionAttribute, String msg) {
this(decommissionAttribute, msg, null);
}

public DecommissionFailedException(DecommissionAttribute decommissionAttribute, String msg, Throwable cause) {
super("[" + (decommissionAttribute == null ? "_na" : decommissionAttribute.toString()) + "] " + msg, cause);
this.decommissionAttribute = decommissionAttribute;
}

public DecommissionFailedException(StreamInput in) throws IOException {
super(in);
decommissionAttribute = new DecommissionAttribute(in);
}

@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
decommissionAttribute.writeTo(out);
}

/**
* Returns decommission attribute
*
* @return decommission attribute
*/
public DecommissionAttribute decommissionAttribute() {
return decommissionAttribute;
}
}
Loading