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

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

commit 83955a7ee00312bdc325ec251b15f68628289b4d
Author: Duo Zhang <[email protected]>
AuthorDate: Thu Aug 14 10:00:26 2025 +0800

    HBASE-29514 Remove deprecated fields in SimpleTotalOrderPartitioner (#7218)
    
    Signed-off-by: Nihal Jain <[email protected]>
    Signed-off-by: Dávid Paksy <[email protected]>
    (cherry picked from commit 95e304d0e9f13270bd51fb73f20be55951669aae)
---
 .../mapreduce/SimpleTotalOrderPartitioner.java     | 48 ++++++----------------
 .../mapreduce/TestSimpleTotalOrderPartitioner.java |  8 +++-
 2 files changed, 18 insertions(+), 38 deletions(-)

diff --git 
a/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/SimpleTotalOrderPartitioner.java
 
b/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/SimpleTotalOrderPartitioner.java
index d9dfeaa6a03..95d995450a9 100644
--- 
a/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/SimpleTotalOrderPartitioner.java
+++ 
b/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/SimpleTotalOrderPartitioner.java
@@ -29,36 +29,20 @@ import org.slf4j.LoggerFactory;
 
 /**
  * A partitioner that takes start and end keys and uses bigdecimal to figure 
which reduce a key
- * belongs to. Pass the start and end keys in the Configuration using
- * <code>hbase.simpletotalorder.start</code> and 
<code>hbase.simpletotalorder.end</code>. The end
- * key needs to be exclusive; i.e. one larger than the biggest key in your key 
space. You may be
- * surprised at how this class partitions the space; it may not align with 
preconceptions; e.g. a
- * start key of zero and an end key of 100 divided in ten will not make 
regions whose range is 0-10,
- * 10-20, and so on. Make your own partitioner if you need the region spacing 
to come out a
- * particular way.
- * @param <VALUE>
- * @see #START
- * @see #END
+ * belongs to. Pass the start and end keys in the Configuration using {@value 
#START_BASE64} and
+ * {@value #END_BASE64}. The end key needs to be exclusive; i.e. one larger 
than the biggest key in
+ * your key space. You may be surprised at how this class partitions the 
space; it may not align
+ * with preconceptions; e.g. a start key of zero and an end key of 100 divided 
in ten will not make
+ * regions whose range is 0-10, 10-20, and so on. Make your own partitioner if 
you need the region
+ * spacing to come out a particular way.
+ * @see #START_BASE64
+ * @see #END_BASE64
  */
 @InterfaceAudience.Public
 public class SimpleTotalOrderPartitioner<VALUE> extends 
Partitioner<ImmutableBytesWritable, VALUE>
   implements Configurable {
   private final static Logger LOG = 
LoggerFactory.getLogger(SimpleTotalOrderPartitioner.class);
 
-  /**
-   * @deprecated since 0.90.0
-   * @see <a 
href="https://issues.apache.org/jira/browse/HBASE-1923";>HBASE-1923</a>
-   */
-  @Deprecated
-  public static final String START = "hbase.simpletotalorder.start";
-
-  /**
-   * @deprecated since 0.90.0
-   * @see <a 
href="https://issues.apache.org/jira/browse/HBASE-1923";>HBASE-1923</a>
-   */
-  @Deprecated
-  public static final String END = "hbase.simpletotalorder.end";
-
   static final String START_BASE64 = "hbase.simpletotalorder.start.base64";
   static final String END_BASE64 = "hbase.simpletotalorder.end.base64";
 
@@ -76,28 +60,20 @@ public class SimpleTotalOrderPartitioner<VALUE> extends 
Partitioner<ImmutableByt
     conf.set(END_BASE64, Bytes.toString(Base64.getEncoder().encode(endKey)));
   }
 
-  @SuppressWarnings("deprecation")
   static byte[] getStartKey(Configuration conf) {
-    return getKeyFromConf(conf, START_BASE64, START);
+    return getBase64KeyFromConf(conf, START_BASE64);
   }
 
-  @SuppressWarnings("deprecation")
   static byte[] getEndKey(Configuration conf) {
-    return getKeyFromConf(conf, END_BASE64, END);
+    return getBase64KeyFromConf(conf, END_BASE64);
   }
 
-  private static byte[] getKeyFromConf(Configuration conf, String base64Key, 
String deprecatedKey) {
+  private static byte[] getBase64KeyFromConf(Configuration conf, String 
base64Key) {
     String encoded = conf.get(base64Key);
     if (encoded != null) {
       return Base64.getDecoder().decode(encoded);
     }
-    String oldStyleVal = conf.get(deprecatedKey);
-    if (oldStyleVal == null) {
-      return null;
-    }
-    LOG.warn("Using deprecated configuration " + deprecatedKey
-      + " - please use static accessor methods instead.");
-    return Bytes.toBytesBinary(oldStyleVal);
+    return null;
   }
 
   @Override
diff --git 
a/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestSimpleTotalOrderPartitioner.java
 
b/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestSimpleTotalOrderPartitioner.java
index 305d6ac1976..9bb10d9dbf4 100644
--- 
a/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestSimpleTotalOrderPartitioner.java
+++ 
b/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestSimpleTotalOrderPartitioner.java
@@ -19,6 +19,8 @@ package org.apache.hadoop.hbase.mapreduce;
 
 import static org.junit.Assert.assertEquals;
 
+import java.nio.charset.StandardCharsets;
+import java.util.Base64;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HBaseClassTestRule;
 import org.apache.hadoop.hbase.HBaseTestingUtil;
@@ -50,8 +52,10 @@ public class TestSimpleTotalOrderPartitioner {
     String end = "{";
     SimpleTotalOrderPartitioner<byte[]> p = new 
SimpleTotalOrderPartitioner<>();
 
-    this.conf.set(SimpleTotalOrderPartitioner.START, start);
-    this.conf.set(SimpleTotalOrderPartitioner.END, end);
+    this.conf.set(SimpleTotalOrderPartitioner.START_BASE64,
+      
Base64.getEncoder().encodeToString(start.getBytes(StandardCharsets.UTF_8)));
+    this.conf.set(SimpleTotalOrderPartitioner.END_BASE64,
+      
Base64.getEncoder().encodeToString(end.getBytes(StandardCharsets.UTF_8)));
     p.setConf(this.conf);
     ImmutableBytesWritable c = new ImmutableBytesWritable(Bytes.toBytes("c"));
     // If one reduce, partition should be 0.

Reply via email to