[ 
https://issues.apache.org/jira/browse/HBASE-18106?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16062144#comment-16062144
 ] 

stack commented on HBASE-18106:
-------------------------------

(Copied from HBASE-18240 where we add protobuf-util which can JSON-ify pb)

The JsonFormatter in protobuf-util is basic but should do the job. Here is 
output:

kalashnikov:hbase.git stack$ ./bin/hbase 
org.apache.hadoop.hbase.procedure2.TestProcedureUtil
{ "className": 
"org.apache.hadoop.hbase.procedure2.ProcedureTestingUtility$TestProcedure", 
"procId": "10", "submittedTime": "1498339510660", "state": "RUNNABLE", 
"lastUpdate": "1498339510660", "stateData": "AA==" }

adding this main on TestProcedureUtil:

public static void main(final String [] args) throws Exception
{ final TestProcedure proc1 = new TestProcedure(10); final 
ProcedureProtos.Procedure proto1 = 
ProcedureUtil.convertToProtoProcedure(proc1); JsonFormat.Printer printer = 
JsonFormat.printer().omittingInsignificantWhitespace(); 
System.out.println(printer.print(proto1)); }

For display in UI, could style the JSON and filter out state data.
For shell, could do simple one-lining (and purge state data... since it opaque. 
Later we might add Stringification..)

> Redo ProcedureInfo and LockInfo
> -------------------------------
>
>                 Key: HBASE-18106
>                 URL: https://issues.apache.org/jira/browse/HBASE-18106
>             Project: HBase
>          Issue Type: Sub-task
>          Components: proc-v2
>    Affects Versions: 2.0.0
>            Reporter: stack
>             Fix For: 2.0.0
>
>
> ProcedureInfo was introduced as a lowest-common-denominator POJO that could 
> be used as a facade on PB Procedures. It was good for showing state of 
> Procedure framework in shell and UI.
> Its a bit weird though. Its up in hbase-common rather than in Procedure and 
> it can only ever show a subset of the Procedure info.
> I was thinking we could use the pb3.1 pb->JSON utility instead and emit a 
> JSON String wherever we need to export a view on procedure internals.
> This issue is about exploring this possibility. Would depend on our having an 
> upgraded guava (so probably depends on the 'pre-build' project).
> From ProcedureInfo and LockInfo need fixing in 
> https://docs.google.com/document/d/1eVKa7FHdeoJ1-9o8yZcOTAQbv0u0bblBlCCzVSIn69g/edit#heading=h.kid1jzo114xw



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to