You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2022/06/01 02:56:44 UTC

[hbase] branch branch-2 updated: HBASE-27081 Fix disallowed compatibility breaks on branch-2.5 and branch-2

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

apurtell 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 6dd1a6bef0d HBASE-27081 Fix disallowed compatibility breaks on branch-2.5 and branch-2
6dd1a6bef0d is described below

commit 6dd1a6bef0d6defa70a8bd3e24aa7d2a09d1ba5e
Author: Andrew Purtell <ap...@apache.org>
AuthorDate: Tue May 31 19:13:11 2022 -0700

    HBASE-27081 Fix disallowed compatibility breaks on branch-2.5 and branch-2
    
    Signed-off-by: Andrew Purtell <ap...@apache.org>
---
 .../org/apache/hadoop/hbase/HTableDescriptor.java  |  2 ++
 .../hbase/client/TableDescriptorBuilder.java       |  3 ++
 .../hadoop/hbase/filter/RandomRowFilter.java       |  5 +--
 .../hbase/replication/ReplicationLoadSink.java     |  2 +-
 .../apache/hadoop/hbase/rsgroup/RSGroupInfo.java   |  3 +-
 .../rsgroup/TestUpdateRSGroupConfiguration.java    | 40 ++++------------------
 6 files changed, 17 insertions(+), 38 deletions(-)

diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java
index c48b31c1d1c..bdaad3beafe 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java
@@ -68,6 +68,8 @@ public class HTableDescriptor implements TableDescriptor, Comparable<HTableDescr
   public static final String REGION_MEMSTORE_REPLICATION =
     TableDescriptorBuilder.REGION_MEMSTORE_REPLICATION;
   public static final String NORMALIZATION_ENABLED = TableDescriptorBuilder.NORMALIZATION_ENABLED;
