hbase-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Daniel Cryans <jdcry...@apache.org>
Subject Heads up! New locking in HRegion
Date Mon, 23 Aug 2010 23:17:14 GMT
Hackers,

I just committed HBASE-2915 which is a rework of the locking story
inside HRegion that fixes a couple of deadlocks. Some issues may
remain, so have your jstacks ready in case some weirdness happens (and
yes, we need another run of jcarder).

Some details for those interested:

We used to have a couple of locks in HRegion: split, newScanner, and
splitsAndCloses. Stack removed the first, and I merged the two others
into one called "lock" (crazy name, I know). It is now required that
every operation that comes from the user (put, get, icv, etc) be
enclosed in this pattern:

startRegionOperation();
try {
  // nifty code
} finally {
  closeRegionOperation();
}

It will take care of checking if the region is closing before trying
to get a readLock (bonus is that it won't be occupying handlers) and
then it will check if the region was closed while we were waiting to
acquire the lock. In both cases, it'll throw a NSRE if the region is
closing/closed. For flush/compact, the handling is different as we
don't expect to see NSREs... although that could be refactored at some
point I guess. Split and close are the only operations that are
permitted to take a writeLock.

Now let's cut another 0.89!

J-D

Mime
View raw message