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

Carries out a drop table operation. More...

#include <OperationDropTable.h>

Inheritance diagram for Hypertable::OperationDropTable:
Inheritance graph
[legend]
Collaboration diagram for Hypertable::OperationDropTable:
Collaboration graph
[legend]

Public Member Functions

 OperationDropTable (ContextPtr &context, const String &name, bool if_exists, TableParts parts)
 Constructor. More...
 
 OperationDropTable (ContextPtr &context, const MetaLog::EntityHeader &header_)
 Constructor with MML entity. More...
 
 OperationDropTable (ContextPtr &context, EventPtr &event)
 Constructor with client request. More...
 
virtual ~OperationDropTable ()
 Destructor. More...
 
void execute () override
 Carries out the drop table operation. More...
 
const String name () override
 Returns name of operation ("OperationDropTable") More...
 
const String label () override
 Returns descriptive label for operation. More...
 
void display_state (std::ostream &os) override
 Writes human readable representation of object to output stream. More...
 
uint8_t encoding_version_state () const override
 Returns version of encoding format of state. More...
 
size_t encoded_length_state () const override
 Returns serialized state length. More...
 
void encode_state (uint8_t **bufp) const override
 Writes serialized encoding of object state. More...
 
void decode_state (uint8_t version, const uint8_t **bufp, size_t *remainp) override
 Decodes state from serialized object. More...
 
void decode_state_old (uint8_t version, const uint8_t **bufp, size_t *remainp) override
 
- Public Member Functions inherited from Hypertable::Operation
 Operation (ContextPtr &context, int32_t type)
 Constructor with operation type specifier. More...
 
 Operation (ContextPtr &context, EventPtr &event, int32_t type)
 Constructor with request Event and operation type specifier. More...
 
 Operation (ContextPtr &context, const MetaLog::EntityHeader &header_)
 Constructor with MetaLog::EntityHeader. More...
 
virtual ~Operation ()
 Destructor. More...
 
virtual const String graphviz_label ()
 Human readable operation label used in graphviz output. More...
 
virtual bool exclusive ()
 Indicates if operation is exclusive. More...
 
virtual size_t encoded_result_length () const
 Length of encoded operation result. More...
 
virtual void encode_result (uint8_t **bufp) const
 Encode operation result. More...
 
virtual void decode_result (const uint8_t **bufp, size_t *remainp)
 Decode operation result. More...
 
void decode (const uint8_t **bufp, size_t *remainp, uint16_t definition_version) override
 Decode operation. More...
 
void display (std::ostream &os) override
 Write human readable string represenation of operation to output stream. More...
 
int64_t id ()
 Operation identifier. More...
 
ClockT::time_point expiration_time ()
 Returns operation expiration time. More...
 
void set_remove_approval_mask (uint16_t mask)
 Sets the remove approvals bit mask. More...
 
uint16_t get_remove_approval_mask ()
 Gets the remove approvals bit mask. More...
 
bool remove_approval_add (uint16_t approval)
 Sets remove approval bits. More...
 
bool removal_approved ()
 Checks if all remove approvals have been received. More...
 
void record_state (std::vector< MetaLog::EntityPtr > &additional)
 Records operation state and additional entities to the MML. More...
 
void record_state ()
 Records operation state to the MML. More...
 
void complete_error (int error, const String &msg, std::vector< MetaLog::EntityPtr > &additional)
 Completes operation with error. More...
 
void complete_error (int error, const String &msg, MetaLog::EntityPtr additional=MetaLog::EntityPtr())
 Completes operation with error. More...
 
void complete_error (Exception &e, std::vector< MetaLog::EntityPtr > &additional)
 Completes operation with exception. More...
 
void complete_error (Exception &e, MetaLog::EntityPtr additional=MetaLog::EntityPtr())
 Completes operation with exception. More...
 
void complete_ok (std::vector< MetaLog::EntityPtr > &additional)
 
void complete_ok (MetaLog::EntityPtr additional=MetaLog::EntityPtr())
 
virtual int64_t hash_code () const
 
virtual void exclusivities (DependencySet &exclusivities)
 
virtual void dependencies (DependencySet &dependencies)
 
virtual void obstructions (DependencySet &obstructions)
 
