0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
OperationRecover.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2007-2015 Hypertable, Inc.
3  *
4  * This file is part of Hypertable.
5  *
6  * Hypertable is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; version 3 of the
9  * License, or any later version.
10  *
11  * Hypertable is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301, USA.
20  */
21 
22 #include <Common/Compat.h>
23 
24 #include "OperationRecover.h"
25 
32 
36 
39 
40 #include <Common/Error.h>
41 #include <Common/md5.h>
42 #include <Common/FailureInducer.h>
43 #include <Common/ScopeGuard.h>
44 
45 #include <chrono>
46 #include <ctime>
47 #include <sstream>
48 #include <thread>
49 
50 using namespace Hypertable;
51 using namespace Hyperspace;
52 using namespace std;
53 
55  RangeServerConnectionPtr &rsc, int flags)
56  : Operation(context, MetaLog::EntityType::OPERATION_RECOVER_SERVER),
57  m_location(rsc->location()), m_rsc(rsc), m_restart(flags==RESTART) {
60  m_dependencies.insert(String("RegisterServer ") + m_location);
61  m_exclusivities.insert(m_rsc->location());
63  m_hash_code = md5_hash("OperationRecover") ^ md5_hash(m_rsc->location().c_str());
64  HT_ASSERT(m_rsc != 0);
65 }
66 
68  const MetaLog::EntityHeader &header_)
69  : Operation(context, header_) {
70 }
71 
72 
74  vector<MetaLog::EntityPtr> removable_move_ops;
75  int state = get_state();
76  String subject, message;
77 
78  HT_INFOF("Entering RecoverServer %s state=%s this=%p",
79  m_location.c_str(), OperationState::get_text(state), (void *)this);
80  if (!m_rsc)
81  (void)m_context->rsc_manager->find_server_by_location(m_location, m_rsc);
82  else
83  HT_ASSERT(m_location == m_rsc->location());
84 
85  if (m_hostname.empty() && m_rsc)
86  m_hostname = m_rsc->hostname();
87 
88  switch (state) {
89 
91  // Prevent any RegisterServer operations for this server from running while
92  // recovery is in progress
93  {
94  lock_guard<mutex> lock(m_mutex);
95  String register_server_label = String("RegisterServer ") + m_location;
96  m_dependencies.erase(register_server_label);
97  m_exclusivities.insert(register_server_label);
98  m_state = OperationState::STARTED;
99  }
100  break;
101 
103 
104  if (!acquire_server_lock()) {
105  if (m_rsc)
106  m_rsc->set_recovering(false);
107  m_expiration_time = ClockT::now(); // force it to get removed immediately
108  complete_ok();
109  return;
110  }
111 
112  // This shouldn't be necessary, however we've seen Hyperspace declare a
113  // server to be dead when it was in fact still alive (see issue 1346).
114  // We'll leave this in place until Hyperspace gets overhauled.
115  {
116  CommAddress addr;
117  addr.set_proxy(m_location);
119  }
120 
121  if (m_rsc) {
122 
123  m_rsc->set_recovering(true);
124 
125  m_context->rsc_manager->disconnect_server(m_rsc);
126 
127  // Remove by public address
128  CommAddress comm_addr(m_rsc->public_addr());
129  m_context->conn_manager->remove(comm_addr);
130 
131  // Remove by location
132  comm_addr.set_proxy(m_rsc->location());
133  m_context->conn_manager->remove(comm_addr);
134  }
135 
136  m_context->remove_available_server(m_location);
137 
138  // Remove proxy from AsyncComm
139  m_context->comm->remove_proxy(m_location);
140 
141  // Send notification
142  subject = format("NOTICE: Recovery of %s (%s) starting",
143  m_location.c_str(), m_hostname.c_str());
144  message = format("Failure of range server %s (%s) has been detected. "
145  "Starting recovery...", m_location.c_str(),
146  m_hostname.c_str());
147  HT_INFOF("%s", message.c_str());
148  m_context->notification_hook(subject, message);
149 
150  // read rsml figure out what types of ranges lived on this server
151  // and populate the various vectors of ranges
152  try {
153  read_rsml(removable_move_ops);
154  }
155  catch (Exception &e) {
156  subject = format("ERROR: Recovery of %s (%s)",
157  m_location.c_str(), m_hostname.c_str());
158  message = format("Problem reading RSML - %s - %s",
159  Error::get_text(e.code()), e.what());
160  time_t last_notification = 0;
161  while (true) {
162  time_t now = time(0);
163  int32_t notify_interval =
164  m_context->props->get_i32("Hypertable.Master.NotificationInterval");
165  if (last_notification + notify_interval <= now) {
166  m_context->notification_hook(subject, message);
167  last_notification = time(0);
168  }
169  HT_ERRORF("%s", message.c_str());
170  this_thread::sleep_for(chrono::milliseconds(30000));
171  }
172  }
173 
174  // now create a new recovery plan
176 
178 
179  HT_MAYBE_FAIL("recover-server-1");
180  record_state(removable_move_ops);
181  HT_MAYBE_FAIL("recover-server-2");
182  break;
183 
185  if (m_root_specs.size()) {
186  HT_INFOF("Number of root ranges to recover for location %s = %u",
187  m_location.c_str(), (unsigned)m_root_specs.size());
188  stage_subop(make_shared<OperationRecoverRanges>(m_context, m_location,
189  RangeSpec::ROOT));
190  }
191  if (m_metadata_specs.size()) {
192  HT_INFOF("Number of metadata ranges to recover for location %s = %u",
193  m_location.c_str(), (unsigned)m_metadata_specs.size());
194  stage_subop(make_shared<OperationRecoverRanges>(m_context, m_location,
196  }
197  if (m_system_specs.size()) {
198  HT_INFOF("Number of system ranges to recover for location %s = %d",
199  m_location.c_str(), (int)m_system_specs.size());
200  stage_subop(make_shared<OperationRecoverRanges>(m_context, m_location,
202  }
203  if (m_user_specs.size()) {
204  HT_INFOF("Number of user ranges to recover for location %s = %d",
205  m_location.c_str(), (int)m_user_specs.size());
206  stage_subop(make_shared<OperationRecoverRanges>(m_context, m_location,
207  RangeSpec::USER));
208  }
210  record_state();
211  HT_MAYBE_FAIL("recover-server-3");
212  break;
213 
215 
216  if (!validate_subops())
217  break;
218 
219  // Once recovery is complete, the master blows away the RSML and CL for the
220  // server being recovered then it unlocks the hyperspace file
222 
223  HT_MAYBE_FAIL("recover-server-4");
224 
225  m_expiration_time = ClockT::now(); // force it to get removed immediately
226 
227  if (m_rsc) {
228  std::vector<MetaLog::EntityPtr> additional;
229  m_rsc->mark_for_removal();
230  additional.push_back(m_rsc);
231  complete_ok(additional);
232  }
233  else
234  complete_ok();
235 
236  // Send notification
237  subject = format("NOTICE: Recovery of %s (%s) succeeded",
238  m_location.c_str(), m_hostname.c_str());
239  message = format("Recovery of range server %s (%s) has succeeded.",
240  m_location.c_str(), m_hostname.c_str());
241  m_context->notification_hook(subject, message);
242  break;
243 
244  default:
245  HT_FATALF("Unrecognized state %d", state);
246  break;
247  }
248 
249  HT_INFOF("Leaving RecoverServer %s state=%s this=%p",
251  (void *)this);
252 }
253 
255 }
256 
257 
259  String subject, message;
260 
261  if (m_lock_acquired)
262  return true;
263 
264  try {
265  String fname = m_context->toplevel_dir + "/servers/" + m_location;
266  uint32_t oflags = OPEN_FLAG_READ | OPEN_FLAG_WRITE | OPEN_FLAG_LOCK;
267  LockStatus lock_status = LOCK_STATUS_BUSY;
268  LockSequencer sequencer;
269  uint64_t handle = 0;
270 
272 
273  handle = m_context->hyperspace->open(fname, oflags);
274 
275  m_context->hyperspace->try_lock(handle,
276  LOCK_MODE_EXCLUSIVE, &lock_status,
277  &sequencer);
278  if (lock_status != LOCK_STATUS_GRANTED) {
279  HT_INFOF("Couldn't obtain lock on '%s' due to conflict, lock_status=0x%x",
280  fname.c_str(), lock_status);
281  if (!m_restart) {
282  // Send notification
283  subject = format("NOTICE: Recovery of %s (%s) aborted",
284  m_location.c_str(), m_hostname.c_str());
285  message = format("Aborting recovery of range server %s (%s) because "
286  "unable to aquire lock.", m_location.c_str(),
287  m_hostname.c_str());
288  HT_INFOF("%s", message.c_str());
289  m_context->notification_hook(subject, message);
290  }
291  else
292  m_restart = false;
293  return false;
294  }
295 
296  m_context->hyperspace->attr_set(handle, "removed", "", 0);
297 
298  m_hyperspace_handle = handle;
299  handle = 0;
300  m_lock_acquired = true;
301 
302  HT_INFOF("Acquired lock on '%s', starting recovery...", fname.c_str());
303  }
304  catch (Exception &e) {
305  HT_ERROR_OUT << "Problem obtaining " << m_location
306  << " hyperspace lock (" << e << "), aborting..." << HT_END;
307  return false;
308  }
309  return true;
310 }
311 
312 void OperationRecover::display_state(std::ostream &os) {
313  os << " location=" << m_location << " ";
314 }
315 
317  return label();
318 }
319 
321  return format("OperationRecover %s", m_location.c_str());
322 }
323 
325 
326  // if m_rsc is NULL then it was already removed
327  if (m_rsc)
328  m_context->monitoring->drop_server(m_rsc->location());
329 
330  // unlock hyperspace file
332  // delete balance plan
333  BalancePlanAuthority *plan = m_context->get_balance_plan_authority();
335 }
336 
338  BalancePlanAuthority *plan = m_context->get_balance_plan_authority();
344 }
345 
346  void OperationRecover::read_rsml(vector<MetaLog::EntityPtr> &removable_move_ops) {
347  // move rsml and commit log to some recovered dir
348  MetaLog::DefinitionPtr rsml_definition
349  = make_shared<MetaLog::DefinitionRangeServer>(m_location.c_str());
350  MetaLogEntityRange *range;
352  vector<MetaLog::EntityPtr> entities;
353  StringSet missing_tables, valid_tables;
354  String tablename;
355  String logfile = m_context->toplevel_dir + "/servers/" + m_location + "/log/"
356  + rsml_definition->name();
357  MetaLog::ReaderPtr rsml_reader =
358  make_shared<MetaLog::Reader>(m_context->dfs, rsml_definition, logfile);
359 
360  rsml_reader->get_entities(entities);
361 
362  try {
363  for (auto &entity : entities) {
364  if ((range = dynamic_cast<MetaLogEntityRange *>(entity.get())) != 0) {
365  QualifiedRangeSpec spec;
366  RangeStateManaged range_state;
367  RangeSpecManaged range_spec;
368  std::stringstream sout;
369 
370  // skip phantom ranges, let whoever was recovering them deal with them
371  if (range->get_state() & RangeState::PHANTOM) {
372  sout << "Skipping PHANTOM range " << *range;
373  HT_INFOF("%s", sout.str().c_str());
374  }
375  else {
376  TableIdentifier table;
377 
378  // Check for missing table
379  range->get_table_identifier(table);
380  if (!table.is_system() && valid_tables.count(table.id) == 0) {
381  if (missing_tables.count(table.id) == 0) {
382  if (!m_context->namemap->id_to_name(table.id, tablename))
383  missing_tables.insert(table.id);
384  else
385  valid_tables.insert(table.id);
386  }
387  if (missing_tables.count(table.id) != 0) {
388  sout << "Range " << *range << ": table does not exist, skipping ...";
389  HT_WARNF("%s", sout.str().c_str());
390  continue;
391  }
392  }
393 
394  sout << "Range " << *range << ": not PHANTOM; including";
395  HT_INFOF("%s", sout.str().c_str());
396 
397  if (range->get_state() == RangeState::SPLIT_SHRUNK)
398  handle_split_shrunk(range, removable_move_ops);
399 
400  range->get_table_identifier(spec.table);
401  range->get_range_spec(range_spec);
402  range->get_range_state(range_state);
403 
404  spec.range = range_spec;
405 
406  if (spec.is_root()) {
407  m_root_specs.push_back(QualifiedRangeSpec(m_arena, spec));
408  m_root_states.push_back(RangeState(m_arena, range_state));
409  }
410  else if (spec.table.is_metadata()) {
411  m_metadata_specs.push_back(QualifiedRangeSpec(m_arena, spec));
412  m_metadata_states.push_back(RangeState(m_arena, range_state));
413  }
414  else if (spec.table.is_system()) {
415  m_system_specs.push_back(QualifiedRangeSpec(m_arena, spec));
416  m_system_states.push_back(RangeState(m_arena, range_state));
417  }
418  else {
419  m_user_specs.push_back(QualifiedRangeSpec(m_arena, spec));
420  m_user_states.push_back(RangeState(m_arena, range_state));
421  }
422  }
423  }
424  else if ((ack_task = dynamic_cast<MetaLog::EntityTaskAcknowledgeRelinquish *>(entity.get())) != 0) {
425  OperationPtr operation =
426  make_shared<OperationRelinquishAcknowledge>(m_context,
427  ack_task->location,
428  ack_task->range_id,
429  ack_task->table,
430  ack_task->range_spec);
431  operation->execute();
432  }
433  }
434  }
435  catch (Exception &e) {
436  HT_FATAL_OUT << e << HT_END;
437  }
438 }
439 
440 
442  vector<MetaLog::EntityPtr> &removable_move_ops) {
443  String start_row, end_row;
444  String split_row = range_entity->get_split_row();
445  String old_boundary_row = range_entity->get_old_boundary_row();
446  bool split_off_high = split_row.compare(old_boundary_row) < 0;
447 
448  TableIdentifier table;
449  RangeSpecManaged range;
450 
451  range_entity->get_table_identifier(table);
452  range_entity->get_boundary_rows(start_row, end_row);
453 
454  if (split_off_high) {
455  range.set_start_row(end_row);
456  range.set_end_row(old_boundary_row);
457  }
458  else {
459  range.set_start_row(old_boundary_row);
460  range.set_end_row(start_row);
461  }
462 
463  int64_t hash_code
464  = OperationMoveRange::hash_code(table, range, range_entity->get_source(),
465  range_entity->id());
466 
467  OperationPtr operation = m_context->get_move_operation(hash_code);
468  if (operation) {
469  if (operation->remove_approval_add(0x01)) {
470  m_context->remove_move_operation(operation);
471  removable_move_ops.push_back(operation);
472  }
473  int64_t soft_limit = range_entity->get_soft_limit();
474  range_entity->clear_state();
475  range_entity->set_soft_limit(soft_limit);
476  }
477 
478 }
479 
481  return 1;
482 }
483 
486  for (size_t i=0; i<m_root_specs.size(); i++)
487  len += m_root_specs[i].encoded_length() + m_root_states[i].encoded_length();
488  for (size_t i=0; i<m_metadata_specs.size(); i++)
489  len += m_metadata_specs[i].encoded_length() + m_metadata_states[i].encoded_length();
490  for (size_t i=0; i<m_system_specs.size(); i++)
491  len += m_system_specs[i].encoded_length() + m_system_states[i].encoded_length();
492  for (size_t i=0; i<m_user_specs.size(); i++)
493  len += m_user_specs[i].encoded_length() + m_user_states[i].encoded_length();
494  return len;
495 }
496 
497 void OperationRecover::encode_state(uint8_t **bufp) const {
499  // root
501  for (size_t i=0; i<m_root_specs.size(); i++) {
502  m_root_specs[i].encode(bufp);
503  m_root_states[i].encode(bufp);
504  }
505  // metadata
507  for (size_t i=0; i<m_metadata_specs.size(); i++) {
508  m_metadata_specs[i].encode(bufp);
509  m_metadata_states[i].encode(bufp);
510  }
511  // system
513  for (size_t i=0; i<m_system_specs.size(); i++) {
514  m_system_specs[i].encode(bufp);
515  m_system_states[i].encode(bufp);
516  }
517  // user
519  for (size_t i=0; i<m_user_specs.size(); i++) {
520  m_user_specs[i].encode(bufp);
521  m_user_states[i].encode(bufp);
522  }
523 }
524 
525 void OperationRecover::decode_state(uint8_t version, const uint8_t **bufp, size_t *remainp) {
526  m_location = Serialization::decode_vstr(bufp, remainp);
527  int nn;
528  QualifiedRangeSpec spec;
529  RangeState state;
530  nn = Serialization::decode_i32(bufp, remainp);
531  for (int ii = 0; ii < nn; ++ii) {
532  spec.decode(bufp, remainp);
533  m_root_specs.push_back(QualifiedRangeSpec(m_arena, spec));
534  state.decode(bufp, remainp);
535  m_root_states.push_back(RangeState(m_arena, state));
536  }
537  nn = Serialization::decode_i32(bufp, remainp);
538  for (int ii = 0; ii < nn; ++ii) {
539  spec.decode(bufp, remainp);
540  m_metadata_specs.push_back(QualifiedRangeSpec(m_arena, spec));
541  state.decode(bufp, remainp);
542  m_metadata_states.push_back(RangeState(m_arena, state));
543  }
544  nn = Serialization::decode_i32(bufp, remainp);
545  for (int ii = 0; ii < nn; ++ii) {
546  spec.decode(bufp, remainp);
547  m_system_specs.push_back(QualifiedRangeSpec(m_arena, spec));
548  state.decode(bufp, remainp);
549  m_system_states.push_back(RangeState(m_arena, state));
550  }
551  nn = Serialization::decode_i32(bufp, remainp);
552  for (int ii = 0; ii < nn; ++ii) {
553  spec.decode(bufp, remainp);
554  m_user_specs.push_back(QualifiedRangeSpec(m_arena, spec));
555  state.decode(bufp, remainp);
556  m_user_states.push_back(RangeState(m_arena, state));
557  }
558 }
559 
560 void OperationRecover::decode_state_old(uint8_t version, const uint8_t **bufp, size_t *remainp) {
561  if (version == 0)
562  Serialization::decode_i16(bufp, remainp); // skip old version
563  m_location = Serialization::decode_vstr(bufp, remainp);
564  int nn;
565  QualifiedRangeSpec spec;
566  RangeState state;
567  nn = Serialization::decode_i32(bufp, remainp);
568  for (int ii = 0; ii < nn; ++ii) {
569  legacy_decode(bufp, remainp, &spec);
570  m_root_specs.push_back(QualifiedRangeSpec(m_arena, spec));
571  legacy_decode(bufp, remainp, &state);
572  m_root_states.push_back(RangeState(m_arena, state));
573  }
574  nn = Serialization::decode_i32(bufp, remainp);
575  for (int ii = 0; ii < nn; ++ii) {
576  legacy_decode(bufp, remainp, &spec);
577  m_metadata_specs.push_back(QualifiedRangeSpec(m_arena, spec));
578  legacy_decode(bufp, remainp, &state);
579  m_metadata_states.push_back(RangeState(m_arena, state));
580  }
581  nn = Serialization::decode_i32(bufp, remainp);
582  for (int ii = 0; ii < nn; ++ii) {
583  legacy_decode(bufp, remainp, &spec);
584  m_system_specs.push_back(QualifiedRangeSpec(m_arena, spec));
585  legacy_decode(bufp, remainp, &state);
586  m_system_states.push_back(RangeState(m_arena, state));
587  }
588  nn = Serialization::decode_i32(bufp, remainp);
589  for (int ii = 0; ii < nn; ++ii) {
590  legacy_decode(bufp, remainp, &spec);
591  m_user_specs.push_back(QualifiedRangeSpec(m_arena, spec));
592  legacy_decode(bufp, remainp, &state);
593  m_user_states.push_back(RangeState(m_arena, state));
594  }
595 }
void get_table_identifier(TableIdentifier &table)
Copies table identifier.
std::set< String > StringSet
STL Set managing Strings.
Definition: StringExt.h:42
char * decode_vstr(const uint8_t **bufp, size_t *remainp)
Decode a vstr (vint64, data, null).
void decode_state_old(uint8_t version, const uint8_t **bufp, size_t *remainp) override
Lock successfully granted.
Definition: LockSequencer.h:58
void set_soft_limit(uint64_t soft_limit)
Sets soft limit.
Declarations for MetaLog::Reader.
#define HT_WARNF(msg,...)
Definition: Logger.h:290
The FailureInducer simulates errors.
vector< RangeState > m_system_states
ContextPtr m_context
Pointer to Master context.
Definition: Operation.h:553
int64_t md5_hash(const char *input)
Returns a 64-bit hash checksum of a null terminated input buffer.
Definition: md5.cc:388
std::shared_ptr< RangeServerConnection > RangeServerConnectionPtr
std::string String
A String is simply a typedef to std::string.
Definition: String.h:44
Declarations for MetaLogEntityRange.
String format(const char *fmt,...)
Returns a String using printf like format facilities Vanilla snprintf is about 1.5x faster than this...
Definition: String.cc:37
bool validate_subops()
Handles the results of sub operations.
Definition: Operation.cc:512
virtual size_t encoded_length() const
Returns serialized object length.
Definition: Serializable.cc:37
String get_source()
Gets source server.
String get_old_boundary_row()
Gets old boundary row.
vector< RangeState > m_user_states
Exclusive lock attempt failed because another has it locked.
Definition: LockSequencer.h:60
std::mutex m_mutex
Mutex for serializing access to members
LockStatus
Lock status.
Definition: LockSequencer.h:56
STL namespace.
virtual int64_t hash_code() const
Definition: Operation.h:455
size_t encoded_length_vstr(size_t len)
Computes the encoded length of vstr (vint64, data, null)
#define HT_ON_SCOPE_EXIT(...)
Definition: ScopeGuard.h:301
const char * get_text(int32_t state)
Definition: Operation.cc:609
const char * RECOVER_SERVER
Definition: Operation.cc:51
uint32_t decode_i32(const uint8_t **bufp, size_t *remainp)
Decode a 32-bit integer in little-endian order.
Declarations for ReferenceManager.
int64_t m_hash_code
Hash code uniqely identifying operation.
Definition: Operation.h:589
std::shared_ptr< Context > ContextPtr
Smart pointer to Context.
Definition: Context.h:265
Hyperspace definitions
#define HT_ASSERT(_e_)
Definition: Logger.h:396
void set_start_row(const std::string &s)
Definition: RangeSpec.h:112
Open file for locking.
Definition: Session.h:75
vector< QualifiedRangeSpec > m_root_specs
void remove_recovery_plan(const String &location)
Removes a recovery plan for a failed range server.
void read_rsml(std::vector< MetaLog::EntityPtr > &removable_move_ops)
const String name() override
Name of operation used for exclusivity.
static time_point now() noexcept
Definition: fast_clock.cc:37
MetaLog entity for range state persisted in RSML.
Open file for writing.
Definition: Session.h:73
const String label() override
Human readable label for operation.
void set_state(int32_t state)
Definition: Operation.h:473
const char * get_text(int error)
Returns a descriptive error message.
Definition: Error.cc:330
void display_state(std::ostream &os) override
Write human readable operation state to output stream.
uint16_t decode_i16(const uint8_t **bufp, size_t *remainp)
Decode a 16-bit integer in little-endian order.
RangeServerConnectionPtr m_rsc
void get_boundary_rows(String &start, String &end)
Gets boundary rows (start and end rows)
void set_proxy(const String &str)
Sets address type to CommAddress::PROXY and proxy name to p.
Definition: CommAddress.h:76
void decode_state(uint8_t version, const uint8_t **bufp, size_t *remainp) override
Decode operation state.
void encode_i32(uint8_t **bufp, uint32_t val)
Encode a 32-bit integer in little-endian order.
void handle_split_shrunk(MetaLogEntityRange *range_entity, std::vector< MetaLog::EntityPtr > &removable_move_ops)
void close_handle_ptr(SessionPtr hyperspace, uint64_t *handlep)
Definition: Session.cc:1400
Compatibility Macros for C/C++.
void stage_subop(std::shared_ptr< Operation > operation)
Stages a sub operation for execution.
Definition: Operation.cc:536
void execute() override
Executes (carries out) the operation.
#define HT_END
Definition: Logger.h:220
uint64_t get_soft_limit()
Gets soft limit.
void record_state()
Records operation state to the MML.
Definition: Operation.h:401
vector< RangeState > m_root_states
OperationRecover(ContextPtr &context, RangeServerConnectionPtr &rsc, int flags=0)
Constructor.
#define HT_ERROR_OUT
Definition: Logger.h:301
virtual void decode(const uint8_t **bufp, size_t *remainp)
Reads serialized representation of object from a buffer.
Definition: Serializable.cc:70
vector< QualifiedRangeSpec > m_system_specs
const char * RECOVERY_BLOCKER
Definition: Operation.cc:52
void lock()
Locks the entity's mutex.
Definition: MetaLogEntity.h:97
void encode_vstr(uint8_t **bufp, const void *buf, size_t len)
Encode a buffer as variable length string (vint64, data, null)
Hypertable definitions
Lock exclusive mode.
Definition: LockSequencer.h:51
#define HT_FATALF(msg,...)
Definition: Logger.h:343
uint8_t encoding_version_state() const override
Returns version of encoding format of state.
std::shared_ptr< Reader > ReaderPtr
Smart pointer to Reader.
DependencySet m_obstructions
Set of obstructions.
Definition: Operation.h:598
vector< RangeState > m_metadata_states
Declarations for general-purpose utility functions.
void create_recovery_plan(const String &location, const vector< QualifiedRangeSpec > &root_specs, const vector< RangeState > &root_states, const vector< QualifiedRangeSpec > &metadata_specs, const vector< RangeState > &metadata_states, const vector< QualifiedRangeSpec > &system_specs, const vector< RangeState > &system_states, const vector< QualifiedRangeSpec > &user_specs, const vector< RangeState > &user_states)
Creates a recovery plan for a failed range server.
void legacy_decode(const uint8_t **bufp, size_t *remainp, BalancePlan *plan)
Central authority for balance plans.
int64_t id() const
Returns the entity ID.
vector< QualifiedRangeSpec > m_metadata_specs
Split - range shrunk.
Definition: RangeState.h:55
DependencySet m_dependencies
Set of dependencies.
Definition: Operation.h:595
#define HT_INFOF(msg,...)
Definition: Logger.h:272
Abstract base class for master operations.
Definition: Operation.h:124
const char * RECOVERY
Definition: Operation.cc:53
This is a generic exception class for Hypertable.
Definition: Error.h:314
Qualified (with table identifier) range specification.
#define HT_ERRORF(msg,...)
Definition: Logger.h:300
String get_split_row()
Gets split row.
void shutdown_rangeserver(ContextPtr &context, CommAddress &addr)
Sends a shutdown command to a rangeserver.
Definition: Utility.cc:447
DependencySet m_exclusivities
Set of exclusivities.
Definition: Operation.h:592
void set_end_row(const std::string &e)
Definition: RangeSpec.h:116
Range state.
Definition: RangeState.h:48
vector< QualifiedRangeSpec > m_user_specs
#define HT_MAYBE_FAIL(_label_)
void complete_ok(std::vector< MetaLog::EntityPtr > &additional)
Definition: Operation.cc:436
Declarations for BalancePlanAuthority.
void clear_state()
Clears range state object.
Open file for reading.
Definition: Session.h:71
std::shared_ptr< Operation > OperationPtr
Smart pointer to Operation.
Definition: Operation.h:609
Error codes, Exception handling, error logging.
md5 digest routines.
Wrapper for RangeSpec providing member storage.
Definition: RangeSpec.h:89
#define HT_FATAL_OUT
Definition: Logger.h:347
Address abstraction to hold either proxy name or IPv4:port address.
Definition: CommAddress.h:52
Range state with memory management.
Definition: RangeState.h:166
size_t encoded_length_state() const override
Encoded length of operation state.
std::shared_ptr< Definition > DefinitionPtr
Smart pointer to Definition.
void encode_state(uint8_t **bufp) const override
Encode operation state.
int code() const
Returns the error code.
Definition: Error.h:391
ClockT::time_point m_expiration_time
Expiration time (used by ResponseManager)
Definition: Operation.h:586
Executes user-defined functions when leaving the current scope.