|
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; |
@@ -622,7 +623,7 @@ private static void writePartitions(Configuration conf, Path partitionsPath, |
622 | 623 | public static void configureIncrementalLoad(Job job, Table table, RegionLocator regionLocator) |
623 | 624 | throws IOException { |
624 | 625 | configureIncrementalLoad(job, table.getDescriptor(), regionLocator); |
625 | | - configureRemoteCluster(job, table.getConfiguration()); |
| 626 | + configureForRemoteCluster(job, table.getConfiguration()); |
626 | 627 | } |
627 | 628 |
|
628 | 629 | /** |
@@ -810,8 +811,34 @@ public static void configureIncrementalLoadMap(Job job, TableDescriptor tableDes |
810 | 811 | * @see #REMOTE_CLUSTER_ZOOKEEPER_QUORUM_CONF_KEY |
811 | 812 | * @see #REMOTE_CLUSTER_ZOOKEEPER_CLIENT_PORT_CONF_KEY |
812 | 813 | * @see #REMOTE_CLUSTER_ZOOKEEPER_ZNODE_PARENT_CONF_KEY |
| 814 | + * @deprecated As of release 2.6.4, this will be removed in HBase 4.0.0 Use |
| 815 | + * {@link #configureForRemoteCluster(Job, Configuration)} instead. |
813 | 816 | */ |
814 | | - public static void configureRemoteCluster(Job job, Configuration clusterConf) throws IOException { |
| 817 | + @Deprecated |
| 818 | + public static void configureRemoteCluster(Job job, Configuration clusterConf) { |
| 819 | + try { |
| 820 | + configureForRemoteCluster(job, clusterConf); |
| 821 | + } catch (IOException e) { |
| 822 | + LOG.error("Configure remote cluster error.", e); |
| 823 | + throw new UncheckedIOException("Configure remote cluster error.", e); |
| 824 | + } |
| 825 | + } |
| 826 | + |
| 827 | + /** |
| 828 | + * Configure HBase cluster key for remote cluster to load region location for locality-sensitive |
| 829 | + * if it's enabled. It's not necessary to call this method explicitly when the cluster key for |
| 830 | + * HBase cluster to be used to load region location is configured in the job configuration. Call |
| 831 | + * this method when another HBase cluster key is configured in the job configuration. For example, |
| 832 | + * you should call when you load data from HBase cluster A using {@link TableInputFormat} and |
| 833 | + * generate hfiles for HBase cluster B. Otherwise, HFileOutputFormat2 fetch location from cluster |
| 834 | + * A and locality-sensitive won't working correctly. If authentication is enabled, it obtains the |
| 835 | + * token for the specific cluster. |
| 836 | + * @param job which has configuration to be updated |
| 837 | + * @param clusterConf which contains cluster key of the HBase cluster to be locality-sensitive |
| 838 | + * @throws IOException Exception while initializing cluster credentials |
| 839 | + */ |
| 840 | + public static void configureForRemoteCluster(Job job, Configuration clusterConf) |
| 841 | + throws IOException { |
815 | 842 | Configuration conf = job.getConfiguration(); |
816 | 843 |
|
817 | 844 | if (!conf.getBoolean(LOCALITY_SENSITIVE_CONF_KEY, DEFAULT_LOCALITY_SENSITIVE)) { |
|
0 commit comments