[
https://issues.apache.org/jira/browse/HBASE-20209?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16744726#comment-16744726
]
Hudson commented on HBASE-20209:
--------------------------------
Results for branch master
[build #725 on
builds.a.o|https://builds.apache.org/job/HBase%20Nightly/job/master/725/]: (x)
*{color:red}-1 overall{color}*
----
details (if available):
(/) {color:green}+1 general checks{color}
-- For more information [see general
report|https://builds.apache.org/job/HBase%20Nightly/job/master/725//General_Nightly_Build_Report/]
(x) {color:red}-1 jdk8 hadoop2 checks{color}
-- For more information [see jdk8 (hadoop2)
report|https://builds.apache.org/job/HBase%20Nightly/job/master/725//JDK8_Nightly_Build_Report_(Hadoop2)/]
(x) {color:red}-1 jdk8 hadoop3 checks{color}
-- For more information [see jdk8 (hadoop3)
report|https://builds.apache.org/job/HBase%20Nightly/job/master/725//JDK8_Nightly_Build_Report_(Hadoop3)/]
(/) {color:green}+1 source release artifact{color}
-- See build output for details.
(/) {color:green}+1 client integration test{color}
> Do Not Use Both Map containsKey and get Methods in Replication Sink
> -------------------------------------------------------------------
>
> Key: HBASE-20209
> URL: https://issues.apache.org/jira/browse/HBASE-20209
> Project: HBase
> Issue Type: Improvement
> Components: Replication
> Affects Versions: 2.0.0
> Reporter: BELUGA BEHR
> Assignee: BELUGA BEHR
> Priority: Trivial
> Fix For: 3.0.0, 1.5.0, 2.2.0
>
> Attachments: HBASE-20209.1.patch, HBASE-20209.2.patch,
> HBASE-20209.3.patch, HBASE-20209.4.patch
>
>
> {code:title=ReplicationSink.java}
> String tableName = table.getNameWithNamespaceInclAsString();
> if (bulkLoadHFileMap.containsKey(tableName)) {
> List<Pair<byte[], List<String>>> familyHFilePathsList =
> bulkLoadHFileMap.get(tableName);
> boolean foundFamily = false;
> for (int i = 0; i < familyHFilePathsList.size(); i++) {
> Pair<byte[], List<String>> familyHFilePathsPair =
> familyHFilePathsList.get(i);
> if (Bytes.equals(familyHFilePathsPair.getFirst(), family)) {
> // Found family already present, just add the path to the
> existing list
> familyHFilePathsPair.getSecond().add(pathToHfileFromNS);
> foundFamily = true;
> break;
> }
> }
> {code}
> I propose that this code does not use the Map methods _containsKey_ *and*
> _get_. Simply use the _get_ method once and check a _null_ return value to
> check for existence. Saves a trip to the Map data structure for each call.
> Also, use enhanced for loop.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)