From 3e92cd5771d20ee3bd60049ddb6d14c7fff3a647 Mon Sep 17 00:00:00 2001 From: Beluga Behr Date: Wed, 16 Jan 2019 09:18:58 -0500 Subject: [PATCH] HBASE-20209 Do Not Use Both Map containsKey and get Methods in Replication Sink Signed-off-by: Sean Busbey --- .../hbase/replication/regionserver/ReplicationSink.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSink.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSink.java index a334b16df85..3cd928ac778 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSink.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSink.java @@ -279,13 +279,11 @@ public class ReplicationSink { // Build hfile relative path from its namespace String pathToHfileFromNS = getHFilePath(table, bld, storeFileList.get(k), family); - String tableName = table.getNameWithNamespaceInclAsString(); - if (bulkLoadHFileMap.containsKey(tableName)) { - List>> familyHFilePathsList = bulkLoadHFileMap.get(tableName); + List>> familyHFilePathsList = bulkLoadHFileMap.get(tableName); + if (familyHFilePathsList != null) { boolean foundFamily = false; - for (int i = 0; i < familyHFilePathsList.size(); i++) { - Pair> familyHFilePathsPair = familyHFilePathsList.get(i); + for (Pair> familyHFilePathsPair : familyHFilePathsList) { if (Bytes.equals(familyHFilePathsPair.getFirst(), family)) { // Found family already present, just add the path to the existing list familyHFilePathsPair.getSecond().add(pathToHfileFromNS);