hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yura Taras <yura.ta...@gmail.com>
Subject Sequental put/get/delete don't work
Date Mon, 01 Mar 2010 19:44:12 GMT
Hi all

I'm learning HBase and I faced a following problem. I'm running HBase
0.20.3 on Windows+Cygwin (just bin/start-hbase.sh). I'm creating
simple table in a shell:
hbase(main):033:0> create 't1', 'f1'
0 row(s) in 2.0630 seconds

Then I'm trying to execute following JUnit test - and it fails on last
assert. Literally - it inserts a value, deletes a row and inserts
value to same id again. When it tries to Get data for given row, null
is returned. When I try to rerun test again, it fails on first assert.
To fix it I have to run 'truncate 't1'' in my shell.
I can't believe there's a bug in such straightforward use case, so
either I do something wrong in a code or there's a problem with my

JUnit test:
    public void sequentUses() throws IOException {
        HTable table = pool.getTable("t1");
        try {
            Put put = new Put("row-id".getBytes());
            put.add("f1".getBytes(), "c1".getBytes(), 1L, "v1".getBytes());

            Get get = new Get("row-id".getBytes());
            Result res = table.get(get);
            table.delete(new Delete("row-id".getBytes()));

            put = new Put("row-id".getBytes());
            put.add("f1".getBytes(), "c1".getBytes(), 1L, "v2".getBytes());

            res = table.get(get);
        } finally {

View raw message