Reads and writes access group "hints" file. More...
#include <AccessGroupHintsFile.h>
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::Hints > | m_hints |
Vector of access group hints. More... | |
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.
AccessGroupHintsFile::AccessGroupHintsFile | ( | const String & | table, |
const String & | start_row, | ||
const String & | end_row | ||
) |
Constructor.
table | Table ID string |
start_row | Start row of range |
end_row | End row of range |
Definition at line 49 of file AccessGroupHintsFile.cc.
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.
end_row | End 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.
start_row | Start row of range |
Definition at line 57 of file AccessGroupHintsFile.cc.
bool AccessGroupHintsFile::exists | ( | ) |
Checks if hints file exists.
Definition at line 215 of file AccessGroupHintsFile.cc.
|
inline |
Returns reference to internal hints vector.
Definition at line 120 of file AccessGroupHintsFile.h.
|
private |
Parses header portion of hints file.
input | Pointer to beginning of hints file content |
ag_base | Address 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.
|
inline |
Replaces contents of internal hints vector.
hints | Reference to vector of hints |
Definition at line 127 of file AccessGroupHintsFile.h.
void AccessGroupHintsFile::write | ( | String | location | ) |
Write hints file.
location | Proxy name of server who owns the range (empty if unknown) |
Definition at line 78 of file AccessGroupHintsFile.cc.
|
private |
End row.
Definition at line 159 of file AccessGroupHintsFile.h.
|
private |
Vector of access group hints.
Definition at line 165 of file AccessGroupHintsFile.h.
|
private |
Range subdirectory (md5 of end row)
Definition at line 162 of file AccessGroupHintsFile.h.
|
private |
Start row.
Definition at line 156 of file AccessGroupHintsFile.h.
|
private |
Table ID string
Definition at line 153 of file AccessGroupHintsFile.h.