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

Recommission api level support #4604

Merged
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
8e1056a
Add changes for Recommission API
pranikum Sep 27, 2022
c614b9a
Update json file name
pranikum Sep 27, 2022
55c4b42
Add line for the file
pranikum Sep 27, 2022
74758e6
Delete decommission awareness
pranikum Sep 27, 2022
d76f281
Merge with latest
pranikum Sep 28, 2022
686a9a2
Resolve conflict
pranikum Sep 28, 2022
c74a18c
Merge branch 'main' into recommission-api-level-support-2
pranikum Sep 28, 2022
ebb0d1a
Conflict resolution
pranikum Sep 28, 2022
07cd63a
Spotless java check
pranikum Sep 28, 2022
746100a
Remove toxcontet implements
pranikum Sep 29, 2022
9d60fd6
Merge with main changes
pranikum Sep 29, 2022
1011f35
Merge branch 'main' into recommission-api-level-support-2
pranikum Sep 29, 2022
0aca81b
Update change log
pranikum Sep 29, 2022
091f2ea
Add todo tin transport for service call
pranikum Sep 29, 2022
9fddb62
Conflict with latest
pranikum Oct 3, 2022
3dde9b4
Merge branch 'main' into recommission-api-level-support-2
pranikum Oct 3, 2022
3ee67fc
Merge conflict with latest
pranikum Oct 3, 2022
7f988f8
Spotless Java check
pranikum Oct 3, 2022
4c3ed86
Merge changelog with latest
pranikum Oct 6, 2022
91d8a69
Merge branch 'main' into recommission-api-level-support-2
pranikum Oct 6, 2022
34d3989
Fix changelog
pranikum Oct 6, 2022
2117249
Merge with latest. Add call to service
pranikum Oct 6, 2022
1a80293
Merge with latest
pranikum Oct 10, 2022
201e64d
Merge branch 'main' into recommission-api-level-support-2
pranikum Oct 10, 2022
baae7fb
Merge back changelog
pranikum Oct 10, 2022
2695198
Fix comments
pranikum Oct 10, 2022
2fa306c
Remove unwanted change
pranikum Oct 11, 2022
e7388e3
Merge branch 'main' into recommission-api-level-support-2
pranikum Oct 11, 2022
a052dad
Merge changelog with latest
pranikum Oct 12, 2022
bfe13cb
Merge branch 'main' into recommission-api-level-support-2
pranikum Oct 12, 2022
0d98d0c
Resolve changelog cnflict
pranikum Oct 12, 2022
d572494
Merge with latest
pranikum Oct 12, 2022
97df22d
Merge branch 'main' into recommission-api-level-support-2
pranikum Oct 12, 2022
28e5c69
Resolve conflict
pranikum Oct 12, 2022
69a281a
Fix comments
pranikum Oct 12, 2022
2981de5
Merge with latest
pranikum Oct 13, 2022
9557048
Merge branch 'main' into recommission-api-level-support-2
pranikum Oct 13, 2022
9bd1717
Resolve conflict
pranikum Oct 13, 2022
760aaaf
Update comments
pranikum Oct 13, 2022
3d842ef
Empty commit
pranikum Oct 13, 2022
6305812
Empty commit
pranikum Oct 13, 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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Added precommit support for MacOS ([#4682](https://github.com/opensearch-project/OpenSearch/pull/4682))
- Recommission API changes for service layer ([#4320](https://github.com/opensearch-project/OpenSearch/pull/4320))
- Update GeoGrid base class access modifier to support extensibility ([#4572](https://github.com/opensearch-project/OpenSearch/pull/4572))

- Recommissioning of zone. REST layer support. ([#4624](https://github.com/opensearch-project/OpenSearch/pull/4604))
### Dependencies
- Bumps `log4j-core` from 2.18.0 to 2.19.0
- Bumps `reactor-netty-http` from 1.0.18 to 1.0.23
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,8 @@ public void testApiNamingConventions() throws Exception {
"cluster.put_weighted_routing",
"cluster.get_weighted_routing",
"cluster.put_decommission_awareness",
"cluster.get_decommission_awareness", };
"cluster.get_decommission_awareness",
"cluster.delete_decommission_awareness", };
List<String> booleanReturnMethods = Arrays.asList("security.enable_user", "security.disable_user", "security.change_password");
Set<String> deprecatedMethods = new HashSet<>();
deprecatedMethods.add("indices.force_merge");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"cluster.delete_decommission_awareness": {
pranikum marked this conversation as resolved.
Show resolved Hide resolved
"documentation": {
"url": "https://opensearch.org/docs/latest/opensearch/rest-api/decommission/",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This link redirects to docs. Is the documentation work in progress? or Am I missing something?

"description": "Delete any existing decommission."
},
"stability": "experimental",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is it experimental?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will be marking this to stable once all meta issues are resolved we already have task identified for same.
#3957

"url": {
"paths": [
{
"path": "/_cluster/decommission/awareness/",
"methods": [
"DELETE"
]
}
]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
import org.opensearch.action.admin.cluster.configuration.TransportClearVotingConfigExclusionsAction;
import org.opensearch.action.admin.cluster.decommission.awareness.get.GetDecommissionStateAction;
import org.opensearch.action.admin.cluster.decommission.awareness.get.TransportGetDecommissionStateAction;
import org.opensearch.action.admin.cluster.decommission.awareness.delete.DeleteDecommissionStateAction;
import org.opensearch.action.admin.cluster.decommission.awareness.delete.TransportDeleteDecommissionStateAction;
import org.opensearch.action.admin.cluster.decommission.awareness.put.DecommissionAction;
import org.opensearch.action.admin.cluster.decommission.awareness.put.TransportDecommissionAction;
import org.opensearch.action.admin.cluster.health.ClusterHealthAction;
Expand Down Expand Up @@ -310,6 +312,7 @@
import org.opensearch.rest.action.admin.cluster.RestClusterStatsAction;
import org.opensearch.rest.action.admin.cluster.RestClusterUpdateSettingsAction;
import org.opensearch.rest.action.admin.cluster.RestCreateSnapshotAction;
import org.opensearch.rest.action.admin.cluster.RestDeleteDecommissionStateAction;
import org.opensearch.rest.action.admin.cluster.RestDeleteRepositoryAction;
import org.opensearch.rest.action.admin.cluster.RestDeleteSnapshotAction;
import org.opensearch.rest.action.admin.cluster.RestDeleteStoredScriptAction;
Expand Down Expand Up @@ -699,6 +702,7 @@ public <Request extends ActionRequest, Response extends ActionResponse> void reg
// Decommission actions
actions.register(DecommissionAction.INSTANCE, TransportDecommissionAction.class);
actions.register(GetDecommissionStateAction.INSTANCE, TransportGetDecommissionStateAction.class);
actions.register(DeleteDecommissionStateAction.INSTANCE, TransportDeleteDecommissionStateAction.class);

return unmodifiableMap(actions.getRegistry());
}
Expand Down Expand Up @@ -879,6 +883,7 @@ public void initRestHandlers(Supplier<DiscoveryNodes> nodesInCluster) {
registerHandler.accept(new RestDeletePitAction());
registerHandler.accept(new RestGetAllPitsAction(nodesInCluster));
registerHandler.accept(new RestPitSegmentsAction(nodesInCluster));
registerHandler.accept(new RestDeleteDecommissionStateAction());

for (ActionPlugin plugin : actionPlugins) {
for (RestHandler handler : plugin.getRestHandlers(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* 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.action.admin.cluster.decommission.awareness.delete;

import org.opensearch.action.ActionType;

/**
* Transport action delete decommission.
*
* @opensearch.internal
*/

public class DeleteDecommissionStateAction extends ActionType<DeleteDecommissionStateResponse> {
public static final DeleteDecommissionStateAction INSTANCE = new DeleteDecommissionStateAction();
public static final String NAME = "cluster:admin/decommission/awareness/delete";

private DeleteDecommissionStateAction() {
super(NAME, DeleteDecommissionStateResponse::new);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* 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.action.admin.cluster.decommission.awareness.delete;

import org.opensearch.action.ActionRequestValidationException;
import org.opensearch.action.support.clustermanager.ClusterManagerNodeRequest;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;

import java.io.IOException;

/**
* Request for deleting decommission request.
*
* @opensearch.internal
*/
public class DeleteDecommissionStateRequest extends ClusterManagerNodeRequest<DeleteDecommissionStateRequest> {
pranikum marked this conversation as resolved.
Show resolved Hide resolved

public DeleteDecommissionStateRequest() {}

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

@Override
public ActionRequestValidationException validate() {
return null;
}

@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* 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.action.admin.cluster.decommission.awareness.delete;

import org.opensearch.action.support.clustermanager.ClusterManagerNodeOperationRequestBuilder;
import org.opensearch.client.OpenSearchClient;

/**
* Builder for a Delete decommission request.
*
* @opensearch.internal
*/
public class DeleteDecommissionStateRequestBuilder extends ClusterManagerNodeOperationRequestBuilder<
DeleteDecommissionStateRequest,
DeleteDecommissionStateResponse,
DeleteDecommissionStateRequestBuilder> {

public DeleteDecommissionStateRequestBuilder(OpenSearchClient client, DeleteDecommissionStateAction action) {
super(client, action, new DeleteDecommissionStateRequest());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* 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.action.admin.cluster.decommission.awareness.delete;

import org.opensearch.action.support.master.AcknowledgedResponse;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;

import java.io.IOException;

/**
* Response returned after deletion of decommission request.
*
* @opensearch.internal
*/
public class DeleteDecommissionStateResponse extends AcknowledgedResponse {

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

public DeleteDecommissionStateResponse(boolean acknowledged) {
super(acknowledged);
}

@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/*
* 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.action.admin.cluster.decommission.awareness.delete;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.opensearch.action.ActionListener;
import org.opensearch.action.support.ActionFilters;
import org.opensearch.action.support.clustermanager.TransportClusterManagerNodeAction;
import org.opensearch.cluster.ClusterState;
import org.opensearch.cluster.block.ClusterBlockException;
import org.opensearch.cluster.block.ClusterBlockLevel;
import org.opensearch.cluster.decommission.DecommissionService;
import org.opensearch.cluster.metadata.IndexNameExpressionResolver;
import org.opensearch.cluster.service.ClusterService;
import org.opensearch.common.inject.Inject;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.threadpool.ThreadPool;
import org.opensearch.transport.TransportService;

import java.io.IOException;

/**
* Transport action for delete decommission.
*
* @opensearch.internal
*/
public class TransportDeleteDecommissionStateAction extends TransportClusterManagerNodeAction<
DeleteDecommissionStateRequest,
DeleteDecommissionStateResponse> {

private static final Logger logger = LogManager.getLogger(TransportDeleteDecommissionStateAction.class);
private final DecommissionService decommissionService;

@Inject
public TransportDeleteDecommissionStateAction(
TransportService transportService,
ClusterService clusterService,
ThreadPool threadPool,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver,
DecommissionService decommissionService
) {
super(
DeleteDecommissionStateAction.NAME,
transportService,
clusterService,
threadPool,
actionFilters,
DeleteDecommissionStateRequest::new,
indexNameExpressionResolver
);
this.decommissionService = decommissionService;
}

@Override
protected String executor() {
return ThreadPool.Names.SAME;
}

@Override
protected DeleteDecommissionStateResponse read(StreamInput in) throws IOException {
return new DeleteDecommissionStateResponse(in);
}

@Override
protected ClusterBlockException checkBlock(DeleteDecommissionStateRequest request, ClusterState state) {
return state.blocks().globalBlockedException(ClusterBlockLevel.METADATA_WRITE);
}

@Override
protected void clusterManagerOperation(
DeleteDecommissionStateRequest request,
ClusterState state,
ActionListener<DeleteDecommissionStateResponse> listener
) {
logger.info("Received delete decommission Request [{}]", request);
this.decommissionService.startRecommissionAction(listener);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* 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.
*/

/** Delete decommission transport handlers. */
package org.opensearch.action.admin.cluster.decommission.awareness.delete;
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
import org.opensearch.action.admin.cluster.allocation.ClusterAllocationExplainRequest;
import org.opensearch.action.admin.cluster.allocation.ClusterAllocationExplainRequestBuilder;
import org.opensearch.action.admin.cluster.allocation.ClusterAllocationExplainResponse;
import org.opensearch.action.admin.cluster.decommission.awareness.delete.DeleteDecommissionStateRequest;
import org.opensearch.action.admin.cluster.decommission.awareness.delete.DeleteDecommissionStateRequestBuilder;
import org.opensearch.action.admin.cluster.decommission.awareness.delete.DeleteDecommissionStateResponse;
import org.opensearch.action.admin.cluster.decommission.awareness.get.GetDecommissionStateRequest;
import org.opensearch.action.admin.cluster.decommission.awareness.get.GetDecommissionStateRequestBuilder;
import org.opensearch.action.admin.cluster.decommission.awareness.get.GetDecommissionStateResponse;
Expand Down Expand Up @@ -864,4 +867,18 @@ public interface ClusterAdminClient extends OpenSearchClient {
*/
GetDecommissionStateRequestBuilder prepareGetDecommission();

/**
* Deletes the decommission metadata.
*/
ActionFuture<DeleteDecommissionStateResponse> deleteDecommissionState(DeleteDecommissionStateRequest request);

/**
* Deletes the decommission metadata.
*/
void deleteDecommissionState(DeleteDecommissionStateRequest request, ActionListener<DeleteDecommissionStateResponse> listener);

/**
* Deletes the decommission metadata.
*/
DeleteDecommissionStateRequestBuilder prepareDeleteDecommissionRequest();
}
8 changes: 8 additions & 0 deletions server/src/main/java/org/opensearch/client/Requests.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

package org.opensearch.client;

import org.opensearch.action.admin.cluster.decommission.awareness.delete.DeleteDecommissionStateRequest;
import org.opensearch.action.admin.cluster.decommission.awareness.get.GetDecommissionStateRequest;
import org.opensearch.action.admin.cluster.decommission.awareness.put.DecommissionRequest;
import org.opensearch.action.admin.cluster.health.ClusterHealthRequest;
Expand Down Expand Up @@ -588,4 +589,11 @@ public static DecommissionRequest decommissionRequest() {
public static GetDecommissionStateRequest getDecommissionStateRequest() {
return new GetDecommissionStateRequest();
}

/**
* Creates a new delete decommission request.
*/
public static DeleteDecommissionStateRequest deleteDecommissionStateRequest() {
return new DeleteDecommissionStateRequest();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
import org.opensearch.action.admin.cluster.allocation.ClusterAllocationExplainRequest;
import org.opensearch.action.admin.cluster.allocation.ClusterAllocationExplainRequestBuilder;
import org.opensearch.action.admin.cluster.allocation.ClusterAllocationExplainResponse;
import org.opensearch.action.admin.cluster.decommission.awareness.delete.DeleteDecommissionStateAction;
import org.opensearch.action.admin.cluster.decommission.awareness.delete.DeleteDecommissionStateRequest;
import org.opensearch.action.admin.cluster.decommission.awareness.delete.DeleteDecommissionStateRequestBuilder;
import org.opensearch.action.admin.cluster.decommission.awareness.delete.DeleteDecommissionStateResponse;
import org.opensearch.action.admin.cluster.decommission.awareness.get.GetDecommissionStateAction;
import org.opensearch.action.admin.cluster.decommission.awareness.get.GetDecommissionStateRequest;
import org.opensearch.action.admin.cluster.decommission.awareness.get.GetDecommissionStateRequestBuilder;
Expand Down Expand Up @@ -1405,6 +1409,23 @@ public GetDecommissionStateRequestBuilder prepareGetDecommission() {
return new GetDecommissionStateRequestBuilder(this, GetDecommissionStateAction.INSTANCE);
}

@Override
public ActionFuture<DeleteDecommissionStateResponse> deleteDecommissionState(DeleteDecommissionStateRequest request) {
return execute(DeleteDecommissionStateAction.INSTANCE, request);
}

@Override
public void deleteDecommissionState(
DeleteDecommissionStateRequest request,
ActionListener<DeleteDecommissionStateResponse> listener
) {
execute(DeleteDecommissionStateAction.INSTANCE, request, listener);
}

@Override
public DeleteDecommissionStateRequestBuilder prepareDeleteDecommissionRequest() {
return new DeleteDecommissionStateRequestBuilder(this, DeleteDecommissionStateAction.INSTANCE);
}
}

static class IndicesAdmin implements IndicesAdminClient {
Expand Down
Loading