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

Make Recovery API support detailed params #29076

Merged
merged 7 commits into from
Jun 21, 2019
Merged

Conversation

PnPie
Copy link
Contributor

@PnPie PnPie commented Mar 14, 2018

Properly forward the detailed parameter to show extra details in the recovery stats.

Close #28910

@elasticmachine
Copy link
Collaborator

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

1 similar comment
@elasticmachine
Copy link
Collaborator

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

@nik9000 nik9000 added the :Distributed Indexing/Recovery Anything around constructing a new shard, either from a local or a remote source. label Mar 23, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed

Copy link
Contributor

@bleskes bleskes left a comment

Choose a reason for hiding this comment

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

Thx for picking this up. I left some comments

@@ -31,7 +31,7 @@
*/
public class RecoveryRequest extends BroadcastRequest<RecoveryRequest> {

private boolean detailed = false; // Provides extra details in the response
private boolean details = false; // Provides extra details in the response
Copy link
Contributor

Choose a reason for hiding this comment

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

can we remove this too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The details variable in RecoveryRequest ? It's to pass the details flag in Recovery API ? can we remove it ?

@@ -91,14 +82,14 @@ public void activeOnly(boolean activeOnly) {
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
out.writeBoolean(detailed);
out.writeBoolean(details);
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here I just changed the name of variable (to be the same as flag name), the value is always a boolean, so we don't need to do some bwc changes ?

@@ -39,7 +39,6 @@
*/
public class RecoveryResponse extends BroadcastResponse implements ToXContentFragment {

private boolean detailed = false;
Copy link
Member

Choose a reason for hiding this comment

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

wasn't this already removed in another PR? Maybe you need to merge master in?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I didn't merge master before.

Copy link
Contributor Author

@PnPie PnPie left a comment

Choose a reason for hiding this comment

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

Hello @bleskes @javanna I update it and added some comments.

@@ -31,7 +31,7 @@
*/
public class RecoveryRequest extends BroadcastRequest<RecoveryRequest> {

private boolean detailed = false; // Provides extra details in the response
private boolean details = false; // Provides extra details in the response
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The details variable in RecoveryRequest ? It's to pass the details flag in Recovery API ? can we remove it ?

@@ -91,14 +82,14 @@ public void activeOnly(boolean activeOnly) {
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
out.writeBoolean(detailed);
out.writeBoolean(details);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here I just changed the name of variable (to be the same as flag name), the value is always a boolean, so we don't need to do some bwc changes ?

@@ -39,7 +39,6 @@
*/
public class RecoveryResponse extends BroadcastResponse implements ToXContentFragment {

private boolean detailed = false;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I didn't merge master before.

@PnPie
Copy link
Contributor Author

PnPie commented Apr 4, 2018

Hello @javanna @bleskes, so as we discussed in the issue, I changed it back to detailed ?

@pcsanwald
Copy link
Contributor

@javanna @bleskes we discussed this in FixIt Thursday, any thoughts on what is best, here?

@ywelsch
Copy link
Contributor

ywelsch commented Mar 4, 2019

@javanna @bleskes ping

@javanna
Copy link
Member

javanna commented Mar 5, 2019

hi @PnPie sorry it took ages to get back to you. We have discussed this with the team and we think that we should rather change the code to expose detailed like the docs mention, rather than accepting details. This is more consistent with other API that already accept detailed. Would you be up for updating your PR and merging master in, or opening a new one given all the changes that went in meanwhile? Thanks!

@PnPie
Copy link
Contributor Author

PnPie commented Mar 7, 2019

Hi @javanna thanks for your reply and I'm sorry I just get occupied these days and I'll update it during this week-end ;)

@javanna
Copy link
Member

javanna commented Mar 7, 2019

no problem at all @PnPie we made you wait much longer than that ;)

@elasticcla
Copy link

Hi @PnPie, we have found your signature in our records, but it seems like you have signed with a different e-mail than the one used in yout Git commit. Can you please add both of these e-mails into your Github profile (they can be hidden), so we can match your e-mails to your Github profile?

@PnPie PnPie changed the title Make Recovery API support only details param Make Recovery API support only detailed param Mar 17, 2019
@PnPie PnPie changed the title Make Recovery API support only detailed param Make Recovery API support detailed params Mar 17, 2019
@PnPie
Copy link
Contributor Author

PnPie commented Mar 17, 2019

Hi @javanna I updated it and added a test case for RecoveryState, sorry for the slight delay :)

@ywelsch ywelsch self-requested a review March 19, 2019 11:58
@ywelsch
Copy link
Contributor

ywelsch commented Mar 19, 2019

@elasticmachine retest this please

Copy link
Contributor

@ywelsch ywelsch left a comment

Choose a reason for hiding this comment

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

Thanks for updating this @PnPie. I've left some comments. We should also update the REST spec (rest-api-spec/api/cat.recovery.json) to include this flag.

}
Copy link
Contributor

Choose a reason for hiding this comment

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

undo this change

@@ -343,7 +343,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
static final String REUSED = "reused";
static final String REUSED_IN_BYTES = "reused_in_bytes";
static final String PERCENT = "percent";
static final String DETAILS = "details";
static final String DETAILED = "detailed";
Copy link
Contributor

Choose a reason for hiding this comment

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

let's leave this field as is. "details" in the output is nicer, and we don't break existing parsers.

@@ -929,8 +929,8 @@ public synchronized XContentBuilder toXContent(XContentBuilder builder, Params p
builder.field(Fields.REUSED, reusedFileCount());
builder.field(Fields.RECOVERED, recoveredFileCount());
builder.field(Fields.PERCENT, String.format(Locale.ROOT, "%1.1f%%", recoveredFilesPercent()));
if (params.paramAsBoolean("details", false)) {
builder.startArray(Fields.DETAILS);
if (params.paramAsBoolean("detailed", false)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this is the only change that we need to do in this class


public class RecoveryStateTests extends ESTestCase {

public void testRecoveryStateIndexToXContent() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would prefer a REST test to show that the detailed flag is honoured (see rest-api-spec/test/cat.recovery/10_basic.yml). This test here is not needed.

@PnPie
Copy link
Contributor Author

PnPie commented Apr 6, 2019

Hi @ywelsch I updated the PR and added a rest layer test.

@ywelsch ywelsch self-requested a review June 17, 2019 09:05
@jakelandis jakelandis added v7.3.0 and removed v7.2.0 labels Jun 17, 2019
@ywelsch
Copy link
Contributor

ywelsch commented Jun 18, 2019

@elasticmachine update-branch

Copy link
Contributor

@ywelsch ywelsch left a comment

Choose a reason for hiding this comment

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

@PnPie sorry that I missed the ping here. Thank you for iterating with me on this. I think we will need to make the test conditional on the ES version that it will run against. I've started CI on this, and if necessary, can make the adjustment myself as well.

@@ -130,3 +130,25 @@
index: [v*]

- match: { $body: {} }
---
"Indices recovery test with detailed parameter":
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we will have to skip this test for versions that don't have this fix.

@ywelsch ywelsch self-requested a review June 18, 2019 09:05
@ywelsch
Copy link
Contributor

ywelsch commented Jun 20, 2019

@elasticmachine update-branch

@ywelsch
Copy link
Contributor

ywelsch commented Jun 20, 2019

@elasticmachine retest this please

@ywelsch
Copy link
Contributor

ywelsch commented Jun 20, 2019

@elasticmachine retest this please

@ywelsch
Copy link
Contributor

ywelsch commented Jun 20, 2019

@elasticmachine retest this please

@ywelsch
Copy link
Contributor

ywelsch commented Jun 20, 2019

@elasticmachine run elasticsearch-ci/1

@ywelsch ywelsch merged commit e8ea831 into elastic:master Jun 21, 2019
ywelsch pushed a commit that referenced this pull request Jun 21, 2019
Properly forwards the `detailed` parameter to show the recovery stats details.

Closes #28910
ywelsch added a commit that referenced this pull request Jun 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Distributed Indexing/Recovery Anything around constructing a new shard, either from a local or a remote source. v7.3.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Recovery API supports details param not detailed
10 participants