001/**
002 *
003 * Licensed to the Apache Software Foundation (ASF) under one
004 * or more contributor license agreements.  See the NOTICE file
005 * distributed with this work for additional information
006 * regarding copyright ownership.  The ASF licenses this file
007 * to you under the Apache License, Version 2.0 (the
008 * "License"); you may not use this file except in compliance
009 * with the License.  You may obtain a copy of the License at
010 *
011 *     http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing, software
014 * distributed under the License is distributed on an "AS IS" BASIS,
015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016 * See the License for the specific language governing permissions and
017 * limitations under the License.
018 */
019package org.apache.hadoop.hbase.mob;
020
021import org.apache.hadoop.hbase.ArrayBackedTag;
022import org.apache.hadoop.hbase.HConstants;
023import org.apache.hadoop.hbase.Tag;
024import org.apache.hadoop.hbase.TagType;
025import org.apache.yetus.audience.InterfaceAudience;
026import org.apache.hadoop.hbase.util.Bytes;
027
028/**
029 * The constants used in mob.
030 */
031@InterfaceAudience.Public
032public final class MobConstants {
033
034  public static final String MOB_SCAN_RAW = "hbase.mob.scan.raw";
035  public static final String MOB_CACHE_BLOCKS = "hbase.mob.cache.blocks";
036  public static final String MOB_SCAN_REF_ONLY = "hbase.mob.scan.ref.only";
037  public static final String EMPTY_VALUE_ON_MOBCELL_MISS = "empty.value.on.mobcell.miss";
038  public static final String MOB_FILE_CACHE_SIZE_KEY = "hbase.mob.file.cache.size";
039  public static final int DEFAULT_MOB_FILE_CACHE_SIZE = 1000;
040  public static final String MOB_DIR_NAME = "mobdir";
041  public static final String MOB_REGION_NAME = ".mob";
042  public static final byte[] MOB_REGION_NAME_BYTES = Bytes.toBytes(MOB_REGION_NAME);
043  public static final String MOB_CLEANER_PERIOD = "hbase.master.mob.cleaner.period";
044  public static final String DEPRECATED_MOB_CLEANER_PERIOD = "hbase.master.mob.ttl.cleaner.period";
045  public static final int DEFAULT_MOB_CLEANER_PERIOD = 24 * 60 * 60; // one day
046  public static final String MOB_CACHE_EVICT_PERIOD = "hbase.mob.cache.evict.period";
047  public static final String MOB_CACHE_EVICT_REMAIN_RATIO = "hbase.mob.cache.evict.remain.ratio";
048  public static final Tag MOB_REF_TAG =
049      new ArrayBackedTag(TagType.MOB_REFERENCE_TAG_TYPE, HConstants.EMPTY_BYTE_ARRAY);
050
051  public static final float DEFAULT_EVICT_REMAIN_RATIO = 0.5f;
052  public static final long DEFAULT_MOB_CACHE_EVICT_PERIOD = 3600L;
053
054  public final static String TEMP_DIR_NAME = ".tmp";
055
056  /**
057   * The max number of a MOB table regions that is allowed in a batch of the mob compaction. By
058   * setting this number to a custom value, users can control the overall effect of a major
059   * compaction of a large MOB-enabled table.
060   */
061
062  public static final String MOB_MAJOR_COMPACTION_REGION_BATCH_SIZE =
063      "hbase.mob.major.compaction.region.batch.size";
064
065  /**
066   * Default is 0 - means no limit - all regions of a MOB table will be compacted at once
067   */
068
069  public static final int DEFAULT_MOB_MAJOR_COMPACTION_REGION_BATCH_SIZE = 0;
070
071  /**
072   * The period that MobCompactionChore runs. The unit is second. The default value is one week.
073   */
074  public static final String MOB_COMPACTION_CHORE_PERIOD = "hbase.mob.compaction.chore.period";
075  public static final int DEFAULT_MOB_COMPACTION_CHORE_PERIOD = 24 * 60 * 60 * 7; // a week
076  public static final String MOB_COMPACTOR_CLASS_KEY = "hbase.mob.compactor.class";
077
078  /**
079   * Mob compaction type: "full", "optimized" "full" - run full major compaction (during migration)
080   * "optimized" - optimized version for use case with infrequent updates/deletes
081   */
082
083  public final static String OPTIMIZED_MOB_COMPACTION_TYPE = "optimized";
084
085  public final static String FULL_MOB_COMPACTION_TYPE = "full";
086
087  public final static String MOB_COMPACTION_TYPE_KEY = "hbase.mob.compaction.type";
088
089  public final static String DEFAULT_MOB_COMPACTION_TYPE = FULL_MOB_COMPACTION_TYPE;
090
091  /**
092   * Maximum size of a MOB compaction selection
093   */
094  public static final String MOB_COMPACTION_MAX_FILE_SIZE_KEY =
095      "hbase.mob.compactions.max.file.size";
096  /**
097   * Default maximum selection size = 1GB
098   */
099  public static final long DEFAULT_MOB_COMPACTION_MAX_FILE_SIZE = 1024 * 1024 * 1024;
100
101  /**
102   * Use this configuration option with caution, only during upgrade procedure to handle missing MOB
103   * cells during compaction.
104   */
105  public static final String MOB_UNSAFE_DISCARD_MISS_KEY = "hbase.unsafe.mob.discard.miss";
106
107  public static final boolean DEFAULT_MOB_DISCARD_MISS = false;
108
109  /**
110   * Minimum MOB file age to archive, default (3600000 - 1h)
111   */
112  public static final String MIN_AGE_TO_ARCHIVE_KEY = "hbase.mob.min.age.archive";
113
114  public static final long DEFAULT_MIN_AGE_TO_ARCHIVE = 3600000; // 1h
115
116  /**
117   * Old configuration parameters (obsolete)
118   */
119
120  public final static String BULKLOAD_DIR_NAME = ".bulkload";
121  public final static byte[] MOB_TABLE_LOCK_SUFFIX = Bytes.toBytes(".mobLock");
122  public final static String EMPTY_STRING = "";
123  /**
124   * If the size of a mob file is less than this value, it's regarded as a small file and needs to
125   * be merged in mob compaction. The default value is 1280MB.
126   */
127  public static final String MOB_COMPACTION_MERGEABLE_THRESHOLD =
128      "hbase.mob.compaction.mergeable.threshold";
129  public static final long DEFAULT_MOB_COMPACTION_MERGEABLE_THRESHOLD = 10 * 128 * 1024 * 1024;
130  public static final String MOB_DELFILE_MAX_COUNT = "hbase.mob.delfile.max.count";
131  public static final int DEFAULT_MOB_DELFILE_MAX_COUNT = 3;
132  /**
133   * The max number of the mob files that is allowed in a batch of the mob compaction. The mob
134   * compaction merges the small mob files to bigger ones. If the number of the small files is very
135   * large, it could lead to a "too many opened file handlers" in the merge. And the merge has to be
136   * split into batches. This value limits the number of mob files that are selected in a batch of
137   * the mob compaction. The default value is 100. Default is 0 - means no limit - all regions of a
138   * MOB table will be compacted at once
139   */
140  public static final String MOB_COMPACTION_BATCH_SIZE = "hbase.mob.compaction.batch.size";
141  public static final int DEFAULT_MOB_COMPACTION_BATCH_SIZE = 100;
142  public static final String MOB_COMPACTION_THREADS_MAX = "hbase.mob.compaction.threads.max";
143  public static final int DEFAULT_MOB_COMPACTION_THREADS_MAX = 1;
144
145  private MobConstants() {
146
147  }
148}