001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018package org.apache.hadoop.hbase;
019
020import static org.apache.hadoop.hbase.IntegrationTestingUtility.createPreSplitLoadTestTable;
021
022import java.io.IOException;
023import org.apache.hadoop.conf.Configuration;
024import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
025import org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder;
026import org.apache.hadoop.hbase.client.TableDescriptor;
027import org.apache.hadoop.hbase.client.TableDescriptorBuilder;
028import org.apache.hadoop.hbase.regionserver.HStore;
029import org.apache.hadoop.hbase.regionserver.StoreEngine;
030import org.apache.hadoop.hbase.regionserver.StripeStoreEngine;
031import org.apache.hadoop.hbase.testclassification.IntegrationTests;
032import org.apache.hadoop.hbase.util.HFileTestUtil;
033import org.apache.hadoop.util.ToolRunner;
034import org.junit.experimental.categories.Category;
035
036/**
037 * A test class that does the same things as IntegrationTestIngest but with stripe compactions. Can
038 * be used with ChaosMonkey in the same manner.
039 */
040@Category(IntegrationTests.class)
041public class IntegrationTestIngestStripeCompactions extends IntegrationTestIngest {
042  @Override
043  protected void initTable() throws IOException {
044    // Do the same as the LoadTestTool does, but with different table configuration.
045    TableDescriptor tableDescriptor = TableDescriptorBuilder.newBuilder(getTablename())
046      .setValue(StoreEngine.STORE_ENGINE_CLASS_KEY, StripeStoreEngine.class.getName())
047      .setValue(HStore.BLOCKING_STOREFILES_KEY, "100").build();
048    ColumnFamilyDescriptor familyDescriptor =
049      ColumnFamilyDescriptorBuilder.of(HFileTestUtil.DEFAULT_COLUMN_FAMILY);
050    ColumnFamilyDescriptor[] columns = new ColumnFamilyDescriptor[] { familyDescriptor };
051    createPreSplitLoadTestTable(util.getConfiguration(), tableDescriptor, columns,
052      IntegrationTestingUtility.DEFAULT_REGIONS_PER_SERVER);
053  }
054
055  public static void main(String[] args) throws Exception {
056    Configuration conf = HBaseConfiguration.create();
057    IntegrationTestingUtility.setUseDistributedCluster(conf);
058    int ret = ToolRunner.run(conf, new IntegrationTestIngestStripeCompactions(), args);
059    System.exit(ret);
060  }
061}