You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Daniel Iancu (JIRA)" <ji...@apache.org> on 2011/07/01 17:30:28 UTC

[jira] [Created] (HBASE-4054) Usability improvement to HTablePool

Usability improvement to HTablePool
-----------------------------------

                 Key: HBASE-4054
                 URL: https://issues.apache.org/jira/browse/HBASE-4054
             Project: HBase
          Issue Type: Improvement
          Components: client
    Affects Versions: 0.90.3
            Reporter: Daniel Iancu
            Priority: Minor


Hi
It look like the usage of HTablePool might be improved. Now, once you 
get the connection from pool you must take good care to return it by 
calling  HTablePool.putTable(table);
If you close the table  (say, you don't read carefully the Javadoc)  
your htable will not be reused.
Other case might be if you build a Datasource like object to obtain 
HTables and, in this case, from the client you don't have a reference to 
the pool to return the table once done with it.

I've fixed all this by subclassing the HTablePool and overriding the  
getTable method

public class HTablePoolEnhanced extends HTablePool
    @Override
     public HTableInterface getTable(String tableName) {
         return new PooledHTable(super.getTable(tableName));
     }

  where  PooledHTable is a inner class that wraps a HTable and 
reimplements the close method to return the table to pool

  public class PooledHTable implements HTableInterface {

         private HTableInterface table;

         public PooledHTable(HTableInterface table) {
             this.table = table;
         }

        @Override
         public void close() throws IOException {
             putTable(table);
         }
  ...
}

}

Does it make sense to have this implementation in Hbase also ? It look 
that all it needs is to have a new HTableInterfaceFactory implementation 
to create some proxy tables like i did.

Regards
Daniel


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-4054) Usability improvement to HTablePool

Posted by "Ted Yu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13061776#comment-13061776 ] 

Ted Yu commented on HBASE-4054:
-------------------------------

Integrated addendum to TRUNK.

Thanks for the review Stack.

> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>         Attachments: 4054.addendum, HBASE-4054_Usability_improvement_to_HTablePool-trunk.patch, HBASE-4054_Usability_improvement_to_HTablePool.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (HBASE-4054) Usability improvement to HTablePool

Posted by "Daniel Iancu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Iancu updated HBASE-4054:
--------------------------------

    Description: 
To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
 
To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public


  was:
Hi
It look like the usage of HTablePool might be improved. Now, once you 
get the connection from pool you must take good care to return it by 
calling  HTablePool.putTable(table);
If you close the table  (say, you don't read carefully the Javadoc)  
your htable will not be reused.
Other case might be if you build a Datasource like object to obtain 
HTables and, in this case, from the client you don't have a reference to 
the pool to return the table once done with it.

I've fixed all this by subclassing the HTablePool and overriding the  
getTable method

public class HTablePoolEnhanced extends HTablePool
    @Override
     public HTableInterface getTable(String tableName) {
         return new PooledHTable(super.getTable(tableName));
     }

  where  PooledHTable is a inner class that wraps a HTable and 
reimplements the close method to return the table to pool

  public class PooledHTable implements HTableInterface {

         private HTableInterface table;

         public PooledHTable(HTableInterface table) {
             this.table = table;
         }

        @Override
         public void close() throws IOException {
             putTable(table);
         }
  ...
}

}

Does it make sense to have this implementation in Hbase also ? It look 
that all it needs is to have a new HTableInterfaceFactory implementation 
to create some proxy tables like i did.

Regards
Daniel



> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>         Attachments: HBASE-4054_Usability_improvement_to_HTablePool.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-4054) Usability improvement to HTablePool

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13439512#comment-13439512 ] 

Hudson commented on HBASE-4054:
-------------------------------

Integrated in HBase-0.94-security #48 (See [https://builds.apache.org/job/HBase-0.94-security/48/])
    HBASE-6471 Performance regression caused by HBASE-4054 (Revision 1373916)

     Result = FAILURE
jxiang : 
Files : 
* /hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/client/HTablePool.java
* /hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/rest/RegionsResource.java
* /hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/client/TestHTablePool.java

                
> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Assignee: Daniel Iancu
>            Priority: Minor
>             Fix For: 0.92.0
>
>         Attachments: 4054.addendum, HBASE-4054_Usability_improvement_to_HTablePool.patch, HBASE-4054_Usability_improvement_to_HTablePool-trunk.patch, TestHTablePool-trunk.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-4054) Usability improvement to HTablePool

Posted by "Ted Yu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13059447#comment-13059447 ] 

Ted Yu commented on HBASE-4054:
-------------------------------

See HBASE-3678 for Eclipse-based Apache Formatter that uses 2 spaces for tab.
Patch version 2 shows more changes than it should contain.

Please indicate the line number where your comment w.r.t. tableFactory.releaseHTableInterface() is located.

> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>         Attachments: HBASE-4054_Usability_improvement_to_HTablePool.patch, HBASE-4054_Usability_improvement_to_HTablePool1.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-4054) Usability improvement to HTablePool

