/** * Put a newly discovered HRegionLocation into the cache. * @param tableName The table name. * @param locations the new locations */ public void cacheLocation(final TableName tableName, final RegionLocations locations) { byte [] startKey = locations.getRegionLocation().getRegion().getStartKey(); ConcurrentMap<byte[], RegionLocations> tableLocations = getTableLocations(tableName); RegionLocations oldLocation = tableLocations.putIfAbsent(startKey, locations); boolean isNewCacheEntry = (oldLocation == null); if (isNewCacheEntry) { if (LOG.isTraceEnabled()) { LOG.trace("Cached location: " + locations); } addToCachedServers(locations); return; } // merge old and new locations and add it to the cache // Meta record might be stale - some (probably the same) server has closed the region // with later seqNum and told us about the new location. RegionLocations mergedLocation = oldLocation.mergeLocations(locations); boolean replaced = tableLocations.replace(startKey, oldLocation, mergedLocation); if (replaced && LOG.isTraceEnabled()) { LOG.trace("Merged cached locations: " + mergedLocation); } addToCachedServers(locations); }
LOG.trace("Cached location: " + location); addToCachedServers(locations); return; LOG.trace("Changed cached location to: " + location); addToCachedServers(updatedLocations);
/** * Put a newly discovered HRegionLocation into the cache. * @param tableName The table name. * @param locations the new locations */ public void cacheLocation(final TableName tableName, final RegionLocations locations) { byte [] startKey = locations.getRegionLocation().getRegion().getStartKey(); ConcurrentMap<byte[], RegionLocations> tableLocations = getTableLocations(tableName); RegionLocations oldLocation = tableLocations.putIfAbsent(startKey, locations); boolean isNewCacheEntry = (oldLocation == null); if (isNewCacheEntry) { if (LOG.isTraceEnabled()) { LOG.trace("Cached location: " + locations); } addToCachedServers(locations); return; } // merge old and new locations and add it to the cache // Meta record might be stale - some (probably the same) server has closed the region // with later seqNum and told us about the new location. RegionLocations mergedLocation = oldLocation.mergeLocations(locations); boolean replaced = tableLocations.replace(startKey, oldLocation, mergedLocation); if (replaced && LOG.isTraceEnabled()) { LOG.trace("Merged cached locations: " + mergedLocation); } addToCachedServers(locations); }
LOG.trace("Cached location: " + location); addToCachedServers(locations); return; LOG.trace("Changed cached location to: " + location); addToCachedServers(updatedLocations);
/** * Put a newly discovered HRegionLocation into the cache. * @param tableName The table name. * @param locations the new locations */ public void cacheLocation(final TableName tableName, final RegionLocations locations) { byte [] startKey = locations.getRegionLocation().getRegion().getStartKey(); ConcurrentMap<byte[], RegionLocations> tableLocations = getTableLocations(tableName); RegionLocations oldLocation = tableLocations.putIfAbsent(startKey, locations); boolean isNewCacheEntry = (oldLocation == null); if (isNewCacheEntry) { if (LOG.isTraceEnabled()) { LOG.trace("Cached location: " + locations); } addToCachedServers(locations); return; } // merge old and new locations and add it to the cache // Meta record might be stale - some (probably the same) server has closed the region // with later seqNum and told us about the new location. RegionLocations mergedLocation = oldLocation.mergeLocations(locations); boolean replaced = tableLocations.replace(startKey, oldLocation, mergedLocation); if (replaced && LOG.isTraceEnabled()) { LOG.trace("Merged cached locations: " + mergedLocation); } addToCachedServers(locations); }
LOG.trace("Cached location: " + location); addToCachedServers(locations); return; LOG.trace("Changed cached location to: " + location); addToCachedServers(updatedLocations);
/** * Put a newly discovered HRegionLocation into the cache. * @param tableName The table name. * @param locations the new locations */ public void cacheLocation(final TableName tableName, final RegionLocations locations) { byte [] startKey = locations.getRegionLocation().getRegionInfo().getStartKey(); ConcurrentMap<byte[], RegionLocations> tableLocations = getTableLocations(tableName); RegionLocations oldLocation = tableLocations.putIfAbsent(startKey, locations); boolean isNewCacheEntry = (oldLocation == null); if (isNewCacheEntry) { if (LOG.isTraceEnabled()) { LOG.trace("Cached location: " + locations); } addToCachedServers(locations); return; } // merge old and new locations and add it to the cache // Meta record might be stale - some (probably the same) server has closed the region // with later seqNum and told us about the new location. RegionLocations mergedLocation = oldLocation.mergeLocations(locations); boolean replaced = tableLocations.replace(startKey, oldLocation, mergedLocation); if (replaced && LOG.isTraceEnabled()) { LOG.trace("Merged cached locations: " + mergedLocation); } addToCachedServers(locations); }
LOG.trace("Cached location: " + location); addToCachedServers(locations); return; LOG.trace("Changed cached location to: " + location); addToCachedServers(updatedLocations);