org.apache.hadoop.hbase
Class HStoreFile

java.lang.Object
  extended by org.apache.hadoop.hbase.HStoreFile
All Implemented Interfaces:
HConstants

public class HStoreFile
extends Object
implements HConstants

A HStore data file. HStores usually have one or more of these files. They are produced by flushing the memcache to disk.

Each HStore maintains a bunch of different data files. The filename is a mix of the parent dir, the region name, the column name, and a file identifier. The name may also be a reference to a store file located elsewhere. This class handles all that path-building stuff for you.

An HStoreFile usually tracks 4 things: its parent dir, the region identifier, the column family, and the file identifier. If you know those four things, you know how to obtain the right HStoreFile. HStoreFiles may also refernce store files in another region serving either from the top-half of the remote file or from the bottom-half. Such references are made fast splitting regions.

Plain HStoreFiles are named for a randomly generated id as in: 1278437856009925445 A file by this name is made in both the mapfiles and info subdirectories of a HStore columnfamily directoy: E.g. If the column family is 'anchor:', then under the region directory there is a subdirectory named 'anchor' within which is a 'mapfiles' and 'info' subdirectory. In each will be found a file named something like 1278437856009925445, one to hold the data in 'mapfiles' and one under 'info' that holds the sequence id for this store file.

References to store files located over in some other region look like this: 1278437856009925445.hbaserepository,qAReLZD-OyQORZWq_vqR1k==,959247014679548184: i.e. an id followed by the name of the referenced region. The data ('mapfiles') of HStoreFile references are empty. The accompanying info file contains the midkey, the id of the remote store we're referencing and whether we're to serve the top or bottom region of the remote store file. Note, a region is not splitable if it has instances of store file references (References are cleaned up by compactions).

When merging or splitting HRegions, we might want to modify one of the params for an HStoreFile (effectively moving it elsewhere).


Nested Class Summary
static class HStoreFile.Range
          For split HStoreFiles, specifies if the file covers the lower half or the upper half of the key range
 
Field Summary
 
Fields inherited from interface org.apache.hadoop.hbase.HConstants
ALL_META_COLUMNS, ALL_VERSIONS, COL_REGIONINFO, COL_REGIONINFO_ARRAY, COL_SERVER, COL_SPLITA, COL_SPLITB, COL_STARTCODE, COLUMN_FAMILY, COLUMN_FAMILY_ARRAY, COLUMN_FAMILY_STR, DEFAULT_HBASE_DIR, DEFAULT_HOST, DEFAULT_MASTER_ADDRESS, DEFAULT_MASTER_INFOPORT, DEFAULT_MASTER_PORT, DEFAULT_MAX_FILE_SIZE, DEFAULT_REGION_SERVER_CLASS, DEFAULT_REGIONSERVER_ADDRESS, DEFAULT_REGIONSERVER_INFOPORT, EMPTY_START_ROW, EMPTY_TEXT, FILE_SYSTEM_VERSION, HBASE_DIR, HREGION_LOGDIR_NAME, HREGION_OLDLOGFILE_NAME, LATEST_TIMESTAMP, MASTER_ADDRESS, META_TABLE_NAME, REGION_SERVER_CLASS, REGIONSERVER_ADDRESS, ROOT_TABLE_NAME, THREAD_WAKE_FREQUENCY, UTF8_ENCODING, VERSION_FILE_NAME
 
Method Summary
 void delete()
          Delete store map files.
 MapFile.Reader getReader(FileSystem fs, Filter bloomFilter)
          Get reader for the store file map file.
 MapFile.Writer getWriter(FileSystem fs, SequenceFile.CompressionType compression, Filter bloomFilter)
          Get a store file writer.
 long length()
           
 boolean rename(FileSystem fs, HStoreFile hsf)
          Renames the mapfiles and info directories under the passed hsf directory.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

delete

public void delete()
            throws IOException
Delete store map files.

Throws:
IOException

rename

public boolean rename(FileSystem fs,
                      HStoreFile hsf)
               throws IOException
Renames the mapfiles and info directories under the passed hsf directory.

Parameters:
fs -
hsf -
Returns:
True if succeeded.
Throws:
IOException

getReader

public MapFile.Reader getReader(FileSystem fs,
                                Filter bloomFilter)
                         throws IOException
Get reader for the store file map file. Client is responsible for closing file when done.

Parameters:
fs -
bloomFilter - If null, no filtering is done.
Returns:
MapFile.Reader
Throws:
IOException

getWriter

public MapFile.Writer getWriter(FileSystem fs,
                                SequenceFile.CompressionType compression,
                                Filter bloomFilter)
                         throws IOException
Get a store file writer. Client is responsible for closing file when done.

Parameters:
fs -
compression - Pass SequenceFile.CompressionType.NONE for none.
bloomFilter - If null, no filtering is done.
Returns:
MapFile.Writer
Throws:
IOException

length

public long length()
            throws IOException
Returns:
Length of the store map file. If a reference, size is approximation.
Throws:
IOException

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2006 The Apache Software Foundation