-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Conversation
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
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? |
Pinging @elastic/es-distributed |
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.
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 |
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 remove this too?
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.
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); |
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.
when you remove this, watch out for BWC aspects - see https://github.com/elastic/elasticsearch/blob/master/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/GetStoredScriptRequest.java#L59 as an example.
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.
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; |
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.
wasn't this already removed in another PR? Maybe you need to merge master in?
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.
Yes, I didn't merge master before.
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.
@@ -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 |
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.
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); |
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.
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; |
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.
Yes, I didn't merge master before.
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 |
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 ;) |
no problem at all @PnPie we made you wait much longer than that ;) |
details
paramdetailed
param
detailed
paramdetailed
params
Hi @javanna I updated it and added a test case for |
@elasticmachine retest this please |
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 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.
} |
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.
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"; |
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 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)) { |
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 is the only change that we need to do in this class
|
||
public class RecoveryStateTests extends ESTestCase { | ||
|
||
public void testRecoveryStateIndexToXContent() { |
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.
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.
Hi @ywelsch I updated the PR and added a rest layer test. |
@elasticmachine update-branch |
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.
@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": |
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.
I think we will have to skip this test for versions that don't have this fix.
@elasticmachine update-branch |
@elasticmachine retest this please |
@elasticmachine retest this please |
@elasticmachine retest this please |
@elasticmachine run elasticsearch-ci/1 |
Properly forward the
detailed
parameter to show extradetails
in the recovery stats.Close #28910