Search in sources :

Example 16 with Coprocessor

use of org.apache.hadoop.hbase.Coprocessor in project cdap by caskdata.

the class HBaseTableAdmin method createCoprocessorJarInternal.

public static CoprocessorJar createCoprocessorJarInternal(CConfiguration conf, CoprocessorManager coprocessorManager, HBaseTableUtil tableUtil, boolean transactional, boolean supportsReadlessIncrement) throws IOException {
    Class<? extends Coprocessor> dataJanitorClass = tableUtil.getTransactionDataJanitorClassForVersion();
    Class<? extends Coprocessor> incrementClass = tableUtil.getIncrementHandlerClassForVersion();
    // The ordering of coprocessors is important here. DataJanitor Coprocessor should get higher priority than
    // IncrementHandler coprocessor. This is because, we have a check in prePutOp, preDeleteOp in DataJanitor
    // to make sure the operation is within the tx max lifetime.
    ImmutableList.Builder<Class<? extends Coprocessor>> coprocessors = ImmutableList.builder();
    if (transactional) {
        // tx janitor
        if (conf.getBoolean(Constants.Transaction.DataJanitor.CFG_TX_JANITOR_ENABLE, Constants.Transaction.DataJanitor.DEFAULT_TX_JANITOR_ENABLE)) {
            coprocessors.add(dataJanitorClass);
        }
    }
    // read-less increments
    if (supportsReadlessIncrement) {
        coprocessors.add(incrementClass);
    }
    ImmutableList<Class<? extends Coprocessor>> coprocessorList = coprocessors.build();
    if (coprocessorList.isEmpty()) {
        return CoprocessorJar.EMPTY;
    }
    Location jarFile = coprocessorManager.ensureCoprocessorExists();
    return new CoprocessorJar(coprocessorList, jarFile);
}
Also used : Coprocessor(org.apache.hadoop.hbase.Coprocessor) ImmutableList(com.google.common.collect.ImmutableList) Location(org.apache.twill.filesystem.Location)

Aggregations

Coprocessor (org.apache.hadoop.hbase.Coprocessor)16 HRegion (org.apache.hadoop.hbase.regionserver.HRegion)7 Test (org.junit.Test)7 TableName (org.apache.hadoop.hbase.TableName)5 IOException (java.io.IOException)4 Configuration (org.apache.hadoop.conf.Configuration)4 Region (org.apache.hadoop.hbase.regionserver.Region)4 HColumnDescriptor (org.apache.hadoop.hbase.HColumnDescriptor)3 HRegionInfo (org.apache.hadoop.hbase.HRegionInfo)3 HTableDescriptor (org.apache.hadoop.hbase.HTableDescriptor)3 RegionCoprocessorHost (org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost)3 Method (java.lang.reflect.Method)2 CoprocessorEnvironment (org.apache.hadoop.hbase.CoprocessorEnvironment)2 DoNotRetryIOException (org.apache.hadoop.hbase.DoNotRetryIOException)2 HBaseConfiguration (org.apache.hadoop.hbase.HBaseConfiguration)2 Put (org.apache.hadoop.hbase.client.Put)2 Scan (org.apache.hadoop.hbase.client.Scan)2 Table (org.apache.hadoop.hbase.client.Table)2 SampleRegionWALObserver (org.apache.hadoop.hbase.coprocessor.SampleRegionWALObserver)2 WALCoprocessorHost (org.apache.hadoop.hbase.regionserver.wal.WALCoprocessorHost)2