HBASE-1693 NPE close_region .META. in shell
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@797851 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
247f508b8e
commit
64e7770cb7
|
@ -284,6 +284,7 @@ Release 0.20.0 - Unreleased
|
|||
defined types (Clint Morgan via Stack and Jon Gray)
|
||||
HBASE-1607 transactions / indexing fixes: trx deletes not handeled, index
|
||||
scan can't specify stopRow (Clint Morgan via Stack)
|
||||
HBASE-1693 NPE close_region ".META." in shell
|
||||
|
||||
IMPROVEMENTS
|
||||
HBASE-1089 Add count of regions on filesystem to master UI; add percentage
|
||||
|
|
15
bin/HBase.rb
15
bin/HBase.rb
|
@ -13,6 +13,8 @@ include_class('java.lang.Boolean') {|package,name| "J#{name}" }
|
|||
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin
|
||||
import org.apache.hadoop.hbase.client.HTable
|
||||
import org.apache.hadoop.hbase.client.Get
|
||||
import org.apache.hadoop.hbase.client.Put
|
||||
import org.apache.hadoop.hbase.client.Delete
|
||||
import org.apache.hadoop.hbase.HConstants
|
||||
import org.apache.hadoop.hbase.io.BatchUpdate
|
||||
|
@ -144,13 +146,16 @@ module HBase
|
|||
now = Time.now
|
||||
meta = HTable.new(HConstants::META_TABLE_NAME)
|
||||
bytes = Bytes.toBytes(regionName)
|
||||
hriBytes = meta.get(bytes, HConstants::COL_REGIONINFO).getValue()
|
||||
g = Get.new(bytes)
|
||||
g.addColumn(HConstants::CATALOG_FAMILY,
|
||||
HConstants::REGIONINFO_QUALIFIER)
|
||||
hriBytes = meta.get(g).value()
|
||||
hri = Writables.getWritable(hriBytes, HRegionInfo.new());
|
||||
hri.setOffline(onOrOff)
|
||||
p hri
|
||||
bu = BatchUpdate.new(bytes)
|
||||
bu.put(HConstants::COL_REGIONINFO, Writables.getBytes(hri))
|
||||
meta.commit(bu);
|
||||
put = Put.new(bytes)
|
||||
put.add(HConstants::CATALOG_FAMILY,
|
||||
HConstants::REGIONINFO_QUALIFIER, Writables.getBytes(hri))
|
||||
meta.put(put);
|
||||
@formatter.header()
|
||||
@formatter.footer(now)
|
||||
end
|
||||
|
|
|
@ -950,10 +950,8 @@ public class HMaster extends Thread implements HConstants, HMasterInterface,
|
|||
throws IOException {
|
||||
MetaRegion meta = this.regionManager.getMetaRegionForRow(row);
|
||||
HRegionInterface srvr = getMETAServer(meta);
|
||||
|
||||
Get get = new Get(row);
|
||||
get.addFamily(family);
|
||||
|
||||
return srvr.get(meta.getRegionName(), get);
|
||||
}
|
||||
|
||||
|
|
|
@ -82,6 +82,8 @@ class RegionManager implements HConstants {
|
|||
new ConcurrentSkipListMap<byte [], MetaRegion>(Bytes.BYTES_COMPARATOR);
|
||||
|
||||
private static final byte[] OVERLOADED = Bytes.toBytes("Overloaded");
|
||||
|
||||
private static final byte [] META_REGION_PREFIX = Bytes.toBytes(".META.,");
|
||||
|
||||
/**
|
||||
* Map of region name to RegionState for regions that are in transition such as
|
||||
|
@ -692,7 +694,7 @@ class RegionManager implements HConstants {
|
|||
/**
|
||||
* Get metaregion that would host passed in row.
|
||||
* @param row Row need to know all the meta regions for
|
||||
* @return set of MetaRegion objects that contain the table
|
||||
* @return MetaRegion for passed row.
|
||||
* @throws NotAllMetaRegionsOnlineException
|
||||
*/
|
||||
public MetaRegion getMetaRegionForRow(final byte [] row)
|
||||
|
@ -700,6 +702,12 @@ class RegionManager implements HConstants {
|
|||
if (!areAllMetaRegionsOnline()) {
|
||||
throw new NotAllMetaRegionsOnlineException();
|
||||
}
|
||||
// Row might be in -ROOT- table. If so, return -ROOT- region.
|
||||
int prefixlen = META_REGION_PREFIX.length;
|
||||
if (row.length > prefixlen &&
|
||||
Bytes.compareTo(META_REGION_PREFIX, 0, prefixlen, row, 0, prefixlen) == 0) {
|
||||
return new MetaRegion(this.master.getRootRegionLocation(), HRegionInfo.ROOT_REGIONINFO);
|
||||
}
|
||||
return this.onlineMetaRegions.floorEntry(row).getValue();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue