ndimiduk commented on a change in pull request #830: HBASE-23281: Track meta
region locations in masters
URL: https://github.com/apache/hbase/pull/830#discussion_r347676342
##########
File path:
hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/MetaTableLocator.java
##########
@@ -274,42 +269,17 @@ public static RegionState getMetaRegionState(ZKWatcher
zkw) throws KeeperExcepti
* @throws KeeperException if a ZooKeeper operation fails
*/
public static RegionState getMetaRegionState(ZKWatcher zkw, int replicaId)
- throws KeeperException {
- RegionState.State state = RegionState.State.OPEN;
- ServerName serverName = null;
+ throws KeeperException {
+ RegionState regionState = null;
try {
byte[] data = ZKUtil.getData(zkw,
zkw.getZNodePaths().getZNodeForReplica(replicaId));
- if (data != null && data.length > 0 &&
ProtobufUtil.isPBMagicPrefix(data)) {
- try {
- int prefixLen = ProtobufUtil.lengthOfPBMagic();
- ZooKeeperProtos.MetaRegionServer rl =
- ZooKeeperProtos.MetaRegionServer.parser().parseFrom(data,
prefixLen,
- data.length - prefixLen);
- if (rl.hasState()) {
- state = RegionState.State.convert(rl.getState());
- }
- HBaseProtos.ServerName sn = rl.getServer();
- serverName = ServerName.valueOf(
- sn.getHostName(), sn.getPort(), sn.getStartCode());
- } catch (InvalidProtocolBufferException e) {
- throw new DeserializationException("Unable to parse meta region
location");
- }
- } else {
- // old style of meta region location?
- serverName = ProtobufUtil.parseServerNameFrom(data);
- }
+ regionState = ProtobufUtil.parseMetaRegionStateFrom(data, replicaId);
Review comment:
Ah, I see; the earlier code was moved.
----------------------------------------------------------------
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]
With regards,
Apache Git Services