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

Output all empty snapshot info fields if in verbose mode #25455

Merged
merged 2 commits into from
Jun 28, 2017

Conversation

abeyad
Copy link

@abeyad abeyad commented Jun 28, 2017

In #24477, a less verbose option was added to retrieve snapshot info via
GET /_snapshot/{repo}/{snapshots}. The point of adding this less
verbose option was so that if the repository is a cloud based one, and
there are many snapshots for which the snapshot info needed to be
retrieved, then each snapshot would require reading a separate snapshot
metadata file to pull out the necessary information. This can be costly
(performance and cost) on cloud based repositories, so a less verbose
option was added that only retrieves very basic information about each
snapshot that is all available in the index-N blob - requiring only one
read!

In order to display this less verbose snapshot info appropriately, logic
was added to not display those fields which could not be populated.
However, this broke integrators (e.g. ECE) that required these fields to
be present, even if empty. This commit is to return these fields in the
response, even if empty, if the verbose option is set.

@abeyad abeyad requested a review from imotov June 28, 2017 19:41
In elastic#24477, a less verbose option was added to retrieve snapshot info via
GET /_snapshot/{repo}/{snapshots}.  The point of adding this less
verbose option was so that if the repository is a cloud based one, and
there are many snapshots for which the snapshot info needed to be
retrieved, then each snapshot would require reading a separate snapshot
metadata file to pull out the necessary information.  This can be costly
(performance and cost) on cloud based repositories, so a less verbose
option was added that only retrieves very basic information about each
snapshot that is all available in the index-N blob - requiring only one
read!

In order to display this less verbose snapshot info appropriately, logic
was added to not display those fields which could not be populated.
However, this broke integrators (e.g. ECE) that required these fields to
be present, even if empty.  This commit is to return these fields in the
response, even if empty, if the verbose option is set.
@abeyad abeyad force-pushed the complete_snapshot_info branch from 5f638f9 to c148601 Compare June 28, 2017 20:19
@abeyad abeyad changed the title Output all SnapshotInfo fields in returned x-content Output all empty snapshot info fields if in verbose mode Jun 28, 2017
Copy link
Contributor

@imotov imotov left a comment

Choose a reason for hiding this comment

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

Left one comment regarding dealing with params. I think it can be simplified. Otherwise, LGTM.

new RestBuilderListener<GetSnapshotsResponse>(channel) {
@Override
public RestResponse buildResponse(GetSnapshotsResponse response, XContentBuilder builder) throws Exception {
Map<String, String> params = Collections.singletonMap("verbose", Boolean.toString(getSnapshotsRequest.verbose()));
Copy link
Contributor

@imotov imotov Jun 28, 2017

Choose a reason for hiding this comment

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

I don't think is necessary. request is passed asparams. So, "verbose" is already in params if it was specified, you just need to be careful resolving defaults. You would also miss other parameters here such as human and pretty.

@abeyad
Copy link
Author

abeyad commented Jun 28, 2017

I pushed 3d34d08 to address your comment. Thanks for the review @imotov!

@rjernst
Copy link
Member

rjernst commented Jun 28, 2017

I understand the reason for this remaining the "default" behavior in 5.x, so as not to break compatibility within a major, but we should still be able to remove this long term? As a followup can the shorter form be used when a url param is set, and that then become the default in 6.0?

@abeyad
Copy link
Author

abeyad commented Jun 28, 2017

@rjernst I had a discussion with @clintongormley about this a few weeks ago and thought maybe we should make the default verbose=false for 6.x, but didn't reach a decision at the time. @clintongormley what do you think?

@abeyad abeyad merged commit b18bfd6 into elastic:master Jun 28, 2017
@abeyad abeyad deleted the complete_snapshot_info branch June 28, 2017 22:38
abeyad pushed a commit that referenced this pull request Jun 28, 2017
In #24477, a less verbose option was added to retrieve snapshot info via
GET /_snapshot/{repo}/{snapshots}.  The point of adding this less
verbose option was so that if the repository is a cloud based one, and
there are many snapshots for which the snapshot info needed to be
retrieved, then each snapshot would require reading a separate snapshot
metadata file to pull out the necessary information.  This can be costly
(performance and cost) on cloud based repositories, so a less verbose
option was added that only retrieves very basic information about each
snapshot that is all available in the index-N blob - requiring only one
read!

In order to display this less verbose snapshot info appropriately, logic
was added to not display those fields which could not be populated.
However, this broke integrators (e.g. ECE) that required these fields to
be present, even if empty.  This commit is to return these fields in the
response, even if empty, if the verbose option is set.
abeyad pushed a commit that referenced this pull request Jun 28, 2017
In #24477, a less verbose option was added to retrieve snapshot info via
GET /_snapshot/{repo}/{snapshots}.  The point of adding this less
verbose option was so that if the repository is a cloud based one, and
there are many snapshots for which the snapshot info needed to be
retrieved, then each snapshot would require reading a separate snapshot
metadata file to pull out the necessary information.  This can be costly
(performance and cost) on cloud based repositories, so a less verbose
option was added that only retrieves very basic information about each
snapshot that is all available in the index-N blob - requiring only one
read!

In order to display this less verbose snapshot info appropriately, logic
was added to not display those fields which could not be populated.
However, this broke integrators (e.g. ECE) that required these fields to
be present, even if empty.  This commit is to return these fields in the
response, even if empty, if the verbose option is set.
@abeyad
Copy link
Author

abeyad commented Jun 28, 2017

5.x commit: 9501233
5.5 commit: 3afbafa

@clintongormley
Copy link
Contributor

thought maybe we should make the default verbose=false for 6.x, but didn't reach a decision at the time.

we could do this quite cleanly - if no verbose flag is specified, then we can emit a deprecation warning saying they should use verbose=true going forwards, then change the default in 6.0

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.

5 participants