+  public static final boolean DEFAULT_NORMALIZATION_ENABLED =
+    TableDescriptorBuilder.DEFAULT_NORMALIZATION_ENABLED;
   public static final String NORMALIZER_TARGET_REGION_COUNT =
     TableDescriptorBuilder.NORMALIZER_TARGET_REGION_COUNT;
   public static final String NORMALIZER_TARGET_REGION_SIZE =
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/TableDescriptorBuilder.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/TableDescriptorBuilder.java
index 3dd386ba21d..a005a752527 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/TableDescriptorBuilder.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/TableDescriptorBuilder.java
@@ -158,6 +158,9 @@ public class TableDescriptorBuilder {
   public static final String NORMALIZATION_ENABLED = "NORMALIZATION_ENABLED";
   private static final Bytes NORMALIZATION_ENABLED_KEY =
     new Bytes(Bytes.toBytes(NORMALIZATION_ENABLED));
+  @InterfaceAudience.Private
+  @Deprecated
+  public static final boolean DEFAULT_NORMALIZATION_ENABLED = false;
 
   @InterfaceAudience.Private
   public static final String NORMALIZER_TARGET_REGION_COUNT = "NORMALIZER_TARGET_REGION_COUNT";
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/RandomRowFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/RandomRowFilter.java
index b09a1995e80..ff73dadb9d8 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/RandomRowFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/RandomRowFilter.java
@@ -18,7 +18,7 @@
 package org.apache.hadoop.hbase.filter;
 
 import java.util.Objects;
-import java.util.concurrent.ThreadLocalRandom;
+import java.util.Random;
 import org.apache.hadoop.hbase.Cell;
 import org.apache.hadoop.hbase.exceptions.DeserializationException;
 import org.apache.yetus.audience.InterfaceAudience;
@@ -32,6 +32,7 @@ import org.apache.hadoop.hbase.shaded.protobuf.generated.FilterProtos;
  */
 @InterfaceAudience.Public
 public class RandomRowFilter extends FilterBase {
+  protected static final Random random = new Random();
 
   protected float chance;
   protected boolean filterOutRow;
@@ -96,7 +97,7 @@ public class RandomRowFilter extends FilterBase {
       filterOutRow = false;
     } else {
       // roll the dice
-      filterOutRow = !(ThreadLocalRandom.current().nextFloat() < chance);
+      filterOutRow = !(random.nextFloat() < chance);
     }
     return filterOutRow;
   }
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/replication/ReplicationLoadSink.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/replication/ReplicationLoadSink.java
index 36e7f80fa06..9da498c0452 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/replication/ReplicationLoadSink.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/replication/ReplicationLoadSink.java
@@ -29,7 +29,7 @@ public class ReplicationLoadSink {
   private final long timestampStarted;
   private final long totalOpsProcessed;
 
-  private ReplicationLoadSink(long age, long timestamp, long timestampStarted,
+  public ReplicationLoadSink(long age, long timestamp, long timestampStarted,
     long totalOpsProcessed) {
     this.ageOfLastAppliedOp = age;
     this.timestampsOfLastAppliedOp = timestamp;
diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfo.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfo.java
index 189960028c5..d72c528ef70 100644
--- a/hbase-common/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfo.java
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfo.java
@@ -22,6 +22,7 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Objects;
+import java.util.Set;
 import java.util.SortedSet;
 import java.util.TreeSet;
 import org.apache.hadoop.hbase.TableName;
@@ -93,7 +94,7 @@ public class RSGroupInfo {
   /**
    * Get list of servers.
    */
-  public SortedSet<Address> getServers() {
+  public Set<Address> getServers() {
     return servers;
   }
 
diff --git a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestUpdateRSGroupConfiguration.java b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestUpdateRSGroupConfiguration.java
index 62996c6b06c..8dc4dfe1f5f 100644
--- a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestUpdateRSGroupConfiguration.java
+++ b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestUpdateRSGroupConfiguration.java
@@ -17,19 +17,16 @@
  */
 package org.apache.hadoop.hbase.rsgroup;
 
-import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
-import java.util.stream.Collectors;
-import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HBaseClassTestRule;
 import org.apache.hadoop.hbase.testclassification.MediumTests;
-import org.apache.hadoop.hbase.util.JVMClusterUtil;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.ClassRule;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.slf4j.Logger;
@@ -83,37 +80,12 @@ public class TestUpdateRSGroupConfiguration extends TestRSGroupsBase {
     }
   }
 
+  // This test relies on a disallowed API change in RSGroupInfo and was also found to be
+  // flaky. REVERTED from branch-2.5 and branch-2.
   @Test
+  @Ignore
   public void testCustomOnlineConfigChangeInRSGroup() throws Exception {
-    // Check the default configuration of the RegionServers
-    TEST_UTIL.getMiniHBaseCluster().getRegionServerThreads().forEach(thread -> {
-      Configuration conf = thread.getRegionServer().getConfiguration();
-      assertEquals(0, conf.getInt("hbase.custom.config", 0));
-    });
-
-    replaceHBaseSiteXML();
-    RSGroupInfo testRSGroup = addGroup(TEST_GROUP, 1);
-    RSGroupInfo test2RSGroup = addGroup(TEST2_GROUP, 1);
-    rsGroupAdmin.updateConfiguration(TEST_GROUP);
-
-    // Check the configuration of the RegionServer in test rsgroup, should be update
-    Configuration regionServerConfiguration = TEST_UTIL.getMiniHBaseCluster()
-      .getLiveRegionServerThreads().stream().map(JVMClusterUtil.RegionServerThread::getRegionServer)
-      .filter(regionServer -> (regionServer.getServerName().getAddress()
-        .equals(testRSGroup.getServers().first())))
-      .collect(Collectors.toList()).get(0).getConfiguration();
-    int custom = regionServerConfiguration.getInt("hbase.custom.config", 0);
-    assertEquals(1000, custom);
-
-    // Check the configuration of the RegionServer in test2 rsgroup, should not be update
-    regionServerConfiguration = TEST_UTIL.getMiniHBaseCluster().getLiveRegionServerThreads()
-      .stream().map(JVMClusterUtil.RegionServerThread::getRegionServer)
-      .filter(regionServer -> (regionServer.getServerName().getAddress()
-        .equals(test2RSGroup.getServers().first())))
-      .collect(Collectors.toList()).get(0).getConfiguration();
-    custom = regionServerConfiguration.getInt("hbase.custom.config", 0);
-    assertEquals(0, custom);
-
-    restoreHBaseSiteXML();
+    // Test contents removed on branch-2.5 and branch-2.
   }
+
 }