From 738097ffdac37a6eed92b2e371bd984509f6c954 Mon Sep 17 00:00:00 2001 From: Jan Hentschel Date: Sat, 20 Apr 2019 13:40:33 +0200 Subject: [PATCH] HBASE-22275 Removed deprecated getRegionInfo in HRegionLocation --- .../apache/hadoop/hbase/HRegionLocation.java | 11 ---- .../hadoop/hbase/MetaTableAccessor.java | 4 +- .../hadoop/hbase/client/AsyncProcess.java | 2 +- .../hbase/client/AsyncRequestFutureImpl.java | 8 +-- .../hadoop/hbase/client/ClientScanner.java | 7 +-- .../hbase/client/FlushRegionCallable.java | 4 +- .../apache/hadoop/hbase/client/HTable.java | 24 ++++---- .../hbase/client/MultiServerCallable.java | 3 +- .../client/RegionAdminServiceCallable.java | 2 +- .../client/RegionCoprocessorRpcChannel.java | 2 +- .../RegionCoprocessorRpcChannelImpl.java | 6 +- .../hbase/client/RegionServerCallable.java | 9 ++- .../hadoop/hbase/client/ResultStatsUtil.java | 2 +- .../hbase/client/ReversedScannerCallable.java | 6 +- .../RpcRetryingCallerWithReadReplicas.java | 2 +- .../hadoop/hbase/client/ScannerCallable.java | 9 ++- .../client/ScannerCallableWithReplicas.java | 11 ++-- .../hbase/client/SecureBulkLoadClient.java | 4 +- .../hbase/client/SimpleRequestController.java | 12 ++-- .../hadoop/hbase/client/TestAsyncProcess.java | 2 +- .../client/TestSimpleRequestController.java | 10 ++-- .../coprocessor/TestCoprocessorEndpoint.java | 8 +-- .../TestServerCustomProtocol.java | 14 ++--- .../hbase/mapred/HRegionPartitioner.java | 2 +- .../hbase/mapreduce/HRegionPartitioner.java | 2 +- .../mapreduce/MultiTableInputFormatBase.java | 16 +++--- .../hbase/mapreduce/TableInputFormatBase.java | 6 +- .../hadoop/hbase/rest/TestTableResource.java | 4 +- .../SnapshotOfRegionAssignmentFromMeta.java | 6 +- .../RegionReplicaReplicationEndpoint.java | 14 ++--- .../hbase/tool/LoadIncrementalHFiles.java | 2 +- .../apache/hadoop/hbase/util/HBaseFsck.java | 19 ++++--- .../hadoop/hbase/util/RegionSplitter.java | 11 ++-- .../resources/hbase-webapps/master/table.jsp | 2 +- .../hadoop/hbase/HBaseTestingUtility.java | 6 +- .../apache/hadoop/hbase/MetaMockingUtil.java | 13 +++-- .../hadoop/hbase/TestHRegionLocation.java | 2 +- .../hadoop/hbase/TestMetaTableAccessor.java | 2 +- .../hadoop/hbase/client/TestAdmin1.java | 52 +++++++++--------- .../hadoop/hbase/client/TestAdmin2.java | 2 +- .../client/TestBlockEvictionFromClient.java | 22 ++++---- .../client/TestConnectionImplementation.java | 55 ++++++++++--------- .../hbase/client/TestFromClientSide.java | 11 ++-- .../hbase/client/TestFromClientSide3.java | 12 ++-- .../hbase/client/TestReplicaWithCluster.java | 6 +- .../hbase/client/TestReplicasClient.java | 14 ++--- .../client/TestScannersFromClientSide.java | 3 +- .../hbase/client/TestTableFavoredNodes.java | 17 +++--- .../coprocessor/TestCoprocessorMetrics.java | 10 ++-- .../hbase/coprocessor/TestMasterObserver.java | 6 +- .../TestRegionObserverInterface.java | 4 +- .../TestLoadAndSwitchEncodeOnDisk.java | 2 +- .../TestCatalogJanitorInMemoryStates.java | 16 +++--- ...TestMasterOperationsForRegionReplicas.java | 2 +- .../MasterProcedureTestingUtility.java | 7 ++- .../TestEndToEndSplitTransaction.java | 4 +- .../regionserver/TestHRegionFileSystem.java | 2 +- .../regionserver/TestHRegionOnCluster.java | 6 +- .../TestHRegionServerBulkLoad.java | 4 +- .../regionserver/TestRegionReplicas.java | 5 +- .../regionserver/TestRegionServerMetrics.java | 4 +- .../TestRegionServerNoMaster.java | 14 +++-- .../TestRegionServerOnlineConfigChange.java | 4 +- .../regionserver/TestRemoveRegionMetrics.java | 6 +- .../TestRegionReplicaReplicationEndpoint.java | 2 +- ...ionReplicaReplicationEndpointNoMaster.java | 6 +- .../regionserver/TestReplicationSink.java | 4 +- .../security/access/TestAccessController.java | 11 ++-- .../hadoop/hbase/util/BaseTestHBaseFsck.java | 4 +- .../hadoop/hbase/util/TestRegionSplitter.java | 4 +- .../util/hbck/OfflineMetaRebuildTestCore.java | 2 +- hbase-shell/src/main/ruby/hbase/admin.rb | 2 +- hbase-shell/src/main/ruby/hbase/table.rb | 2 +- .../main/ruby/shell/commands/locate_region.rb | 2 +- hbase-shell/src/test/ruby/hbase/admin_test.rb | 4 +- .../thrift/ThriftHBaseServiceHandler.java | 2 +- .../hadoop/hbase/thrift2/ThriftUtilities.java | 4 +- 77 files changed, 299 insertions(+), 309 deletions(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/HRegionLocation.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/HRegionLocation.java index fd679bd0cbc4..8f356f1fe774 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/HRegionLocation.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/HRegionLocation.java @@ -18,7 +18,6 @@ */ package org.apache.hadoop.hbase; -import org.apache.hadoop.hbase.client.ImmutableHRegionInfo; import org.apache.hadoop.hbase.client.RegionInfo; import org.apache.hadoop.hbase.util.Addressing; import org.apache.yetus.audience.InterfaceAudience; @@ -86,16 +85,6 @@ public int hashCode() { return this.serverName.hashCode(); } - /** - * - * @return Immutable HRegionInfo - * @deprecated Since 2.0.0. Will remove in 3.0.0. Use {@link #getRegion()}} instead. - */ - @Deprecated - public HRegionInfo getRegionInfo(){ - return regionInfo == null ? null : new ImmutableHRegionInfo(regionInfo); - } - /** * @return regionInfo */ diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/MetaTableAccessor.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/MetaTableAccessor.java index 22256df3a061..3ce67b7ff248 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/MetaTableAccessor.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/MetaTableAccessor.java @@ -169,7 +169,7 @@ public boolean visitInternal(Result result) throws IOException { if (locations == null) return true; for (HRegionLocation loc : locations.getRegionLocations()) { if (loc != null) { - RegionInfo regionInfo = loc.getRegionInfo(); + RegionInfo regionInfo = loc.getRegion(); regions.put(regionInfo, loc.getServerName()); } } @@ -295,7 +295,7 @@ public static Pair getRegion(Connection connection, byte HRegionLocation location = getRegionLocation(connection, regionName); return location == null ? null - : new Pair<>(location.getRegionInfo(), location.getServerName()); + : new Pair<>(location.getRegion(), location.getServerName()); } /** diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncProcess.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncProcess.java index de7449bf2852..2c3f7c498b25 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncProcess.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncProcess.java @@ -307,7 +307,7 @@ private AsyncRequestFuture submit(AsyncProcessTask task, setNonce(ng, r, action); retainedActions.add(action); // TODO: replica-get is not supported on this path - byte[] regionName = loc.getRegionInfo().getRegionName(); + byte[] regionName = loc.getRegion().getRegionName(); addAction(loc.getServerName(), regionName, action, actionsByServer, nonceGroup); it.remove(); } diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRequestFutureImpl.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRequestFutureImpl.java index e46a50e76199..50029b9a6e9e 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRequestFutureImpl.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRequestFutureImpl.java @@ -154,7 +154,7 @@ private void addReplicaActions(int index, Map actionsBy for (int i = 1; i < locs.length; ++i) { Action replicaAction = new Action(action, i); if (locs[i] != null) { - asyncProcess.addAction(locs[i].getServerName(), locs[i].getRegionInfo().getRegionName(), + asyncProcess.addAction(locs[i].getServerName(), locs[i].getRegion().getRegionName(), replicaAction, actionsByServer, nonceGroup); } else { unknownReplicaActions.add(replicaAction); @@ -169,7 +169,7 @@ private void addReplicaActionsAgain( } HRegionLocation loc = getReplicaLocationOrFail(action); if (loc == null) return; - asyncProcess.addAction(loc.getServerName(), loc.getRegionInfo().getRegionName(), + asyncProcess.addAction(loc.getServerName(), loc.getRegion().getRegionName(), action, actionsByServer, nonceGroup); } } @@ -437,7 +437,7 @@ void groupAndSendMultiAction(List currentActions, int numAttempt) { manageLocationError(action, null); } } else { - byte[] regionName = loc.getRegionInfo().getRegionName(); + byte[] regionName = loc.getRegion().getRegionName(); AsyncProcess.addAction(loc.getServerName(), regionName, action, actionsByServer, nonceGroup); } } @@ -455,7 +455,7 @@ void groupAndSendMultiAction(List currentActions, int numAttempt) { for (Action action : unknownReplicaActions) { HRegionLocation loc = getReplicaLocationOrFail(action); if (loc == null) continue; - byte[] regionName = loc.getRegionInfo().getRegionName(); + byte[] regionName = loc.getRegion().getRegionName(); AsyncProcess.addAction(loc.getServerName(), regionName, action, actionsByServer, nonceGroup); } if (!actionsByServer.isEmpty()) { diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientScanner.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientScanner.java index 0342537cca5b..89499fcc705a 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientScanner.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientScanner.java @@ -30,7 +30,6 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.DoNotRetryIOException; import org.apache.hadoop.hbase.HConstants; -import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.NotServingRegionException; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.UnknownScannerException; @@ -60,7 +59,7 @@ public abstract class ClientScanner extends AbstractClientScanner { protected boolean closed = false; // Current region scanner is against. Gets cleared if current region goes // wonky: e.g. if it splits on us. - protected HRegionInfo currentRegion = null; + protected RegionInfo currentRegion = null; protected ScannerCallableWithReplicas callable = null; protected Queue cache; private final ScanResultCache scanResultCache; @@ -262,7 +261,7 @@ private Result[] call(ScannerCallableWithReplicas callable, RpcRetryingCaller, List> getKeysAndRegionsInRange( HRegionLocation regionLocation = getRegionLocator().getRegionLocation(currentKey, reload); keysInRange.add(currentKey); regionsInRange.add(regionLocation); - currentKey = regionLocation.getRegionInfo().getEndKey(); + currentKey = regionLocation.getRegion().getEndKey(); } while (!Bytes.equals(currentKey, HConstants.EMPTY_END_ROW) && (endKeyIsEndOfTable || Bytes.compareTo(currentKey, endKey) < 0 || (includeEndKey && Bytes.compareTo(currentKey, endKey) == 0))); @@ -362,7 +362,7 @@ private Result get(Get get, final boolean checkExistenceOnly) throws IOException @Override protected Result rpcCall() throws Exception { ClientProtos.GetRequest request = RequestConverter.buildGetRequest( - getLocation().getRegionInfo().getRegionName(), configuredGet); + getLocation().getRegion().getRegionName(), configuredGet); ClientProtos.GetResponse response = doGet(request); return response == null? null: ProtobufUtil.toResult(response.getResult(), getRpcControllerCellScanner()); @@ -479,7 +479,7 @@ public void delete(final Delete delete) throws IOException { @Override protected Void rpcCall() throws Exception { MutateRequest request = RequestConverter - .buildMutateRequest(getLocation().getRegionInfo().getRegionName(), delete); + .buildMutateRequest(getLocation().getRegion().getRegionName(), delete); doMutate(request); return null; } @@ -519,7 +519,7 @@ public void put(final Put put) throws IOException { @Override protected Void rpcCall() throws Exception { MutateRequest request = - RequestConverter.buildMutateRequest(getLocation().getRegionInfo().getRegionName(), put); + RequestConverter.buildMutateRequest(getLocation().getRegion().getRegionName(), put); doMutate(request); return null; } @@ -550,7 +550,7 @@ public void mutateRow(final RowMutations rm) throws IOException { @Override protected MultiResponse rpcCall() throws Exception { RegionAction.Builder regionMutationBuilder = RequestConverter.buildRegionAction( - getLocation().getRegionInfo().getRegionName(), rm); + getLocation().getRegion().getRegionName(), rm); regionMutationBuilder.setAtomic(true); MultiRequest request = MultiRequest.newBuilder().addRegionAction(regionMutationBuilder.build()).build(); @@ -591,7 +591,7 @@ public Result append(final Append append) throws IOException { @Override protected Result rpcCall() throws Exception { MutateRequest request = RequestConverter.buildMutateRequest( - getLocation().getRegionInfo().getRegionName(), append, getNonceGroup(), getNonce()); + getLocation().getRegion().getRegionName(), append, getNonceGroup(), getNonce()); MutateResponse response = doMutate(request); if (!response.hasResult()) return null; return ProtobufUtil.toResult(response.getResult(), getRpcControllerCellScanner()); @@ -610,7 +610,7 @@ public Result increment(final Increment increment) throws IOException { @Override protected Result rpcCall() throws Exception { MutateRequest request = RequestConverter.buildMutateRequest( - getLocation().getRegionInfo().getRegionName(), increment, getNonceGroup(), getNonce()); + getLocation().getRegion().getRegionName(), increment, getNonceGroup(), getNonce()); MutateResponse response = doMutate(request); // Should this check for null like append does? return ProtobufUtil.toResult(response.getResult(), getRpcControllerCellScanner()); @@ -648,7 +648,7 @@ public long incrementColumnValue(final byte [] row, final byte [] family, @Override protected Long rpcCall() throws Exception { MutateRequest request = RequestConverter.buildIncrementRequest( - getLocation().getRegionInfo().getRegionName(), row, family, + getLocation().getRegion().getRegionName(), row, family, qualifier, amount, durability, getNonceGroup(), getNonce()); MutateResponse response = doMutate(request); Result result = ProtobufUtil.toResult(response.getResult(), getRpcControllerCellScanner()); @@ -685,7 +685,7 @@ private boolean doCheckAndPut(final byte[] row, final byte[] family, final byte[ protected Boolean rpcCall() throws Exception { CompareType compareType = CompareType.valueOf(opName); MutateRequest request = RequestConverter.buildMutateRequest( - getLocation().getRegionInfo().getRegionName(), row, family, qualifier, + getLocation().getRegion().getRegionName(), row, family, qualifier, new BinaryComparator(value), compareType, timeRange, put); MutateResponse response = doMutate(request); return Boolean.valueOf(response.getProcessed()); @@ -721,7 +721,7 @@ private boolean doCheckAndDelete(final byte[] row, final byte[] family, final by protected SingleResponse rpcCall() throws Exception { CompareType compareType = CompareType.valueOf(opName); MutateRequest request = RequestConverter - .buildMutateRequest(getLocation().getRegionInfo().getRegionName(), row, family, + .buildMutateRequest(getLocation().getRegion().getRegionName(), row, family, qualifier, new BinaryComparator(value), compareType, timeRange, delete); MutateResponse response = doMutate(request); return ResponseConverter.getResult(request, response, getRpcControllerCellScanner()); @@ -760,7 +760,7 @@ private boolean doCheckAndMutate(final byte[] row, final byte[] family, final by protected MultiResponse rpcCall() throws Exception { CompareType compareType = CompareType.valueOf(opName); MultiRequest request = RequestConverter - .buildMutateRequest(getLocation().getRegionInfo().getRegionName(), row, family, qualifier, + .buildMutateRequest(getLocation().getRegion().getRegionName(), row, family, qualifier, new BinaryComparator(value), compareType, timeRange, rm); ClientProtos.MultiResponse response = doMulti(request); ClientProtos.RegionActionResult res = response.getRegionActionResultList().get(0); @@ -1097,7 +1097,7 @@ public void batchCoprocessorService( final Map execsByRow = new TreeMap<>(Bytes.BYTES_COMPARATOR); for (int i = 0; i < keys.size(); i++) { final byte[] rowKey = keys.get(i); - final byte[] region = regions.get(i).getRegionInfo().getRegionName(); + final byte[] region = regions.get(i).getRegion().getRegionName(); RegionCoprocessorServiceExec exec = new RegionCoprocessorServiceExec(region, rowKey, methodDescriptor, request); execs.add(exec); diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MultiServerCallable.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MultiServerCallable.java index bfc161e5c235..dc4a9b1af131 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MultiServerCallable.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MultiServerCallable.java @@ -26,7 +26,6 @@ import org.apache.hadoop.hbase.CellScannable; import org.apache.hadoop.hbase.CellUtil; import org.apache.hadoop.hbase.DoNotRetryIOException; -import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.HRegionLocation; import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.TableName; @@ -76,7 +75,7 @@ protected HRegionLocation getLocation() { } @Override - public HRegionInfo getHRegionInfo() { + public RegionInfo getRegionInfo() { throw new RuntimeException("Cannot get region info for multi-region request"); } diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionAdminServiceCallable.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionAdminServiceCallable.java index ece91bd1e0ea..745071e0ba2f 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionAdminServiceCallable.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionAdminServiceCallable.java @@ -110,7 +110,7 @@ public HRegionLocation getLocation(boolean useCache) throws IOException { @Override public void throwable(Throwable t, boolean retrying) { if (location != null) { - connection.updateCachedLocations(tableName, location.getRegionInfo().getRegionName(), row, + connection.updateCachedLocations(tableName, location.getRegion().getRegionName(), row, t, location.getServerName()); } } diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionCoprocessorRpcChannel.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionCoprocessorRpcChannel.java index 448302c854d6..a5e1d7243709 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionCoprocessorRpcChannel.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionCoprocessorRpcChannel.java @@ -81,7 +81,7 @@ protected Message callExecService(final RpcController controller, this.table, this.row, this.conn.getRpcControllerFactory().newController(), HConstants.PRIORITY_UNSET) { @Override protected CoprocessorServiceResponse rpcCall() throws Exception { - byte [] regionName = getLocation().getRegionInfo().getRegionName(); + byte [] regionName = getLocation().getRegion().getRegionName(); CoprocessorServiceRequest csr = CoprocessorRpcUtils.getCoprocessorServiceRequest(method, request, row, regionName); return getStub().execService(getRpcController(), csr); diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionCoprocessorRpcChannelImpl.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionCoprocessorRpcChannelImpl.java index 94e7d9a019ce..2deaa7516883 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionCoprocessorRpcChannelImpl.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionCoprocessorRpcChannelImpl.java @@ -72,14 +72,14 @@ private CompletableFuture rpcCall(MethodDescriptor method, Message requ ClientService.Interface stub) { CompletableFuture future = new CompletableFuture<>(); if (region != null - && !Bytes.equals(loc.getRegionInfo().getRegionName(), region.getRegionName())) { + && !Bytes.equals(loc.getRegion().getRegionName(), region.getRegionName())) { future.completeExceptionally(new DoNotRetryIOException( "Region name is changed, expected " + region.getRegionNameAsString() + ", actual " - + loc.getRegionInfo().getRegionNameAsString())); + + loc.getRegion().getRegionNameAsString())); return future; } CoprocessorServiceRequest csr = CoprocessorRpcUtils.getCoprocessorServiceRequest(method, - request, row, loc.getRegionInfo().getRegionName()); + request, row, loc.getRegion().getRegionName()); stub.execService(controller, csr, new org.apache.hbase.thirdparty.com.google.protobuf.RpcCallback() { diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionServerCallable.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionServerCallable.java index f709c440d617..d45c1ec08a8f 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionServerCallable.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionServerCallable.java @@ -22,7 +22,6 @@ import org.apache.hadoop.hbase.CellScanner; import org.apache.hadoop.hbase.HConstants; -import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.HRegionLocation; import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.TableName; @@ -187,7 +186,7 @@ public TableName getTableName() { @Override public void throwable(Throwable t, boolean retrying) { if (location != null) { - getConnection().updateCachedLocations(tableName, location.getRegionInfo().getRegionName(), + getConnection().updateCachedLocations(tableName, location.getRegion().getRegionName(), row, t, location.getServerName()); } } @@ -203,13 +202,13 @@ public long sleep(long pause, int tries) { } /** - * @return the HRegionInfo for the current region + * @return the RegionInfo for the current region */ - public HRegionInfo getHRegionInfo() { + public RegionInfo getRegionInfo() { if (this.location == null) { return null; } - return this.location.getRegionInfo(); + return this.location.getRegion(); } @Override diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ResultStatsUtil.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ResultStatsUtil.java index 77c56ef07ea5..af45325df8df 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ResultStatsUtil.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ResultStatsUtil.java @@ -71,7 +71,7 @@ public static T updateStats(T r, ServerStatisticTracker stats, ServerName server = null; if (regionLocation != null) { server = regionLocation.getServerName(); - regionName = regionLocation.getRegionInfo().getRegionName(); + regionName = regionLocation.getRegion().getRegionName(); } return updateStats(r, stats, server, regionName); diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ReversedScannerCallable.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ReversedScannerCallable.java index 30e541cefe46..7360a1509e1e 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ReversedScannerCallable.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ReversedScannerCallable.java @@ -143,14 +143,14 @@ private List locateRegionsInRange(byte[] startKey, RegionLocations rl = RpcRetryingCallerWithReadReplicas.getRegionLocations(!reload, id, getConnection(), getTableName(), currentKey); HRegionLocation regionLocation = id < rl.size() ? rl.getRegionLocation(id) : null; - if (regionLocation != null && regionLocation.getRegionInfo().containsRow(currentKey)) { + if (regionLocation != null && regionLocation.getRegion().containsRow(currentKey)) { regionList.add(regionLocation); } else { throw new DoNotRetryIOException("Does hbase:meta exist hole? Locating row " + Bytes.toStringBinary(currentKey) + " returns incorrect region " - + (regionLocation == null ? null : regionLocation.getRegionInfo())); + + (regionLocation == null ? null : regionLocation.getRegion())); } - currentKey = regionLocation.getRegionInfo().getEndKey(); + currentKey = regionLocation.getRegion().getEndKey(); } while (!Bytes.equals(currentKey, HConstants.EMPTY_END_ROW) && (endKeyIsEndOfTable || Bytes.compareTo(currentKey, endKey) < 0)); return regionList; diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerWithReadReplicas.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerWithReadReplicas.java index c82fcb89d4fe..0c9379a58a15 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerWithReadReplicas.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerWithReadReplicas.java @@ -138,7 +138,7 @@ protected Result rpcCall() throws Exception { if (Thread.interrupted()) { throw new InterruptedIOException(); } - byte[] reg = location.getRegionInfo().getRegionName(); + byte[] reg = location.getRegion().getRegionName(); ClientProtos.GetRequest request = RequestConverter.buildGetRequest(reg, get); HBaseRpcController hrc = (HBaseRpcController)getRpcController(); hrc.reset(); diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ScannerCallable.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ScannerCallable.java index 45b74ef93843..dd64e957fde0 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ScannerCallable.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ScannerCallable.java @@ -30,7 +30,6 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.DoNotRetryIOException; import org.apache.hadoop.hbase.HBaseIOException; -import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.HRegionLocation; import org.apache.hadoop.hbase.NotServingRegionException; import org.apache.hadoop.hbase.RegionLocations; @@ -327,7 +326,7 @@ private void close() { private ScanResponse openScanner() throws IOException { incRPCCallsMetrics(scanMetrics, isRegionServerRemote); ScanRequest request = RequestConverter.buildScanRequest( - getLocation().getRegionInfo().getRegionName(), this.scan, this.caching, false); + getLocation().getRegion().getRegionName(), this.scan, this.caching, false); try { ScanResponse response = getStub().scan(getRpcController(), request); long id = response.getScannerId(); @@ -366,14 +365,14 @@ public void setRenew(boolean val) { } /** - * @return the HRegionInfo for the current region + * @return the RegionInfo for the current region */ @Override - public HRegionInfo getHRegionInfo() { + public RegionInfo getRegionInfo() { if (!instantiated) { return null; } - return getLocation().getRegionInfo(); + return getLocation().getRegion(); } /** diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ScannerCallableWithReplicas.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ScannerCallableWithReplicas.java index bcb81f7e9d41..d96cb1bef0b7 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ScannerCallableWithReplicas.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ScannerCallableWithReplicas.java @@ -34,7 +34,6 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.DoNotRetryIOException; -import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.RegionLocations; import org.apache.hadoop.hbase.TableName; import org.apache.yetus.audience.InterfaceAudience; @@ -109,8 +108,8 @@ public int getCaching() { return currentScannerCallable.getCaching(); } - public HRegionInfo getHRegionInfo() { - return currentScannerCallable.getHRegionInfo(); + public RegionInfo getRegionInfo() { + return currentScannerCallable.getRegionInfo(); } public MoreResults moreResultsInRegion() { @@ -262,16 +261,16 @@ private void updateCurrentlyServingReplica(ScannerCallable scanner, Result[] res if (result != null && result.length != 0) this.lastResult = result[result.length - 1]; if (LOG.isTraceEnabled()) { LOG.trace("Setting current scanner as id=" + currentScannerCallable.scannerId + - " associated with replica=" + currentScannerCallable.getHRegionInfo().getReplicaId()); + " associated with replica=" + currentScannerCallable.getRegionInfo().getReplicaId()); } // close all outstanding replica scanners but the one we heard back from outstandingCallables.remove(scanner); for (ScannerCallable s : outstandingCallables) { if (LOG.isTraceEnabled()) { LOG.trace("Closing scanner id=" + s.scannerId + - ", replica=" + s.getHRegionInfo().getRegionId() + + ", replica=" + s.getRegionInfo().getRegionId() + " because slow and replica=" + - this.currentScannerCallable.getHRegionInfo().getReplicaId() + " succeeded"); + this.currentScannerCallable.getRegionInfo().getReplicaId() + " succeeded"); } // Submit the "close" to the pool since this might take time, and we don't // want to wait for the "close" to happen yet. The "wait" will happen when diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/SecureBulkLoadClient.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/SecureBulkLoadClient.java index 218627175713..19ff8a03a320 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/SecureBulkLoadClient.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/SecureBulkLoadClient.java @@ -60,7 +60,7 @@ public String prepareBulkLoad(final Connection conn) throws IOException { this.rpcControllerFactory.newController(), PRIORITY_UNSET) { @Override protected String rpcCall() throws Exception { - byte[] regionName = getLocation().getRegionInfo().getRegionName(); + byte[] regionName = getLocation().getRegion().getRegionName(); RegionSpecifier region = RequestConverter.buildRegionSpecifier(RegionSpecifierType.REGION_NAME, regionName); PrepareBulkLoadRequest request = PrepareBulkLoadRequest.newBuilder() @@ -83,7 +83,7 @@ public void cleanupBulkLoad(final Connection conn, final String bulkToken) throw table.getName(), HConstants.EMPTY_START_ROW, this.rpcControllerFactory.newController(), PRIORITY_UNSET) { @Override protected Void rpcCall() throws Exception { - byte[] regionName = getLocation().getRegionInfo().getRegionName(); + byte[] regionName = getLocation().getRegion().getRegionName(); RegionSpecifier region = RequestConverter.buildRegionSpecifier( RegionSpecifierType.REGION_NAME, regionName); CleanupBulkLoadRequest request = diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/SimpleRequestController.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/SimpleRequestController.java index 261d663e0fcc..ce260ee11e0a 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/SimpleRequestController.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/SimpleRequestController.java @@ -37,7 +37,6 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HConstants; -import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.HRegionLocation; import org.apache.hadoop.hbase.ServerName; import org.apache.yetus.audience.InterfaceAudience; @@ -370,7 +369,7 @@ public void reset() { static class TaskCountChecker implements RowChecker { private static final long MAX_WAITING_TIME = 1000; //ms - private final Set regionsIncluded = new HashSet<>(); + private final Set regionsIncluded = new HashSet<>(); private final Set serversIncluded = new HashSet<>(); private final int maxConcurrentTasksPerRegion; private final int maxTotalConcurrentTasks; @@ -438,13 +437,12 @@ private void waitForRegion() throws InterruptedIOException { */ @Override public ReturnCode canTakeOperation(HRegionLocation loc, long heapSizeOfRow) { - - HRegionInfo regionInfo = loc.getRegionInfo(); + RegionInfo regionInfo = loc.getRegion(); if (regionsIncluded.contains(regionInfo)) { // We already know what to do with this region. return ReturnCode.INCLUDE; } - AtomicInteger regionCnt = taskCounterPerRegion.get(loc.getRegionInfo().getRegionName()); + AtomicInteger regionCnt = taskCounterPerRegion.get(loc.getRegion().getRegionName()); if (regionCnt != null && regionCnt.get() >= maxConcurrentTasksPerRegion) { // Too many tasks on this region already. return ReturnCode.SKIP; @@ -466,10 +464,10 @@ public ReturnCode canTakeOperation(HRegionLocation loc, long heapSizeOfRow) { @Override public void notifyFinal(ReturnCode code, HRegionLocation loc, long heapSizeOfRow) { if (code == ReturnCode.INCLUDE) { - regionsIncluded.add(loc.getRegionInfo()); + regionsIncluded.add(loc.getRegion()); serversIncluded.add(loc.getServerName()); } - busyRegions.add(loc.getRegionInfo().getRegionName()); + busyRegions.add(loc.getRegion().getRegionName()); } } diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAsyncProcess.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAsyncProcess.java index 81dcc46f4840..d5e8dccf4795 100644 --- a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAsyncProcess.java +++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAsyncProcess.java @@ -521,7 +521,7 @@ public RegionLocations locateRegion(TableName tableName, byte[] row, boolean useCache, boolean retry, int replicaId) throws IOException { int i = 0; for (HRegionLocation hr : hrl){ - if (Arrays.equals(row, hr.getRegionInfo().getStartKey())) { + if (Arrays.equals(row, hr.getRegion().getStartKey())) { usedRegions[i] = true; return new RegionLocations(hr); } diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestSimpleRequestController.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestSimpleRequestController.java index 3dc86de2f354..87ef9b6990bb 100644 --- a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestSimpleRequestController.java +++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestSimpleRequestController.java @@ -148,7 +148,7 @@ public void testTaskCheckerHost() throws IOException { assertNotEquals(ReturnCode.INCLUDE, loc2Code); // fill the task slots for LOC3. - taskCounterPerRegion.put(LOC3.getRegionInfo().getRegionName(), new AtomicInteger(100)); + taskCounterPerRegion.put(LOC3.getRegion().getRegionName(), new AtomicInteger(100)); taskCounterPerServer.put(LOC3.getServerName(), new AtomicInteger(100)); ReturnCode loc3Code = checker.canTakeRow(LOC3, createPut(1L)); @@ -156,7 +156,7 @@ public void testTaskCheckerHost() throws IOException { assertNotEquals(ReturnCode.INCLUDE, loc3Code); // release the task slots for LOC3. - taskCounterPerRegion.put(LOC3.getRegionInfo().getRegionName(), new AtomicInteger(0)); + taskCounterPerRegion.put(LOC3.getRegion().getRegionName(), new AtomicInteger(0)); taskCounterPerServer.put(LOC3.getServerName(), new AtomicInteger(0)); ReturnCode loc3Code_2 = checker.canTakeRow(LOC3, createPut(1L)); @@ -306,7 +306,7 @@ public void testTaskCountChecker() throws InterruptedIOException { checker.notifyFinal(code, LOC1, heapSizeOfRow); // fill the task slots for LOC1. - taskCounterPerRegion.put(LOC1.getRegionInfo().getRegionName(), new AtomicInteger(100)); + taskCounterPerRegion.put(LOC1.getRegion().getRegionName(), new AtomicInteger(100)); taskCounterPerServer.put(LOC1.getServerName(), new AtomicInteger(100)); // the region was previously accepted, so it must be accpted now. @@ -317,7 +317,7 @@ public void testTaskCountChecker() throws InterruptedIOException { } // fill the task slots for LOC3. - taskCounterPerRegion.put(LOC3.getRegionInfo().getRegionName(), new AtomicInteger(100)); + taskCounterPerRegion.put(LOC3.getRegion().getRegionName(), new AtomicInteger(100)); taskCounterPerServer.put(LOC3.getServerName(), new AtomicInteger(100)); // no task slots. @@ -328,7 +328,7 @@ public void testTaskCountChecker() throws InterruptedIOException { } // release the tasks for LOC3. - taskCounterPerRegion.put(LOC3.getRegionInfo().getRegionName(), new AtomicInteger(0)); + taskCounterPerRegion.put(LOC3.getRegion().getRegionName(), new AtomicInteger(0)); taskCounterPerServer.put(LOC3.getServerName(), new AtomicInteger(0)); // add LOC3 region. diff --git a/hbase-endpoint/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorEndpoint.java b/hbase-endpoint/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorEndpoint.java index 4b8f6c7e8bec..3edc26b15073 100644 --- a/hbase-endpoint/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorEndpoint.java +++ b/hbase-endpoint/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorEndpoint.java @@ -35,12 +35,12 @@ import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.HConstants; -import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.HRegionLocation; import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.Put; +import org.apache.hadoop.hbase.client.RegionInfo; import org.apache.hadoop.hbase.client.RegionLocator; import org.apache.hadoop.hbase.client.Table; import org.apache.hadoop.hbase.client.coprocessor.Batch; @@ -218,8 +218,8 @@ public void update(byte[] region, byte[] row, TestProtos.EchoResponseProto resul } assertEquals(3, results.size()); for (HRegionLocation info : regions) { - LOG.info("Region info is "+info.getRegionInfo().getRegionNameAsString()); - assertTrue(results.containsKey(info.getRegionInfo().getRegionName())); + LOG.info("Region info is "+info.getRegion().getRegionNameAsString()); + assertTrue(results.containsKey(info.getRegion().getRegionName())); } results.clear(); @@ -291,7 +291,7 @@ public String call(TestRpcServiceProtos.TestProtobufRpcProto instance) } assertEquals(3, results.size()); for (HRegionLocation region : regions) { - HRegionInfo info = region.getRegionInfo(); + RegionInfo info = region.getRegion(); LOG.info("Region info is "+info.getRegionNameAsString()); assertTrue(results.containsKey(info.getRegionName())); assertNull(results.get(info.getRegionName())); diff --git a/hbase-endpoint/src/test/java/org/apache/hadoop/hbase/regionserver/TestServerCustomProtocol.java b/hbase-endpoint/src/test/java/org/apache/hadoop/hbase/regionserver/TestServerCustomProtocol.java index bc368e3c5a97..2e2939612244 100644 --- a/hbase-endpoint/src/test/java/org/apache/hadoop/hbase/regionserver/TestServerCustomProtocol.java +++ b/hbase-endpoint/src/test/java/org/apache/hadoop/hbase/regionserver/TestServerCustomProtocol.java @@ -342,7 +342,7 @@ public void testRowRange() throws Throwable { try (Table table = util.getConnection().getTable(TEST_TABLE); RegionLocator locator = util.getConnection().getRegionLocator(TEST_TABLE)) { for (HRegionLocation e: locator.getAllRegionLocations()) { - LOG.info("Region " + e.getRegionInfo().getRegionNameAsString() + LOG.info("Region " + e.getRegion().getRegionNameAsString() + ", servername=" + e.getServerName()); } // Here are what regions looked like on a run: @@ -362,7 +362,7 @@ public void testRowRange() throws Throwable { // should contain last 2 regions HRegionLocation loc = locator.getRegionLocation(ROW_A, true); assertNull("Should be missing region for row aaa (prior to start row)", - results.get(loc.getRegionInfo().getRegionName())); + results.get(loc.getRegion().getRegionName())); verifyRegionResults(locator, results, ROW_B); verifyRegionResults(locator, results, ROW_C); @@ -374,7 +374,7 @@ public void testRowRange() throws Throwable { verifyRegionResults(locator, results, ROW_B); loc = locator.getRegionLocation(ROW_C, true); assertNull("Should be missing region for row ccc (past stop row)", - results.get(loc.getRegionInfo().getRegionName())); + results.get(loc.getRegion().getRegionName())); // test explicit start + end results = ping(table, ROW_AB, ROW_BC); @@ -384,7 +384,7 @@ public void testRowRange() throws Throwable { verifyRegionResults(locator, results, ROW_B); loc = locator.getRegionLocation(ROW_C, true); assertNull("Should be missing region for row ccc (past stop row)", - results.get(loc.getRegionInfo().getRegionName())); + results.get(loc.getRegion().getRegionName())); // test single region results = ping(table, ROW_B, ROW_BC); @@ -393,10 +393,10 @@ public void testRowRange() throws Throwable { verifyRegionResults(locator, results, ROW_B); loc = locator.getRegionLocation(ROW_A, true); assertNull("Should be missing region for row aaa (prior to start)", - results.get(loc.getRegionInfo().getRegionName())); + results.get(loc.getRegion().getRegionName())); loc = locator.getRegionLocation(ROW_C, true); assertNull("Should be missing region for row ccc (past stop row)", - results.get(loc.getRegionInfo().getRegionName())); + results.get(loc.getRegion().getRegionName())); } } @@ -476,7 +476,7 @@ private void verifyRegionResults(RegionLocator regionLocator, Map getSplits(JobContext context) throws IOException { HRegionLocation hregionLocation = regionLocator.getRegionLocation( keys.getFirst()[i], false); String regionHostname = hregionLocation.getHostname(); - HRegionInfo regionInfo = hregionLocation.getRegionInfo(); + RegionInfo regionInfo = hregionLocation.getRegion(); String encodedRegionName = regionInfo.getEncodedName(); long regionSize = sizeCalculator.getRegionSize( regionInfo.getRegionName()); diff --git a/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableInputFormatBase.java b/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableInputFormatBase.java index 2300d98ea3c7..ea50f3960697 100644 --- a/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableInputFormatBase.java +++ b/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableInputFormatBase.java @@ -304,7 +304,7 @@ private List oneInputSplitPerRegion() throws IOException { throw new IOException("Expecting at least one region."); } List splits = new ArrayList<>(1); - long regionSize = sizeCalculator.getRegionSize(regLoc.getRegionInfo().getRegionName()); + long regionSize = sizeCalculator.getRegionSize(regLoc.getRegion().getRegionName()); TableSplit split = new TableSplit(tableName, scan, HConstants.EMPTY_BYTE_ARRAY, HConstants.EMPTY_BYTE_ARRAY, regLoc .getHostnamePort().split(Addressing.HOSTNAME_PORT_SEPARATOR)[0], regionSize); @@ -342,8 +342,8 @@ private List oneInputSplitPerRegion() throws IOException { String regionLocation; regionLocation = reverseDNS(regionAddress); - byte[] regionName = location.getRegionInfo().getRegionName(); - String encodedRegionName = location.getRegionInfo().getEncodedName(); + byte[] regionName = location.getRegion().getRegionName(); + String encodedRegionName = location.getRegion().getEncodedName(); long regionSize = sizeCalculator.getRegionSize(regionName); TableSplit split = new TableSplit(tableName, scan, splitStart, splitStop, regionLocation, encodedRegionName, regionSize); diff --git a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestTableResource.java b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestTableResource.java index 7cbc6318b752..0bece66df380 100644 --- a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestTableResource.java +++ b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestTableResource.java @@ -31,13 +31,13 @@ import org.apache.hadoop.hbase.CellUtil; import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; -import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.HRegionLocation; import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.client.Durability; import org.apache.hadoop.hbase.client.Put; +import org.apache.hadoop.hbase.client.RegionInfo; import org.apache.hadoop.hbase.client.RegionLocator; import org.apache.hadoop.hbase.client.Table; import org.apache.hadoop.hbase.rest.client.Client; @@ -153,7 +153,7 @@ void checkTableInfo(TableInfoModel model) { boolean found = false; LOG.debug("looking for region " + region.getName()); for (HRegionLocation e: regionMap) { - HRegionInfo hri = e.getRegionInfo(); + RegionInfo hri = e.getRegion(); // getRegionNameAsString uses Bytes.toStringBinary which escapes some non-printable // characters String hriRegionName = Bytes.toString(hri.getRegionName()); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/SnapshotOfRegionAssignmentFromMeta.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/SnapshotOfRegionAssignmentFromMeta.java index 90315775840a..4b78135d14d7 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/SnapshotOfRegionAssignmentFromMeta.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/SnapshotOfRegionAssignmentFromMeta.java @@ -113,7 +113,7 @@ public boolean visit(Result result) throws IOException { if (result == null || result.isEmpty()) return true; RegionLocations rl = MetaTableAccessor.getRegionLocations(result); if (rl == null) return true; - RegionInfo hri = rl.getRegionLocation(0).getRegionInfo(); + RegionInfo hri = rl.getRegionLocation(0).getRegion(); if (hri == null) return true; if (hri.getTable() == null) return true; if (disabledTables.contains(hri.getTable())) { @@ -126,13 +126,13 @@ public boolean visit(Result result) throws IOException { // Add the current assignment to the snapshot for all replicas for (int i = 0; i < hrls.length; i++) { if (hrls[i] == null) continue; - hri = hrls[i].getRegionInfo(); + hri = hrls[i].getRegion(); if (hri == null) continue; addAssignment(hri, hrls[i].getServerName()); addRegion(hri); } - hri = rl.getRegionLocation(0).getRegionInfo(); + hri = rl.getRegionLocation(0).getRegion(); // the code below is to handle favored nodes byte[] favoredNodes = result.getValue(HConstants.CATALOG_FAMILY, FavoredNodeAssignmentHelper.FAVOREDNODES_QUALIFIER); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/RegionReplicaReplicationEndpoint.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/RegionReplicaReplicationEndpoint.java index f7721e0934a5..b821d7596244 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/RegionReplicaReplicationEndpoint.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/RegionReplicaReplicationEndpoint.java @@ -463,7 +463,7 @@ public void append(TableName tableName, byte[] encodedRegionName, byte[] row, // check whether we should still replay this entry. If the regions are changed, or the // entry is not coming from the primary region, filter it out. HRegionLocation primaryLocation = locations.getDefaultRegionLocation(); - if (!Bytes.equals(primaryLocation.getRegionInfo().getEncodedNameAsBytes(), + if (!Bytes.equals(primaryLocation.getRegion().getEncodedNameAsBytes(), encodedRegionName)) { if (useCache) { useCache = false; @@ -471,7 +471,7 @@ public void append(TableName tableName, byte[] encodedRegionName, byte[] row, } if (LOG.isTraceEnabled()) { LOG.trace("Skipping " + entries.size() + " entries in table " + tableName - + " because located region " + primaryLocation.getRegionInfo().getEncodedName() + + " because located region " + primaryLocation.getRegion().getEncodedName() + " is different than the original region " + Bytes.toStringBinary(encodedRegionName) + " from WALEdit"); for (Entry entry : entries) { @@ -497,8 +497,8 @@ public void append(TableName tableName, byte[] encodedRegionName, byte[] row, if (!RegionReplicaUtil.isDefaultReplica(replicaId)) { RegionInfo regionInfo = location == null ? RegionReplicaUtil.getRegionInfoForReplica( - locations.getDefaultRegionLocation().getRegionInfo(), replicaId) - : location.getRegionInfo(); + locations.getDefaultRegionLocation().getRegion(), replicaId) + : location.getRegion(); RegionReplicaReplayCallable callable = new RegionReplicaReplayCallable(connection, rpcControllerFactory, tableName, location, regionInfo, row, entries, sink.getSkippedEditsCounter()); @@ -604,7 +604,7 @@ public ReplicateWALEntryResponse call(HBaseRpcController controller) throws Exce // entry is not coming form the primary region, filter it out because we do not need it. // Regions can change because of (1) region split (2) region merge (3) table recreated boolean skip = false; - if (!Bytes.equals(location.getRegionInfo().getEncodedNameAsBytes(), + if (!Bytes.equals(location.getRegion().getEncodedNameAsBytes(), initialEncodedRegionName)) { skip = true; } @@ -615,7 +615,7 @@ public ReplicateWALEntryResponse call(HBaseRpcController controller) throws Exce // set the region name for the target region replica Pair p = ReplicationProtbufUtil.buildReplicateWALEntryRequest(entriesArray, location - .getRegionInfo().getEncodedNameAsBytes(), null, null, null); + .getRegion().getEncodedNameAsBytes(), null, null, null); controller.setCellScanner(p.getSecond()); return stub.replay(controller, p.getFirst()); } @@ -623,7 +623,7 @@ public ReplicateWALEntryResponse call(HBaseRpcController controller) throws Exce if (skip) { if (LOG.isTraceEnabled()) { LOG.trace("Skipping " + entries.size() + " entries in table " + tableName - + " because located region " + location.getRegionInfo().getEncodedName() + + " because located region " + location.getRegion().getEncodedName() + " is different than the original region " + Bytes.toStringBinary(initialEncodedRegionName) + " from WALEdit"); for (Entry entry : entries) { diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/LoadIncrementalHFiles.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/LoadIncrementalHFiles.java index ec349fe9cb6e..bc0f8bf78c20 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/LoadIncrementalHFiles.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/LoadIncrementalHFiles.java @@ -522,7 +522,7 @@ protected byte[] rpcCall() throws Exception { Bytes.toStringBinary(getRow()) + " with hfile group " + LoadIncrementalHFiles.this.toString(famPaths)); } - byte[] regionName = getLocation().getRegionInfo().getRegionName(); + byte[] regionName = getLocation().getRegion().getRegionName(); try (Table table = conn.getTable(getTableName())) { secureClient = new SecureBulkLoadClient(getConf(), table); success = secureClient.secureBulkLoadHFiles(getStub(), famPaths, regionName, diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java index 1a009458525f..236c6611fe3b 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java @@ -1962,7 +1962,7 @@ private boolean recordMetaRegion() throws IOException { "META region location is null"); return false; } - if (metaLocation.getRegionInfo() == null) { + if (metaLocation.getRegion() == null) { errors.reportError(ERROR_CODE.NULL_META_REGION, "META location regionInfo is null"); return false; @@ -1973,10 +1973,11 @@ private boolean recordMetaRegion() throws IOException { return false; } ServerName sn = metaLocation.getServerName(); - MetaEntry m = new MetaEntry(metaLocation.getRegionInfo(), sn, EnvironmentEdgeManager.currentTime()); - HbckInfo hbckInfo = regionInfoMap.get(metaLocation.getRegionInfo().getEncodedName()); + MetaEntry m = new MetaEntry(metaLocation.getRegion(), sn, + EnvironmentEdgeManager.currentTime()); + HbckInfo hbckInfo = regionInfoMap.get(metaLocation.getRegion().getEncodedName()); if (hbckInfo == null) { - regionInfoMap.put(metaLocation.getRegionInfo().getEncodedName(), new HbckInfo(m)); + regionInfoMap.put(metaLocation.getRegion().getEncodedName(), new HbckInfo(m)); } else { hbckInfo.metaEntry = m; } @@ -2365,7 +2366,7 @@ private void closeRegion(HbckInfo hi) throws IOException, InterruptedException { + "have handle to reach it."); continue; } - RegionInfo hri = h.getRegionInfo(); + RegionInfo hri = h.getRegion(); if (hri == null) { LOG.warn("Unable to close region " + hi.getRegionNameAsString() + " because hbase:meta had invalid or missing " @@ -3759,24 +3760,24 @@ public boolean visit(Result result) throws IOException { } ServerName sn = null; if (rl.getRegionLocation(RegionInfo.DEFAULT_REPLICA_ID) == null || - rl.getRegionLocation(RegionInfo.DEFAULT_REPLICA_ID).getRegionInfo() == null) { + rl.getRegionLocation(RegionInfo.DEFAULT_REPLICA_ID).getRegion() == null) { emptyRegionInfoQualifiers.add(result); errors.reportError(ERROR_CODE.EMPTY_META_CELL, "Empty REGIONINFO_QUALIFIER found in hbase:meta"); return true; } - RegionInfo hri = rl.getRegionLocation(RegionInfo.DEFAULT_REPLICA_ID).getRegionInfo(); + RegionInfo hri = rl.getRegionLocation(RegionInfo.DEFAULT_REPLICA_ID).getRegion(); if (!(isTableIncluded(hri.getTable()) || hri.isMetaRegion())) { return true; } PairOfSameType daughters = MetaTableAccessor.getDaughterRegions(result); for (HRegionLocation h : rl.getRegionLocations()) { - if (h == null || h.getRegionInfo() == null) { + if (h == null || h.getRegion() == null) { continue; } sn = h.getServerName(); - hri = h.getRegionInfo(); + hri = h.getRegion(); MetaEntry m = null; if (hri.getReplicaId() == RegionInfo.DEFAULT_REPLICA_ID) { diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/RegionSplitter.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/RegionSplitter.java index 0673c2f422aa..cd52e0c29863 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/RegionSplitter.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/RegionSplitter.java @@ -45,6 +45,7 @@ import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor; +import org.apache.hadoop.hbase.client.RegionInfo; import org.apache.hadoop.hbase.client.TableDescriptor; import org.apache.yetus.audience.InterfaceAudience; import org.slf4j.Logger; @@ -551,7 +552,7 @@ static void rollingSplit(TableName tableName, SplitAlgorithm splitAlgo, Configur } // make sure this region wasn't already split - byte[] sk = regionLoc.getRegionInfo().getStartKey(); + byte[] sk = regionLoc.getRegion().getStartKey(); if (sk.length != 0) { if (Bytes.equals(split, sk)) { LOG.debug("Region already split on " @@ -721,7 +722,7 @@ static LinkedList> splitScan( // see if the new split daughter region has come online try { - HRegionInfo dri = regionLocator.getRegionLocation(split).getRegionInfo(); + RegionInfo dri = regionLocator.getRegionLocation(split).getRegion(); if (dri.isOffline() || !Bytes.equals(dri.getStartKey(), split)) { logicalSplitting.add(region); continue; @@ -736,9 +737,9 @@ static LinkedList> splitScan( try { // when a daughter region is opened, a compaction is triggered // wait until compaction completes for both daughter regions - LinkedList check = Lists.newLinkedList(); - check.add(regionLocator.getRegionLocation(start).getRegionInfo()); - check.add(regionLocator.getRegionLocation(split).getRegionInfo()); + LinkedList check = Lists.newLinkedList(); + check.add(regionLocator.getRegionLocation(start).getRegion()); + check.add(regionLocator.getRegionLocation(split).getRegion()); for (HRegionInfo hri : check.toArray(new HRegionInfo[check.size()])) { byte[] sk = hri.getStartKey(); if (sk.length == 0) diff --git a/hbase-server/src/main/resources/hbase-webapps/master/table.jsp b/hbase-server/src/main/resources/hbase-webapps/master/table.jsp index ced5b4463de4..e4de7041c534 100644 --- a/hbase-server/src/main/resources/hbase-webapps/master/table.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/master/table.jsp @@ -407,7 +407,7 @@ if ( fqtn != null ) { Map regionsToLoad = new LinkedHashMap<>(); Map regionsToServer = new LinkedHashMap<>(); for (HRegionLocation hriEntry : regions) { - RegionInfo regionInfo = hriEntry.getRegionInfo(); + RegionInfo regionInfo = hriEntry.getRegion(); ServerName addr = hriEntry.getServerName(); regionsToServer.put(regionInfo, addr); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java index 805613dcb765..5b8b4c736f5d 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java @@ -3093,7 +3093,7 @@ public void unassignRegionByRow(String row, RegionLocator table) throws IOExcept */ public void unassignRegionByRow(byte[] row, RegionLocator table) throws IOException { HRegionLocation hrl = table.getRegionLocation(row); - unassignRegion(hrl.getRegionInfo().getRegionName()); + unassignRegion(hrl.getRegion().getRegionName()); } /* @@ -4188,8 +4188,8 @@ public boolean evaluate() throws IOException { TableDescriptor htd = table.getDescriptor(); for (HRegionLocation loc : getConnection().getRegionLocator(tableName) .getAllRegionLocations()) { - Scan scan = new Scan().withStartRow(loc.getRegionInfo().getStartKey()) - .withStopRow(loc.getRegionInfo().getEndKey()).setOneRowLimit() + Scan scan = new Scan().withStartRow(loc.getRegion().getStartKey()) + .withStopRow(loc.getRegion().getEndKey()).setOneRowLimit() .setMaxResultsPerColumnFamily(1).setCacheBlocks(false); for (byte[] family : htd.getColumnFamilyNames()) { scan.addFamily(family); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/MetaMockingUtil.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/MetaMockingUtil.java index 66c6f95171ae..723b9daad091 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/MetaMockingUtil.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/MetaMockingUtil.java @@ -23,6 +23,7 @@ import java.util.Collections; import java.util.List; +import org.apache.hadoop.hbase.client.RegionInfo; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.util.Bytes; @@ -59,21 +60,21 @@ public static Result getMetaTableRowResult(final HRegionInfo region, final Serve /** * Returns a Result object constructed from the given region information simulating * a catalog table result. - * @param region the HRegionInfo object or null + * @param region the RegionInfo object or null * @param sn to use making startcode and server hostname:port in meta or null * @param splita daughter region or null * @param splitb daughter region or null * @return A mocked up Result that fakes a Get on a row in the hbase:meta table. * @throws IOException */ - public static Result getMetaTableRowResult(HRegionInfo region, final ServerName sn, - HRegionInfo splita, HRegionInfo splitb) throws IOException { + public static Result getMetaTableRowResult(RegionInfo region, final ServerName sn, + RegionInfo splita, RegionInfo splitb) throws IOException { List kvs = new ArrayList<>(); if (region != null) { kvs.add(new KeyValue( region.getRegionName(), HConstants.CATALOG_FAMILY, HConstants.REGIONINFO_QUALIFIER, - region.toByteArray())); + RegionInfo.toByteArray(region))); } if (sn != null) { @@ -89,14 +90,14 @@ public static Result getMetaTableRowResult(HRegionInfo region, final ServerName kvs.add(new KeyValue( region.getRegionName(), HConstants.CATALOG_FAMILY, HConstants.SPLITA_QUALIFIER, - splita.toByteArray())); + RegionInfo.toByteArray(splita))); } if (splitb != null) { kvs.add(new KeyValue( region.getRegionName(), HConstants.CATALOG_FAMILY, HConstants.SPLITB_QUALIFIER, - splitb.toByteArray())); + RegionInfo.toByteArray(splitb))); } //important: sort the kvs so that binary search work diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestHRegionLocation.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestHRegionLocation.java index cffe4b63b15c..2307ab89a1d5 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestHRegionLocation.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestHRegionLocation.java @@ -56,7 +56,7 @@ public void testHashAndEqualsCode() { HRegionLocation hrl4 = new HRegionLocation(HRegionInfo.FIRST_META_REGIONINFO, hsa2); // These have same HRI but different locations so should be different. assertFalse(hrl3.equals(hrl4)); - HRegionLocation hrl5 = new HRegionLocation(hrl4.getRegionInfo(), + HRegionLocation hrl5 = new HRegionLocation(hrl4.getRegion(), hrl4.getServerName(), hrl4.getSeqNum() + 1); assertTrue(hrl4.equals(hrl5)); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestMetaTableAccessor.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestMetaTableAccessor.java index 558217880592..1a22cd0e6ad8 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestMetaTableAccessor.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestMetaTableAccessor.java @@ -800,7 +800,7 @@ public void testMetaUpdatesGoToPriorityQueue() throws Exception { UTIL.createTable(tableName, "cf1"); HRegionLocation loc = rl.getAllRegionLocations().get(0); - RegionInfo parent = loc.getRegionInfo(); + RegionInfo parent = loc.getRegion(); long rid = 1000; byte[] splitKey = Bytes.toBytes("a"); RegionInfo splitA = RegionInfoBuilder.newBuilder(parent.getTable()) diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin1.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin1.java index ba118583d996..392512bf59b3 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin1.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin1.java @@ -461,7 +461,7 @@ public void testCompactionTimestamps() throws Exception { byte[] regionName; try (RegionLocator l = TEST_UTIL.getConnection().getRegionLocator(tableName)) { - regionName = l.getAllRegionLocations().get(0).getRegionInfo().getRegionName(); + regionName = l.getAllRegionLocations().get(0).getRegion().getRegionName(); } long ts1 = ADMIN.getLastMajorCompactionTimestampForRegion(regionName); assertEquals(ts, ts1); @@ -646,7 +646,7 @@ protected void verifyRoundRobinDistribution(ClusterConnection c, RegionLocator r regs = new ArrayList<>(); server2Regions.put(server, regs); } - regs.add(loc.getRegionInfo()); + regs.add(loc.getRegion()); } boolean tablesOnMaster = LoadBalancer.isTablesOnMaster(TEST_UTIL.getConfiguration()); if (tablesOnMaster) { @@ -749,34 +749,34 @@ public void testCreateTableWithRegions() throws IOException, InterruptedExceptio System.err.println("Found " + regions.size() + " regions"); hris = regions.iterator(); - hri = hris.next().getRegionInfo(); + hri = hris.next().getRegion(); assertTrue(hri.getStartKey() == null || hri.getStartKey().length == 0); assertTrue(Bytes.equals(hri.getEndKey(), splitKeys[0])); - hri = hris.next().getRegionInfo(); + hri = hris.next().getRegion(); assertTrue(Bytes.equals(hri.getStartKey(), splitKeys[0])); assertTrue(Bytes.equals(hri.getEndKey(), splitKeys[1])); - hri = hris.next().getRegionInfo(); + hri = hris.next().getRegion(); assertTrue(Bytes.equals(hri.getStartKey(), splitKeys[1])); assertTrue(Bytes.equals(hri.getEndKey(), splitKeys[2])); - hri = hris.next().getRegionInfo(); + hri = hris.next().getRegion(); assertTrue(Bytes.equals(hri.getStartKey(), splitKeys[2])); assertTrue(Bytes.equals(hri.getEndKey(), splitKeys[3])); - hri = hris.next().getRegionInfo(); + hri = hris.next().getRegion(); assertTrue(Bytes.equals(hri.getStartKey(), splitKeys[3])); assertTrue(Bytes.equals(hri.getEndKey(), splitKeys[4])); - hri = hris.next().getRegionInfo(); + hri = hris.next().getRegion(); assertTrue(Bytes.equals(hri.getStartKey(), splitKeys[4])); assertTrue(Bytes.equals(hri.getEndKey(), splitKeys[5])); - hri = hris.next().getRegionInfo(); + hri = hris.next().getRegion(); assertTrue(Bytes.equals(hri.getStartKey(), splitKeys[5])); assertTrue(Bytes.equals(hri.getEndKey(), splitKeys[6])); - hri = hris.next().getRegionInfo(); + hri = hris.next().getRegion(); assertTrue(Bytes.equals(hri.getStartKey(), splitKeys[6])); assertTrue(Bytes.equals(hri.getEndKey(), splitKeys[7])); - hri = hris.next().getRegionInfo(); + hri = hris.next().getRegion(); assertTrue(Bytes.equals(hri.getStartKey(), splitKeys[7])); assertTrue(Bytes.equals(hri.getEndKey(), splitKeys[8])); - hri = hris.next().getRegionInfo(); + hri = hris.next().getRegion(); assertTrue(Bytes.equals(hri.getStartKey(), splitKeys[8])); assertTrue(hri.getEndKey() == null || hri.getEndKey().length == 0); @@ -809,34 +809,34 @@ public void testCreateTableWithRegions() throws IOException, InterruptedExceptio System.err.println("Found " + regions.size() + " regions"); hris = regions.iterator(); - hri = hris.next().getRegionInfo(); + hri = hris.next().getRegion(); assertTrue(hri.getStartKey() == null || hri.getStartKey().length == 0); assertTrue(Bytes.equals(hri.getEndKey(), new byte[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 })); - hri = hris.next().getRegionInfo(); + hri = hris.next().getRegion(); assertTrue(Bytes.equals(hri.getStartKey(), new byte[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 })); assertTrue(Bytes.equals(hri.getEndKey(), new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 })); - hri = hris.next().getRegionInfo(); + hri = hris.next().getRegion(); assertTrue(Bytes.equals(hri.getStartKey(), new byte[] { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 })); assertTrue(Bytes.equals(hri.getEndKey(), new byte[] { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 })); - hri = hris.next().getRegionInfo(); + hri = hris.next().getRegion(); assertTrue(Bytes.equals(hri.getStartKey(), new byte[] { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 })); assertTrue(Bytes.equals(hri.getEndKey(), new byte[] { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 })); - hri = hris.next().getRegionInfo(); + hri = hris.next().getRegion(); assertTrue(Bytes.equals(hri.getStartKey(), new byte[] { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 })); assertTrue(Bytes.equals(hri.getEndKey(), new byte[] { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 })); - hri = hris.next().getRegionInfo(); + hri = hris.next().getRegion(); assertTrue(Bytes.equals(hri.getStartKey(), new byte[] { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 })); assertTrue(Bytes.equals(hri.getEndKey(), new byte[] { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 })); - hri = hris.next().getRegionInfo(); + hri = hris.next().getRegion(); assertTrue(Bytes.equals(hri.getStartKey(), new byte[] { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 })); assertTrue(Bytes.equals(hri.getEndKey(), new byte[] { 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 })); - hri = hris.next().getRegionInfo(); + hri = hris.next().getRegion(); assertTrue(Bytes.equals(hri.getStartKey(), new byte[] { 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 })); assertTrue(Bytes.equals(hri.getEndKey(), new byte[] { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 })); - hri = hris.next().getRegionInfo(); + hri = hris.next().getRegion(); assertTrue(Bytes.equals(hri.getStartKey(), new byte[] { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 })); assertTrue(Bytes.equals(hri.getEndKey(), new byte[] { 9, 9, 9, 9, 9, 9, 9, 9, 9, 9 })); - hri = hris.next().getRegionInfo(); + hri = hris.next().getRegion(); assertTrue(Bytes.equals(hri.getStartKey(), new byte[] { 9, 9, 9, 9, 9, 9, 9, 9, 9, 9 })); assertTrue(hri.getEndKey() == null || hri.getEndKey().length == 0); @@ -1131,18 +1131,18 @@ void splitTest(byte[] splitPoint, byte[][] familyNames, int[] rowCounts, if (splitPoint != null) { // make sure the split point matches our explicit configuration assertEquals(Bytes.toString(splitPoint), - Bytes.toString(regions.get(0).getRegionInfo().getEndKey())); + Bytes.toString(regions.get(0).getRegion().getEndKey())); assertEquals(Bytes.toString(splitPoint), - Bytes.toString(regions.get(1).getRegionInfo().getStartKey())); + Bytes.toString(regions.get(1).getRegion().getStartKey())); LOG.debug("Properly split on " + Bytes.toString(splitPoint)); } else { if (familyNames.length > 1) { - int splitKey = Bytes.toInt(regions.get(0).getRegionInfo().getEndKey()); + int splitKey = Bytes.toInt(regions.get(0).getRegion().getEndKey()); // check if splitKey is based on the largest column family // in terms of it store size int deltaForLargestFamily = Math.abs(rowCount / 2 - splitKey); LOG.debug("SplitKey=" + splitKey + "&deltaForLargestFamily=" + deltaForLargestFamily + - ", r=" + regions.get(0).getRegionInfo()); + ", r=" + regions.get(0).getRegion()); for (int index = 0; index < familyNames.length; index++) { int delta = Math.abs(rowCounts[index] / 2 - splitKey); if (delta < deltaForLargestFamily) { diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin2.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin2.java index f4aafc03247f..64d63c08c92b 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin2.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin2.java @@ -611,7 +611,7 @@ public void testGetRegion() throws Exception { try (RegionLocator locator = TEST_UTIL.getConnection().getRegionLocator(tableName)) { HRegionLocation regionLocation = locator.getRegionLocation(Bytes.toBytes("mmm")); - RegionInfo region = regionLocation.getRegionInfo(); + RegionInfo region = regionLocation.getRegion(); byte[] regionName = region.getRegionName(); Pair pair = rawAdmin.getRegion(regionName); assertTrue(Bytes.equals(regionName, pair.getFirst().getRegionName())); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestBlockEvictionFromClient.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestBlockEvictionFromClient.java index 5d852efa7815..12ef7e91d262 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestBlockEvictionFromClient.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestBlockEvictionFromClient.java @@ -190,7 +190,7 @@ public void testBlockEvictionWithParallelScans() throws Exception { CustomInnerRegionObserver.class.getName()); // get the block cache and region RegionLocator locator = TEST_UTIL.getConnection().getRegionLocator(tableName); - String regionName = locator.getAllRegionLocations().get(0).getRegionInfo().getEncodedName(); + String regionName = locator.getAllRegionLocations().get(0).getRegion().getEncodedName(); HRegion region = TEST_UTIL.getRSForFirstRegionInTable(tableName) .getRegion(regionName); HStore store = region.getStores().iterator().next(); @@ -280,7 +280,7 @@ public void testParallelGetsAndScans() throws IOException, InterruptedException CustomInnerRegionObserver.class.getName()); // get the block cache and region RegionLocator locator = TEST_UTIL.getConnection().getRegionLocator(tableName); - String regionName = locator.getAllRegionLocations().get(0).getRegionInfo().getEncodedName(); + String regionName = locator.getAllRegionLocations().get(0).getRegion().getEncodedName(); HRegion region = TEST_UTIL.getRSForFirstRegionInTable(tableName).getRegion(regionName); HStore store = region.getStores().iterator().next(); @@ -339,7 +339,7 @@ public void testGetWithCellsInDifferentFiles() throws IOException, InterruptedEx CustomInnerRegionObserver.class.getName()); // get the block cache and region RegionLocator locator = TEST_UTIL.getConnection().getRegionLocator(tableName); - String regionName = locator.getAllRegionLocations().get(0).getRegionInfo().getEncodedName(); + String regionName = locator.getAllRegionLocations().get(0).getRegion().getEncodedName(); HRegion region = TEST_UTIL.getRSForFirstRegionInTable(tableName).getRegion(regionName); HStore store = region.getStores().iterator().next(); @@ -401,7 +401,7 @@ public void testGetsWithMultiColumnsAndExplicitTracker() CustomInnerRegionObserver.class.getName()); // get the block cache and region RegionLocator locator = TEST_UTIL.getConnection().getRegionLocator(tableName); - String regionName = locator.getAllRegionLocations().get(0).getRegionInfo().getEncodedName(); + String regionName = locator.getAllRegionLocations().get(0).getRegion().getEncodedName(); HRegion region = TEST_UTIL.getRSForFirstRegionInTable(tableName).getRegion(regionName); BlockCache cache = setCacheProperties(region); @@ -494,7 +494,7 @@ public void testGetWithMultipleColumnFamilies() throws IOException, InterruptedE CustomInnerRegionObserver.class.getName()); // get the block cache and region RegionLocator locator = TEST_UTIL.getConnection().getRegionLocator(tableName); - String regionName = locator.getAllRegionLocations().get(0).getRegionInfo().getEncodedName(); + String regionName = locator.getAllRegionLocations().get(0).getRegion().getEncodedName(); HRegion region = TEST_UTIL.getRSForFirstRegionInTable(tableName).getRegion(regionName); BlockCache cache = setCacheProperties(region); @@ -634,7 +634,7 @@ public void testMultiGets() throws IOException, InterruptedException { CustomInnerRegionObserver.class.getName()); // get the block cache and region RegionLocator locator = TEST_UTIL.getConnection().getRegionLocator(tableName); - String regionName = locator.getAllRegionLocations().get(0).getRegionInfo().getEncodedName(); + String regionName = locator.getAllRegionLocations().get(0).getRegion().getEncodedName(); HRegion region = TEST_UTIL.getRSForFirstRegionInTable(tableName).getRegion(regionName); HStore store = region.getStores().iterator().next(); @@ -717,7 +717,7 @@ public void testScanWithMultipleColumnFamilies() throws IOException, Interrupted CustomInnerRegionObserver.class.getName()); // get the block cache and region RegionLocator locator = TEST_UTIL.getConnection().getRegionLocator(tableName); - String regionName = locator.getAllRegionLocations().get(0).getRegionInfo().getEncodedName(); + String regionName = locator.getAllRegionLocations().get(0).getRegion().getEncodedName(); HRegion region = TEST_UTIL.getRSForFirstRegionInTable(tableName).getRegion(regionName); BlockCache cache = setCacheProperties(region); @@ -817,7 +817,7 @@ public void testParallelGetsAndScanWithWrappedRegionScanner() throws IOException CustomInnerRegionObserverWrapper.class.getName()); // get the block cache and region RegionLocator locator = TEST_UTIL.getConnection().getRegionLocator(tableName); - String regionName = locator.getAllRegionLocations().get(0).getRegionInfo().getEncodedName(); + String regionName = locator.getAllRegionLocations().get(0).getRegion().getEncodedName(); HRegion region = TEST_UTIL.getRSForFirstRegionInTable(tableName).getRegion(regionName); HStore store = region.getStores().iterator().next(); @@ -883,7 +883,7 @@ private void testScanWithCompactionInternals(String tableNameStr, boolean revers CustomInnerRegionObserverWrapper.class.getName()); // get the block cache and region RegionLocator locator = TEST_UTIL.getConnection().getRegionLocator(tableName); - String regionName = locator.getAllRegionLocations().get(0).getRegionInfo().getEncodedName(); + String regionName = locator.getAllRegionLocations().get(0).getRegion().getEncodedName(); HRegion region = TEST_UTIL.getRSForFirstRegionInTable(tableName).getRegion(regionName); HStore store = region.getStores().iterator().next(); @@ -1001,7 +1001,7 @@ public void testBlockEvictionAfterHBASE13082WithCompactionAndFlush() CustomInnerRegionObserverWrapper.class.getName()); // get the block cache and region RegionLocator locator = TEST_UTIL.getConnection().getRegionLocator(tableName); - String regionName = locator.getAllRegionLocations().get(0).getRegionInfo().getEncodedName(); + String regionName = locator.getAllRegionLocations().get(0).getRegion().getEncodedName(); HRegion region = TEST_UTIL.getRSForFirstRegionInTable(tableName).getRegion(regionName); HStore store = region.getStores().iterator().next(); @@ -1131,7 +1131,7 @@ public void testScanWithException() throws IOException, InterruptedException { CustomInnerRegionObserverWrapper.class.getName()); // get the block cache and region RegionLocator locator = TEST_UTIL.getConnection().getRegionLocator(tableName); - String regionName = locator.getAllRegionLocations().get(0).getRegionInfo().getEncodedName(); + String regionName = locator.getAllRegionLocations().get(0).getRegion().getEncodedName(); HRegion region = TEST_UTIL.getRSForFirstRegionInTable(tableName).getRegion(regionName); HStore store = region.getStores().iterator().next(); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestConnectionImplementation.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestConnectionImplementation.java index b1ad86636cbe..6a620051c153 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestConnectionImplementation.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestConnectionImplementation.java @@ -231,13 +231,13 @@ public void testClusterStatus() throws Exception { final ConnectionImplementation hci = (ConnectionImplementation)TEST_UTIL.getConnection(); try (RegionLocator l = TEST_UTIL.getConnection().getRegionLocator(tableName)) { while (l.getRegionLocation(rk).getPort() != sn.getPort()) { - TEST_UTIL.getAdmin().move(l.getRegionLocation(rk).getRegionInfo().getEncodedNameAsBytes(), + TEST_UTIL.getAdmin().move(l.getRegionLocation(rk).getRegion().getEncodedNameAsBytes(), sn); TEST_UTIL.waitUntilNoRegionsInTransition(); hci.clearRegionCache(tableName); } Assert.assertNotNull(hci.clusterStatusListener); - TEST_UTIL.assertRegionOnServer(l.getRegionLocation(rk).getRegionInfo(), sn, 20000); + TEST_UTIL.assertRegionOnServer(l.getRegionLocation(rk).getRegion(), sn, 20000); } Put p1 = new Put(rk); @@ -551,7 +551,7 @@ public void testRegionCaching() throws Exception { // a location where the port is current port number +1 -- i.e. a non-existent location. HRegionLocation loc = conn.getCachedLocation(TABLE_NAME, ROW).getRegionLocation(); final int nextPort = loc.getPort() + 1; - conn.updateCachedLocation(loc.getRegionInfo(), loc.getServerName(), + conn.updateCachedLocation(loc.getRegion(), loc.getServerName(), ServerName.valueOf("127.0.0.1", nextPort, HConstants.LATEST_TIMESTAMP), HConstants.LATEST_TIMESTAMP); Assert.assertEquals(conn.getCachedLocation(TABLE_NAME, ROW) @@ -579,8 +579,8 @@ public void testRegionCaching() throws Exception { // Now moving the region to the second server HRegionLocation toMove = conn.getCachedLocation(TABLE_NAME, ROW).getRegionLocation(); - byte[] regionName = toMove.getRegionInfo().getRegionName(); - byte[] encodedRegionNameBytes = toMove.getRegionInfo().getEncodedNameAsBytes(); + byte[] regionName = toMove.getRegion().getRegionName(); + byte[] encodedRegionNameBytes = toMove.getRegion().getEncodedNameAsBytes(); // Choose the other server. int curServerId = TEST_UTIL.getHBaseCluster().getServerWith(regionName); @@ -602,8 +602,8 @@ public void testRegionCaching() throws Exception { // Moving. It's possible that we don't have all the regions online at this point, so // the test must depend only on the region we're looking at. - LOG.info("Move starting region="+toMove.getRegionInfo().getRegionNameAsString()); - TEST_UTIL.getAdmin().move(toMove.getRegionInfo().getEncodedNameAsBytes(), destServerName); + LOG.info("Move starting region="+toMove.getRegion().getRegionNameAsString()); + TEST_UTIL.getAdmin().move(toMove.getRegion().getEncodedNameAsBytes(), destServerName); while (destServer.getOnlineRegion(regionName) == null || destServer.getRegionsInTransitionInRS().containsKey(encodedRegionNameBytes) || @@ -613,7 +613,7 @@ public void testRegionCaching() throws Exception { Thread.sleep(1); } - LOG.info("Move finished for region="+toMove.getRegionInfo().getRegionNameAsString()); + LOG.info("Move finished for region="+toMove.getRegion().getRegionNameAsString()); // Check our new state. Assert.assertNull(curServer.getOnlineRegion(regionName)); @@ -665,8 +665,8 @@ public void testRegionCaching() throws Exception { .containsKey(encodedRegionNameBytes)); // We move it back to do another test with a scan - LOG.info("Move starting region=" + toMove.getRegionInfo().getRegionNameAsString()); - TEST_UTIL.getAdmin().move(toMove.getRegionInfo().getEncodedNameAsBytes(), + LOG.info("Move starting region=" + toMove.getRegion().getRegionNameAsString()); + TEST_UTIL.getAdmin().move(toMove.getRegion().getEncodedNameAsBytes(), curServer.getServerName()); while (curServer.getOnlineRegion(regionName) == null || @@ -680,7 +680,7 @@ public void testRegionCaching() throws Exception { // Check our new state. Assert.assertNotNull(curServer.getOnlineRegion(regionName)); Assert.assertNull(destServer.getOnlineRegion(regionName)); - LOG.info("Move finished for region=" + toMove.getRegionInfo().getRegionNameAsString()); + LOG.info("Move finished for region=" + toMove.getRegion().getRegionNameAsString()); // Cache was NOT updated and points to the wrong server Assert.assertFalse(conn.getCachedLocation(TABLE_NAME, ROW).getRegionLocation().getPort() == @@ -759,28 +759,28 @@ public void testCacheSeqNums() throws Exception{ // Same server as already in cache reporting - overwrites any value despite seqNum. int nextPort = location.getPort() + 1; - conn.updateCachedLocation(location.getRegionInfo(), location.getServerName(), + conn.updateCachedLocation(location.getRegion(), location.getServerName(), ServerName.valueOf("127.0.0.1", nextPort, 0), location.getSeqNum() - 1); location = conn.getCachedLocation(TABLE_NAME2, ROW).getRegionLocation(); Assert.assertEquals(nextPort, location.getPort()); // No source specified - same. nextPort = location.getPort() + 1; - conn.updateCachedLocation(location.getRegionInfo(), location.getServerName(), + conn.updateCachedLocation(location.getRegion(), location.getServerName(), ServerName.valueOf("127.0.0.1", nextPort, 0), location.getSeqNum() - 1); location = conn.getCachedLocation(TABLE_NAME2, ROW).getRegionLocation(); Assert.assertEquals(nextPort, location.getPort()); // Higher seqNum - overwrites lower seqNum. nextPort = location.getPort() + 1; - conn.updateCachedLocation(location.getRegionInfo(), anySource, + conn.updateCachedLocation(location.getRegion(), anySource, ServerName.valueOf("127.0.0.1", nextPort, 0), location.getSeqNum() + 1); location = conn.getCachedLocation(TABLE_NAME2, ROW).getRegionLocation(); Assert.assertEquals(nextPort, location.getPort()); // Lower seqNum - does not overwrite higher seqNum. nextPort = location.getPort() + 1; - conn.updateCachedLocation(location.getRegionInfo(), anySource, + conn.updateCachedLocation(location.getRegion(), anySource, ServerName.valueOf("127.0.0.1", nextPort, 0), location.getSeqNum() - 1); location = conn.getCachedLocation(TABLE_NAME2, ROW).getRegionLocation(); Assert.assertEquals(nextPort - 1, location.getPort()); @@ -880,8 +880,8 @@ public void testMulti() throws Exception { // Now moving the region to the second server HRegionLocation toMove = conn.getCachedLocation(TABLE_NAME3, ROW_X).getRegionLocation(); - byte[] regionName = toMove.getRegionInfo().getRegionName(); - byte[] encodedRegionNameBytes = toMove.getRegionInfo().getEncodedNameAsBytes(); + byte[] regionName = toMove.getRegion().getRegionName(); + byte[] encodedRegionNameBytes = toMove.getRegion().getEncodedNameAsBytes(); // Choose the other server. int curServerId = TEST_UTIL.getHBaseCluster().getServerWith(regionName); @@ -896,13 +896,14 @@ public void testMulti() throws Exception { //find another row in the cur server that is less than ROW_X List regions = curServer.getRegions(TABLE_NAME3); byte[] otherRow = null; - for (Region region : regions) { - if (!region.getRegionInfo().getEncodedName().equals(toMove.getRegionInfo().getEncodedName()) - && Bytes.BYTES_COMPARATOR.compare(region.getRegionInfo().getStartKey(), ROW_X) < 0) { - otherRow = region.getRegionInfo().getStartKey(); - break; - } - } + for (Region region : regions) { + if (!region.getRegionInfo().getEncodedName().equals(toMove.getRegion().getEncodedName()) + && Bytes.BYTES_COMPARATOR.compare( + region.getRegionInfo().getStartKey(), ROW_X) < 0) { + otherRow = region.getRegionInfo().getStartKey(); + break; + } + } assertNotNull(otherRow); // If empty row, set it to first row.-f if (otherRow.length <= 0) otherRow = Bytes.toBytes("aaa"); @@ -921,8 +922,8 @@ public void testMulti() throws Exception { // Moving. It's possible that we don't have all the regions online at this point, so // the test depends only on the region we're looking at. - LOG.info("Move starting region=" + toMove.getRegionInfo().getRegionNameAsString()); - TEST_UTIL.getAdmin().move(toMove.getRegionInfo().getEncodedNameAsBytes(), destServerName); + LOG.info("Move starting region=" + toMove.getRegion().getRegionNameAsString()); + TEST_UTIL.getAdmin().move(toMove.getRegion().getEncodedNameAsBytes(), destServerName); while (destServer.getOnlineRegion(regionName) == null || destServer.getRegionsInTransitionInRS().containsKey(encodedRegionNameBytes) || @@ -932,7 +933,7 @@ public void testMulti() throws Exception { Thread.sleep(1); } - LOG.info("Move finished for region="+toMove.getRegionInfo().getRegionNameAsString()); + LOG.info("Move finished for region="+toMove.getRegion().getRegionNameAsString()); // Check our new state. Assert.assertNull(curServer.getOnlineRegion(regionName)); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java index 2c41ed390411..52d0f946e141 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java @@ -53,7 +53,6 @@ import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.HConstants; -import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.HRegionLocation; import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.KeepDeletedCells; @@ -482,7 +481,7 @@ public void testFilterAcrossMultipleRegions() List regions = splitTable(t); assertRowCount(t, rowCount); // Get end key of first region. - byte [] endKey = regions.get(0).getRegionInfo().getEndKey(); + byte [] endKey = regions.get(0).getRegion().getEndKey(); // Count rows with a filter that stops us before passed 'endKey'. // Should be count of rows in first region. int endKeyCount = TEST_UTIL.countRows(t, createScanWithRowFilter(endKey)); @@ -4372,7 +4371,7 @@ public void testGetClosestRowBefore() throws IOException, InterruptedException { // set block size to 64 to making 2 kvs into one block, bypassing the walkForwardInSingleRow // in Store.rowAtOrBeforeFromStoreFile - String regionName = locator.getAllRegionLocations().get(0).getRegionInfo().getEncodedName(); + String regionName = locator.getAllRegionLocations().get(0).getRegion().getEncodedName(); HRegion region = TEST_UTIL.getRSForFirstRegionInTable(tableName).getRegion(regionName); Put put1 = new Put(firstRow); Put put2 = new Put(secondRow); @@ -5216,7 +5215,7 @@ public void testCacheOnWriteEvictOnClose() throws Exception { Table table = TEST_UTIL.createTable(tableName, FAMILY); try (RegionLocator locator = TEST_UTIL.getConnection().getRegionLocator(tableName)) { // get the block cache and region - String regionName = locator.getAllRegionLocations().get(0).getRegionInfo().getEncodedName(); + String regionName = locator.getAllRegionLocations().get(0).getRegion().getEncodedName(); HRegion region = TEST_UTIL.getRSForFirstRegionInTable(tableName) .getRegion(regionName); @@ -5336,7 +5335,7 @@ public void testNonCachedGetRegionLocation() throws Exception { RegionLocator locator = TEST_UTIL.getConnection().getRegionLocator(tableName)) { List allRegionLocations = locator.getAllRegionLocations(); assertEquals(1, allRegionLocations.size()); - HRegionInfo regionInfo = allRegionLocations.get(0).getRegionInfo(); + RegionInfo regionInfo = allRegionLocations.get(0).getRegion(); ServerName addrBefore = allRegionLocations.get(0).getServerName(); // Verify region location before move. HRegionLocation addrCache = locator.getRegionLocation(regionInfo.getStartKey(), false); @@ -5438,7 +5437,7 @@ private List getRegionsInRange(TableName tableName, byte[] star do { HRegionLocation regionLocation = r.getRegionLocation(currentKey); regionsInRange.add(regionLocation); - currentKey = regionLocation.getRegionInfo().getEndKey(); + currentKey = regionLocation.getRegion().getEndKey(); } while (!Bytes.equals(currentKey, HConstants.EMPTY_END_ROW) && (endKeyIsEndOfTable || Bytes.compareTo(currentKey, endKey) < 0)); return regionsInRange; diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide3.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide3.java index 2d021bb85cbd..ec2f01c61387 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide3.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide3.java @@ -153,7 +153,7 @@ private void performMultiplePutAndFlush(HBaseAdmin admin, Table table, HRegionLocation loc = locator.getRegionLocation(row, true); AdminProtos.AdminService.BlockingInterface server = ((ClusterConnection) admin.getConnection()).getAdmin(loc.getServerName()); - byte[] regName = loc.getRegionInfo().getRegionName(); + byte[] regName = loc.getRegion().getRegionName(); for (int i = 0; i < nFlushes; i++) { randomCFPuts(table, row, family, nPuts); @@ -291,7 +291,7 @@ public void testAdvancedConfigOverride() throws Exception { try (RegionLocator locator = TEST_UTIL.getConnection().getRegionLocator(tableName)) { // Verify we have multiple store files. HRegionLocation loc = locator.getRegionLocation(row, true); - byte[] regionName = loc.getRegionInfo().getRegionName(); + byte[] regionName = loc.getRegion().getRegionName(); AdminProtos.AdminService.BlockingInterface server = connection.getAdmin(loc.getServerName()); assertTrue(ProtobufUtil.getStoreFiles(server, regionName, FAMILY).size() > 1); @@ -302,8 +302,8 @@ public void testAdvancedConfigOverride() throws Exception { for (int i = 0; i < 10 * 1000 / 40; ++i) { // The number of store files after compaction should be lesser. loc = locator.getRegionLocation(row, true); - if (!loc.getRegionInfo().isOffline()) { - regionName = loc.getRegionInfo().getRegionName(); + if (!loc.getRegion().isOffline()) { + regionName = loc.getRegion().getRegionName(); server = connection.getAdmin(loc.getServerName()); if (ProtobufUtil.getStoreFiles(server, regionName, FAMILY).size() <= 1) { break; @@ -330,7 +330,7 @@ public void testAdvancedConfigOverride() throws Exception { // This time, the compaction request should not happen Thread.sleep(10 * 1000); loc = locator.getRegionLocation(row, true); - regionName = loc.getRegionInfo().getRegionName(); + regionName = loc.getRegion().getRegionName(); server = connection.getAdmin(loc.getServerName()); int sfCount = ProtobufUtil.getStoreFiles(server, regionName, FAMILY).size(); assertTrue(sfCount > 1); @@ -349,7 +349,7 @@ public void testAdvancedConfigOverride() throws Exception { // poll wait for the compactions to happen for (int i = 0; i < 10 * 1000 / 40; ++i) { loc = locator.getRegionLocation(row, true); - regionName = loc.getRegionInfo().getRegionName(); + regionName = loc.getRegion().getRegionName(); try { server = connection.getAdmin(loc.getServerName()); if (ProtobufUtil.getStoreFiles(server, regionName, FAMILY).size() < sfCount) { diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestReplicaWithCluster.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestReplicaWithCluster.java index 89430f6482e2..566b10702349 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestReplicaWithCluster.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestReplicaWithCluster.java @@ -494,7 +494,7 @@ protected Void rpcCall() throws Exception { LOG.debug("Going to connect to server " + getLocation() + " for row " + Bytes.toStringBinary(getRow())); SecureBulkLoadClient secureClient = null; - byte[] regionName = getLocation().getRegionInfo().getRegionName(); + byte[] regionName = getLocation().getRegion().getRegionName(); try (Table table = conn.getTable(getTableName())) { secureClient = new SecureBulkLoadClient(HTU.getConfiguration(), table); secureClient.secureBulkLoadHFiles(getStub(), famPaths, regionName, @@ -726,7 +726,7 @@ public void testReplicaGetWithPrimaryAndMetaDown() throws IOException, Interrupt // Make sure that user primary region is co-hosted with the meta region if (!url.getDefaultRegionLocation().getServerName().equals( mrl.getDefaultRegionLocation().getServerName())) { - HTU.moveRegionAndWait(url.getDefaultRegionLocation().getRegionInfo(), + HTU.moveRegionAndWait(url.getDefaultRegionLocation().getRegion(), mrl.getDefaultRegionLocation().getServerName()); } @@ -734,7 +734,7 @@ public void testReplicaGetWithPrimaryAndMetaDown() throws IOException, Interrupt // primary if (url.getRegionLocation(1).getServerName().equals(mrl.getDefaultRegionLocation() .getServerName())) { - HTU.moveRegionAndWait(url.getRegionLocation(1).getRegionInfo(), + HTU.moveRegionAndWait(url.getRegionLocation(1).getRegion(), url.getDefaultRegionLocation().getServerName()); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestReplicasClient.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestReplicasClient.java index 3703f43a6120..fae00e6b0beb 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestReplicasClient.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestReplicasClient.java @@ -89,7 +89,7 @@ public class TestReplicasClient { private static Table table = null; private static final byte[] row = Bytes.toBytes(TestReplicasClient.class.getName()); - private static HRegionInfo hriPrimary; + private static RegionInfo hriPrimary; private static HRegionInfo hriSecondary; private static final HBaseTestingUtility HTU = new HBaseTestingUtility(); @@ -205,7 +205,7 @@ public static void beforeClass() throws Exception { table = HTU.createTable(hdt, new byte[][]{f}, null); try (RegionLocator locator = HTU.getConnection().getRegionLocator(hdt.getTableName())) { - hriPrimary = locator.getRegionLocation(row, false).getRegionInfo(); + hriPrimary = locator.getRegionLocation(row, false).getRegion(); } // mock a secondary region info to open @@ -258,7 +258,7 @@ private HRegionServer getRS() { return HTU.getMiniHBaseCluster().getRegionServer(0); } - private void openRegion(HRegionInfo hri) throws Exception { + private void openRegion(RegionInfo hri) throws Exception { try { if (isRegionOpened(hri)) return; } catch (Exception e){} @@ -272,7 +272,7 @@ private void openRegion(HRegionInfo hri) throws Exception { checkRegionIsOpened(hri); } - private void closeRegion(HRegionInfo hri) throws Exception { + private void closeRegion(RegionInfo hri) throws Exception { AdminProtos.CloseRegionRequest crr = ProtobufUtil.buildCloseRegionRequest( getRS().getServerName(), hri.getRegionName()); AdminProtos.CloseRegionResponse responseClose = getRS() @@ -282,13 +282,13 @@ private void closeRegion(HRegionInfo hri) throws Exception { checkRegionIsClosed(hri.getEncodedName()); } - private void checkRegionIsOpened(HRegionInfo hri) throws Exception { + private void checkRegionIsOpened(RegionInfo hri) throws Exception { while (!getRS().getRegionsInTransitionInRS().isEmpty()) { Thread.sleep(1); } } - private boolean isRegionOpened(HRegionInfo hri) throws Exception { + private boolean isRegionOpened(RegionInfo hri) throws Exception { return getRS().getRegionByEncodedName(hri.getEncodedName()).isAvailable(); } @@ -307,7 +307,7 @@ private void checkRegionIsClosed(String encodedRegionName) throws Exception { // We don't delete the znode here, because there is not always a znode. } - private void flushRegion(HRegionInfo regionInfo) throws IOException { + private void flushRegion(RegionInfo regionInfo) throws IOException { TestRegionServerNoMaster.flushRegion(HTU, regionInfo); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestScannersFromClientSide.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestScannersFromClientSide.java index af0248215cdf..72c953020d86 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestScannersFromClientSide.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestScannersFromClientSide.java @@ -41,7 +41,6 @@ import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.HConstants; -import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.HRegionLocation; import org.apache.hadoop.hbase.HTestConst; import org.apache.hadoop.hbase.KeyValue; @@ -672,7 +671,7 @@ public void testScanOnReopenedRegion() throws Exception { try (RegionLocator locator = TEST_UTIL.getConnection().getRegionLocator(tableName)) { loc = locator.getRegionLocation(ROW); } - HRegionInfo hri = loc.getRegionInfo(); + RegionInfo hri = loc.getRegion(); MiniHBaseCluster cluster = TEST_UTIL.getMiniHBaseCluster(); byte[] regionName = hri.getRegionName(); int i = cluster.getServerWith(regionName); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestTableFavoredNodes.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestTableFavoredNodes.java index fd4cc51cca7d..ea859b457772 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestTableFavoredNodes.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestTableFavoredNodes.java @@ -35,7 +35,6 @@ import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HConstants; -import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.HRegionLocation; import org.apache.hadoop.hbase.MetaTableAccessor; import org.apache.hadoop.hbase.NamespaceDescriptor; @@ -176,7 +175,7 @@ public void testSplitTable() throws Exception { byte[] splitPoint = Bytes.toBytes(0); RegionLocator locator = TEST_UTIL.getConnection().getRegionLocator(tableName); - HRegionInfo parent = locator.getRegionLocation(splitPoint).getRegionInfo(); + RegionInfo parent = locator.getRegionLocation(splitPoint).getRegion(); List parentFN = fnm.getFavoredNodes(parent); assertNotNull("FN should not be null for region: " + parent, parentFN); @@ -190,10 +189,10 @@ public void testSplitTable() throws Exception { // All regions should have favored nodes checkIfFavoredNodeInformationIsCorrect(tableName); // Get the daughters of parent. - HRegionInfo daughter1 = locator.getRegionLocation(parent.getStartKey(), true).getRegionInfo(); + RegionInfo daughter1 = locator.getRegionLocation(parent.getStartKey(), true).getRegion(); List daughter1FN = fnm.getFavoredNodes(daughter1); - HRegionInfo daughter2 = locator.getRegionLocation(splitPoint, true).getRegionInfo(); + RegionInfo daughter2 = locator.getRegionLocation(splitPoint, true).getRegion(); List daughter2FN = fnm.getFavoredNodes(daughter2); checkIfDaughterInherits2FN(parentFN, daughter1FN); @@ -240,8 +239,8 @@ public void testMergeTable() throws Exception { checkIfFavoredNodeInformationIsCorrect(tableName); RegionLocator locator = TEST_UTIL.getConnection().getRegionLocator(tableName); - HRegionInfo regionA = locator.getRegionLocation(HConstants.EMPTY_START_ROW).getRegionInfo(); - HRegionInfo regionB = locator.getRegionLocation(splitKeys[0]).getRegionInfo(); + RegionInfo regionA = locator.getRegionLocation(HConstants.EMPTY_START_ROW).getRegion(); + RegionInfo regionB = locator.getRegionLocation(splitKeys[0]).getRegion(); List regionAFN = fnm.getFavoredNodes(regionA); LOG.info("regionA: " + regionA.getEncodedName() + " with FN: " + fnm.getFavoredNodes(regionA)); @@ -257,8 +256,8 @@ public void testMergeTable() throws Exception { // All regions should have favored nodes checkIfFavoredNodeInformationIsCorrect(tableName); - HRegionInfo mergedRegion = - locator.getRegionLocation(HConstants.EMPTY_START_ROW).getRegionInfo(); + RegionInfo mergedRegion = + locator.getRegionLocation(HConstants.EMPTY_START_ROW).getRegion(); List mergedFN = fnm.getFavoredNodes(mergedRegion); assertArrayEquals("Merged region doesn't match regionA's FN", @@ -315,7 +314,7 @@ private void checkIfFavoredNodeInformationIsCorrect(TableName tableName) throws RegionLocator regionLocator = admin.getConnection().getRegionLocator(tableName); for (HRegionLocation regionLocation : regionLocator.getAllRegionLocations()) { - HRegionInfo regionInfo = regionLocation.getRegionInfo(); + RegionInfo regionInfo = regionLocation.getRegion(); List fnList = fnm.getFavoredNodes(regionInfo); // 1. Does each region have favored node? diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorMetrics.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorMetrics.java index 473da0b207f7..35125e42a200 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorMetrics.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorMetrics.java @@ -422,8 +422,8 @@ public void testRegionObserverMultiRegion() throws IOException { table.get(new Get(bar)); table.get(new Get(foo)); // 2 gets to 2 separate regions assertEquals(2, locator.getAllRegionLocations().size()); - assertNotEquals(locator.getRegionLocation(bar).getRegionInfo(), - locator.getRegionLocation(foo).getRegionInfo()); + assertNotEquals(locator.getRegionLocation(bar).getRegion(), + locator.getRegionLocation(foo).getRegion()); } } @@ -498,12 +498,12 @@ public void testRegionObserverAfterRegionClosed() throws IOException { // close one of the regions try (RegionLocator locator = connection.getRegionLocator(tableName)) { HRegionLocation loc = locator.getRegionLocation(foo); - admin.unassign(loc.getRegionInfo().getEncodedNameAsBytes(), true); + admin.unassign(loc.getRegion().getEncodedNameAsBytes(), true); HRegionServer server = UTIL.getMiniHBaseCluster().getRegionServer(loc.getServerName()); UTIL.waitFor(30000, - () -> server.getOnlineRegion(loc.getRegionInfo().getRegionName()) == null); - assertNull(server.getOnlineRegion(loc.getRegionInfo().getRegionName())); + () -> server.getOnlineRegion(loc.getRegion().getRegionName()) == null); + assertNull(server.getOnlineRegion(loc.getRegion().getRegionName())); } // with only 1 region remaining, we should still be able to find the Counter diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java index 178429dcb3db..02ddfc4a7777 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java @@ -1324,8 +1324,8 @@ public void testTableOperations() throws Exception { RegionLocator regionLocator = connection.getRegionLocator(htd.getTableName()); List regions = regionLocator.getAllRegionLocations(); - admin.mergeRegionsAsync(regions.get(0).getRegionInfo().getEncodedNameAsBytes(), - regions.get(1).getRegionInfo().getEncodedNameAsBytes(), true); + admin.mergeRegionsAsync(regions.get(0).getRegion().getEncodedNameAsBytes(), + regions.get(1).getRegion().getEncodedNameAsBytes(), true); assertTrue("Coprocessor should have been called on region merge", cp.wasMergeRegionsCalled()); @@ -1563,7 +1563,7 @@ public void testRegionTransitionOperations() throws Exception { assertTrue("Found server", found); LOG.info("Found " + destName); master.getMasterRpcServices().moveRegion(null, RequestConverter.buildMoveRegionRequest( - firstGoodPair.getRegionInfo().getEncodedNameAsBytes(), ServerName.valueOf(destName))); + firstGoodPair.getRegion().getEncodedNameAsBytes(), ServerName.valueOf(destName))); assertTrue("Coprocessor should have been called on region move", cp.wasMoveCalled()); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverInterface.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverInterface.java index 6934c98d8ffb..7e89942023c6 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverInterface.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverInterface.java @@ -587,7 +587,7 @@ public void testRecovery() throws Exception { JVMClusterUtil.RegionServerThread rs1 = cluster.startRegionServer(); ServerName sn2 = rs1.getRegionServer().getServerName(); - String regEN = locator.getAllRegionLocations().get(0).getRegionInfo().getEncodedName(); + String regEN = locator.getAllRegionLocations().get(0).getRegion().getEncodedName(); util.getAdmin().move(Bytes.toBytes(regEN), sn2); while (!sn2.equals(locator.getAllRegionLocations().get(0).getServerName())) { @@ -637,7 +637,7 @@ public void testPreWALRestoreSkip() throws Exception { try (RegionLocator locator = util.getConnection().getRegionLocator(tableName)) { JVMClusterUtil.RegionServerThread rs1 = cluster.startRegionServer(); ServerName sn2 = rs1.getRegionServer().getServerName(); - String regEN = locator.getAllRegionLocations().get(0).getRegionInfo().getEncodedName(); + String regEN = locator.getAllRegionLocations().get(0).getRegion().getEncodedName(); util.getAdmin().move(Bytes.toBytes(regEN), sn2); while (!sn2.equals(locator.getAllRegionLocations().get(0).getServerName())) { diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/encoding/TestLoadAndSwitchEncodeOnDisk.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/encoding/TestLoadAndSwitchEncodeOnDisk.java index ac46d9bbce85..0fd6e7b93e44 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/encoding/TestLoadAndSwitchEncodeOnDisk.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/encoding/TestLoadAndSwitchEncodeOnDisk.java @@ -116,7 +116,7 @@ private void assertAllOnLine(final Table t) throws IOException { regions = rl.getAllRegionLocations(); } for (HRegionLocation e: regions) { - byte [] startkey = e.getRegionInfo().getStartKey(); + byte [] startkey = e.getRegion().getStartKey(); Scan s = new Scan(startkey); ResultScanner scanner = t.getScanner(s); Result r = scanner.next(); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestCatalogJanitorInMemoryStates.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestCatalogJanitorInMemoryStates.java index cefe10e93d0c..5be6630d7624 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestCatalogJanitorInMemoryStates.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestCatalogJanitorInMemoryStates.java @@ -110,24 +110,24 @@ public void testInMemoryParentCleanup() // We need to create a valid split with daughter regions HRegionLocation parent = allRegionLocations.get(0); - List daughters = splitRegion(parent.getRegionInfo()); + List daughters = splitRegion(parent.getRegion()); LOG.info("Parent region: " + parent); LOG.info("Daughter regions: " + daughters); assertNotNull("Should have found daughter regions for " + parent, daughters); assertTrue("Parent region should exist in RegionStates", - am.getRegionStates().isRegionInRegionStates(parent.getRegionInfo())); + am.getRegionStates().isRegionInRegionStates(parent.getRegion())); assertTrue("Parent region should exist in ServerManager", - sm.isRegionInServerManagerStates(parent.getRegionInfo())); + sm.isRegionInServerManagerStates(parent.getRegion())); // clean the parent - Result r = MetaMockingUtil.getMetaTableRowResult(parent.getRegionInfo(), null, - daughters.get(0).getRegionInfo(), daughters.get(1).getRegionInfo()); - janitor.cleanParent(parent.getRegionInfo(), r); + Result r = MetaMockingUtil.getMetaTableRowResult(parent.getRegion(), null, + daughters.get(0).getRegion(), daughters.get(1).getRegion()); + janitor.cleanParent(parent.getRegion(), r); assertFalse("Parent region should have been removed from RegionStates", - am.getRegionStates().isRegionInRegionStates(parent.getRegionInfo())); + am.getRegionStates().isRegionInRegionStates(parent.getRegion())); assertFalse("Parent region should have been removed from ServerManager", - sm.isRegionInServerManagerStates(parent.getRegionInfo())); + sm.isRegionInServerManagerStates(parent.getRegion())); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterOperationsForRegionReplicas.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterOperationsForRegionReplicas.java index 44cf1ccd7a1b..dfa86afb7a2a 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterOperationsForRegionReplicas.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterOperationsForRegionReplicas.java @@ -155,7 +155,7 @@ public void testCreateTableWithMultipleReplicas() throws Exception { int numRows = 0; for (Result result : metaRows) { RegionLocations locations = MetaTableAccessor.getRegionLocations(result); - RegionInfo hri = locations.getRegionLocation().getRegionInfo(); + RegionInfo hri = locations.getRegionLocation().getRegion(); if (!hri.getTable().equals(tableName)) continue; numRows += 1; HRegionLocation[] servers = locations.getRegionLocations(); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/MasterProcedureTestingUtility.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/MasterProcedureTestingUtility.java index b4d16c6544ad..deaa1a11436e 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/MasterProcedureTestingUtility.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/MasterProcedureTestingUtility.java @@ -252,10 +252,13 @@ public boolean visit(Result rowResult) throws IOException { if (l == null) { return true; } - if (!l.getRegionInfo().getTable().equals(tableName)) { + if (!l.getRegion().getTable().equals(tableName)) { return false; } - if (l.getRegionInfo().isOffline() || l.getRegionInfo().isSplit()) return true; + if (l.getRegion().isOffline() || l.getRegion().isSplit()) { + return true; + } + HRegionLocation[] locations = list.getRegionLocations(); for (HRegionLocation location : locations) { if (location == null) continue; diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestEndToEndSplitTransaction.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestEndToEndSplitTransaction.java index 57ced95265c6..e38c3e616795 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestEndToEndSplitTransaction.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestEndToEndSplitTransaction.java @@ -325,7 +325,7 @@ void verifyRegionsUsingHTable() throws IOException { Set regions = new TreeSet<>(RegionInfo.COMPARATOR); for (HRegionLocation loc : rl.getAllRegionLocations()) { - regions.add(loc.getRegionInfo()); + regions.add(loc.getRegion()); } verifyTableRegions(regions); } @@ -504,7 +504,7 @@ public static void blockUntilRegionIsInMeta(Connection conn, long timeout, Regio long start = System.currentTimeMillis(); while (System.currentTimeMillis() - start < timeout) { HRegionLocation loc = MetaTableAccessor.getRegionLocation(conn, hri); - if (loc != null && !loc.getRegionInfo().isOffline()) { + if (loc != null && !loc.getRegion().isOffline()) { log("found region in META: " + hri.getRegionNameAsString()); break; } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionFileSystem.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionFileSystem.java index be29f1a9e30a..550db20e24b3 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionFileSystem.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionFileSystem.java @@ -187,7 +187,7 @@ private HRegionFileSystem getHRegionFS(HTable table, Configuration conf) throws assertEquals(1, regionDirs.size()); List familyDirs = FSUtils.getFamilyDirs(fs, regionDirs.get(0)); assertEquals(2, familyDirs.size()); - RegionInfo hri = table.getRegionLocator().getAllRegionLocations().get(0).getRegionInfo(); + RegionInfo hri = table.getRegionLocator().getAllRegionLocations().get(0).getRegion(); HRegionFileSystem regionFs = new HRegionFileSystem(conf, new HFileSystem(fs), tableDir, hri); return regionFs; } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionOnCluster.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionOnCluster.java index 42ab3110afb6..4ce298fc5a79 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionOnCluster.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionOnCluster.java @@ -27,12 +27,12 @@ import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HColumnDescriptor; -import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.MiniHBaseCluster; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.Put; +import org.apache.hadoop.hbase.client.RegionInfo; import org.apache.hadoop.hbase.client.RegionLocator; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.client.ResultScanner; @@ -96,9 +96,9 @@ public void testDataCorrectnessReplayingRecoveredEdits() throws Exception { TEST_UTIL.waitUntilAllRegionsAssigned(table.getName()); // Move region to target server - HRegionInfo regionInfo; + RegionInfo regionInfo; try (RegionLocator locator = TEST_UTIL.getConnection().getRegionLocator(tableName)) { - regionInfo = locator.getRegionLocation(Bytes.toBytes("r1")).getRegionInfo(); + regionInfo = locator.getRegionLocation(Bytes.toBytes("r1")).getRegion(); } int originServerNum = cluster.getServerWith(regionInfo.getRegionName()); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionServerBulkLoad.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionServerBulkLoad.java index c86f3e11ef06..6729a3f5aa70 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionServerBulkLoad.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionServerBulkLoad.java @@ -225,7 +225,7 @@ public Void rpcCall() throws Exception { LOG.debug("Going to connect to server " + getLocation() + " for row " + Bytes.toStringBinary(getRow())); SecureBulkLoadClient secureClient = null; - byte[] regionName = getLocation().getRegionInfo().getRegionName(); + byte[] regionName = getLocation().getRegion().getRegionName(); try (Table table = conn.getTable(getTableName())) { secureClient = new SecureBulkLoadClient(UTIL.getConfiguration(), table); secureClient.secureBulkLoadHFiles(getStub(), famPaths, regionName, @@ -251,7 +251,7 @@ protected Void rpcCall() throws Exception { AdminProtos.AdminService.BlockingInterface server = conn.getAdmin(getLocation().getServerName()); CompactRegionRequest request = RequestConverter.buildCompactRegionRequest( - getLocation().getRegionInfo().getRegionName(), true, null); + getLocation().getRegion().getRegionName(), true, null); server.compactRegion(null, request); numCompactions.incrementAndGet(); return null; diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionReplicas.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionReplicas.java index 263b0dd1eb07..a8fdd2d2cffa 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionReplicas.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionReplicas.java @@ -38,6 +38,7 @@ import org.apache.hadoop.hbase.client.Consistency; import org.apache.hadoop.hbase.client.Get; import org.apache.hadoop.hbase.client.Put; +import org.apache.hadoop.hbase.client.RegionInfo; import org.apache.hadoop.hbase.client.RegionLocator; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.client.Table; @@ -79,7 +80,7 @@ public class TestRegionReplicas { private static Table table; private static final byte[] row = Bytes.toBytes("TestRegionReplicas"); - private static HRegionInfo hriPrimary; + private static RegionInfo hriPrimary; private static HRegionInfo hriSecondary; private static final HBaseTestingUtility HTU = new HBaseTestingUtility(); @@ -100,7 +101,7 @@ public static void before() throws Exception { table = HTU.createTable(tableName, f); try (RegionLocator locator = HTU.getConnection().getRegionLocator(tableName)) { - hriPrimary = locator.getRegionLocation(row, false).getRegionInfo(); + hriPrimary = locator.getRegionLocation(row, false).getRegion(); } // mock a secondary region info to open diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerMetrics.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerMetrics.java index 3778c205beb9..49505798c6c4 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerMetrics.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerMetrics.java @@ -30,7 +30,6 @@ import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.HConstants; -import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.HRegionLocation; import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.MiniHBaseCluster; @@ -45,6 +44,7 @@ import org.apache.hadoop.hbase.client.Get; import org.apache.hadoop.hbase.client.Increment; import org.apache.hadoop.hbase.client.Put; +import org.apache.hadoop.hbase.client.RegionInfo; import org.apache.hadoop.hbase.client.RegionLocator; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.client.ResultScanner; @@ -166,7 +166,7 @@ public void assertGauge(String metric, long expectedValue) { public void assertRegionMetrics(String metric, long expectedValue) throws Exception { try (RegionLocator locator = connection.getRegionLocator(tableName)) { for ( HRegionLocation location: locator.getAllRegionLocations()) { - HRegionInfo hri = location.getRegionInfo(); + RegionInfo hri = location.getRegion(); MetricsRegionAggregateSource agg = rs.getRegion(hri.getRegionName()).getMetrics().getSource().getAggregateSource(); String prefix = "namespace_" + NamespaceDescriptor.DEFAULT_NAMESPACE_NAME_STR + diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerNoMaster.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerNoMaster.java index b9f89b72dae6..6c70be82befe 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerNoMaster.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerNoMaster.java @@ -26,6 +26,7 @@ import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.Put; +import org.apache.hadoop.hbase.client.RegionInfo; import org.apache.hadoop.hbase.client.RegionLocator; import org.apache.hadoop.hbase.client.Table; import org.apache.hadoop.hbase.client.TableDescriptor; @@ -67,7 +68,7 @@ public class TestRegionServerNoMaster { private static Table table; private static final byte[] row = Bytes.toBytes("ee"); - private static HRegionInfo hri; + private static RegionInfo hri; private static byte[] regionName; private static final HBaseTestingUtility HTU = new HBaseTestingUtility(); @@ -85,7 +86,7 @@ public static void before() throws Exception { table.put(p); try (RegionLocator locator = HTU.getConnection().getRegionLocator(tableName)) { - hri = locator.getRegionLocation(row, false).getRegionInfo(); + hri = locator.getRegionLocation(row, false).getRegion(); } regionName = hri.getRegionName(); @@ -130,7 +131,8 @@ public static void stopMasterAndAssignMeta(HBaseTestingUtility HTU) } /** Flush the given region in the mini cluster. Since no master, we cannot use HBaseAdmin.flush() */ - public static void flushRegion(HBaseTestingUtility HTU, HRegionInfo regionInfo) throws IOException { + public static void flushRegion(HBaseTestingUtility HTU, RegionInfo regionInfo) + throws IOException { for (RegionServerThread rst : HTU.getMiniHBaseCluster().getRegionServerThreads()) { HRegion region = rst.getRegionServer().getRegionByEncodedName(regionInfo.getEncodedName()); if (region != null) { @@ -153,7 +155,7 @@ private static HRegionServer getRS() { } - public static void openRegion(HBaseTestingUtility HTU, HRegionServer rs, HRegionInfo hri) + public static void openRegion(HBaseTestingUtility HTU, HRegionServer rs, RegionInfo hri) throws Exception { AdminProtos.OpenRegionRequest orr = RequestConverter.buildOpenRegionRequest(rs.getServerName(), hri, null); @@ -168,7 +170,7 @@ public static void openRegion(HBaseTestingUtility HTU, HRegionServer rs, HRegion } public static void checkRegionIsOpened(HBaseTestingUtility HTU, HRegionServer rs, - HRegionInfo hri) throws Exception { + RegionInfo hri) throws Exception { while (!rs.getRegionsInTransitionInRS().isEmpty()) { Thread.sleep(1); } @@ -186,7 +188,7 @@ public static void closeRegion(HBaseTestingUtility HTU, HRegionServer rs, HRegio } public static void checkRegionIsClosed(HBaseTestingUtility HTU, HRegionServer rs, - HRegionInfo hri) throws Exception { + RegionInfo hri) throws Exception { while (!rs.getRegionsInTransitionInRS().isEmpty()) { Thread.sleep(1); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerOnlineConfigChange.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerOnlineConfigChange.java index 7eedafc03c8c..157b29f62ed8 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerOnlineConfigChange.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerOnlineConfigChange.java @@ -26,8 +26,8 @@ import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HConstants; -import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.TableName; +import org.apache.hadoop.hbase.client.RegionInfo; import org.apache.hadoop.hbase.client.RegionLocator; import org.apache.hadoop.hbase.client.Table; import org.apache.hadoop.hbase.regionserver.compactions.CompactionConfiguration; @@ -76,7 +76,7 @@ public static void setUp() throws Exception { hbaseTestingUtility.startMiniCluster(); t1 = hbaseTestingUtility.createTable(TABLE1, COLUMN_FAMILY1); try (RegionLocator locator = hbaseTestingUtility.getConnection().getRegionLocator(TABLE1)) { - HRegionInfo firstHRI = locator.getAllRegionLocations().get(0).getRegionInfo(); + RegionInfo firstHRI = locator.getAllRegionLocations().get(0).getRegion(); r1name = firstHRI.getRegionName(); rs1 = hbaseTestingUtility.getHBaseCluster().getRegionServer( hbaseTestingUtility.getHBaseCluster().getServerWith(r1name)); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRemoveRegionMetrics.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRemoveRegionMetrics.java index 45469116579f..acc3f9dd1eee 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRemoveRegionMetrics.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRemoveRegionMetrics.java @@ -23,12 +23,12 @@ import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HConstants; -import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.MiniHBaseCluster; import org.apache.hadoop.hbase.NamespaceDescriptor; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.Put; +import org.apache.hadoop.hbase.client.RegionInfo; import org.apache.hadoop.hbase.client.RegionLocator; import org.apache.hadoop.hbase.client.Table; import org.apache.hadoop.hbase.test.MetricsAssertHelper; @@ -86,14 +86,14 @@ public void testMoveRegion() throws IOException, InterruptedException { Table t = TEST_UTIL.createTable(tableName, Bytes.toBytes("D")); TEST_UTIL.waitUntilAllRegionsAssigned(t.getName()); Admin admin = TEST_UTIL.getAdmin(); - HRegionInfo regionInfo; + RegionInfo regionInfo; byte[] row = Bytes.toBytes("r1"); for (int i = 0; i < 30; i++) { boolean moved = false; try (RegionLocator locator = TEST_UTIL.getConnection().getRegionLocator(tableName)) { - regionInfo = locator.getRegionLocation(row, true).getRegionInfo(); + regionInfo = locator.getRegionLocation(row, true).getRegion(); } int currentServerIdx = cluster.getServerWith(regionInfo.getRegionName()); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestRegionReplicaReplicationEndpoint.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestRegionReplicaReplicationEndpoint.java index 55da3f4e9128..669e3d2a1242 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestRegionReplicaReplicationEndpoint.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestRegionReplicaReplicationEndpoint.java @@ -428,7 +428,7 @@ public void testRegionReplicaReplicationIgnores(boolean dropTable, boolean disab fstd); RegionLocator rl = connection.getRegionLocator(toBeDisabledTable); HRegionLocation hrl = rl.getRegionLocation(HConstants.EMPTY_BYTE_ARRAY); - byte[] encodedRegionName = hrl.getRegionInfo().getEncodedNameAsBytes(); + byte[] encodedRegionName = hrl.getRegion().getEncodedNameAsBytes(); Cell cell = CellBuilderFactory.create(CellBuilderType.DEEP_COPY).setRow(Bytes.toBytes("A")) .setFamily(HTU.fam1).setValue(Bytes.toBytes("VAL")).setType(Type.Put).build(); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestRegionReplicaReplicationEndpointNoMaster.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestRegionReplicaReplicationEndpointNoMaster.java index e91a8bd5d27b..fa84477d583c 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestRegionReplicaReplicationEndpointNoMaster.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestRegionReplicaReplicationEndpointNoMaster.java @@ -95,7 +95,7 @@ public class TestRegionReplicaReplicationEndpointNoMaster { private static HRegionServer rs0; private static HRegionServer rs1; - private static HRegionInfo hriPrimary; + private static RegionInfo hriPrimary; private static HRegionInfo hriSecondary; private static final HBaseTestingUtility HTU = new HBaseTestingUtility(); @@ -123,7 +123,7 @@ public static void beforeClass() throws Exception { table = HTU.createTable(htd, new byte[][]{f}, null); try (RegionLocator locator = HTU.getConnection().getRegionLocator(tableName)) { - hriPrimary = locator.getRegionLocation(row, false).getRegionInfo(); + hriPrimary = locator.getRegionLocation(row, false).getRegion(); } // mock a secondary region info to open @@ -205,7 +205,7 @@ private void replicateUsingCallable(ClusterConnection connection, Queue e RegionReplicaReplayCallable callable = new RegionReplicaReplayCallable(connection, RpcControllerFactory.instantiate(connection.getConfiguration()), table.getName(), locations.getRegionLocation(1), - locations.getRegionLocation(1).getRegionInfo(), row, Lists.newArrayList(entry), + locations.getRegionLocation(1).getRegion(), row, Lists.newArrayList(entry), new AtomicLong()); RpcRetryingCallerFactory factory = RpcRetryingCallerFactory.instantiate( diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSink.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSink.java index 2d6c28fd760a..b8a1d8d72bfc 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSink.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSink.java @@ -40,7 +40,6 @@ import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HConstants; -import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.Stoppable; import org.apache.hadoop.hbase.TableName; @@ -49,6 +48,7 @@ import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.client.ConnectionFactory; import org.apache.hadoop.hbase.client.Get; +import org.apache.hadoop.hbase.client.RegionInfo; import org.apache.hadoop.hbase.client.RegionLocator; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.client.ResultScanner; @@ -349,7 +349,7 @@ public void testReplicateEntriesForHFiles() throws Exception { try (Connection c = ConnectionFactory.createConnection(conf); RegionLocator l = c.getRegionLocator(TABLE_NAME1)) { - HRegionInfo regionInfo = l.getAllRegionLocations().get(0).getRegionInfo(); + RegionInfo regionInfo = l.getAllRegionLocations().get(0).getRegion(); loadDescriptor = ProtobufUtil.toBulkLoadDescriptor(TABLE_NAME1, UnsafeByteOperations.unsafeWrap(regionInfo.getEncodedNameAsBytes()), diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java index 523b82f595fd..fddbce4753de 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java @@ -68,6 +68,7 @@ import org.apache.hadoop.hbase.client.Increment; import org.apache.hadoop.hbase.client.MasterSwitchType; import org.apache.hadoop.hbase.client.Put; +import org.apache.hadoop.hbase.client.RegionInfo; import org.apache.hadoop.hbase.client.RegionLocator; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.client.ResultScanner; @@ -623,7 +624,7 @@ public void testMove() throws Exception { regions = locator.getAllRegionLocations(); } HRegionLocation location = regions.get(0); - final HRegionInfo hri = location.getRegionInfo(); + final RegionInfo hri = location.getRegion(); final ServerName server = location.getServerName(); AccessTestAction action = new AccessTestAction() { @Override @@ -646,7 +647,7 @@ public void testAssign() throws Exception { regions = locator.getAllRegionLocations(); } HRegionLocation location = regions.get(0); - final HRegionInfo hri = location.getRegionInfo(); + final RegionInfo hri = location.getRegion(); AccessTestAction action = new AccessTestAction() { @Override public Object run() throws Exception { @@ -667,7 +668,7 @@ public void testUnassign() throws Exception { regions = locator.getAllRegionLocations(); } HRegionLocation location = regions.get(0); - final HRegionInfo hri = location.getRegionInfo(); + final RegionInfo hri = location.getRegion(); AccessTestAction action = new AccessTestAction() { @Override public Object run() throws Exception { @@ -688,7 +689,7 @@ public void testRegionOffline() throws Exception { regions = locator.getAllRegionLocations(); } HRegionLocation location = regions.get(0); - final HRegionInfo hri = location.getRegionInfo(); + final RegionInfo hri = location.getRegion(); AccessTestAction action = new AccessTestAction() { @Override public Object run() throws Exception { @@ -2131,7 +2132,7 @@ public void testGlobalAuthorizationForNewRegisteredRS() throws Exception { regions = locator.getAllRegionLocations(); } HRegionLocation location = regions.get(0); - final HRegionInfo hri = location.getRegionInfo(); + final RegionInfo hri = location.getRegion(); final ServerName server = location.getServerName(); try (Table table = systemUserConnection.getTable(TEST_TABLE2)) { AccessTestAction moveAction = new AccessTestAction() { diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/BaseTestHBaseFsck.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/BaseTestHBaseFsck.java index 40ce1c553ca8..7445a16e0a62 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/BaseTestHBaseFsck.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/BaseTestHBaseFsck.java @@ -170,7 +170,7 @@ protected void deleteRegion(Configuration conf, final HTableDescriptor htd, } for (HRegionLocation location : locations) { - RegionInfo hri = location.getRegionInfo(); + RegionInfo hri = location.getRegion(); ServerName hsa = location.getServerName(); if (Bytes.compareTo(hri.getStartKey(), startKey) == 0 && Bytes.compareTo(hri.getEndKey(), endKey) == 0 @@ -546,7 +546,7 @@ protected void deleteMetaRegion(Configuration conf, boolean unassign, boolean hd HRegionLocation metaLocation = connection.getRegionLocator(TableName.META_TABLE_NAME) .getRegionLocation(HConstants.EMPTY_START_ROW); ServerName hsa = metaLocation.getServerName(); - RegionInfo hri = metaLocation.getRegionInfo(); + RegionInfo hri = metaLocation.getRegion(); if (unassign) { LOG.info("Undeploying meta region " + hri + " from server " + hsa); try (Connection unmanagedConnection = ConnectionFactory.createConnection(conf)) { diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestRegionSplitter.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestRegionSplitter.java index 8fdcc5381cc2..a9c591972664 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestRegionSplitter.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestRegionSplitter.java @@ -29,9 +29,9 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; -import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.HRegionLocation; import org.apache.hadoop.hbase.TableName; +import org.apache.hadoop.hbase.client.RegionInfo; import org.apache.hadoop.hbase.client.RegionLocator; import org.apache.hadoop.hbase.client.Table; import org.apache.hadoop.hbase.testclassification.MediumTests; @@ -408,7 +408,7 @@ private void verifyBounds(List expectedBounds, TableName tableName) final List regionInfoMap = locator.getAllRegionLocations(); assertEquals(numRegions, regionInfoMap.size()); for (HRegionLocation entry : regionInfoMap) { - final HRegionInfo regionInfo = entry.getRegionInfo(); + final RegionInfo regionInfo = entry.getRegion(); byte[] regionStart = regionInfo.getStartKey(); byte[] regionEnd = regionInfo.getEndKey(); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/OfflineMetaRebuildTestCore.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/OfflineMetaRebuildTestCore.java index 1329f44734f8..8f498d38eb45 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/OfflineMetaRebuildTestCore.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/OfflineMetaRebuildTestCore.java @@ -171,7 +171,7 @@ protected void deleteRegion(Configuration conf, final Table tbl, } for (HRegionLocation e : regions) { - RegionInfo hri = e.getRegionInfo(); + RegionInfo hri = e.getRegion(); ServerName hsa = e.getServerName(); if (Bytes.compareTo(hri.getStartKey(), startKey) == 0 && Bytes.compareTo(hri.getEndKey(), endKey) == 0) { diff --git a/hbase-shell/src/main/ruby/hbase/admin.rb b/hbase-shell/src/main/ruby/hbase/admin.rb index acfe1780f586..2cf625409e7e 100644 --- a/hbase-shell/src/main/ruby/hbase/admin.rb +++ b/hbase-shell/src/main/ruby/hbase/admin.rb @@ -563,7 +563,7 @@ def truncate_preserve(table_name_str, conf = @conf) locator = @connection.getRegionLocator(table_name) begin splits = locator.getAllRegionLocations - .map { |i| Bytes.toStringBinary(i.getRegionInfo.getStartKey) } + .map { |i| Bytes.toStringBinary(i.getRegion.getStartKey) } .delete_if { |k| k == '' }.to_java :String splits = org.apache.hadoop.hbase.util.Bytes.toBinaryByteArrays(splits) ensure diff --git a/hbase-shell/src/main/ruby/hbase/table.rb b/hbase-shell/src/main/ruby/hbase/table.rb index 8c7144d2d46b..764363028bb3 100644 --- a/hbase-shell/src/main/ruby/hbase/table.rb +++ b/hbase-shell/src/main/ruby/hbase/table.rb @@ -816,7 +816,7 @@ def _get_splits_internal locator = @table.getRegionLocator locator.getAllRegionLocations .select { |s| RegionReplicaUtil.isDefaultReplica(s.getRegion) } - .map { |i| Bytes.toStringBinary(i.getRegionInfo.getStartKey) } + .map { |i| Bytes.toStringBinary(i.getRegion.getStartKey) } .delete_if { |k| k == '' } ensure locator.close diff --git a/hbase-shell/src/main/ruby/shell/commands/locate_region.rb b/hbase-shell/src/main/ruby/shell/commands/locate_region.rb index 9afbbec4cd8a..ab5e7ead5a22 100644 --- a/hbase-shell/src/main/ruby/shell/commands/locate_region.rb +++ b/hbase-shell/src/main/ruby/shell/commands/locate_region.rb @@ -31,7 +31,7 @@ def help def command(table, row_key) region_location = admin.locate_region(table, row_key) - hri = region_location.getRegionInfo + hri = region_location.getRegion formatter.header(%w[HOST REGION]) formatter.row([region_location.getHostnamePort, hri.toString]) diff --git a/hbase-shell/src/test/ruby/hbase/admin_test.rb b/hbase-shell/src/test/ruby/hbase/admin_test.rb index 65d2eef00348..6cb8fdf6a272 100644 --- a/hbase-shell/src/test/ruby/hbase/admin_test.rb +++ b/hbase-shell/src/test/ruby/hbase/admin_test.rb @@ -497,13 +497,13 @@ def teardown define_test "unassign should allow encoded region names" do region = command(:locate_region, @test_name, '') - regionName = region.getRegionInfo().getRegionNameAsString() + regionName = region.getRegion.getRegionNameAsString command(:unassign, regionName, true) end define_test "unassign should allow non-encoded region names" do region = command(:locate_region, @test_name, '') - encodedRegionName = region.getRegionInfo().getEncodedName() + encodedRegionName = region.getRegion.getEncodedName command(:unassign, encodedRegionName, true) end end diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftHBaseServiceHandler.java b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftHBaseServiceHandler.java index d4ac01643ee7..5b6132d339e5 100644 --- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftHBaseServiceHandler.java +++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftHBaseServiceHandler.java @@ -250,7 +250,7 @@ public List getTableRegions(ByteBuffer tableName) throws IOError { List regionLocations = locator.getAllRegionLocations(); List results = new ArrayList<>(regionLocations.size()); for (HRegionLocation regionLocation : regionLocations) { - RegionInfo info = regionLocation.getRegionInfo(); + RegionInfo info = regionLocation.getRegion(); ServerName serverName = regionLocation.getServerName(); TRegionInfo region = new TRegionInfo(); region.serverName = ByteBuffer.wrap( diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftUtilities.java b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftUtilities.java index 7d1fd8441d44..d18a74b1353a 100644 --- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftUtilities.java +++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftUtilities.java @@ -35,7 +35,6 @@ import org.apache.hadoop.hbase.ExtendedCellBuilder; import org.apache.hadoop.hbase.ExtendedCellBuilderFactory; import org.apache.hadoop.hbase.HConstants; -import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.HRegionLocation; import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.KeepDeletedCells; @@ -54,6 +53,7 @@ import org.apache.hadoop.hbase.client.Mutation; import org.apache.hadoop.hbase.client.OperationWithAttributes; 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; @@ -725,7 +725,7 @@ public static Append appendFromThrift(TAppend append) throws IOException { } public static THRegionLocation regionLocationFromHBase(HRegionLocation hrl) { - HRegionInfo hri = hrl.getRegionInfo(); + RegionInfo hri = hrl.getRegion(); ServerName serverName = hrl.getServerName(); THRegionInfo thRegionInfo = new THRegionInfo();