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   /** Parameter name for port region server's info server listens on. */
171   public static final String REGIONSERVER_INFO_PORT = "hbase.regionserver.info.port";
172   
173   /** Default port region server listens on. */
174   public static final int DEFAULT_REGIONSERVER_PORT = 60020;
175 
176   /** default port for region server web api */
177   public static final int DEFAULT_REGIONSERVER_INFOPORT = 60030;
178 
179   /** A flag that enables automatic selection of regionserver info port */
180   public static final String REGIONSERVER_INFO_PORT_AUTO =
181     "hbase.regionserver.info.port.auto";
182 
183   /** Parameter name for what region server interface to use. */
184   public static final String REGION_SERVER_CLASS = "hbase.regionserver.class";
185 
186   /** Parameter name for what region server implementation to use. */
187   public static final String REGION_SERVER_IMPL= "hbase.regionserver.impl";
188 
189   /** Default region server interface class name. */
190   public static final String DEFAULT_REGION_SERVER_CLASS = HRegionInterface.class.getName();
191 
192   /** Parameter name for what master implementation to use. */
193   public static final String MASTER_IMPL= "hbase.master.impl";
194 
195   /** Parameter name for how often threads should wake up */
196   public static final String THREAD_WAKE_FREQUENCY = "hbase.server.thread.wakefrequency";
197 
198   /** Default value for thread wake frequency */
199   public static final int DEFAULT_THREAD_WAKE_FREQUENCY = 10 * 1000;
200 
201   /** Parameter name for how often we should try to write a version file, before failing */
202   public static final String VERSION_FILE_WRITE_ATTEMPTS = "hbase.server.versionfile.writeattempts";
203 
204   /** Parameter name for how often we should try to write a version file, before failing */
205   public static final int DEFAULT_VERSION_FILE_WRITE_ATTEMPTS = 3;
206 
207   /** Parameter name for how often a region should should perform a major compaction */
208   public static final String MAJOR_COMPACTION_PERIOD = "hbase.hregion.majorcompaction";
209 
210   /** Parameter name for the maximum batch of KVs to be used in flushes and compactions */
211   public static final String COMPACTION_KV_MAX = "hbase.hstore.compaction.kv.max";
212 
213   /** Parameter name for HBase instance root directory */
214   public static final String HBASE_DIR = "hbase.rootdir";
215 
216   /** Parameter name for HBase client IPC pool type */
217   public static final String HBASE_CLIENT_IPC_POOL_TYPE = "hbase.client.ipc.pool.type";
218 
219   /** Parameter name for HBase client IPC pool size */
220   public static final String HBASE_CLIENT_IPC_POOL_SIZE = "hbase.client.ipc.pool.size";
221 
222   /** Parameter name for HBase client operation timeout, which overrides RPC timeout */
223   public static final String HBASE_CLIENT_OPERATION_TIMEOUT = "hbase.client.operation.timeout";
224 
225   /** Default HBase client operation timeout, which is tantamount to a blocking call */
226   public static final int DEFAULT_HBASE_CLIENT_OPERATION_TIMEOUT = Integer.MAX_VALUE;
227 
228   /** Used to construct the name of the log directory for a region server
229    * Use '.' as a special character to seperate the log files from table data */
230   public static final String HREGION_LOGDIR_NAME = ".logs";
231 
232   /** Used to construct the name of the splitlog directory for a region server */
233   public static final String SPLIT_LOGDIR_NAME = "splitlog";
234 
235   public static final String CORRUPT_DIR_NAME = ".corrupt";
236 
237   /** Like the previous, but for old logs that are about to be deleted */
238   public static final String HREGION_OLDLOGDIR_NAME = ".oldlogs";
239 
240   /** Used by HBCK to sideline backup data */
241   public static final String HBCK_SIDELINEDIR_NAME = ".hbck";
242 
243   /** Used to construct the name of the compaction directory during compaction */
244   public static final String HREGION_COMPACTIONDIR_NAME = "compaction.dir";
245 
246   /** Conf key for the max file size after which we split the region */
247   public static final String HREGION_MAX_FILESIZE =
248       "hbase.hregion.max.filesize";
249 
250   /** Default maximum file size */
251   public static final long DEFAULT_MAX_FILE_SIZE = 10 * 1024 * 1024 * 1024L;
252 
253   /**
254    * The max number of threads used for opening and closing stores or store
255    * files in parallel
256    */
257   public static final String HSTORE_OPEN_AND_CLOSE_THREADS_MAX =
258     "hbase.hstore.open.and.close.threads.max";
259 
260   /**
261    * The default number for the max number of threads used for opening and
262    * closing stores or store files in parallel
263    */
264   public static final int DEFAULT_HSTORE_OPEN_AND_CLOSE_THREADS_MAX = 1;
265 
266 
267   /** Conf key for the memstore size at which we flush the memstore */
268   public static final String HREGION_MEMSTORE_FLUSH_SIZE =
269       "hbase.hregion.memstore.flush.size";
270 
271   /** Default size of a reservation block   */
272   public static final int DEFAULT_SIZE_RESERVATION_BLOCK = 1024 * 1024 * 5;
273 
274   /** Maximum value length, enforced on KeyValue construction */
275   public static final int MAXIMUM_VALUE_LENGTH = Integer.MAX_VALUE;
276 
277   /** name of the file for unique cluster ID */
278   public static final String CLUSTER_ID_FILE_NAME = "hbase.id";
279 
280   /** Configuration key storing the cluster ID */
281   public static final String CLUSTER_ID = "hbase.cluster.id";
282 
283   // Always store the location of the root table's HRegion.
284   // This HRegion is never split.
285 
286   // region name = table + startkey + regionid. This is the row key.
287   // each row in the root and meta tables describes exactly 1 region
288   // Do we ever need to know all the information that we are storing?
289 
290   // Note that the name of the root table starts with "-" and the name of the
291   // meta table starts with "." Why? it's a trick. It turns out that when we
292   // store region names in memory, we use a SortedMap. Since "-" sorts before
293   // "." (and since no other table name can start with either of these
294   // characters, the root region will always be the first entry in such a Map,
295   // followed by all the meta regions (which will be ordered by their starting
296   // row key as well), followed by all user tables. So when the Master is
297   // choosing regions to assign, it will always choose the root region first,
298   // followed by the meta regions, followed by user regions. Since the root
299   // and meta regions always need to be on-line, this ensures that they will
300   // be the first to be reassigned if the server(s) they are being served by
301   // should go down.
302 
303   /** The root table's name.*/
304   public static final byte [] ROOT_TABLE_NAME = Bytes.toBytes("-ROOT-");
305 
306   /** The META table's name. */
307   public static final byte [] META_TABLE_NAME = Bytes.toBytes(".META.");
308 
309   /** delimiter used between portions of a region name */
310   public static final int META_ROW_DELIMITER = ',';
311 
312   /** The catalog family as a string*/
313   public static final String CATALOG_FAMILY_STR = "info";
314 
315   /** The catalog family */
316   public static final byte [] CATALOG_FAMILY = Bytes.toBytes(CATALOG_FAMILY_STR);
317 
318   /** The regioninfo column qualifier */
319   public static final byte [] REGIONINFO_QUALIFIER = Bytes.toBytes("regioninfo");
320 
321   /** The server column qualifier */
322   public static final byte [] SERVER_QUALIFIER = Bytes.toBytes("server");
323 
324   /** The startcode column qualifier */
325   public static final byte [] STARTCODE_QUALIFIER = Bytes.toBytes("serverstartcode");
326 
327   /** The lower-half split region column qualifier */
328   public static final byte [] SPLITA_QUALIFIER = Bytes.toBytes("splitA");
329 
330   /** The upper-half split region column qualifier */
331   public static final byte [] SPLITB_QUALIFIER = Bytes.toBytes("splitB");
332 
333   /**
334    * The meta table version column qualifier.
335    * We keep current version of the meta table in this column in <code>-ROOT-</code>
336    * table: i.e. in the 'info:v' column.
337    */
338   public static final byte [] META_VERSION_QUALIFIER = Bytes.toBytes("v");
339 
340   /**
341    * The current version of the meta table.
342    * Before this the meta had HTableDescriptor serialized into the HRegionInfo;
343    * i.e. pre-hbase 0.92.  There was no META_VERSION column in the root table
344    * in this case.  The presence of a version and its value being zero indicates
345    * meta is up-to-date.
346    */
347   public static final short META_VERSION = 0;
348 
349   // Other constants
350 
351   /**
352    * An empty instance.
353    */
354   public static final byte [] EMPTY_BYTE_ARRAY = new byte [0];
355 
356   /**
357    * Used by scanners, etc when they want to start at the beginning of a region
358    */
359   public static final byte [] EMPTY_START_ROW = EMPTY_BYTE_ARRAY;
360 
361   /**
362    * Last row in a table.
363    */
364   public static final byte [] EMPTY_END_ROW = EMPTY_START_ROW;
365 
366   /**
367     * Used by scanners and others when they're trying to detect the end of a
368     * table
369     */
370   public static final byte [] LAST_ROW = EMPTY_BYTE_ARRAY;
371 
372   /**
373    * Max length a row can have because of the limitation in TFile.
374    */
375   public static final int MAX_ROW_LENGTH = Short.MAX_VALUE;
376 
377   /** When we encode strings, we always specify UTF8 encoding */
378   public static final String UTF8_ENCODING = "UTF-8";
379 
380   /**
381    * Timestamp to use when we want to refer to the latest cell.
382    * This is the timestamp sent by clients when no timestamp is specified on
383    * commit.
384    */
385   public static final long LATEST_TIMESTAMP = Long.MAX_VALUE;
386 
387   /**
388    * Timestamp to use when we want to refer to the oldest cell.
389    */
390   public static final long OLDEST_TIMESTAMP = Long.MIN_VALUE;
391 
392   /**
393    * LATEST_TIMESTAMP in bytes form
394    */
395   public static final byte [] LATEST_TIMESTAMP_BYTES = Bytes.toBytes(LATEST_TIMESTAMP);
396 
397   /**
398    * Define for 'return-all-versions'.
399    */
400   public static final int ALL_VERSIONS = Integer.MAX_VALUE;
401 
402   /**
403    * Unlimited time-to-live.
404    */
405 //  public static final int FOREVER = -1;
406   public static final int FOREVER = Integer.MAX_VALUE;
407 
408   /**
409    * Seconds in a week
410    */
411   public static final int WEEK_IN_SECONDS = 7 * 24 * 3600;
412 
413   //TODO: although the following are referenced widely to format strings for
414   //      the shell. They really aren't a part of the public API. It would be
415   //      nice if we could put them somewhere where they did not need to be
416   //      public. They could have package visibility
417   public static final String NAME = "NAME";
418   public static final String VERSIONS = "VERSIONS";
419   public static final String IN_MEMORY = "IN_MEMORY";
420   public static final String CONFIG = "CONFIG";
421 
422   /**
423    * This is a retry backoff multiplier table similar to the BSD TCP syn
424    * backoff table, a bit more aggressive than simple exponential backoff.
425    */
426   public static int RETRY_BACKOFF[] = { 1, 1, 1, 2, 2, 4, 4, 8, 16, 32, 64 };
427 
428   public static final String REGION_IMPL = "hbase.hregion.impl";
429 
430   /** modifyTable op for replacing the table descriptor */
431   public static enum Modify {
432     CLOSE_REGION,
433     TABLE_COMPACT,
434     TABLE_FLUSH,
435     TABLE_MAJOR_COMPACT,
436     TABLE_SET_HTD,
437     TABLE_SPLIT
438   }
439 
440   /**
441    * Scope tag for locally scoped data.
442    * This data will not be replicated.
443    */
444   public static final int REPLICATION_SCOPE_LOCAL = 0;
445 
446   /**
447    * Scope tag for globally scoped data.
448    * This data will be replicated to all peers.
449    */
450   public static final int REPLICATION_SCOPE_GLOBAL = 1;
451 
452   /**
453    * Default cluster ID, cannot be used to identify a cluster so a key with
454    * this value means it wasn't meant for replication.
455    */
456   public static final UUID DEFAULT_CLUSTER_ID = new UUID(0L,0L);
457 
458     /**
459      * Parameter name for maximum number of bytes returned when calling a
460      * scanner's next method.
461      */
462   public static String HBASE_CLIENT_SCANNER_MAX_RESULT_SIZE_KEY = "hbase.client.scanner.max.result.size";
463 
464   /**
465    * Maximum number of bytes returned when calling a scanner's next method.
466    * Note that when a single row is larger than this limit the row is still
467    * returned completely.
468    *
469    * The default value is unlimited.
470    */
471   public static long DEFAULT_HBASE_CLIENT_SCANNER_MAX_RESULT_SIZE = Long.MAX_VALUE;
472 
473   /**
474    * Parameter name for client pause value, used mostly as value to wait
475    * before running a retry of a failed get, region lookup, etc.
476    */
477   public static String HBASE_CLIENT_PAUSE = "hbase.client.pause";
478 
479   /**
480    * Default value of {@link #HBASE_CLIENT_PAUSE}.
481    */
482   public static long DEFAULT_HBASE_CLIENT_PAUSE = 1000;
483 
484   /**
485    * Parameter name for server pause value, used mostly as value to wait before
486    * running a retry of a failed operation.
487    */
488   public static String HBASE_SERVER_PAUSE = "hbase.server.pause";
489 
490   /**
491    * Default value of {@link #HBASE_SERVER_PAUSE}.
492    */
493   public static int DEFAULT_HBASE_SERVER_PAUSE = 1000;
494 
495   /**
496    * Parameter name for maximum retries, used as maximum for all retryable
497    * operations such as fetching of the root region from root region server,
498    * getting a cell's value, starting a row update, etc.
499    */
500   public static String HBASE_CLIENT_RETRIES_NUMBER = "hbase.client.retries.number";
501 
502   /**
503    * Default value of {@link #HBASE_CLIENT_RETRIES_NUMBER}.
504    */
505   public static int DEFAULT_HBASE_CLIENT_RETRIES_NUMBER = 10;
506 
507   /**
508    * Parameter name for maximum attempts, used to limit the number of times the
509    * client will try to obtain the proxy for a given region server.
510    */
511   public static String HBASE_CLIENT_RPC_MAXATTEMPTS = "hbase.client.rpc.maxattempts";
512 
513   /**
514    * Default value of {@link #HBASE_CLIENT_RPC_MAXATTEMPTS}.
515    */
516   public static int DEFAULT_HBASE_CLIENT_RPC_MAXATTEMPTS = 1;
517 
518   /**
519    * Parameter name for client prefetch limit, used as the maximum number of regions
520    * info that will be prefetched.
521    */
522   public static String HBASE_CLIENT_PREFETCH_LIMIT = "hbase.client.prefetch.limit";
523 
524   /**
525    * Default value of {@link #HBASE_CLIENT_PREFETCH_LIMIT}.
526    */
527   public static int DEFAULT_HBASE_CLIENT_PREFETCH_LIMIT = 10;
528 
529   /**
530    * Parameter name for number of rows that will be fetched when calling next on
531    * a scanner if it is not served from memory. Higher caching values will
532    * enable faster scanners but will eat up more memory and some calls of next
533    * may take longer and longer times when the cache is empty.
534    */
535   public static String HBASE_META_SCANNER_CACHING = "hbase.meta.scanner.caching";
536 
537   /**
538    * Default value of {@link #HBASE_META_SCANNER_CACHING}.
539    */
540   public static int DEFAULT_HBASE_META_SCANNER_CACHING = 100;
541 
542   /**
543    * Parameter name for unique identifier for this {@link org.apache.hadoop.conf.Configuration}
544    * instance. If there are two or more {@link org.apache.hadoop.conf.Configuration} instances that,
545    * for all intents and purposes, are the same except for their instance ids,
546    * then they will not be able to share the same {@link org.apache.hadoop.hbase.client.HConnection} instance.
547    * On the other hand, even if the instance ids are the same, it could result
548    * in non-shared {@link org.apache.hadoop.hbase.client.HConnection}
549    * instances if some of the other connection parameters differ.
550    */
551   public static String HBASE_CLIENT_INSTANCE_ID = "hbase.client.instance.id";
552 
553   /**
554    * HRegion server lease period in milliseconds. Clients must report in within this period
555    * else they are considered dead. Unit measured in ms (milliseconds).
556    */
557   public static String HBASE_REGIONSERVER_LEASE_PERIOD_KEY =
558     "hbase.regionserver.lease.period";
559 
560   /**
561    * Default value of {@link #HBASE_REGIONSERVER_LEASE_PERIOD_KEY}.
562    */
563   public static long DEFAULT_HBASE_REGIONSERVER_LEASE_PERIOD = 60000;
564 
565   /**
566    * timeout for each RPC
567    */
568   public static String HBASE_RPC_TIMEOUT_KEY = "hbase.rpc.timeout";
569 
570   /**
571    * Default value of {@link #HBASE_RPC_TIMEOUT_KEY}
572    */
573   public static int DEFAULT_HBASE_RPC_TIMEOUT = 60000;
574 
575   /**
576    * timeout for short operation RPC
577    */
578   public static String HBASE_RPC_SHORTOPERATION_TIMEOUT_KEY = "hbase.rpc.shortoperation.timeout";
579 
580   /**
581    * Default value of {@link #HBASE_RPC_SHORTOPERATION_TIMEOUT_KEY}
582    */
583   public static int DEFAULT_HBASE_RPC_SHORTOPERATION_TIMEOUT = 10000;
584 
585   /*
586    * cluster replication constants.
587    */
588   public static final String
589       REPLICATION_ENABLE_KEY = "hbase.replication";
590   public static final String
591       REPLICATION_SOURCE_SERVICE_CLASSNAME = "hbase.replication.source.service";
592   public static final String
593       REPLICATION_SINK_SERVICE_CLASSNAME = "hbase.replication.sink.service";
594   public static final String REPLICATION_SERVICE_CLASSNAME_DEFAULT =
595     "org.apache.hadoop.hbase.replication.regionserver.Replication";
596 
597   /** HBCK special code name used as server name when manipulating ZK nodes */
598   public static final String HBCK_CODE_NAME = "HBCKServerName";
599 
600   public static final ServerName HBCK_CODE_SERVERNAME =
601     new ServerName(HBCK_CODE_NAME, -1, -1L);
602 
603   public static final String KEY_FOR_HOSTNAME_SEEN_BY_MASTER =
604     "hbase.regionserver.hostname.seen.by.master";
605 
606   public static final String HBASE_MASTER_LOGCLEANER_PLUGINS =
607       "hbase.master.logcleaner.plugins";
608 
609   public static final String HBASE_REGION_SPLIT_POLICY_KEY =
610     "hbase.regionserver.region.split.policy";
611 
612   /**
613    * Configuration key for the size of the block cache
614    */
615   public static final String HFILE_BLOCK_CACHE_SIZE_KEY =
616     "hfile.block.cache.size";
617 
618   public static final float HFILE_BLOCK_CACHE_SIZE_DEFAULT = 0.25f;
619 
620   /*
621     * Minimum percentage of free heap necessary for a successful cluster startup.
622     */
623   public static final float HBASE_CLUSTER_MINIMUM_MEMORY_THRESHOLD = 0.2f;
624 
625   public static final Pattern CP_HTD_ATTR_KEY_PATTERN = Pattern.compile
626       ("^coprocessor\\$([0-9]+)$", Pattern.CASE_INSENSITIVE);
627   public static final Pattern CP_HTD_ATTR_VALUE_PATTERN =
628       Pattern.compile("(^[^\\|]*)\\|([^\\|]+)\\|[\\s]*([\\d]*)[\\s]*(\\|.*)?$");
629 
630   public static final String CP_HTD_ATTR_VALUE_PARAM_KEY_PATTERN = "[^=,]+";
631   public static final String CP_HTD_ATTR_VALUE_PARAM_VALUE_PATTERN = "[^,]+";
632   public static final Pattern CP_HTD_ATTR_VALUE_PARAM_PATTERN = Pattern.compile(
633       "(" + CP_HTD_ATTR_VALUE_PARAM_KEY_PATTERN + ")=(" +
634       CP_HTD_ATTR_VALUE_PARAM_VALUE_PATTERN + "),?");
635 
636   /** The delay when re-trying a socket operation in a loop (HBASE-4712) */
637   public static final int SOCKET_RETRY_WAIT_MS = 200;
638 
639   /** Host name of the local machine */
640   public static final String LOCALHOST = "localhost";
641 
642   /** Enable file permission modification from standard hbase */
643   public static final String ENABLE_DATA_FILE_UMASK = "hbase.data.umask.enable";
644   /** File permission umask to use when creating hbase data files */
645   public static final String DATA_FILE_UMASK_KEY = "hbase.data.umask";
646 
647   /**
648    * If this parameter is set to true, then hbase will read
649    * data and then verify checksums. Checksum verification
650    * inside hdfs will be switched off.  However, if the hbase-checksum
651    * verification fails, then it will switch back to using
652    * hdfs checksums for verifiying data that is being read from storage.
653    *
654    * If this parameter is set to false, then hbase will not
655    * verify any checksums, instead it will depend on checksum verification
656    * being done in the hdfs client.
657    */
658   public static final String HBASE_CHECKSUM_VERIFICATION =
659       "hbase.regionserver.checksum.verify";
660 
661   /**
662    * The name of the configuration parameter that specifies
663    * the number of bytes in a newly created checksum chunk.
664    */
665   public static final String BYTES_PER_CHECKSUM =
666       "hbase.hstore.bytes.per.checksum";
667 
668   /**
669    * The name of the configuration parameter that specifies
670    * the name of an algorithm that is used to compute checksums
671    * for newly created blocks.
672    */
673   public static final String CHECKSUM_TYPE_NAME =
674       "hbase.hstore.checksum.algorithm";
675 
676   /** Configuration name of HLog Compression */
677   public static final String ENABLE_WAL_COMPRESSION =
678     "hbase.regionserver.wal.enablecompression";
679 
680   /**
681    * QOS attributes: these attributes are used to demarcate RPC call processing
682    * by different set of handlers. For example, HIGH_QOS tagged methods are
683    * handled by high priority handlers.
684    */
685   public static final int NORMAL_QOS = 0;
686   public static final int QOS_THRESHOLD = 10;
687   public static final int HIGH_QOS = 100;
688   public static final int REPLICATION_QOS = 5; // normal_QOS < replication_QOS < high_QOS
689 
690   /**
691    * The byte array represents for NO_NEXT_INDEXED_KEY;
692    * The actual value is irrelevant because this is always compared by reference.
693    */
694   public static final byte [] NO_NEXT_INDEXED_KEY = Bytes.toBytes("NO_NEXT_INDEXED_KEY");
695   
696   /** Directory under /hbase where archived hfiles are stored */
697   public static final String HFILE_ARCHIVE_DIRECTORY = ".archive";
698 
699   /**
700    * Name of the directory to store all snapshots. See SnapshotDescriptionUtils for
701    * remaining snapshot constants; this is here to keep HConstants dependencies at a minimum and
702    * uni-directional.
703    */
704   public static final String SNAPSHOT_DIR_NAME = ".hbase-snapshot";
705 
706   /* Name of old snapshot directory. See HBASE-8352 for details on why it needs to be renamed */
707   public static final String OLD_SNAPSHOT_DIR_NAME = ".snapshot";
708   
709   /** Temporary directory used for table creation and deletion */
710   public static final String HBASE_TEMP_DIRECTORY = ".tmp";
711 
712   /** Directories that are not HBase table directories */
713   public static final List<String> HBASE_NON_TABLE_DIRS =
714     Collections.unmodifiableList(Arrays.asList(new String[] { HREGION_LOGDIR_NAME,
715       HREGION_OLDLOGDIR_NAME, CORRUPT_DIR_NAME, SPLIT_LOGDIR_NAME,
716       HBCK_SIDELINEDIR_NAME, HFILE_ARCHIVE_DIRECTORY, SNAPSHOT_DIR_NAME, HBASE_TEMP_DIRECTORY,
717       OLD_SNAPSHOT_DIR_NAME }));
718 
719   /** Directories that are not HBase user table directories */
720   public static final List<String> HBASE_NON_USER_TABLE_DIRS =
721     Collections.unmodifiableList(Arrays.asList((String[])ArrayUtils.addAll(
722       new String[] { Bytes.toString(META_TABLE_NAME), Bytes.toString(ROOT_TABLE_NAME) },
723       HBASE_NON_TABLE_DIRS.toArray())));
724 
725   /** Health script related settings. */
726   public static final String HEALTH_SCRIPT_LOC = "hbase.node.health.script.location";
727   public static final String HEALTH_SCRIPT_TIMEOUT = "hbase.node.health.script.timeout";
728   public static final String HEALTH_CHORE_WAKE_FREQ =
729       "hbase.node.health.script.frequency";
730   public static final long DEFAULT_HEALTH_SCRIPT_TIMEOUT = 60000;
731   /**
732    * The maximum number of health check failures a server can encounter consecutively.
733    */
734   public static final String HEALTH_FAILURE_THRESHOLD =
735       "hbase.node.health.failure.threshold";
736   public static final int DEFAULT_HEALTH_FAILURE_THRESHOLD = 3;
737 
738   private HConstants() {
739     // Can't be instantiated with this ctor.
740   }
741 }