[
https://issues.apache.org/jira/browse/HADOOP-11308?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14233553#comment-14233553
]
Benoy Antony edited comment on HADOOP-11308 at 12/5/14 3:45 AM:
----------------------------------------------------------------
[~wheat9],
This was done to address the requirement mentioned in
https://issues.apache.org/jira/browse/HDFS-7390?focusedCommentId=14211474&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14211474
Without this change, the flow in the specific case was like this :
1) FSNamesystem.getTieredStorageStats() outputs a properly formatted JSON
object as string.
The JSON at this point satisfies the requirement mentioned in
https://issues.apache.org/jira/browse/HDFS-7390?focusedCommentId=14211474&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14211474
2) But _JMXJsonServlet_ converts the above JSON object representation to
another JSON string. So there is double transformation, which causes the issue
that was pointed out in
https://issues.apache.org/jira/browse/HDFS-7390?focusedCommentId=14211474&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14211474
To avoid this double transformation, I needed a way to signal _JMXJsonServlet_
that the string is already in JSON format so that _JMXJsonServlet_ can output
it without any transformation. That's why _JsonString_ was introduced.
{quote}
what if the string is malformed?
{quote}
Since output from FSNamesystem.getTieredStorageStats() is already in JSON
format, there will not be a case of malformed string. Basically its the
responsibility of producer of _JsonString_ to make sure its well formed JSON.
{quote}
what will the remote JMX port will get ?
{quote}
Do you mean the consumer of the JMX output ? They will get the output
specified in
https://issues.apache.org/jira/browse/HDFS-7390?focusedCommentId=14211474&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14211474
was (Author: benoyantony):
[~wheat9],
This was done to address the requirement mentioned in
https://issues.apache.org/jira/browse/HDFS-7390?focusedCommentId=14211474&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14211474
Without this change, the flow in the specific case was like this :
1) FSNamesystem.getTieredStorageStats() outputs a properly formatted JSON
object as string.
The JSON at this point satisfies the requirement mentioned in
https://issues.apache.org/jira/browse/HDFS-7390?focusedCommentId=14211474&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14211474
2) But _JMXJsonServlet_ converts the above JSON object representation to
another JSON string. So there is double transformation, which causes the issue
that was pointed out in
https://issues.apache.org/jira/browse/HDFS-7390?focusedCommentId=14211474&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14211474
To avoid this double transformation, I needed a way to signal _JMXJsonServlet_
that the string is already in JSON format so that _JMXJsonServlet_ can output
it without any transformation. That's why _JsonString_ was introduced.
{quote}
what if the string is malformed?
{quote}
Since output from FSNamesystem.getTieredStorageStats() is already in JSON
format, there will not be a case of malformed string. Basically the its the
responsibility of producer of _JsonString_ to make sure its well formed JSON.
{quote}
what will the remote JMX port will get ?
{quote}
Do you mean the consumer of the JMX output ? They will get the output
specified in
https://issues.apache.org/jira/browse/HDFS-7390?focusedCommentId=14211474&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14211474
> Enable JMX to directly output JSON objects instead JSON strings
> ---------------------------------------------------------------
>
> Key: HADOOP-11308
> URL: https://issues.apache.org/jira/browse/HADOOP-11308
> Project: Hadoop Common
> Issue Type: Improvement
> Affects Versions: 2.5.1
> Reporter: Benoy Antony
> Assignee: Benoy Antony
> Attachments: HADOOP-11308.patch, HADOOP-11308.patch
>
>
> Currently many JMX beans provide Json content as strings.
> JMXJsonServlet outputs these as Json Strings. This also results in losing
> the original Json object structure.
> An example is given below:
> {code}
> "TieredStorageStats" :
> "{\"ARCHIVE\":{\"capacityTotal\":1498254102528,\"capacityUsed\":12288,\"capacityRemaining\":980102602752,\"blockPoolUsed\":12288,\"nodesInService\":3,\"numBlocks\":0}...
> {code}
> {code}
> "TieredStorageStats" :
> {"ARCHIVE":{"capacityTotal":1498254102528,"capacityUsed":12288,"capacityRemaining":980102602752,"blockPoolUsed":12288,"nodesInService":3,"numBlocks":0}...
> {code}
> In the former output {{TieredStorageStats}} maps to a JSON string while in
> the latter one it maps to a JSON object.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)