-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes to make security granular for PIT Ids for delete and get pits…
… operation Signed-off-by: Bharathwaj G <bharath78910@gmail.com>
- Loading branch information
1 parent
2e97a58
commit 7796ace
Showing
16 changed files
with
284 additions
and
142 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
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
23 changes: 23 additions & 0 deletions
23
server/src/main/java/org/opensearch/action/search/NodesGetAllPitsAction.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,23 @@ | ||
/* | ||
* 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.search; | ||
|
||
import org.opensearch.action.ActionType; | ||
|
||
/** | ||
* Action type for retrieving all PIT reader contexts from nodes | ||
*/ | ||
public class NodesGetAllPitsAction extends ActionType<GetAllPitNodesResponse> { | ||
public static final NodesGetAllPitsAction INSTANCE = new NodesGetAllPitsAction(); | ||
public static final String NAME = "cluster:admin/point_in_time/read_from_nodes"; | ||
|
||
private NodesGetAllPitsAction() { | ||
super(NAME, GetAllPitNodesResponse::new); | ||
} | ||
} |
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
86 changes: 86 additions & 0 deletions
86
server/src/main/java/org/opensearch/action/search/TransportNodesGetAllPitsAction.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,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.search; | ||
|
||
import org.opensearch.action.FailedNodeException; | ||
import org.opensearch.action.support.ActionFilters; | ||
import org.opensearch.action.support.nodes.TransportNodesAction; | ||
import org.opensearch.cluster.service.ClusterService; | ||
import org.opensearch.common.inject.Inject; | ||
import org.opensearch.common.io.stream.StreamInput; | ||
import org.opensearch.search.SearchService; | ||
import org.opensearch.threadpool.ThreadPool; | ||
import org.opensearch.transport.TransportService; | ||
|
||
import java.io.IOException; | ||
import java.util.List; | ||
|
||
/** | ||
* Transport action to get all active PIT contexts across all nodes | ||
*/ | ||
public class TransportNodesGetAllPitsAction extends TransportNodesAction< | ||
GetAllPitNodesRequest, | ||
GetAllPitNodesResponse, | ||
GetAllPitNodeRequest, | ||
GetAllPitNodeResponse> { | ||
private final SearchService searchService; | ||
|
||
@Inject | ||
public TransportNodesGetAllPitsAction( | ||
ThreadPool threadPool, | ||
ClusterService clusterService, | ||
TransportService transportService, | ||
ActionFilters actionFilters, | ||
SearchService searchService | ||
) { | ||
super( | ||
NodesGetAllPitsAction.NAME, | ||
threadPool, | ||
clusterService, | ||
transportService, | ||
actionFilters, | ||
GetAllPitNodesRequest::new, | ||
GetAllPitNodeRequest::new, | ||
ThreadPool.Names.SAME, | ||
GetAllPitNodeResponse.class | ||
); | ||
this.searchService = searchService; | ||
} | ||
|
||
@Override | ||
protected GetAllPitNodesResponse newResponse( | ||
GetAllPitNodesRequest request, | ||
List<GetAllPitNodeResponse> getAllPitNodeRespons, | ||
List<FailedNodeException> failures | ||
) { | ||
return new GetAllPitNodesResponse(clusterService.getClusterName(), getAllPitNodeRespons, failures); | ||
} | ||
|
||
@Override | ||
protected GetAllPitNodeRequest newNodeRequest(GetAllPitNodesRequest request) { | ||
return new GetAllPitNodeRequest(); | ||
} | ||
|
||
@Override | ||
protected GetAllPitNodeResponse newNodeResponse(StreamInput in) throws IOException { | ||
return new GetAllPitNodeResponse(in); | ||
} | ||
|
||
/** | ||
* This retrieves all active PITs in the node | ||
*/ | ||
@Override | ||
protected GetAllPitNodeResponse nodeOperation(GetAllPitNodeRequest request) { | ||
GetAllPitNodeResponse nodeResponse = new GetAllPitNodeResponse( | ||
transportService.getLocalNode(), | ||
searchService.getAllPITReaderContexts() | ||
); | ||
return nodeResponse; | ||
} | ||
} |
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
Oops, something went wrong.