[ 
https://issues.apache.org/jira/browse/HADOOP-2555?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12561308#action_12561308
 ] 

Hadoop QA commented on HADOOP-2555:
-----------------------------------

+1 overall.  Here are the results of testing the latest attachment 
http://issues.apache.org/jira/secure/attachment/12373710/2555-v2.patch
against trunk revision r613923.

    @author +1.  The patch does not contain any @author tags.

    javadoc +1.  The javadoc tool did not generate any warning messages.

    javac +1.  The applied patch does not generate any new compiler warnings.

    findbugs +1.  The patch does not introduce any new Findbugs warnings.

    core tests +1.  The patch passed core unit tests.

    contrib tests +1.  The patch passed contrib unit tests.

Test results: 
http://lucene.zones.apache.org:8080/hudson/job/Hadoop-Patch/1672/testReport/
Findbugs warnings: 
http://lucene.zones.apache.org:8080/hudson/job/Hadoop-Patch/1672/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Checkstyle results: 
http://lucene.zones.apache.org:8080/hudson/job/Hadoop-Patch/1672/artifact/trunk/build/test/checkstyle-errors.html
Console output: 
http://lucene.zones.apache.org:8080/hudson/job/Hadoop-Patch/1672/console

This message is automatically generated.

> Refactor the HTable#get and HTable#getRow methods to avoid repetition of 
> retry-on-failure logic
> -----------------------------------------------------------------------------------------------
>
>                 Key: HADOOP-2555
>                 URL: https://issues.apache.org/jira/browse/HADOOP-2555
>             Project: Hadoop
>          Issue Type: Improvement
>          Components: contrib/hbase
>            Reporter: Peter Dolan
>            Assignee: Bryan Duxbury
>            Priority: Minor
>         Attachments: 2555-v2.patch, hadoop-2555.patch
>
>
> The following code is repeated in every one of HTable#get and HTable#getRow 
> methods:
> {code:title=HTable.java|borderStyle=solid}
>     MapWritable value = null;
>     for (int tries = 0; tries < numRetries; tries++) {
>       HRegionLocation r = getRegionLocation(row);
>       HRegionInterface server =
>         connection.getHRegionConnection(r.getServerAddress());
>       
>       try {
>         value = server.getRow(r.getRegionInfo().getRegionName(), row, ts);  
> // This is the only line of code that changes significantly between methods
>         break;
>         
>       } catch (IOException e) {
>         if (e instanceof RemoteException) {
>           e = RemoteExceptionHandler.decodeRemoteException((RemoteException) 
> e);
>         }
>         if (tries == numRetries - 1) {
>           // No more tries
>           throw e;
>         }
>         if (LOG.isDebugEnabled()) {
>           LOG.debug("reloading table servers because: " + e.getMessage());
>         }
>         tableServers = connection.reloadTableServers(tableName);
>       }
>       try {
>         Thread.sleep(this.pause);
>         
>       } catch (InterruptedException x) {
>         // continue
>       }
>     }
> {code}
> This should be factored out into a protected method that handles 
> retry-on-failure logic to facilitate more robust testing and the development 
> of new API methods.
> Proposed modification:
> // Execute the provided Callable against the server
> protected <T> callServerWithRetries(Callable<T> callable) throws 
> RemoteException;
> The above code could then be reduced to:
> {code:title=HTable.java|borderStyle=solid}
>     MapWritable value = null;
>     final connection;
>     try {
>       value = callServerWithRetries(new Callable<MapWritable>() {
>             HRegionLocation r = getRegionLocation(row);
>             HRegionInterface server =
>                 connection.getHRegionConnection(r.getServerAddress());
>             server.getRow(r.getRegionInfo().getRegionName(), row, ts);
>           });
>     } catch (RemoteException e) {
>       // handle unrecoverable remote exceptions
>     }
> {code}
> This would greatly ease the development of new API methods by reducing the 
> amount of code needed to implement a new method and reducing the amount of 
> logic that needs to be tested per method.

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