HBASE-20209 Do Not Use Both Map containsKey and get Methods in Replication Sink

Signed-off-by: Sean Busbey <busbey@apache.org>
This commit is contained in:
Beluga Behr 2019-01-16 09:18:58 -05:00 committed by Sean Busbey
parent 594341d6fe
commit 3e92cd5771
1 changed files with 3 additions and 5 deletions

View File

@ -279,13 +279,11 @@ public class ReplicationSink {
// Build hfile relative path from its namespace // Build hfile relative path from its namespace
String pathToHfileFromNS = getHFilePath(table, bld, storeFileList.get(k), family); String pathToHfileFromNS = getHFilePath(table, bld, storeFileList.get(k), family);
String tableName = table.getNameWithNamespaceInclAsString(); 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; boolean foundFamily = false;
for (int i = 0; i < familyHFilePathsList.size(); i++) { for (Pair<byte[], List<String>> familyHFilePathsPair : familyHFilePathsList) {
Pair<byte[], List<String>> familyHFilePathsPair = familyHFilePathsList.get(i);
if (Bytes.equals(familyHFilePathsPair.getFirst(), family)) { if (Bytes.equals(familyHFilePathsPair.getFirst(), family)) {
// Found family already present, just add the path to the existing list // Found family already present, just add the path to the existing list
familyHFilePathsPair.getSecond().add(pathToHfileFromNS); familyHFilePathsPair.getSecond().add(pathToHfileFromNS);