From 586e177ded822b9fe527f05d815cbbc49009e706 Mon Sep 17 00:00:00 2001 From: Jan Hentschel Date: Wed, 31 Jul 2019 08:07:31 +0200 Subject: [PATCH] HBASE-22753 Removed deprecated ImmutableHRegionInfo (#420) Signed-off-by: stack --- .../hbase/client/ImmutableHRegionInfo.java | 49 ------------- .../client/TestImmutableHRegionInfo.java | 68 ------------------- .../hadoop/hbase/HBaseTestingUtility.java | 20 ------ 3 files changed, 137 deletions(-) delete mode 100644 hbase-client/src/main/java/org/apache/hadoop/hbase/client/ImmutableHRegionInfo.java delete mode 100644 hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestImmutableHRegionInfo.java diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ImmutableHRegionInfo.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ImmutableHRegionInfo.java deleted file mode 100644 index ed00ceedce5..00000000000 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ImmutableHRegionInfo.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.hadoop.hbase.client; - -import org.apache.hadoop.hbase.HRegionInfo; -import org.apache.yetus.audience.InterfaceAudience; - -/** - * Read-only Region info. - */ -@Deprecated // deprecated for hbase 2.0, remove for hbase 3.0. see HRegionInfo. -@InterfaceAudience.Private -public class ImmutableHRegionInfo extends HRegionInfo { - - /* - * Creates an immutable copy of an HRegionInfo. - * - * @param other - */ - public ImmutableHRegionInfo(RegionInfo other) { - super(other); - } - - @Override - public void setSplit(boolean split) { - throw new UnsupportedOperationException("HRegionInfo is read-only"); - } - - @Override - public void setOffline(boolean offline) { - throw new UnsupportedOperationException("HRegionInfo is read-only"); - } -} diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestImmutableHRegionInfo.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestImmutableHRegionInfo.java deleted file mode 100644 index 68afeec2663..00000000000 --- a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestImmutableHRegionInfo.java +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.hadoop.hbase.client; - -import static org.junit.Assert.fail; - -import java.util.Arrays; -import java.util.List; -import java.util.function.Consumer; -import org.apache.hadoop.hbase.HBaseClassTestRule; -import org.apache.hadoop.hbase.HRegionInfo; -import org.apache.hadoop.hbase.TableName; -import org.apache.hadoop.hbase.testclassification.ClientTests; -import org.apache.hadoop.hbase.testclassification.SmallTests; -import org.junit.ClassRule; -import org.junit.Rule; -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.junit.rules.TestName; - -/** - * Test ImmutableHRegionInfo - */ -@Category({ClientTests.class, SmallTests.class}) -public class TestImmutableHRegionInfo { - - @ClassRule - public static final HBaseClassTestRule CLASS_RULE = - HBaseClassTestRule.forClass(TestImmutableHRegionInfo.class); - - @Rule - public TestName name = new TestName(); - - private final List> TEST_FUNCTIONS = Arrays.asList( - hri -> hri.setOffline(true), - hri -> hri.setSplit(true) - ); - - @Test - public void testImmutable() { - HRegionInfo hri = new HRegionInfo(TableName.valueOf(name.getMethodName())); - ImmutableHRegionInfo immutableHri = new ImmutableHRegionInfo(hri); - - TEST_FUNCTIONS.forEach(f -> { - try { - f.accept(immutableHri); - fail("ImmutableHRegionInfo can't be modified !!!"); - } catch(UnsupportedOperationException e) { - } - }); - } - -} diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java index 8ae35179f48..09f93e9edaa 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java @@ -51,7 +51,6 @@ import java.util.Set; import java.util.TreeSet; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; -import java.util.stream.Collectors; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.logging.impl.Jdk14Logger; @@ -75,7 +74,6 @@ import org.apache.hadoop.hbase.client.Delete; import org.apache.hadoop.hbase.client.Durability; import org.apache.hadoop.hbase.client.Get; import org.apache.hadoop.hbase.client.Hbck; -import org.apache.hadoop.hbase.client.ImmutableHRegionInfo; import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.client.RegionInfo; import org.apache.hadoop.hbase.client.RegionInfoBuilder; @@ -2540,24 +2538,6 @@ public class HBaseTestingUtility extends HBaseZKTestingUtility { Bytes.toBytes("xxx"), Bytes.toBytes("yyy"), Bytes.toBytes("zzz") }; - /** - * Create rows in hbase:meta for regions of the specified table with the specified - * start keys. The first startKey should be a 0 length byte array if you - * want to form a proper range of regions. - * @param conf - * @param htd - * @param startKeys - * @return list of region info for regions added to meta - * @throws IOException - * @deprecated since 2.0 version and will be removed in 3.0 version. - * use {@link #createMultiRegionsInMeta(Configuration, TableDescriptor, byte[][])} - */ - @Deprecated - public List createMultiRegionsInMeta(final Configuration conf, - final HTableDescriptor htd, byte [][] startKeys) throws IOException { - return createMultiRegionsInMeta(conf, (TableDescriptor) htd, startKeys) - .stream().map(ImmutableHRegionInfo::new).collect(Collectors.toList()); - } /** * Create rows in hbase:meta for regions of the specified table with the specified * start keys. The first startKey should be a 0 length byte array if you