HDDS-8858. Do not mix JSON output with hints.#4933
Conversation
|
@adoroszlai, Please help to review. Thanks |
|
As a general question - does the json output contain any hint that there are more records to retrieve? Eg, should it have a startKey and hasMore = true / false so that a program can page down the results? Also having a limit of 1 by default seems a bit strange - a default of 100 or something like that might be more useful. |
sodonnel
left a comment
There was a problem hiding this comment.
I believe this change makes sense - basically we are putting any help / warning text to stderr rather than stdout, which is generally the correct thing to do.
I think it would be nicer if the json was able to self describe better and give a hint that there are more records to consume. That way, a program could page through them more easily if needed, but that isn't really what this PR is for.
|
@sodonnel, Thanks for the review. does the json output contain any hint that there are more records to retrieve? Also having a limit of 1 by default seems a bit strange |
|
@sodonnel Agreed, such metadata in the JSON output would be nice, but that would mean changing the top-level list to a map, which is not backwards compatible. I hope we can make this change for 2.0.
Where do you see that default? The command in the description limits output to 1 item, but the default is 100 (in |
|
Ah, I just looked at the example output - didn't realize the default was not 1. Good to know its 100, as that is more sensible. |
|
Thanks @ashishkumar50 for the patch, @sodonnel for the review. |
What changes were proposed in this pull request?
We should avoid mixing JSON output with hints, which can lead to jq parse failure.
In this PR, In code where hints are printed with stdout is replaced by stderr.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-8858
How was this patch tested?
Verified in local cluster to see json/err redirection
$$ozone sh key list -l 1 o3://localhost:9862/vol11/ > a.txtListing first 1 entries of the result. Use --length (-l) to override max returned keys.