52 const string &transfer_log, int64_t soft_limit,
bool is_split)
54 m_params(source, range_id, table, range, transfer_log, soft_limit, is_split) {
69 const uint8_t *ptr =
event->payload;
70 size_t remaining =
event->payload_len;
84 "OperationMoveRange"));
111 m_context->get_balance_plan_authority(bpa_entity);
115 HT_INFOF(
"Entering MoveRange-%lld %s (id=%lld) state=%s",
131 HT_INFOF(
"MoveRange %s: destination is %s (previous: %s)",
133 old_destination.c_str());
136 m_context->mml_writer->record_state(shared_from_this());
164 HT_WARNF(
"Skipping %s::load_range() because in TEST MODE",
176 this_thread::sleep_for(chrono::milliseconds(2000));
181 HT_WARNF(
"Aborting MoveRange %s because table no longer exists",
187 = dynamic_pointer_cast<
Operation>(shared_from_this());
188 m_context->remove_move_operation(operation);
194 HT_WARNF(
"Problem moving range %s to %s: %s - %s",
197 this_thread::sleep_for(chrono::milliseconds(5000));
204 m_context->mml_writer->record_state(shared_from_this());
213 HT_WARNF(
"Skipping %s::acknowledge_load() because in TEST MODE",
219 vector<QualifiedRangeSpec *> range_vec;
220 map<QualifiedRangeSpec, int> response_map;
221 range_vec.push_back(&qrs);
223 map<QualifiedRangeSpec, int>::iterator it = response_map.begin();
227 HT_THROWF(it->second,
"Problem acknowledging load range %s to %s",
232 HT_WARNF(
"Problem acknowledging load range %s: %s - %s (dest %s)",
235 this_thread::sleep_for(chrono::milliseconds(5000));
251 = dynamic_pointer_cast<
Operation>(shared_from_this());
252 m_context->remove_move_operation(operation);
261 HT_FATALF(
"Unrecognized state %d", state);
264 HT_INFOF(
"Leaving MoveRange-%lld %s (id=%lld) -> %s (state=%s)",
318 transfer_log, soft_limit,
338 return "OperationMoveRange";
339 return format(
"OperationMoveRange %s %s[%s..%s] -> %s",
347 return "OperationMoveRange";
348 return format(
"MoveRange %s %s[%s..%s] -> %s",
358 if (start_row.length() > 20)
359 start_row = start_row.substr(0, 10) +
".."
360 + start_row.substr(start_row.length()-10, 10);
363 end_row =
"END_ROW_MARKER";
364 else if (end_row.length() > 20)
365 end_row = end_row.substr(0, 10) +
".."
366 + end_row.substr(end_row.length() - 10, 10);
369 start_row.c_str(), end_row.c_str());
375 const std::string &source,
379 source +
":" + range_id);
Retrieves system information (hardware, installation directory, etc)
char * decode_vstr(const uint8_t **bufp, size_t *remainp)
Decode a vstr (vint64, data, null).
void decode_state(uint8_t version, const uint8_t **bufp, size_t *remainp) override
Decode operation state.
void display_state(std::ostream &os) override
Write human readable operation state to output stream.
#define HT_WARNF(msg,...)
The FailureInducer simulates errors.
ContextPtr m_context
Pointer to Master context.
static const char * METADATA_ID
void decode_result(const uint8_t **bufp, size_t *remainp) override
Decode operation result.
std::shared_ptr< Entity > EntityPtr
Smart pointer to Entity.
String format(const char *fmt,...)
Returns a String using printf like format facilities Vanilla snprintf is about 1.5x faster than this...
virtual int response_ok()
Sends a a simple success response back to the client which is just the 4-byte error code Error::OK...
virtual size_t encoded_length() const
Returns serialized object length.
Declarations for OperationProcessor.
virtual void decode_result(const uint8_t **bufp, size_t *remainp)
Decode operation result.
void acknowledge_load(const CommAddress &addr, const vector< QualifiedRangeSpec * > &ranges, std::map< QualifiedRangeSpec, int > &response_map)
Issues a synchronous "acknowledge load" request for multiple ranges.
uint64_t soft_limit
Soft split size limit.
std::shared_ptr< Event > EventPtr
Smart pointer to Event.
int64_t range_hash_code(const TableIdentifier &table, const RangeSpec &range, const String &qualifier)
Returns a hash code for a range with an optional qualifer string.
virtual int64_t hash_code() const
size_t encoded_length_state() const override
Encoded length of operation state.
size_t encoded_length_vstr(size_t len)
Computes the encoded length of vstr (vint64, data, null)
const String graphviz_label() override
Human readable operation label used in graphviz output.
const char * get_text(int32_t state)
int64_t m_hash_code
Hash code uniqely identifying operation.
EventPtr m_event
Pointer to client event (if any) that originated the operation.
std::shared_ptr< Context > ContextPtr
Smart pointer to Context.
Request parameters for move range operation.
String 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.
Lib::Master::Request::Parameters::MoveRange m_params
Request parmaeters.
uint64_t decode_i64(const uint8_t **bufp, size_t *remainp)
Decode a 64-bit integer in little-endian order.
virtual void encode(uint8_t **bufp) const
Writes serialized representation of object to a buffer.
void set_state(int32_t state)
bool decode_bool(const uint8_t **bufp, size_t *remainp)
Decodes a boolean value from the given buffer.
const char * get_text(int error)
Returns a descriptive error message.
OperationMoveRange(ContextPtr &context, const String &source, int64_t range_id, const TableIdentifier &table, const RangeSpec &range, const String &transfer_log, int64_t soft_limit, bool is_split)
void set_proxy(const String &str)
Sets address type to CommAddress::PROXY and proxy name to p.
Compatibility Macros for C/C++.
int64_t soft_limit()
Gets soft limit.
const char * transfer_log
Full pathname of transfer log.
TableIdentifier & table()
Gets table identifier.
void set_remove_approval_mask(uint16_t mask)
Sets the remove approvals bit mask.
Functions to serialize/deserialize primitives to/from a memory buffer.
const String label() override
Human readable label for operation.
const String name() override
Name of operation used for exclusivity.
virtual void decode(const uint8_t **bufp, size_t *remainp)
Reads serialized representation of object from a buffer.
RangeSpec & range_spec()
Gets range specification.
void encode_state(uint8_t **bufp) const override
Encode operation state.
This class is used to generate and deliver standard responses back to a client.
void encode_vstr(uint8_t **bufp, const void *buf, size_t len)
Encode a buffer as variable length string (vint64, data, null)
#define HT_FATALF(msg,...)
long long int Lld
Shortcut for printf formats.
bool table_exists(ContextPtr &context, const String &name, String &id)
Checks if table exists and returns table ID.
DependencySet m_obstructions
Set of obstructions.
Declarations for general-purpose utility functions.
void legacy_decode(const uint8_t **bufp, size_t *remainp, BalancePlan *plan)
Central authority for balance plans.
void initialize_dependencies()
bool is_split()
Gets is split flag.
DependencySet m_dependencies
Set of dependencies.
uint8_t encoding_version_state() const override
Returns version of encoding format of state.
#define HT_INFOF(msg,...)
#define HT_THROWF(_code_, _fmt_,...)
Client interface to RangeServer.
Abstract base class for master operations.
This is a generic exception class for Hypertable.
void execute() override
Executes (carries out) the operation.
Qualified (with table identifier) range specification.
DependencySet m_exclusivities
Set of exclusivities.
const string & transfer_log() const
Gets transfer log.
void load_range(const CommAddress &addr, const TableIdentifier &table, const RangeSpec &range_spec, const RangeState &range_state, bool needs_compaction)
Issues a synchronous "load range" request.
void decode_state_old(uint8_t version, const uint8_t **bufp, size_t *remainp) override
#define HT_MAYBE_FAIL(_label_)
void complete_ok(std::vector< MetaLog::EntityPtr > &additional)
Declarations for BalancePlanAuthority.
std::shared_ptr< Operation > OperationPtr
Smart pointer to Operation.
Declarations for ResponseCallback.
std::shared_ptr< BalancePlanAuthority > BalancePlanAuthorityPtr
Smart pointer to BalancePlanAuthority.
int32_t get_original_type()
bool remove_approval_add(uint16_t approval)
Sets remove approval bits.
Error codes, Exception handling, error logging.
int64_t range_id() const
Gets range MetaLog entry identifier.
static const char * END_ROW_MARKER
String m_range_name
Range name for logging purposes.
Address abstraction to hold either proxy name or IPv4:port address.
const string & source() const
Gets name of source RangeServer.
int code() const
Returns the error code.
Executes user-defined functions when leaving the current scope.
String m_destination
Destination server.