|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hbase.util.MetaUtils
public class MetaUtils
Contains utility methods for manipulating HBase meta tables.
Be sure to call 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.
Nested Class Summary | |
---|---|
static interface |
MetaUtils.ScannerListener
Used by scanRootRegion and scanMetaRegion to call back the caller so it can process the data for a row. |
Constructor Summary | |
---|---|
MetaUtils()
Default constructor |
|
MetaUtils(org.apache.hadoop.conf.Configuration conf)
|
Method Summary | |
---|---|
void |
addColumn(byte[] tableName,
HColumnDescriptor hcd)
Offline version of the online TableOperation, org.apache.hadoop.hbase.master.AddColumn. |
static void |
changeOnlineStatus(org.apache.hadoop.conf.Configuration c,
byte[] row,
boolean onlineOffline)
Set a single region on/offline. |
void |
deleteColumn(byte[] tableName,
byte[] columnFamily)
Offline version of the online TableOperation, org.apache.hadoop.hbase.master.DeleteColumn. |
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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MetaUtils() throws IOException
IOException
- epublic MetaUtils(org.apache.hadoop.conf.Configuration conf) throws IOException
conf
- Configuration
IOException
- eMethod Detail |
---|
public HLog getLog() throws IOException
IOException
- epublic HRegion getRootRegion() throws IOException
IOException
- epublic HRegion getMetaRegion(HRegionInfo metaInfo) throws IOException
metaInfo
- HRegionInfo for meta region
IOException
- epublic void shutdown()
public void scanRootRegion(MetaUtils.ScannerListener listener) throws IOException
listener
- method to be called for each meta region found
IOException
- epublic void scanMetaRegion(HRegion r, MetaUtils.ScannerListener listener) throws IOException
m
invoking the passed
listener
per row found.
r
- regionlistener
- scanner listener
IOException
- 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 found
IOException
- 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 addColumn(byte[] tableName, HColumnDescriptor hcd) throws IOException
tableName
- table namehcd
- Add this column to tableName
IOException
- epublic void deleteColumn(byte[] tableName, byte[] columnFamily) throws IOException
tableName
- table namecolumnFamily
- Name of column name to remove.
IOException
- epublic void updateMETARegionInfo(HRegion r, HRegionInfo hri) throws IOException
r
- regionhri
- region info
IOException
- 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)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |