-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Fix toString of class SnapshotStatus (#26851) #26852
Fix toString of class SnapshotStatus (#26851) #26852
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? |
@@ -162,9 +161,7 @@ public static SnapshotStatus readSnapshotStatus(StreamInput in) throws IOExcepti | |||
public String toString() { | |||
try { | |||
XContentBuilder builder = XContentFactory.jsonBuilder().prettyPrint(); | |||
builder.startObject(); |
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.
There's utility method that could replace all of this in org.elasticsearch.common.String
. I think toString(ToXContent toXContent, boolean pretty, boolean human)
can replace all of this methods code.
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 reviewing this.
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.
Hi @liketic, I left a short suggestion about making the toString() method shorter.
} catch (IOException e) { | ||
return "{ \"error\" : \"" + e.getMessage() + "\"}"; | ||
} | ||
return Strings.toString(this, true, true); |
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.
Since the original toString() method only used the pretty
printing option but not the 'human` option, could we keep that the same?
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.
Make sense. Thanks.
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.
@liketic looks good to me now, thanks again for picking this up. I will merge this to master and the 6.1 branch.
@elasticmachine test this please |
@@ -0,0 +1,89 @@ | |||
package org.elasticsearch.action.admin.cluster.snapshots.status; |
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 CI tests just complained about missing license headers for this new test file. Can you please copy over the header comments from any existing test to this one? Sorry I missed this during review.
@liketic sorry I missed it before, can you add our standard license headers to the new test file? |
@elasticmachine Test 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.
The new SnapshotStatusTests is still failing. Depending on which shardStage is picked, the output is different. Could you update the test to fix this? I think the randomization of the shardStage is a thing we want to keep.
@liketic thanks, I'll start another CI run |
No idea about why the testing is still failed... I can get success on my laptop but only sometimes... |
@liketic those failures look unrelated, however I'd like to have a clean build before merging this. Sometimes its the commit you branched from, would you mind rebasing this PR or merging in master again so we can see if we get a clean CI run? |
0c41110
to
2b7de1a
Compare
@cbuescher Rebase done. |
@elasticmachine lets test this again, shall we? |
@liketic finally a good test run, I merged this to master and 6.1. Thanks for this PR. |
@cbuescher finally, we got it... Thanks for your patient. |
* ccr: (42 commits) [DOCS] Added info about snapshotting your data before an upgrade. Add documentation about disabling `_field_names`. (elastic#26813) Remove UnsortedNumericDoubleValues (elastic#26817) Fix IndexOutOfBoundsException in histograms for NaN doubles (elastic#26787) (elastic#26856) [TEST] Added skipping the `headers` feature to the Bulk REST YAML test Update type-field.asciidoc Fix search_after with geo distance sorting (elastic#26891) Use proper logging placeholder for Netty logging Add Netty channel information on write and flush failure Remove deploying in JBoss documentation Document JVM option MaxFDLimit for macOS () Add additional low-level logging handler () Unwrap causes when maybe dying Change log level on write and flush failure to warn [TEST] add test to ensure legacy list syntax in yml works fine Bump BWC version for settings serialization to 6.1.0 Removed void token filter entries and added two tests Added Bengali Analyzer to Elasticsearch with respect to the lucene update(PR#238) Fix toString() in SnapshotStatus (elastic#26852) elastic#26870 change bwc version for fuzzy_transpositions to 6.1 after backport ...
* ccr: (110 commits) Use LF line endings in Painless generated files (elastic#26822) [DOCS] Added info about snapshotting your data before an upgrade. Add documentation about disabling `_field_names`. (elastic#26813) Remove UnsortedNumericDoubleValues (elastic#26817) Fix IndexOutOfBoundsException in histograms for NaN doubles (elastic#26787) (elastic#26856) [TEST] Added skipping the `headers` feature to the Bulk REST YAML test Update type-field.asciidoc Fix search_after with geo distance sorting (elastic#26891) Use proper logging placeholder for Netty logging Add Netty channel information on write and flush failure Remove deploying in JBoss documentation Document JVM option MaxFDLimit for macOS () Add additional low-level logging handler () Unwrap causes when maybe dying Change log level on write and flush failure to warn [TEST] add test to ensure legacy list syntax in yml works fine Bump BWC version for settings serialization to 6.1.0 Removed void token filter entries and added two tests Added Bengali Analyzer to Elasticsearch with respect to the lucene update(PR#238) Fix toString() in SnapshotStatus (elastic#26852) ...
Fixes #26851