public class MetaUtils extends Object
shutdown()
when done with this class so it closes
resources opened during meta processing (ROOT, META, etc.). Be careful
how you use this class. If used during migrations, be careful when using
this class to check whether migration is needed.Modifier and Type | Class and Description |
---|---|
static interface |
MetaUtils.ScannerListener
Used by scanRootRegion and scanMetaRegion to call back the caller so it
can process the data for a row.
|
Constructor and Description |
---|
MetaUtils()
Default constructor
|
MetaUtils(org.apache.hadoop.conf.Configuration conf) |
Modifier and Type | Method and Description |
---|---|
static void |
changeOnlineStatus(org.apache.hadoop.conf.Configuration c,
byte[] row,
boolean onlineOffline)
Set a single region on/offline.
|
HLog |
getLog() |
HRegion |
getMetaRegion(HRegionInfo metaInfo)
Open or return cached opened meta region
|
List<HRegionInfo> |
getMETARows(byte[] tableName) |
HRegion |
getRootRegion() |
void |
scanMetaRegion(HRegionInfo metaRegionInfo,
MetaUtils.ScannerListener listener)
Scans a meta region.
|
void |
scanMetaRegion(HRegion r,
MetaUtils.ScannerListener listener)
Scan the passed in metaregion
m invoking the passed
listener per row found. |
void |
scanRootRegion(MetaUtils.ScannerListener listener)
Scans the root region.
|
void |
shutdown()
Closes catalog regions if open.
|
void |
updateMETARegionInfo(HRegion r,
HRegionInfo hri)
Update COL_REGIONINFO in meta region r with HRegionInfo hri
|
public MetaUtils() throws IOException
IOException
- epublic MetaUtils(org.apache.hadoop.conf.Configuration conf) throws IOException
conf
- ConfigurationIOException
- epublic HLog getLog() throws IOException
IOException
- epublic HRegion getRootRegion() throws IOException
IOException
- epublic HRegion getMetaRegion(HRegionInfo metaInfo) throws IOException
metaInfo
- HRegionInfo for meta regionIOException
- epublic void shutdown()
public void scanRootRegion(MetaUtils.ScannerListener listener) throws IOException
listener
- method to be called for each meta region foundIOException
- epublic void scanMetaRegion(HRegion r, MetaUtils.ScannerListener listener) throws IOException
m
invoking the passed
listener
per row found.r
- regionlistener
- scanner listenerIOException
- epublic void scanMetaRegion(HRegionInfo metaRegionInfo, MetaUtils.ScannerListener listener) throws IOException
Use for reading meta only. Does not close region when done.
Use getMetaRegion(HRegionInfo)
instead if writing. Adds
meta region to list that will get a close on shutdown()
.
metaRegionInfo
- HRegionInfo for meta regionlistener
- method to be called for each meta region foundIOException
- epublic static void changeOnlineStatus(org.apache.hadoop.conf.Configuration c, byte[] row, boolean onlineOffline) throws IOException
HTable
instance per invocation to go against .META.
c
- A configuration that has its hbase.master
properly set.row
- Row in the catalog .META. table whose HRegionInfo's offline
status we want to change.onlineOffline
- Pass true
to OFFLINE the region.IOException
- epublic void updateMETARegionInfo(HRegion r, HRegionInfo hri) throws IOException
r
- regionhri
- region infoIOException
- epublic List<HRegionInfo> getMETARows(byte[] tableName) throws IOException
tableName
- Name of table to go looking for.HRegionInfo
rows found in the ROOT or META
catalog table.IOException
- egetMetaRegion(HRegionInfo)
Copyright © 2014 The Apache Software Foundation. All Rights Reserved.