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 java.io.IOException;
021import org.apache.hadoop.conf.Configuration;
022import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
023import org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder;
024import org.apache.hadoop.hbase.client.TableDescriptor;
025import org.apache.hadoop.hbase.client.TableDescriptorBuilder;
026import org.apache.hadoop.hbase.regionserver.HStore;
027import org.apache.hadoop.hbase.regionserver.StoreEngine;
028import org.apache.hadoop.hbase.regionserver.StripeStoreEngine;
029import org.apache.hadoop.hbase.testclassification.IntegrationTests;
030import org.apache.hadoop.hbase.util.HFileTestUtil;
031import org.apache.hadoop.util.ToolRunner;
032import org.junit.experimental.categories.Category;
033
034/**
035 * A test class that does the same things as IntegrationTestIngest but with stripe compactions. Can
036 * be used with ChaosMonkey in the same manner.
037 */
038@Category(IntegrationTests.class)
039public class IntegrationTestIngestStripeCompactions extends IntegrationTestIngest {
040  @Override
041  protected void initTable() throws IOException {
042    // Do the same as the LoadTestTool does, but with different table configuration.
043    TableDescriptor tableDescriptor = TableDescriptorBuilder.newBuilder(getTablename())
044      .setValue(StoreEngine.STORE_ENGINE_CLASS_KEY, StripeStoreEngine.class.getName())
045      .setValue(HStore.BLOCKING_STOREFILES_KEY, "100").build();
046    ColumnFamilyDescriptor familyDescriptor =
047      ColumnFamilyDescriptorBuilder.of(HFileTestUtil.DEFAULT_COLUMN_FAMILY);
048    HBaseTestingUtil.createPreSplitLoadTestTable(util.getConfiguration(), tableDescriptor,
049      familyDescriptor);
050  }
051
052  public static void main(String[] args) throws Exception {
053    Configuration conf = HBaseConfiguration.create();
054    IntegrationTestingUtility.setUseDistributedCluster(conf);
055    int ret = ToolRunner.run(conf, new IntegrationTestIngestStripeCompactions(), args);
056    System.exit(ret);
057  }
058}