@InterfaceAudience.Private public class MetaCache extends Object
Modifier and Type | Field and Description |
---|---|
private ConcurrentMap<TableName,ConcurrentNavigableMap<byte[],RegionLocations>> |
cachedRegionLocations
Map of table to table
HRegionLocation s. |
private Set<ServerName> |
cachedServers |
private static org.apache.commons.logging.Log |
LOG |
private MetricsConnection |
metrics |
Constructor and Description |
---|
MetaCache(MetricsConnection metrics) |
Modifier and Type | Method and Description |
---|---|
private void |
addToCachedServers(RegionLocations locations) |
void |
cacheLocation(TableName tableName,
RegionLocations locations)
Put a newly discovered HRegionLocation into the cache.
|
void |
cacheLocation(TableName tableName,
ServerName source,
HRegionLocation location)
Put a newly discovered HRegionLocation into the cache.
|
void |
clearCache()
Delete all cached entries.
|
void |
clearCache(HRegionInfo hri)
Deletes the cached location of the region if necessary, based on some error from source.
|
void |
clearCache(HRegionLocation location) |
void |
clearCache(ServerName serverName)
Delete all cached entries of a server.
|
void |
clearCache(TableName tableName)
Delete all cached entries of a table.
|
void |
clearCache(TableName tableName,
byte[] row)
Delete a cached location, no matter what it is.
|
void |
clearCache(TableName tableName,
byte[] row,
int replicaId)
Delete a cached location, no matter what it is.
|
void |
clearCache(TableName tableName,
byte[] row,
ServerName serverName)
Delete a cached location for a table, row and server
|
RegionLocations |
getCachedLocation(TableName tableName,
byte[] row)
Search the cache for a location that fits our table and row key.
|
int |
getNumberOfCachedRegionLocations(TableName tableName)
Return the number of cached region for a table.
|
private KeyValue.KVComparator |
getRowComparator(TableName tableName) |
private ConcurrentNavigableMap<byte[],RegionLocations> |
getTableLocations(TableName tableName) |
boolean |
isRegionCached(TableName tableName,
byte[] row)
Check the region cache to see whether a region is cached yet or not.
|
private static final org.apache.commons.logging.Log LOG
private final ConcurrentMap<TableName,ConcurrentNavigableMap<byte[],RegionLocations>> cachedRegionLocations
HRegionLocation
s.private final Set<ServerName> cachedServers
private final MetricsConnection metrics
public MetaCache(MetricsConnection metrics)
public RegionLocations getCachedLocation(TableName tableName, byte[] row)
private KeyValue.KVComparator getRowComparator(TableName tableName)
public void cacheLocation(TableName tableName, ServerName source, HRegionLocation location)
tableName
- The table name.source
- the source of the new locationlocation
- the new locationpublic void cacheLocation(TableName tableName, RegionLocations locations)
tableName
- The table name.locations
- the new locationsprivate void addToCachedServers(RegionLocations locations)
private ConcurrentNavigableMap<byte[],RegionLocations> getTableLocations(TableName tableName)
tableName
- tableName
public boolean isRegionCached(TableName tableName, byte[] row)
tableName
- tableNamerow
- rowpublic int getNumberOfCachedRegionLocations(TableName tableName)
public void clearCache()
public void clearCache(ServerName serverName)
public void clearCache(TableName tableName)
public void clearCache(TableName tableName, byte[] row, int replicaId)
tableName
- tableNamerow
- public void clearCache(TableName tableName, byte[] row)
tableName
- tableNamerow
- public void clearCache(TableName tableName, byte[] row, ServerName serverName)
public void clearCache(HRegionInfo hri)
hri
- The region in question.public void clearCache(HRegionLocation location)
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.