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);
}
Aggregations