Search in sources :

Example 1 with MobCompactor

use of org.apache.hadoop.hbase.mob.compactions.MobCompactor in project hbase by apache.

the class MobUtils method doMobCompaction.

/**
   * Performs the mob compaction.
   * @param conf the Configuration
   * @param fs the file system
   * @param tableName the table the compact
   * @param hcd the column descriptor
   * @param pool the thread pool
   * @param allFiles Whether add all mob files into the compaction.
   */
public static void doMobCompaction(Configuration conf, FileSystem fs, TableName tableName, HColumnDescriptor hcd, ExecutorService pool, boolean allFiles, LockManager.MasterLock lock) throws IOException {
    String className = conf.get(MobConstants.MOB_COMPACTOR_CLASS_KEY, PartitionedMobCompactor.class.getName());
    // instantiate the mob compactor.
    MobCompactor compactor = null;
    try {
        compactor = ReflectionUtils.instantiateWithCustomCtor(className, new Class[] { Configuration.class, FileSystem.class, TableName.class, HColumnDescriptor.class, ExecutorService.class }, new Object[] { conf, fs, tableName, hcd, pool });
    } catch (Exception e) {
        throw new IOException("Unable to load configured mob file compactor '" + className + "'", e);
    }
    // with major compaction in mob-enabled column.
    try {
        lock.acquire();
        compactor.compact(allFiles);
    } catch (Exception e) {
        LOG.error("Failed to compact the mob files for the column " + hcd.getNameAsString() + " in the table " + tableName.getNameAsString(), e);
    } finally {
        lock.release();
    }
}
Also used : TableName(org.apache.hadoop.hbase.TableName) Configuration(org.apache.hadoop.conf.Configuration) HColumnDescriptor(org.apache.hadoop.hbase.HColumnDescriptor) PartitionedMobCompactor(org.apache.hadoop.hbase.mob.compactions.PartitionedMobCompactor) FileSystem(org.apache.hadoop.fs.FileSystem) ExecutorService(java.util.concurrent.ExecutorService) MobCompactor(org.apache.hadoop.hbase.mob.compactions.MobCompactor) PartitionedMobCompactor(org.apache.hadoop.hbase.mob.compactions.PartitionedMobCompactor) IOException(java.io.IOException) ParseException(java.text.ParseException) FileNotFoundException(java.io.FileNotFoundException) RejectedExecutionException(java.util.concurrent.RejectedExecutionException) IOException(java.io.IOException)

Aggregations

FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 ParseException (java.text.ParseException)1 ExecutorService (java.util.concurrent.ExecutorService)1 RejectedExecutionException (java.util.concurrent.RejectedExecutionException)1 Configuration (org.apache.hadoop.conf.Configuration)1 FileSystem (org.apache.hadoop.fs.FileSystem)1 HColumnDescriptor (org.apache.hadoop.hbase.HColumnDescriptor)1 TableName (org.apache.hadoop.hbase.TableName)1 MobCompactor (org.apache.hadoop.hbase.mob.compactions.MobCompactor)1 PartitionedMobCompactor (org.apache.hadoop.hbase.mob.compactions.PartitionedMobCompactor)1