Master server. More...
Namespaces | |
Hypertable::OperationState | |
Master operation states. | |
Hypertable::Dependency | |
Master dependency strings | |
Hypertable::TableMaintenance | |
Table maintenance constants | |
Functions | |
Hypertable::DispatchHandlerOperationSystemStatus::Result::Result (const std::string &location, InetAddr addr) | |
Hypertable::DispatchHandlerOperationSystemStatus::DispatchHandlerOperationSystemStatus (ContextPtr &context, Timer &timer) | |
Constructor. More... | |
void | Hypertable::DispatchHandlerOperationSystemStatus::initialize (std::vector< Result > &results) |
Performs initialization. More... | |
void | Hypertable::DispatchHandlerOperationSystemStatus::start (const String &location) override |
Issues a status request for the range server at location . More... | |
void | Hypertable::DispatchHandlerOperationSystemStatus::result_callback (const EventPtr &event) override |
Handles a status request event. More... | |
int | main (int argc, char **argv) |
void | Hypertable::Utility::get_table_server_set (ContextPtr &context, const String &id, const String &row, StringSet &servers) |
Gets set of servers holding ranges for a given table. More... | |
bool | Hypertable::Utility::table_exists (ContextPtr &context, const String &name, String &id) |
Checks if table exists and returns table ID. More... | |
bool | Hypertable::Utility::table_exists (ContextPtr &context, const String &id) |
Checks if table ID exists. More... | |
TableParts | Hypertable::Utility::get_index_parts (const std::string &schema) |
Gets index parts specified in schema. More... | |
void | Hypertable::Utility::verify_table_name_availability (ContextPtr &context, const String &name, String &id) |
Checks if table name is available. More... | |
void | Hypertable::Utility::create_table_in_hyperspace (ContextPtr &context, const String &name, const String &schema_str, TableIdentifierManaged *table) |
Creates a table in Hyperspace. More... | |
void | Hypertable::Utility::prepare_index (ContextPtr &context, const String &name, const String &schema_str, bool qualifier, String &index_name, String &index_schema) |
Prepares index schema and table name. More... | |
void | Hypertable::Utility::create_table_write_metadata (ContextPtr &context, TableIdentifier *table) |
Creates initial METADATA table entry for table . More... | |
bool | Hypertable::Utility::next_available_server (ContextPtr &context, String &location, bool urgent=false) |
Gets name of next available server. More... | |
void | Hypertable::Utility::create_table_load_range (ContextPtr &context, const String &location, TableIdentifier &table, RangeSpec &range, bool needs_compaction) |
Loads a table's initial range. More... | |
void | Hypertable::Utility::create_table_acknowledge_range (ContextPtr &context, const String &location, TableIdentifier &table, RangeSpec &range) |
Calls RangeServer::acknowledge_load for a range. More... | |
int64_t | Hypertable::Utility::range_hash_code (const TableIdentifier &table, const RangeSpec &range, const String &qualifier) |
Returns a hash code for a range with an optional qualifer string. More... | |
String | Hypertable::Utility::range_hash_string (const TableIdentifier &table, const RangeSpec &range, const String &qualifier) |
Returns string representation of hash code for a range with an optional qualifer string. More... | |
String | Hypertable::Utility::root_range_location (ContextPtr &context) |
Returns location of root METADATA range. More... | |
bool | Hypertable::Utility::status (ContextPtr &context, Timer &timer, Status &status) |
Runs a status check on the master. More... | |
void | Hypertable::Utility::shutdown_rangeserver (ContextPtr &context, CommAddress &addr) |
Sends a shutdown command to a rangeserver. More... | |
Master server.
The Master module contains all of the definitions that make up the Master server process which is responsible for handling meta operations such the following
typedef std::shared_ptr<BalancePlanAuthority> Hypertable::BalancePlanAuthorityPtr |
Smart pointer to BalancePlanAuthority.
Definition at line 399 of file BalancePlanAuthority.h.
typedef std::shared_ptr< Context > Hypertable::ContextPtr |
typedef std::set<String> Hypertable::DependencySet |
Set of dependency string.
Definition at line 107 of file Operation.h.
typedef std::shared_ptr<DispatchHandlerOperationCompact> Hypertable::DispatchHandlerOperationCompactPtr |
Smart pointer to DispatchHandlerOperationCompact.
Definition at line 84 of file DispatchHandlerOperationCompact.h.
typedef std::shared_ptr<DispatchHandlerOperation> Hypertable::DispatchHandlerOperationPtr |
Smart pointer to DispatchHandlerOperation.
Definition at line 179 of file DispatchHandlerOperation.h.
typedef std::shared_ptr<DispatchHandlerOperationSetState> Hypertable::DispatchHandlerOperationSetStatePtr |
Smart pointer to DispatchHandlerOperationSetState.
Definition at line 84 of file DispatchHandlerOperationSetState.h.
typedef std::shared_ptr<DispatchHandlerOperationSystemStatus> Hypertable::DispatchHandlerOperationSystemStatusPtr |
Smart pointer to DispatchHandlerOperationSystemStatus.
Definition at line 94 of file DispatchHandlerOperationSystemStatus.h.
typedef std::shared_ptr< MetricsHandler > Hypertable::MetricsHandlerPtr |
Smart pointer to MetricsHandler.
Shared smart pointer to MetricsHandler.
Definition at line 107 of file MetricsHandler.h.
typedef std::shared_ptr<Operation> Hypertable::OperationPtr |
Smart pointer to Operation.
Definition at line 609 of file Operation.h.
typedef std::shared_ptr<RecoveredServers> Hypertable::RecoveredServersPtr |
Smart pointer to RecoveredServers.
Definition at line 112 of file RecoveredServers.h.
typedef std::shared_ptr<SystemState> Hypertable::SystemStatePtr |
Shared smart pointer to SystemState.
Definition at line 191 of file SystemState.h.
anonymous enum |
Enumeration for operation states.
Definition at line 53 of file Operation.h.
anonymous enum |
Enumerator | |
---|---|
RESTART |
Definition at line 47 of file OperationRecover.h.
void Hypertable::Utility::create_table_acknowledge_range | ( | ContextPtr & | context, |
const String & | location, | ||
TableIdentifier & | table, | ||
RangeSpec & | range | ||
) |
Calls RangeServer::acknowledge_load for a range.
Calls RangeServer::acknowledge_load for the range specified by table
and range
.
context | Master context |
location | RangeServer at which to call acknowledge_load |
table | Table identifier |
range | Range spec |
Exception | holding error code if not Error::OK, Error::TABLE_NOT_FOUND, or Error::RANGESERVER_RANGE_NOT_FOUND |
Definition at line 350 of file Utility.cc.
void Hypertable::Utility::create_table_in_hyperspace | ( | ContextPtr & | context, |
const String & | name, | ||
const String & | schema_str, | ||
TableIdentifierManaged * | table | ||
) |
Creates a table in Hyperspace.
Adds a table ID mapping for name
, creates a schema object from schema_str
and assigns column family IDs and writes schema attribute of ID file in Hyperspace, and sets the table ID and generation attributes of table
. This method also creates access group directories (/hypertable/tables/$TABLE_ID/$ACCESS_GROUP
) for the table in the DFS.
context | Master context |
name | Table name to create |
schema_str | Schema XML string |
table | Pointer to table identifier |
Definition at line 182 of file Utility.cc.
void Hypertable::Utility::create_table_load_range | ( | ContextPtr & | context, |
const String & | location, | ||
TableIdentifier & | table, | ||
RangeSpec & | range, | ||
bool | needs_compaction | ||
) |
Loads a table's initial range.
Load's a table's initial range in the server specified by location
. A RangeState object is initialized with the split size and passed into the RangeServer::load_range call. The split size is set as follows:
Hypertable.RangeServer.Range.MetadataSplitSize
property if it is set, otherwise it is set to the value of the Hypertable.RangeServer.Range.SplitSize
property.Hypertable.RangeServer.Range.SplitSize
property if Hypertable.Master.Split.SoftLimitEnabled
is false. Otherwise, if Hypertable.Master.Split.SoftLimitEnabled
is true, the split size is set to Hypertable.RangeServer.Range.SplitSize / min(64, server_count*2)
context | Master context |
location | RangeServer in which to load initial range |
table | Table identifier |
range | Range spec |
needs_compaction | Needs compaction flag |
Definition at line 313 of file Utility.cc.
void Hypertable::Utility::create_table_write_metadata | ( | ContextPtr & | context, |
TableIdentifier * | table | ||
) |
Creates initial METADATA table entry for table
.
Creates the initial METADATA table entry for table
by writing a new StartRow column with row key formulated as table_id + ":" + Key::END_ROW_MARKER. The value is set to NULL unless table is METADATA in which case it is set to Key::END_ROOT_ROW.
context | Master context |
table | Table identifier for which to create initial METADATA entry |
Definition at line 275 of file Utility.cc.
DispatchHandlerOperationSystemStatus::DispatchHandlerOperationSystemStatus | ( | ContextPtr & | context, |
Timer & | timer | ||
) |
Constructor.
context | Master context |
timer | Deadline timer |
Definition at line 33 of file DispatchHandlerOperationSystemStatus.cc.
TableParts Hypertable::Utility::get_index_parts | ( | const std::string & | schema | ) |
Gets index parts specified in schema.
Returns a TableParts object specifying the indices that are specified in schema
.
schema | Schema for which to obtain index parts |
schema
Definition at line 124 of file Utility.cc.
void Hypertable::Utility::get_table_server_set | ( | ContextPtr & | context, |
const String & | id, | ||
const String & | row, | ||
StringSet & | servers | ||
) |
Gets set of servers holding ranges for a given table.
Scans the METADATA table to determine which RangeServers hold ranges for the table with identifier id
.
context | Master context |
id | Table identifier |
row | Get servers containing this row ("" implies all) |
servers | Reference to string set to hold RangeServer names |
Definition at line 57 of file Utility.cc.
void DispatchHandlerOperationSystemStatus::initialize | ( | std::vector< Result > & | results | ) |
Performs initialization.
This method populates m_index with pointers to the Result objects in results
. This means that while the the status operations are in progress, the caller should not modify the results
vector in any way. It also starts the deadline timer m_timer.
results | Vector of result objects, one for each RangeServer. |
Definition at line 37 of file DispatchHandlerOperationSystemStatus.cc.
int main | ( | int | argc, |
char ** | argv | ||
) |
bool Hypertable::Utility::next_available_server | ( | ContextPtr & | context, |
String & | location, | ||
bool | urgent = false |
||
) |
Gets name of next available server.
Queries RangeServerConnectionManager for next available server to hold a new range and sets location
to the server name if found.
context | Master context |
location | Reference to string to hold next available server name |
urgent | Use servers that exceed disk threshold, if necessary |
Definition at line 304 of file Utility.cc.
void Hypertable::Utility::prepare_index | ( | ContextPtr & | context, |
const String & | name, | ||
const String & | schema_str, | ||
bool | qualifier, | ||
String & | index_name, | ||
String & | index_schema | ||
) |
Prepares index schema and table name.
Creates a schema for an index table associated with primary table name
. The group commit interval is obtained from the primary table schema and copied to the index table schema. The index name is formualted by prepending "^" to the primary table name for a value index and "^^" for a qualifier index.
context | Master context |
name | Name of table for which to prepare index |
schema_str | XML schema string for primary table |
qualifier | Indicates if preparation is for qualifier index |
index_name | Return string to hold index table name |
index_schema | Return string to hold index table XML schema |
Definition at line 229 of file Utility.cc.
int64_t Hypertable::Utility::range_hash_code | ( | const TableIdentifier & | table, |
const RangeSpec & | range, | ||
const String & | qualifier | ||
) |
Returns a hash code for a range with an optional qualifer string.
This method computes a hash code by XOR'ing the md5_hash values for the following components:
qualifier
(if not empty)table.id
range.start_row
range.end_row
table | Table identifier |
range | Range spec |
qualifier | Qualifier string |
Definition at line 379 of file Utility.cc.
String Hypertable::Utility::range_hash_string | ( | const TableIdentifier & | table, |
const RangeSpec & | range, | ||
const String & | qualifier | ||
) |
Returns string representation of hash code for a range with an optional qualifer string.
Calls Utility::range_hash_code and converts it to a string.
table | Table identifier |
range | Range spec |
qualifier | Qualifier string |
Definition at line 385 of file Utility.cc.
|
inline |
Definition at line 54 of file DispatchHandlerOperationSystemStatus.h.
|
overridevirtual |
Handles a status request event.
Locates the corresponding result object in m_index and populates it with
Reimplemented from Hypertable::DispatchHandlerOperation.
Definition at line 51 of file DispatchHandlerOperationSystemStatus.cc.
String Hypertable::Utility::root_range_location | ( | ContextPtr & | context | ) |
Returns location of root METADATA range.
Reads location of root METADATA range from Location attribute of /hypertable/root
file in Hyperspace and returns it.
/hypertable
may be different depending on the Hypertable.Directory
property. context | Master context |
Definition at line 389 of file Utility.cc.
void Hypertable::Utility::shutdown_rangeserver | ( | ContextPtr & | context, |
CommAddress & | addr | ||
) |
Sends a shutdown command to a rangeserver.
context | Master context |
addr | Address of rangeserver to shut down |
Definition at line 447 of file Utility.cc.
|
overridevirtual |
Issues a status request for the range server at location
.
location | Proxy name of range server |
Implements Hypertable::DispatchHandlerOperation.
Definition at line 44 of file DispatchHandlerOperationSystemStatus.cc.
bool Hypertable::Utility::status | ( | ContextPtr & | context, |
Timer & | timer, | ||
Status & | status | ||
) |
Runs a status check on the master.
context | Master context |
timer | Deadline timer |
status | Status output object |
Definition at line 408 of file Utility.cc.
bool Hypertable::Utility::table_exists | ( | ContextPtr & | context, |
const String & | name, | ||
String & | id | ||
) |
Checks if table exists and returns table ID.
Checks to see if table name
exists and returns the corresponding table ID in the id
parameter. It considers the table to exist if it has an ID mapping in Hyperspace and the x attribute exists. The creation of the x atribute on a table's ID file in Hyperspace is the last thing that happens in a create table operation.
context | Master context |
name | Name of table to check for existance |
id | Return parameter to hold table ID |
Definition at line 100 of file Utility.cc.
bool Hypertable::Utility::table_exists | ( | ContextPtr & | context, |
const String & | id | ||
) |
Checks if table ID exists.
Checks to see if table specified by id
exists. It considers the table to exist if the ID file exists in Hyperspace and the the x attribute exists. The creation of the x atribute on a table's ID file in Hyperspace is the last thing that happens in a create table operation.
context | Master context |
id | ID of table to check for existance |
Definition at line 140 of file Utility.cc.
void Hypertable::Utility::verify_table_name_availability | ( | ContextPtr & | context, |
const String & | name, | ||
String & | id | ||
) |
Checks if table name is available.
Checks to see if table name
is available for use in a create table operation. It considers the table name to be available if it does not have an ID mapping, or the x attribute does not exist. The creation of the x atribute on a table's ID file in Hyperspace is the last thing that happens in a create table operation. If this function retuns without throwing an exception, then name
can be considered available. If name
has an ID mapping, but no x attribute, then the ID is returned in id
.
context | Master context |
name | Table name to check for availability |
id | Table ID, if already assigned |
Error::NAME_ALREADY_IN_USE | if name exists and is a namespace, or Error::MASTER_TABLE_EXISTS if name exists and is a table. |
Definition at line 158 of file Utility.cc.
InetAddr Hypertable::DispatchHandlerOperationSystemStatus::Result::addr |
Definition at line 57 of file DispatchHandlerOperationSystemStatus.h.
int32_t Hypertable::DispatchHandlerOperationSystemStatus::Result::error {Error::NO_RESPONSE} |
Definition at line 58 of file DispatchHandlerOperationSystemStatus.h.
std::string Hypertable::DispatchHandlerOperationSystemStatus::Result::location |
Definition at line 56 of file DispatchHandlerOperationSystemStatus.h.
|
private |
Result map.
Definition at line 90 of file DispatchHandlerOperationSystemStatus.h.
|
private |
Deadline timer.
Definition at line 87 of file DispatchHandlerOperationSystemStatus.h.
std::string Hypertable::DispatchHandlerOperationSystemStatus::Result::message |
Definition at line 59 of file DispatchHandlerOperationSystemStatus.h.
Status Hypertable::DispatchHandlerOperationSystemStatus::Result::status |
Definition at line 60 of file DispatchHandlerOperationSystemStatus.h.