Search in sources :

Example 1 with MetaMutationAnnotation

use of org.apache.hadoop.hbase.MetaMutationAnnotation in project hbase by apache.

the class MergeTableRegionsProcedure method preMergeRegionsCommit.

/**
 * Post merge region action
 * @param env MasterProcedureEnv
 */
private void preMergeRegionsCommit(final MasterProcedureEnv env) throws IOException {
    final MasterCoprocessorHost cpHost = env.getMasterCoprocessorHost();
    if (cpHost != null) {
        @MetaMutationAnnotation final List<Mutation> metaEntries = new ArrayList<>();
        cpHost.preMergeRegionsCommit(regionsToMerge, metaEntries, getUser());
        try {
            for (Mutation p : metaEntries) {
                RegionInfo.parseRegionName(p.getRow());
            }
        } catch (IOException e) {
            LOG.error("Row key of mutation from coprocessor is not parsable as region name. " + "Mutations from coprocessor should only be for hbase:meta table.", e);
            throw e;
        }
    }
}
Also used : MasterCoprocessorHost(org.apache.hadoop.hbase.master.MasterCoprocessorHost) MetaMutationAnnotation(org.apache.hadoop.hbase.MetaMutationAnnotation) ArrayList(java.util.ArrayList) Mutation(org.apache.hadoop.hbase.client.Mutation) IOException(java.io.IOException)

Example 2 with MetaMutationAnnotation

use of org.apache.hadoop.hbase.MetaMutationAnnotation in project hbase by apache.

the class MergeTableRegionsProcedure method preMergeRegionsCommit.

/**
   * Post merge region action
   * @param env MasterProcedureEnv
   **/
private void preMergeRegionsCommit(final MasterProcedureEnv env) throws IOException {
    final MasterCoprocessorHost cpHost = env.getMasterCoprocessorHost();
    if (cpHost != null) {
        @MetaMutationAnnotation final List<Mutation> metaEntries = new ArrayList<>();
        boolean ret = cpHost.preMergeRegionsCommit(regionsToMerge, metaEntries, getUser());
        if (ret) {
            throw new IOException("Coprocessor bypassing regions " + getRegionsToMergeListFullNameString() + " merge.");
        }
        try {
            for (Mutation p : metaEntries) {
                HRegionInfo.parseRegionName(p.getRow());
            }
        } catch (IOException e) {
            LOG.error("Row key of mutation from coprocessor is not parsable as region name." + "Mutations from coprocessor should only be for hbase:meta table.", e);
            throw e;
        }
    }
}
Also used : MasterCoprocessorHost(org.apache.hadoop.hbase.master.MasterCoprocessorHost) MetaMutationAnnotation(org.apache.hadoop.hbase.MetaMutationAnnotation) ArrayList(java.util.ArrayList) Mutation(org.apache.hadoop.hbase.client.Mutation) InterruptedIOException(java.io.InterruptedIOException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 MetaMutationAnnotation (org.apache.hadoop.hbase.MetaMutationAnnotation)2 Mutation (org.apache.hadoop.hbase.client.Mutation)2 MasterCoprocessorHost (org.apache.hadoop.hbase.master.MasterCoprocessorHost)2 InterruptedIOException (java.io.InterruptedIOException)1 DoNotRetryIOException (org.apache.hadoop.hbase.DoNotRetryIOException)1