void add_exclusivity (const String &exclusivity)
 
void add_dependency (const String &dependency)
 
void add_obstruction (const String &obstruction)
 
void add_obstruction_permanent (const String &obstruction)
 
void fetch_sub_operations (std::vector< std::shared_ptr< Operation > > &sub_ops)
 
void pre_run ()
 
void post_run ()
 
int32_t get_state ()
 
void set_state (int32_t state)
 
virtual bool is_perpetual ()
 
bool block ()
 
bool unblock ()
 
bool is_blocked ()
 
bool is_complete ()
 
int32_t get_original_type ()
 
void set_original_type (int32_t original_type)
 
void set_ephemeral ()
 Sets the ephemeral flag to true. More...
 
bool ephemeral ()
 Gets the ephemeral flag. More...
 
int32_t get_error ()
 Get error code. More...
 
String get_error_msg ()
 Get error message. More...
 
- Public Member Functions inherited from Hypertable::MetaLog::Entity
 Entity (int32_t type)
 Constructor from entity type. More...
 
 Entity (const EntityHeader &header_)
 Constructor from entity header. More...
 
virtual ~Entity ()
 Destructor. More...
 
void lock ()
 Locks the entity's mutex. More...
 
void unlock ()
 Unlocks the entity's mutex. More...
 
void mark_for_removal ()
 Marks entity for removal. More...
 
bool marked_for_removal ()
 Checks if entity is marked for removal. More...
 
int64_t id () const
 Returns the entity ID. More...
 
- Public Member Functions inherited from Hypertable::Serializable
virtual size_t encoded_length () const
 Returns serialized object length. More...
 
virtual void encode (uint8_t **bufp) const
 Writes serialized representation of object to a buffer. More...
 
virtual void decode (const uint8_t **bufp, size_t *remainp)
 Reads serialized representation of object from a buffer. More...
 

Private Attributes

Lib::Master::Request::Parameters::DropTable m_params
 Request parmaeters. More...
 
String m_id
 Table ID string More...
 
StringSet m_servers
 Set of participating range servers. More...
 
StringSet m_completed
 Range servers for which drop table operation has completed successfuly More...
 
TableParts m_parts {TableParts::ALL}
 Specification for which parts of table to drop. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Hypertable::Operation
uint8_t encoding_version () const override
 Returns encoding version. More...
 
size_t encoded_length_internal () const override
 Returns internal serialized length. More...
 
void encode_internal (uint8_t **bufp) const override
 Writes serialized representation of object to a buffer. More...
 
void decode_internal (uint8_t version, const uint8_t **bufp, size_t *remainp) override
 Reads serialized representation of object from a buffer. More...
 
void decode_old (const uint8_t **bufp, size_t *remainp, uint16_t definition_version)
 
bool validate_subops ()
 Handles the results of sub operations. More...
 
void stage_subop (std::shared_ptr< Operation > operation)
 Stages a sub operation for execution. More...
 
- Protected Member Functions inherited from Hypertable::MetaLog::Entity
void encode_entry (uint8_t **bufp)
 Encodes entity header plus serialized state. More...
 
- Protected Attributes inherited from Hypertable::Operation
ContextPtr m_context
 Pointer to Master context. More...
 
EventPtr m_event
 Pointer to client event (if any) that originated the operation. More...
 
uint16_t m_remove_approvals {}
 Remove approvals received. More...
 
uint16_t m_remove_approval_mask {}
 Remove approval mask. More...
 
int32_t m_original_type {}
 Original entity type read from MML (prior to conversion) More...
 
int32_t m_error {}
 Result error code. More...
 
String m_error_msg
 Result error message. More...
 
bool m_unblock_on_exit {}
 Flag to signal operation to be unblocked on exit (post_run()) More...
 
bool m_blocked {}
 Flag indicating if operation is blocked. More...
 
bool m_ephemeral {}
 Indicates if operation is ephemeral and does not get persisted to MML. More...
 
ClockT::time_point m_expiration_time
 Expiration time (used by ResponseManager) More...
 
int64_t m_hash_code
 Hash code uniqely identifying operation. More...
 
DependencySet m_exclusivities
 Set of exclusivities. More...
 
