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.mob; 019 020import org.apache.hadoop.hbase.HBaseClassTestRule; 021import org.apache.hadoop.hbase.testclassification.LargeTests; 022import org.junit.ClassRule; 023import org.junit.experimental.categories.Category; 024 025/** 026 * Mob file compaction chore in a generational non-batch mode test. 1. Uses default (non-batch) mode 027 * for regular MOB compaction, sets generational mode ON 2. Disables periodic MOB compactions, sets 028 * minimum age to archive to 10 sec 3. Creates MOB table with 20 regions 4. Loads MOB data 029 * (randomized keys, 1000 rows), flushes data. 5. Repeats 4. two more times 6. Verifies that we have 030 * 20 *3 = 60 mob files (equals to number of regions x 3) 7. Runs major MOB compaction. 8. Verifies 031 * that number of MOB files in a mob directory is 20 x4 = 80 9. Waits for a period of time larger 032 * than minimum age to archive 10. Runs Mob cleaner chore 11 Verifies that number of MOB files in a 033 * mob directory is 20. 12 Runs scanner and checks all 3 * 1000 rows. 034 */ 035@Category(LargeTests.class) 036public class TestMobCompactionOptMode extends TestMobCompactionWithDefaults { 037 038 @ClassRule 039 public static final HBaseClassTestRule CLASS_RULE = 040 HBaseClassTestRule.forClass(TestMobCompactionOptMode.class); 041 042 public TestMobCompactionOptMode(Boolean useFileBasedSFT) { 043 super(useFileBasedSFT); 044 } 045 046 protected void additonalConfigSetup() { 047 conf.set(MobConstants.MOB_COMPACTION_TYPE_KEY, MobConstants.OPTIMIZED_MOB_COMPACTION_TYPE); 048 conf.setLong(MobConstants.MOB_COMPACTION_MAX_FILE_SIZE_KEY, 1000000); 049 } 050 051 @Override 052 protected String description() { 053 return "generational (non-batch) mode"; 054 } 055 056}