org.apache.hadoop.hbase.master.handler
Class CreateTableHandler

java.lang.Object
  extended by org.apache.hadoop.hbase.executor.EventHandler
      extended by org.apache.hadoop.hbase.master.handler.CreateTableHandler
All Implemented Interfaces:
Comparable<Runnable>, Runnable
Direct Known Subclasses:
CloneSnapshotHandler

@InterfaceAudience.Private
public class CreateTableHandler
extends EventHandler

Handler to create a table.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.hadoop.hbase.executor.EventHandler
EventHandler.EventHandlerListener
 
Field Summary
protected  org.apache.hadoop.conf.Configuration conf
           
protected  MasterFileSystem fileSystemManager
           
protected  HTableDescriptor hTableDescriptor
           
 
Fields inherited from class org.apache.hadoop.hbase.executor.EventHandler
eventType, seqids, server, waitingTimeForEvents
 
Constructor Summary
CreateTableHandler(Server server, MasterFileSystem fileSystemManager, HTableDescriptor hTableDescriptor, org.apache.hadoop.conf.Configuration conf, HRegionInfo[] newRegions, MasterServices masterServices)
           
 
Method Summary
protected  void addRegionsToMeta(CatalogTracker ct, List<HRegionInfo> regionInfos)
          Add the specified set of regions to the hbase:meta table.
protected  void completed(Throwable exception)
          Called after that process() is completed.
protected  List<HRegionInfo> handleCreateHdfsRegions(org.apache.hadoop.fs.Path tableRootDir, TableName tableName)
          Create the on-disk structure for the table, and returns the regions info.
 CreateTableHandler prepare()
          Event handlers should do all the necessary checks in this method (rather than in the constructor, or in process()) so that the caller, which is mostly executed in the ipc context can fail fast.
 void process()
          This method is the main processing loop to be implemented by the various subclasses.
 String toString()
           
 
Methods inherited from class org.apache.hadoop.hbase.executor.EventHandler
compareTo, getEventType, getInformativeName, getListener, getPriority, getSeqid, handleException, run, setListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fileSystemManager

protected final MasterFileSystem fileSystemManager

hTableDescriptor

protected final HTableDescriptor hTableDescriptor

conf

protected final org.apache.hadoop.conf.Configuration conf
Constructor Detail

CreateTableHandler

public CreateTableHandler(Server server,
                          MasterFileSystem fileSystemManager,
                          HTableDescriptor hTableDescriptor,
                          org.apache.hadoop.conf.Configuration conf,
                          HRegionInfo[] newRegions,
                          MasterServices masterServices)
Method Detail

prepare

public CreateTableHandler prepare()
                           throws NotAllMetaRegionsOnlineException,
                                  TableExistsException,
                                  IOException
Description copied from class: EventHandler
Event handlers should do all the necessary checks in this method (rather than in the constructor, or in process()) so that the caller, which is mostly executed in the ipc context can fail fast. Process is executed async from the client ipc, so this method gives a quick chance to do some basic checks. Should be called after constructing the EventHandler, and before process().

Overrides:
prepare in class EventHandler
Returns:
the instance of this class
Throws:
NotAllMetaRegionsOnlineException
TableExistsException
IOException

toString

public String toString()
Overrides:
toString in class EventHandler

process

public void process()
Description copied from class: EventHandler
This method is the main processing loop to be implemented by the various subclasses.

Specified by:
process in class EventHandler

completed

protected void completed(Throwable exception)
Called after that process() is completed.

Parameters:
exception - null if process() is successful or not null if something has failed.

handleCreateHdfsRegions

protected List<HRegionInfo> handleCreateHdfsRegions(org.apache.hadoop.fs.Path tableRootDir,
                                                    TableName tableName)
                                             throws IOException
Create the on-disk structure for the table, and returns the regions info.

Parameters:
tableRootDir - directory where the table is being created
tableName - name of the table under construction
Returns:
the list of regions created
Throws:
IOException

addRegionsToMeta

protected void addRegionsToMeta(CatalogTracker ct,
                                List<HRegionInfo> regionInfos)
                         throws IOException
Add the specified set of regions to the hbase:meta table.

Throws:
IOException


Copyright © 2015 The Apache Software Foundation. All rights reserved.