Source:
private static List<RegionInfo> createMetaEntries(final MasterServices masterServices, final List<RegionInfo> newRegionInfos) { final List<Either<List<RegionInfo>, IOException>> addMetaEntriesResults = newRegionInfos.stream() .map(regionInfo -> { try { TableDescriptor td = masterServices.getTableDescriptors().get(regionInfo.getTable()); List<RegionInfo> newRegions = RegionReplicaUtil.addReplicas(td, Collections.singletonList(regionInfo), 1, td.getRegionReplication()); MetaTableAccessor.addRegionsToMeta(masterServices.getConnection(), newRegions, td.getRegionReplication()); if (td.getRegionReplication() > 1) { ServerRegionReplicaUtil.setupRegionReplicaReplication( masterServices.getConfiguration()); } return Either.<List<RegionInfo>, IOException>ofLeft(newRegions); } catch (IOException e) { return Either.<List<RegionInfo>, IOException>ofRight(e); } }) .collect(Collectors.toList()); final List<RegionInfo> createMetaEntriesSuccesses = addMetaEntriesResults.stream() .filter(Either::hasLeft) .map(Either::getLeft) .flatMap(List::stream) .collect(Collectors.toList()); final List<IOException> createMetaEntriesFailures = addMetaEntriesResults.stream() .filter(Either::hasRight) .map(Either::getRight) .collect(Collectors.toList()); LOG.debug("Added {}/{} entries to hbase:meta", createMetaEntriesSuccesses.size(), newRegionInfos.size()); if (!createMetaEntriesFailures.isEmpty()) { LOG.warn("Failed to create entries in hbase:meta for {}/{} RegionInfo descriptors. First" + " failure message included; full list of failures with accompanying stack traces is" + " available at log level DEBUG. message={}", createMetaEntriesFailures.size(), addMetaEntriesResults.size(), createMetaEntriesFailures.get(0).getMessage()); if (LOG.isDebugEnabled()) { createMetaEntriesFailures.forEach( ioe -> LOG.debug("Attempt to fix region hole in hbase:meta failed.", ioe)); } } return createMetaEntriesSuccesses; }

Target:
private static List<RegionInfo> createMetaEntries(final MasterServices masterServices, final List<RegionInfo> newRegionInfos) { final List<Either<List<RegionInfo>, IOException>> addMetaEntriesResults = newRegionInfos. stream().map(regionInfo -> { try { TableDescriptor td = masterServices.getTableDescriptors().get(regionInfo.getTable()); List<RegionInfo> newRegions = RegionReplicaUtil.addReplicas( Collections.singletonList(regionInfo), 1, td.getRegionReplication()); MetaTableAccessor.addRegionsToMeta(masterServices.getConnection(), newRegions, td.getRegionReplication()); if (td.getRegionReplication() > 1) { ServerRegionReplicaUtil.setupRegionReplicaReplication( masterServices.getConfiguration()); } return Either.<List<RegionInfo>, IOException>ofLeft(newRegions); } catch (IOException e) { return Either.<List<RegionInfo>, IOException>ofRight(e); } }) .collect(Collectors.toList()); final List<RegionInfo> createMetaEntriesSuccesses = addMetaEntriesResults.stream() .filter(Either::hasLeft) .map(Either::getLeft) .flatMap(List::stream) .collect(Collectors.toList()); final List<IOException> createMetaEntriesFailures = addMetaEntriesResults.stream() .filter(Either::hasRight) .map(Either::getRight) .collect(Collectors.toList()); LOG.debug("Added {}/{} entries to hbase:meta", createMetaEntriesSuccesses.size(), newRegionInfos.size()); if (!createMetaEntriesFailures.isEmpty()) { LOG.warn("Failed to create entries in hbase:meta for {}/{} RegionInfo descriptors. First" + " failure message included; full list of failures with accompanying stack traces is" + " available at log level DEBUG. message={}", createMetaEntriesFailures.size(), addMetaEntriesResults.size(), createMetaEntriesFailures.get(0).getMessage()); if (LOG.isDebugEnabled()) { createMetaEntriesFailures.forEach( ioe -> LOG.debug("Attempt to fix region hole in hbase:meta failed.", ioe)); } } return createMetaEntriesSuccesses; }