View Javadoc

1   /**
2    * Copyright 2010 The Apache Software Foundation
3    *
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *     http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS,
16   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17   * See the License for the specific language governing permissions and
18   * limitations under the License.
19   */
20  package org.apache.hadoop.hbase;
21  
22  import java.util.Arrays;
23  import java.util.Collections;
24  import java.util.List;
25  import java.util.UUID;
26  import java.util.regex.Pattern;
27  
28  import org.apache.commons.lang.ArrayUtils;
29  import org.apache.hadoop.hbase.ipc.HRegionInterface;
30  import org.apache.hadoop.hbase.util.Bytes;
31  
32  /**
33   * HConstants holds a bunch of HBase-related constants
34   */
35  public final class HConstants {
36    /**
37     * Status codes used for return values of bulk operations.
38     */
39    public enum OperationStatusCode {
40      NOT_RUN,
41      SUCCESS,
42      BAD_FAMILY,
43      SANITY_CHECK_FAILURE,
44      FAILURE;
45    }
46  
47    /** long constant for zero */
48    public static final Long ZERO_L = Long.valueOf(0L);
49    public static final String NINES = "99999999999999";
50    public static final String ZEROES = "00000000000000";
51  
52    // For migration
53  
54    /** name of version file */
55    public static final String VERSION_FILE_NAME = "hbase.version";
56  
57    /**
58     * Current version of file system.
59     * Version 4 supports only one kind of bloom filter.
60     * Version 5 changes versions in catalog table regions.
61     * Version 6 enables blockcaching on catalog tables.
62     * Version 7 introduces hfile -- hbase 0.19 to 0.20..
63     */
64    // public static final String FILE_SYSTEM_VERSION = "6";
65    public static final String FILE_SYSTEM_VERSION = "7";
66  
67    // Configuration parameters
68  
69    //TODO: Is having HBase homed on port 60k OK?
70  
71    /** Cluster is in distributed mode or not */
72    public static final String CLUSTER_DISTRIBUTED = "hbase.cluster.distributed";
73  
74    /** Config for pluggable load balancers */
75    public static final String HBASE_MASTER_LOADBALANCER_CLASS = "hbase.master.loadbalancer.class";
76    
77    /** Config for pluggable hbase cluster manager */
78    public static final String HBASE_CLUSTER_MANAGER_CLASS = "hbase.it.clustermanager.class";
79    
80    /** Cluster is standalone or pseudo-distributed */
81    public static final boolean CLUSTER_IS_LOCAL = false;
82  
83    /** Cluster is fully-distributed */
84    public static final boolean CLUSTER_IS_DISTRIBUTED = true;
85  
86    /** Default value for cluster distributed mode */
87    public static final boolean DEFAULT_CLUSTER_DISTRIBUTED = CLUSTER_IS_LOCAL;
88  
89    /** default host address */
90    public static final String DEFAULT_HOST = "0.0.0.0";
91  
92    /** Parameter name for port master listens on. */
93    public static final String MASTER_PORT = "hbase.master.port";
94  
95    /** default port that the master listens on */
96    public static final int DEFAULT_MASTER_PORT = 60000;
97  
98    /** default port for master web api */
99    public static final int DEFAULT_MASTER_INFOPORT = 60010;
100 
101   /** Parameter name for the master type being backup (waits for primary to go inactive). */
102   public static final String MASTER_TYPE_BACKUP = "hbase.master.backup";
103 
104   /** by default every master is a possible primary master unless the conf explicitly overrides it */
105   public static final boolean DEFAULT_MASTER_TYPE_BACKUP = false;
106 
107   /** Name of ZooKeeper quorum configuration parameter. */
108   public static final String ZOOKEEPER_QUORUM = "hbase.zookeeper.quorum";
109 
110   /** Name of ZooKeeper config file in conf/ directory. */
111   public static final String ZOOKEEPER_CONFIG_NAME = "zoo.cfg";
112 
113   /** Common prefix of ZooKeeper configuration properties */
114   public static final String ZK_CFG_PROPERTY_PREFIX =
115       "hbase.zookeeper.property.";
116 
117   public static final int ZK_CFG_PROPERTY_PREFIX_LEN =
118       ZK_CFG_PROPERTY_PREFIX.length();
119 
120   /**
121    * The ZK client port key in the ZK properties map. The name reflects the
122    * fact that this is not an HBase configuration key.
123    */
124   public static final String CLIENT_PORT_STR = "clientPort";
125 
126   /** Parameter name for the client port that the zookeeper listens on */
127   public static final String ZOOKEEPER_CLIENT_PORT =
128       ZK_CFG_PROPERTY_PREFIX + CLIENT_PORT_STR;
129 
130   /** Default client port that the zookeeper listens on */
131   public static final int DEFAULT_ZOOKEPER_CLIENT_PORT = 2181;
132 
133   /** Parameter name for the wait time for the recoverable zookeeper */
134   public static final String ZOOKEEPER_RECOVERABLE_WAITTIME = "hbase.zookeeper.recoverable.waittime";
135 
136   /** Default wait time for the recoverable zookeeper */
137   public static final long DEFAULT_ZOOKEPER_RECOVERABLE_WAITIME = 10000;
138 
139   /** Parameter name for the root dir in ZK for this cluster */
140   public static final String ZOOKEEPER_ZNODE_PARENT = "zookeeper.znode.parent";
141 
142   public static final String DEFAULT_ZOOKEEPER_ZNODE_PARENT = "/hbase";
143 
144   /**
145    * Parameter name for the limit on concurrent client-side zookeeper
146    * connections
147    */
148   public static final String ZOOKEEPER_MAX_CLIENT_CNXNS =
149       ZK_CFG_PROPERTY_PREFIX + "maxClientCnxns";
150 
151   /** Parameter name for the ZK data directory */
152   public static final String ZOOKEEPER_DATA_DIR =
153       ZK_CFG_PROPERTY_PREFIX + "dataDir";
154 
155   /** Default limit on concurrent client-side zookeeper connections */
156   public static final int DEFAULT_ZOOKEPER_MAX_CLIENT_CNXNS = 300;
157 
158   /** Configuration key for ZooKeeper session timeout */
159   public static final String ZK_SESSION_TIMEOUT = "zookeeper.session.timeout";
160 
161   /** Default value for ZooKeeper session timeout */
162   public static final int DEFAULT_ZK_SESSION_TIMEOUT = 180 * 1000;
163 
164   /** Configuration key for whether to use ZK.multi */
165   public static final String ZOOKEEPER_USEMULTI = "hbase.zookeeper.useMulti";
166 
167   /** Parameter name for port region server listens on. */
168   public static final String REGIONSERVER_PORT = "hbase.regionserver.port";
169 
170   /** Default port region server listens on. */
171   public static final int DEFAULT_REGIONSERVER_PORT = 60020;
172 
173   /** default port for region server web api */
174   public static final int DEFAULT_REGIONSERVER_INFOPORT = 60030;
175 
176   /** A flag that enables automatic selection of regionserver info port */
177   public static final String REGIONSERVER_INFO_PORT_AUTO =
178     "hbase.regionserver.info.port.auto";
179 
180   /** Parameter name for what region server interface to use. */
181   public static final String REGION_SERVER_CLASS = "hbase.regionserver.class";
182 
183   /** Parameter name for what region server implementation to use. */
184   public static final String REGION_SERVER_IMPL= "hbase.regionserver.impl";
185 
186   /** Default region server interface class name. */
187   public static final String DEFAULT_REGION_SERVER_CLASS = HRegionInterface.class.getName();
188 
189   /** Parameter name for what master implementation to use. */
190   public static final String MASTER_IMPL= "hbase.master.impl";
191 
192   /** Parameter name for how often threads should wake up */
193   public static final String THREAD_WAKE_FREQUENCY = "hbase.server.thread.wakefrequency";
194 
195   /** Default value for thread wake frequency */
196   public static final int DEFAULT_THREAD_WAKE_FREQUENCY = 10 * 1000;
197 
198   /** Parameter name for how often we should try to write a version file, before failing */
199   public static final String VERSION_FILE_WRITE_ATTEMPTS = "hbase.server.versionfile.writeattempts";
200 
201   /** Parameter name for how often we should try to write a version file, before failing */
202   public static final int DEFAULT_VERSION_FILE_WRITE_ATTEMPTS = 3;
203 
204   /** Parameter name for how often a region should should perform a major compaction */
205   public static final String MAJOR_COMPACTION_PERIOD = "hbase.hregion.majorcompaction";
206 
207   /** Parameter name for the maximum batch of KVs to be used in flushes and compactions */
208   public static final String COMPACTION_KV_MAX = "hbase.hstore.compaction.kv.max";
209 
210   /** Parameter name for HBase instance root directory */
211   public static final String HBASE_DIR = "hbase.rootdir";
212 
213   /** Parameter name for HBase client IPC pool type */
214   public static final String HBASE_CLIENT_IPC_POOL_TYPE = "hbase.client.ipc.pool.type";
215 
216   /** Parameter name for HBase client IPC pool size */
217   public static final String HBASE_CLIENT_IPC_POOL_SIZE = "hbase.client.ipc.pool.size";
218 
219   /** Parameter name for HBase client operation timeout, which overrides RPC timeout */
220   public static final String HBASE_CLIENT_OPERATION_TIMEOUT = "hbase.client.operation.timeout";
221 
222   /** Default HBase client operation timeout, which is tantamount to a blocking call */
223   public static final int DEFAULT_HBASE_CLIENT_OPERATION_TIMEOUT = Integer.MAX_VALUE;
224 
225   /** Used to construct the name of the log directory for a region server
226    * Use '.' as a special character to seperate the log files from table data */
227   public static final String HREGION_LOGDIR_NAME = ".logs";
228 
229   /** Used to construct the name of the splitlog directory for a region server */
230   public static final String SPLIT_LOGDIR_NAME = "splitlog";
231 
232   public static final String CORRUPT_DIR_NAME = ".corrupt";
233 
234   /** Like the previous, but for old logs that are about to be deleted */
235   public static final String HREGION_OLDLOGDIR_NAME = ".oldlogs";
236 
237   /** Used by HBCK to sideline backup data */
238   public static final String HBCK_SIDELINEDIR_NAME = ".hbck";
239 
240   /** Used to construct the name of the compaction directory during compaction */
241   public static final String HREGION_COMPACTIONDIR_NAME = "compaction.dir";
242 
243   /** Conf key for the max file size after which we split the region */
244   public static final String HREGION_MAX_FILESIZE =
245       "hbase.hregion.max.filesize";
246 
247   /** Default maximum file size */
248   public static final long DEFAULT_MAX_FILE_SIZE = 10 * 1024 * 1024 * 1024L;
249 
250   /**
251    * The max number of threads used for opening and closing stores or store
252    * files in parallel
253    */
254   public static final String HSTORE_OPEN_AND_CLOSE_THREADS_MAX =
255     "hbase.hstore.open.and.close.threads.max";
256 
257   /**
258    * The default number for the max number of threads used for opening and
259    * closing stores or store files in parallel
260    */
261   public static final int DEFAULT_HSTORE_OPEN_AND_CLOSE_THREADS_MAX = 1;
262 
263 
264   /** Conf key for the memstore size at which we flush the memstore */
265   public static final String HREGION_MEMSTORE_FLUSH_SIZE =
266       "hbase.hregion.memstore.flush.size";
267 
268   /** Default size of a reservation block   */
269   public static final int DEFAULT_SIZE_RESERVATION_BLOCK = 1024 * 1024 * 5;
270 
271   /** Maximum value length, enforced on KeyValue construction */
272   public static final int MAXIMUM_VALUE_LENGTH = Integer.MAX_VALUE;
273 
274   /** name of the file for unique cluster ID */
275   public static final String CLUSTER_ID_FILE_NAME = "hbase.id";
276 
277   /** Configuration key storing the cluster ID */
278   public static final String CLUSTER_ID = "hbase.cluster.id";
279 
280   // Always store the location of the root table's HRegion.
281   // This HRegion is never split.
282 
283   // region name = table + startkey + regionid. This is the row key.
284   // each row in the root and meta tables describes exactly 1 region
285   // Do we ever need to know all the information that we are storing?
286 
287   // Note that the name of the root table starts with "-" and the name of the
288   // meta table starts with "." Why? it's a trick. It turns out that when we
289   // store region names in memory, we use a SortedMap. Since "-" sorts before
290   // "." (and since no other table name can start with either of these
291   // characters, the root region will always be the first entry in such a Map,
292   // followed by all the meta regions (which will be ordered by their starting
293   // row key as well), followed by all user tables. So when the Master is
294   // choosing regions to assign, it will always choose the root region first,
295   // followed by the meta regions, followed by user regions. Since the root
296   // and meta regions always need to be on-line, this ensures that they will
297   // be the first to be reassigned if the server(s) they are being served by
298   // should go down.
299 
300   /** The root table's name.*/
301   public static final byte [] ROOT_TABLE_NAME = Bytes.toBytes("-ROOT-");
302 
303   /** The META table's name. */
304   public static final byte [] META_TABLE_NAME = Bytes.toBytes(".META.");
305 
306   /** delimiter used between portions of a region name */
307   public static final int META_ROW_DELIMITER = ',';
308 
309   /** The catalog family as a string*/
310   public static final String CATALOG_FAMILY_STR = "info";
311 
312   /** The catalog family */
313   public static final byte [] CATALOG_FAMILY = Bytes.toBytes(CATALOG_FAMILY_STR);
314 
315   /** The regioninfo column qualifier */
316   public static final byte [] REGIONINFO_QUALIFIER = Bytes.toBytes("regioninfo");
317 
318   /** The server column qualifier */
319   public static final byte [] SERVER_QUALIFIER = Bytes.toBytes("server");
320 
321   /** The startcode column qualifier */
322   public static final byte [] STARTCODE_QUALIFIER = Bytes.toBytes("serverstartcode");
323 
324   /** The lower-half split region column qualifier */
325   public static final byte [] SPLITA_QUALIFIER = Bytes.toBytes("splitA");
326 
327   /** The upper-half split region column qualifier */
328   public static final byte [] SPLITB_QUALIFIER = Bytes.toBytes("splitB");
329 
330   /**
331    * The meta table version column qualifier.
332    * We keep current version of the meta table in this column in <code>-ROOT-</code>
333    * table: i.e. in the 'info:v' column.
334    */
335   public static final byte [] META_VERSION_QUALIFIER = Bytes.toBytes("v");
336 
337   /**
338    * The current version of the meta table.
339    * Before this the meta had HTableDescriptor serialized into the HRegionInfo;
340    * i.e. pre-hbase 0.92.  There was no META_VERSION column in the root table
341    * in this case.  The presence of a version and its value being zero indicates
342    * meta is up-to-date.
343    */
344   public static final short META_VERSION = 0;
345 
346   // Other constants
347 
348   /**
349    * An empty instance.
350    */
351   public static final byte [] EMPTY_BYTE_ARRAY = new byte [0];
352 
353   /**
354    * Used by scanners, etc when they want to start at the beginning of a region
355    */
356   public static final byte [] EMPTY_START_ROW = EMPTY_BYTE_ARRAY;
357 
358   /**
359    * Last row in a table.
360    */
361   public static final byte [] EMPTY_END_ROW = EMPTY_START_ROW;
362 
363   /**
364     * Used by scanners and others when they're trying to detect the end of a
365     * table
366     */
367   public static final byte [] LAST_ROW = EMPTY_BYTE_ARRAY;
368 
369   /**
370    * Max length a row can have because of the limitation in TFile.
371    */
372   public static final int MAX_ROW_LENGTH = Short.MAX_VALUE;
373 
374   /** When we encode strings, we always specify UTF8 encoding */
375   public static final String UTF8_ENCODING = "UTF-8";
376 
377   /**
378    * Timestamp to use when we want to refer to the latest cell.
379    * This is the timestamp sent by clients when no timestamp is specified on
380    * commit.
381    */
382   public static final long LATEST_TIMESTAMP = Long.MAX_VALUE;
383 
384   /**
385    * Timestamp to use when we want to refer to the oldest cell.
386    */
387   public static final long OLDEST_TIMESTAMP = Long.MIN_VALUE;
388 
389   /**
390    * LATEST_TIMESTAMP in bytes form
391    */
392   public static final byte [] LATEST_TIMESTAMP_BYTES = Bytes.toBytes(LATEST_TIMESTAMP);
393 
394   /**
395    * Define for 'return-all-versions'.
396    */
397   public static final int ALL_VERSIONS = Integer.MAX_VALUE;
398 
399   /**
400    * Unlimited time-to-live.
401    */
402 //  public static final int FOREVER = -1;
403   public static final int FOREVER = Integer.MAX_VALUE;
404 
405   /**
406    * Seconds in a week
407    */
408   public static final int WEEK_IN_SECONDS = 7 * 24 * 3600;
409 
410   //TODO: although the following are referenced widely to format strings for
411   //      the shell. They really aren't a part of the public API. It would be
412   //      nice if we could put them somewhere where they did not need to be
413   //      public. They could have package visibility
414   public static final String NAME = "NAME";
415   public static final String VERSIONS = "VERSIONS";
416   public static final String IN_MEMORY = "IN_MEMORY";
417   public static final String CONFIG = "CONFIG";
418 
419   /**
420    * This is a retry backoff multiplier table similar to the BSD TCP syn
421    * backoff table, a bit more aggressive than simple exponential backoff.
422    */
423   public static int RETRY_BACKOFF[] = { 1, 1, 1, 2, 2, 4, 4, 8, 16, 32 };
424 
425   public static final String REGION_IMPL = "hbase.hregion.impl";
426 
427   /** modifyTable op for replacing the table descriptor */
428   public static enum Modify {
429     CLOSE_REGION,
430     TABLE_COMPACT,
431     TABLE_FLUSH,
432     TABLE_MAJOR_COMPACT,
433     TABLE_SET_HTD,
434     TABLE_SPLIT
435   }
436 
437   /**
438    * Scope tag for locally scoped data.
439    * This data will not be replicated.
440    */
441   public static final int REPLICATION_SCOPE_LOCAL = 0;
442 
443   /**
444    * Scope tag for globally scoped data.
445    * This data will be replicated to all peers.
446    */
447   public static final int REPLICATION_SCOPE_GLOBAL = 1;
448 
449   /**
450    * Default cluster ID, cannot be used to identify a cluster so a key with
451    * this value means it wasn't meant for replication.
452    */
453   public static final UUID DEFAULT_CLUSTER_ID = new UUID(0L,0L);
454 
455     /**
456      * Parameter name for maximum number of bytes returned when calling a
457      * scanner's next method.
458      */
459   public static String HBASE_CLIENT_SCANNER_MAX_RESULT_SIZE_KEY = "hbase.client.scanner.max.result.size";
460 
461   /**
462    * Maximum number of bytes returned when calling a scanner's next method.
463    * Note that when a single row is larger than this limit the row is still
464    * returned completely.
465    *
466    * The default value is unlimited.
467    */
468   public static long DEFAULT_HBASE_CLIENT_SCANNER_MAX_RESULT_SIZE = Long.MAX_VALUE;
469 
470   /**
471    * Parameter name for client pause value, used mostly as value to wait
472    * before running a retry of a failed get, region lookup, etc.
473    */
474   public static String HBASE_CLIENT_PAUSE = "hbase.client.pause";
475 
476   /**
477    * Default value of {@link #HBASE_CLIENT_PAUSE}.
478    */
479   public static long DEFAULT_HBASE_CLIENT_PAUSE = 1000;
480 
481   /**
482    * Parameter name for server pause value, used mostly as value to wait before
483    * running a retry of a failed operation.
484    */
485   public static String HBASE_SERVER_PAUSE = "hbase.server.pause";
486 
487   /**
488    * Default value of {@link #HBASE_SERVER_PAUSE}.
489    */
490   public static int DEFAULT_HBASE_SERVER_PAUSE = 1000;
491 
492   /**
493    * Parameter name for maximum retries, used as maximum for all retryable
494    * operations such as fetching of the root region from root region server,
495    * getting a cell's value, starting a row update, etc.
496    */
497   public static String HBASE_CLIENT_RETRIES_NUMBER = "hbase.client.retries.number";
498 
499   /**
500    * Default value of {@link #HBASE_CLIENT_RETRIES_NUMBER}.
501    */
502   public static int DEFAULT_HBASE_CLIENT_RETRIES_NUMBER = 10;
503 
504   /**
505    * Parameter name for maximum attempts, used to limit the number of times the
506    * client will try to obtain the proxy for a given region server.
507    */
508   public static String HBASE_CLIENT_RPC_MAXATTEMPTS = "hbase.client.rpc.maxattempts";
509 
510   /**
511    * Default value of {@link #HBASE_CLIENT_RPC_MAXATTEMPTS}.
512    */
513   public static int DEFAULT_HBASE_CLIENT_RPC_MAXATTEMPTS = 1;
514 
515   /**
516    * Parameter name for client prefetch limit, used as the maximum number of regions
517    * info that will be prefetched.
518    */
519   public static String HBASE_CLIENT_PREFETCH_LIMIT = "hbase.client.prefetch.limit";
520 
521   /**
522    * Default value of {@link #HBASE_CLIENT_PREFETCH_LIMIT}.
523    */
524   public static int DEFAULT_HBASE_CLIENT_PREFETCH_LIMIT = 10;
525 
526   /**
527    * Parameter name for number of rows that will be fetched when calling next on
528    * a scanner if it is not served from memory. Higher caching values will
529    * enable faster scanners but will eat up more memory and some calls of next
530    * may take longer and longer times when the cache is empty.
531    */
532   public static String HBASE_META_SCANNER_CACHING = "hbase.meta.scanner.caching";
533 
534   /**
535    * Default value of {@link #HBASE_META_SCANNER_CACHING}.
536    */
537   public static int DEFAULT_HBASE_META_SCANNER_CACHING = 100;
538 
539   /**
540    * Parameter name for unique identifier for this {@link org.apache.hadoop.conf.Configuration}
541    * instance. If there are two or more {@link org.apache.hadoop.conf.Configuration} instances that,
542    * for all intents and purposes, are the same except for their instance ids,
543    * then they will not be able to share the same {@link org.apache.hadoop.hbase.client.HConnection} instance.
544    * On the other hand, even if the instance ids are the same, it could result
545    * in non-shared {@link org.apache.hadoop.hbase.client.HConnection}
546    * instances if some of the other connection parameters differ.
547    */
548   public static String HBASE_CLIENT_INSTANCE_ID = "hbase.client.instance.id";
549 
550   /**
551    * HRegion server lease period in milliseconds. Clients must report in within this period
552    * else they are considered dead. Unit measured in ms (milliseconds).
553    */
554   public static String HBASE_REGIONSERVER_LEASE_PERIOD_KEY =
555     "hbase.regionserver.lease.period";
556 
557   /**
558    * Default value of {@link #HBASE_REGIONSERVER_LEASE_PERIOD_KEY}.
559    */
560   public static long DEFAULT_HBASE_REGIONSERVER_LEASE_PERIOD = 60000;
561 
562   /**
563    * timeout for each RPC
564    */
565   public static String HBASE_RPC_TIMEOUT_KEY = "hbase.rpc.timeout";
566 
567   /**
568    * Default value of {@link #HBASE_RPC_TIMEOUT_KEY}
569    */
570   public static int DEFAULT_HBASE_RPC_TIMEOUT = 60000;
571 
572   /*
573    * cluster replication constants.
574    */
575   public static final String
576       REPLICATION_ENABLE_KEY = "hbase.replication";
577   public static final String
578       REPLICATION_SOURCE_SERVICE_CLASSNAME = "hbase.replication.source.service";
579   public static final String
580       REPLICATION_SINK_SERVICE_CLASSNAME = "hbase.replication.sink.service";
581   public static final String REPLICATION_SERVICE_CLASSNAME_DEFAULT =
582     "org.apache.hadoop.hbase.replication.regionserver.Replication";
583 
584   /** HBCK special code name used as server name when manipulating ZK nodes */
585   public static final String HBCK_CODE_NAME = "HBCKServerName";
586 
587   public static final ServerName HBCK_CODE_SERVERNAME =
588     new ServerName(HBCK_CODE_NAME, -1, -1L);
589 
590   public static final String KEY_FOR_HOSTNAME_SEEN_BY_MASTER =
591     "hbase.regionserver.hostname.seen.by.master";
592 
593   public static final String HBASE_MASTER_LOGCLEANER_PLUGINS =
594       "hbase.master.logcleaner.plugins";
595 
596   public static final String HBASE_REGION_SPLIT_POLICY_KEY =
597     "hbase.regionserver.region.split.policy";
598 
599   /**
600    * Configuration key for the size of the block cache
601    */
602   public static final String HFILE_BLOCK_CACHE_SIZE_KEY =
603     "hfile.block.cache.size";
604 
605   public static final float HFILE_BLOCK_CACHE_SIZE_DEFAULT = 0.25f;
606 
607   /*
608     * Minimum percentage of free heap necessary for a successful cluster startup.
609     */
610   public static final float HBASE_CLUSTER_MINIMUM_MEMORY_THRESHOLD = 0.2f;
611 
612   public static final Pattern CP_HTD_ATTR_KEY_PATTERN = Pattern.compile
613       ("^coprocessor\\$([0-9]+)$", Pattern.CASE_INSENSITIVE);
614   public static final Pattern CP_HTD_ATTR_VALUE_PATTERN =
615       Pattern.compile("(^[^\\|]*)\\|([^\\|]+)\\|[\\s]*([\\d]*)[\\s]*(\\|.*)?$");
616 
617   public static final String CP_HTD_ATTR_VALUE_PARAM_KEY_PATTERN = "[^=,]+";
618   public static final String CP_HTD_ATTR_VALUE_PARAM_VALUE_PATTERN = "[^,]+";
619   public static final Pattern CP_HTD_ATTR_VALUE_PARAM_PATTERN = Pattern.compile(
620       "(" + CP_HTD_ATTR_VALUE_PARAM_KEY_PATTERN + ")=(" +
621       CP_HTD_ATTR_VALUE_PARAM_VALUE_PATTERN + "),?");
622 
623   /** The delay when re-trying a socket operation in a loop (HBASE-4712) */
624   public static final int SOCKET_RETRY_WAIT_MS = 200;
625 
626   /** Host name of the local machine */
627   public static final String LOCALHOST = "localhost";
628 
629   /** Enable file permission modification from standard hbase */
630   public static final String ENABLE_DATA_FILE_UMASK = "hbase.data.umask.enable";
631   /** File permission umask to use when creating hbase data files */
632   public static final String DATA_FILE_UMASK_KEY = "hbase.data.umask";
633 
634   /**
635    * If this parameter is set to true, then hbase will read
636    * data and then verify checksums. Checksum verification
637    * inside hdfs will be switched off.  However, if the hbase-checksum
638    * verification fails, then it will switch back to using
639    * hdfs checksums for verifiying data that is being read from storage.
640    *
641    * If this parameter is set to false, then hbase will not
642    * verify any checksums, instead it will depend on checksum verification
643    * being done in the hdfs client.
644    */
645   public static final String HBASE_CHECKSUM_VERIFICATION =
646       "hbase.regionserver.checksum.verify";
647 
648   /**
649    * The name of the configuration parameter that specifies
650    * the number of bytes in a newly created checksum chunk.
651    */
652   public static final String BYTES_PER_CHECKSUM =
653       "hbase.hstore.bytes.per.checksum";
654 
655   /**
656    * The name of the configuration parameter that specifies
657    * the name of an algorithm that is used to compute checksums
658    * for newly created blocks.
659    */
660   public static final String CHECKSUM_TYPE_NAME =
661       "hbase.hstore.checksum.algorithm";
662 
663   /** Configuration name of HLog Compression */
664   public static final String ENABLE_WAL_COMPRESSION =
665     "hbase.regionserver.wal.enablecompression";
666 
667   /**
668    * QOS attributes: these attributes are used to demarcate RPC call processing
669    * by different set of handlers. For example, HIGH_QOS tagged methods are
670    * handled by high priority handlers.
671    */
672   public static final int NORMAL_QOS = 0;
673   public static final int QOS_THRESHOLD = 10;
674   public static final int HIGH_QOS = 100;
675   public static final int REPLICATION_QOS = 5; // normal_QOS < replication_QOS < high_QOS
676 
677   /**
678    * The byte array represents for NO_NEXT_INDEXED_KEY;
679    * The actual value is irrelevant because this is always compared by reference.
680    */
681   public static final byte [] NO_NEXT_INDEXED_KEY = Bytes.toBytes("NO_NEXT_INDEXED_KEY");
682   
683   /** Directory under /hbase where archived hfiles are stored */
684   public static final String HFILE_ARCHIVE_DIRECTORY = ".archive";
685 
686   /**
687    * Name of the directory to store all snapshots. See SnapshotDescriptionUtils for
688    * remaining snapshot constants; this is here to keep HConstants dependencies at a minimum and
689    * uni-directional.
690    */
691   public static final String SNAPSHOT_DIR_NAME = ".hbase-snapshot";
692 
693   /* Name of old snapshot directory. See HBASE-8352 for details on why it needs to be renamed */
694   public static final String OLD_SNAPSHOT_DIR_NAME = ".snapshot";
695   
696   /** Temporary directory used for table creation and deletion */
697   public static final String HBASE_TEMP_DIRECTORY = ".tmp";
698 
699   /** Directories that are not HBase table directories */
700   public static final List<String> HBASE_NON_TABLE_DIRS =
701     Collections.unmodifiableList(Arrays.asList(new String[] { HREGION_LOGDIR_NAME,
702       HREGION_OLDLOGDIR_NAME, CORRUPT_DIR_NAME, SPLIT_LOGDIR_NAME,
703       HBCK_SIDELINEDIR_NAME, HFILE_ARCHIVE_DIRECTORY, SNAPSHOT_DIR_NAME, HBASE_TEMP_DIRECTORY,
704       OLD_SNAPSHOT_DIR_NAME }));
705 
706   /** Directories that are not HBase user table directories */
707   public static final List<String> HBASE_NON_USER_TABLE_DIRS =
708     Collections.unmodifiableList(Arrays.asList((String[])ArrayUtils.addAll(
709       new String[] { Bytes.toString(META_TABLE_NAME), Bytes.toString(ROOT_TABLE_NAME) },
710       HBASE_NON_TABLE_DIRS.toArray())));
711 
712   /** Health script related settings. */
713   public static final String HEALTH_SCRIPT_LOC = "hbase.node.health.script.location";
714   public static final String HEALTH_SCRIPT_TIMEOUT = "hbase.node.health.script.timeout";
715   public static final String HEALTH_CHORE_WAKE_FREQ =
716       "hbase.node.health.script.frequency";
717   public static final long DEFAULT_HEALTH_SCRIPT_TIMEOUT = 60000;
718   /**
719    * The maximum number of health check failures a server can encounter consecutively.
720    */
721   public static final String HEALTH_FAILURE_THRESHOLD =
722       "hbase.node.health.failure.threshold";
723   public static final int DEFAULT_HEALTH_FAILURE_THRESHOLD = 3;
724 
725   private HConstants() {
726     // Can't be instantiated with this ctor.
727   }
728 }