hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julien Ruchaud <julien.ruch...@codelutin.com>
Subject Re: Test fail randomly
Date Fri, 09 Oct 2009 15:35:53 GMT
Hi,

If hbase.zookeeper.property.maxClientCnxns increase to 300, the test
pass. So I test the second solution to close connection each put, get
and delete, the test pass too. How do you know when to close
connection ? each get, delete or put ? is it better to instanciate a
new HTable each time ?

Thanks

Julien Ruchaud

Le Fri, 9 Oct 2009 11:07:55 -0400,
Jean-Daniel Cryans <jdcryans@apache.org> a écrit :

> Julien,
> 
> This is a Zookeeper error that can be related to the number of
> connections a ZK server can handle. To verify, set
> hbase.zookeeper.property.maxClientCnxns to something a lot bigger than
> the default 30 and restart HBase.
> 
> This could happen because  you run a lot of unit tests sequentially
> without closing the connections.
> 
> J-D
> 
> On Fri, Oct 9, 2009 at 10:53 AM, Julien Ruchaud
> <julien.ruchaud@codelutin.com> wrote:
> > Hi,
> >
> > I am a newbie on hbase. Currently I am testing hbase 0.20.0, but I
> > don't understand why my test don't run correctly sometimes :
> >
> >    public void testLoop() throws Exception {
> >        HTable hTable = new HTable(new HBaseConfiguration(),
> > Bytes.toBytes("Table")); byte[] rowId = Bytes.toBytes("Test");
> >
> >        for (int j = 0; j < 10; j++) {
> >            Put put = new Put(rowId);
> >            put.add(Bytes.toBytes("data"), Bytes.toBytes("1:" + j),
> > Bytes.toBytes(j)); hTable.put(put);
> >        }
> >
> >        for (int j = 0; j < 10; j++) {
> >            Get get = new Get(rowId);
> >            Result row = hTable.get(get);
> >            if(row.getValue(Bytes.toBytes("data"),
> > Bytes.toBytes("1:" + j)) == null) { throw new Exception("Error 1");
> >            }
> >        }
> >
> >        for (int j = 0; j < 10; j++) {
> >                Delete delete = new Delete(rowId);
> >                hTable.delete(delete);
> >        }
> >
> >        for (int j = 0; j < 10; j++) {
> >            Put put = new Put(rowId);
> >            put.add(Bytes.toBytes("data"), Bytes.toBytes("2:" + j),
> > Bytes.toBytes(j)); hTable.put(put);
> >        }
> >
> >        for (int j = 0; j < 10; j++) {
> >            Get get = new Get(rowId);
> >            Result row = hTable.get(get);
> >            if(row.getValue(Bytes.toBytes("data"),
> > Bytes.toBytes("2:" + j)) == null) { throw new Exception("Error 2");
> >            }
> >        }
> >    }
> >
> > In fact I have got exception "Error 2" with a exception in hbase
> > log :
> >
> > 2009-10-09 16:39:34,829 WARN
> > org.apache.zookeeper.server.NIOServerCnxn: Exception causing close
> > of session 0x124393fc5390046 due to java.io.IOException: Read error
> > 2009-10-09 16:39:34,829 DEBUG
> > org.apache.zookeeper.server.NIOServerCnxn: IOException stack trace
> > java.io.IOException: Read error at
> > org.apache.zookeeper.server.NIOServerCnxn.doIO(NIOServerCnxn.java:366)
> > at
> > org.apache.zookeeper.server.NIOServerCnxn$Factory.run(NIOServerCnxn.java:220)
> > 2009-10-09 16:39:34,830 INFO
> > org.apache.zookeeper.server.NIOServerCnxn: closing
> > session:0x124393fc5390046 NIOServerCnxn:
> > java.nio.channels.SocketChannel[connected local=/127.0.0.1:2181
> > remote=/127.0.0.1:48870] 2009-10-09 16:39:34,830 DEBUG
> > org.apache.zookeeper.server.NIOServerCnxn: ignoring exception
> > during input shutdown java.net.SocketException: Transport endpoint
> > is not connected at sun.nio.ch.SocketChannelImpl.shutdown(Native
> > Method) at
> > sun.nio.ch.SocketChannelImpl.shutdownInput(SocketChannelImpl.java:640)
> > at sun.nio.ch.SocketAdaptor.shutdownInput(SocketAdaptor.java:360)
> > at
> > org.apache.zookeeper.server.NIOServerCnxn.close(NIOServerCnxn.java:841)
> > at
> > org.apache.zookeeper.server.NIOServerCnxn.doIO(NIOServerCnxn.java:492)
> > at
> > org.apache.zookeeper.server.NIOServerCnxn$Factory.run(NIOServerCnxn.java:220)
> >
> > Thanks in advance for your input
> >
> > Julien Ruchaud
> >

Mime
View raw message