From 90a4b72d1661c396d128900471b38234a4f6617e Mon Sep 17 00:00:00 2001 From: zhangduo Date: Tue, 1 Jan 2019 09:38:50 +0800 Subject: [PATCH] HBASE-21644 Move the methods in QuotaTableUtil which are only used by tests to test code base --- .../hadoop/hbase/quotas/QuotaTableUtil.java | 130 +------------- .../hadoop/hbase/client/QuotaStatusCalls.java | 5 + .../hbase/quotas/QuotaTableTestUtil.java | 161 ++++++++++++++++++ .../quotas/SpaceQuotaHelperForTests.java | 4 +- .../hbase/quotas/TestQuotaStatusRPCs.java | 21 +-- .../quotas/TestSpaceQuotasWithSnapshots.java | 16 +- 6 files changed, 194 insertions(+), 143 deletions(-) rename {hbase-client/src/main => hbase-server/src/test}/java/org/apache/hadoop/hbase/client/QuotaStatusCalls.java (95%) create mode 100644 hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/QuotaTableTestUtil.java diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/QuotaTableUtil.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/QuotaTableUtil.java index 419091dfdb..8104984fe6 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/QuotaTableUtil.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/QuotaTableUtil.java @@ -27,23 +27,14 @@ import java.util.List; import java.util.Map; import java.util.Objects; import java.util.regex.Pattern; - import org.apache.commons.lang3.StringUtils; import org.apache.hadoop.hbase.Cell; -import org.apache.hadoop.hbase.CellScanner; import org.apache.hadoop.hbase.CompareOperator; import org.apache.hadoop.hbase.NamespaceDescriptor; -import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.TableName; -import org.apache.yetus.audience.InterfaceAudience; -import org.apache.yetus.audience.InterfaceStability; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.apache.hadoop.hbase.client.ClusterConnection; import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.client.Get; import org.apache.hadoop.hbase.client.Put; -import org.apache.hadoop.hbase.client.QuotaStatusCalls; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.client.ResultScanner; import org.apache.hadoop.hbase.client.Scan; @@ -55,21 +46,20 @@ import org.apache.hadoop.hbase.filter.QualifierFilter; import org.apache.hadoop.hbase.filter.RegexStringComparator; import org.apache.hadoop.hbase.filter.RowFilter; import org.apache.hadoop.hbase.protobuf.ProtobufMagic; +import org.apache.hadoop.hbase.util.Bytes; +import org.apache.yetus.audience.InterfaceAudience; +import org.apache.yetus.audience.InterfaceStability; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import org.apache.hbase.thirdparty.com.google.protobuf.ByteString; import org.apache.hbase.thirdparty.com.google.protobuf.InvalidProtocolBufferException; -import org.apache.hbase.thirdparty.com.google.protobuf.TextFormat; import org.apache.hbase.thirdparty.com.google.protobuf.UnsafeByteOperations; + import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil; -import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos; import org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos; -import org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.GetQuotaStatesResponse; -import org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.GetSpaceQuotaRegionSizesResponse; -import org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.GetSpaceQuotaSnapshotsResponse; -import org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.GetSpaceQuotaSnapshotsResponse.TableQuotaSnapshot; -import org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.GetSpaceQuotaRegionSizesResponse.RegionSizes; import org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas; import org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.SpaceQuota; -import org.apache.hadoop.hbase.util.Bytes; /** * Helper class to interact with the quota table. @@ -538,112 +528,6 @@ public class QuotaTableUtil { new ColumnPrefixFilter(QUOTA_SNAPSHOT_SIZE_QUALIFIER)); } - /** - * Fetches any persisted HBase snapshot sizes stored in the quota table. The sizes here are - * computed relative to the table which the snapshot was created from. A snapshot's size will - * not include the size of files which the table still refers. These sizes, in bytes, are what - * is used internally to compute quota violation for tables and namespaces. - * - * @return A map of snapshot name to size in bytes per space quota computations - */ - public static Map getObservedSnapshotSizes(Connection conn) throws IOException { - try (Table quotaTable = conn.getTable(QUOTA_TABLE_NAME); - ResultScanner rs = quotaTable.getScanner(createScanForSpaceSnapshotSizes())) { - final Map snapshotSizes = new HashMap<>(); - for (Result r : rs) { - CellScanner cs = r.cellScanner(); - while (cs.advance()) { - Cell c = cs.current(); - final String snapshot = extractSnapshotNameFromSizeCell(c); - final long size = parseSnapshotSize(c); - snapshotSizes.put(snapshot, size); - } - } - return snapshotSizes; - } - } - - /* ========================================================================= - * Space quota status RPC helpers - */ - /** - * Fetches the table sizes on the filesystem as tracked by the HBase Master. - */ - public static Map getMasterReportedTableSizes( - Connection conn) throws IOException { - if (!(conn instanceof ClusterConnection)) { - throw new IllegalArgumentException("Expected a ClusterConnection"); - } - ClusterConnection clusterConn = (ClusterConnection) conn; - GetSpaceQuotaRegionSizesResponse response = QuotaStatusCalls.getMasterRegionSizes( - clusterConn, 0); - Map tableSizes = new HashMap<>(); - for (RegionSizes sizes : response.getSizesList()) { - TableName tn = ProtobufUtil.toTableName(sizes.getTableName()); - tableSizes.put(tn, sizes.getSize()); - } - return tableSizes; - } - - /** - * Fetches the observed {@link SpaceQuotaSnapshot}s observed by a RegionServer. - */ - public static Map getRegionServerQuotaSnapshots( - Connection conn, ServerName regionServer) throws IOException { - if (!(conn instanceof ClusterConnection)) { - throw new IllegalArgumentException("Expected a ClusterConnection"); - } - ClusterConnection clusterConn = (ClusterConnection) conn; - GetSpaceQuotaSnapshotsResponse response = QuotaStatusCalls.getRegionServerQuotaSnapshot( - clusterConn, 0, regionServer); - Map snapshots = new HashMap<>(); - for (TableQuotaSnapshot snapshot : response.getSnapshotsList()) { - snapshots.put( - ProtobufUtil.toTableName(snapshot.getTableName()), - SpaceQuotaSnapshot.toSpaceQuotaSnapshot(snapshot.getSnapshot())); - } - return snapshots; - } - - /** - * Returns the Master's view of a quota on the given {@code tableName} or null if the - * Master has no quota information on that table. - */ - public static SpaceQuotaSnapshot getCurrentSnapshot( - Connection conn, TableName tn) throws IOException { - if (!(conn instanceof ClusterConnection)) { - throw new IllegalArgumentException("Expected a ClusterConnection"); - } - ClusterConnection clusterConn = (ClusterConnection) conn; - GetQuotaStatesResponse resp = QuotaStatusCalls.getMasterQuotaStates(clusterConn, 0); - HBaseProtos.TableName protoTableName = ProtobufUtil.toProtoTableName(tn); - for (GetQuotaStatesResponse.TableQuotaSnapshot tableSnapshot : resp.getTableSnapshotsList()) { - if (protoTableName.equals(tableSnapshot.getTableName())) { - return SpaceQuotaSnapshot.toSpaceQuotaSnapshot(tableSnapshot.getSnapshot()); - } - } - return null; - } - - /** - * Returns the Master's view of a quota on the given {@code namespace} or null if the - * Master has no quota information on that namespace. - */ - public static SpaceQuotaSnapshot getCurrentSnapshot( - Connection conn, String namespace) throws IOException { - if (!(conn instanceof ClusterConnection)) { - throw new IllegalArgumentException("Expected a ClusterConnection"); - } - ClusterConnection clusterConn = (ClusterConnection) conn; - GetQuotaStatesResponse resp = QuotaStatusCalls.getMasterQuotaStates(clusterConn, 0); - for (GetQuotaStatesResponse.NamespaceQuotaSnapshot nsSnapshot : resp.getNsSnapshotsList()) { - if (namespace.equals(nsSnapshot.getNamespace())) { - return SpaceQuotaSnapshot.toSpaceQuotaSnapshot(nsSnapshot.getSnapshot()); - } - } - return null; - } - /* ========================================================================= * Quotas protobuf helpers */ diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/QuotaStatusCalls.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/QuotaStatusCalls.java similarity index 95% rename from hbase-client/src/main/java/org/apache/hadoop/hbase/client/QuotaStatusCalls.java rename to hbase-server/src/test/java/org/apache/hadoop/hbase/client/QuotaStatusCalls.java index fc609cf8c2..735ef46eed 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/QuotaStatusCalls.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/QuotaStatusCalls.java @@ -20,6 +20,11 @@ import java.io.IOException; import java.util.concurrent.Callable; import org.apache.hadoop.hbase.ServerName; +import org.apache.hadoop.hbase.client.ClusterConnection; +import org.apache.hadoop.hbase.client.Connection; +import org.apache.hadoop.hbase.client.MasterCallable; +import org.apache.hadoop.hbase.client.RpcRetryingCaller; +import org.apache.hadoop.hbase.client.RpcRetryingCallerFactory; import org.apache.yetus.audience.InterfaceAudience; import org.apache.hadoop.hbase.ipc.RpcControllerFactory; import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil; diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/QuotaTableTestUtil.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/QuotaTableTestUtil.java new file mode 100644 index 0000000000..d4944a2bef --- /dev/null +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/QuotaTableTestUtil.java @@ -0,0 +1,161 @@ +/** + * 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.quotas; + +import static org.apache.hadoop.hbase.quotas.QuotaTableUtil.QUOTA_TABLE_NAME; +import static org.apache.hadoop.hbase.quotas.QuotaTableUtil.createScanForSpaceSnapshotSizes; +import static org.apache.hadoop.hbase.quotas.QuotaTableUtil.extractSnapshotNameFromSizeCell; +import static org.apache.hadoop.hbase.quotas.QuotaTableUtil.parseSnapshotSize; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import org.apache.hadoop.hbase.Cell; +import org.apache.hadoop.hbase.CellScanner; +import org.apache.hadoop.hbase.ServerName; +import org.apache.hadoop.hbase.TableName; +import org.apache.hadoop.hbase.client.ClusterConnection; +import org.apache.hadoop.hbase.client.Connection; +import org.apache.hadoop.hbase.client.QuotaStatusCalls; +import org.apache.hadoop.hbase.client.Result; +import org.apache.hadoop.hbase.client.ResultScanner; +import org.apache.hadoop.hbase.client.Table; + +import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil; +import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos; +import org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.GetQuotaStatesResponse; +import org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.GetSpaceQuotaRegionSizesResponse; +import org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.GetSpaceQuotaRegionSizesResponse.RegionSizes; +import org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.GetSpaceQuotaSnapshotsResponse; +import org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.GetSpaceQuotaSnapshotsResponse.TableQuotaSnapshot; + +/** + * + */ +final class QuotaTableTestUtil { + + private QuotaTableTestUtil() { + } + + + /** + * Fetches any persisted HBase snapshot sizes stored in the quota table. The sizes here are + * computed relative to the table which the snapshot was created from. A snapshot's size will + * not include the size of files which the table still refers. These sizes, in bytes, are what + * is used internally to compute quota violation for tables and namespaces. + * + * @return A map of snapshot name to size in bytes per space quota computations + */ + public static Map getObservedSnapshotSizes(Connection conn) throws IOException { + try (Table quotaTable = conn.getTable(QUOTA_TABLE_NAME); + ResultScanner rs = quotaTable.getScanner(createScanForSpaceSnapshotSizes())) { + final Map snapshotSizes = new HashMap<>(); + for (Result r : rs) { + CellScanner cs = r.cellScanner(); + while (cs.advance()) { + Cell c = cs.current(); + final String snapshot = extractSnapshotNameFromSizeCell(c); + final long size = parseSnapshotSize(c); + snapshotSizes.put(snapshot, size); + } + } + return snapshotSizes; + } + } + + /* ========================================================================= + * Space quota status RPC helpers + */ + /** + * Fetches the table sizes on the filesystem as tracked by the HBase Master. + */ + public static Map getMasterReportedTableSizes( + Connection conn) throws IOException { + if (!(conn instanceof ClusterConnection)) { + throw new IllegalArgumentException("Expected a ClusterConnection"); + } + ClusterConnection clusterConn = (ClusterConnection) conn; + GetSpaceQuotaRegionSizesResponse response = QuotaStatusCalls.getMasterRegionSizes( + clusterConn, 0); + Map tableSizes = new HashMap<>(); + for (RegionSizes sizes : response.getSizesList()) { + TableName tn = ProtobufUtil.toTableName(sizes.getTableName()); + tableSizes.put(tn, sizes.getSize()); + } + return tableSizes; + } + + /** + * Fetches the observed {@link SpaceQuotaSnapshot}s observed by a RegionServer. + */ + public static Map getRegionServerQuotaSnapshots( + Connection conn, ServerName regionServer) throws IOException { + if (!(conn instanceof ClusterConnection)) { + throw new IllegalArgumentException("Expected a ClusterConnection"); + } + ClusterConnection clusterConn = (ClusterConnection) conn; + GetSpaceQuotaSnapshotsResponse response = QuotaStatusCalls.getRegionServerQuotaSnapshot( + clusterConn, 0, regionServer); + Map snapshots = new HashMap<>(); + for (TableQuotaSnapshot snapshot : response.getSnapshotsList()) { + snapshots.put( + ProtobufUtil.toTableName(snapshot.getTableName()), + SpaceQuotaSnapshot.toSpaceQuotaSnapshot(snapshot.getSnapshot())); + } + return snapshots; + } + + /** + * Returns the Master's view of a quota on the given {@code tableName} or null if the + * Master has no quota information on that table. + */ + public static SpaceQuotaSnapshot getCurrentSnapshot( + Connection conn, TableName tn) throws IOException { + if (!(conn instanceof ClusterConnection)) { + throw new IllegalArgumentException("Expected a ClusterConnection"); + } + ClusterConnection clusterConn = (ClusterConnection) conn; + GetQuotaStatesResponse resp = QuotaStatusCalls.getMasterQuotaStates(clusterConn, 0); + HBaseProtos.TableName protoTableName = ProtobufUtil.toProtoTableName(tn); + for (GetQuotaStatesResponse.TableQuotaSnapshot tableSnapshot : resp.getTableSnapshotsList()) { + if (protoTableName.equals(tableSnapshot.getTableName())) { + return SpaceQuotaSnapshot.toSpaceQuotaSnapshot(tableSnapshot.getSnapshot()); + } + } + return null; + } + + /** + * Returns the Master's view of a quota on the given {@code namespace} or null if the + * Master has no quota information on that namespace. + */ + public static SpaceQuotaSnapshot getCurrentSnapshot( + Connection conn, String namespace) throws IOException { + if (!(conn instanceof ClusterConnection)) { + throw new IllegalArgumentException("Expected a ClusterConnection"); + } + ClusterConnection clusterConn = (ClusterConnection) conn; + GetQuotaStatesResponse resp = QuotaStatusCalls.getMasterQuotaStates(clusterConn, 0); + for (GetQuotaStatesResponse.NamespaceQuotaSnapshot nsSnapshot : resp.getNsSnapshotsList()) { + if (namespace.equals(nsSnapshot.getNamespace())) { + return SpaceQuotaSnapshot.toSpaceQuotaSnapshot(nsSnapshot.getSnapshot()); + } + } + return null; + } +} diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/SpaceQuotaHelperForTests.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/SpaceQuotaHelperForTests.java index a9a082213d..be8272f9d0 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/SpaceQuotaHelperForTests.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/SpaceQuotaHelperForTests.java @@ -443,9 +443,9 @@ public class SpaceQuotaHelperForTests { public boolean evaluate() throws Exception { SpaceQuotaSnapshot snapshot; if (null == ns) { - snapshot = QuotaTableUtil.getCurrentSnapshot(conn, tn); + snapshot = QuotaTableTestUtil.getCurrentSnapshot(conn, tn); } else { - snapshot = QuotaTableUtil.getCurrentSnapshot(conn, ns); + snapshot = QuotaTableTestUtil.getCurrentSnapshot(conn, ns); } LOG.debug("Saw quota snapshot for " + (null == tn ? ns : tn) + ": " + snapshot); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaStatusRPCs.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaStatusRPCs.java index 3e14b8a648..4debafb1e5 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaStatusRPCs.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaStatusRPCs.java @@ -108,7 +108,8 @@ public class TestQuotaStatusRPCs { } }); - Map sizes = QuotaTableUtil.getMasterReportedTableSizes(TEST_UTIL.getConnection()); + Map sizes = + QuotaTableTestUtil.getMasterReportedTableSizes(TEST_UTIL.getConnection()); Long size = sizes.get(tn); assertNotNull("No reported size for " + tn, size); assertTrue("Reported table size was " + size, size.longValue() >= tableSize); @@ -142,8 +143,8 @@ public class TestQuotaStatusRPCs { } }); - Map snapshots = QuotaTableUtil.getRegionServerQuotaSnapshots( - TEST_UTIL.getConnection(), rs.getServerName()); + Map snapshots = QuotaTableTestUtil + .getRegionServerQuotaSnapshots(TEST_UTIL.getConnection(), rs.getServerName()); SpaceQuotaSnapshot snapshot = snapshots.get(tn); assertNotNull("Did not find snapshot for " + tn, snapshot); assertTrue( @@ -189,8 +190,8 @@ public class TestQuotaStatusRPCs { }); // We obtain the violations for a RegionServer by observing the snapshots - Map snapshots = - QuotaTableUtil.getRegionServerQuotaSnapshots(TEST_UTIL.getConnection(), rs.getServerName()); + Map snapshots = QuotaTableTestUtil + .getRegionServerQuotaSnapshots(TEST_UTIL.getConnection(), rs.getServerName()); SpaceQuotaSnapshot snapshot = snapshots.get(tn); assertNotNull("Did not find snapshot for " + tn, snapshot); assertTrue(snapshot.getQuotaStatus().isInViolation()); @@ -224,7 +225,7 @@ public class TestQuotaStatusRPCs { Waiter.waitFor(TEST_UTIL.getConfiguration(), 30 * 1000, new Predicate() { @Override public boolean evaluate() throws Exception { - SpaceQuotaSnapshot snapshot = QuotaTableUtil.getCurrentSnapshot(conn, tn); + SpaceQuotaSnapshot snapshot = QuotaTableTestUtil.getCurrentSnapshot(conn, tn); LOG.info("Table snapshot after initial ingest: " + snapshot); if (snapshot == null) { return false; @@ -237,7 +238,7 @@ public class TestQuotaStatusRPCs { Waiter.waitFor(TEST_UTIL.getConfiguration(), 30 * 1000 * 1000, new Predicate() { @Override public boolean evaluate() throws Exception { - SpaceQuotaSnapshot snapshot = QuotaTableUtil.getCurrentSnapshot( + SpaceQuotaSnapshot snapshot = QuotaTableTestUtil.getCurrentSnapshot( conn, tn.getNamespaceAsString()); LOG.debug("Namespace snapshot after initial ingest: " + snapshot); if (snapshot == null) { @@ -250,7 +251,7 @@ public class TestQuotaStatusRPCs { // Sanity check: the below assertions will fail if we somehow write too much data // and force the table to move into violation before we write the second bit of data. - SpaceQuotaSnapshot snapshot = QuotaTableUtil.getCurrentSnapshot(conn, tn); + SpaceQuotaSnapshot snapshot = QuotaTableTestUtil.getCurrentSnapshot(conn, tn); assertTrue("QuotaSnapshot for " + tn + " should be non-null and not in violation", snapshot != null && !snapshot.getQuotaStatus().isInViolation()); @@ -264,7 +265,7 @@ public class TestQuotaStatusRPCs { Waiter.waitFor(TEST_UTIL.getConfiguration(), 30 * 1000, new Predicate() { @Override public boolean evaluate() throws Exception { - SpaceQuotaSnapshot snapshot = QuotaTableUtil.getCurrentSnapshot(conn, tn); + SpaceQuotaSnapshot snapshot = QuotaTableTestUtil.getCurrentSnapshot(conn, tn); LOG.info("Table snapshot after second ingest: " + snapshot); if (snapshot == null) { return false; @@ -276,7 +277,7 @@ public class TestQuotaStatusRPCs { Waiter.waitFor(TEST_UTIL.getConfiguration(), 30 * 1000, new Predicate() { @Override public boolean evaluate() throws Exception { - SpaceQuotaSnapshot snapshot = QuotaTableUtil.getCurrentSnapshot( + SpaceQuotaSnapshot snapshot = QuotaTableTestUtil.getCurrentSnapshot( conn, tn.getNamespaceAsString()); LOG.debug("Namespace snapshot after second ingest: " + snapshot); if (snapshot == null) { diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestSpaceQuotasWithSnapshots.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestSpaceQuotasWithSnapshots.java index e4f212c0e4..a65c2e9139 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestSpaceQuotasWithSnapshots.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestSpaceQuotasWithSnapshots.java @@ -122,7 +122,7 @@ public class TestSpaceQuotasWithSnapshots { waitForStableQuotaSize(conn, tn, null); // The actual size on disk after we wrote our data the first time - final long actualInitialSize = QuotaTableUtil.getCurrentSnapshot(conn, tn).getUsage(); + final long actualInitialSize = QuotaTableTestUtil.getCurrentSnapshot(conn, tn).getUsage(); LOG.info("Initial table size was " + actualInitialSize); LOG.info("Snapshot the table"); @@ -182,7 +182,7 @@ public class TestSpaceQuotasWithSnapshots { } }); - Map snapshotSizes = QuotaTableUtil.getObservedSnapshotSizes(conn); + Map snapshotSizes = QuotaTableTestUtil.getObservedSnapshotSizes(conn); Long size = snapshotSizes.get(snapshot1); assertNotNull("Did not observe the size of the snapshot", size); assertEquals( @@ -217,7 +217,7 @@ public class TestSpaceQuotasWithSnapshots { waitForStableQuotaSize(conn, null, ns); // The actual size on disk after we wrote our data the first time - final long actualInitialSize = QuotaTableUtil.getCurrentSnapshot(conn, ns).getUsage(); + final long actualInitialSize = QuotaTableTestUtil.getCurrentSnapshot(conn, ns).getUsage(); LOG.info("Initial table size was " + actualInitialSize); LOG.info("Snapshot the table"); @@ -241,7 +241,7 @@ public class TestSpaceQuotasWithSnapshots { TEST_UTIL.waitFor(30 * 1000, 500, new Predicate() { @Override public boolean evaluate() throws Exception { - Map sizes = QuotaTableUtil.getMasterReportedTableSizes(conn); + Map sizes = QuotaTableTestUtil.getMasterReportedTableSizes(conn); LOG.debug("Master observed table sizes from region size reports: " + sizes); Long size = sizes.get(tn); if (null == size) { @@ -281,7 +281,7 @@ public class TestSpaceQuotasWithSnapshots { } }); - Map snapshotSizes = QuotaTableUtil.getObservedSnapshotSizes(conn); + Map snapshotSizes = QuotaTableTestUtil.getObservedSnapshotSizes(conn); Long size = snapshotSizes.get(snapshot1); assertNotNull("Did not observe the size of the snapshot", size); assertEquals( @@ -374,7 +374,7 @@ public class TestSpaceQuotasWithSnapshots { waitForStableQuotaSize(conn, tn, null); // The actual size on disk after we wrote our data the first time - final long actualInitialSize = QuotaTableUtil.getCurrentSnapshot(conn, tn).getUsage(); + final long actualInitialSize = QuotaTableTestUtil.getCurrentSnapshot(conn, tn).getUsage(); LOG.info("Initial table size was " + actualInitialSize); LOG.info("Snapshot the table"); @@ -397,7 +397,7 @@ public class TestSpaceQuotasWithSnapshots { }); // We know that reports were sent by our RS, verify that they take up zero size. - SpaceQuotaSnapshot snapshot = QuotaTableUtil.getCurrentSnapshot(conn, tn2); + SpaceQuotaSnapshot snapshot = QuotaTableTestUtil.getCurrentSnapshot(conn, tn2); assertNotNull(snapshot); assertEquals(0, snapshot.getUsage()); @@ -436,7 +436,7 @@ public class TestSpaceQuotasWithSnapshots { } long getRegionSizeReportForTable(Connection conn, TableName tn) throws IOException { - Map sizes = QuotaTableUtil.getMasterReportedTableSizes(conn); + Map sizes = QuotaTableTestUtil.getMasterReportedTableSizes(conn); Long value = sizes.get(tn); if (null == value) { return 0L; -- 2.17.1