/
Appendix: HBaseDDLExecutor
Appendix: HBaseDDLExecutor
For details on replication of CDAP clusters, see CDAP Replication.
This document provides a sample implementation of HBaseDDLExecutor
.
The HBaseDDLExecutorImpl
class performs the DDL operations on the local and peer cluster (master and slave).
Interface
Interface of HBaseDDLExecutor
. Note that this is a Beta feature and subject to change without notice.
/**
* Interface providing the HBase DDL operations. All methods except {@link #initialize} must
* be idempotent in order to allow retry of failed operations.
*/
@Beta
public interface HBaseDDLExecutor extends Closeable {
/**
* Initialize the {@link HBaseDDLExecutor}.
* This method is called once when the executor is created, before any other methods are called.
* @param context the context for the executor
*/
void initialize(HBaseDDLExecutorContext context);
/**
* Create the specified namespace if it does not exist.
* This method gets called when CDAP attempts to create a new namespace.
*
* @param name the namespace to create
* @return whether the namespace was created
* @throws IOException if a remote or network exception occurs
*/
boolean createNamespaceIfNotExists(String name) throws IOException;
/**
* Delete the specified namespace if it exists.
* This method is called during namespace deletion process.
*
* @param name the namespace to delete
* @throws IOException if a remote or network exception occurs
* @throws IllegalStateException if there are tables in the namespace
*/
void deleteNamespaceIfExists(String name) throws IOException;
/**
* Create the specified table if it does not exist.
* This method is called during the creation of an HBase backed dataset (either system or user).
*
* @param descriptor the descriptor for the table to create
* @param splitKeys the initial split keys for the table
* @throws IOException if a remote or network exception occurs
*/
void createTableIfNotExists(TableDescriptor descriptor, @Nullable byte[][] splitKeys)
throws IOException;
/**
* Enable the specified table if it is disabled.
*
* @param namespace the namespace of the table to enable
* @param name the name of the table to enable
* @throws IOException if a remote or network exception occurs
*/
void enableTableIfDisabled(String namespace, String name) throws IOException;