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.ArrayBackedTag;
021import org.apache.hadoop.hbase.HConstants;
022import org.apache.hadoop.hbase.Tag;
023import org.apache.hadoop.hbase.TagType;
024import org.apache.hadoop.hbase.util.Bytes;
025import org.apache.yetus.audience.InterfaceAudience;
026
027/**
028 * The constants used in mob.
029 */
030@InterfaceAudience.Public
031public final class MobConstants {
032
033  public static final String MOB_SCAN_RAW = "hbase.mob.scan.raw";
034  public static final String MOB_CACHE_BLOCKS = "hbase.mob.cache.blocks";
035  public static final String MOB_SCAN_REF_ONLY = "hbase.mob.scan.ref.only";
036  public static final String EMPTY_VALUE_ON_MOBCELL_MISS = "empty.value.on.mobcell.miss";
037
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
041  public static final String MOB_DIR_NAME = "mobdir";
042  public static final String MOB_REGION_NAME = ".mob";
043  public static final byte[] MOB_REGION_NAME_BYTES = Bytes.toBytes(MOB_REGION_NAME);
044
045  public static final String MOB_CLEANER_PERIOD = "hbase.master.mob.ttl.cleaner.period";
046  public static final int DEFAULT_MOB_CLEANER_PERIOD = 24 * 60 * 60; // one day
047
048  public static final String MOB_CACHE_EVICT_PERIOD = "hbase.mob.cache.evict.period";
049  public static final String MOB_CACHE_EVICT_REMAIN_RATIO = "hbase.mob.cache.evict.remain.ratio";
050  public static final Tag MOB_REF_TAG =
051    new ArrayBackedTag(TagType.MOB_REFERENCE_TAG_TYPE, HConstants.EMPTY_BYTE_ARRAY);
052  public static final String MOB_CLEANER_BATCH_SIZE_UPPER_BOUND =
053    "hbase.master.mob.cleaner.batch.size.upper.bound";
054  public static final int DEFAULT_MOB_CLEANER_BATCH_SIZE_UPPER_BOUND = 10000;
055
056  public static final float DEFAULT_EVICT_REMAIN_RATIO = 0.5f;
057  public static final long DEFAULT_MOB_CACHE_EVICT_PERIOD = 3600L;
058
059  public final static String TEMP_DIR_NAME = ".tmp";
060  public final static String BULKLOAD_DIR_NAME = ".bulkload";
061  public final static byte[] MOB_TABLE_LOCK_SUFFIX = Bytes.toBytes(".mobLock");
062  public final static String EMPTY_STRING = "";
063  /**
064   * If the size of a mob file is less than this value, it's regarded as a small file and needs to
065   * be merged in mob compaction. The default value is 1280MB.
066   */
067  public static final String MOB_COMPACTION_MERGEABLE_THRESHOLD =
068    "hbase.mob.compaction.mergeable.threshold";
069  public static final long DEFAULT_MOB_COMPACTION_MERGEABLE_THRESHOLD = 10 * 128 * 1024 * 1024;
070  /**
071   * The max number of del files that is allowed in the mob file compaction. In the mob compaction,
072   * when the number of existing del files is larger than this value, they are merged until number
073   * of del files is not larger this value. The default value is 3.
074   */
075  public static final String MOB_DELFILE_MAX_COUNT = "hbase.mob.delfile.max.count";
076  public static final int DEFAULT_MOB_DELFILE_MAX_COUNT = 3;
077  /**
078   * The max number of the mob files that is allowed in a batch of the mob compaction. The mob
079   * compaction merges the small mob files to bigger ones. If the number of the small files is very
080   * large, it could lead to a "too many opened file handlers" in the merge. And the merge has to be
081   * split into batches. This value limits the number of mob files that are selected in a batch of
082   * the mob compaction. The default value is 100.
083   */
084  public static final String MOB_COMPACTION_BATCH_SIZE = "hbase.mob.compaction.batch.size";
085  public static final int DEFAULT_MOB_COMPACTION_BATCH_SIZE = 100;
086  /**
087   * The period that MobCompactionChore runs. The unit is second. The default value is one week.
088   */
089  public static final String MOB_COMPACTION_CHORE_PERIOD = "hbase.mob.compaction.chore.period";
090  public static final int DEFAULT_MOB_COMPACTION_CHORE_PERIOD = 24 * 60 * 60 * 7; // a week
091  public static final String MOB_COMPACTOR_CLASS_KEY = "hbase.mob.compactor.class";
092  /**
093   * The max number of threads used in MobCompactor.
094   */
095  public static final String MOB_COMPACTION_THREADS_MAX = "hbase.mob.compaction.threads.max";
096  public static final int DEFAULT_MOB_COMPACTION_THREADS_MAX = 1;
097
098  private MobConstants() {
099
100  }
101}