You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by bu...@apache.org on 2019/01/16 22:22:52 UTC

[hbase] branch branch-1 updated: HBASE-20209 Do Not Use Both Map containsKey and get Methods in Replication Sink

This is an automated email from the ASF dual-hosted git repository.

busbey pushed a commit to branch branch-1
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-1 by this push:
     new 0315c2d  HBASE-20209 Do Not Use Both Map containsKey and get Methods in Replication Sink
0315c2d is described below

commit 0315c2d65d76698951a98082a30c57d56c881886
Author: Beluga Behr <da...@gmail.com>
AuthorDate: Wed Jan 16 09:18:58 2019 -0500

    HBASE-20209 Do Not Use Both Map containsKey and get Methods in Replication Sink
    
    Signed-off-by: Sean Busbey <bu...@apache.org>
    (cherry picked from commit 3e92cd5771d20ee3bd60049ddb6d14c7fff3a647)
---
 .../hadoop/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 30d25c1..30c7b0b 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
@@ -249,13 +249,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<Pair<byte[], List<String>>> familyHFilePathsList = bulkLoadHFileMap.get(tableName);
+        List<Pair<byte[], List<String>>> familyHFilePathsList = bulkLoadHFileMap.get(tableName);
+        if (familyHFilePathsList != null) {
           boolean foundFamily = false;
-          for (int i = 0; i < familyHFilePathsList.size(); i++) {
-            Pair<byte[], List<String>> familyHFilePathsPair = familyHFilePathsList.get(i);
+          for (Pair<byte[], List<String>> familyHFilePathsPair :  familyHFilePathsList) {
             if (Bytes.equals(familyHFilePathsPair.getFirst(), family)) {
               // Found family already present, just add the path to the existing list
               familyHFilePathsPair.getSecond().add(pathToHfileFromNS);