This is an automated email from the ASF dual-hosted git repository.

zhangduo pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2 by this push:
     new 62d99b60226 HBASE-29686 Compatible issue of 
HFileOutputFormat2#configureRemoteCluster (#7415)
62d99b60226 is described below

commit 62d99b602260dab4edb51cda88bc7fc2a95d33b5
Author: mokai <[email protected]>
AuthorDate: Tue Nov 4 14:50:42 2025 +0800

    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]>
    (cherry picked from commit eae219812addbcc7a7b59b43df2cff18793f9f7d)
---
 .../hadoop/hbase/mapreduce/HFileOutputFormat2.java | 31 ++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)

diff --git 
a/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/HFileOutputFormat2.java
 
b/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/HFileOutputFormat2.java
index 594d03f9e9f..0a3dfbef3ff 100644
--- 
a/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/HFileOutputFormat2.java
+++ 
b/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/HFileOutputFormat2.java
@@ -23,6 +23,7 @@ import static 
org.apache.hadoop.hbase.regionserver.HStoreFile.EXCLUDE_FROM_MINOR
 import static 
org.apache.hadoop.hbase.regionserver.HStoreFile.MAJOR_COMPACTION_KEY;
 
 import java.io.IOException;
+import java.io.UncheckedIOException;
 import java.io.UnsupportedEncodingException;
 import java.net.InetSocketAddress;
 import java.net.URLDecoder;
@@ -623,7 +624,7 @@ public class HFileOutputFormat2 extends 
FileOutputFormat<ImmutableBytesWritable,
   public static void configureIncrementalLoad(Job job, Table table, 
RegionLocator regionLocator)
     throws IOException {
     configureIncrementalLoad(job, table.getDescriptor(), regionLocator);
-    configureRemoteCluster(job, table.getConfiguration());
+    configureForRemoteCluster(job, table.getConfiguration());
   }
 
   /**
@@ -811,8 +812,34 @@ public class HFileOutputFormat2 extends 
FileOutputFormat<ImmutableBytesWritable,
    * @see #REMOTE_CLUSTER_ZOOKEEPER_QUORUM_CONF_KEY
    * @see #REMOTE_CLUSTER_ZOOKEEPER_CLIENT_PORT_CONF_KEY
    * @see #REMOTE_CLUSTER_ZOOKEEPER_ZNODE_PARENT_CONF_KEY
+   * @deprecated As of release 2.6.4, this will be removed in HBase 4.0.0 Use
+   *             {@link #configureForRemoteCluster(Job, Configuration)} 
instead.
    */
-  public static void configureRemoteCluster(Job job, Configuration 
clusterConf) throws IOException {
+  @Deprecated
+  public static void configureRemoteCluster(Job job, Configuration 
clusterConf) {
+    try {
+      configureForRemoteCluster(job, clusterConf);
+    } catch (IOException e) {
+      LOG.error("Configure remote cluster error.", e);
+      throw new UncheckedIOException("Configure remote cluster error.", e);
+    }
+  }
+
+  /**
+   * Configure HBase cluster key for remote cluster to load region location 
for locality-sensitive
+   * if it's enabled. It's not necessary to call this method explicitly when 
the cluster key for
+   * HBase cluster to be used to load region location is configured in the job 
configuration. Call
+   * this method when another HBase cluster key is configured in the job 
configuration. For example,
+   * you should call when you load data from HBase cluster A using {@link 
TableInputFormat} and
+   * generate hfiles for HBase cluster B. Otherwise, HFileOutputFormat2 fetch 
location from cluster
+   * A and locality-sensitive won't working correctly. If authentication is 
enabled, it obtains the
+   * token for the specific cluster.
+   * @param job         which has configuration to be updated
+   * @param clusterConf which contains cluster key of the HBase cluster to be 
locality-sensitive
+   * @throws IOException Exception while initializing cluster credentials
+   */
+  public static void configureForRemoteCluster(Job job, Configuration 
clusterConf)
+    throws IOException {
     Configuration conf = job.getConfiguration();
 
     if (!conf.getBoolean(LOCALITY_SENSITIVE_CONF_KEY, 
DEFAULT_LOCALITY_SENSITIVE)) {

Reply via email to