HBASE-4696 HRegionThriftServer' might have to indefinitely do redirtects (jgray)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1196254 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Gray 2011-11-01 20:14:42 +00:00
parent d8516489ff
commit 8e2dea1eb4
2 changed files with 16 additions and 3 deletions

View File

@ -29,6 +29,7 @@ Release 0.93.0 - Unreleased
HBASE-4691 Remove more unnecessary byte[] copies from KeyValues (Lars H)
HBASE-4669 Add an option of using round-robin assignment for enabling table
(Jieshan Bean)
HBASE-4696 HRegionThriftServer' might have to indefinitely do redirtects (jgray)
BUG FIXES
HBASE-4488 Store could miss rows during flush (Lars H via jgray)

View File

@ -77,6 +77,12 @@ public class HRegionThriftServer extends Thread {
private String protocol;
volatile private TServer tserver;
/**
* Whether requests should be redirected to other RegionServers if the
* specified region is not hosted by this RegionServer.
*/
private boolean redirect;
/**
* Create an instance of the glue object that connects the
* RegionServer with the standard ThriftServer implementation
@ -113,7 +119,7 @@ public class HRegionThriftServer extends Thread {
byte [] row = rowb.array();
HTable table = getTable(tableName.array());
HRegionLocation location = table.getRegionLocation(row);
byte[] regionName = location.getRegionInfo().getEncodedNameAsBytes();
byte[] regionName = location.getRegionInfo().getRegionName();
if (columns == null) {
Get get = new Get(row);
@ -136,7 +142,10 @@ public class HRegionThriftServer extends Thread {
Result result = rs.get(regionName, get);
return ThriftUtilities.rowResultFromHBase(result);
} catch (NotServingRegionException e) {
LOG.info("ThriftServer redirecting getRowWithColumnsTs");
if (!redirect) {
throw new IOError(e.getMessage());
}
LOG.debug("ThriftServer redirecting getRowWithColumnsTs");
return super.getRowWithColumnsTs(tableName, rowb, columns, timestamp);
} catch (IOException e) {
throw new IOError(e.getMessage());
@ -155,6 +164,8 @@ public class HRegionThriftServer extends Thread {
this.transport = conf.get("hbase.regionserver.thrift.transport");
this.nonblocking = conf.getBoolean("hbase.regionserver.thrift.nonblocking",
false);
this.redirect = conf.getBoolean("hbase.regionserver.thrift.redirect",
false);
}
/**
@ -171,7 +182,8 @@ public class HRegionThriftServer extends Thread {
public void run() {
try {
HBaseHandlerRegion handler = new HBaseHandlerRegion(this.conf);
Hbase.Processor processor = new Hbase.Processor(handler);
Hbase.Processor<HBaseHandlerRegion> processor =
new Hbase.Processor<HBaseHandlerRegion>(handler);
TProtocolFactory protocolFactory;
if (this.protocol != null && this.protocol.equals("compact")) {