Review Board 1.7.22

HBASE-4460 Support running an embedded ThriftServer within a RegionServer

Review Request #2410 - Created Oct. 17, 2011 and updated

Jonathan Gray
apurtell, dhruba, ghelmling, stack
Rather than a separate process, it can be advantageous in some situations for each RegionServer to embed their own ThriftServer. This allows each embedded ThriftServer to short-circuit any queries that should be executed on the local RS and skip the extra hop. This then enables the building of fat Thrift clients that cache region locations and avoid extra hops all together.
Running this already on our hbase-92-based branch and running test site.
Posted (Oct. 18, 2011, 4:47 a.m.)
This makes much more sense than having to run a separate thrift server.
I think we're no longer supposed to put the copyright notice with year in, but just the license grant.
I wish there'd be a more lightweight way to do this. I know these are cached in BaseHandler, but each HTable will have it's ThreadPoolExecutor, etc, and having these "inside" RegionServer just to get the regionname seems wasteful.
In fact this will establish another request to the same regionserver again, if it wasn't in the cache.

On the other hand I don't see an easy way to avoid this...
Maybe the RegionServer itself could provide a facility to find a region it manages by table/row, but that different from how HBae operates normally... (for another jira)
Posted (Oct. 20, 2011, 12:34 a.m.)
Looks good to me, one minor nit... +1
  1. Thanks for reviews guys.  I'm going to file a follow-up JIRA to deal with your comments (cleanup and optimize).
Just a code-readability comment - could we structure as:

Get get = new Get(row);
get.setTimeRange(Long.MIN_VALUE, timestamp);

if (columns != null) {
  // ...

Result result = rs.get(regionName, get);
return ThriftUtilities.rowResultFromHBase(result);