Skip to content

Commit 436d6e2

Browse files
committed
HBASE-22275 Removed deprecated getRegionInfo in HRegionLocation
1 parent 6e95977 commit 436d6e2

File tree

74 files changed

+299
-309
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+299
-309
lines changed

hbase-client/src/main/java/org/apache/hadoop/hbase/HRegionLocation.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
*/
1919
package org.apache.hadoop.hbase;
2020

21-
import org.apache.hadoop.hbase.client.ImmutableHRegionInfo;
2221
import org.apache.hadoop.hbase.client.RegionInfo;
2322
import org.apache.hadoop.hbase.util.Addressing;
2423
import org.apache.yetus.audience.InterfaceAudience;
@@ -86,16 +85,6 @@ public int hashCode() {
8685
return this.serverName.hashCode();
8786
}
8887

89-
/**
90-
*
91-
* @return Immutable HRegionInfo
92-
* @deprecated Since 2.0.0. Will remove in 3.0.0. Use {@link #getRegion()}} instead.
93-
*/
94-
@Deprecated
95-
public HRegionInfo getRegionInfo(){
96-
return regionInfo == null ? null : new ImmutableHRegionInfo(regionInfo);
97-
}
98-
9988
/**
10089
* @return regionInfo
10190
*/

hbase-client/src/main/java/org/apache/hadoop/hbase/MetaTableAccessor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public boolean visitInternal(Result result) throws IOException {
169169
if (locations == null) return true;
170170
for (HRegionLocation loc : locations.getRegionLocations()) {
171171
if (loc != null) {
172-
RegionInfo regionInfo = loc.getRegionInfo();
172+
RegionInfo regionInfo = loc.getRegion();
173173
regions.put(regionInfo, loc.getServerName());
174174
}
175175
}
@@ -295,7 +295,7 @@ public static Pair<RegionInfo, ServerName> getRegion(Connection connection, byte
295295
HRegionLocation location = getRegionLocation(connection, regionName);
296296
return location == null
297297
? null
298-
: new Pair<>(location.getRegionInfo(), location.getServerName());
298+
: new Pair<>(location.getRegion(), location.getServerName());
299299
}
300300

301301
/**

hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncProcess.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ private <CResult> AsyncRequestFuture submit(AsyncProcessTask<CResult> task,
307307
setNonce(ng, r, action);
308308
retainedActions.add(action);
309309
// TODO: replica-get is not supported on this path
310-
byte[] regionName = loc.getRegionInfo().getRegionName();
310+
byte[] regionName = loc.getRegion().getRegionName();
311311
addAction(loc.getServerName(), regionName, action, actionsByServer, nonceGroup);
312312
it.remove();
313313
}

hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRequestFutureImpl.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ private void addReplicaActions(int index, Map<ServerName, MultiAction> actionsBy
154154
for (int i = 1; i < locs.length; ++i) {
155155
Action replicaAction = new Action(action, i);
156156
if (locs[i] != null) {
157-
asyncProcess.addAction(locs[i].getServerName(), locs[i].getRegionInfo().getRegionName(),
157+
asyncProcess.addAction(locs[i].getServerName(), locs[i].getRegion().getRegionName(),
158158
replicaAction, actionsByServer, nonceGroup);
159159
} else {
160160
unknownReplicaActions.add(replicaAction);
@@ -169,7 +169,7 @@ private void addReplicaActionsAgain(
169169
}
170170
HRegionLocation loc = getReplicaLocationOrFail(action);
171171
if (loc == null) return;
172-
asyncProcess.addAction(loc.getServerName(), loc.getRegionInfo().getRegionName(),
172+
asyncProcess.addAction(loc.getServerName(), loc.getRegion().getRegionName(),
173173
action, actionsByServer, nonceGroup);
174174
}
175175
}
@@ -437,7 +437,7 @@ void groupAndSendMultiAction(List<Action> currentActions, int numAttempt) {
437437
manageLocationError(action, null);
438438
}
439439
} else {
440-
byte[] regionName = loc.getRegionInfo().getRegionName();
440+
byte[] regionName = loc.getRegion().getRegionName();
441441
AsyncProcess.addAction(loc.getServerName(), regionName, action, actionsByServer, nonceGroup);
442442
}
443443
}
@@ -455,7 +455,7 @@ void groupAndSendMultiAction(List<Action> currentActions, int numAttempt) {
455455
for (Action action : unknownReplicaActions) {
456456
HRegionLocation loc = getReplicaLocationOrFail(action);
457457
if (loc == null) continue;
458-
byte[] regionName = loc.getRegionInfo().getRegionName();
458+
byte[] regionName = loc.getRegion().getRegionName();
459459
AsyncProcess.addAction(loc.getServerName(), regionName, action, actionsByServer, nonceGroup);
460460
}
461461
if (!actionsByServer.isEmpty()) {

hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientScanner.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import org.apache.hadoop.conf.Configuration;
3131
import org.apache.hadoop.hbase.DoNotRetryIOException;
3232
import org.apache.hadoop.hbase.HConstants;
33-
import org.apache.hadoop.hbase.HRegionInfo;
3433
import org.apache.hadoop.hbase.NotServingRegionException;
3534
import org.apache.hadoop.hbase.TableName;
3635
import org.apache.hadoop.hbase.UnknownScannerException;
@@ -59,7 +58,7 @@ public abstract class ClientScanner extends AbstractClientScanner {
5958
protected boolean closed = false;
6059
// Current region scanner is against. Gets cleared if current region goes
6160
// wonky: e.g. if it splits on us.
62-
protected HRegionInfo currentRegion = null;
61+
protected RegionInfo currentRegion = null;
6362
protected ScannerCallableWithReplicas callable = null;
6463
protected Queue<Result> cache;
6564
private final ScanResultCache scanResultCache;
@@ -261,7 +260,7 @@ private Result[] call(ScannerCallableWithReplicas callable, RpcRetryingCaller<Re
261260
// we do a callWithRetries
262261
Result[] rrs = caller.callWithoutRetries(callable, scannerTimeout);
263262
if (currentRegion == null && updateCurrentRegion) {
264-
currentRegion = callable.getHRegionInfo();
263+
currentRegion = callable.getRegionInfo();
265264
}
266265
return rrs;
267266
}
@@ -410,7 +409,7 @@ protected void loadCache() throws IOException {
410409
// Any accumulated partial results are no longer valid since the callable will
411410
// openScanner with the correct startkey and we must pick up from there
412411
scanResultCache.clear();
413-
this.currentRegion = callable.getHRegionInfo();
412+
this.currentRegion = callable.getRegionInfo();
414413
}
415414
retryAfterOutOfOrderException.setValue(true);
416415
} catch (DoNotRetryIOException e) {

hbase-client/src/main/java/org/apache/hadoop/hbase/client/FlushRegionCallable.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,12 @@ public void prepare(boolean reload) throws IOException {
6767
protected FlushRegionResponse call(HBaseRpcController controller) throws Exception {
6868
// Check whether we should still do the flush to this region. If the regions are changed due
6969
// to splits or merges, etc return success
70-
if (!Bytes.equals(location.getRegionInfo().getRegionName(), regionName)) {
70+
if (!Bytes.equals(location.getRegion().getRegionName(), regionName)) {
7171
if (!reload) {
7272
throw new IOException("Cached location seems to be different than requested region.");
7373
}
7474
LOG.info("Skipping flush region, because the located region "
75-
+ Bytes.toStringBinary(location.getRegionInfo().getRegionName()) + " is different than "
75+
+ Bytes.toStringBinary(location.getRegion().getRegionName()) + " is different than "
7676
+ " requested region " + Bytes.toStringBinary(regionName));
7777
return FlushRegionResponse.newBuilder()
7878
.setLastFlushTime(EnvironmentEdgeManager.currentTime())

hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ private Pair<List<byte[]>, List<HRegionLocation>> getKeysAndRegionsInRange(
273273
HRegionLocation regionLocation = getRegionLocator().getRegionLocation(currentKey, reload);
274274
keysInRange.add(currentKey);
275275
regionsInRange.add(regionLocation);
276-
currentKey = regionLocation.getRegionInfo().getEndKey();
276+
currentKey = regionLocation.getRegion().getEndKey();
277277
} while (!Bytes.equals(currentKey, HConstants.EMPTY_END_ROW)
278278
&& (endKeyIsEndOfTable || Bytes.compareTo(currentKey, endKey) < 0
279279
|| (includeEndKey && Bytes.compareTo(currentKey, endKey) == 0)));
@@ -363,7 +363,7 @@ private Result get(Get get, final boolean checkExistenceOnly) throws IOException
363363
@Override
364364
protected Result rpcCall() throws Exception {
365365
ClientProtos.GetRequest request = RequestConverter.buildGetRequest(
366-
getLocation().getRegionInfo().getRegionName(), configuredGet);
366+
getLocation().getRegion().getRegionName(), configuredGet);
367367
ClientProtos.GetResponse response = doGet(request);
368368
return response == null? null:
369369
ProtobufUtil.toResult(response.getResult(), getRpcControllerCellScanner());
@@ -480,7 +480,7 @@ public void delete(final Delete delete) throws IOException {
480480
@Override
481481
protected Void rpcCall() throws Exception {
482482
MutateRequest request = RequestConverter
483-
.buildMutateRequest(getLocation().getRegionInfo().getRegionName(), delete);
483+
.buildMutateRequest(getLocation().getRegion().getRegionName(), delete);
484484
doMutate(request);
485485
return null;
486486
}
@@ -520,7 +520,7 @@ public void put(final Put put) throws IOException {
520520
@Override
521521
protected Void rpcCall() throws Exception {
522522
MutateRequest request =
523-
RequestConverter.buildMutateRequest(getLocation().getRegionInfo().getRegionName(), put);
523+
RequestConverter.buildMutateRequest(getLocation().getRegion().getRegionName(), put);
524524
doMutate(request);
525525
return null;
526526
}
@@ -551,7 +551,7 @@ public void mutateRow(final RowMutations rm) throws IOException {
551551
@Override
552552
protected MultiResponse rpcCall() throws Exception {
553553
RegionAction.Builder regionMutationBuilder = RequestConverter.buildRegionAction(
554-
getLocation().getRegionInfo().getRegionName(), rm);
554+
getLocation().getRegion().getRegionName(), rm);
555555
regionMutationBuilder.setAtomic(true);
556556
MultiRequest request =
557557
MultiRequest.newBuilder().addRegionAction(regionMutationBuilder.build()).build();
@@ -592,7 +592,7 @@ public Result append(final Append append) throws IOException {
592592
@Override
593593
protected Result rpcCall() throws Exception {
594594
MutateRequest request = RequestConverter.buildMutateRequest(
595-
getLocation().getRegionInfo().getRegionName(), append, getNonceGroup(), getNonce());
595+
getLocation().getRegion().getRegionName(), append, getNonceGroup(), getNonce());
596596
MutateResponse response = doMutate(request);
597597
if (!response.hasResult()) return null;
598598
return ProtobufUtil.toResult(response.getResult(), getRpcControllerCellScanner());
@@ -611,7 +611,7 @@ public Result increment(final Increment increment) throws IOException {
611611
@Override
612612
protected Result rpcCall() throws Exception {
613613
MutateRequest request = RequestConverter.buildMutateRequest(
614-
getLocation().getRegionInfo().getRegionName(), increment, getNonceGroup(), getNonce());
614+
getLocation().getRegion().getRegionName(), increment, getNonceGroup(), getNonce());
615615
MutateResponse response = doMutate(request);
616616
// Should this check for null like append does?
617617
return ProtobufUtil.toResult(response.getResult(), getRpcControllerCellScanner());
@@ -649,7 +649,7 @@ public long incrementColumnValue(final byte [] row, final byte [] family,
649649
@Override
650650
protected Long rpcCall() throws Exception {
651651
MutateRequest request = RequestConverter.buildIncrementRequest(
652-
getLocation().getRegionInfo().getRegionName(), row, family,
652+
getLocation().getRegion().getRegionName(), row, family,
653653
qualifier, amount, durability, getNonceGroup(), getNonce());
654654
MutateResponse response = doMutate(request);
655655
Result result = ProtobufUtil.toResult(response.getResult(), getRpcControllerCellScanner());
@@ -693,7 +693,7 @@ private boolean doCheckAndPut(final byte[] row, final byte[] family, final byte[
693693
protected Boolean rpcCall() throws Exception {
694694
CompareType compareType = CompareType.valueOf(opName);
695695
MutateRequest request = RequestConverter.buildMutateRequest(
696-
getLocation().getRegionInfo().getRegionName(), row, family, qualifier,
696+
getLocation().getRegion().getRegionName(), row, family, qualifier,
697697
new BinaryComparator(value), compareType, timeRange, put);
698698
MutateResponse response = doMutate(request);
699699
return Boolean.valueOf(response.getProcessed());
@@ -736,7 +736,7 @@ private boolean doCheckAndDelete(final byte[] row, final byte[] family, final by
736736
protected SingleResponse rpcCall() throws Exception {
737737
CompareType compareType = CompareType.valueOf(opName);
738738
MutateRequest request = RequestConverter
739-
.buildMutateRequest(getLocation().getRegionInfo().getRegionName(), row, family,
739+
.buildMutateRequest(getLocation().getRegion().getRegionName(), row, family,
740740
qualifier, new BinaryComparator(value), compareType, timeRange, delete);
741741
MutateResponse response = doMutate(request);
742742
return ResponseConverter.getResult(request, response, getRpcControllerCellScanner());
@@ -775,7 +775,7 @@ private boolean doCheckAndMutate(final byte[] row, final byte[] family, final by
775775
protected MultiResponse rpcCall() throws Exception {
776776
CompareType compareType = CompareType.valueOf(opName);
777777
MultiRequest request = RequestConverter
778-
.buildMutateRequest(getLocation().getRegionInfo().getRegionName(), row, family, qualifier,
778+
.buildMutateRequest(getLocation().getRegion().getRegionName(), row, family, qualifier,
779779
new BinaryComparator(value), compareType, timeRange, rm);
780780
ClientProtos.MultiResponse response = doMulti(request);
781781
ClientProtos.RegionActionResult res = response.getRegionActionResultList().get(0);
@@ -1120,7 +1120,7 @@ public <R extends Message> void batchCoprocessorService(
11201120
final Map<byte[], RegionCoprocessorServiceExec> execsByRow = new TreeMap<>(Bytes.BYTES_COMPARATOR);
11211121
for (int i = 0; i < keys.size(); i++) {
11221122
final byte[] rowKey = keys.get(i);
1123-
final byte[] region = regions.get(i).getRegionInfo().getRegionName();
1123+
final byte[] region = regions.get(i).getRegion().getRegionName();
11241124
RegionCoprocessorServiceExec exec =
11251125
new RegionCoprocessorServiceExec(region, rowKey, methodDescriptor, request);
11261126
execs.add(exec);

hbase-client/src/main/java/org/apache/hadoop/hbase/client/MultiServerCallable.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import org.apache.hadoop.hbase.CellScannable;
2727
import org.apache.hadoop.hbase.CellUtil;
2828
import org.apache.hadoop.hbase.DoNotRetryIOException;
29-
import org.apache.hadoop.hbase.HRegionInfo;
3029
import org.apache.hadoop.hbase.HRegionLocation;
3130
import org.apache.hadoop.hbase.ServerName;
3231
import org.apache.hadoop.hbase.TableName;
@@ -76,7 +75,7 @@ protected HRegionLocation getLocation() {
7675
}
7776

7877
@Override
79-
public HRegionInfo getHRegionInfo() {
78+
public RegionInfo getRegionInfo() {
8079
throw new RuntimeException("Cannot get region info for multi-region request");
8180
}
8281

hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionAdminServiceCallable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public HRegionLocation getLocation(boolean useCache) throws IOException {
110110
@Override
111111
public void throwable(Throwable t, boolean retrying) {
112112
if (location != null) {
113-
connection.updateCachedLocations(tableName, location.getRegionInfo().getRegionName(), row,
113+
connection.updateCachedLocations(tableName, location.getRegion().getRegionName(), row,
114114
t, location.getServerName());
115115
}
116116
}

hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionCoprocessorRpcChannel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ protected Message callExecService(final RpcController controller,
8181
this.table, this.row, this.conn.getRpcControllerFactory().newController(), HConstants.PRIORITY_UNSET) {
8282
@Override
8383
protected CoprocessorServiceResponse rpcCall() throws Exception {
84-
byte [] regionName = getLocation().getRegionInfo().getRegionName();
84+
byte [] regionName = getLocation().getRegion().getRegionName();
8585
CoprocessorServiceRequest csr =
8686
CoprocessorRpcUtils.getCoprocessorServiceRequest(method, request, row, regionName);
8787
return getStub().execService(getRpcController(), csr);

hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionCoprocessorRpcChannelImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,14 @@ private CompletableFuture<Message> rpcCall(MethodDescriptor method, Message requ
7272
ClientService.Interface stub) {
7373
CompletableFuture<Message> future = new CompletableFuture<>();
7474
if (region != null
75-
&& !Bytes.equals(loc.getRegionInfo().getRegionName(), region.getRegionName())) {
75+
&& !Bytes.equals(loc.getRegion().getRegionName(), region.getRegionName())) {
7676
future.completeExceptionally(new DoNotRetryIOException(
7777
"Region name is changed, expected " + region.getRegionNameAsString() + ", actual "
78-
+ loc.getRegionInfo().getRegionNameAsString()));
78+
+ loc.getRegion().getRegionNameAsString()));
7979
return future;
8080
}
8181
CoprocessorServiceRequest csr = CoprocessorRpcUtils.getCoprocessorServiceRequest(method,
82-
request, row, loc.getRegionInfo().getRegionName());
82+
request, row, loc.getRegion().getRegionName());
8383
stub.execService(controller, csr,
8484
new org.apache.hbase.thirdparty.com.google.protobuf.RpcCallback<CoprocessorServiceResponse>() {
8585

hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionServerCallable.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
import org.apache.hadoop.hbase.CellScanner;
2424
import org.apache.hadoop.hbase.HConstants;
25-
import org.apache.hadoop.hbase.HRegionInfo;
2625
import org.apache.hadoop.hbase.HRegionLocation;
2726
import org.apache.hadoop.hbase.ServerName;
2827
import org.apache.hadoop.hbase.TableName;
@@ -187,7 +186,7 @@ public TableName getTableName() {
187186
@Override
188187
public void throwable(Throwable t, boolean retrying) {
189188
if (location != null) {
190-
getConnection().updateCachedLocations(tableName, location.getRegionInfo().getRegionName(),
189+
getConnection().updateCachedLocations(tableName, location.getRegion().getRegionName(),
191190
row, t, location.getServerName());
192191
}
193192
}
@@ -203,13 +202,13 @@ public long sleep(long pause, int tries) {
203202
}
204203

205204
/**
206-
* @return the HRegionInfo for the current region
205+
* @return the RegionInfo for the current region
207206
*/
208-
public HRegionInfo getHRegionInfo() {
207+
public RegionInfo getRegionInfo() {
209208
if (this.location == null) {
210209
return null;
211210
}
212-
return this.location.getRegionInfo();
211+
return this.location.getRegion();
213212
}
214213

215214
@Override

hbase-client/src/main/java/org/apache/hadoop/hbase/client/ResultStatsUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public static <T> T updateStats(T r, ServerStatisticTracker stats,
7171
ServerName server = null;
7272
if (regionLocation != null) {
7373
server = regionLocation.getServerName();
74-
regionName = regionLocation.getRegionInfo().getRegionName();
74+
regionName = regionLocation.getRegion().getRegionName();
7575
}
7676

7777
return updateStats(r, stats, server, regionName);

hbase-client/src/main/java/org/apache/hadoop/hbase/client/ReversedScannerCallable.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,14 @@ private List<HRegionLocation> locateRegionsInRange(byte[] startKey,
143143
RegionLocations rl = RpcRetryingCallerWithReadReplicas.getRegionLocations(!reload, id,
144144
getConnection(), getTableName(), currentKey);
145145
HRegionLocation regionLocation = id < rl.size() ? rl.getRegionLocation(id) : null;
146-
if (regionLocation != null && regionLocation.getRegionInfo().containsRow(currentKey)) {
146+
if (regionLocation != null && regionLocation.getRegion().containsRow(currentKey)) {
147147
regionList.add(regionLocation);
148148
} else {
149149
throw new DoNotRetryIOException("Does hbase:meta exist hole? Locating row "
150150
+ Bytes.toStringBinary(currentKey) + " returns incorrect region "
151-
+ (regionLocation == null ? null : regionLocation.getRegionInfo()));
151+
+ (regionLocation == null ? null : regionLocation.getRegion()));
152152
}
153-
currentKey = regionLocation.getRegionInfo().getEndKey();
153+
currentKey = regionLocation.getRegion().getEndKey();
154154
} while (!Bytes.equals(currentKey, HConstants.EMPTY_END_ROW)
155155
&& (endKeyIsEndOfTable || Bytes.compareTo(currentKey, endKey) < 0));
156156
return regionList;

hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerWithReadReplicas.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ protected Result rpcCall() throws Exception {
136136
if (Thread.interrupted()) {
137137
throw new InterruptedIOException();
138138
}
139-
byte[] reg = location.getRegionInfo().getRegionName();
139+
byte[] reg = location.getRegion().getRegionName();
140140
ClientProtos.GetRequest request = RequestConverter.buildGetRequest(reg, get);
141141
HBaseRpcController hrc = (HBaseRpcController)getRpcController();
142142
hrc.reset();

0 commit comments

Comments
 (0)