Posted by "stack (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13062005#comment-13062005 ] 

stack commented on HBASE-4054:
------------------------------

No worries Daniel.

> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>         Attachments: 4054.addendum, HBASE-4054_Usability_improvement_to_HTablePool-trunk.patch, HBASE-4054_Usability_improvement_to_HTablePool.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-4054) Usability improvement to HTablePool

Posted by "Daniel Iancu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13059465#comment-13059465 ] 

Daniel Iancu commented on HBASE-4054:
-------------------------------------

the putTable method was renamed to returnTable. line is 195. the actual putTable checks it the table passed is a table from pool then delegates to returnTable (line 168) 

> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>         Attachments: HBASE-4054_Usability_improvement_to_HTablePool.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-4054) Usability improvement to HTablePool

Posted by "stack (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13058817#comment-13058817 ] 

stack commented on HBASE-4054:
------------------------------

@Daniel Can we not push your improvement back into HTablePool rather than make a new class?  The getTable returns an HTableInterface.  Can't we change it so it gives out your pool+table carrying class instead?  We could add deprecated to putTable with a note that its going private?

> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>         Attachments: HBASE-4054_Usability_improvement_to_HTablePool.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (HBASE-4054) Usability improvement to HTablePool

Posted by "Daniel Iancu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Iancu updated HBASE-4054:
--------------------------------

    Attachment: HBASE-4054_Usability_improvement_to_HTablePool-trunk.patch

@Ted I've patched the trunk version also, please have a look

> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>         Attachments: HBASE-4054_Usability_improvement_to_HTablePool-trunk.patch, HBASE-4054_Usability_improvement_to_HTablePool.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-4054) Usability improvement to HTablePool

Posted by "stack (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13063726#comment-13063726 ] 

stack commented on HBASE-4054:
------------------------------

umm... it completed finally but testReturnDifferentTable failed with this:

{code}
-------------------------------------------------------------------------------
Test set: org.apache.hadoop.hbase.client.TestHTablePool
-------------------------------------------------------------------------------
Tests run: 18, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 457.077 sec <<< FAILURE!
testReturnDifferentTable(org.apache.hadoop.hbase.client.TestHTablePool$TestHTableReusablePool)  Time elapsed: 93.551 sec  <<< ERROR!
org.apache.hadoop.hbase.client.RetriesExhaustedException: Failed setting up proxy interface org.apache.hadoop.hbase.ipc.HRegionInterface to /192.168.1.8:60222 after attempts=1
        at org.apache.hadoop.hbase.ipc.HBaseRPC.waitForProxy(HBaseRPC.java:234)
        at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getHRegionConnection(HConnectionManager.java:1164)
        at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getHRegionConnection(HConnectionManager.java:1126)
        at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getHRegionConnection(HConnectionManager.java:1113)
        at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:845)
        at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:741)
        at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.relocateRegion(HConnectionManager.java:715)
        at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:950)
        at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:745)
        at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:709)
        at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:189)
        at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:145)
        at org.apache.hadoop.hbase.client.TestHTablePool$TestHTablePoolType$1.<init>(TestHTablePool.java:165)
        at org.apache.hadoop.hbase.client.TestHTablePool$TestHTablePoolType.testReturnDifferentTable(TestHTablePool.java:165)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at junit.framework.TestCase.runTest(TestCase.java:168)
        at junit.framework.TestCase.runBare(TestCase.java:134)
        at junit.framework.TestResult$1.protect(TestResult.java:110)
        at junit.framework.TestResult.runProtected(TestResult.java:128)
        at junit.framework.TestResult.run(TestResult.java:113)
        at junit.framework.TestCase.run(TestCase.java:124)
        at junit.framework.TestSuite.runTest(TestSuite.java:243)
        at junit.framework.TestSuite.run(TestSuite.java:238)
        at junit.framework.TestSuite.runTest(TestSuite.java:243)
        at junit.framework.TestSuite.run(TestSuite.java:238)
        at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
        at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
        at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
        at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:165)
        at org.apache.maven.surefire.Surefire.run(Surefire.java:107)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:289)
        at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1005)
Caused by: java.net.ConnectException: Connection refused
        at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
        at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:567)
        at org.apache.hadoop.net.SocketIOWithTimeout.connect(SocketIOWithTimeout.java:206)
        at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:404)
        at org.apache.hadoop.hbase.ipc.HBaseClient$Connection.setupIOstreams(HBaseClient.java:343)
        at org.apache.hadoop.hbase.ipc.HBaseClient.getConnection(HBaseClient.java:976)
        at org.apache.hadoop.hbase.ipc.HBaseClient.call(HBaseClient.java:828)
        at org.apache.hadoop.hbase.ipc.WritableRpcEngine$Invoker.invoke(WritableRpcEngine.java:141)
        at $Proxy10.getProtocolVersion(Unknown Source)
        at org.apache.hadoop.hbase.ipc.WritableRpcEngine.getProxy(WritableRpcEngine.java:174)
        at org.apache.hadoop.hbase.ipc.HBaseRPC.getProxy(HBaseRPC.java:295)
        at org.apache.hadoop.hbase.ipc.HBaseRPC.getProxy(HBaseRPC.java:272)
        at org.apache.hadoop.hbase.ipc.HBaseRPC.getProxy(HBaseRPC.java:324)
        at org.apache.hadoop.hbase.ipc.HBaseRPC.waitForProxy(HBaseRPC.java:228)
{code}

> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>         Attachments: 4054.addendum, HBASE-4054_Usability_improvement_to_HTablePool-trunk.patch, HBASE-4054_Usability_improvement_to_HTablePool.patch, TestHTablePool-trunk.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (HBASE-4054) Usability improvement to HTablePool

Posted by "Daniel Iancu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Iancu updated HBASE-4054:
--------------------------------

    Attachment: HBASE-4054_Usability_improvement_to_HTablePool1.patch

> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>         Attachments: HBASE-4054_Usability_improvement_to_HTablePool.patch, HBASE-4054_Usability_improvement_to_HTablePool1.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-4054) Usability improvement to HTablePool

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13436436#comment-13436436 ] 

Hudson commented on HBASE-4054:
-------------------------------

Integrated in HBase-TRUNK-on-Hadoop-2.0.0 #132 (See [https://builds.apache.org/job/HBase-TRUNK-on-Hadoop-2.0.0/132/])
    HBASE-6471 Performance regression caused by HBASE-4054 (Revision 1373917)

     Result = FAILURE
jxiang : 
Files : 
* /hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HTablePool.java
* /hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RegionsResource.java
* /hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestHTablePool.java

                
> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Assignee: Daniel Iancu
>            Priority: Minor
>             Fix For: 0.92.0
>
>         Attachments: 4054.addendum, HBASE-4054_Usability_improvement_to_HTablePool.patch, HBASE-4054_Usability_improvement_to_HTablePool-trunk.patch, TestHTablePool-trunk.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-4054) Usability improvement to HTablePool

Posted by "Ted Yu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13058643#comment-13058643 ] 

Ted Yu commented on HBASE-4054:
-------------------------------

Please document the above pattern in your patch.
It would be difficult to change the way HTablePool operates now.

> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>         Attachments: HBASE-4054_Usability_improvement_to_HTablePool.patch
>
>
> Hi
> It look like the usage of HTablePool might be improved. Now, once you 
> get the connection from pool you must take good care to return it by 
> calling  HTablePool.putTable(table);
> If you close the table  (say, you don't read carefully the Javadoc)  
> your htable will not be reused.
> Other case might be if you build a Datasource like object to obtain 
> HTables and, in this case, from the client you don't have a reference to 
> the pool to return the table once done with it.
> I've fixed all this by subclassing the HTablePool and overriding the  
> getTable method
> public class HTablePoolEnhanced extends HTablePool
>     @Override
>      public HTableInterface getTable(String tableName) {
>          return new PooledHTable(super.getTable(tableName));
>      }
>   where  PooledHTable is a inner class that wraps a HTable and 
> reimplements the close method to return the table to pool
>   public class PooledHTable implements HTableInterface {
>          private HTableInterface table;
>          public PooledHTable(HTableInterface table) {
>              this.table = table;
>          }
>         @Override
>          public void close() throws IOException {
>              putTable(table);
>          }
>   ...
> }
> }
> Does it make sense to have this implementation in Hbase also ? It look 
> that all it needs is to have a new HTableInterfaceFactory implementation 
> to create some proxy tables like i did.
> Regards
> Daniel

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-4054) Usability improvement to HTablePool

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13436160#comment-13436160 ] 

Hudson commented on HBASE-4054:
-------------------------------

Integrated in HBase-0.94 #399 (See [https://builds.apache.org/job/HBase-0.94/399/])
    HBASE-6471 Performance regression caused by HBASE-4054 (Revision 1373916)

     Result = FAILURE
jxiang : 
Files : 
* /hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/client/HTablePool.java
* /hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/rest/RegionsResource.java
* /hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/client/TestHTablePool.java

                
> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Assignee: Daniel Iancu
>            Priority: Minor
>             Fix For: 0.92.0
>
>         Attachments: 4054.addendum, HBASE-4054_Usability_improvement_to_HTablePool.patch, HBASE-4054_Usability_improvement_to_HTablePool-trunk.patch, TestHTablePool-trunk.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (HBASE-4054) Usability improvement to HTablePool

Posted by "Daniel Iancu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Iancu updated HBASE-4054:
--------------------------------

    Attachment: HBASE-4054_Usability_improvement_to_HTablePool.patch

source files formatted with Apache eclipse formatter 

> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>         Attachments: HBASE-4054_Usability_improvement_to_HTablePool.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-4054) Usability improvement to HTablePool

Posted by "Daniel Iancu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13059705#comment-13059705 ] 

Daniel Iancu commented on HBASE-4054:
-------------------------------------

