View Javadoc

1   /**
2    *
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  You may obtain a copy of the License at
10   *
11   *     http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   */
19  package org.apache.hadoop.hbase.mob;
20  
21  import org.apache.hadoop.hbase.classification.InterfaceAudience;
22  import org.apache.hadoop.hbase.classification.InterfaceStability;
23  import org.apache.hadoop.hbase.HConstants;
24  import org.apache.hadoop.hbase.Tag;
25  import org.apache.hadoop.hbase.TagType;
26  import org.apache.hadoop.hbase.util.Bytes;
27  
28  /**
29   * The constants used in mob.
30   */
31  @InterfaceAudience.Public
32  @InterfaceStability.Evolving
33  public class MobConstants {
34  
35    public static final String MOB_SCAN_RAW = "hbase.mob.scan.raw";
36    public static final String MOB_CACHE_BLOCKS = "hbase.mob.cache.blocks";
37    public static final String MOB_SCAN_REF_ONLY = "hbase.mob.scan.ref.only";
38    public static final String EMPTY_VALUE_ON_MOBCELL_MISS = "empty.value.on.mobcell.miss";
39  
40    public static final String MOB_FILE_CACHE_SIZE_KEY = "hbase.mob.file.cache.size";
41    public static final int DEFAULT_MOB_FILE_CACHE_SIZE = 1000;
42  
43    public static final String MOB_DIR_NAME = "mobdir";
44    public static final String MOB_REGION_NAME = ".mob";
45    public static final byte[] MOB_REGION_NAME_BYTES = Bytes.toBytes(MOB_REGION_NAME);
46  
47    public static final String MOB_CLEANER_PERIOD = "hbase.master.mob.ttl.cleaner.period";
48    public static final int DEFAULT_MOB_CLEANER_PERIOD = 24 * 60 * 60; // one day
49  
50    public static final String MOB_SWEEP_TOOL_COMPACTION_START_DATE =
51        "hbase.mob.sweep.tool.compaction.start.date";
52    public static final String MOB_SWEEP_TOOL_COMPACTION_RATIO =
53        "hbase.mob.sweep.tool.compaction.ratio";
54    public static final String MOB_SWEEP_TOOL_COMPACTION_MERGEABLE_SIZE =
55        "hbase.mob.sweep.tool.compaction.mergeable.size";
56  
57    public static final float DEFAULT_SWEEP_TOOL_MOB_COMPACTION_RATIO = 0.5f;
58    public static final long DEFAULT_SWEEP_TOOL_MOB_COMPACTION_MERGEABLE_SIZE = 128 * 1024 * 1024;
59  
60    public static final String MOB_SWEEP_TOOL_COMPACTION_TEMP_DIR_NAME = "mobcompaction";
61  
62    public static final String MOB_SWEEP_TOOL_COMPACTION_MEMSTORE_FLUSH_SIZE =
63        "hbase.mob.sweep.tool.compaction.memstore.flush.size";
64    public static final long DEFAULT_MOB_SWEEP_TOOL_COMPACTION_MEMSTORE_FLUSH_SIZE =
65        1024 * 1024 * 128; // 128M
66  
67    public static final String MOB_CACHE_EVICT_PERIOD = "hbase.mob.cache.evict.period";
68    public static final String MOB_CACHE_EVICT_REMAIN_RATIO = "hbase.mob.cache.evict.remain.ratio";
69    public static final Tag MOB_REF_TAG = new Tag(TagType.MOB_REFERENCE_TAG_TYPE,
70        HConstants.EMPTY_BYTE_ARRAY);
71  
72    public static final float DEFAULT_EVICT_REMAIN_RATIO = 0.5f;
73    public static final long DEFAULT_MOB_CACHE_EVICT_PERIOD = 3600l;
74  
75    public final static String TEMP_DIR_NAME = ".tmp";
76    public final static String BULKLOAD_DIR_NAME = ".bulkload";
77    public final static byte[] MOB_TABLE_LOCK_SUFFIX = Bytes.toBytes(".mobLock");
78    public final static String EMPTY_STRING = "";
79    /**
80     * If the size of a mob file is less than this value, it's regarded as a small file and needs to
81     * be merged in mob compaction. The default value is 1280MB.
82     */
83    public static final String MOB_COMPACTION_MERGEABLE_THRESHOLD =
84      "hbase.mob.compaction.mergeable.threshold";
85    public static final long DEFAULT_MOB_COMPACTION_MERGEABLE_THRESHOLD = 10 * 128 * 1024 * 1024;
86    /**
87     * The max number of del files that is allowed in the mob file compaction. In the mob
88     * compaction, when the number of existing del files is larger than this value, they are merged
89     * until number of del files is not larger this value. The default value is 3.
90     */
91    public static final String MOB_DELFILE_MAX_COUNT = "hbase.mob.delfile.max.count";
92    public static final int DEFAULT_MOB_DELFILE_MAX_COUNT = 3;
93    /**
94     * The max number of the mob files that is allowed in a batch of the mob compaction.
95     * The mob compaction merges the small mob files to bigger ones. If the number of the
96     * small files is very large, it could lead to a "too many opened file handlers" in the merge.
97     * And the merge has to be split into batches. This value limits the number of mob files
98     * that are selected in a batch of the mob compaction. The default value is 100.
99     */
100   public static final String MOB_COMPACTION_BATCH_SIZE =
101     "hbase.mob.compaction.batch.size";
102   public static final int DEFAULT_MOB_COMPACTION_BATCH_SIZE = 100;
103   /**
104    * The period that MobCompactionChore runs. The unit is second.
105    * The default value is one week.
106    */
107   public static final String MOB_COMPACTION_CHORE_PERIOD =
108     "hbase.mob.compaction.chore.period";
109   public static final int DEFAULT_MOB_COMPACTION_CHORE_PERIOD =
110     24 * 60 * 60 * 7; // a week
111   public static final String MOB_COMPACTOR_CLASS_KEY = "hbase.mob.compactor.class";
112   /**
113    * The max number of threads used in MobCompactor.
114    */
115   public static final String MOB_COMPACTION_THREADS_MAX =
116     "hbase.mob.compaction.threads.max";
117   public static final int DEFAULT_MOB_COMPACTION_THREADS_MAX = 1;
118   private MobConstants() {
119 
120   }
121 }