DependencySet m_dependencies
 Set of dependencies. More...
 
DependencySet m_obstructions
 Set of obstructions. More...
 
DependencySet m_obstructions_permanent
 Set of permanent obstructions. More...
 
std::vector< int64_t > m_sub_ops
 Vector of sub operations IDs. More...
 
- Protected Attributes inherited from Hypertable::MetaLog::Entity
std::mutex m_mutex
 Mutex for serializing access to members More...
 
EntityHeader header
 Entity header More...
 

Detailed Description

Carries out a drop table operation.

Definition at line 45 of file OperationDropTable.h.

Constructor & Destructor Documentation

OperationDropTable::OperationDropTable ( ContextPtr context,
const String name,
bool  if_exists,
TableParts  parts 
)

Constructor.

Initializes object by passing MetaLog::EntityType::OPERATION_DROP_TABLE to parent Operation constructor and initializes m_params with name and if_exists. Lastly, it initializes the dependency graph state as follows:

  • dependencies - INIT
  • exclusivities - Table pathname initialization with a call to initialize_dependencies().
    Parameters
    contextMaster context
    namePathname of table to drop
    if_existsFlag indicating if operation should succeed if table does not exist
    partsWhich parts of the table to drop

Definition at line 54 of file OperationDropTable.cc.

OperationDropTable::OperationDropTable ( ContextPtr context,
const MetaLog::EntityHeader header_ 
)

Constructor with MML entity.

Parameters
contextMaster context
header_MetaLog header

Definition at line 60 of file OperationDropTable.cc.

OperationDropTable::OperationDropTable ( ContextPtr context,
EventPtr event 
)

Constructor with client request.

Parameters
contextMaster context
eventEvent received from AsyncComm from client request

Definition at line 65 of file OperationDropTable.cc.

virtual Hypertable::OperationDropTable::~OperationDropTable ( )
inlinevirtual

Destructor.

Definition at line 75 of file OperationDropTable.h.

Member Function Documentation

void OperationDropTable::decode_state ( uint8_t  version,
const uint8_t **  bufp,
size_t *  remainp 
)
overridevirtual

Decodes state from serialized object.

This method restores the state of the object by decoding a serialized representation of the state from the memory location pointed to by *bufp.

Parameters
versionEncoding version
bufpAddress of source buffer pointer (advanced by call)
remainpAmount of remaining buffer pointed to by *bufp (decremented by call)
See also
encode() for a description of the serialized format

Implements Hypertable::Operation.

Definition at line 371 of file OperationDropTable.cc.

void OperationDropTable::decode_state_old ( uint8_t  version,
const uint8_t **  bufp,
size_t *  remainp 
)
overridevirtual

Implements Hypertable::Operation.

Definition at line 383 of file OperationDropTable.cc.

void OperationDropTable::display_state ( std::ostream &  os)
overridevirtual

Writes human readable representation of object to output stream.

The string returned has the following format:

 name=<TableName> id=<TableId>
Parameters
osOutput stream

Implements Hypertable::Operation.

Definition at line 338 of file OperationDropTable.cc.

void OperationDropTable::encode_state ( uint8_t **  bufp) const
overridevirtual

Writes serialized encoding of object state.

This method writes a serialized encoding of object state to the memory location pointed to by *bufp. The encoding has the following format:

EncodingDescription
boolif exists flag
vstrTable name
vstrTable identifier
i32Size of m_completed
vstrforeach server in m_completed, server name
i32[VERSION 2] Size of m_servers
vstr[VERSION 2] foreach server in m_servers, server name
TableParts[VERSION 3] Table parts to create (m_parts)
Parameters
bufpAddress of destination buffer pointer (advanced by call)

Implements Hypertable::Operation.

Definition at line 359 of file OperationDropTable.cc.

size_t OperationDropTable::encoded_length_state ( ) const
overridevirtual

Returns serialized state length.

This method returns the length of the serialized representation of the object state.

Returns
Serialized length.
See also
encode() for a description of the serialized format.

Implements Hypertable::Operation.

Definition at line 346 of file OperationDropTable.cc.

uint8_t OperationDropTable::encoding_version_state ( ) const
overridevirtual

Returns version of encoding format of state.

