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 public static final String MOB_COMPACTION_READ_CACHE_BLOCKS = 080 "hbase.mob.compaction.read.cache.blocks"; 081 public static final boolean DEFAULT_MOB_COMPACTION_READ_CACHE_BLOCKS = true; 082 083 /** 084 * Mob compaction type: "full", "optimized" "full" - run full major compaction (during migration) 085 * "optimized" - optimized version for use case with infrequent updates/deletes 086 */ 087 088 public final static String OPTIMIZED_MOB_COMPACTION_TYPE = "optimized"; 089 090 public final static String FULL_MOB_COMPACTION_TYPE = "full"; 091 092 public final static String MOB_COMPACTION_TYPE_KEY = "hbase.mob.compaction.type"; 093 094 public final static String DEFAULT_MOB_COMPACTION_TYPE = FULL_MOB_COMPACTION_TYPE; 095 096 /** 097 * Maximum size of a MOB compaction selection 098 */ 099 public static final String MOB_COMPACTION_MAX_FILE_SIZE_KEY = 100 "hbase.mob.compactions.max.file.size"; 101 /** 102 * Default maximum selection size = 1GB 103 */ 104 public static final long DEFAULT_MOB_COMPACTION_MAX_FILE_SIZE = 1024 * 1024 * 1024; 105 106 /** 107 * Use this configuration option with caution, only during upgrade procedure to handle missing MOB 108 * cells during compaction. 109 */ 110 public static final String MOB_UNSAFE_DISCARD_MISS_KEY = "hbase.unsafe.mob.discard.miss"; 111 112 public static final boolean DEFAULT_MOB_DISCARD_MISS = false; 113 114 /** 115 * Minimum MOB file age to archive, default (3600000 - 1h) 116 */ 117 public static final String MIN_AGE_TO_ARCHIVE_KEY = "hbase.mob.min.age.archive"; 118 119 public static final long DEFAULT_MIN_AGE_TO_ARCHIVE = 3600000; // 1h 120 121 /** 122 * Old configuration parameters (obsolete) 123 */ 124 125 public final static String BULKLOAD_DIR_NAME = ".bulkload"; 126 public final static byte[] MOB_TABLE_LOCK_SUFFIX = Bytes.toBytes(".mobLock"); 127 public final static String EMPTY_STRING = ""; 128 /** 129 * If the size of a mob file is less than this value, it's regarded as a small file and needs to 130 * be merged in mob compaction. The default value is 1280MB. 131 */ 132 public static final String MOB_COMPACTION_MERGEABLE_THRESHOLD = 133 "hbase.mob.compaction.mergeable.threshold"; 134 public static final long DEFAULT_MOB_COMPACTION_MERGEABLE_THRESHOLD = 10 * 128 * 1024 * 1024; 135 public static final String MOB_DELFILE_MAX_COUNT = "hbase.mob.delfile.max.count"; 136 public static final int DEFAULT_MOB_DELFILE_MAX_COUNT = 3; 137 /** 138 * The max number of the mob files that is allowed in a batch of the mob compaction. The mob 139 * compaction merges the small mob files to bigger ones. If the number of the small files is very 140 * large, it could lead to a "too many opened file handlers" in the merge. And the merge has to be 141 * split into batches. This value limits the number of mob files that are selected in a batch of 142 * the mob compaction. The default value is 100. Default is 0 - means no limit - all regions of a 143 * MOB table will be compacted at once 144 */ 145 public static final String MOB_COMPACTION_BATCH_SIZE = "hbase.mob.compaction.batch.size"; 146 public static final int DEFAULT_MOB_COMPACTION_BATCH_SIZE = 100; 147 public static final String MOB_COMPACTION_THREADS_MAX = "hbase.mob.compaction.threads.max"; 148 public static final int DEFAULT_MOB_COMPACTION_THREADS_MAX = 1; 149 150 public static final String MOB_CLEANER_THREAD_COUNT = "hbase.master.mob.cleaner.threads"; 151 public static final int DEFAULT_MOB_CLEANER_THREAD_COUNT = 1; 152 public static final String MOB_FILE_CLEANER_CHORE_TIME_OUT = 153 "hbase.master.mob.cleaner.chore.timeout"; 154 public static final int DEFAULT_MOB_FILE_CLEANER_CHORE_TIME_OUT = 5 * 60; // 5 minutes 155 156 private MobConstants() { 157 158 } 159}