Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
HBase, mail # user - RowLocks


+
Kristoffer Sjögren 2013-08-28, 22:14
+
Ted Yu 2013-08-28, 22:18
+
Kristoffer Sjögren 2013-08-28, 22:30
+
Chris Perluss 2013-08-29, 02:54
+
Jean-Marc Spaggiari 2013-08-28, 22:26
+
Michael Segel 2013-08-29, 02:58
+
Ted Yu 2013-08-29, 03:01
+
lars hofhansl 2013-08-29, 04:22
Copy link to this message
-
Re: RowLocks
Kristoffer Sjögren 2013-08-29, 06:34
Maybe I should illustrate with a specific usecase.

I want to create a unique row with a rowkey that look like this:
id+timestamp

The timestamp (in millis) is provided by the user. It is ONLY the id that
dictate uniqueness, not the timestamp. So there is a race condition here.

My reasoning is as follows.

1) Lock the id (without the timestamp).

2.1) If the lock was aquired. Scan for the row.
2.2) If the row was not found, create it and set a counter on the
id+timestamp row to 0.
2.3) If the row is found, increase a counter on the id+timestamp row.
2.4) Release the lock.

If the lock was NOT aquired.

3.1) Not really sure how to proceed here. The easiest way is probably to
wait until the lock is released (like a SELECT FOR UPDATE). Retries would
also work.

It is very important that we do not loose the increments or create multiple
rows with same id with different timestamps when there are race conditions.

On Thu, Aug 29, 2013 at 6:22 AM, lars hofhansl <[EMAIL PROTECTED]> wrote:

> Specifically the API has been removed because it had never actually worked
> correctly.
>
>
> Rowlocks are used by RegionServers for intra-region operations.
> As such they are ephemeral, in-memory constructs, that cannot reliably
> outlive a single RPC request.
> The HTable rowlock API allowed you to create a rowlocks and hold it over
> multiple RPCs, which would break if f.e. a region is moved or split.
>
> -- Lars
> ________________________________
> From: Ted Yu <[EMAIL PROTECTED]>
> To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> Sent: Wednesday, August 28, 2013 8:01 PM
> Subject: Re: RowLocks
>
>
> The API is no longer a public API
>
> Thanks
>
>
> On Wed, Aug 28, 2013 at 7:58 PM, Michael Segel <[EMAIL PROTECTED]
> >wrote:
>
> > Ted,
> > Can you clarify...
> > Do you mean the API is no longer a public API, or do you mean no more RLL
> > for atomic writes?
> >
> > On Aug 28, 2013, at 5:18 PM, Ted Yu <[EMAIL PROTECTED]> wrote:
> >
> > > RowLock API has been removed in 0.96.
> > >
> > > Can you tell us your use case ?
> > >
> > >
> > > On Wed, Aug 28, 2013 at 3:14 PM, Kristoffer Sjögren <[EMAIL PROTECTED]
> > >wrote:
> > >
> > >> Hi
> > >>
> > >> About the internals of locking a row in hbase.
> > >>
> > >> Does hbase row locks map one-to-one with a locks in zookeeper or are
> > there
> > >> any optimizations based on the fact that a row only exist on a single
> > >> machine?
> > >>
> > >> Cheers,
> > >> -Kristoffer
> > >>
> >
> > The opinions expressed here are mine, while they may reflect a cognitive
> > thought, that is purely accidental.
> > Use at your own risk.
> > Michael Segel
> > michael_segel (AT) hotmail.com
> >
> >
> >
> >
> >
> >
>
+
Michael Segel 2013-08-29, 11:45