Logo Search packages:      
Sourcecode: hbase version File versions  Download package

HConstants.java

/**
 * Copyright 2007 The Apache Software Foundation
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.hadoop.hbase;

import org.apache.hadoop.hbase.ipc.HRegionInterface;
import org.apache.hadoop.hbase.util.Bytes;

/**
 * HConstants holds a bunch of HBase-related constants
 */
00028 public interface HConstants {

  /** long constant for zero */
00031   static final Long ZERO_L = Long.valueOf(0L);

  //TODO: NINES is only used in HBaseAdmin and HConnectionManager. Move to client
  //      package and change visibility to default
  static final String NINES = "99999999999999";
  //TODO: ZEROS is only used in HConnectionManager and MetaScanner. Move to
  //      client package and change visibility to default
  static final String ZEROES = "00000000000000";
  
  // For migration

  /** name of version file */
00043   static final String VERSION_FILE_NAME = "hbase.version";
  
  /**
   * Current version of file system.
   * Version 4 supports only one kind of bloom filter.
   * Version 5 changes versions in catalog table regions.
   * Version 6 enables blockcaching on catalog tables.
   * Version 7 introduces hfile -- hbase 0.19 to 0.20..
   */
  // public static final String FILE_SYSTEM_VERSION = "6";
00053   public static final String FILE_SYSTEM_VERSION = "7";
  
  // Configuration parameters
  
  //TODO: Is having HBase homed on port 60k OK?
  
  /** Cluster is in distributed mode or not */
00060   static final String CLUSTER_DISTRIBUTED = "hbase.cluster.distributed";
  
  /** Cluster is standalone or pseudo-distributed */
00063   static final String CLUSTER_IS_LOCAL = "false";
  
  /** Cluster is fully-distributed */
00066   static final String CLUSTER_IS_DISTRIBUTED = "true";

  /** default host address */
00069   static final String DEFAULT_HOST = "0.0.0.0";

  /** Parameter name for port master listens on. */
00072   static final String MASTER_PORT = "hbase.master.port";

  /** default port that the master listens on */
00075   static final int DEFAULT_MASTER_PORT = 60000;

  /** default port for master web api */
00078   static final int DEFAULT_MASTER_INFOPORT = 60010;

  /** Name of ZooKeeper quorum configuration parameter. */
00081   static final String ZOOKEEPER_QUORUM = "hbase.zookeeper.quorum";

  /** Name of ZooKeeper config file in conf/ directory. */
00084   static final String ZOOKEEPER_CONFIG_NAME = "zoo.cfg";

  /** Parameter name for number of times to retry writes to ZooKeeper. */
00087   static final String ZOOKEEPER_RETRIES = "zookeeper.retries";
  /** Default number of times to retry writes to ZooKeeper. */
00089   static final int DEFAULT_ZOOKEEPER_RETRIES = 5;

  /** Parameter name for ZooKeeper pause between retries. In milliseconds. */
00092   static final String ZOOKEEPER_PAUSE = "zookeeper.pause";
  /** Default ZooKeeper pause value. In milliseconds. */
00094   static final int DEFAULT_ZOOKEEPER_PAUSE = 2 * 1000;

  /** Parameter name for port region server listens on. */
00097   static final String REGIONSERVER_PORT = "hbase.regionserver.port";

  /** Default port region server listens on. */
00100   static final int DEFAULT_REGIONSERVER_PORT = 60020;

  /** default port for region server web api */
00103   static final int DEFAULT_REGIONSERVER_INFOPORT = 60030;

  /** Parameter name for what region server interface to use. */
00106   static final String REGION_SERVER_CLASS = "hbase.regionserver.class";
  
  /** Parameter name for what region server implementation to use. */
00109   static final String REGION_SERVER_IMPL= "hbase.regionserver.impl";
  
  /** Default region server interface class name. */
00112   static final String DEFAULT_REGION_SERVER_CLASS = HRegionInterface.class.getName();

  /** Parameter name for what region implementation to use. */
00115   static final String REGION_IMPL= "hbase.hregion.impl";

  /** Parameter name for how often threads should wake up */
00118   static final String THREAD_WAKE_FREQUENCY = "hbase.server.thread.wakefrequency";
  
  /** Parameter name for how often a region should should perform a major compaction */
00121   static final String MAJOR_COMPACTION_PERIOD = "hbase.hregion.majorcompaction";

  /** Parameter name for HBase instance root directory */
00124   static final String HBASE_DIR = "hbase.rootdir";
  
  /** Used to construct the name of the log directory for a region server 
   * Use '.' as a special character to seperate the log files from table data */
00128   static final String HREGION_LOGDIR_NAME = ".logs";

  /** Name of old log file for reconstruction */
00131   static final String HREGION_OLDLOGFILE_NAME = "oldlogfile.log";
  
  /** Used to construct the name of the compaction directory during compaction */
00134   static final String HREGION_COMPACTIONDIR_NAME = "compaction.dir";
  
  /** Default maximum file size */
00137   static final long DEFAULT_MAX_FILE_SIZE = 256 * 1024 * 1024;
  
  /** Default size of a reservation block   */
00140   static final int DEFAULT_SIZE_RESERVATION_BLOCK = 1024 * 1024 * 5;

  /** Maximum value length, enforced on KeyValue construction */
00143   static final int MAXIMUM_VALUE_LENGTH = Integer.MAX_VALUE;
  
  // Always store the location of the root table's HRegion.
  // This HRegion is never split.
  
  // region name = table + startkey + regionid. This is the row key.
  // each row in the root and meta tables describes exactly 1 region
  // Do we ever need to know all the information that we are storing?

  // Note that the name of the root table starts with "-" and the name of the
  // meta table starts with "." Why? it's a trick. It turns out that when we
  // store region names in memory, we use a SortedMap. Since "-" sorts before
  // "." (and since no other table name can start with either of these
  // characters, the root region will always be the first entry in such a Map,
  // followed by all the meta regions (which will be ordered by their starting
  // row key as well), followed by all user tables. So when the Master is 
  // choosing regions to assign, it will always choose the root region first,
  // followed by the meta regions, followed by user regions. Since the root
  // and meta regions always need to be on-line, this ensures that they will
  // be the first to be reassigned if the server(s) they are being served by
  // should go down.


  //
  // New stuff.  Making a slow transition.
  //
  
  /** The root table's name.*/
00171   static final byte [] ROOT_TABLE_NAME = Bytes.toBytes("-ROOT-");

  /** The META table's name. */
00174   static final byte [] META_TABLE_NAME = Bytes.toBytes(".META.");  

  /** delimiter used between portions of a region name */
00177   public static final int META_ROW_DELIMITER = ',';

  /** The catalog family as a string*/
00180   static final String CATALOG_FAMILY_STR = "info";
  
  /** The catalog family */
00183   static final byte [] CATALOG_FAMILY = Bytes.toBytes(CATALOG_FAMILY_STR);
  
  /** The catalog historian family */
00186   static final byte [] CATALOG_HISTORIAN_FAMILY = Bytes.toBytes("historian");
  
  /** The regioninfo column qualifier */
00189   static final byte [] REGIONINFO_QUALIFIER = Bytes.toBytes("regioninfo");
    
  /** The server column qualifier */
00192   static final byte [] SERVER_QUALIFIER = Bytes.toBytes("server");
  
  /** The startcode column qualifier */
00195   static final byte [] STARTCODE_QUALIFIER = Bytes.toBytes("serverstartcode");
  
  /** The lower-half split region column qualifier */
00198   static final byte [] SPLITA_QUALIFIER = Bytes.toBytes("splitA");
  
  /** The upper-half split region column qualifier */
00201   static final byte [] SPLITB_QUALIFIER = Bytes.toBytes("splitB");
  
  // Other constants

  /**
   * An empty instance.
   */
00208   static final byte [] EMPTY_BYTE_ARRAY = new byte [0];
  
  /**
   * Used by scanners, etc when they want to start at the beginning of a region
   */
00213   static final byte [] EMPTY_START_ROW = EMPTY_BYTE_ARRAY;
  
  /**
   * Last row in a table.
   */
00218   static final byte [] EMPTY_END_ROW = EMPTY_START_ROW;

  /** 
    * Used by scanners and others when they're trying to detect the end of a 
    * table 
    */
00224   static final byte [] LAST_ROW = EMPTY_BYTE_ARRAY;
  
  /**
   * Max length a row can have because of the limitation in TFile.
   */
00229   static final int MAX_ROW_LENGTH = Short.MAX_VALUE;
  
  /** When we encode strings, we always specify UTF8 encoding */
00232   static final String UTF8_ENCODING = "UTF-8";

  /**
   * Timestamp to use when we want to refer to the latest cell.
   * This is the timestamp sent by clients when no timestamp is specified on
   * commit.
   */
00239   static final long LATEST_TIMESTAMP = Long.MAX_VALUE;

  /**
   * LATEST_TIMESTAMP in bytes form
   */
00244   static final byte [] LATEST_TIMESTAMP_BYTES = Bytes.toBytes(LATEST_TIMESTAMP);
  
  /**
   * Define for 'return-all-versions'.
   */
00249   static final int ALL_VERSIONS = Integer.MAX_VALUE;
  
  /**
   * Unlimited time-to-live.
   */
//  static final int FOREVER = -1;
00255   static final int FOREVER = Integer.MAX_VALUE;
  
  /**
   * Seconds in a week
   */
00260   public static final int WEEK_IN_SECONDS = 7 * 24 * 3600;

  /**
   * The key used to store the number of times a client should retry before
   * giving up.
   */
00266   public static final String HBASE_CLIENT_RETRIES_NUMBER_KEY =
    "hbase.client.retries.number";

  //TODO: although the following are referenced widely to format strings for
  //      the shell. They really aren't a part of the public API. It would be
  //      nice if we could put them somewhere where they did not need to be
  //      public. They could have package visibility
  static final String NAME = "NAME";
  static final String VERSIONS = "VERSIONS";
  static final String IN_MEMORY = "IN_MEMORY";
  
  /**
   * This is a retry backoff multiplier table similar to the BSD TCP syn
   * backoff table, a bit more aggressive than simple exponential backoff.
   */ 
00281   public static int RETRY_BACKOFF[] = { 1, 1, 1, 2, 2, 4, 4, 8, 16, 32 };

  /** modifyTable op for replacing the table descriptor */
00284   public static enum Modify {
    CLOSE_REGION,
    TABLE_COMPACT, 
    TABLE_FLUSH,
    TABLE_MAJOR_COMPACT,
    TABLE_SET_HTD, 
    TABLE_SPLIT
  }
  
    /**
     * Parameter name for maximum number of bytes returned when calling a
     * scanner's next method.
     */
00297   public static String HBASE_CLIENT_SCANNER_MAX_RESULT_SIZE_KEY = "hbase.client.scanner.max.result.size";
  
  /**
   * Maximum number of bytes returned when calling a scanner's next method.
   * Note that when a single row is larger than this limit the row is still
   * returned completely.
   * 
   * The default value is unlimited.
   */
00306   public static long DEFAULT_HBASE_CLIENT_SCANNER_MAX_RESULT_SIZE = Long.MAX_VALUE;

}

Generated by  Doxygen 1.6.0   Back to index