This is method returns the version of the encoding format of the state.

Returns
Version of encoding format of state.

Implements Hypertable::Operation.

Definition at line 342 of file OperationDropTable.cc.

void OperationDropTable::execute ( )
overridevirtual

Carries out the drop table operation.

This method carries out the operation via the following states:

State Description
INITIAL
  • Gets table ID from Hyperspace and stores it in m_id. If mapping does not exist in Hyperspace, then if the if exists parameter is true it completes successfully, otherwise it completes with error Error::TABLE_NOT_FOUND
  • Transitions to DROP_VALUE_INDEX
  • Persists self to MML and returns
DROP_VALUE_INDEX
  • If value index is not specified in m_parts or the value index table does not exist in Hyperspace, state is transitioned to DROP_QUALIFIER_INDEX and function drops through to next state
  • Creates OperationDropTable sub operation for value index table
  • Stages sub operation with call to stage_subop()
  • Transitions to state DROP_QUALIFIER_INDEX
  • Persists operation with a call to record_state() and returns
DROP_QUALIFIER_INDEX
  • Handles result of value index dropping sub operation with a call to validate_subops(), returning if it failed
  • If qualifier index is not specified in m_parts or the qualifier index table does not exist in Hyperspace, state is transitioned to UPDATE_HYPERSPACE, state is persisted with a call to record_state(), then drops through to next state
  • Creates OperationDropTable sub operation for the qualifier index table
  • Stages sub operation with call to stage_subop()
  • Transitions to state UPDATE_HYPERSPACE
  • Persists operation with a call to record_state() and returns
UPDATE_HYPERSPACE
  • Handles result of qualifier index dropping sub operation with a call to validate_subops(), returning if it failed
  • Drops the name/id mapping for table in Hyperspace
  • Removes the table directory from the brokered FS
  • Dependencies set to Dependency::METADATA and "<table-id> move range", the latter causing the drop table operation to wait for all in-progress MoveRange operations on the table to complete
  • Transitions to SCAN_METADATA state
  • Persists operation with a call to record_state() and returns
SCAN_METADATA
  • Scans the METADATA table and populates m_servers to hold the set of servers that hold the table to be dropped which are not in the m_completed set.
  • Dependencies are set to server names in m_servers
  • Transitions to ISSUE_REQUESTS state
  • Persists self to MML and returns
ISSUE_REQUESTS
  • Issues a drop table request to all servers in m_servers and waits for their completion
  • If there are any errors, for each server that was successful or returned with Error::TABLE_NOT_FOUND, the server name is added to m_completed. Dependencies are then set back to METADATA and m_id + " move range", the state is reset back to SCAN_METADATA, the operation is persisted to the MML, and the method returns
  • Otherwise the table is purged from the monitoring subsystem and state is transitioned to COMPLETED

Implements Hypertable::Operation.

Definition at line 159 of file OperationDropTable.cc.

const String OperationDropTable::label ( )
overridevirtual

Returns descriptive label for operation.

This method returns a descriptive label for the operation which is constructed as the string "DropTable " followed by the name of the table being dropped.

Returns
Descriptive label for operation

Implements Hypertable::Operation.

Definition at line 408 of file OperationDropTable.cc.

const String OperationDropTable::name ( )
overridevirtual

Returns name of operation ("OperationDropTable")

Returns
Operation name

Implements Hypertable::Operation.

Definition at line 404 of file OperationDropTable.cc.

Member Data Documentation

StringSet Hypertable::OperationDropTable::m_completed
private

Range servers for which drop table operation has completed successfuly

Definition at line 170 of file OperationDropTable.h.

String Hypertable::OperationDropTable::m_id
private

Table ID string

Definition at line 164 of file OperationDropTable.h.

Lib::Master::Request::Parameters::DropTable Hypertable::OperationDropTable::m_params
private

Request parmaeters.

Definition at line 161 of file OperationDropTable.h.

TableParts Hypertable::OperationDropTable::m_parts {TableParts::ALL}
private

Specification for which parts of table to drop.

Definition at line 173 of file OperationDropTable.h.

StringSet Hypertable::OperationDropTable::m_servers
private

Set of participating range servers.

Definition at line 167 of file OperationDropTable.h.


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