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.test; 019 020import java.util.List; 021import org.apache.hadoop.conf.Configuration; 022import org.apache.hadoop.hbase.HBaseConfiguration; 023import org.apache.hadoop.hbase.IntegrationTestingUtility; 024import org.apache.hadoop.hbase.testclassification.IntegrationTests; 025import org.apache.hadoop.hbase.util.LoadTestTool; 026import org.apache.hadoop.util.ToolRunner; 027import org.junit.experimental.categories.Category; 028 029import org.apache.hbase.thirdparty.com.google.common.collect.Lists; 030 031/** 032 * Extends {@link IntegrationTestTimeBoundedRequestsWithRegionReplicas} for multi-gets Besides the 033 * options already talked about in IntegrationTestTimeBoundedRequestsWithRegionReplicas the addition 034 * options here are: 035 * 036 * <pre> 037 * -DIntegrationTestTimeBoundedMultiGetRequestsWithRegionReplicas.multiget_batchsize=100 038 * -DIntegrationTestTimeBoundedMultiGetRequestsWithRegionReplicas.num_regions_per_server=5 039 * </pre> 040 * 041 * The multiget_batchsize when set to 1 will issue normal GETs. The num_regions_per_server argument 042 * indirectly impacts the region size (for a given number of num_keys_per_server). That in 043 * conjunction with multiget_batchsize would have different behaviors - the batch of gets goes to 044 * the same region or to multiple regions. 045 */ 046@Category(IntegrationTests.class) 047public class IntegrationTestTimeBoundedMultiGetRequestsWithRegionReplicas 048 extends IntegrationTestTimeBoundedRequestsWithRegionReplicas { 049 050 @Override 051 protected String[] getArgsForLoadTestTool(String mode, String modeSpecificArg, long startKey, 052 long numKeys) { 053 List<String> args = 054 Lists.newArrayList(super.getArgsForLoadTestTool(mode, modeSpecificArg, startKey, numKeys)); 055 String clazz = this.getClass().getSimpleName(); 056 args.add("-" + LoadTestTool.OPT_MULTIGET); 057 args.add(conf.get(String.format("%s.%s", clazz, LoadTestTool.OPT_MULTIGET), "100")); 058 059 args.add("-" + LoadTestTool.OPT_NUM_REGIONS_PER_SERVER); 060 args.add(conf.get(String.format("%s.%s", clazz, LoadTestTool.OPT_NUM_REGIONS_PER_SERVER), 061 Integer.toString(LoadTestTool.DEFAULT_NUM_REGIONS_PER_SERVER))); 062 063 return args.toArray(new String[args.size()]); 064 } 065 066 public static void main(String args[]) throws Exception { 067 Configuration conf = HBaseConfiguration.create(); 068 IntegrationTestingUtility.setUseDistributedCluster(conf); 069 int ret = ToolRunner.run(conf, 070 new IntegrationTestTimeBoundedMultiGetRequestsWithRegionReplicas(), args); 071 System.exit(ret); 072 } 073}