Amitanand Aiyer created HBASE-8476:
--------------------------------------
Summary: locateRegionInMeta should check the cache before doing
the prefetch
Key: HBASE-8476
URL: https://issues.apache.org/jira/browse/HBASE-8476
Project: HBase
Issue Type: Bug
Reporter: Amitanand Aiyer
Assignee: Amitanand Aiyer
Priority: Minor
Fix For: 0.89-fb, 0.95.2
locateRegionInMeta uses a regionLockObject to synchronize all accesses to
prefetch the RegionCache.
synchronized (regionLockObject) {
// If the parent table is META, we may want to pre-fetch some
// region info into the global region cache for this table.
if (Bytes.equals(parentTable, HConstants.META_TABLE_NAME) &&
(getRegionCachePrefetch(tableName)) ) {
prefetchRegionCache(tableName, row);
}
// Check the cache again for a hit in case some other thread made
the
// same query while we were waiting on the lock. If not supposed to
// be using the cache, delete any existing cached location so it
won't
// interfere.
if (useCache) {
location = getCachedLocation(tableName, row);
if (location != null) {
return location;
}
} else {
deleteCachedLocation(tableName, row);
}
However, for this to be effective, we need to check the cache as soon as we
grab the lock; before doing the prefetch. Checking the cache after doing the
prefetch does not help the current thread, in case another thread has done the
prefetch.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira