You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by hongbin ma <ma...@apache.org> on 2015/11/17 09:07:28 UTC

isolation level of put and scan

hi,experts:

i have two concurrent threads to read/write same the same htable row.
this row has two columns A and B.

Currently this rows value is (A:a1, B:b1)
thread 1 wants to read the value of this row's column value for A, B
and thread 2 wants to update this row to (A:a2, B:b2)

if thread 1,2 happens at the same time, is it possible that thread 1 gets
(A:a1 B:b2) or (A:a2 B:b1) ?

I'm asking this because this document
https://hbase.apache.org/acid-semantics.html describes  hbase's isolation
level as "read committed", and "read committed" may not prevent the above
scenario.
​
Will the answer vary if A,B are of the same column family or not?
and will checkAndPut help here?

thanks in advance.​

-- 
Regards,

*Bin Mahone | 马洪宾*
Apache Kylin: http://kylin.io
Github: https://github.com/binmahone

Re: isolation level of put and scan

Posted by Heng Chen <he...@gmail.com>.
Oh, it will never happen.

Each put will acquire row lock to guarantee consistency.

2015-11-17 16:20 GMT+08:00 hongbin ma <ma...@apache.org>:

> i found a good article
> https://blogs.apache.org/hbase/entry/apache_hbase_internals_locking_and
> which seems to have answered my question.
>
> so the my described scenario will NEVER happen no matter whether A and B
> are in same column family? please kindly confirm
>
> thanks
>
> On Tue, Nov 17, 2015 at 4:07 PM, hongbin ma <ma...@apache.org> wrote:
>
> > hi,experts:
> >
> > i have two concurrent threads to read/write same the same htable row.
> > this row has two columns A and B.
> >
> > Currently this rows value is (A:a1, B:b1)
> > thread 1 wants to read the value of this row's column value for A, B
> > and thread 2 wants to update this row to (A:a2, B:b2)
> >
> > if thread 1,2 happens at the same time, is it possible that thread 1 gets
> > (A:a1 B:b2) or (A:a2 B:b1) ?
> >
> > I'm asking this because this document
> > https://hbase.apache.org/acid-semantics.html describes  hbase's
> isolation
> > level as "read committed", and "read committed" may not prevent the above
> > scenario.
> > ​
> > Will the answer vary if A,B are of the same column family or not?
> > and will checkAndPut help here?
> >
> > thanks in advance.​
> >
> > --
> > Regards,
> >
> > *Bin Mahone | 马洪宾*
> > Apache Kylin: http://kylin.io
> > Github: https://github.com/binmahone
> >
>
>
>
> --
> Regards,
>
> *Bin Mahone | 马洪宾*
> Apache Kylin: http://kylin.io
> Github: https://github.com/binmahone
>

Re: isolation level of put and scan

Posted by hongbin ma <ma...@apache.org>.
i found a good article
https://blogs.apache.org/hbase/entry/apache_hbase_internals_locking_and
which seems to have answered my question.

so the my described scenario will NEVER happen no matter whether A and B
are in same column family? please kindly confirm

thanks

On Tue, Nov 17, 2015 at 4:07 PM, hongbin ma <ma...@apache.org> wrote:

> hi,experts:
>
> i have two concurrent threads to read/write same the same htable row.
> this row has two columns A and B.
>
> Currently this rows value is (A:a1, B:b1)
> thread 1 wants to read the value of this row's column value for A, B
> and thread 2 wants to update this row to (A:a2, B:b2)
>
> if thread 1,2 happens at the same time, is it possible that thread 1 gets
> (A:a1 B:b2) or (A:a2 B:b1) ?
>
> I'm asking this because this document
> https://hbase.apache.org/acid-semantics.html describes  hbase's isolation
> level as "read committed", and "read committed" may not prevent the above
> scenario.
> ​
> Will the answer vary if A,B are of the same column family or not?
> and will checkAndPut help here?
>
> thanks in advance.​
>
> --
> Regards,
>
> *Bin Mahone | 马洪宾*
> Apache Kylin: http://kylin.io
> Github: https://github.com/binmahone
>



-- 
Regards,

*Bin Mahone | 马洪宾*
Apache Kylin: http://kylin.io
Github: https://github.com/binmahone