HBASE-22753 Removed deprecated ImmutableHRegionInfo (#420)

Signed-off-by: stack <stack@apache.org>
This commit is contained in:
Jan Hentschel 2019-07-31 08:07:31 +02:00 committed by Peter Somogyi
parent 373c2dc13f
commit 586e177ded
3 changed files with 0 additions and 137 deletions

View File

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

View File

@ -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<Consumer<ImmutableHRegionInfo>> 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) {
}
});
}
}

View File

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