diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/namequeues/impl/SlowLogQueueService.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/namequeues/impl/SlowLogQueueService.java index 9072f4294894..62e4c5d96696 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/namequeues/impl/SlowLogQueueService.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/namequeues/impl/SlowLogQueueService.java @@ -185,6 +185,9 @@ public void consumeEventFromDisruptor(NamedQueuePayload namedQueuePayload) { private static Collection buildNameBytesPairs(Map attributes) { + if (attributes == null) { + return Collections.emptySet(); + } return attributes.entrySet().stream().map(attr -> HBaseProtos.NameBytesPair.newBuilder() .setName(attr.getKey()).setValue(ByteString.copyFrom(attr.getValue())).build()) .collect(Collectors.toSet()); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/namequeues/TestNamedQueueRecorder.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/namequeues/TestNamedQueueRecorder.java index 1cd6b03f20c6..af6c51260fd5 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/namequeues/TestNamedQueueRecorder.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/namequeues/TestNamedQueueRecorder.java @@ -756,20 +756,19 @@ public long getSize() { @Override public RPCProtos.RequestHeader getHeader() { - RPCProtos.RequestHeader.Builder builder = RPCProtos.RequestHeader.newBuilder(); - REQUEST_HEADERS.forEach(builder::addAttribute); - return builder.build(); + return null; } @Override public Map getConnectionAttributes() { - return CONNECTION_HEADERS.stream().collect(Collectors.toMap( - nameBytesPair -> nameBytesPair.getName(), nameBytesPair -> nameBytesPair.toByteArray())); + return CONNECTION_HEADERS.stream().collect(Collectors + .toMap(HBaseProtos.NameBytesPair::getName, pair -> pair.getValue().toByteArray())); } @Override public Map getRequestAttributes() { - return null; + return REQUEST_HEADERS.stream().collect(Collectors.toMap(HBaseProtos.NameBytesPair::getName, + pair -> pair.getValue().toByteArray())); } @Override