@Ted comment is fine. I'm gonna take a look at the trunk version to see how can I patch it

> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>         Attachments: HBASE-4054_Usability_improvement_to_HTablePool.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-4054) Usability improvement to HTablePool

Posted by "Daniel Iancu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13059420#comment-13059420 ] 

Daniel Iancu commented on HBASE-4054:
-------------------------------------

@Stack, I've created a new patch where changes are pushed into HTablePool. I've updated the unit test and added some more tests

@Ted putTable now checks the returned table to be a valid table. tableFactory.releaseHTableInterface(table) will never return the table in pool. I've added more comments in the code to describe better how it works

If any changes are required just let me know

> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>         Attachments: HBASE-4054_Usability_improvement_to_HTablePool.patch, HBASE-4054_Usability_improvement_to_HTablePool1.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-4054) Usability improvement to HTablePool

Posted by "Ted Yu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13059512#comment-13059512 ] 

Ted Yu commented on HBASE-4054:
-------------------------------

How about the following comment ?
{noformat}
+    /**
+     * Expose the wrapped HTable to tests in the same package
+     *
{noformat}
This JIRA is marked Improvement which would only go to TRUNK.

> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>         Attachments: HBASE-4054_Usability_improvement_to_HTablePool.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (HBASE-4054) Usability improvement to HTablePool

Posted by "stack (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

stack updated HBASE-4054:
-------------------------

       Resolution: Fixed
    Fix Version/s: 0.92.0
     Hadoop Flags: [Reviewed]
           Status: Resolved  (was: Patch Available)

Committed the test to TRUNK (I tried it in a few different locations and it passed).  Thanks for the patch Daniel.

> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>             Fix For: 0.92.0
>
>         Attachments: 4054.addendum, HBASE-4054_Usability_improvement_to_HTablePool-trunk.patch, HBASE-4054_Usability_improvement_to_HTablePool.patch, TestHTablePool-trunk.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-4054) Usability improvement to HTablePool

Posted by "Ted Yu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13058620#comment-13058620 ] 

Ted Yu commented on HBASE-4054:
-------------------------------

The way PooledHTable.close() is implemented would pose challenge to HTablePool's management of the size of its tables map, namely when maxSize is not Integer.MAX_VALUE.
Take a look at the following in HTablePool.putTable():
{code}
    if(tables.size(tableName) >= maxSize) {
      // release table instance since we're not reusing it
      this.tableFactory.releaseHTableInterface(table);
      return;
    }
{code}
In HTableFactory:
{code}
  public void releaseHTableInterface(HTableInterface table) throws IOException {
    table.close();
  }
{code}
So the intention of cleaning HTable instance ends up putting the instance back to the pool.

Looks like you need to implement your own HTableInterfaceFactory which would call realClose(), a method to be added to PooledHTable, to really close the instance for the above scenario.


> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>         Attachments: HBASE-4054_Usability_improvement_to_HTablePool.patch
>
>
> Hi
> It look like the usage of HTablePool might be improved. Now, once you 
> get the connection from pool you must take good care to return it by 
> calling  HTablePool.putTable(table);
> If you close the table  (say, you don't read carefully the Javadoc)  
> your htable will not be reused.
> Other case might be if you build a Datasource like object to obtain 
> HTables and, in this case, from the client you don't have a reference to 
> the pool to return the table once done with it.
> I've fixed all this by subclassing the HTablePool and overriding the  
> getTable method
> public class HTablePoolEnhanced extends HTablePool
>     @Override
>      public HTableInterface getTable(String tableName) {
>          return new PooledHTable(super.getTable(tableName));
>      }
>   where  PooledHTable is a inner class that wraps a HTable and 
> reimplements the close method to return the table to pool
>   public class PooledHTable implements HTableInterface {
>          private HTableInterface table;
>          public PooledHTable(HTableInterface table) {
>              this.table = table;
>          }
>         @Override
>          public void close() throws IOException {
>              putTable(table);
>          }
>   ...
> }
> }
> Does it make sense to have this implementation in Hbase also ? It look 
> that all it needs is to have a new HTableInterfaceFactory implementation 
> to create some proxy tables like i did.
> Regards
> Daniel

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-4054) Usability improvement to HTablePool

Posted by "stack (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13061771#comment-13061771 ] 

stack commented on HBASE-4054:
------------------------------

I've been working this too.  I have a different fix, one that does not change PooledHTable such that it extends HTable.  Let me upload it to see what you think Ted.

> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>         Attachments: 4054.addendum, HBASE-4054_Usability_improvement_to_HTablePool-trunk.patch, HBASE-4054_Usability_improvement_to_HTablePool.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (HBASE-4054) Usability improvement to HTablePool

Posted by "Daniel Iancu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Iancu updated HBASE-4054:
--------------------------------

    Attachment:     (was: TestHTablePool-trunk.patch)

> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>         Attachments: 4054.addendum, HBASE-4054_Usability_improvement_to_HTablePool-trunk.patch, HBASE-4054_Usability_improvement_to_HTablePool.patch, TestHTablePool-trunk.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-4054) Usability improvement to HTablePool

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13061668#comment-13061668 ] 

Hudson commented on HBASE-4054:
-------------------------------

Integrated in HBase-TRUNK #2011 (See [https://builds.apache.org/job/HBase-TRUNK/2011/])
    HBASE-4054 Usability improvement to HTablePool

stack : 
Files : 
* /hbase/trunk/CHANGES.txt
* /hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HTablePool.java
* /hbase/trunk/src/test/java/org/apache/hadoop/hbase/client/TestHTablePool.java


> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>         Attachments: HBASE-4054_Usability_improvement_to_HTablePool-trunk.patch, HBASE-4054_Usability_improvement_to_HTablePool.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-4054) Usability improvement to HTablePool

Posted by "Daniel Iancu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13058636#comment-13058636 ] 

Daniel Iancu commented on HBASE-4054:
-------------------------------------

I think HTablePool.putTable should be made private and called only from PooledHTable.close. This way you are sure that nobody puts back a HTableImplementation other then then HTable.

HTablePool usage should be mainly 
{{  
   table = HTablePool.getTable();

   //use table

   table.close(); 
}}


> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>         Attachments: HBASE-4054_Usability_improvement_to_HTablePool.patch
>
>
> Hi
> It look like the usage of HTablePool might be improved. Now, once you 
> get the connection from pool you must take good care to return it by 
> calling  HTablePool.putTable(table);
> If you close the table  (say, you don't read carefully the Javadoc)  
> your htable will not be reused.
> Other case might be if you build a Datasource like object to obtain 
> HTables and, in this case, from the client you don't have a reference to 
> the pool to return the table once done with it.
> I've fixed all this by subclassing the HTablePool and overriding the  
> getTable method
> public class HTablePoolEnhanced extends HTablePool
>     @Override
>      public HTableInterface getTable(String tableName) {
>          return new PooledHTable(super.getTable(tableName));
>      }
>   where  PooledHTable is a inner class that wraps a HTable and 
> reimplements the close method to return the table to pool
>   public class PooledHTable implements HTableInterface {
>          private HTableInterface table;
>          public PooledHTable(HTableInterface table) {
>              this.table = table;
>          }
>         @Override
>          public void close() throws IOException {
>              putTable(table);
>          }
>   ...
> }
> }
> Does it make sense to have this implementation in Hbase also ? It look 
> that all it needs is to have a new HTableInterfaceFactory implementation 
> to create some proxy tables like i did.
> Regards
> Daniel

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (HBASE-4054) Usability improvement to HTablePool

Posted by "Daniel Iancu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Iancu updated HBASE-4054:
--------------------------------

    Attachment: TestHTablePool-trunk.patch

> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>         Attachments: 4054.addendum, HBASE-4054_Usability_improvement_to_HTablePool-trunk.patch, HBASE-4054_Usability_improvement_to_HTablePool.patch, TestHTablePool-trunk.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Assigned] (HBASE-4054) Usability improvement to HTablePool

Posted by "Jean-Daniel Cryans (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jean-Daniel Cryans reassigned HBASE-4054:
-----------------------------------------

    Assignee: Daniel Iancu
    
> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Assignee: Daniel Iancu
>            Priority: Minor
>             Fix For: 0.92.0
>
>         Attachments: 4054.addendum, HBASE-4054_Usability_improvement_to_HTablePool-trunk.patch, HBASE-4054_Usability_improvement_to_HTablePool.patch, TestHTablePool-trunk.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (HBASE-4054) Usability improvement to HTablePool

Posted by "Daniel Iancu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Iancu updated HBASE-4054:
--------------------------------

    Attachment: TestHTablePool-trunk.patch

Included test to check for ClassCastException on returned table 

> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>         Attachments: 4054.addendum, HBASE-4054_Usability_improvement_to_HTablePool-trunk.patch, HBASE-4054_Usability_improvement_to_HTablePool.patch, TestHTablePool-trunk.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (HBASE-4054) Usability improvement to HTablePool

Posted by "Ted Yu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ted Yu updated HBASE-4054:
--------------------------

    Attachment: 4054.addendum

> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>         Attachments: 4054.addendum, HBASE-4054_Usability_improvement_to_HTablePool-trunk.patch, HBASE-4054_Usability_improvement_to_HTablePool.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-4054) Usability improvement to HTablePool

Posted by "Daniel Iancu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13061937#comment-13061937 ] 

Daniel Iancu commented on HBASE-4054:
-------------------------------------

@Stack sorry for the gratuitous changes, I've seen them but I didn't know how to get rid of them. I set up my  Eclipse as explained in HBASE-3678 but still they got through. I'll do better checks next time.

> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>         Attachments: 4054.addendum, HBASE-4054_Usability_improvement_to_HTablePool-trunk.patch, HBASE-4054_Usability_improvement_to_HTablePool.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (HBASE-4054) Usability improvement to HTablePool

Posted by "Daniel Iancu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Iancu updated HBASE-4054:
--------------------------------

    Attachment:     (was: HBASE-4054_Usability_improvement_to_HTablePool1.patch)

> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-4054) Usability improvement to HTablePool

Posted by "Ted Yu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13059476#comment-13059476 ] 

Ted Yu commented on HBASE-4054:
-------------------------------

@Daniel:
The comment below is not true considering that it is called by putTable() as well:
{code}
+    /**
+     * Expose the wrapped HTable only for testing purposes
+     *
+     * @return wrapped htable
+     */
+    HTableInterface getWrappedTable() {
{code}


> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>         Attachments: HBASE-4054_Usability_improvement_to_HTablePool.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-4054) Usability improvement to HTablePool

