diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java index 3b24f3db087..b9cafd9a5f8 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java @@ -3928,7 +3928,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi * We throw RegionTooBusyException if above memstore limit * and expect client to retry using some kind of backoff */ - private void checkResources() throws RegionTooBusyException { + void checkResources() throws RegionTooBusyException { // If catalog region, do not impose resource constraints or block updates. if (this.getRegionInfo().isMetaRegion()) return; @@ -3974,7 +3974,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi * @param edits Cell updates by column * @throws IOException */ - private void put(final byte [] row, byte [] family, List edits) + void put(final byte [] row, byte [] family, List edits) throws IOException { NavigableMap> familyMap; familyMap = new TreeMap<>(Bytes.BYTES_COMPARATOR); @@ -6877,33 +6877,6 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi return r; } - /** - * Inserts a new region's meta information into the passed - * meta region. Used by the HMaster bootstrap code adding - * new table to hbase:meta table. - * - * @param meta hbase:meta HRegion to be updated - * @param r HRegion to add to meta - * - * @throws IOException - */ - // TODO remove since only test and merge use this - public static void addRegionToMETA(final HRegion meta, final HRegion r) throws IOException { - meta.checkResources(); - // The row key is the region name - byte[] row = r.getRegionInfo().getRegionName(); - final long now = EnvironmentEdgeManager.currentTime(); - final List cells = new ArrayList<>(2); - cells.add(new KeyValue(row, HConstants.CATALOG_FAMILY, - HConstants.REGIONINFO_QUALIFIER, now, - r.getRegionInfo().toByteArray())); - // Set into the root table the version of the meta table. - cells.add(new KeyValue(row, HConstants.CATALOG_FAMILY, - HConstants.META_VERSION_QUALIFIER, now, - Bytes.toBytes(HConstants.META_VERSION))); - meta.put(row, HConstants.CATALOG_FAMILY, cells); - } - /** * Computes the Path of the HRegion * diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestDefaultMemStore.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestDefaultMemStore.java index 0b1638b4d40..7b108467184 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestDefaultMemStore.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestDefaultMemStore.java @@ -975,7 +975,7 @@ public class TestDefaultMemStore { HRegion r = HRegion.createHRegion(hri, testDir, conf, desc, wFactory.getWAL(hri.getEncodedNameAsBytes(), hri.getTable().getNamespace())); - HRegion.addRegionToMETA(meta, r); + addRegionToMETA(meta, r); edge.setCurrentTimeMillis(1234 + 100); StringBuffer sb = new StringBuffer(); assertTrue(meta.shouldFlush(sb) == false); @@ -983,6 +983,32 @@ public class TestDefaultMemStore { assertTrue(meta.shouldFlush(sb) == true); } + /** + * Inserts a new region's meta information into the passed + * meta region. Used by the HMaster bootstrap code adding + * new table to hbase:meta table. + * + * @param meta hbase:meta HRegion to be updated + * @param r HRegion to add to meta + * + * @throws IOException + */ + public static void addRegionToMETA(final HRegion meta, final HRegion r) throws IOException { + meta.checkResources(); + // The row key is the region name + byte[] row = r.getRegionInfo().getRegionName(); + final long now = EnvironmentEdgeManager.currentTime(); + final List cells = new ArrayList<>(2); + cells.add(new KeyValue(row, HConstants.CATALOG_FAMILY, + HConstants.REGIONINFO_QUALIFIER, now, + r.getRegionInfo().toByteArray())); + // Set into the root table the version of the meta table. + cells.add(new KeyValue(row, HConstants.CATALOG_FAMILY, + HConstants.META_VERSION_QUALIFIER, now, + Bytes.toBytes(HConstants.META_VERSION))); + meta.put(row, HConstants.CATALOG_FAMILY, cells); + } + private class EnvironmentEdgeForMemstoreTest implements EnvironmentEdge { long t = 1234; @Override