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

Implementing Delete PIT service layer changes #3949

Merged
merged 22 commits into from
Jul 26, 2022

Conversation

bharath-techie
Copy link
Contributor

Description

Delete point in time changes - merging the service layer changes as part of this PR and Rest changes will come in as part of separate PR.

Reference PR - Already reviewed delete PIT API PR in feature branch ->
#3401

Request:

`DELETE /_search/point_in_time

{
    "pit_id": [
        "o463QQEPbXktaW5kZXgtMDAwMDAxFkhGN09fMVlPUkVPLXh6MUExZ1hpaEEAFjBGbmVEZHdGU1EtaFhhUFc4ZkR5cWcAAAAAAAAAAAEWaXBPNVJtZEhTZDZXTWFFR05waXdWZwEWSEY3T18xWU9SRU8teHoxQTFnWGloQQAA",
        "o463QQEPbXktaW5kZXgtMDAwMDAxFkhGN09fMVlPUkVPLXh6MUExZ1hpaEEAFjBGbmVEZHdGU1EtaFhhUFc4ZkR5cWcAAAAAAAAAAAIWaXBPNVJtZEhTZDZXTWFFR05waXdWZwEWSEY3T18xWU9SRU8teHoxQTFnWGloQQAA"
    ]
}`

(or) Delete All :
`DELETE /_search/point_in_time/_all`

Response:

`{
    "pits": [
        {
            "succeeded": true,
            "pitId": "o463QQEPbXktaW5kZXgtMDAwMDAxFkhGN09fMVlPUkVPLXh6MUExZ1hpaEEAFjBGbmVEZHdGU1EtaFhhUFc4ZkR5cWcAAAAAAAAAAAEWaXBPNVJtZEhTZDZXTWFFR05waXdWZwEWSEY3T18xWU9SRU8teHoxQTFnWGloQQAA"
        },
        {
            "succeeded": false,
            "pitId": "o463QQEPbXktaW5kZXgtMDAwMDAxFkhGN09fMVlPUkVPLXh6MUExZ1hpaEEAFjBGbmVEZHdGU1EtaFhhUFc4ZkR5cWcAAAAAAAAAAAIWaXBPNVJtZEhTZDZXTWFFR05waXdWZwEWSEY3T18xWU9SRU8teHoxQTFnWGloQQAA"
        }
    ]
}
`

Issues Resolved

#1147

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

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.

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]>
@bharath-techie bharath-techie marked this pull request as ready for review July 19, 2022 15:18
@bharath-techie bharath-techie requested review from a team and reta as code owners July 19, 2022 15:18
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@Bukhtawar
Copy link
Collaborator

/cc: @sachinpkale

@sachinpkale
Copy link
Member

We use squash and merge while merging the PRs. In such cases, PR title becomes commit message in main branch. Use imperative mood to write PR title.

/**
* @return Whether the attempt to delete PIT was successful.
*/

Copy link
Member

Choose a reason for hiding this comment

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

nit: Extra line


@Override
public RestStatus status() {
if (deletePitResults.isEmpty()) return NOT_FOUND;
Copy link
Member

Choose a reason for hiding this comment

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

What would be the status if PIT ID exists but we are not able to delete it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Succeeded would be false for the PIT ID deletion failures as given in PR description. Status is still 200.

@@ -45,12 +45,12 @@
*
* @opensearch.internal
*/
final class SearchContextIdForNode implements Writeable {
public final class SearchContextIdForNode implements Writeable {
Copy link
Member

Choose a reason for hiding this comment

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

Repeat comment: Why is this made public?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -50,6 +51,7 @@ public TransportCreatePitAction(
ClusterService clusterService,
TransportSearchAction transportSearchAction,
NamedWriteableRegistry namedWriteableRegistry,
PitService pitService,
Copy link
Member

Choose a reason for hiding this comment

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

PitService is not used in this class, right?

Signed-off-by: Bharathwaj G <[email protected]>
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@codecov-commenter
Copy link

codecov-commenter commented Jul 20, 2022

Codecov Report

Merging #3949 (ae618ff) into main (b24b02f) will decrease coverage by 0.01%.
The diff coverage is 76.45%.

@@             Coverage Diff              @@
##               main    #3949      +/-   ##
============================================
- Coverage     70.54%   70.53%   -0.02%     
- Complexity    56798    56837      +39     
============================================
  Files          4573     4579       +6     
  Lines        273476   273768     +292     
  Branches      40101    40141      +40     
============================================
+ Hits         192925   193092     +167     
- Misses        64301    64368      +67     
- Partials      16250    16308      +58     
Impacted Files Coverage Δ
...er/src/main/java/org/opensearch/client/Client.java 40.00% <ø> (ø)
.../org/opensearch/client/support/AbstractClient.java 34.78% <0.00%> (+0.07%) ⬆️
...org/opensearch/action/search/DeletePitRequest.java 21.27% <21.27%> (ø)
.../opensearch/action/search/CreatePitController.java 82.30% <62.96%> (-6.08%) ⬇️
...main/java/org/opensearch/search/SearchService.java 72.71% <76.66%> (+0.43%) ⬆️
.../java/org/opensearch/action/search/PitService.java 84.37% <84.37%> (ø)
...rg/opensearch/action/search/DeletePitResponse.java 93.54% <93.54%> (ø)
...ensearch/action/search/SearchTransportService.java 84.39% <96.55%> (-1.41%) ⬇️
.../main/java/org/opensearch/action/ActionModule.java 98.11% <100.00%> (+<0.01%) ⬆️
.../org/opensearch/action/search/DeletePitAction.java 100.00% <100.00%> (ø)
... and 504 more

Help us with your feedback. Take ten seconds to tell us how you rate us.

@bharath-techie bharath-techie changed the title Delete PIT service layer changes Implementing Delete PIT service layer changes Jul 20, 2022
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

Signed-off-by: Bharathwaj G <[email protected]>
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

.filter(r -> !r.isSuccessful())
.forEach(r -> failedPitsStringBuilder.append(r.getPitId()).append(","));
logger.warn(() -> new ParameterizedMessage("Failed to delete PIT IDs {}", failedPitsStringBuilder.toString()));
if (!logger.isDebugEnabled()) return;
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: put this inside the if block instead of negating it and returning early


@Override
public void onFailure(final Exception e) {
logger.error("Delete PITs failed", e);
Copy link
Collaborator

@Bukhtawar Bukhtawar Jul 21, 2022

Choose a reason for hiding this comment

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

Can we log more info on which PITs or how many failed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This onFailure is never called in our flow, during connection failures or during delete pit failures, we mark the associated pit ids 'isSucceeded' as false, which gives info that deletion failed.

This will only be executed when there is an unhandled exception and doubt we have context on pits at that point.

client().admin().indices().prepareDelete("index1").get();
}

public void testDeleteWhileSearch() throws Exception {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Lets add more concurrent tests to ensure all failure cases around grouped listener is covered

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

Signed-off-by: Bharathwaj G <[email protected]>
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants