|
23 | 23 | import static org.apache.hadoop.hbase.regionserver.HStoreFile.MAJOR_COMPACTION_KEY; |
24 | 24 |
|
25 | 25 | import java.io.IOException; |
| 26 | +import java.io.UncheckedIOException; |
26 | 27 | import java.io.UnsupportedEncodingException; |
27 | 28 | import java.net.InetSocketAddress; |
28 | 29 | import java.net.URLDecoder; |
@@ -590,7 +591,7 @@ private static void writePartitions(Configuration conf, Path partitionsPath, |
590 | 591 | public static void configureIncrementalLoad(Job job, Table table, RegionLocator regionLocator) |
591 | 592 | throws IOException { |
592 | 593 | configureIncrementalLoad(job, table.getDescriptor(), regionLocator); |
593 | | - configureRemoteCluster(job, table.getConfiguration()); |
| 594 | + configureForRemoteCluster(job, table.getConfiguration()); |
594 | 595 | } |
595 | 596 |
|
596 | 597 | /** |
@@ -776,8 +777,34 @@ public static void configureIncrementalLoadMap(Job job, TableDescriptor tableDes |
776 | 777 | * @see #REMOTE_CLUSTER_ZOOKEEPER_QUORUM_CONF_KEY |
777 | 778 | * @see #REMOTE_CLUSTER_ZOOKEEPER_CLIENT_PORT_CONF_KEY |
778 | 779 | * @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. |
779 | 782 | */ |
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 { |
781 | 808 | Configuration conf = job.getConfiguration(); |
782 | 809 |
|
783 | 810 | if (!conf.getBoolean(LOCALITY_SENSITIVE_CONF_KEY, DEFAULT_LOCALITY_SENSITIVE)) { |
|
0 commit comments