-
Notifications
You must be signed in to change notification settings - Fork 0
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
Deletepit API #3
base: createpit
Are you sure you want to change the base?
Conversation
Signed-off-by: Bharathwaj G <[email protected]>
Signed-off-by: Bharathwaj G <[email protected]>
Signed-off-by: Bharathwaj G <[email protected]>
Signed-off-by: Bharathwaj G <[email protected]>
Signed-off-by: Bharathwaj G <[email protected]>
8f23568
to
3e23f9d
Compare
Signed-off-by: Bharathwaj G <[email protected]>
3e23f9d
to
d67e389
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making these changes @bharath-techie.
Have comments on few code structuring
Skimmed through PR. Will take a deeper look and review along with test cases once rest tests, functional tests etc. are added.
public static final String FREE_CONTEXT_ACTION_NAME = "indices:data/read/search[free_context]"; | ||
public static final String CLEAR_SCROLL_CONTEXTS_ACTION_NAME = "indices:data/read/search[clear_scroll_contexts]"; | ||
public static final String DELETE_ALL_PIT_CONTEXTS_ACTION_NAME = "indices:data/read/search[delete_pit_contexts]"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
variable name and action name should be consistent for delete all should be consistent with
public static final String FREE_CONTEXT_PIT_ACTION_NAME = "indices:data/read/search[free_context/pit]";
transportService.sendRequest( | ||
connection, | ||
FREE_CONTEXT_PIT_ACTION_NAME, | ||
new ScrollFreeContextRequest(contextId), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this ScrollFreeContextRequest
@@ -198,6 +214,16 @@ public void sendClearAllScrollContexts(Transport.Connection connection, final Ac | |||
); | |||
} | |||
|
|||
public void sendDeleteAllPitContexts(Transport.Connection connection, final ActionListener<TransportResponse> listener) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's make it uniform and call it freeAllPitContexts maybe
DELETE_ALL_PIT_CONTEXTS_ACTION_NAME, | ||
TransportRequest.Empty.INSTANCE, | ||
TransportRequestOptions.EMPTY, | ||
new ActionListenerResponseHandler<>(listener, (in) -> TransportResponse.Empty.INSTANCE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this returning an empty transport response?
server/src/main/java/org/opensearch/action/search/TransportDeletePITAction.java
Outdated
Show resolved
Hide resolved
for (SearchContextIdForNode contextId : contexts) { | ||
final DiscoveryNode node = nodeLookup.apply(contextId.getClusterAlias(), contextId.getNode()); | ||
if (node == null) { | ||
groupedListener.onFailure(new OpenSearchException("node not connected")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"node not found" maybe? How do we know node even exists
/** | ||
* Delete all active PIT reader contexts | ||
*/ | ||
void deleteAllPits(ActionListener<DeletePITResponse> listener) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we move this to a separate handler class which would enable us to do better functional testing?
/** | ||
* Delete list of pits, return success if all reader contexts are deleted ( or not found ). | ||
*/ | ||
void deletePits(List<SearchContextIdForNode> contexts, ActionListener<Integer> listener) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we move this to a separate handler class which would enable us to do better functional testing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unlike create pit (where mocking the transport action didn't give us the desired results), i was able to mock and write functional tests without segregating the methods into a separate file.
}, listener::onFailure); | ||
} | ||
|
||
private StepListener<BiFunction<String, String, DiscoveryNode>> getLookupListener(List<SearchContextIdForNode> contexts) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems like a reusable method between create/delete/pit or on those lines. redundant? Maybe all in one service class can harness common functionalities better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not reusable since signature and hence logic is different between create and delete.
return lookupListener; | ||
} | ||
|
||
private ActionListener<DeletePITResponse> getGroupedListener(ActionListener<DeletePITResponse> deletePitListener, int size) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why a separate method for this if its used only once and is private hence not even being called in unit tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Meant to mark as request changes.
Signed-off-by: Bharathwaj G <[email protected]>
Signed-off-by: Bharathwaj G <[email protected]>
Signed-off-by: Bharathwaj G <[email protected]>
6cda616
to
730afa8
Compare
Signed-off-by: Bharathwaj G <[email protected]>
7a77f7b
to
929800d
Compare
Signed-off-by: Bharathwaj G <[email protected]>
f65aa43
to
35d8cc4
Compare
Signed-off-by: Bharathwaj G <[email protected]>
100e1ea
to
d2e972b
Compare
Bumps com.diffplug.spotless from 6.5.2 to 6.6.1. --- updated-dependencies: - dependency-name: com.diffplug.spotless dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…pensearch-project#3361) * Bump grpc-context from 1.45.1 to 1.46.0 in /plugins/repository-gcs Bumps [grpc-context](https://github.com/grpc/grpc-java) from 1.45.1 to 1.46.0. - [Release notes](https://github.com/grpc/grpc-java/releases) - [Commits](grpc/grpc-java@v1.45.1...v1.46.0) --- updated-dependencies: - dependency-name: io.grpc:grpc-context dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * Updating SHAs Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
…ensearch-project#3371) Signed-off-by: Suraj Singh <[email protected]>
…h-project#3364) Signed-off-by: Ankit Jain <[email protected]>
Signed-off-by: Bharathwaj G <[email protected]>
* Create Point In Time API changes Signed-off-by: Bharathwaj G <[email protected]>
Description
Changes for delete pit api ( single, list and all )
Issues Resolved
[List any issues this PR will resolve]
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.