bharathv commented on a change in pull request #2095:
URL: https://github.com/apache/hbase/pull/2095#discussion_r457757116
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java
##########
@@ -2928,13 +2928,27 @@ public GetActiveMasterResponse
getActiveMaster(RpcController rpcController,
@Override
public GetMetaRegionLocationsResponse getMetaRegionLocations(RpcController
rpcController,
- GetMetaRegionLocationsRequest request) throws ServiceException {
- GetMetaRegionLocationsResponse.Builder response =
GetMetaRegionLocationsResponse.newBuilder();
- Optional<List<HRegionLocation>> metaLocations =
- master.getMetaRegionLocationCache().getMetaRegionLocations();
- metaLocations.ifPresent(hRegionLocations -> hRegionLocations.forEach(
- location ->
response.addMetaLocations(ProtobufUtil.toRegionLocation(location))));
- return response.build();
+ GetMetaRegionLocationsRequest request) throws ServiceException {
+ MetaLocationCache cache = master.getMetaLocationCache();
+ RegionLocations locs;
+ try {
+ if (cache != null) {
+ locs = cache.locateMeta(HConstants.EMPTY_BYTE_ARRAY,
RegionLocateType.CURRENT);
+ } else {
Review comment:
Ah got it, I missed that part in the first iteration, I think you could
roll that logic into the cache to keep the lifecycle simple (since the cache
already has access to the master and we can check if master.isActive()). That
way all the callers only use the cache and we can avoid the logic in
finishMasterInitialization logic.
Also as discussed in the design doc, would be nice to have an actual
versioned cache that avoids round trips if nothing changes (for the future).
The 1s pull seems a bit aggressive but is fine as a stop-gap I guess.
----------------------------------------------------------------
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]