Skip to content

Commit eae2198

Browse files
authored
HBASE-29686 Compatible issue of HFileOutputFormat2#configureRemoteCluster (#7415)
Signed-off-by: Duo Zhang <[email protected]> Signed-off-by: Junegunn Choi <[email protected]> Signed-off-by: Pankaj Kumar <[email protected]> Reviewed-by: chaijunjie0101 <[email protected]>
1 parent bc54a7e commit eae2198

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/HFileOutputFormat2.java

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import static org.apache.hadoop.hbase.regionserver.HStoreFile.MAJOR_COMPACTION_KEY;
2424

2525
import java.io.IOException;
26+
import java.io.UncheckedIOException;
2627
import java.io.UnsupportedEncodingException;
2728
import java.net.InetSocketAddress;
2829
import java.net.URLDecoder;
@@ -590,7 +591,7 @@ private static void writePartitions(Configuration conf, Path partitionsPath,
590591
public static void configureIncrementalLoad(Job job, Table table, RegionLocator regionLocator)
591592
throws IOException {
592593
configureIncrementalLoad(job, table.getDescriptor(), regionLocator);
593-
configureRemoteCluster(job, table.getConfiguration());
594+
configureForRemoteCluster(job, table.getConfiguration());
594595
}
595596

596597
/**
@@ -776,8 +777,34 @@ public static void configureIncrementalLoadMap(Job job, TableDescriptor tableDes
776777
* @see #REMOTE_CLUSTER_ZOOKEEPER_QUORUM_CONF_KEY
777778
* @see #REMOTE_CLUSTER_ZOOKEEPER_CLIENT_PORT_CONF_KEY
778779
* @see #REMOTE_CLUSTER_ZOOKEEPER_ZNODE_PARENT_CONF_KEY
780+
* @deprecated As of release 2.6.4, this will be removed in HBase 4.0.0 Use
781+
* {@link #configureForRemoteCluster(Job, Configuration)} instead.
779782
*/
780-
public static void configureRemoteCluster(Job job, Configuration clusterConf) throws IOException {
783+
@Deprecated
784+
public static void configureRemoteCluster(Job job, Configuration clusterConf) {
785+
try {
786+
configureForRemoteCluster(job, clusterConf);
787+
} catch (IOException e) {
788+
LOG.error("Configure remote cluster error.", e);
789+
throw new UncheckedIOException("Configure remote cluster error.", e);
790+
}
791+
}
792+
793+
/**
794+
* Configure HBase cluster key for remote cluster to load region location for locality-sensitive
795+
* if it's enabled. It's not necessary to call this method explicitly when the cluster key for
796+
* HBase cluster to be used to load region location is configured in the job configuration. Call
797+
* this method when another HBase cluster key is configured in the job configuration. For example,
798+
* you should call when you load data from HBase cluster A using {@link TableInputFormat} and
799+
* generate hfiles for HBase cluster B. Otherwise, HFileOutputFormat2 fetch location from cluster
800+
* A and locality-sensitive won't working correctly. If authentication is enabled, it obtains the
801+
* token for the specific cluster.
802+
* @param job which has configuration to be updated
803+
* @param clusterConf which contains cluster key of the HBase cluster to be locality-sensitive
804+
* @throws IOException Exception while initializing cluster credentials
805+
*/
806+
public static void configureForRemoteCluster(Job job, Configuration clusterConf)
807+
throws IOException {
781808
Configuration conf = job.getConfiguration();
782809

783810
if (!conf.getBoolean(LOCALITY_SENSITIVE_CONF_KEY, DEFAULT_LOCALITY_SENSITIVE)) {

0 commit comments

Comments
 (0)