Posted by "Daniel Iancu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13059493#comment-13059493 ] 

Daniel Iancu commented on HBASE-4054:
-------------------------------------

Is the patch based on trunk still required ? I saw the trunk version having coprocessors methods introduced so I didn't know if I can patch it but I can try again.

> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>         Attachments: HBASE-4054_Usability_improvement_to_HTablePool.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-4054) Usability improvement to HTablePool

Posted by "Ted Yu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13061756#comment-13061756 ] 

Ted Yu commented on HBASE-4054:
-------------------------------

There were tests broken by this JIRA.
For TestRemoteTable:
{noformat}
Jul 7, 2011 11:06:01 PM com.sun.jersey.spi.container.ContainerResponse mapMappableContainerException
SEVERE: The RuntimeException could not be mapped to a response, re-throwing to the HTTP container

java.lang.ClassCastException: org.apache.hadoop.hbase.client.HTablePool$PooledHTable cannot be cast to org.apache.hadoop.hbase.client.HTable
	at org.apache.hadoop.hbase.rest.RowResource.update(RowResource.java:162)
	at org.apache.hadoop.hbase.rest.RowResource.put(RowResource.java:289)
{noformat}

And TestTableResource.testTableInfoText():
{noformat}
    2011-07-07 17:58:45,139 ERROR [318977678@qtp-1052953772-1] log.Slf4jLog(87): /TestTableResource/regions
    java.lang.ClassCastException: org.apache.hadoop.hbase.client.HTablePool$PooledHTable cannot be cast to org.apache.hadoop.hbase.client.HTable
        at org.apache.hadoop.hbase.rest.RegionsResource.getTableRegions(RegionsResource.java:75)
        at org.apache.hadoop.hbase.rest.RegionsResource.get(RegionsResource.java:91)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
{noformat}

