[
https://issues.apache.org/jira/browse/HBASE-407?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12567728#action_12567728
]
stack commented on HBASE-407:
-----------------------------
You can't use ReferenceMap from commons collections because you want a
SortedMap and ReferenceMap ? Want me to make a little test to ensure this
SoftReference value is actually working (I'd force the JVM to head for an OOME
and add a ReferenceQueue implementation to the SortReference constructor and
log its dequeues).
Otherwise, for the future, would suggest that you put together declarations and
assignments as in:
{code}
@@ -116,7 +115,8 @@
private HRegionLocation rootRegionLocation;
- private Map<Text, SortedMap<Text, HRegionLocation>> cachedRegionLocations;
+ private Map<Text, SortedMap<Text,
+ SoftReference<HRegionLocation>>> cachedRegionLocations;
/**
* constructor
@@ -147,7 +147,8 @@
this.masterChecked = false;
this.cachedRegionLocations =
- new ConcurrentHashMap<Text, SortedMap<Text, HRegionLocation>>();
+ new ConcurrentHashMap<Text, SortedMap<Text,
+ SoftReference<HRegionLocation>>>();
{code}
i.e. do private Map<Text, SortedMap<Text, SoftReference<HRegionLocation>>>
cachedRegionLocations = new ConcurrentHashMap<Text, SortedMap<Text,
SoftReference<HRegionLocation>>>();
You might also be able to make cachedRegionLocations 'final' too.
These are for sure safe:
{code}
+ HRegionLocation rl = tableLocations.get(row).get();
{code}
and
{code}
+ matchingRegions.get(matchingRegions.lastKey()).get();
{code}
Otherwise, patch looks great.
> Client should cache region locations in an LRU structure
> --------------------------------------------------------
>
> Key: HBASE-407
> URL: https://issues.apache.org/jira/browse/HBASE-407
> Project: Hadoop HBase
> Issue Type: Improvement
> Components: client
> Reporter: Bryan Duxbury
> Assignee: Bryan Duxbury
> Attachments: 407-v2.patch, 407.patch
>
>
> Instead of keeping the region locations cached client side in a TreeMap, we
> should use an LRU mechanism to help manage memory more dynamically.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.