You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by jeremy p <at...@gmail.com> on 2014/03/13 23:39:45 UTC

How to pass multiple operations to HBase and be guaranteed of execution order

Hello all,

The documentation for htable.batch() warns us :

"The execution ordering of the actions is not defined. Meaning if you do a
Put and a Get in the same batch() call, you will not necessarily be
guaranteed that the Get returns what the Put had put."

Is there a way to pass multiple get() and put() calls to HBase and be
guaranteed that they will be executed in the order that you provide?

--Jeremy

Re: 答复: How to pass multiple operations to HBase and be guaranteed of execution order

Posted by jeremy p <at...@gmail.com>.
Thanks for the info.  I was hoping to batch my get and put calls for
greater efficiency, but this operation requires them to be run in order.
 Sounds like batching is not an option.

--Jeremy


On Fri, Mar 14, 2014 at 2:16 AM, 冯宏华 <fe...@xiaomi.com> wrote:

> your understanding of batch is correct, multiple put() and get() against a
> same region in a single batch() operation will be executed as multiple sub
> steps, all operations on the same region are iterated one by one, the get()
> will be executed immediately and serially, while the put() will be
> accumulated as iterated first(batched and delayed) and then executed in a
> batch fashion after all mutations are collected, so you can assume the
> get() always can't get the result of put() in the same batch()...
>
> IMHO, seems the only way to guarantee multiple get() and put() be executed
> in the order you provide is to execute them serially where the latter is
> always issued after the former is returned successfully.
> ________________________________________
> 发件人: jeremy p [athomewithagroovebox@gmail.com]
> 发送时间: 2014年3月14日 6:39
> 收件人: user@hbase.apache.org
> 主题: How to pass multiple operations to HBase and be guaranteed of
> execution order
>
> Hello all,
>
> The documentation for htable.batch() warns us :
>
> "The execution ordering of the actions is not defined. Meaning if you do a
> Put and a Get in the same batch() call, you will not necessarily be
> guaranteed that the Get returns what the Put had put."
>
> Is there a way to pass multiple get() and put() calls to HBase and be
> guaranteed that they will be executed in the order that you provide?
>
> --Jeremy
>

答复: How to pass multiple operations to HBase and be guaranteed of execution order

Posted by 冯宏华 <fe...@xiaomi.com>.
your understanding of batch is correct, multiple put() and get() against a same region in a single batch() operation will be executed as multiple sub steps, all operations on the same region are iterated one by one, the get() will be executed immediately and serially, while the put() will be accumulated as iterated first(batched and delayed) and then executed in a batch fashion after all mutations are collected, so you can assume the get() always can't get the result of put() in the same batch()...

IMHO, seems the only way to guarantee multiple get() and put() be executed in the order you provide is to execute them serially where the latter is always issued after the former is returned successfully.
________________________________________
发件人: jeremy p [athomewithagroovebox@gmail.com]
发送时间: 2014年3月14日 6:39
收件人: user@hbase.apache.org
主题: How to pass multiple operations to HBase and be guaranteed of execution order

Hello all,

The documentation for htable.batch() warns us :

"The execution ordering of the actions is not defined. Meaning if you do a
Put and a Get in the same batch() call, you will not necessarily be
guaranteed that the Get returns what the Put had put."

Is there a way to pass multiple get() and put() calls to HBase and be
guaranteed that they will be executed in the order that you provide?

--Jeremy