You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ch...@apache.org on 2017/09/28 12:30:40 UTC
[10/19] hbase git commit: HBASE-18839 Apply RegionInfo to code base
http://git-wip-us.apache.org/repos/asf/hbase/blob/a11a35a1/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/flush/MasterFlushTableProcedureManager.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/flush/MasterFlushTableProcedureManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/flush/MasterFlushTableProcedureManager.java
index 03141a3..66f9240 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/flush/MasterFlushTableProcedureManager.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/flush/MasterFlushTableProcedureManager.java
@@ -24,15 +24,15 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ThreadPoolExecutor;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.yetus.audience.InterfaceAudience;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseInterfaceAudience;
-import org.apache.hadoop.hbase.HRegionInfo;
+import org.apache.hadoop.hbase.MetaTableAccessor;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.MetaTableAccessor;
+import org.apache.hadoop.hbase.client.RegionInfo;
import org.apache.hadoop.hbase.errorhandling.ForeignException;
import org.apache.hadoop.hbase.errorhandling.ForeignExceptionDispatcher;
import org.apache.hadoop.hbase.master.MasterCoprocessorHost;
@@ -43,12 +43,13 @@ import org.apache.hadoop.hbase.procedure.Procedure;
import org.apache.hadoop.hbase.procedure.ProcedureCoordinator;
import org.apache.hadoop.hbase.procedure.ProcedureCoordinatorRpcs;
import org.apache.hadoop.hbase.procedure.ZKProcedureCoordinator;
-import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ProcedureDescription;
import org.apache.hadoop.hbase.util.Pair;
import org.apache.hadoop.hbase.zookeeper.MetaTableLocator;
+import org.apache.yetus.audience.InterfaceAudience;
import org.apache.zookeeper.KeeperException;
import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
+import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ProcedureDescription;
@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.CONFIG)
public class MasterFlushTableProcedureManager extends MasterProcedureManager {
@@ -125,7 +126,7 @@ public class MasterFlushTableProcedureManager extends MasterProcedureManager {
// It is possible that regions may move after we get the region server list.
// Each region server will get its own online regions for the table.
// We may still miss regions that need to be flushed.
- List<Pair<HRegionInfo, ServerName>> regionsAndLocations;
+ List<Pair<RegionInfo, ServerName>> regionsAndLocations;
if (TableName.META_TABLE_NAME.equals(tableName)) {
regionsAndLocations = new MetaTableLocator().getMetaRegionsAndLocations(
@@ -136,9 +137,9 @@ public class MasterFlushTableProcedureManager extends MasterProcedureManager {
}
Set<String> regionServers = new HashSet<>(regionsAndLocations.size());
- for (Pair<HRegionInfo, ServerName> region : regionsAndLocations) {
+ for (Pair<RegionInfo, ServerName> region : regionsAndLocations) {
if (region != null && region.getFirst() != null && region.getSecond() != null) {
- HRegionInfo hri = region.getFirst();
+ RegionInfo hri = region.getFirst();
if (hri.isOffline() && (hri.isSplit() || hri.isSplitParent())) continue;
regionServers.add(region.getSecond().toString());
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/a11a35a1/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/FileSystemUtilizationChore.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/FileSystemUtilizationChore.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/FileSystemUtilizationChore.java
index 89d7e14..a76e9c1 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/FileSystemUtilizationChore.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/FileSystemUtilizationChore.java
@@ -26,16 +26,14 @@ import java.util.concurrent.TimeUnit;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.ScheduledChore;
-import org.apache.yetus.audience.InterfaceAudience;
+import org.apache.hadoop.hbase.client.RegionInfo;
import org.apache.hadoop.hbase.regionserver.HRegion;
import org.apache.hadoop.hbase.regionserver.HRegionServer;
import org.apache.hadoop.hbase.regionserver.Region;
import org.apache.hadoop.hbase.regionserver.Store;
-import org.apache.hadoop.hbase.regionserver.StoreFile;
-import org.apache.hadoop.hbase.regionserver.StoreFileReader;
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.yetus.audience.InterfaceAudience;
/**
* A chore which computes the size of each {@link HRegion} on the FileSystem hosted by the given {@link HRegionServer}.
@@ -76,7 +74,7 @@ public class FileSystemUtilizationChore extends ScheduledChore {
numberOfCyclesToSkip--;
return;
}
- final Map<HRegionInfo,Long> onlineRegionSizes = new HashMap<>();
+ final Map<RegionInfo, Long> onlineRegionSizes = new HashMap<>();
final Set<Region> onlineRegions = new HashSet<>(rs.getRegions());
// Process the regions from the last run if we have any. If we are somehow having difficulty
// processing the Regions, we want to avoid creating a backlog in memory of Region objs.
@@ -121,7 +119,7 @@ public class FileSystemUtilizationChore extends ScheduledChore {
continue;
}
// Avoid computing the size of region replicas.
- if (HRegionInfo.DEFAULT_REPLICA_ID != region.getRegionInfo().getReplicaId()) {
+ if (RegionInfo.DEFAULT_REPLICA_ID != region.getRegionInfo().getReplicaId()) {
skippedRegionReplicas++;
continue;
}
@@ -185,7 +183,7 @@ public class FileSystemUtilizationChore extends ScheduledChore {
* @return {@code false} if FileSystemUtilizationChore should pause reporting to master,
* {@code true} otherwise.
*/
- boolean reportRegionSizesToMaster(Map<HRegionInfo,Long> onlineRegionSizes) {
+ boolean reportRegionSizesToMaster(Map<RegionInfo,Long> onlineRegionSizes) {
return this.rs.reportRegionSizesForQuotas(onlineRegionSizes);
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/a11a35a1/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/MasterQuotaManager.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/MasterQuotaManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/MasterQuotaManager.java
index 4f2b51d..0587cc7 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/MasterQuotaManager.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/MasterQuotaManager.java
@@ -31,22 +31,22 @@ import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.DoNotRetryIOException;
-import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.MetaTableAccessor;
import org.apache.hadoop.hbase.NamespaceDescriptor;
import org.apache.hadoop.hbase.RegionStateListener;
import org.apache.hadoop.hbase.TableName;
-import org.apache.yetus.audience.InterfaceAudience;
-import org.apache.yetus.audience.InterfaceStability;
+import org.apache.hadoop.hbase.client.RegionInfo;
import org.apache.hadoop.hbase.master.MasterServices;
import org.apache.hadoop.hbase.namespace.NamespaceAuditor;
-import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
-import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest;
-import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaResponse;
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.apache.yetus.audience.InterfaceStability;
import org.apache.hadoop.hbase.shaded.com.google.common.annotations.VisibleForTesting;
import org.apache.hadoop.hbase.shaded.com.google.protobuf.TextFormat;
+import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
+import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaRequest;
+import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SetQuotaResponse;
/**
* Master Quota Manager.
@@ -60,7 +60,7 @@ import org.apache.hadoop.hbase.shaded.com.google.protobuf.TextFormat;
@InterfaceStability.Evolving
public class MasterQuotaManager implements RegionStateListener {
private static final Log LOG = LogFactory.getLog(MasterQuotaManager.class);
- private static final Map<HRegionInfo, Long> EMPTY_MAP = Collections.unmodifiableMap(
+ private static final Map<RegionInfo, Long> EMPTY_MAP = Collections.unmodifiableMap(
new HashMap<>());
private final MasterServices masterServices;
@@ -69,7 +69,7 @@ public class MasterQuotaManager implements RegionStateListener {
private NamedLock<String> userLocks;
private boolean initialized = false;
private NamespaceAuditor namespaceQuotaManager;
- private ConcurrentHashMap<HRegionInfo, SizeSnapshotWithTimestamp> regionSizes;
+ private ConcurrentHashMap<RegionInfo, SizeSnapshotWithTimestamp> regionSizes;
public MasterQuotaManager(final MasterServices masterServices) {
this.masterServices = masterServices;
@@ -367,14 +367,14 @@ public class MasterQuotaManager implements RegionStateListener {
}
@Override
- public void onRegionMerged(HRegionInfo mergedRegion) throws IOException {
+ public void onRegionMerged(RegionInfo mergedRegion) throws IOException {
if (initialized) {
namespaceQuotaManager.updateQuotaForRegionMerge(mergedRegion);
}
}
@Override
- public void onRegionSplit(HRegionInfo hri) throws IOException {
+ public void onRegionSplit(RegionInfo hri) throws IOException {
if (initialized) {
namespaceQuotaManager.checkQuotaToSplitRegion(hri);
}
@@ -476,7 +476,7 @@ public class MasterQuotaManager implements RegionStateListener {
}
@Override
- public void onRegionSplitReverted(HRegionInfo hri) throws IOException {
+ public void onRegionSplitReverted(RegionInfo hri) throws IOException {
if (initialized) {
this.namespaceQuotaManager.removeRegionFromNamespaceUsage(hri);
}
@@ -530,20 +530,20 @@ public class MasterQuotaManager implements RegionStateListener {
this.regionSizes = new ConcurrentHashMap<>();
}
- public void addRegionSize(HRegionInfo hri, long size, long time) {
+ public void addRegionSize(RegionInfo hri, long size, long time) {
if (regionSizes == null) {
return;
}
regionSizes.put(hri, new SizeSnapshotWithTimestamp(size, time));
}
- public Map<HRegionInfo, Long> snapshotRegionSizes() {
+ public Map<RegionInfo, Long> snapshotRegionSizes() {
if (regionSizes == null) {
return EMPTY_MAP;
}
- Map<HRegionInfo, Long> copy = new HashMap<>();
- for (Entry<HRegionInfo, SizeSnapshotWithTimestamp> entry : regionSizes.entrySet()) {
+ Map<RegionInfo, Long> copy = new HashMap<>();
+ for (Entry<RegionInfo, SizeSnapshotWithTimestamp> entry : regionSizes.entrySet()) {
copy.put(entry.getKey(), entry.getValue().getSize());
}
return copy;
@@ -554,7 +554,7 @@ public class MasterQuotaManager implements RegionStateListener {
return 0;
}
int numEntriesRemoved = 0;
- Iterator<Entry<HRegionInfo,SizeSnapshotWithTimestamp>> iterator =
+ Iterator<Entry<RegionInfo,SizeSnapshotWithTimestamp>> iterator =
regionSizes.entrySet().iterator();
while (iterator.hasNext()) {
long currentEntryTime = iterator.next().getValue().getTime();
http://git-wip-us.apache.org/repos/asf/hbase/blob/a11a35a1/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/NamespaceQuotaSnapshotStore.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/NamespaceQuotaSnapshotStore.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/NamespaceQuotaSnapshotStore.java
index 5f71705..8d0a27e 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/NamespaceQuotaSnapshotStore.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/NamespaceQuotaSnapshotStore.java
@@ -24,16 +24,16 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
-import org.apache.hadoop.hbase.HRegionInfo;
-import org.apache.yetus.audience.InterfaceAudience;
import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.RegionInfo;
import org.apache.hadoop.hbase.quotas.SpaceQuotaSnapshot.SpaceQuotaStatus;
-import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
-import org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas;
-import org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.SpaceQuota;
+import org.apache.yetus.audience.InterfaceAudience;
import org.apache.hadoop.hbase.shaded.com.google.common.base.Predicate;
import org.apache.hadoop.hbase.shaded.com.google.common.collect.Iterables;
+import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
+import org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas;
+import org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.SpaceQuota;
/**
* {@link QuotaSnapshotStore} implementation for namespaces.
@@ -46,9 +46,9 @@ public class NamespaceQuotaSnapshotStore implements QuotaSnapshotStore<String> {
private final Connection conn;
private final QuotaObserverChore chore;
- private Map<HRegionInfo,Long> regionUsage;
+ private Map<RegionInfo,Long> regionUsage;
- public NamespaceQuotaSnapshotStore(Connection conn, QuotaObserverChore chore, Map<HRegionInfo,Long> regionUsage) {
+ public NamespaceQuotaSnapshotStore(Connection conn, QuotaObserverChore chore, Map<RegionInfo,Long> regionUsage) {
this.conn = Objects.requireNonNull(conn);
this.chore = Objects.requireNonNull(chore);
this.regionUsage = Objects.requireNonNull(regionUsage);
@@ -83,7 +83,7 @@ public class NamespaceQuotaSnapshotStore implements QuotaSnapshotStore<String> {
try {
final long sizeLimitInBytes = spaceQuota.getSoftLimit();
long sum = 0L;
- for (Entry<HRegionInfo,Long> entry : filterBySubject(subject)) {
+ for (Entry<RegionInfo,Long> entry : filterBySubject(subject)) {
sum += entry.getValue();
}
// Add in the size for any snapshots against this table
@@ -98,12 +98,12 @@ public class NamespaceQuotaSnapshotStore implements QuotaSnapshotStore<String> {
}
@Override
- public Iterable<Entry<HRegionInfo,Long>> filterBySubject(String namespace) {
+ public Iterable<Entry<RegionInfo, Long>> filterBySubject(String namespace) {
rlock.lock();
try {
- return Iterables.filter(regionUsage.entrySet(), new Predicate<Entry<HRegionInfo,Long>>() {
+ return Iterables.filter(regionUsage.entrySet(), new Predicate<Entry<RegionInfo,Long>>() {
@Override
- public boolean apply(Entry<HRegionInfo,Long> input) {
+ public boolean apply(Entry<RegionInfo,Long> input) {
return namespace.equals(input.getKey().getTable().getNamespaceAsString());
}
});
@@ -119,7 +119,7 @@ public class NamespaceQuotaSnapshotStore implements QuotaSnapshotStore<String> {
}
@Override
- public void setRegionUsage(Map<HRegionInfo,Long> regionUsage) {
+ public void setRegionUsage(Map<RegionInfo,Long> regionUsage) {
wlock.lock();
try {
this.regionUsage = Objects.requireNonNull(regionUsage);
http://git-wip-us.apache.org/repos/asf/hbase/blob/a11a35a1/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/QuotaObserverChore.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/QuotaObserverChore.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/QuotaObserverChore.java
index 3eb36c5..bfbda35 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/QuotaObserverChore.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/QuotaObserverChore.java
@@ -29,24 +29,23 @@ import java.util.concurrent.TimeUnit;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.ScheduledChore;
import org.apache.hadoop.hbase.Stoppable;
import org.apache.hadoop.hbase.TableName;
-import org.apache.yetus.audience.InterfaceAudience;
import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.RegionInfo;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.master.HMaster;
import org.apache.hadoop.hbase.master.MetricsMaster;
-import org.apache.hadoop.hbase.quotas.SpaceQuotaSnapshot;
import org.apache.hadoop.hbase.quotas.SpaceQuotaSnapshot.SpaceQuotaStatus;
-import org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.SpaceQuota;
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.yetus.audience.InterfaceAudience;
import org.apache.hadoop.hbase.shaded.com.google.common.annotations.VisibleForTesting;
import org.apache.hadoop.hbase.shaded.com.google.common.collect.HashMultimap;
import org.apache.hadoop.hbase.shaded.com.google.common.collect.Iterables;
import org.apache.hadoop.hbase.shaded.com.google.common.collect.Multimap;
+import org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.SpaceQuota;
/**
* Reads the currently received Region filesystem-space use reports and acts on those which
@@ -159,7 +158,7 @@ public class QuotaObserverChore extends ScheduledChore {
}
// The current "view" of region space use. Used henceforth.
- final Map<HRegionInfo,Long> reportedRegionSpaceUse = quotaManager.snapshotRegionSizes();
+ final Map<RegionInfo,Long> reportedRegionSpaceUse = quotaManager.snapshotRegionSizes();
if (LOG.isTraceEnabled()) {
LOG.trace(
"Using " + reportedRegionSpaceUse.size() + " region space use reports: " +
@@ -216,8 +215,8 @@ public class QuotaObserverChore extends ScheduledChore {
processNamespacesWithQuotas(namespacesWithQuotas, tablesByNamespace);
}
- void initializeSnapshotStores(Map<HRegionInfo,Long> regionSizes) {
- Map<HRegionInfo,Long> immutableRegionSpaceUse = Collections.unmodifiableMap(regionSizes);
+ void initializeSnapshotStores(Map<RegionInfo,Long> regionSizes) {
+ Map<RegionInfo,Long> immutableRegionSpaceUse = Collections.unmodifiableMap(regionSizes);
if (tableSnapshotStore == null) {
tableSnapshotStore = new TableQuotaSnapshotStore(conn, this, immutableRegionSpaceUse);
} else {
@@ -729,7 +728,7 @@ public class QuotaObserverChore extends ScheduledChore {
* Computes the total number of regions in a table.
*/
int getNumRegions(TableName table) throws IOException {
- List<HRegionInfo> regions = this.conn.getAdmin().getTableRegions(table);
+ List<RegionInfo> regions = this.conn.getAdmin().getRegions(table);
if (regions == null) {
return 0;
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/a11a35a1/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/QuotaSnapshotStore.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/QuotaSnapshotStore.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/QuotaSnapshotStore.java
index d7c5a00..929eeb6 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/QuotaSnapshotStore.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/QuotaSnapshotStore.java
@@ -20,9 +20,10 @@ import java.io.IOException;
import java.util.Map;
import java.util.Map.Entry;
-import org.apache.hadoop.hbase.HRegionInfo;
-import org.apache.yetus.audience.InterfaceAudience;
+import org.apache.hadoop.hbase.client.RegionInfo;
import org.apache.hadoop.hbase.quotas.SpaceQuotaSnapshot.SpaceQuotaStatus;
+import org.apache.yetus.audience.InterfaceAudience;
+
import org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.SpaceQuota;
/**
@@ -68,7 +69,7 @@ public interface QuotaSnapshotStore<T> {
*
* @param subject The filter criteria. Only regions belonging to this parameter will be returned
*/
- Iterable<Entry<HRegionInfo,Long>> filterBySubject(T subject);
+ Iterable<Entry<RegionInfo,Long>> filterBySubject(T subject);
/**
* Persists the current {@link SpaceQuotaSnapshot} for the {@code subject}.
@@ -81,7 +82,7 @@ public interface QuotaSnapshotStore<T> {
/**
* Updates {@code this} with the latest snapshot of filesystem use by region.
*
- * @param regionUsage A map of {@code HRegionInfo} objects to their filesystem usage in bytes
+ * @param regionUsage A map of {@code RegionInfo} objects to their filesystem usage in bytes
*/
- void setRegionUsage(Map<HRegionInfo,Long> regionUsage);
+ void setRegionUsage(Map<RegionInfo,Long> regionUsage);
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/a11a35a1/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/TableQuotaSnapshotStore.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/TableQuotaSnapshotStore.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/TableQuotaSnapshotStore.java
index 33f748c..dfaabec 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/TableQuotaSnapshotStore.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/TableQuotaSnapshotStore.java
@@ -28,23 +28,23 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellScanner;
-import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.TableName;
-import org.apache.yetus.audience.InterfaceAudience;
import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.RegionInfo;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.ResultScanner;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.quotas.SpaceQuotaSnapshot.SpaceQuotaStatus;
+import org.apache.yetus.audience.InterfaceAudience;
+
+import org.apache.hadoop.hbase.shaded.com.google.common.base.Predicate;
+import org.apache.hadoop.hbase.shaded.com.google.common.collect.Iterables;
import org.apache.hadoop.hbase.shaded.com.google.protobuf.InvalidProtocolBufferException;
import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
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.shaded.com.google.common.base.Predicate;
-import org.apache.hadoop.hbase.shaded.com.google.common.collect.Iterables;
-
/**
* {@link QuotaSnapshotStore} for tables.
*/
@@ -58,9 +58,9 @@ public class TableQuotaSnapshotStore implements QuotaSnapshotStore<TableName> {
private final Connection conn;
private final QuotaObserverChore chore;
- private Map<HRegionInfo,Long> regionUsage;
+ private Map<RegionInfo,Long> regionUsage;
- public TableQuotaSnapshotStore(Connection conn, QuotaObserverChore chore, Map<HRegionInfo,Long> regionUsage) {
+ public TableQuotaSnapshotStore(Connection conn, QuotaObserverChore chore, Map<RegionInfo,Long> regionUsage) {
this.conn = Objects.requireNonNull(conn);
this.chore = Objects.requireNonNull(chore);
this.regionUsage = Objects.requireNonNull(regionUsage);
@@ -94,7 +94,7 @@ public class TableQuotaSnapshotStore implements QuotaSnapshotStore<TableName> {
try {
final long sizeLimitInBytes = spaceQuota.getSoftLimit();
long sum = 0L;
- for (Entry<HRegionInfo,Long> entry : filterBySubject(table)) {
+ for (Entry<RegionInfo,Long> entry : filterBySubject(table)) {
sum += entry.getValue();
}
// Add in the size for any snapshots against this table
@@ -145,12 +145,12 @@ public class TableQuotaSnapshotStore implements QuotaSnapshotStore<TableName> {
}
@Override
- public Iterable<Entry<HRegionInfo,Long>> filterBySubject(TableName table) {
+ public Iterable<Entry<RegionInfo,Long>> filterBySubject(TableName table) {
rlock.lock();
try {
- return Iterables.filter(regionUsage.entrySet(), new Predicate<Entry<HRegionInfo,Long>>() {
+ return Iterables.filter(regionUsage.entrySet(), new Predicate<Entry<RegionInfo,Long>>() {
@Override
- public boolean apply(Entry<HRegionInfo,Long> input) {
+ public boolean apply(Entry<RegionInfo,Long> input) {
return table.equals(input.getKey().getTable());
}
});
@@ -166,7 +166,7 @@ public class TableQuotaSnapshotStore implements QuotaSnapshotStore<TableName> {
}
@Override
- public void setRegionUsage(Map<HRegionInfo,Long> regionUsage) {
+ public void setRegionUsage(Map<RegionInfo,Long> regionUsage) {
wlock.lock();
try {
this.regionUsage = Objects.requireNonNull(regionUsage);
http://git-wip-us.apache.org/repos/asf/hbase/blob/a11a35a1/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
----------------------------------------------------------------------
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 9552f43..d059977 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
@@ -91,7 +91,6 @@ import org.apache.hadoop.hbase.ExtendedCellBuilderFactory;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HConstants.OperationStatusCode;
import org.apache.hadoop.hbase.HDFSBlocksDistribution;
-import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.KeyValueUtil;
import org.apache.hadoop.hbase.NamespaceDescriptor;
@@ -111,6 +110,7 @@ import org.apache.hadoop.hbase.client.IsolationLevel;
import org.apache.hadoop.hbase.client.Mutation;
import org.apache.hadoop.hbase.client.PackagePrivateFieldAccessor;
import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.client.RegionInfo;
import org.apache.hadoop.hbase.client.RegionReplicaUtil;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.RowMutations;
@@ -668,7 +668,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
* the supplied path.
* @param fs is the filesystem.
* @param confParam is global configuration settings.
- * @param regionInfo - HRegionInfo that describes the region
+ * @param regionInfo - RegionInfo that describes the region
* is new), then read them from the supplied path.
* @param htd the table descriptor
* @param rsServices reference to {@link RegionServerServices} or null
@@ -677,7 +677,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
@Deprecated
@VisibleForTesting
public HRegion(final Path tableDir, final WAL wal, final FileSystem fs,
- final Configuration confParam, final HRegionInfo regionInfo,
+ final Configuration confParam, final RegionInfo regionInfo,
final TableDescriptor htd, final RegionServerServices rsServices) {
this(new HRegionFileSystem(confParam, fs, tableDir, regionInfo),
wal, confParam, htd, rsServices);
@@ -880,7 +880,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
// Write HRI to a file in case we need to recover hbase:meta
// Only the primary replica should write .regioninfo
- if (this.getRegionInfo().getReplicaId() == HRegionInfo.DEFAULT_REPLICA_ID) {
+ if (this.getRegionInfo().getReplicaId() == RegionInfo.DEFAULT_REPLICA_ID) {
status.setStatus("Writing region info on filesystem");
fs.checkRegionInfoOnFilesystem();
} else {
@@ -1140,7 +1140,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
* @throws IOException
*/
public static HDFSBlocksDistribution computeHDFSBlocksDistribution(Configuration conf,
- TableDescriptor tableDescriptor, HRegionInfo regionInfo) throws IOException {
+ TableDescriptor tableDescriptor, RegionInfo regionInfo) throws IOException {
Path tablePath = FSUtils.getTableDir(FSUtils.getRootDir(conf), tableDescriptor.getTableName());
return computeHDFSBlocksDistribution(conf, tableDescriptor, regionInfo, tablePath);
}
@@ -1155,7 +1155,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
* @throws IOException
*/
public static HDFSBlocksDistribution computeHDFSBlocksDistribution(Configuration conf,
- TableDescriptor tableDescriptor, HRegionInfo regionInfo, Path tablePath) throws IOException {
+ TableDescriptor tableDescriptor, RegionInfo regionInfo, Path tablePath) throws IOException {
HDFSBlocksDistribution hdfsBlocksDistribution = new HDFSBlocksDistribution();
FileSystem fs = tablePath.getFileSystem(conf);
@@ -1222,7 +1222,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
}
@Override
- public HRegionInfo getRegionInfo() {
+ public RegionInfo getRegionInfo() {
return this.fs.getRegionInfo();
}
@@ -2307,7 +2307,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
}
long modifiedFlushCheckInterval = flushCheckInterval;
if (getRegionInfo().isSystemTable() &&
- getRegionInfo().getReplicaId() == HRegionInfo.DEFAULT_REPLICA_ID) {
+ getRegionInfo().getReplicaId() == RegionInfo.DEFAULT_REPLICA_ID) {
modifiedFlushCheckInterval = SYSTEM_CACHE_FLUSH_INTERVAL;
}
if (modifiedFlushCheckInterval <= 0) { //disabled
@@ -2558,7 +2558,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
/**
* Sync unflushed WAL changes. See HBASE-8208 for details
*/
- private static void doSyncOfUnflushedWALChanges(final WAL wal, final HRegionInfo hri)
+ private static void doSyncOfUnflushedWALChanges(final WAL wal, final RegionInfo hri)
throws IOException {
if (wal == null) {
return;
@@ -5798,7 +5798,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
private final FilterWrapper filter;
@Override
- public HRegionInfo getRegionInfo() {
+ public RegionInfo getRegionInfo() {
return region.getRegionInfo();
}
@@ -6435,13 +6435,13 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
* the supplied path.
* @param fs is the filesystem.
* @param conf is global configuration settings.
- * @param regionInfo - HRegionInfo that describes the region
+ * @param regionInfo - RegionInfo that describes the region
* is new), then read them from the supplied path.
* @param htd the table descriptor
* @return the new instance
*/
static HRegion newHRegion(Path tableDir, WAL wal, FileSystem fs,
- Configuration conf, HRegionInfo regionInfo, final TableDescriptor htd,
+ Configuration conf, RegionInfo regionInfo, final TableDescriptor htd,
RegionServerServices rsServices) {
try {
@SuppressWarnings("unchecked")
@@ -6450,7 +6450,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
Constructor<? extends HRegion> c =
regionClass.getConstructor(Path.class, WAL.class, FileSystem.class,
- Configuration.class, HRegionInfo.class, TableDescriptor.class,
+ Configuration.class, RegionInfo.class, TableDescriptor.class,
RegionServerServices.class);
return c.newInstance(tableDir, wal, fs, conf, regionInfo, htd, rsServices);
@@ -6470,7 +6470,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
* @return new HRegion
* @throws IOException
*/
- public static HRegion createHRegion(final HRegionInfo info, final Path rootDir,
+ public static HRegion createHRegion(final RegionInfo info, final Path rootDir,
final Configuration conf, final TableDescriptor hTableDescriptor,
final WAL wal, final boolean initialize)
throws IOException {
@@ -6485,7 +6485,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
return region;
}
- public static HRegion createHRegion(final HRegionInfo info, final Path rootDir,
+ public static HRegion createHRegion(final RegionInfo info, final Path rootDir,
final Configuration conf,
final TableDescriptor hTableDescriptor,
final WAL wal)
@@ -6505,7 +6505,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
*
* @throws IOException
*/
- public static HRegion openHRegion(final HRegionInfo info,
+ public static HRegion openHRegion(final RegionInfo info,
final TableDescriptor htd, final WAL wal,
final Configuration conf)
throws IOException {
@@ -6527,7 +6527,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
*
* @throws IOException
*/
- public static HRegion openHRegion(final HRegionInfo info,
+ public static HRegion openHRegion(final RegionInfo info,
final TableDescriptor htd, final WAL wal, final Configuration conf,
final RegionServerServices rsServices,
final CancelableProgressable reporter)
@@ -6548,7 +6548,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
* @return new HRegion
* @throws IOException
*/
- public static HRegion openHRegion(Path rootDir, final HRegionInfo info,
+ public static HRegion openHRegion(Path rootDir, final RegionInfo info,
final TableDescriptor htd, final WAL wal, final Configuration conf)
throws IOException {
return openHRegion(rootDir, info, htd, wal, conf, null, null);
@@ -6569,7 +6569,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
* @return new HRegion
* @throws IOException
*/
- public static HRegion openHRegion(final Path rootDir, final HRegionInfo info,
+ public static HRegion openHRegion(final Path rootDir, final RegionInfo info,
final TableDescriptor htd, final WAL wal, final Configuration conf,
final RegionServerServices rsServices,
final CancelableProgressable reporter)
@@ -6599,7 +6599,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
* @throws IOException
*/
public static HRegion openHRegion(final Configuration conf, final FileSystem fs,
- final Path rootDir, final HRegionInfo info, final TableDescriptor htd, final WAL wal)
+ final Path rootDir, final RegionInfo info, final TableDescriptor htd, final WAL wal)
throws IOException {
return openHRegion(conf, fs, rootDir, info, htd, wal, null, null);
}
@@ -6621,7 +6621,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
* @throws IOException
*/
public static HRegion openHRegion(final Configuration conf, final FileSystem fs,
- final Path rootDir, final HRegionInfo info, final TableDescriptor htd, final WAL wal,
+ final Path rootDir, final RegionInfo info, final TableDescriptor htd, final WAL wal,
final RegionServerServices rsServices, final CancelableProgressable reporter)
throws IOException {
Path tableDir = FSUtils.getTableDir(rootDir, info.getTable());
@@ -6645,7 +6645,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
* @throws IOException
*/
public static HRegion openHRegion(final Configuration conf, final FileSystem fs,
- final Path rootDir, final Path tableDir, final HRegionInfo info, final TableDescriptor htd,
+ final Path rootDir, final Path tableDir, final RegionInfo info, final TableDescriptor htd,
final WAL wal, final RegionServerServices rsServices,
final CancelableProgressable reporter)
throws IOException {
@@ -6709,7 +6709,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
return this;
}
- public static void warmupHRegion(final HRegionInfo info,
+ public static void warmupHRegion(final RegionInfo info,
final TableDescriptor htd, final WAL wal, final Configuration conf,
final RegionServerServices rsServices,
final CancelableProgressable reporter)
@@ -6760,7 +6760,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
* @param hri Spec. for daughter region to open.
* @throws IOException
*/
- public HRegion createDaughterRegionFromSplits(final HRegionInfo hri) throws IOException {
+ public HRegion createDaughterRegionFromSplits(final RegionInfo hri) throws IOException {
// Move the files from the temporary .splits to the final /table/region directory
fs.commitDaughterRegion(hri);
@@ -6779,7 +6779,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
* @return merged HRegion
* @throws IOException
*/
- HRegion createMergedRegionFromMerges(final HRegionInfo mergedRegionInfo,
+ HRegion createMergedRegionFromMerges(final RegionInfo mergedRegionInfo,
final HRegion region_b) throws IOException {
HRegion r = HRegion.newHRegion(this.fs.getTableDir(), this.getWAL(),
fs.getFileSystem(), this.getBaseConf(), mergedRegionInfo,
@@ -6812,33 +6812,33 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
* Computes the Path of the HRegion
*
* @param rootdir qualified path of HBase root directory
- * @param info HRegionInfo for the region
+ * @param info RegionInfo for the region
* @return qualified path of region directory
* @deprecated For tests only; to be removed.
*/
@Deprecated
@VisibleForTesting
- public static Path getRegionDir(final Path rootdir, final HRegionInfo info) {
+ public static Path getRegionDir(final Path rootdir, final RegionInfo info) {
return new Path(
FSUtils.getTableDir(rootdir, info.getTable()), info.getEncodedName());
}
/**
* Determines if the specified row is within the row range specified by the
- * specified HRegionInfo
+ * specified RegionInfo
*
- * @param info HRegionInfo that specifies the row range
+ * @param info RegionInfo that specifies the row range
* @param row row to be checked
- * @return true if the row is within the range specified by the HRegionInfo
+ * @return true if the row is within the range specified by the RegionInfo
*/
- public static boolean rowIsInRange(HRegionInfo info, final byte [] row) {
+ public static boolean rowIsInRange(RegionInfo info, final byte [] row) {
return ((info.getStartKey().length == 0) ||
(Bytes.compareTo(info.getStartKey(), row) <= 0)) &&
((info.getEndKey().length == 0) ||
(Bytes.compareTo(info.getEndKey(), row) > 0));
}
- public static boolean rowIsInRange(HRegionInfo info, final byte [] row, final int offset,
+ public static boolean rowIsInRange(RegionInfo info, final byte [] row, final int offset,
final short length) {
return ((info.getStartKey().length == 0) ||
(Bytes.compareTo(info.getStartKey(), 0, info.getStartKey().length,
http://git-wip-us.apache.org/repos/asf/hbase/blob/a11a35a1/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionFileSystem.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionFileSystem.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionFileSystem.java
index 3f42466..fcd6c57 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionFileSystem.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionFileSystem.java
@@ -42,9 +42,9 @@ import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.backup.HFileArchiver;
import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
+import org.apache.hadoop.hbase.client.RegionInfo;
import org.apache.hadoop.hbase.client.TableDescriptor;
import org.apache.hadoop.hbase.fs.HFileSystem;
import org.apache.hadoop.hbase.io.Reference;
@@ -79,9 +79,9 @@ public class HRegionFileSystem {
/** Temporary subdirectory of the region directory used for compaction output. */
private static final String REGION_TEMP_DIR = ".tmp";
- private final HRegionInfo regionInfo;
+ private final RegionInfo regionInfo;
//regionInfo for interacting with FS (getting encodedName, etc)
- private final HRegionInfo regionInfoForFs;
+ private final RegionInfo regionInfoForFs;
private final Configuration conf;
private final Path tableDir;
private final FileSystem fs;
@@ -100,10 +100,10 @@ public class HRegionFileSystem {
* @param conf the {@link Configuration} to use
* @param fs {@link FileSystem} that contains the region
* @param tableDir {@link Path} to where the table is being stored
- * @param regionInfo {@link HRegionInfo} for region
+ * @param regionInfo {@link RegionInfo} for region
*/
HRegionFileSystem(final Configuration conf, final FileSystem fs, final Path tableDir,
- final HRegionInfo regionInfo) {
+ final RegionInfo regionInfo) {
this.fs = fs;
this.conf = conf;
this.tableDir = tableDir;
@@ -120,12 +120,12 @@ public class HRegionFileSystem {
return this.fs;
}
- /** @return the {@link HRegionInfo} that describe this on-disk region view */
- public HRegionInfo getRegionInfo() {
+ /** @return the {@link RegionInfo} that describe this on-disk region view */
+ public RegionInfo getRegionInfo() {
return this.regionInfo;
}
- public HRegionInfo getRegionInfoForFS() {
+ public RegionInfo getRegionInfoForFS() {
return this.regionInfoForFs;
}
@@ -547,7 +547,7 @@ public class HRegionFileSystem {
return new Path(getRegionDir(), REGION_SPLITS_DIR);
}
- public Path getSplitsDir(final HRegionInfo hri) {
+ public Path getSplitsDir(final RegionInfo hri) {
return new Path(getSplitsDir(), hri.getEncodedName());
}
@@ -589,10 +589,10 @@ public class HRegionFileSystem {
/**
* Remove daughter region
- * @param regionInfo daughter {@link HRegionInfo}
+ * @param regionInfo daughter {@link RegionInfo}
* @throws IOException
*/
- void cleanupDaughterRegion(final HRegionInfo regionInfo) throws IOException {
+ void cleanupDaughterRegion(final RegionInfo regionInfo) throws IOException {
Path regionDir = new Path(this.tableDir, regionInfo.getEncodedName());
if (this.fs.exists(regionDir) && !deleteDir(regionDir)) {
throw new IOException("Failed delete of " + regionDir);
@@ -603,10 +603,10 @@ public class HRegionFileSystem {
* Commit a daughter region, moving it from the split temporary directory
* to the proper location in the filesystem.
*
- * @param regionInfo daughter {@link org.apache.hadoop.hbase.HRegionInfo}
+ * @param regionInfo daughter {@link org.apache.hadoop.hbase.client.RegionInfo}
* @throws IOException
*/
- public Path commitDaughterRegion(final HRegionInfo regionInfo)
+ public Path commitDaughterRegion(final RegionInfo regionInfo)
throws IOException {
Path regionDir = new Path(this.tableDir, regionInfo.getEncodedName());
Path daughterTmpDir = this.getSplitsDir(regionInfo);
@@ -648,7 +648,7 @@ public class HRegionFileSystem {
/**
* Write out a split reference. Package local so it doesnt leak out of
* regionserver.
- * @param hri {@link HRegionInfo} of the destination
+ * @param hri {@link RegionInfo} of the destination
* @param familyName Column Family Name
* @param f File to split.
* @param splitRow Split Row
@@ -657,7 +657,7 @@ public class HRegionFileSystem {
* @return Path to created reference.
* @throws IOException
*/
- public Path splitStoreFile(HRegionInfo hri, String familyName, HStoreFile f, byte[] splitRow,
+ public Path splitStoreFile(RegionInfo hri, String familyName, HStoreFile f, byte[] splitRow,
boolean top, RegionSplitPolicy splitPolicy) throws IOException {
if (splitPolicy == null || !splitPolicy.skipStoreFileRangeCheck(familyName)) {
// Check whether the split row lies in the range of the store file
@@ -715,7 +715,7 @@ public class HRegionFileSystem {
return new Path(getRegionDir(), REGION_MERGES_DIR);
}
- Path getMergesDir(final HRegionInfo hri) {
+ Path getMergesDir(final RegionInfo hri) {
return new Path(getMergesDir(), hri.getEncodedName());
}
@@ -728,10 +728,10 @@ public class HRegionFileSystem {
/**
* Remove merged region
- * @param mergedRegion {@link HRegionInfo}
+ * @param mergedRegion {@link RegionInfo}
* @throws IOException
*/
- public void cleanupMergedRegion(final HRegionInfo mergedRegion) throws IOException {
+ public void cleanupMergedRegion(final RegionInfo mergedRegion) throws IOException {
Path regionDir = new Path(this.tableDir, mergedRegion.getEncodedName());
if (this.fs.exists(regionDir) && !this.fs.delete(regionDir, true)) {
throw new IOException("Failed delete of " + regionDir);
@@ -769,14 +769,14 @@ public class HRegionFileSystem {
/**
* Write out a merge reference under the given merges directory. Package local
* so it doesnt leak out of regionserver.
- * @param mergedRegion {@link HRegionInfo} of the merged region
+ * @param mergedRegion {@link RegionInfo} of the merged region
* @param familyName Column Family Name
* @param f File to create reference.
* @param mergedDir
* @return Path to created reference.
* @throws IOException
*/
- public Path mergeStoreFile(HRegionInfo mergedRegion, String familyName, HStoreFile f,
+ public Path mergeStoreFile(RegionInfo mergedRegion, String familyName, HStoreFile f,
Path mergedDir) throws IOException {
Path referenceDir = new Path(new Path(mergedDir,
mergedRegion.getEncodedName()), familyName);
@@ -797,10 +797,10 @@ public class HRegionFileSystem {
/**
* Commit a merged region, moving it from the merges temporary directory to
* the proper location in the filesystem.
- * @param mergedRegionInfo merged region {@link HRegionInfo}
+ * @param mergedRegionInfo merged region {@link RegionInfo}
* @throws IOException
*/
- public void commitMergedRegion(final HRegionInfo mergedRegionInfo) throws IOException {
+ public void commitMergedRegion(final RegionInfo mergedRegionInfo) throws IOException {
Path regionDir = new Path(this.tableDir, mergedRegionInfo.getEncodedName());
Path mergedRegionTmpDir = this.getMergesDir(mergedRegionInfo);
// Move the tmp dir in the expected location
@@ -829,22 +829,22 @@ public class HRegionFileSystem {
* @return Content of the file we write out to the filesystem under a region
* @throws IOException
*/
- private static byte[] getRegionInfoFileContent(final HRegionInfo hri) throws IOException {
- return hri.toDelimitedByteArray();
+ private static byte[] getRegionInfoFileContent(final RegionInfo hri) throws IOException {
+ return RegionInfo.toDelimitedByteArray(hri);
}
/**
- * Create a {@link HRegionInfo} from the serialized version on-disk.
+ * Create a {@link RegionInfo} from the serialized version on-disk.
* @param fs {@link FileSystem} that contains the Region Info file
* @param regionDir {@link Path} to the Region Directory that contains the Info file
- * @return An {@link HRegionInfo} instance gotten from the Region Info file.
+ * @return An {@link RegionInfo} instance gotten from the Region Info file.
* @throws IOException if an error occurred during file open/read operation.
*/
- public static HRegionInfo loadRegionInfoFileContent(final FileSystem fs, final Path regionDir)
+ public static RegionInfo loadRegionInfoFileContent(final FileSystem fs, final Path regionDir)
throws IOException {
FSDataInputStream in = fs.open(new Path(regionDir, REGION_INFO_FILE));
try {
- return HRegionInfo.parseFrom(in);
+ return RegionInfo.parseFrom(in);
} finally {
in.close();
}
@@ -921,7 +921,7 @@ public class HRegionFileSystem {
/**
* Write out an info file under the region directory. Useful recovering mangled regions.
- * @param regionInfoContent serialized version of the {@link HRegionInfo}
+ * @param regionInfoContent serialized version of the {@link RegionInfo}
* @param useTempDir indicate whether or not using the region .tmp dir for a safer file creation.
*/
private void writeRegionInfoOnFilesystem(final byte[] regionInfoContent,
@@ -962,11 +962,11 @@ public class HRegionFileSystem {
* @param conf the {@link Configuration} to use
* @param fs {@link FileSystem} from which to add the region
* @param tableDir {@link Path} to where the table is being stored
- * @param regionInfo {@link HRegionInfo} for region to be added
+ * @param regionInfo {@link RegionInfo} for region to be added
* @throws IOException if the region creation fails due to a FileSystem exception.
*/
public static HRegionFileSystem createRegionOnFileSystem(final Configuration conf,
- final FileSystem fs, final Path tableDir, final HRegionInfo regionInfo) throws IOException {
+ final FileSystem fs, final Path tableDir, final RegionInfo regionInfo) throws IOException {
HRegionFileSystem regionFs = new HRegionFileSystem(conf, fs, tableDir, regionInfo);
Path regionDir = regionFs.getRegionDir();
@@ -983,7 +983,7 @@ public class HRegionFileSystem {
// Write HRI to a file in case we need to recover hbase:meta
// Only primary replicas should write region info
- if (regionInfo.getReplicaId() == HRegionInfo.DEFAULT_REPLICA_ID) {
+ if (regionInfo.getReplicaId() == RegionInfo.DEFAULT_REPLICA_ID) {
regionFs.writeRegionInfoOnFilesystem(false);
} else {
if (LOG.isDebugEnabled())
@@ -997,12 +997,12 @@ public class HRegionFileSystem {
* @param conf the {@link Configuration} to use
* @param fs {@link FileSystem} from which to add the region
* @param tableDir {@link Path} to where the table is being stored
- * @param regionInfo {@link HRegionInfo} for region to be added
+ * @param regionInfo {@link RegionInfo} for region to be added
* @param readOnly True if you don't want to edit the region data
* @throws IOException if the region creation fails due to a FileSystem exception.
*/
public static HRegionFileSystem openRegionFromFileSystem(final Configuration conf,
- final FileSystem fs, final Path tableDir, final HRegionInfo regionInfo, boolean readOnly)
+ final FileSystem fs, final Path tableDir, final RegionInfo regionInfo, boolean readOnly)
throws IOException {
HRegionFileSystem regionFs = new HRegionFileSystem(conf, fs, tableDir, regionInfo);
Path regionDir = regionFs.getRegionDir();
@@ -1020,7 +1020,7 @@ public class HRegionFileSystem {
// If it doesn't exists, Write HRI to a file, in case we need to recover hbase:meta
// Only create HRI if we are the default replica
- if (regionInfo.getReplicaId() == HRegionInfo.DEFAULT_REPLICA_ID) {
+ if (regionInfo.getReplicaId() == RegionInfo.DEFAULT_REPLICA_ID) {
regionFs.checkRegionInfoOnFilesystem();
} else {
if (LOG.isDebugEnabled()) {
@@ -1037,11 +1037,11 @@ public class HRegionFileSystem {
* @param conf the {@link Configuration} to use
* @param fs {@link FileSystem} from which to remove the region
* @param tableDir {@link Path} to where the table is being stored
- * @param regionInfo {@link HRegionInfo} for region to be deleted
+ * @param regionInfo {@link RegionInfo} for region to be deleted
* @throws IOException if the request cannot be completed
*/
public static void deleteRegionFromFileSystem(final Configuration conf,
- final FileSystem fs, final Path tableDir, final HRegionInfo regionInfo) throws IOException {
+ final FileSystem fs, final Path tableDir, final RegionInfo regionInfo) throws IOException {
HRegionFileSystem regionFs = new HRegionFileSystem(conf, fs, tableDir, regionInfo);
Path regionDir = regionFs.getRegionDir();
http://git-wip-us.apache.org/repos/asf/hbase/blob/a11a35a1/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
index 53f4445..5ef0358 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
@@ -18,6 +18,9 @@
*/
package org.apache.hadoop.hbase.regionserver;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.servlet.http.HttpServlet;
import java.io.IOException;
import java.io.InterruptedIOException;
import java.lang.Thread.UncaughtExceptionHandler;
@@ -51,10 +54,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.function.Function;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-import javax.servlet.http.HttpServlet;
-
import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.SystemUtils;
import org.apache.commons.logging.Log;
@@ -71,7 +70,6 @@ import org.apache.hadoop.hbase.DoNotRetryIOException;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseInterfaceAudience;
import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.HealthCheckChore;
import org.apache.hadoop.hbase.MetaTableAccessor;
import org.apache.hadoop.hbase.NotServingRegionException;
@@ -87,6 +85,8 @@ import org.apache.hadoop.hbase.client.ClusterConnection;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionUtils;
import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.client.RegionInfo;
+import org.apache.hadoop.hbase.client.RegionInfoBuilder;
import org.apache.hadoop.hbase.client.RpcRetryingCallerFactory;
import org.apache.hadoop.hbase.client.TableDescriptorBuilder;
import org.apache.hadoop.hbase.client.locking.EntityLock;
@@ -1229,7 +1229,7 @@ public class HRegionServer extends HasThread implements
}
private boolean containsMetaTableRegions() {
- return onlineRegions.containsKey(HRegionInfo.FIRST_META_REGIONINFO.getEncodedName());
+ return onlineRegions.containsKey(RegionInfoBuilder.FIRST_META_REGIONINFO.getEncodedName());
}
private boolean areAllUserRegionsOffline() {
@@ -1292,7 +1292,7 @@ public class HRegionServer extends HasThread implements
* @param onlineRegionSizes A map of region info to size in bytes
* @return false if FileSystemUtilizationChore should pause reporting to master. true otherwise
*/
- public boolean reportRegionSizesForQuotas(final Map<HRegionInfo, Long> onlineRegionSizes) {
+ public boolean reportRegionSizesForQuotas(final Map<RegionInfo, Long> onlineRegionSizes) {
RegionServerStatusService.BlockingInterface rss = rssStub;
if (rss == null) {
// the current server could be stopping.
@@ -1336,25 +1336,25 @@ public class HRegionServer extends HasThread implements
* @param regionSizes Map of region info to size in bytes.
* @return The corresponding protocol buffer message.
*/
- RegionSpaceUseReportRequest buildRegionSpaceUseReportRequest(Map<HRegionInfo,Long> regionSizes) {
+ RegionSpaceUseReportRequest buildRegionSpaceUseReportRequest(Map<RegionInfo,Long> regionSizes) {
RegionSpaceUseReportRequest.Builder request = RegionSpaceUseReportRequest.newBuilder();
- for (Entry<HRegionInfo, Long> entry : Objects.requireNonNull(regionSizes).entrySet()) {
+ for (Entry<RegionInfo, Long> entry : Objects.requireNonNull(regionSizes).entrySet()) {
request.addSpaceUse(convertRegionSize(entry.getKey(), entry.getValue()));
}
return request.build();
}
/**
- * Converts a pair of {@link HRegionInfo} and {@code long} into a {@link RegionSpaceUse}
+ * Converts a pair of {@link RegionInfo} and {@code long} into a {@link RegionSpaceUse}
* protobuf message.
*
- * @param regionInfo The HRegionInfo
+ * @param regionInfo The RegionInfo
* @param sizeInBytes The size in bytes of the Region
* @return The protocol buffer
*/
- RegionSpaceUse convertRegionSize(HRegionInfo regionInfo, Long sizeInBytes) {
+ RegionSpaceUse convertRegionSize(RegionInfo regionInfo, Long sizeInBytes) {
return RegionSpaceUse.newBuilder()
- .setRegionInfo(HRegionInfo.convert(Objects.requireNonNull(regionInfo)))
+ .setRegionInfo(ProtobufUtil.toRegionInfo(Objects.requireNonNull(regionInfo)))
.setRegionSize(Objects.requireNonNull(sizeInBytes))
.build();
}
@@ -1470,7 +1470,7 @@ public class HRegionServer extends HasThread implements
// protect against the case where an open comes in after we start the
// iterator of onlineRegions to close all user regions.
for (Map.Entry<String, Region> e : this.onlineRegions.entrySet()) {
- HRegionInfo hri = e.getValue().getRegionInfo();
+ RegionInfo hri = e.getValue().getRegionInfo();
if (!this.regionsInTransitionInRS.containsKey(hri.getEncodedNameAsBytes())
&& !closedRegions.contains(hri.getEncodedName())) {
closedRegions.add(hri.getEncodedName());
@@ -2075,11 +2075,11 @@ public class HRegionServer extends HasThread implements
}
@Override
- public WAL getWAL(HRegionInfo regionInfo) throws IOException {
+ public WAL getWAL(RegionInfo regionInfo) throws IOException {
WAL wal;
// _ROOT_ and hbase:meta regions have separate WAL.
if (regionInfo != null && regionInfo.isMetaTable()
- && regionInfo.getReplicaId() == HRegionInfo.DEFAULT_REPLICA_ID) {
+ && regionInfo.getReplicaId() == RegionInfo.DEFAULT_REPLICA_ID) {
wal = walFactory.getMetaWAL(regionInfo.getEncodedNameAsBytes());
} else if (regionInfo == null) {
wal = walFactory.getWAL(UNSPECIFIED_REGION, null);
@@ -2198,13 +2198,13 @@ public class HRegionServer extends HasThread implements
}
@Override
- public boolean reportRegionStateTransition(TransitionCode code, HRegionInfo... hris) {
+ public boolean reportRegionStateTransition(TransitionCode code, RegionInfo... hris) {
return reportRegionStateTransition(code, HConstants.NO_SEQNUM, hris);
}
@Override
public boolean reportRegionStateTransition(
- TransitionCode code, long openSeqNum, HRegionInfo... hris) {
+ TransitionCode code, long openSeqNum, RegionInfo... hris) {
return reportRegionStateTransition(
new RegionStateTransitionContext(code, HConstants.NO_SEQNUM, -1, hris));
}
@@ -2214,7 +2214,7 @@ public class HRegionServer extends HasThread implements
TransitionCode code = context.getCode();
long openSeqNum = context.getOpenSeqNum();
long masterSystemTime = context.getMasterSystemTime();
- HRegionInfo[] hris = context.getHris();
+ RegionInfo[] hris = context.getHris();
if (TEST_SKIP_REPORTING_TRANSITION) {
// This is for testing only in case there is no master
@@ -2250,8 +2250,8 @@ public class HRegionServer extends HasThread implements
if (code == TransitionCode.OPENED && openSeqNum >= 0) {
transition.setOpenSeqNum(openSeqNum);
}
- for (HRegionInfo hri: hris) {
- transition.addRegionInfo(HRegionInfo.convert(hri));
+ for (RegionInfo hri: hris) {
+ transition.addRegionInfo(ProtobufUtil.toRegionInfo(hri));
}
ReportRegionStateTransitionRequest request = builder.build();
int tries = 0;
@@ -2668,7 +2668,7 @@ public class HRegionServer extends HasThread implements
this.lock.writeLock().lock();
try {
for (Map.Entry<String, Region> e: onlineRegions.entrySet()) {
- HRegionInfo hri = e.getValue().getRegionInfo();
+ RegionInfo hri = e.getValue().getRegionInfo();
if (hri.isMetaRegion()) {
meta = e.getValue();
}
@@ -2802,8 +2802,8 @@ public class HRegionServer extends HasThread implements
* calculate which regions are most loaded. (Right now, we're just grabbing
* the first N regions being served regardless of load.)
*/
- protected HRegionInfo[] getMostLoadedRegions() {
- ArrayList<HRegionInfo> regions = new ArrayList<>();
+ protected RegionInfo[] getMostLoadedRegions() {
+ ArrayList<RegionInfo> regions = new ArrayList<>();
for (Region r : onlineRegions.values()) {
if (!r.isAvailable()) {
continue;
@@ -2814,7 +2814,7 @@ public class HRegionServer extends HasThread implements
break;
}
}
- return regions.toArray(new HRegionInfo[regions.size()]);
+ return regions.toArray(new RegionInfo[regions.size()]);
}
@Override
@@ -3007,7 +3007,7 @@ public class HRegionServer extends HasThread implements
List<Region> tableRegions = new ArrayList<>();
synchronized (this.onlineRegions) {
for (Region region: this.onlineRegions.values()) {
- HRegionInfo regionInfo = region.getRegionInfo();
+ RegionInfo regionInfo = region.getRegionInfo();
if(regionInfo.getTable().equals(tableName)) {
tableRegions.add(region);
}
@@ -3070,7 +3070,7 @@ public class HRegionServer extends HasThread implements
* Try to close the region, logs a warning on failure but continues.
* @param region Region to close
*/
- private void closeRegionIgnoreErrors(HRegionInfo region, final boolean abort) {
+ private void closeRegionIgnoreErrors(RegionInfo region, final boolean abort) {
try {
if (!closeRegion(region.getEncodedName(), abort, null)) {
LOG.warn("Failed to close " + region.getRegionNameAsString() +
@@ -3150,7 +3150,7 @@ public class HRegionServer extends HasThread implements
}
CloseRegionHandler crh;
- final HRegionInfo hri = actualRegion.getRegionInfo();
+ final RegionInfo hri = actualRegion.getRegionInfo();
if (hri.isMetaRegion()) {
crh = new CloseMetaHandler(this, this, hri, abort);
} else {
@@ -3223,7 +3223,7 @@ public class HRegionServer extends HasThread implements
* named region is not member of the online regions.
*/
public Region getOnlineRegion(final byte[] regionName) {
- String encodedRegionName = HRegionInfo.encodeRegionName(regionName);
+ String encodedRegionName = RegionInfo.encodeRegionName(regionName);
return this.onlineRegions.get(encodedRegionName);
}
@@ -3263,7 +3263,7 @@ public class HRegionServer extends HasThread implements
*/
protected Region getRegion(final byte[] regionName)
throws NotServingRegionException {
- String encodedRegionName = HRegionInfo.encodeRegionName(regionName);
+ String encodedRegionName = RegionInfo.encodeRegionName(regionName);
return getRegionByEncodedName(regionName, encodedRegionName);
}
@@ -3537,7 +3537,7 @@ public class HRegionServer extends HasThread implements
return;
}
- HRegionInfo regionInfo = r.getRegionInfo();
+ RegionInfo regionInfo = r.getRegionInfo();
ZooKeeperWatcher zkw = getZooKeeper();
String previousRSName = this.getLastFailedRSFromZK(regionInfo.getEncodedName());
Map<byte[], Long> maxSeqIdInStores = r.getMaxStoreSeqId();
@@ -3747,7 +3747,7 @@ public class HRegionServer extends HasThread implements
}
@Override
- public EntityLock regionLock(List<HRegionInfo> regionInfos, String description,
+ public EntityLock regionLock(List<RegionInfo> regionInfos, String description,
Abortable abort) throws IOException {
return new LockServiceClient(conf, lockStub, clusterConnection.getNonceGenerator())
.regionLock(regionInfos, description, abort);
http://git-wip-us.apache.org/repos/asf/hbase/blob/a11a35a1/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
index 8c55c42..f232ddd 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
@@ -59,11 +59,11 @@ import org.apache.hadoop.hbase.CellComparator;
import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.CompoundConfiguration;
import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.MemoryCompactionPolicy;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.backup.FailedArchiveException;
import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
+import org.apache.hadoop.hbase.client.RegionInfo;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.conf.ConfigurationManager;
import org.apache.hadoop.hbase.conf.PropagatingConfigurationObserver;
@@ -467,13 +467,13 @@ public class HStore implements Store, HeapSize, StoreConfigInformation, Propagat
/**
* @param tabledir {@link Path} to where the table is being stored
- * @param hri {@link HRegionInfo} for the region.
+ * @param hri {@link RegionInfo} for the region.
* @param family {@link ColumnFamilyDescriptor} describing the column family
* @return Path to family/Store home directory.
*/
@Deprecated
public static Path getStoreHomedir(final Path tabledir,
- final HRegionInfo hri, final byte[] family) {
+ final RegionInfo hri, final byte[] family) {
return getStoreHomedir(tabledir, hri.getEncodedName(), family);
}
@@ -1454,7 +1454,7 @@ public class HStore implements Store, HeapSize, StoreConfigInformation, Propagat
filesCompacted.stream().map(HStoreFile::getPath).collect(Collectors.toList());
List<Path> outputPaths =
newFiles.stream().map(HStoreFile::getPath).collect(Collectors.toList());
- HRegionInfo info = this.region.getRegionInfo();
+ RegionInfo info = this.region.getRegionInfo();
CompactionDescriptor compactionDescriptor = ProtobufUtil.toCompactionDescriptor(info,
family.getName(), inputPaths, outputPaths, fs.getStoreDir(getColumnFamilyDescriptor().getNameAsString()));
// Fix reaching into Region to get the maxWaitForSeqId.
@@ -2142,7 +2142,7 @@ public class HStore implements Store, HeapSize, StoreConfigInformation, Propagat
}
@Override
- public HRegionInfo getRegionInfo() {
+ public RegionInfo getRegionInfo() {
return this.fs.getRegionInfo();
}
@@ -2452,7 +2452,7 @@ public class HStore implements Store, HeapSize, StoreConfigInformation, Propagat
@Override
public boolean isPrimaryReplicaStore() {
- return getRegionInfo().getReplicaId() == HRegionInfo.DEFAULT_REPLICA_ID;
+ return getRegionInfo().getReplicaId() == RegionInfo.DEFAULT_REPLICA_ID;
}
/**
http://git-wip-us.apache.org/repos/asf/hbase/blob/a11a35a1/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionWrapperImpl.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionWrapperImpl.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionWrapperImpl.java
index efdf712..24e1ae5 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionWrapperImpl.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionWrapperImpl.java
@@ -30,7 +30,7 @@ import java.util.concurrent.TimeUnit;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.CompatibilitySingletonFactory;
-import org.apache.hadoop.hbase.HRegionInfo;
+import org.apache.hadoop.hbase.client.RegionInfo;
import org.apache.hadoop.hbase.client.TableDescriptor;
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
import org.apache.hadoop.metrics2.MetricsExecutor;
@@ -88,7 +88,7 @@ public class MetricsRegionWrapperImpl implements MetricsRegionWrapper, Closeable
@Override
public String getRegionName() {
- HRegionInfo regionInfo = this.region.getRegionInfo();
+ RegionInfo regionInfo = this.region.getRegionInfo();
if (regionInfo == null) {
return UNKNOWN;
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/a11a35a1/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
index e71c1eb..dba314d 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
@@ -18,6 +18,31 @@
*/
package org.apache.hadoop.hbase.regionserver;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InterruptedIOException;
+import java.net.BindException;
+import java.net.InetSocketAddress;
+import java.net.UnknownHostException;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.NavigableMap;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.atomic.LongAdder;
+
import org.apache.commons.lang3.mutable.MutableObject;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -33,13 +58,11 @@ import org.apache.hadoop.hbase.DoNotRetryIOException;
import org.apache.hadoop.hbase.DroppedSnapshotException;
import org.apache.hadoop.hbase.HBaseIOException;
import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.MultiActionResultTooLarge;
import org.apache.hadoop.hbase.NotServingRegionException;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.UnknownScannerException;
-import org.apache.yetus.audience.InterfaceAudience;
import org.apache.hadoop.hbase.client.Append;
import org.apache.hadoop.hbase.client.ConnectionUtils;
import org.apache.hadoop.hbase.client.Delete;
@@ -48,6 +71,7 @@ import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.Increment;
import org.apache.hadoop.hbase.client.Mutation;
import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.client.RegionInfo;
import org.apache.hadoop.hbase.client.RegionReplicaUtil;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.RowMutations;
@@ -88,9 +112,22 @@ import org.apache.hadoop.hbase.regionserver.compactions.CompactionLifeCycleTrack
import org.apache.hadoop.hbase.regionserver.handler.OpenMetaHandler;
import org.apache.hadoop.hbase.regionserver.handler.OpenPriorityRegionHandler;
import org.apache.hadoop.hbase.regionserver.handler.OpenRegionHandler;
-import org.apache.hadoop.hbase.wal.WALEdit;
import org.apache.hadoop.hbase.security.Superusers;
import org.apache.hadoop.hbase.security.User;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.DNS;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.hadoop.hbase.util.Pair;
+import org.apache.hadoop.hbase.util.ServerRegionReplicaUtil;
+import org.apache.hadoop.hbase.util.Strings;
+import org.apache.hadoop.hbase.wal.WAL;
+import org.apache.hadoop.hbase.wal.WALEdit;
+import org.apache.hadoop.hbase.wal.WALKey;
+import org.apache.hadoop.hbase.wal.WALSplitter;
+import org.apache.hadoop.hbase.zookeeper.ZKSplitLog;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.apache.zookeeper.KeeperException;
+
import org.apache.hadoop.hbase.shaded.com.google.common.annotations.VisibleForTesting;
import org.apache.hadoop.hbase.shaded.com.google.common.cache.Cache;
import org.apache.hadoop.hbase.shaded.com.google.common.cache.CacheBuilder;
@@ -172,7 +209,6 @@ import org.apache.hadoop.hbase.shaded.protobuf.generated.ClusterStatusProtos;
import org.apache.hadoop.hbase.shaded.protobuf.generated.ClusterStatusProtos.RegionLoad;
import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.NameBytesPair;
import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.NameInt64Pair;
-import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionInfo;
import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionSpecifier;
import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionSpecifier.RegionSpecifierType;
import org.apache.hadoop.hbase.shaded.protobuf.generated.MapReduceProtos.ScanMetrics;
@@ -184,42 +220,6 @@ import org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.BulkLoadDescr
import org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.CompactionDescriptor;
import org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.FlushDescriptor;
import org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.RegionEventDescriptor;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.hadoop.hbase.util.DNS;
-import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
-import org.apache.hadoop.hbase.util.Pair;
-import org.apache.hadoop.hbase.util.ServerRegionReplicaUtil;
-import org.apache.hadoop.hbase.util.Strings;
-import org.apache.hadoop.hbase.wal.WAL;
-import org.apache.hadoop.hbase.wal.WALKey;
-import org.apache.hadoop.hbase.wal.WALSplitter;
-import org.apache.hadoop.hbase.zookeeper.ZKSplitLog;
-import org.apache.zookeeper.KeeperException;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InterruptedIOException;
-import java.net.BindException;
-import java.net.InetSocketAddress;
-import java.net.UnknownHostException;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.NavigableMap;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.concurrent.atomic.LongAdder;
/**
* Implements the regionserver RPC services.
@@ -1370,7 +1370,7 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
switch (type) {
case REGION_NAME:
byte[] regionName = value.toByteArray();
- String encodedRegionName = HRegionInfo.encodeRegionName(regionName);
+ String encodedRegionName = RegionInfo.encodeRegionName(regionName);
return regionServer.getRegionByEncodedName(regionName, encodedRegionName);
case ENCODED_REGION_NAME:
return regionServer.getRegionByEncodedName(value.toStringUtf8());
@@ -1653,11 +1653,11 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
checkOpen();
requestCount.increment();
Map<String, Region> onlineRegions = regionServer.onlineRegions;
- List<HRegionInfo> list = new ArrayList<>(onlineRegions.size());
+ List<RegionInfo> list = new ArrayList<>(onlineRegions.size());
for (Region region: onlineRegions.values()) {
list.add(region.getRegionInfo());
}
- Collections.sort(list);
+ Collections.sort(list, RegionInfo.COMPARATOR);
return ResponseConverter.buildGetOnlineRegionResponse(list);
} catch (IOException ie) {
throw new ServiceException(ie);
@@ -1672,7 +1672,7 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
checkOpen();
requestCount.increment();
Region region = getRegion(request.getRegion());
- HRegionInfo info = region.getRegionInfo();
+ RegionInfo info = region.getRegionInfo();
byte[] bestSplitRow = null;
if (request.hasBestSplitRow() && request.getBestSplitRow()) {
HRegion r = (HRegion) region;
@@ -1688,7 +1688,7 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
r.clearSplit();
}
GetRegionInfoResponse.Builder builder = GetRegionInfoResponse.newBuilder();
- builder.setRegionInfo(HRegionInfo.convert(info));
+ builder.setRegionInfo(ProtobufUtil.toRegionInfo(info));
if (request.hasCompactionState() && request.getCompactionState()) {
builder.setCompactionState(region.getCompactionState());
}
@@ -1866,7 +1866,7 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
} catch (IOException ie) {
TableName tableName = null;
if (regionCount == 1) {
- RegionInfo ri = request.getOpenInfo(0).getRegion();
+ org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionInfo ri = request.getOpenInfo(0).getRegion();
if (ri != null) {
tableName = ProtobufUtil.toTableName(ri.getTableName());
}
@@ -1897,7 +1897,7 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
long masterSystemTime = request.hasMasterSystemTime() ? request.getMasterSystemTime() : -1;
for (RegionOpenInfo regionOpenInfo : request.getOpenInfoList()) {
- final HRegionInfo region = HRegionInfo.convert(regionOpenInfo.getRegion());
+ final RegionInfo region = ProtobufUtil.toRegionInfo(regionOpenInfo.getRegion());
TableDescriptor htd;
try {
String encodedName = region.getEncodedName();
@@ -2018,8 +2018,7 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
public WarmupRegionResponse warmupRegion(final RpcController controller,
final WarmupRegionRequest request) throws ServiceException {
- RegionInfo regionInfo = request.getRegionInfo();
- final HRegionInfo region = HRegionInfo.convert(regionInfo);
+ final RegionInfo region = ProtobufUtil.toRegionInfo(request.getRegionInfo());
TableDescriptor htd;
WarmupRegionResponse response = WarmupRegionResponse.getDefaultInstance();
@@ -2237,7 +2236,7 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
List<UpdateFavoredNodesRequest.RegionUpdateInfo> openInfoList = request.getUpdateInfoList();
UpdateFavoredNodesResponse.Builder respBuilder = UpdateFavoredNodesResponse.newBuilder();
for (UpdateFavoredNodesRequest.RegionUpdateInfo regionUpdateInfo : openInfoList) {
- HRegionInfo hri = HRegionInfo.convert(regionUpdateInfo.getRegion());
+ RegionInfo hri = ProtobufUtil.toRegionInfo(regionUpdateInfo.getRegion());
if (regionUpdateInfo.getFavoredNodesCount() > 0) {
regionServer.updateRegionFavoredNodesMapping(hri.getEncodedName(),
regionUpdateInfo.getFavoredNodesList());
@@ -2868,7 +2867,7 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
"'hbase.client.scanner.timeout.period' configuration.");
}
}
- HRegionInfo hri = rsh.s.getRegionInfo();
+ RegionInfo hri = rsh.s.getRegionInfo();
// Yes, should be the same instance
if (regionServer.getOnlineRegion(hri.getRegionName()) != rsh.r) {
String msg = "Region has changed on the scanner " + scannerName + ": regionName="
http://git-wip-us.apache.org/repos/asf/hbase/blob/a11a35a1/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Region.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Region.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Region.java
index 073c25f..f410e57 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Region.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Region.java
@@ -28,7 +28,6 @@ import org.apache.hadoop.hbase.CellComparator;
import org.apache.hadoop.hbase.CompareOperator;
import org.apache.hadoop.hbase.HBaseInterfaceAudience;
import org.apache.hadoop.hbase.HDFSBlocksDistribution;
-import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.client.Append;
import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Get;
@@ -36,6 +35,7 @@ import org.apache.hadoop.hbase.client.Increment;
import org.apache.hadoop.hbase.client.IsolationLevel;
import org.apache.hadoop.hbase.client.Mutation;
import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.client.RegionInfo;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.RowMutations;
import org.apache.hadoop.hbase.client.Scan;
@@ -78,7 +78,7 @@ public interface Region extends ConfigurationObserver {
// Region state
/** @return region information for this region */
- HRegionInfo getRegionInfo();
+ RegionInfo getRegionInfo();
/** @return table descriptor for this region */
TableDescriptor getTableDescriptor();
@@ -308,11 +308,11 @@ public interface Region extends ConfigurationObserver {
*
* Before calling this function make sure that a region operation has already been
* started (the calling thread has already acquired the region-close-guard lock).
- *
+ *
* NOTE: the boolean passed here has changed. It used to be a boolean that
* stated whether or not to wait on the lock. Now it is whether it an exclusive
* lock is requested.
- *
+ *
* @param row The row actions will be performed against
* @param readLock is the lock reader or writer. True indicates that a non-exclusive
* lock is requested
http://git-wip-us.apache.org/repos/asf/hbase/blob/a11a35a1/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionMergeRequest.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionMergeRequest.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionMergeRequest.java
index c3c78bc..1779e5c 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionMergeRequest.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionMergeRequest.java
@@ -22,23 +22,24 @@ import java.security.PrivilegedAction;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.TableName;
-import org.apache.yetus.audience.InterfaceAudience;
+import org.apache.hadoop.hbase.client.RegionInfo;
+import org.apache.hadoop.hbase.client.RegionInfoBuilder;
import org.apache.hadoop.hbase.security.User;
-import org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.RegionStateTransition.TransitionCode;
+import org.apache.yetus.audience.InterfaceAudience;
import org.apache.hadoop.hbase.shaded.com.google.common.base.Preconditions;
+import org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.RegionStateTransition.TransitionCode;
/**
* Handles processing region merges. Put in a queue, owned by HRegionServer.
*/
-// UNUSED: REMOVE!!!
+// TODO:UNUSED: REMOVE!!!
@InterfaceAudience.Private
class RegionMergeRequest implements Runnable {
private static final Log LOG = LogFactory.getLog(RegionMergeRequest.class);
- private final HRegionInfo region_a;
- private final HRegionInfo region_b;
+ private final RegionInfo region_a;
+ private final RegionInfo region_b;
private final HRegionServer server;
private final boolean forcible;
private final User user;
@@ -84,7 +85,7 @@ class RegionMergeRequest implements Runnable {
}
// TODO: fake merged region for compat with the report protocol
- final HRegionInfo merged = new HRegionInfo(table);
+ final RegionInfo merged = RegionInfoBuilder.newBuilder(table).build();
// Send the split request to the master. the master will do the validation on the split-key.
// The parent region will be unassigned and the two new regions will be assigned.
http://git-wip-us.apache.org/repos/asf/hbase/blob/a11a35a1/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionScanner.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionScanner.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionScanner.java
index ad5608c..159f13b 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionScanner.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionScanner.java
@@ -23,7 +23,7 @@ import java.util.List;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.HBaseInterfaceAudience;
-import org.apache.hadoop.hbase.HRegionInfo;
+import org.apache.hadoop.hbase.client.RegionInfo;
import org.apache.yetus.audience.InterfaceAudience;
import org.apache.yetus.audience.InterfaceStability;
@@ -36,7 +36,7 @@ public interface RegionScanner extends InternalScanner, Shipper {
/**
* @return The RegionInfo for this scanner.
*/
- HRegionInfo getRegionInfo();
+ RegionInfo getRegionInfo();
/**
* @return True if a filter indicates that this scanner will return no further rows.
@@ -57,7 +57,7 @@ public interface RegionScanner extends InternalScanner, Shipper {
boolean reseek(byte[] row) throws IOException;
/**
- * @return The preferred max buffersize. See
+ * @return The preferred max buffersize. See
* {@link org.apache.hadoop.hbase.client.Scan#setMaxResultSize(long)}
*/
long getMaxResultSize();
@@ -83,7 +83,7 @@ public interface RegionScanner extends InternalScanner, Shipper {
* @throws IOException e
*/
boolean nextRaw(List<Cell> result) throws IOException;
-
+
/**
* Grab the next row's worth of values. The {@link ScannerContext} is used to enforce and track
* any limits associated with this call. Any progress that exists in the {@link ScannerContext}