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 public static final String MOB_FILE_CACHE_SIZE_KEY = "hbase.mob.file.cache.size"; 038 public static final int DEFAULT_MOB_FILE_CACHE_SIZE = 1000; 039 public static final String MOB_DIR_NAME = "mobdir"; 040 public static final String MOB_REGION_NAME = ".mob"; 041 public static final byte[] MOB_REGION_NAME_BYTES = Bytes.toBytes(MOB_REGION_NAME); 042 public static final String MOB_CLEANER_PERIOD = "hbase.master.mob.cleaner.period"; 043 public static final String DEPRECATED_MOB_CLEANER_PERIOD = "hbase.master.mob.ttl.cleaner.period"; 044 public static final int DEFAULT_MOB_CLEANER_PERIOD = 24 * 60 * 60; // one day 045 public static final String MOB_CACHE_EVICT_PERIOD = "hbase.mob.cache.evict.period"; 046 public static final String MOB_CACHE_EVICT_REMAIN_RATIO = "hbase.mob.cache.evict.remain.ratio"; 047 public static final Tag MOB_REF_TAG = 048 new ArrayBackedTag(TagType.MOB_REFERENCE_TAG_TYPE, HConstants.EMPTY_BYTE_ARRAY); 049 public static final String MOB_CLEANER_BATCH_SIZE_UPPER_BOUND = 050 "hbase.master.mob.cleaner.batch.size.upper.bound"; 051 public static final int DEFAULT_MOB_CLEANER_BATCH_SIZE_UPPER_BOUND = 10000; 052 053 public static final float DEFAULT_EVICT_REMAIN_RATIO = 0.5f; 054 public static final long DEFAULT_MOB_CACHE_EVICT_PERIOD = 3600L; 055 056 public final static String TEMP_DIR_NAME = ".tmp"; 057 058 /** 059 * The max number of a MOB table regions that is allowed in a batch of the mob compaction. By 060 * setting this number to a custom value, users can control the overall effect of a major 061 * compaction of a large MOB-enabled table. 062 */ 063 064 public static final String MOB_MAJOR_COMPACTION_REGION_BATCH_SIZE = 065 "hbase.mob.major.compaction.region.batch.size"; 066 067 /** 068 * Default is 0 - means no limit - all regions of a MOB table will be compacted at once 069 */ 070 071 public static final int DEFAULT_MOB_MAJOR_COMPACTION_REGION_BATCH_SIZE = 0; 072 073 /** 074 * The period that MobCompactionChore runs. The unit is second. The default value is one week. 075 */ 076 public static final String MOB_COMPACTION_CHORE_PERIOD = "hbase.mob.compaction.chore.period"; 077 public static final int DEFAULT_MOB_COMPACTION_CHORE_PERIOD = 24 * 60 * 60 * 7; // a week 078 public static final String MOB_COMPACTOR_CLASS_KEY = "hbase.mob.compactor.class"; 079 080 /** 081 * Mob compaction type: "full", "optimized" "full" - run full major compaction (during migration) 082 * "optimized" - optimized version for use case with infrequent updates/deletes 083 */ 084 085 public final static String OPTIMIZED_MOB_COMPACTION_TYPE = "optimized"; 086 087 public final static String FULL_MOB_COMPACTION_TYPE = "full"; 088 089 public final static String MOB_COMPACTION_TYPE_KEY = "hbase.mob.compaction.type"; 090 091 public final static String DEFAULT_MOB_COMPACTION_TYPE = FULL_MOB_COMPACTION_TYPE; 092 093 /** 094 * Maximum size of a MOB compaction selection 095 */ 096 public static final String MOB_COMPACTION_MAX_FILE_SIZE_KEY = 097 "hbase.mob.compactions.max.file.size"; 098 /** 099 * Default maximum selection size = 1GB 100 */ 101 public static final long DEFAULT_MOB_COMPACTION_MAX_FILE_SIZE = 1024 * 1024 * 1024; 102 103 /** 104 * Use this configuration option with caution, only during upgrade procedure to handle missing MOB 105 * cells during compaction. 106 */ 107 public static final String MOB_UNSAFE_DISCARD_MISS_KEY = "hbase.unsafe.mob.discard.miss"; 108 109 public static final boolean DEFAULT_MOB_DISCARD_MISS = false; 110 111 /** 112 * Minimum MOB file age to archive, default (3600000 - 1h) 113 */ 114 public static final String MIN_AGE_TO_ARCHIVE_KEY = "hbase.mob.min.age.archive"; 115 116 public static final long DEFAULT_MIN_AGE_TO_ARCHIVE = 3600000; // 1h 117 118 /** 119 * Old configuration parameters (obsolete) 120 */ 121 122 public final static String BULKLOAD_DIR_NAME = ".bulkload"; 123 public final static byte[] MOB_TABLE_LOCK_SUFFIX = Bytes.toBytes(".mobLock"); 124 public final static String EMPTY_STRING = ""; 125 /** 126 * If the size of a mob file is less than this value, it's regarded as a small file and needs to 127 * be merged in mob compaction. The default value is 1280MB. 128 */ 129 public static final String MOB_COMPACTION_MERGEABLE_THRESHOLD = 130 "hbase.mob.compaction.mergeable.threshold"; 131 public static final long DEFAULT_MOB_COMPACTION_MERGEABLE_THRESHOLD = 10 * 128 * 1024 * 1024; 132 /** 133 * The max number of del files that is allowed in the mob file compaction. In the mob compaction, 134 * when the number of existing del files is larger than this value, they are merged until number 135 * of del files is not larger this value. The default value is 3. 136 */ 137 public static final String MOB_DELFILE_MAX_COUNT = "hbase.mob.delfile.max.count"; 138 public static final int DEFAULT_MOB_DELFILE_MAX_COUNT = 3; 139 /** 140 * The max number of the mob files that is allowed in a batch of the mob compaction. The mob 141 * compaction merges the small mob files to bigger ones. If the number of the small files is very 142 * large, it could lead to a "too many opened file handlers" in the merge. And the merge has to be 143 * split into batches. This value limits the number of mob files that are selected in a batch of 144 * the mob compaction. The default value is 100. Default is 0 - means no limit - all regions of a 145 * MOB table will be compacted at once 146 */ 147 public static final String MOB_COMPACTION_BATCH_SIZE = "hbase.mob.compaction.batch.size"; 148 public static final int DEFAULT_MOB_COMPACTION_BATCH_SIZE = 100; 149 public static final String MOB_COMPACTION_THREADS_MAX = "hbase.mob.compaction.threads.max"; 150 public static final int DEFAULT_MOB_COMPACTION_THREADS_MAX = 1; 151 152 private MobConstants() { 153 154 } 155}