Keep in mind that a JDBC Connection is not thread safe. Make sure to use a separate Connection for each thread.
Thanks, James On Tue, Nov 1, 2016 at 9:29 AM, Shiva Krishna <[email protected]> wrote: > Hi Elser, > Thanks for the quick response. > > Below is the exception that being logged in some region servers. > In local it is working good when running in a distributed environment I > am getting the below exception. > Caused by: java.lang.AssertionError: we should never remove a different > context > at org.apache.hadoop.hbase.regionserver.HRegion$RowLockContext.cleanUp( > HRegion.java:5227) > at org.apache.hadoop.hbase.regionserver.HRegion$ > RowLockImpl.release(HRegion.java:5272) > at org.apache.phoenix.coprocessor.MetaDataEndpointImpl.doGetTable( > MetaDataEndpointImpl.java:2489) > at org.apache.phoenix.coprocessor.MetaDataEndpointImpl.doGetTable( > MetaDataEndpointImpl.java:2426) > at org.apache.phoenix.coprocessor.MetaDataEndpointImpl.getTable( > MetaDataEndpointImpl.java:451) > ... 10 more > > Phoenix : 4.7.0-HBase1.1 jar > HBase: 1.2.2 > > Cluster : 1 master 4 cores > > OS : Amazon EMR 5.0.0 > > Thanks, > Krishna. > > > On 01-Nov-2016, at 21:54, Josh Elser <[email protected]> wrote: > > > > (cc: -dev +user, bcc: +dev) > > > > Hi Krishna, > > > > Might you be able to share the stacktrace that accompanied that > Exception? > > > > Shiva Krishna wrote: > >> Hi All, > >> Can any one give me a small example of Phoenix upserts using Threads in > Java. > >> I wrote a sample it is working fine in local environment but when > running it cluster it is failing with below error. > >> java.lang.AssertionError: we should never remove a different context > >> > >> try(Connection conn = getConnection(); > >> PreparedStatement statement = conn.prepareStatement("upsert into > \”test\" values(?,?,?)");){ > >> statement.setString(1,”test1”); > >> statement.setString(2,”test2”); > >> statement.setString(3,”test3”); > >> statement.execute(); > >> conn.commit(); > >> }catch(SqlException ex) > >> { > >> ex.printStackTrace(); > >> } > >> Tried using both Threads and ForkJoins but getting the same exception > some times we are not able to predict or generalise when this exception is > occurring or how to resolve it. > >> > >> Thanks, > >> Krishna. > >
