huaxiangsun commented on a change in pull request #2640:
URL: https://github.com/apache/hbase/pull/2640#discussion_r520936401
##########
File path:
hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java
##########
@@ -841,8 +898,23 @@ private RegionLocations locateRegionInMeta(TableName
tableName, byte[] row, bool
Scan s = new Scan().withStartRow(metaStartKey).withStopRow(metaStopKey,
true)
.addFamily(HConstants.CATALOG_FAMILY).setReversed(true).setCaching(5)
.setReadType(ReadType.PREAD);
- if (this.useMetaReplicas) {
- s.setConsistency(Consistency.TIMELINE);
+
+ switch (this.metaReplicaMode) {
+ case LOAD_BALANCE:
+ int metaReplicaId = this.metaReplicaSelector.select(tableName, row,
+ RegionLocateType.CURRENT);
+ if (metaReplicaId != RegionInfo.DEFAULT_REPLICA_ID) {
+ // If the selector gives a non-primary meta replica region, then go
with it.
+ // Otherwise, just go to primary in non-hedgedRead mode.
+ s.setConsistency(Consistency.TIMELINE);
+ s.setReplicaId(metaReplicaId);
+ }
+ break;
+ case HEDGED_READ:
+ s.setConsistency(Consistency.TIMELINE);
+ break;
+ default:
+ // do nothing
Review comment:
As explained above.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]