HBASE-27081 Fix disallowed compatibility breaks on branch-2.5 and branch-2

Signed-off-by: Andrew Purtell <apurtell@apache.org>
This commit is contained in:
Andrew Purtell 2022-05-31 19:13:11 -07:00
parent e69da68f97
commit 6dd1a6bef0
6 changed files with 17 additions and 38 deletions

View File

@ -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 =

View File

@ -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";

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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.
}
}