You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by JinChao Wen <we...@gmail.com> on 2011/02/01 01:48:06 UTC
Re: How the batch operations are implemented in HBase?
as far as i know, there is no concept of transaction in hbase.
you can do this.
try{
htable1.put( putList1);
htable2.put( putList2)
}
catch(IOException ioe )
{
//rollback by yourself
}
catch(Exception e)
{
// do something
}
finally{
// return resource
}
2011/1/31 Jim X <ji...@gmail.com>
> For one table, I can implement it like:
> HTable htable = ...;
> List<Put> list = getPuts();
> htable.setAutoFlush(true);
> htable.put(list);
> htable.flushCommits();
>
> If my batch comes across multiple tables, how do I implement it in one
> transaction?
>
> Jim
>
> On Sun, Jan 30, 2011 at 11:33 PM, Jim X <ji...@gmail.com> wrote:
> > Thanks. Yes. This is what I want to know.
> >
> > On Sun, Jan 30, 2011 at 11:10 PM, JinChao Wen <we...@gmail.com>
> wrote:
> >> see htable.put(List<Put> put)
> >>
> >> if you set autoFlush=true, or number of puts you add to htable is exceed
> the
> >> writeBufferSize of htable.
> >> The puts will be flushed.
> >>
> >>
> >>
> >> 2011/1/31 Jim X <ji...@gmail.com>
> >>
> >>> Hi, HBase users,
> >>>
> >>> JDBC provides batch operation API. I am assigned to convert a
> >>> JDBC batch implementation into HBase. Does HBase provide some APIs
> >>> like PreparedStatement.addBatch() in JDBC? How do I implement HBase
> >>> batch process in one transaction?
> >>>
> >>>
> >>> Jim
> >>>
> >>
> >
>