The attached addendum fixes the above two tests.

> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>         Attachments: HBASE-4054_Usability_improvement_to_HTablePool-trunk.patch, HBASE-4054_Usability_improvement_to_HTablePool.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (HBASE-4054) Usability improvement to HTablePool

Posted by "Daniel Iancu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Iancu updated HBASE-4054:
--------------------------------

    Attachment:     (was: HBASE-4054_Usability_improvement_to_HTablePool.patch)

> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-4054) Usability improvement to HTablePool

Posted by "stack (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13063723#comment-13063723 ] 

stack commented on HBASE-4054:
------------------------------

Your test passes for you Daniel?  Its hanging for me.

> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>         Attachments: 4054.addendum, HBASE-4054_Usability_improvement_to_HTablePool-trunk.patch, HBASE-4054_Usability_improvement_to_HTablePool.patch, TestHTablePool-trunk.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (HBASE-4054) Usability improvement to HTablePool

Posted by "Daniel Iancu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Iancu updated HBASE-4054:
--------------------------------

    Status: Patch Available  (was: Open)

> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>         Attachments: HBASE-4054_Usability_improvement_to_HTablePool.patch
>
>
> Hi
> It look like the usage of HTablePool might be improved. Now, once you 
> get the connection from pool you must take good care to return it by 
> calling  HTablePool.putTable(table);
> If you close the table  (say, you don't read carefully the Javadoc)  
> your htable will not be reused.
> Other case might be if you build a Datasource like object to obtain 
> HTables and, in this case, from the client you don't have a reference to 
> the pool to return the table once done with it.
> I've fixed all this by subclassing the HTablePool and overriding the  
> getTable method
> public class HTablePoolEnhanced extends HTablePool
>     @Override
>      public HTableInterface getTable(String tableName) {
>          return new PooledHTable(super.getTable(tableName));
>      }
>   where  PooledHTable is a inner class that wraps a HTable and 
> reimplements the close method to return the table to pool
>   public class PooledHTable implements HTableInterface {
>          private HTableInterface table;
>          public PooledHTable(HTableInterface table) {
>              this.table = table;
>          }
>         @Override
>          public void close() throws IOException {
>              putTable(table);
>          }
>   ...
> }
> }
> Does it make sense to have this implementation in Hbase also ? It look 
> that all it needs is to have a new HTableInterfaceFactory implementation 
> to create some proxy tables like i did.
> Regards
> Daniel

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-4054) Usability improvement to HTablePool

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13061797#comment-13061797 ] 

