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

Add delete rollup job support to HL REST Client #34066

Merged
merged 14 commits into from Oct 16, 2018

Conversation

pcsanwald
Copy link
Contributor

@pcsanwald pcsanwald commented Sep 25, 2018

Related to #29827, add support for deletion of a job to HLRC. A few notes on the PR:

  • refactored to use AcknowledgedResponse to remove a small bit of duplication

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

Copy link
Contributor

@iverase iverase left a comment

Choose a reason for hiding this comment

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

In general looks good. Maybe we should add this action to the IT tests:

org.elasticsearch.client.RollupIT

WDYT?

@pcsanwald
Copy link
Contributor Author

@iverase good call, I'll add a test in RollupIT

Copy link
Member

@tlrx tlrx left a comment

Choose a reason for hiding this comment

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

didn't add support for a synchronous call intentionally, from digging around there is no way to block on this

Can you expand on what is the problem exactly? Thanks!

Otherwise I left some minor comments, it looks great

@@ -73,4 +75,38 @@ public void putRollupJobAsync(PutRollupJobRequest request, RequestOptions option
PutRollupJobResponse::fromXContent,
listener, Collections.emptySet());
}

/**
* delete a rollup job from the cluster
Copy link
Member

Choose a reason for hiding this comment

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

Nit: delete -> Delete


private final String id;

private static final ParseField ID_FIELD = new ParseField("id");
Copy link
Member

Choose a reason for hiding this comment

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

Nit: We usually place static constants at the beginning of the class, then class members

private static final ParseField ID_FIELD = new ParseField("id");

public DeleteRollupJobRequest(String id) {
this.id = Objects.requireNonNull(id,"id parameter must not be null");
Copy link
Member

Choose a reason for hiding this comment

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

Nit: missing space after ,

return PARSER.parse(parser, null);
}

private static final ConstructingObjectParser<DeleteRollupJobResponse, Void> PARSER
Copy link
Member

Choose a reason for hiding this comment

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

I think we could move the declaration of the PARSER into the AcknowledgedResponse class so that we don't have to repeat the parsing logic in DeleteRollupJobResponse and PutRollupJobResponse?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

originally I tried to do this, but it's a static field and I couldn't work out a way to pass the concrete type without using some kind of builder thing, which felt like overkill for a small amount of duplication. Am I missing an easy way to do this?

Copy link
Member

Choose a reason for hiding this comment

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

I was thinking of something like declareInnerHitsParseFields or declareAggregationFields (in ParsedAggregation). But I agree this is a bit overkill :)

} catch (Exception e) {
// Swallow any exception, this test does not test actually cancelling.
}

Copy link
Member

Choose a reason for hiding this comment

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

extra spaces

[[java-rest-high-x-pack-rollup-delete-job]]
=== Delete Rollup Job API

The Delete Rollup Job API can be used to create a new Rollup job
Copy link
Member

Choose a reason for hiding this comment

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

create a new -> delete an existing


The Delete Rollup Job API can be used to create a new Rollup job
in the cluster. The API accepts a `PutRollupJobRequest` object
as a request and returns a `PutRollupJobResponse`.
Copy link
Member

Choose a reason for hiding this comment

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

We now have a mecanism to avoid repeating this section, can you use it? (with DeleteRollupJobRequest instead of PutRollupJobRequest)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd like to do this in a follow up PR: because there is a lot of re-use of RollupDocumentationIT across these, I'd like to just move (get|put|delete) job all at once, and adding that stuff to this PR doesn't feel right to me. I'll open the PR as soon as this is merged. seem reasonable?

@pcsanwald
Copy link
Contributor Author

@tlrx @iverase this is ready for re-review, I believe I have addressed your comments. My apologies on the long delay between your initial comments and me making updates, it's been a busy couple weeks :), thank you very much for reviewing.

DeleteRollupJobResponse::fromXContent,
Collections.emptySet());
}
/**
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: need a space

@iverase iverase self-requested a review October 16, 2018 11:33
Copy link
Contributor

@iverase iverase left a comment

Choose a reason for hiding this comment

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

LGTM, just a minor comment

@pcsanwald pcsanwald merged commit 936faba into elastic:master Oct 16, 2018
@pcsanwald pcsanwald deleted the add-delete-rollup-job-hlrc branch October 16, 2018 13:02
kcm pushed a commit that referenced this pull request Oct 30, 2018
Add support for delete rollup job to HL REST Client.
@hub-cap
Copy link
Contributor

hub-cap commented Dec 7, 2018

hey this needs backporting to 6.x

@hub-cap hub-cap added the v6.6.0 label Dec 7, 2018
@pcsanwald
Copy link
Contributor Author

backported in #35045

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

Successfully merging this pull request may close these issues.

None yet

7 participants