You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ps...@apache.org on 2019/07/30 10:32:15 UTC
[hbase] branch master updated: HBASE-22752 Removed the deprecated
ImmutableHColumnDescriptor and ImmutableHTableDescriptor (#419)
This is an automated email from the ASF dual-hosted git repository.
psomogyi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/master by this push:
new f9fd5b6 HBASE-22752 Removed the deprecated ImmutableHColumnDescriptor and ImmutableHTableDescriptor (#419)
f9fd5b6 is described below
commit f9fd5b65fab4fa82a98c4af91b0f87e4d2fc8dd6
Author: Jan Hentschel <ja...@ultratendency.com>
AuthorDate: Tue Jul 30 12:32:10 2019 +0200
HBASE-22752 Removed the deprecated ImmutableHColumnDescriptor and ImmutableHTableDescriptor (#419)
Signed-off-by: Peter Somogyi <ps...@apache.org>
Signed-off-by: stack <st...@apache.org>
---
.../hbase/client/ImmutableHColumnDescriptor.java | 47 --------
.../hbase/client/ImmutableHTableDescriptor.java | 60 ----------
.../client/TestImmutableHColumnDescriptor.java | 103 ----------------
.../client/TestImmutableHTableDescriptor.java | 130 ---------------------
.../apache/hadoop/hbase/HBaseTestingUtility.java | 11 --
5 files changed, 351 deletions(-)
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ImmutableHColumnDescriptor.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ImmutableHColumnDescriptor.java
deleted file mode 100644
index aa132af..0000000
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ImmutableHColumnDescriptor.java
+++ /dev/null
@@ -1,47 +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.HColumnDescriptor;
-import org.apache.yetus.audience.InterfaceAudience;
-import org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder.ModifyableColumnFamilyDescriptor;
-
-/**
- * Read-only column descriptor.
- */
-@Deprecated // deprecated for hbase 2.0, remove for hbase 3.0. see HColumnDescriptor.
-@InterfaceAudience.Private
-public class ImmutableHColumnDescriptor extends HColumnDescriptor {
- /*
- * Create an unmodifyable copy of an HColumnDescriptor
- * @param desc
- */
- ImmutableHColumnDescriptor(final HColumnDescriptor desc) {
- super(desc, false);
- }
-
- public ImmutableHColumnDescriptor(final ColumnFamilyDescriptor desc) {
- super(desc instanceof ModifyableColumnFamilyDescriptor ?
- (ModifyableColumnFamilyDescriptor) desc : new ModifyableColumnFamilyDescriptor(desc));
- }
-
- @Override
- protected ModifyableColumnFamilyDescriptor getDelegateeForModification() {
- throw new UnsupportedOperationException("HColumnDescriptor is read-only");
- }
-}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ImmutableHTableDescriptor.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ImmutableHTableDescriptor.java
deleted file mode 100644
index 8539cef..0000000
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ImmutableHTableDescriptor.java
+++ /dev/null
@@ -1,60 +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.HColumnDescriptor;
-import org.apache.hadoop.hbase.HTableDescriptor;
-import org.apache.hadoop.hbase.client.TableDescriptorBuilder.ModifyableTableDescriptor;
-import org.apache.yetus.audience.InterfaceAudience;
-
-/**
- * Read-only table descriptor.
- */
-@Deprecated // deprecated for hbase 2.0, remove for hbase 3.0. see HTableDescriptor.
-@InterfaceAudience.Private
-public class ImmutableHTableDescriptor extends HTableDescriptor {
-
- @Override
- protected HColumnDescriptor toHColumnDescriptor(ColumnFamilyDescriptor desc) {
- if (desc == null) {
- return null;
- } else if (desc instanceof HColumnDescriptor) {
- return new ImmutableHColumnDescriptor((HColumnDescriptor) desc);
- } else {
- return new ImmutableHColumnDescriptor(desc);
- }
- }
- /*
- * Create an unmodifyable copy of an HTableDescriptor
- * @param desc
- */
- public ImmutableHTableDescriptor(final HTableDescriptor desc) {
- super(desc, false);
- }
-
- public ImmutableHTableDescriptor(final TableDescriptor desc) {
- super(desc instanceof ModifyableTableDescriptor ?
- (ModifyableTableDescriptor) desc : new ModifyableTableDescriptor(desc.getTableName(), desc));
- }
-
- @Override
- protected ModifyableTableDescriptor getDelegateeForModification() {
- throw new UnsupportedOperationException("HTableDescriptor is read-only");
- }
-}
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestImmutableHColumnDescriptor.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestImmutableHColumnDescriptor.java
deleted file mode 100644
index 1ac483d..0000000
--- a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestImmutableHColumnDescriptor.java
+++ /dev/null
@@ -1,103 +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.HColumnDescriptor;
-import org.apache.hadoop.hbase.KeepDeletedCells;
-import org.apache.hadoop.hbase.MemoryCompactionPolicy;
-import org.apache.hadoop.hbase.io.compress.Compression;
-import org.apache.hadoop.hbase.io.encoding.DataBlockEncoding;
-import org.apache.hadoop.hbase.regionserver.BloomType;
-import org.apache.hadoop.hbase.testclassification.ClientTests;
-import org.apache.hadoop.hbase.testclassification.SmallTests;
-import org.apache.hadoop.hbase.util.BuilderStyleTest;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.rules.TestName;
-
-@Category({ClientTests.class, SmallTests.class})
-public class TestImmutableHColumnDescriptor {
-
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
- HBaseClassTestRule.forClass(TestImmutableHColumnDescriptor.class);
-
- @Rule
- public TestName name = new TestName();
- private static final List<Consumer<ImmutableHColumnDescriptor>> TEST_FUNCTION = Arrays.asList(
- hcd -> hcd.setValue("a", "a"),
- hcd -> hcd.setValue(Bytes.toBytes("a"), Bytes.toBytes("a")),
- hcd -> hcd.setConfiguration("aaa", "ccc"),
- hcd -> hcd.remove(Bytes.toBytes("aaa")),
- hcd -> hcd.removeConfiguration("xxx"),
- hcd -> hcd.setBlockCacheEnabled(false),
- hcd -> hcd.setBlocksize(10),
- hcd -> hcd.setBloomFilterType(BloomType.NONE),
- hcd -> hcd.setCacheBloomsOnWrite(false),
- hcd -> hcd.setCacheDataOnWrite(true),
- hcd -> hcd.setCacheIndexesOnWrite(true),
- hcd -> hcd.setCompactionCompressionType(Compression.Algorithm.LZO),
- hcd -> hcd.setCompressTags(true),
- hcd -> hcd.setCompressionType(Compression.Algorithm.LZO),
- hcd -> hcd.setDFSReplication((short) 10),
- hcd -> hcd.setDataBlockEncoding(DataBlockEncoding.NONE),
- hcd -> hcd.setEncryptionKey(Bytes.toBytes("xxx")),
- hcd -> hcd.setEncryptionType("xxx"),
- hcd -> hcd.setEvictBlocksOnClose(true),
- hcd -> hcd.setInMemory(true),
- hcd -> hcd.setInMemoryCompaction(MemoryCompactionPolicy.NONE),
- hcd -> hcd.setKeepDeletedCells(KeepDeletedCells.FALSE),
- hcd -> hcd.setMaxVersions(1000),
- hcd -> hcd.setMinVersions(10),
- hcd -> hcd.setMobCompactPartitionPolicy(MobCompactPartitionPolicy.DAILY),
- hcd -> hcd.setMobEnabled(true),
- hcd -> hcd.setMobThreshold(10),
- hcd -> hcd.setPrefetchBlocksOnOpen(true),
- hcd -> hcd.setScope(0),
- hcd -> hcd.setStoragePolicy("aaa"),
- hcd -> hcd.setTimeToLive(100),
- hcd -> hcd.setVersions(1, 10)
- );
-
- @Test
- public void testImmutable() {
- ImmutableHColumnDescriptor hcd = new ImmutableHColumnDescriptor(
- new HColumnDescriptor(Bytes.toBytes(name.getMethodName())));
- for (int i = 0; i != TEST_FUNCTION.size(); ++i) {
- try {
- TEST_FUNCTION.get(i).accept(hcd);
- fail("ImmutableHTableDescriptor can't be modified!!! The index of method is " + i);
- } catch (UnsupportedOperationException e) {
- }
- }
- }
-
- @Test
- public void testClassMethodsAreBuilderStyle() {
- BuilderStyleTest.assertClassesAreBuilderStyle(ImmutableHColumnDescriptor.class);
- }
-}
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestImmutableHTableDescriptor.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestImmutableHTableDescriptor.java
deleted file mode 100644
index b83c01a..0000000
--- a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestImmutableHTableDescriptor.java
+++ /dev/null
@@ -1,130 +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.io.IOException;
-import java.util.Arrays;
-import java.util.List;
-import java.util.function.Consumer;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
-import org.apache.hadoop.hbase.HColumnDescriptor;
-import org.apache.hadoop.hbase.HTableDescriptor;
-import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.testclassification.ClientTests;
-import org.apache.hadoop.hbase.testclassification.SmallTests;
-import org.apache.hadoop.hbase.util.BuilderStyleTest;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.rules.TestName;
-
-@Category({ClientTests.class, SmallTests.class})
-public class TestImmutableHTableDescriptor {
-
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
- HBaseClassTestRule.forClass(TestImmutableHTableDescriptor.class);
-
- @Rule
- public TestName name = new TestName();
- private static final List<Consumer<ImmutableHTableDescriptor>> TEST_FUNCTION = Arrays.asList(
- htd -> htd.setValue("a", "a"),
- htd -> htd.setValue(Bytes.toBytes("a"), Bytes.toBytes("a")),
- htd -> htd.setValue(new Bytes(Bytes.toBytes("a")), new Bytes(Bytes.toBytes("a"))),
- htd -> htd.setCompactionEnabled(false),
- htd -> htd.setConfiguration("aaa", "ccc"),
- htd -> htd.setDurability(Durability.USE_DEFAULT),
- htd -> htd.setFlushPolicyClassName("class"),
- htd -> htd.setMaxFileSize(123),
- htd -> htd.setMemStoreFlushSize(123123123),
- htd -> htd.setNormalizationEnabled(false),
- htd -> htd.setPriority(123),
- htd -> htd.setReadOnly(true),
- htd -> htd.setRegionMemstoreReplication(true),
- htd -> htd.setRegionReplication(123),
- htd -> htd.setRegionSplitPolicyClassName("class"),
- htd -> htd.addFamily(new HColumnDescriptor(Bytes.toBytes("fm"))),
- htd -> htd.remove(new Bytes(Bytes.toBytes("aaa"))),
- htd -> htd.remove("aaa"),
- htd -> htd.remove(Bytes.toBytes("aaa")),
- htd -> htd.removeConfiguration("xxx"),
- htd -> htd.removeFamily(Bytes.toBytes("fm")),
- htd -> {
- try {
- htd.addCoprocessor("xxx");
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
- );
-
- @Test
- public void testImmutable() {
- HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(name.getMethodName()));
- ImmutableHTableDescriptor immutableHtd = new ImmutableHTableDescriptor(htd);
- TEST_FUNCTION.forEach(f -> {
- try {
- f.accept(immutableHtd);
- fail("ImmutableHTableDescriptor can't be modified!!!");
- } catch (UnsupportedOperationException e) {
- }
- });
- }
-
- @Test
- public void testImmutableHColumnDescriptor() {
- HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(name.getMethodName()));
- htd.addFamily(new HColumnDescriptor(Bytes.toBytes("family")));
- ImmutableHTableDescriptor immutableHtd = new ImmutableHTableDescriptor(htd);
- for (HColumnDescriptor hcd : immutableHtd.getColumnFamilies()) {
- assertReadOnly(hcd);
- }
- for (HColumnDescriptor hcd : immutableHtd.getFamilies()) {
- assertReadOnly(hcd);
- }
- }
-
- private void assertReadOnly(HColumnDescriptor hcd) {
- try {
- hcd.setBlocksize(10);
- fail("ImmutableHColumnDescriptor can't be modified!!!");
- } catch (UnsupportedOperationException e) {
- }
- }
-
- @Test
- public void testClassMethodsAreBuilderStyle() {
- /* ImmutableHTableDescriptor should have a builder style setup where setXXX/addXXX methods
- * can be chainable together:
- * . For example:
- * ImmutableHTableDescriptor d
- * = new ImmutableHTableDescriptor()
- * .setFoo(foo)
- * .setBar(bar)
- * .setBuz(buz)
- *
- * This test ensures that all methods starting with "set" returns the declaring object
- */
-
- BuilderStyleTest.assertClassesAreBuilderStyle(ImmutableHTableDescriptor.class);
- }
-}
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 eea0c67..8ae3517 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
@@ -76,7 +76,6 @@ 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.ImmutableHTableDescriptor;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.RegionInfo;
import org.apache.hadoop.hbase.client.RegionInfoBuilder;
@@ -499,16 +498,6 @@ public class HBaseTestingUtility extends HBaseZKTestingUtility {
/**
* @return META table descriptor
- * @deprecated since 2.0 version and will be removed in 3.0 version.
- * use {@link #getMetaTableDescriptorBuilder()}
- */
- @Deprecated
- public HTableDescriptor getMetaTableDescriptor() {
- return new ImmutableHTableDescriptor(getMetaTableDescriptorBuilder().build());
- }
-
- /**
- * @return META table descriptor
*/
public TableDescriptorBuilder getMetaTableDescriptorBuilder() {
try {