HBASE-24033 Add ut for loading the corrupt recovered hfiles (#1322)
[hbase.git] / hbase-server / src / test / java / org / apache / hadoop / hbase / regionserver / TestDateTieredCompactionPolicyOverflow.java
blob29f9ea74414adf663307808b6233912afb988393
1 /**
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 package org.apache.hadoop.hbase.regionserver;
20 import java.io.IOException;
21 import org.apache.hadoop.hbase.HBaseClassTestRule;
22 import org.apache.hadoop.hbase.HConstants;
23 import org.apache.hadoop.hbase.regionserver.compactions.CompactionConfiguration;
24 import org.apache.hadoop.hbase.regionserver.compactions.ExponentialCompactionWindowFactory;
25 import org.apache.hadoop.hbase.testclassification.RegionServerTests;
26 import org.apache.hadoop.hbase.testclassification.SmallTests;
27 import org.junit.ClassRule;
28 import org.junit.Test;
29 import org.junit.experimental.categories.Category;
31 @Category({ RegionServerTests.class, SmallTests.class })
32 public class TestDateTieredCompactionPolicyOverflow extends AbstractTestDateTieredCompactionPolicy {
34 @ClassRule
35 public static final HBaseClassTestRule CLASS_RULE =
36 HBaseClassTestRule.forClass(TestDateTieredCompactionPolicyOverflow.class);
38 @Override
39 protected void config() {
40 super.config();
42 // Set up policy
43 conf.set(StoreEngine.STORE_ENGINE_CLASS_KEY,
44 "org.apache.hadoop.hbase.regionserver.DateTieredStoreEngine");
45 conf.setLong(CompactionConfiguration.DATE_TIERED_MAX_AGE_MILLIS_KEY, 100);
46 conf.setLong(CompactionConfiguration.DATE_TIERED_INCOMING_WINDOW_MIN_KEY, 3);
47 conf.setLong(ExponentialCompactionWindowFactory.BASE_WINDOW_MILLIS_KEY, Long.MAX_VALUE / 2);
48 conf.setInt(ExponentialCompactionWindowFactory.WINDOWS_PER_TIER_KEY, 2);
49 conf.setBoolean(CompactionConfiguration.DATE_TIERED_SINGLE_OUTPUT_FOR_MINOR_COMPACTION_KEY,
50 false);
52 // Special settings for compaction policy per window
53 this.conf.setInt(CompactionConfiguration.HBASE_HSTORE_COMPACTION_MIN_KEY, 2);
54 this.conf.setInt(CompactionConfiguration.HBASE_HSTORE_COMPACTION_MAX_KEY, 12);
55 this.conf.setFloat(CompactionConfiguration.HBASE_HSTORE_COMPACTION_RATIO_KEY, 1.2F);
57 conf.setInt(HStore.BLOCKING_STOREFILES_KEY, 20);
58 conf.setLong(HConstants.MAJOR_COMPACTION_PERIOD, 10);
61 /**
62 * Major compaction with maximum values
63 * @throws IOException with error
65 @Test
66 public void maxValuesForMajor() throws IOException {
67 long[] minTimestamps = new long[] { Long.MIN_VALUE, -100 };
68 long[] maxTimestamps = new long[] { -8, Long.MAX_VALUE };
69 long[] sizes = new long[] { 0, 1 };
71 compactEquals(Long.MAX_VALUE, sfCreate(minTimestamps, maxTimestamps, sizes),
72 new long[] { 0, 1 }, new long[] { Long.MIN_VALUE, -4611686018427387903L, 0,
73 4611686018427387903L, 9223372036854775806L }, true, true);