Search in sources :

Example 1 with BypassCoprocessorException

use of org.apache.hadoop.hbase.coprocessor.BypassCoprocessorException in project hbase by apache.

the class HMaster method modifyNamespace.

/**
   * Modify an existing Namespace.
   * @param nonceGroup Identifier for the source of the request, a client or process.
   * @param nonce A unique identifier for this operation from the client or process identified by
   * <code>nonceGroup</code> (the source must ensure each operation gets a unique id).
   * @return procedure id
   */
long modifyNamespace(final NamespaceDescriptor namespaceDescriptor, final long nonceGroup, final long nonce) throws IOException {
    checkInitialized();
    TableName.isLegalNamespaceName(Bytes.toBytes(namespaceDescriptor.getName()));
    return MasterProcedureUtil.submitProcedure(new MasterProcedureUtil.NonceProcedureRunnable(this, nonceGroup, nonce) {

        @Override
        protected void run() throws IOException {
            if (getMaster().getMasterCoprocessorHost().preModifyNamespace(namespaceDescriptor)) {
                throw new BypassCoprocessorException();
            }
            LOG.info(getClientIdAuditPrefix() + " modify " + namespaceDescriptor);
            // Execute the operation synchronously - wait for the operation to complete before
            // continuing.
            setProcId(getClusterSchema().modifyNamespace(namespaceDescriptor, getNonceKey()));
            getMaster().getMasterCoprocessorHost().postModifyNamespace(namespaceDescriptor);
        }

        @Override
        protected String getDescription() {
            return "ModifyNamespaceProcedure";
        }
    });
}
Also used : BypassCoprocessorException(org.apache.hadoop.hbase.coprocessor.BypassCoprocessorException) InterruptedIOException(java.io.InterruptedIOException) IOException(java.io.IOException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException) HBaseIOException(org.apache.hadoop.hbase.HBaseIOException) MasterProcedureUtil(org.apache.hadoop.hbase.master.procedure.MasterProcedureUtil)

Example 2 with BypassCoprocessorException

use of org.apache.hadoop.hbase.coprocessor.BypassCoprocessorException in project hbase by apache.

the class HMaster method createNamespace.

/**
   * Create a new Namespace.
   * @param namespaceDescriptor descriptor for new Namespace
   * @param nonceGroup Identifier for the source of the request, a client or process.
   * @param nonce A unique identifier for this operation from the client or process identified by
   * <code>nonceGroup</code> (the source must ensure each operation gets a unique id).
   * @return procedure id
   */
long createNamespace(final NamespaceDescriptor namespaceDescriptor, final long nonceGroup, final long nonce) throws IOException {
    checkInitialized();
    TableName.isLegalNamespaceName(Bytes.toBytes(namespaceDescriptor.getName()));
    return MasterProcedureUtil.submitProcedure(new MasterProcedureUtil.NonceProcedureRunnable(this, nonceGroup, nonce) {

        @Override
        protected void run() throws IOException {
            if (getMaster().getMasterCoprocessorHost().preCreateNamespace(namespaceDescriptor)) {
                throw new BypassCoprocessorException();
            }
            LOG.info(getClientIdAuditPrefix() + " creating " + namespaceDescriptor);
            // Execute the operation synchronously - wait for the operation to complete before
            // continuing.
            setProcId(getClusterSchema().createNamespace(namespaceDescriptor, getNonceKey()));
            getMaster().getMasterCoprocessorHost().postCreateNamespace(namespaceDescriptor);
        }

        @Override
        protected String getDescription() {
            return "CreateNamespaceProcedure";
        }
    });
}
Also used : BypassCoprocessorException(org.apache.hadoop.hbase.coprocessor.BypassCoprocessorException) InterruptedIOException(java.io.InterruptedIOException) IOException(java.io.IOException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException) HBaseIOException(org.apache.hadoop.hbase.HBaseIOException) MasterProcedureUtil(org.apache.hadoop.hbase.master.procedure.MasterProcedureUtil)

Aggregations

IOException (java.io.IOException)2 InterruptedIOException (java.io.InterruptedIOException)2 DoNotRetryIOException (org.apache.hadoop.hbase.DoNotRetryIOException)2 HBaseIOException (org.apache.hadoop.hbase.HBaseIOException)2 BypassCoprocessorException (org.apache.hadoop.hbase.coprocessor.BypassCoprocessorException)2 MasterProcedureUtil (org.apache.hadoop.hbase.master.procedure.MasterProcedureUtil)2