Issue Details (XML | Word | Printable)

Key: NUCHBASE-79
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: nicolas
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
DataNucleus Store HBase

HBaseManagedConnection.getHTable(HBaseManagedConnection.java:68) generates ClassCastException after introduction of HTablePool

Created: 30/Jan/13 09:44 AM   Updated: 01/Feb/13 07:42 AM   Resolved: 30/Jan/13 03:22 PM
Component/s: Persistence
Affects Version/s: 3.2.0.m2
Fix Version/s: 3.2.0.m3

File Attachments: 1. Text File Replace_HTable_by_HTableInterface.patch (11 kB)

Environment: Linux, JDK 7, standard Java SE


 Description  « Hide
When trying to access the HTablePool, the following exception is thrown:
java.lang.ClassCastException: org.apache.hadoop.hbase.client.HTablePool$PooledHTable cannot be cast to org.apache.hadoop.hbase.client.HTable
at org.datanucleus.store.hbase.HBaseManagedConnection.getHTable(HBaseManagedConnection.java:68)
at org.datanucleus.store.hbase.HBasePersistenceHandler.insertObject(HBasePersistenceHandler.java:116)
at org.datanucleus.state.JDOStateManager.internalMakePersistent(JDOStateManager.java:2347)

This is due to the introduction of HTablePool, the return is an PooledHTable instance and not an HTable.

HTablePool has the following signature:
HTableInterface getTable(java.lang.String tableName)

Replacing instances of HTable by HTableInterface seems to do the trick.

Sort Order: Ascending order - Click to sort in descending order
nicolas added a comment - 30/Jan/13 09:45 AM
The fix.

nicolas added a comment - 30/Jan/13 09:58 AM
Test report with patch:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running org.datanucleus.tests.ApplicationIdPersistenceTest
Tests run: 9, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 68.295 sec
Running org.datanucleus.tests.BasicTest
Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.164 sec
Running org.datanucleus.tests.DatastoreIdPersistenceTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 22.19 sec
Running org.datanucleus.tests.EmbeddedTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.54 sec
Running org.datanucleus.tests.JDOQLTest
Tests run: 11, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.228 sec
Running org.datanucleus.tests.MetaDataExtensionTest
Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.333 sec
Running org.datanucleus.tests.ValueGeneratorTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 7.451 sec

Results :

Tests run: 37, Failures: 0, Errors: 0, Skipped: 0

Andy Jefferson added a comment - 30/Jan/13 03:22 PM
SVN trunk has this now. Thx. Note that the tests all passed for me before and after, so only came up dependent on the config of HBase; using interface for HTable makes sense anyway