org.apache.hadoop.hbase.catalog
Class MetaEditor

java.lang.Object
  extended by org.apache.hadoop.hbase.catalog.MetaEditor

public class MetaEditor
extends Object

Writes region and assignment information to .META.. TODO: Put MetaReader and MetaEditor together; doesn't make sense having them distinct.


Constructor Summary
MetaEditor()
           
 
Method Summary
static void addDaughter(CatalogTracker catalogTracker, HRegionInfo regionInfo, ServerName sn)
           
static void addRegionsToMeta(CatalogTracker catalogTracker, List<HRegionInfo> regionInfos)
          Adds a META row for each of the specified new regions.
static void addRegionToMeta(CatalogTracker catalogTracker, HRegionInfo regionInfo)
          Adds a META row for the specified new region.
static void deleteFromMetaTable(CatalogTracker ct, List<Delete> deletes)
          Delete the passed deletes from the .META. table.
static void deleteRegion(CatalogTracker catalogTracker, HRegionInfo regionInfo)
          Deletes the specified region from META.
static void deleteRegions(CatalogTracker catalogTracker, List<HRegionInfo> regionsInfo)
          Deletes the specified regions from META.
static PairOfSameType<HRegionInfo> getDaughterRegions(Result data)
          Returns the daughter regions by reading from the corresponding columns of the .META.
static HRegionInfo getHRegionInfo(Result data)
           
static void mutateRegions(CatalogTracker catalogTracker, List<HRegionInfo> regionsToRemove, List<HRegionInfo> regionsToAdd)
          Adds and Removes the specified regions from .META.
static void offlineParentInMeta(CatalogTracker catalogTracker, HRegionInfo parent, HRegionInfo a, HRegionInfo b)
          Offline parent in meta.
static void overwriteRegions(CatalogTracker catalogTracker, List<HRegionInfo> regionInfos)
          Overwrites the specified regions from hbase:meta
static void updateMetaLocation(CatalogTracker catalogTracker, HRegionInfo regionInfo, ServerName sn)
          Updates the location of the specified META region in ROOT to be the specified server hostname and startcode.
static void updateRegionLocation(CatalogTracker catalogTracker, HRegionInfo regionInfo, ServerName sn)
          Updates the location of the specified region in META to be the specified server hostname and startcode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetaEditor

public MetaEditor()
Method Detail

deleteFromMetaTable

public static void deleteFromMetaTable(CatalogTracker ct,
                                       List<Delete> deletes)
                                throws IOException
Delete the passed deletes from the .META. table.

Parameters:
ct - CatalogTracker on whose back we will ride the edit.
deletes - Deletes to add to .META. This list should support #remove.
Throws:
IOException

addRegionToMeta

public static void addRegionToMeta(CatalogTracker catalogTracker,
                                   HRegionInfo regionInfo)
                            throws IOException
Adds a META row for the specified new region.

Parameters:
regionInfo - region information
Throws:
IOException - if problem connecting or updating meta

addRegionsToMeta

public static void addRegionsToMeta(CatalogTracker catalogTracker,
                                    List<HRegionInfo> regionInfos)
                             throws IOException
Adds a META row for each of the specified new regions.

Parameters:
catalogTracker - CatalogTracker
regionInfos - region information list
Throws:
IOException - if problem connecting or updating meta

offlineParentInMeta

public static void offlineParentInMeta(CatalogTracker catalogTracker,
                                       HRegionInfo parent,
                                       HRegionInfo a,
                                       HRegionInfo b)
                                throws NotAllMetaRegionsOnlineException,
                                       IOException
Offline parent in meta. Used when splitting.

Parameters:
catalogTracker -
parent -
a - Split daughter region A
b - Split daughter region B
Throws:
NotAllMetaRegionsOnlineException
IOException

addDaughter

public static void addDaughter(CatalogTracker catalogTracker,
                               HRegionInfo regionInfo,
                               ServerName sn)
                        throws NotAllMetaRegionsOnlineException,
                               IOException
Throws:
NotAllMetaRegionsOnlineException
IOException

updateMetaLocation

public static void updateMetaLocation(CatalogTracker catalogTracker,
                                      HRegionInfo regionInfo,
                                      ServerName sn)
                               throws IOException,
                                      ConnectException
Updates the location of the specified META region in ROOT to be the specified server hostname and startcode.

Uses passed catalog tracker to get a connection to the server hosting ROOT and makes edits to that region.

Parameters:
catalogTracker - catalog tracker
regionInfo - region to update location of
sn - Server name
Throws:
IOException
ConnectException - Usually because the regionserver carrying .META. is down.
NullPointerException - Because no -ROOT- server connection

updateRegionLocation

public static void updateRegionLocation(CatalogTracker catalogTracker,
                                        HRegionInfo regionInfo,
                                        ServerName sn)
                                 throws IOException
Updates the location of the specified region in META to be the specified server hostname and startcode.

Uses passed catalog tracker to get a connection to the server hosting META and makes edits to that region.

Parameters:
catalogTracker - catalog tracker
regionInfo - region to update location of
sn - Server name
Throws:
IOException

deleteRegion

public static void deleteRegion(CatalogTracker catalogTracker,
                                HRegionInfo regionInfo)
                         throws IOException
Deletes the specified region from META.

Parameters:
catalogTracker -
regionInfo - region to be deleted from META
Throws:
IOException

deleteRegions

public static void deleteRegions(CatalogTracker catalogTracker,
                                 List<HRegionInfo> regionsInfo)
                          throws IOException
Deletes the specified regions from META.

Parameters:
catalogTracker -
regionsInfo - list of regions to be deleted from META
Throws:
IOException

mutateRegions

public static void mutateRegions(CatalogTracker catalogTracker,
                                 List<HRegionInfo> regionsToRemove,
                                 List<HRegionInfo> regionsToAdd)
                          throws IOException
Adds and Removes the specified regions from .META.

Parameters:
catalogTracker -
regionsToRemove - list of regions to be deleted from META
regionsToAdd - list of regions to be added to META
Throws:
IOException

overwriteRegions

public static void overwriteRegions(CatalogTracker catalogTracker,
                                    List<HRegionInfo> regionInfos)
                             throws IOException
Overwrites the specified regions from hbase:meta

Parameters:
catalogTracker -
regionInfos - list of regions to be added to META
Throws:
IOException

getHRegionInfo

public static HRegionInfo getHRegionInfo(Result data)
                                  throws IOException
Throws:
IOException

getDaughterRegions

public static PairOfSameType<HRegionInfo> getDaughterRegions(Result data)
                                                      throws IOException
Returns the daughter regions by reading from the corresponding columns of the .META. table Result. If the region is not a split parent region, it returns PairOfSameType(null, null).

Throws:
IOException


Copyright © 2015 The Apache Software Foundation. All Rights Reserved.