Hudson commented on HBASE-4054:
-------------------------------

Integrated in HBase-TRUNK #2014 (See [https://builds.apache.org/job/HBase-TRUNK/2014/])
    HBASE-4054 extending HTable because HTableInterface does not include
           getRegionInfos and setAutoFlush

tedyu : 
Files : 
* /hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HTablePool.java


> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>         Attachments: 4054.addendum, HBASE-4054_Usability_improvement_to_HTablePool-trunk.patch, HBASE-4054_Usability_improvement_to_HTablePool.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-4054) Usability improvement to HTablePool

Posted by "stack (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13063724#comment-13063724 ] 

stack commented on HBASE-4054:
------------------------------

Oh, I tried it on TRUNK.

> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>         Attachments: 4054.addendum, HBASE-4054_Usability_improvement_to_HTablePool-trunk.patch, HBASE-4054_Usability_improvement_to_HTablePool.patch, TestHTablePool-trunk.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-4054) Usability improvement to HTablePool

Posted by "stack (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13061617#comment-13061617 ] 

stack commented on HBASE-4054:
------------------------------

Patch looks great.  I think this new form better than previous where we added a new class.  I'll fix the usage doc (talks about put to return the table to the pool... when you want them to call close instead) and then commit.

For the future Daniel, bulk of your patch are gratuitous changes of the type below:

{code}
-   * Get a reference to the specified table from the pool.<p>
-   *
-   * Create a new one if one is not available.
-   * @param tableName table name
+   * Get a reference to the specified table from the pool.
+   * <p>
+   * <p/>
+   * 
+   * @param tableName
+   *          table name
{code}

i.e. no change of substance, just change in formatting.  Leave these out of your patches going forward I'd say.



> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>         Attachments: HBASE-4054_Usability_improvement_to_HTablePool-trunk.patch, HBASE-4054_Usability_improvement_to_HTablePool.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-4054) Usability improvement to HTablePool

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13064058#comment-13064058 ] 

Hudson commented on HBASE-4054:
-------------------------------

Integrated in HBase-TRUNK #2020 (See [https://builds.apache.org/job/HBase-TRUNK/2020/])
    HBASE-4054 Usability improvement to HTablePool

stack : 
Files : 
* /hbase/trunk/src/test/java/org/apache/hadoop/hbase/client/TestHTablePool.java


> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>             Fix For: 0.92.0
>
>         Attachments: 4054.addendum, HBASE-4054_Usability_improvement_to_HTablePool-trunk.patch, HBASE-4054_Usability_improvement_to_HTablePool.patch, TestHTablePool-trunk.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (HBASE-4054) Usability improvement to HTablePool

Posted by "Daniel Iancu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Iancu updated HBASE-4054:
--------------------------------

    Attachment: HBASE-4054_Usability_improvement_to_HTablePool.patch

> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>         Attachments: HBASE-4054_Usability_improvement_to_HTablePool.patch
>
>
> Hi
> It look like the usage of HTablePool might be improved. Now, once you 
> get the connection from pool you must take good care to return it by 
> calling  HTablePool.putTable(table);
> If you close the table  (say, you don't read carefully the Javadoc)  
> your htable will not be reused.
> Other case might be if you build a Datasource like object to obtain 
> HTables and, in this case, from the client you don't have a reference to 
> the pool to return the table once done with it.
> I've fixed all this by subclassing the HTablePool and overriding the  
> getTable method
> public class HTablePoolEnhanced extends HTablePool
>     @Override
>      public HTableInterface getTable(String tableName) {
>          return new PooledHTable(super.getTable(tableName));
>      }
>   where  PooledHTable is a inner class that wraps a HTable and 
> reimplements the close method to return the table to pool
>   public class PooledHTable implements HTableInterface {
>          private HTableInterface table;
>          public PooledHTable(HTableInterface table) {
>              this.table = table;
>          }
>         @Override
>          public void close() throws IOException {
>              putTable(table);
>          }
>   ...
> }
> }
> Does it make sense to have this implementation in Hbase also ? It look 
> that all it needs is to have a new HTableInterfaceFactory implementation 
> to create some proxy tables like i did.
> Regards
> Daniel

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-4054) Usability improvement to HTablePool

Posted by "Daniel Iancu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13058638#comment-13058638 ] 

Daniel Iancu commented on HBASE-4054:
-------------------------------------

correction: This way you are sure that nobody puts back a HTableImplementation other then the one it got from pool

> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>         Attachments: HBASE-4054_Usability_improvement_to_HTablePool.patch
>
>
> Hi
> It look like the usage of HTablePool might be improved. Now, once you 
> get the connection from pool you must take good care to return it by 
> calling  HTablePool.putTable(table);
> If you close the table  (say, you don't read carefully the Javadoc)  
> your htable will not be reused.
> Other case might be if you build a Datasource like object to obtain 
> HTables and, in this case, from the client you don't have a reference to 
> the pool to return the table once done with it.
> I've fixed all this by subclassing the HTablePool and overriding the  
> getTable method
> public class HTablePoolEnhanced extends HTablePool
>     @Override
>      public HTableInterface getTable(String tableName) {
>          return new PooledHTable(super.getTable(tableName));
>      }
>   where  PooledHTable is a inner class that wraps a HTable and 
> reimplements the close method to return the table to pool
>   public class PooledHTable implements HTableInterface {
>          private HTableInterface table;
>          public PooledHTable(HTableInterface table) {
>              this.table = table;
>          }
>         @Override
>          public void close() throws IOException {
>              putTable(table);
>          }
>   ...
> }
> }
> Does it make sense to have this implementation in Hbase also ? It look 
> that all it needs is to have a new HTableInterfaceFactory implementation 
> to create some proxy tables like i did.
> Regards
> Daniel

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-4054) Usability improvement to HTablePool

Posted by "Daniel Iancu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13059488#comment-13059488 ] 

Daniel Iancu commented on HBASE-4054:
-------------------------------------

I meant the wrapped table is not exposed outside package, rather it is used internally or for testing purposes. The putTable can access the wrapped htable even if the method is private but not the tests.

> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>         Attachments: HBASE-4054_Usability_improvement_to_HTablePool.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-4054) Usability improvement to HTablePool

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13448334#comment-13448334 ] 

Hudson commented on HBASE-4054:
-------------------------------

Integrated in HBase-0.94-security-on-Hadoop-23 #7 (See [https://builds.apache.org/job/HBase-0.94-security-on-Hadoop-23/7/])
    HBASE-6471 Performance regression caused by HBASE-4054 (Revision 1373916)

     Result = FAILURE
jxiang : 
Files : 
* /hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/client/HTablePool.java
* /hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/rest/RegionsResource.java
* /hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/client/TestHTablePool.java

                
> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Assignee: Daniel Iancu
>            Priority: Minor
>             Fix For: 0.92.0
>
>         Attachments: 4054.addendum, HBASE-4054_Usability_improvement_to_HTablePool.patch, HBASE-4054_Usability_improvement_to_HTablePool-trunk.patch, TestHTablePool-trunk.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

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

[jira] [Commented] (HBASE-4054) Usability improvement to HTablePool

Posted by "Ted Yu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13059472#comment-13059472 ] 

Ted Yu commented on HBASE-4054:
-------------------------------

Can you provide a patch that is based off TRUNK ?
{noformat}
patching file src/main/java/org/apache/hadoop/hbase/client/HTablePool.java
Hunk #1 FAILED at 19.
Hunk #2 succeeded at 65 with fuzz 1 (offset 1 line).
Hunk #3 FAILED at 79.
Hunk #4 FAILED at 201.
Hunk #5 FAILED at 229.
4 out of 5 hunks FAILED -- saving rejects to file src/main/java/org/apache/hadoop/hbase/client/HTablePool.java.rej
patching file src/test/java/org/apache/hadoop/hbase/client/TestHTablePool.java
Reversed (or previously applied) patch detected!  Assume -R? [n] 
{noformat}

> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>         Attachments: HBASE-4054_Usability_improvement_to_HTablePool.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-4054) Usability improvement to HTablePool

Posted by "Daniel Iancu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13063777#comment-13063777 ] 

Daniel Iancu commented on HBASE-4054:
-------------------------------------

yes, I run them again this morning with the latest updates from svn and they all have passed. That test is not different from the others so I suspect an issue with the minicluster?  

> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>         Attachments: 4054.addendum, HBASE-4054_Usability_improvement_to_HTablePool-trunk.patch, HBASE-4054_Usability_improvement_to_HTablePool.patch, TestHTablePool-trunk.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-4054) Usability improvement to HTablePool

Posted by "stack (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13061774#comment-13061774 ] 

stack commented on HBASE-4054:
------------------------------

+1 on your patch Ted (I cannot solve the getRegionInfos failures going my route).  On commit, please add commentary that extending HTable is a hack until we fix HTableInterface to include getRegionInfos (or its equiv since this is now deprecated) and setAutoFlush.

> Usability improvement to HTablePool
> -----------------------------------
>
>                 Key: HBASE-4054
>                 URL: https://issues.apache.org/jira/browse/HBASE-4054
>             Project: HBase
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.90.3
>            Reporter: Daniel Iancu
>            Priority: Minor
>         Attachments: 4054.addendum, HBASE-4054_Usability_improvement_to_HTablePool-trunk.patch, HBASE-4054_Usability_improvement_to_HTablePool.patch
>
>
> To improve the usability of the HTablePool the implementation should not rely on the user returning the connection to the pool but rather do that transparently when user closes the HTableImplementation it got.
>  
> To do that a HTableImplementation proxy implementation should be returned that wraps a HTable object and holds a reference to the pool. When the client close the proxy it will actually automatically return the wrapped HTable back in pool to be reused. In this case the method HTablePool.putTable don't need to be public

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira