0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Hypertable::AccessGroupHintsFile Class Reference

Reads and writes access group "hints" file. More...

#include <AccessGroupHintsFile.h>

Collaboration diagram for Hypertable::AccessGroupHintsFile:
Collaboration graph
[legend]

Public Member Functions

 AccessGroupHintsFile (const String &table, const String &start_row, const String &end_row)
 Constructor. More...
 
void change_start_row (const String &start_row)
 Changes the start row. More...
 
void change_end_row (const String &end_row)
 Changes the end row. More...
 
std::vector< AccessGroup::Hints > & get ()
 Returns reference to internal hints vector. More...
 
void set (const std::vector< AccessGroup::Hints > &hints)
 Replaces contents of internal hints vector. More...
 
void write (String location)
 Write hints file. More...
 
void read ()
 Reads hints file. More...
 
bool exists ()
 Checks if hints file exists. More...
 

Private Member Functions

void parse_header (const char *input, const char **ag_base)
 Parses header portion of hints file. More...
 

Private Attributes

String m_table_id
 Table ID string More...
 
String m_start_row
 Start row. More...
 
String m_end_row
 End row. More...
 
String m_range_dir
 Range subdirectory (md5 of end row) More...
 
std::vector< AccessGroup::Hintsm_hints
 Vector of access group hints. More...
 

Detailed Description

Reads and writes access group "hints" file.

There are some state variables in each access group object that are required immediately after the object is constructed. These variables improve the performance of the system, but are expensive to compute because it requires scanning the METADATA table entry for the parent range, and opening and loading the block indexes for all CellStores that make up the access group. To allow this state to be reconstructed cheaply on restart, these state variables are persisted to a hints file in the filesystem that is read before the access group objects are constructed. There is one hints file for each range that contains an entry for each access group that makes up the range. For each range, the hints file has the following path:

/hypertable/tables/<table-id>/default/<md5-end-row>/hints

This file is in YAML format and contains a version number, start row, end row, and one mapping for each access group with the following format:

Version: 2
Start Row: <start-row>
End Row: <start-row>
Access Groups: {
  ag_name: {
    LatestStoredRevision: <revision>,
    DiskUsage: $bytes,
    Files: $file_list
  }
  ...
}

The fields in the mapping for each access group are described below.

The reason that the hints for all of the access groups are persisted to a single hints file for each range is to improve restart performance. Upon restart, a single file is read to obtain the hints for all access groups, regardless of the number of access groups.

Definition at line 91 of file AccessGroupHintsFile.h.

Constructor & Destructor Documentation

AccessGroupHintsFile::AccessGroupHintsFile ( const String table,
const String start_row,
const String end_row 
)

Constructor.

Parameters
tableTable ID string
start_rowStart row of range
end_rowEnd row of range

Definition at line 49 of file AccessGroupHintsFile.cc.

Member Function Documentation

void AccessGroupHintsFile::change_end_row ( const String end_row)

Changes the end row.

This method is called after a range split to change the end row that is used to compute the path name to the hints file.

Parameters
end_rowEnd row of range

Definition at line 62 of file AccessGroupHintsFile.cc.

void AccessGroupHintsFile::change_start_row ( const String start_row)

Changes the start row.

This method is called after a range split to change the start row that is written to the hints file.

Parameters
start_rowStart row of range

Definition at line 57 of file AccessGroupHintsFile.cc.

bool AccessGroupHintsFile::exists ( )

Checks if hints file exists.

Returns
true if file exists, false otherwise

Definition at line 215 of file AccessGroupHintsFile.cc.

std::vector<AccessGroup::Hints>& Hypertable::AccessGroupHintsFile::get ( )
inline

Returns reference to internal hints vector.

Returns
reference to internal hints vector

Definition at line 120 of file AccessGroupHintsFile.h.

void AccessGroupHintsFile::parse_header ( const char *  input,
const char **  ag_base 
)
private

Parses header portion of hints file.

Parameters
inputPointer to beginning of hints file content
ag_baseAddress of return pointer to Access Group section

Definition at line 253 of file AccessGroupHintsFile.cc.

void AccessGroupHintsFile::read ( )

Reads hints file.

Definition at line 128 of file AccessGroupHintsFile.cc.

void Hypertable::AccessGroupHintsFile::set ( const std::vector< AccessGroup::Hints > &  hints)
inline

Replaces contents of internal hints vector.

Parameters
hintsReference to vector of hints

Definition at line 127 of file AccessGroupHintsFile.h.

void AccessGroupHintsFile::write ( String  location)

Write hints file.

Parameters
locationProxy name of server who owns the range (empty if unknown)

Definition at line 78 of file AccessGroupHintsFile.cc.

Member Data Documentation

String Hypertable::AccessGroupHintsFile::m_end_row
private

End row.

Definition at line 159 of file AccessGroupHintsFile.h.

std::vector<AccessGroup::Hints> Hypertable::AccessGroupHintsFile::m_hints
private

Vector of access group hints.

Definition at line 165 of file AccessGroupHintsFile.h.

String Hypertable::AccessGroupHintsFile::m_range_dir
private

Range subdirectory (md5 of end row)

Definition at line 162 of file AccessGroupHintsFile.h.

String Hypertable::AccessGroupHintsFile::m_start_row
private

Start row.

Definition at line 156 of file AccessGroupHintsFile.h.

String Hypertable::AccessGroupHintsFile::m_table_id
private

Table ID string

Definition at line 153 of file AccessGroupHintsFile.h.


The documentation for this class was generated from the following files: