Apache9 commented on a change in pull request #4078:
URL: https://github.com/apache/hbase/pull/4078#discussion_r795177791
##########
File path:
hbase-client/src/main/java/org/apache/hadoop/hbase/MetaTableAccessor.java
##########
@@ -567,19 +569,55 @@ public static Scan getScanForTableName(Configuration
conf, TableName tableName)
// Stop key appends the smallest possible char to the table name
byte[] stopKey = getTableStopRowForMeta(tableName, QueryType.REGION);
- Scan scan = getMetaScan(conf, -1);
+ Scan scan = getMetaScan(null, conf, -1);
scan.setStartRow(startKey);
scan.setStopRow(stopKey);
return scan;
}
- private static Scan getMetaScan(Configuration conf, int rowUpperLimit) {
+ private static Scan getMetaScan(Connection conn, Configuration conf, int
rowUpperLimit) {
Scan scan = new Scan();
int scannerCaching = conf.getInt(HConstants.HBASE_META_SCANNER_CACHING,
HConstants.DEFAULT_HBASE_META_SCANNER_CACHING);
- if (conf.getBoolean(HConstants.USE_META_REPLICAS,
HConstants.DEFAULT_USE_META_REPLICAS)) {
- scan.setConsistency(Consistency.TIMELINE);
+
+ // Get the region locator's meta replica mode.
+ CatalogReplicaMode metaReplicaMode = CatalogReplicaMode.fromString(
+ conf.get(LOCATOR_META_REPLICAS_MODE,
CatalogReplicaMode.NONE.toString()));
+
+ switch (metaReplicaMode) {
+ case LOAD_BALANCE:
+ int numOfReplicas = 1;
+ if (conn != null) {
+ try {
+ try (Table metaTable = getMetaHTable(conn)) {
+ numOfReplicas = metaTable.getDescriptor().getRegionReplication();
Review comment:
Ah, this is a bit painful... We used to expect getMetaScan to only
contain memory operations but here we will have network io... And everytime we
call this method it will generate a rpc calll...
Looking at the code above, in the async code we also have this and we even
introduce a blocking rpc call. I haven't realized this when reviewing the PR
for master, but obviously it is incorrect, we should not do blocking call in
the async code. We should try to find a better way...
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]