[ 
https://issues.apache.org/jira/browse/HBASE-407?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12568277#action_12568277
 ] 

stack commented on HBASE-407:
-----------------------------

Remove unnecessary SoftReference import in HConnetionManager

Put declaration and assignment of cachedRegionLocations onto the one line (w/ 
final qualifier (if possible -- maybe its not... I can't see just looking at 
this patch)

Does this comment and the nulling code that follows still apply --> // since 
we're using SoftReferences now, it's possible this possible .... 
Doesn't your new fancy SoftSortedMap handle all that stuff internally? (This 
comment and code is in two places -- make a method?)

In the article on a cache map, there was also a test.  Did you try your new SSM 
against the test?

I wonder if this safe:

+  public V get(Object key) {                                                   
                                                                              
|~                                                                              
                                                                              
+    checkReferences();                                                         
                                                                              
|~                                                                              
                                                                              
+    return internalMap.get(key).get();                                         
                                                                              
|~                                                                              
                                                                              
+  }  

Whats to stop the GC running between call to checkReference and execution of 
the internalMap.get?

Same for the remove, contains, etc.  

Here is how its done in the apache commons collections ReferenceMap:

{code}
    public Object get(Object key) {                                             
                                                                              |
        purgeBeforeRead();                                                      
                                                                              
|/**
        Entry entry = getEntry(key);                                            
                                                                              | 
* Annotation
        if (entry == null) {                                                    
                                                                              | 
*/
            return null;                                                        
                                                                              
|struct Annotation {
        }                                                                       
                                                                              | 
 1:string family,
        return entry.getValue();                                                
                                                                              | 
 2:i32 index = -1,
    }  
{code}

This logging will only prove annoying, I predict: +    LOG.debug("Done cleaning 
up references.");   ... and the one before it.  At lease output some stats?

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-v3.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.

Reply via email to