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 2877b8915bc50eeff3e3a6ea2287fc0cd383eecb
Author: Duo Zhang <zhang...@apache.org>
AuthorDate: Wed May 8 15:30:30 2024 +0800

    HBASE-28570 Remove deprecated fields in HBTU (#5877)
    
    Signed-off-by: Xin Sun <sun...@apache.org>
    (cherry picked from commit f750de2b1129c4be5fea0fb8434797b1a681f3a7)
---
 .../org/apache/hadoop/hbase/HBaseTestingUtil.java  | 27 ++++++----------------
 .../apache/hadoop/hbase/HBaseTestingUtility.java   | 27 ++++++----------------
 2 files changed, 14 insertions(+), 40 deletions(-)

diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtil.java 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtil.java
index 79b041f3421..dcdf55a945b 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtil.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtil.java
@@ -183,16 +183,6 @@ import 
org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
 @InterfaceStability.Evolving
 public class HBaseTestingUtil extends HBaseZKTestingUtil {
 
-  /**
-   * System property key to get test directory value. Name is as it is because 
mini dfs has
-   * hard-codings to put test data here. It should NOT be used directly in 
HBase, as it's a property
-   * used in mini dfs.
-   * @deprecated since 2.0.0 and will be removed in 3.0.0. Can be used only 
with mini dfs.
-   * @see <a 
href="https://issues.apache.org/jira/browse/HBASE-19410";>HBASE-19410</a>
-   */
-  @Deprecated
-  private static final String TEST_DIRECTORY_KEY = "test.build.data";
-
   public static final String REGIONS_PER_SERVER_KEY = 
"hbase.test.regions-per-server";
   /**
    * The default number of regions per regionserver when creating a pre-split 
table.
@@ -384,13 +374,12 @@ public class HBaseTestingUtil extends HBaseZKTestingUtil {
 
   /**
    * Home our data in a dir under {@link #DEFAULT_BASE_TEST_DIRECTORY}. Give 
it a random name so can
-   * have many concurrent tests running if we need to. It needs to amend the
-   * {@link #TEST_DIRECTORY_KEY} System property, as it's what minidfscluster 
bases it data dir on.
-   * Moding a System property is not the way to do concurrent instances -- 
another instance could
-   * grab the temporary value unintentionally -- but not anything can do about 
it at moment; single
-   * instance only is how the minidfscluster works. We also create the 
underlying directory names
-   * for hadoop.log.dir, mapreduce.cluster.local.dir and hadoop.tmp.dir, and 
set the values in the
-   * conf, and as a system property for hadoop.tmp.dir (We do not create 
them!).
+   * have many concurrent tests running if we need to. Moding a System 
property is not the way to do
+   * concurrent instances -- another instance could grab the temporary value 
unintentionally -- but
+   * not anything can do about it at moment; single instance only is how the 
minidfscluster works.
+   * We also create the underlying directory names for hadoop.log.dir, 
mapreduce.cluster.local.dir
+   * and hadoop.tmp.dir, and set the values in the conf, and as a system 
property for hadoop.tmp.dir
+   * (We do not create them!).
    * @return The calculated data test build directory, if newly-created.
    */
   @Override
@@ -677,8 +666,7 @@ public class HBaseTestingUtil extends HBaseZKTestingUtil {
    */
   private void createDirsAndSetProperties() throws IOException {
     setupClusterTestDir();
-    conf.set(TEST_DIRECTORY_KEY, clusterTestDir.getPath());
-    System.setProperty(TEST_DIRECTORY_KEY, clusterTestDir.getPath());
+    conf.set(MiniDFSCluster.HDFS_MINIDFS_BASEDIR, 
clusterTestDir.getCanonicalPath());
     createDirAndSetProperty("test.cache.data");
     createDirAndSetProperty("hadoop.tmp.dir");
     hadoopLogDir = createDirAndSetProperty("hadoop.log.dir");
@@ -832,7 +820,6 @@ public class HBaseTestingUtil extends HBaseZKTestingUtil {
     miniClusterRunning = true;
 
     setupClusterTestDir();
-    System.setProperty(TEST_DIRECTORY_KEY, this.clusterTestDir.getPath());
 
     // Bring up mini dfs cluster. This spews a bunch of warnings about missing
     // scheme. Complaints are 'Scheme is undefined for 
build/test/data/dfs/name1'.
diff --git 
a/hbase-testing-util/src/main/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
 
b/hbase-testing-util/src/main/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
index 5329408e4e6..8cdf2719db9 100644
--- 
a/hbase-testing-util/src/main/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
+++ 
b/hbase-testing-util/src/main/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
@@ -171,16 +171,6 @@ import 
org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
 @Deprecated
 public class HBaseTestingUtility extends HBaseZKTestingUtility {
 
-  /**
-   * System property key to get test directory value. Name is as it is because 
mini dfs has
-   * hard-codings to put test data here. It should NOT be used directly in 
HBase, as it's a property
-   * used in mini dfs.
-   * @deprecated since 2.0.0 and will be removed in 3.0.0. Can be used only 
with mini dfs.
-   * @see <a 
href="https://issues.apache.org/jira/browse/HBASE-19410";>HBASE-19410</a>
-   */
-  @Deprecated
-  private static final String TEST_DIRECTORY_KEY = "test.build.data";
-
   public static final String REGIONS_PER_SERVER_KEY = 
"hbase.test.regions-per-server";
   /**
    * The default number of regions per regionserver when creating a pre-split 
table.
@@ -372,13 +362,12 @@ public class HBaseTestingUtility extends 
HBaseZKTestingUtility {
 
   /**
    * Home our data in a dir under {@link #DEFAULT_BASE_TEST_DIRECTORY}. Give 
it a random name so can
-   * have many concurrent tests running if we need to. It needs to amend the
-   * {@link #TEST_DIRECTORY_KEY} System property, as it's what minidfscluster 
bases it data dir on.
-   * Moding a System property is not the way to do concurrent instances -- 
another instance could
-   * grab the temporary value unintentionally -- but not anything can do about 
it at moment; single
-   * instance only is how the minidfscluster works. We also create the 
underlying directory names
-   * for hadoop.log.dir, mapreduce.cluster.local.dir and hadoop.tmp.dir, and 
set the values in the
-   * conf, and as a system property for hadoop.tmp.dir (We do not create 
them!).
+   * have many concurrent tests running if we need to. Moding a System 
property is not the way to do
+   * concurrent instances -- another instance could grab the temporary value 
unintentionally -- but
+   * not anything can do about it at moment; single instance only is how the 
minidfscluster works.
+   * We also create the underlying directory names for hadoop.log.dir, 
mapreduce.cluster.local.dir
+   * and hadoop.tmp.dir, and set the values in the conf, and as a system 
property for hadoop.tmp.dir
+   * (We do not create them!).
    * @return The calculated data test build directory, if newly-created.
    */
   @Override
@@ -663,8 +652,7 @@ public class HBaseTestingUtility extends 
HBaseZKTestingUtility {
    */
   private void createDirsAndSetProperties() throws IOException {
     setupClusterTestDir();
-    conf.set(TEST_DIRECTORY_KEY, clusterTestDir.getPath());
-    System.setProperty(TEST_DIRECTORY_KEY, clusterTestDir.getPath());
+    conf.set(MiniDFSCluster.HDFS_MINIDFS_BASEDIR, 
clusterTestDir.getCanonicalPath());
     createDirAndSetProperty("test.cache.data");
     createDirAndSetProperty("hadoop.tmp.dir");
     hadoopLogDir = createDirAndSetProperty("hadoop.log.dir");
@@ -1066,7 +1054,6 @@ public class HBaseTestingUtility extends 
HBaseZKTestingUtility {
     miniClusterRunning = true;
 
     setupClusterTestDir();
-    System.setProperty(TEST_DIRECTORY_KEY, this.clusterTestDir.getPath());
 
     // Bring up mini dfs cluster. This spews a bunch of warnings about missing
     // scheme. Complaints are 'Scheme is undefined for 
build/test/data/dfs/name1'.

Reply via email to