From 1616d2e2da6c1c6cb7776bbb8e7731b76387f9ef Mon Sep 17 00:00:00 2001 From: Ray Mattingly Date: Mon, 31 Jul 2023 11:23:15 -0400 Subject: [PATCH] rsOperationDetails UI fixes --- .../apache/hadoop/hbase/client/OnlineLogRecord.java | 2 +- .../hadoop/hbase/shaded/protobuf/ProtobufUtil.java | 9 +++++++++ .../hbase-webapps/regionserver/rsOperationDetails.jsp | 10 +++++----- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/OnlineLogRecord.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/OnlineLogRecord.java index 5ac20d04036f..fd1cd89160d5 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/OnlineLogRecord.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/OnlineLogRecord.java @@ -378,7 +378,7 @@ public String toString() { .append("connectionAttributes", connectionAttributes).toString(); } - public static Map deserializeAttributes(Map attributes) { + private static Map deserializeAttributes(Map attributes) { return attributes.entrySet().stream().collect( Collectors.toMap(Map.Entry::getKey, entry -> Bytes.toStringBinary(entry.getValue()))); } diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java index 0b1609153dcd..84b3cfee2dd5 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java @@ -2196,6 +2196,15 @@ public static SlowLogParams getSlowLogParams(Message message, boolean slowLogSca return new SlowLogParams(params); } + public static Map deserializeAttributes(List attributes) { + return deserializeAttributes(convertNameBytesPairsToMap(attributes)); + } + + public static Map deserializeAttributes(Map attributes) { + return attributes.entrySet().stream().collect( + Collectors.toMap(Map.Entry::getKey, entry -> Bytes.toStringBinary(entry.getValue()))); + } + /** * Print out some subset of a MutationProto rather than all of it and its data * @param proto Protobuf to print out diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/rsOperationDetails.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/rsOperationDetails.jsp index 9225dd202a8f..bf9f84a7f436 100644 --- a/hbase-server/src/main/resources/hbase-webapps/regionserver/rsOperationDetails.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/rsOperationDetails.jsp @@ -25,8 +25,8 @@ import="org.apache.hadoop.util.StringUtils" import="org.apache.hadoop.hbase.regionserver.HRegionServer" import="org.apache.hadoop.hbase.HConstants" - import="org.apache.hadoop.hbase.client.OnlineLogRecord.deserializeAttributes" import="org.apache.hadoop.hbase.shaded.protobuf.generated.TooSlowLog" + import="org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil" import="org.apache.hadoop.hbase.namequeues.NamedQueueRecorder" import="org.apache.hadoop.hbase.namequeues.RpcLogDetails" import="org.apache.hadoop.hbase.namequeues.request.NamedQueueGetRequest" @@ -130,8 +130,8 @@ <%=r.getMultiServiceCalls()%> <%=r.getCallDetails()%> <%=r.getParam()%> - <%=deserializeAttributes(r.getRequestAttributes())%> - <%=deserializeAttributes(r.getConnectionAttributes())%> + <%=ProtobufUtil.deserializeAttributes(r.getRequestAttributeList())%> + <%=ProtobufUtil.deserializeAttributes(r.getConnectionAttributeList())%> <% } %> <% } %> @@ -177,8 +177,8 @@ <%=r.getMultiServiceCalls()%> <%=r.getCallDetails()%> <%=r.getParam()%> - <%=deserializeAttributes(r.getRequestAttributes())%> - <%=deserializeAttributes(r.getConnectionAttributes())%> + <%=ProtobufUtil.deserializeAttributes(r.getRequestAttributeList())%> + <%=ProtobufUtil.deserializeAttributes(r.getConnectionAttributeList())%> <% } %> <% } %>