0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
OperationRecoverRanges.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 "BalancePlanAuthority.h"
25 #include "OperationMoveRange.h"
26 #include "OperationRecoverRanges.h"
28 #include "OperationProcessor.h"
29 #include "Utility.h"
30 
33 
34 #include <Common/Error.h>
35 #include <Common/md5.h>
37 #include <Common/FailureInducer.h>
38 
39 #include <algorithm>
40 #include <chrono>
41 #include <iostream>
42 #include <set>
43 #include <thread>
44 
45 using namespace Hypertable;
46 using namespace std;
47 
49  const String &location, int type)
50  : Operation(context, MetaLog::EntityType::OPERATION_RECOVER_SERVER_RANGES),
51  m_location(location), m_type(type) {
53  set_type_str();
55 }
56 
58  const MetaLog::EntityHeader &header_)
59  : Operation(context, header_), m_plan_generation(0), m_last_notification(0) {
60 }
61 
63  int state = get_state();
64 
65  HT_INFOF("Entering RecoverServerRanges (%p) %s type=%d plan_generation=%d state=%s",
66  (void *)this, m_location.c_str(), m_type, m_plan_generation,
68 
69  if (!m_context->recovery_state().get_replay_future(id())) {
70  m_timeout = m_context->props->get_i32("Hypertable.Failover.Timeout");
71  set_type_str();
73  return;
75  }
76 
77  switch (state) {
79 
81  return;
82 
83  // if there are no ranges then there is nothing to do
84  if (m_plan.receiver_plan.empty()) {
85  HT_INFOF("Plan for location %s, type %s is empty, nothing to do",
86  m_location.c_str(), m_type_str.c_str());
87  m_expiration_time = ClockT::now(); // force it to get removed immediately
88  complete_ok();
89  break;
90  }
91 
92  HT_MAYBE_FAIL(format("recover-server-ranges-%s-initial-1", m_type_str.c_str()));
94  m_context->mml_writer->record_state(shared_from_this());
95  HT_MAYBE_FAIL(format("recover-server-ranges-%s-initial-2", m_type_str.c_str()));
96 
97  // fall through
98 
100 
101  if (!wait_for_quorum())
102  break;
103 
106  m_context->mml_writer->record_state(shared_from_this());
107  break;
108  }
109 
110  try {
111  if (!phantom_load_ranges()) {
112  // repeat phantom load
113  HT_MAYBE_FAIL(format("recover-server-ranges-%s-load-2",
114  m_type_str.c_str()));
115  break;
116  }
117  }
118  catch (Exception &e) {
119  HT_ERROR_OUT << e << HT_END;
120  HT_THROW(e.code(), e.what());
121  }
122  HT_MAYBE_FAIL(format("recover-server-ranges-%s-load-3", m_type_str.c_str()));
124  m_context->mml_writer->record_state(shared_from_this());
125 
126  // fall through to replay fragments
127 
129 
130  if (!wait_for_quorum())
131  break;
132 
135  break;
136  }
137 
138  try {
139  if (!replay_fragments()) {
140  HT_MAYBE_FAIL(format("recover-server-ranges-%s-replay-2", m_type_str.c_str()));
141  break;
142  }
143  }
144  catch (Exception &e) {
145  HT_ERROR_OUT << e << HT_END;
146  HT_THROW(e.code(), e.what());
147  }
148  HT_MAYBE_FAIL(format("recover-server-ranges-%s-replay-3", m_type_str.c_str()));
150  m_context->mml_writer->record_state(shared_from_this());
151 
152  // fall through to prepare
153 
155 
156  if (!wait_for_quorum())
157  break;
158 
161  break;
162  }
163 
164  try {
165  // tell destination servers to merge fragment data into range,
166  // link in transfer logs to commit log
167  if (!prepare_to_commit()) {
168  HT_MAYBE_FAIL(format("recover-server-ranges-%s-prepare-2", m_type_str.c_str()));
169  break;
170  }
171  }
172  catch (Exception &e) {
173  HT_ERROR_OUT << e << HT_END;
174  HT_THROW(e.code(), e.what());
175  }
176  HT_MAYBE_FAIL(format("recover-server-ranges-%s-prepare-3", m_type_str.c_str()));
178  m_context->mml_writer->record_state(shared_from_this());
179 
180  // fall through to commit
181 
183 
184  if (!wait_for_quorum())
185  break;
186 
187  if (!commit()) {
188  // repeat commit
189  HT_MAYBE_FAIL(format("recover-server-ranges-%s-commit-2", m_type_str.c_str()));
190  break;
191  }
192  HT_MAYBE_FAIL(format("recover-server-ranges-%s-commit-3", m_type_str.c_str()));
194  m_context->mml_writer->record_state(shared_from_this());
195 
196  // fall through
197 
199 
200  if (!wait_for_quorum())
201  break;
202 
203  if (!acknowledge()) {
204  // wait a few seconds and then try again
205  this_thread::sleep_for(chrono::milliseconds(5000));
206  HT_MAYBE_FAIL(format("recover-server-ranges-%s-12", m_type_str.c_str()));
207  break;
208  }
209  HT_MAYBE_FAIL(format("recover-server-ranges-%s-ack-3", m_type_str.c_str()));
210 
211  if (recovery_plan_has_changed() || !m_redo_set.empty()) {
212  m_redo_set.clear();
214  break;
215  }
216 
217  HT_ASSERT(m_context->get_balance_plan_authority()->recovery_complete(m_location, m_type));
218 
219  m_expiration_time = ClockT::now(); // force it to get removed immediately
220  complete_ok();
221  break;
222 
223  default:
224  HT_FATALF("Unrecognized state %d", state);
225  break;
226  }
227 
228  HT_INFOF("Leaving RecoverServerRanges %s plan_generation=%d type=%d state=%s",
231 }
232 
234  os << " location=" << m_location << " plan_generation=" << m_plan_generation
235  << " type=" << m_type << " num_ranges=" << m_plan.receiver_plan.size()
236  << " recovery_plan type=" << m_type_str
237  << " state=" << OperationState::get_text(get_state());
238 }
239 
241  return "OperationRecoverRanges";
242 }
243 
245  return format("RecoverServerRanges %s type=%s",
246  m_location.c_str(), m_type_str.c_str());
247 }
248 
250  lock_guard<mutex> lock(m_mutex);
251  m_dependencies.clear();
252  m_obstructions.clear();
254  switch (m_type) {
255  case RangeSpec::ROOT:
257  break;
258  case RangeSpec::METADATA:
261  break;
262  case RangeSpec::SYSTEM:
266  break;
267  case RangeSpec::USER:
268  if (m_context->props->get_bool("Hypertable.Failover.RecoverInSeries"))
270  m_obstructions.insert(format("%s-user", m_location.c_str()));
274  break;
275  }
276 
277  vector<QualifiedRangeSpec> specs;
279  for (auto &spec : specs)
280  m_dependencies.insert(format("OperationMove %s[%s..%s]",
281  spec.table.id, spec.range.start_row,
282  spec.range.end_row));
283 }
284 
286  return 1;
287 }
288 
291  + 4 + 4 + m_plan.encoded_length();
292 }
293 
294 void OperationRecoverRanges::encode_state(uint8_t **bufp) const {
298  m_plan.encode(bufp);
299 }
300 
301 void OperationRecoverRanges::decode_state(uint8_t version, const uint8_t **bufp,
302  size_t *remainp) {
303  m_location = Serialization::decode_vstr(bufp, remainp);
304  m_type = Serialization::decode_i32(bufp, remainp);
305  set_type_str();
307  m_plan.decode(bufp, remainp);
308 }
309 
310 void OperationRecoverRanges::decode_state_old(uint8_t version, const uint8_t **bufp,
311  size_t *remainp) {
312  if (version == 0)
313  Serialization::decode_i16(bufp, remainp); // skip old version
314  m_location = Serialization::decode_vstr(bufp, remainp);
315  if (version < 2) {
316  string parent_dependency = Serialization::decode_vstr(bufp, remainp);
317  m_obstructions_permanent.insert(parent_dependency);
318  }
319  m_type = Serialization::decode_i32(bufp, remainp);
320  set_type_str();
322  legacy_decode(bufp, remainp, &m_plan);
323 }
324 
325 void OperationRecoverRanges::decode_request(const uint8_t **bufp,
326  size_t *remainp) {
327  HT_ASSERT(!"Not implemented!");
328 }
329 
331  RangeServer::Client rsc(m_context->comm);
332  CommAddress addr;
333  bool success = true;
334  StringSet locations;
336  vector<int32_t> fragments;
337 
338  m_plan.replay_plan.get_fragments(fragments);
339  for (const auto &location : locations) {
340  addr.set_proxy(location);
341  vector<QualifiedRangeSpec> specs;
342  vector<RangeState> states;
343  m_plan.receiver_plan.get_range_specs_and_states(location, specs, states);
344  try {
345  HT_INFOF("Calling phantom_load(plan_generation=%d, location=%s) for %d %s ranges",
346  m_plan_generation, location.c_str(), (int)specs.size(), m_type_str.c_str());
347  rsc.phantom_load(addr, m_location, m_plan_generation, fragments, specs, states);
348  HT_MAYBE_FAIL(format("recover-server-ranges-%s-phantom-load-ranges",
349  m_type_str.c_str()));
350  }
351  catch (Exception &e) {
352  success = false;
353  HT_ERROR_OUT << e << HT_END;
354  break;
355  }
356  }
357  if (!success)
358  HT_ERROR_OUT << "Failed to issue phantom_load calls" << HT_END;
359 
360  return success;
361 }
362 
365  return m_plan_generation !=
366  m_context->get_balance_plan_authority()->get_generation();
367 }
368 
371 
372  return (m_plan_generation
373  == m_context->get_balance_plan_authority()->get_generation());
374 }
375 
377  size_t available_servers = m_context->available_server_count();
378  size_t total_servers = m_context->rsc_manager->server_count();
379  size_t failover_pct =
380  m_context->props->get_i32("Hypertable.Failover.Quorum.Percentage");
381  size_t quorum = ((total_servers * failover_pct) + 99) / 100;
382 
383  if (available_servers < quorum || available_servers == 0) {
384  // wait for at least half the servers to be up before proceeding
385  // Send notification
386  String subject, message;
387  subject = format("ERROR: Recovery of %s suspended", m_location.c_str());
388  message = format("Recovery of range server %s has been suspended because\\n"
389  "only %d out of %d servers are available. Required\\n"
390  "quorum is %d.\\n", m_location.c_str(),
391  (int)available_servers, (int)total_servers,
392  (int)quorum);
393  m_context->notification_hook(subject, message);
394  HT_WARN_OUT << message << HT_END;
396  return false;
397  }
398  return true;
399 }
400 
402  RecoveryStepFuturePtr future;
403 
404  // Install "replay" future
405  future = make_shared<RecoveryStepFuture>("replay", m_plan_generation);
406  m_context->recovery_state().install_replay_future(id(), future);
407 
408  // Install "prepare" future
409  future = make_shared<RecoveryStepFuture>("prepare", m_plan_generation);
410  m_context->recovery_state().install_prepare_future(id(), future);
411 
412  // Install "commit" future
413  future = make_shared<RecoveryStepFuture>("commit", m_plan_generation);
414  m_context->recovery_state().install_commit_future(id(), future);
415 }
416 
418  int initial_generation = m_plan_generation;
419 
420  m_context->get_balance_plan_authority()->copy_recovery_plan(m_location,
422 
423  if (initial_generation != m_plan_generation) {
424  HT_INFOF("Retrieved new balance plan for %s (type=%s, generation=%d) range count %d",
425  m_location.c_str(), m_type_str.c_str(), m_plan_generation,
426  (int)m_plan.receiver_plan.size());
427  create_futures();
429  m_context->mml_writer->record_state(shared_from_this());
430  return true;
431  }
432  return false;
433 }
434 
436  switch (m_type) {
437  case RangeSpec::ROOT:
438  m_type_str = "root";
439  break;
440  case RangeSpec::METADATA:
441  m_type_str = "metadata";
442  break;
443  case RangeSpec::SYSTEM:
444  m_type_str = "system";
445  break;
446  case RangeSpec::USER:
447  m_type_str = "user";
448  break;
449  default:
450  m_type_str = "UNKNOWN";
451  }
452 }
453 
455  RangeServer::Client rsc(m_context->comm);
456  CommAddress addr;
457  StringSet locations;
458  vector<int32_t> fragments;
459 
460  RecoveryStepFuturePtr future =
461  m_context->recovery_state().get_replay_future(id());
462 
463  HT_ASSERT(future);
464 
465  m_plan.replay_plan.get_locations(locations);
466 
467  future->register_locations(locations);
468 
469  for (const auto &location : locations) {
470  try {
471  fragments.clear();
472  m_plan.replay_plan.get_fragments(location, fragments);
473  addr.set_proxy(location);
474  HT_INFOF("Issue replay_fragments for %d fragments to %s (%s)",
475  (int)fragments.size(), location.c_str(), m_type_str.c_str());
477  m_type, fragments, m_plan.receiver_plan, m_timeout);
478  HT_MAYBE_FAIL(format("recover-server-ranges-%s-replay-fragments",
479  m_type_str.c_str()));
480  }
481  catch (Exception &e) {
482  HT_ERROR_OUT << e << HT_END;
483  future->failure(location, m_plan_generation, e.code(), e.what());
484  }
485  }
486 
487  if (!future->wait_for_completion(m_timeout)) {
488  bool range_map_not_found = false;
489  String str;
490  String message =
491  format("Failure encountered during REPLAY FRAGMENTS step of recovery\\n"
492  "of range server %s\\n\\n", m_location.c_str());
494  future->get_error_map(error_map);
495  for (RecoveryStepFuture::ErrorMapT::iterator iter=error_map.begin();
496  iter != error_map.end(); ++iter) {
497  str = String("player ") + iter->first + ": " + Error::get_text(iter->second.first)
498  + " - " + iter->second.second;
499  message += str + "\\n";
500  HT_ERROR_OUT << "replay_fragments failed for " << str << HT_END;
501  if (iter->second.first == Error::RANGESERVER_PHANTOM_RANGE_MAP_NOT_FOUND)
502  range_map_not_found = true;
503  }
504  if (range_map_not_found)
506  else {
507  time_t now = time(0);
508  if (now - m_last_notification > 60) {
509  String subject = format("ERROR: Replay failure during recovery of %s",
510  m_location.c_str());
511  m_context->notification_hook(subject, message);
512  m_last_notification = now;
513  }
514  }
515  return false;
516  }
517 
518  return true;
519 }
520 
522  StringSet locations;
523  RangeServer::Client rsc(m_context->comm);
524  CommAddress addr;
525 
526  RecoveryStepFuturePtr future =
527  m_context->recovery_state().get_prepare_future(id());
528 
529  HT_ASSERT(future);
530 
532 
533  future->register_locations(locations);
534 
535  for (const auto &location : locations) {
536  addr.set_proxy(location);
537  vector<QualifiedRangeSpec> specs;
538  m_plan.receiver_plan.get_range_specs(location, specs);
539 
540  HT_INFOF("Issue phantom_prepare_ranges for %d ranges to %s (%s)",
541  (int)specs.size(), location.c_str(), m_type_str.c_str());
542  try {
544  HT_MAYBE_FAIL(format("recover-server-ranges-%s-phantom-prepare-ranges",
545  m_type_str.c_str()));
546  }
547  catch (Exception &e) {
548  HT_ERROR_OUT << e << HT_END;
549  future->failure(location, m_plan_generation, e.code(), e.what());
550  }
551  }
552 
553  if (!future->wait_for_completion(m_timeout)) {
554  bool range_map_not_found = false;
556  future->get_error_map(error_map);
557  for (RecoveryStepFuture::ErrorMapT::iterator iter=error_map.begin();
558  iter != error_map.end(); ++iter) {
559  HT_ERRORF("phantom commit at %s failed - %s (%s)", iter->first.c_str(),
560  Error::get_text(iter->second.first), iter->second.second.c_str());
561  if (iter->second.first == Error::RANGESERVER_PHANTOM_RANGE_MAP_NOT_FOUND)
562  range_map_not_found = true;
563  }
564  if (range_map_not_found)
566  return false;
567  }
568 
569  return true;
570 }
571 
573  StringSet locations;
574  RangeServer::Client rsc(m_context->comm);
575  CommAddress addr;
576  BalancePlanAuthority *bpa = m_context->get_balance_plan_authority();
577 
578  RecoveryStepFuturePtr future =
579  m_context->recovery_state().get_commit_future(id());
580 
581  HT_ASSERT(future);
582 
584  StringSet existing_locations, new_locations;
585  m_plan.receiver_plan.get_locations(existing_locations);
586  bpa->get_receiver_plan_locations(m_location, m_type, new_locations);
587  std::set_intersection(existing_locations.begin(), existing_locations.end(),
588  new_locations.begin(), new_locations.end(),
589  std::inserter(locations, locations.end()));
590  }
591  else
593 
594  // Erase locations marked for "redo"
595  for (const auto &location : m_redo_set)
596  locations.erase(location);
597 
598  future->register_locations(locations);
599 
600  for (const auto &location : locations) {
601  addr.set_proxy(location);
602  vector<QualifiedRangeSpec> specs;
603  m_plan.receiver_plan.get_range_specs(location, specs);
604 
605  try {
606  HT_INFOF("Issue phantom_commit_ranges for %d ranges to %s",
607  (int)specs.size(), location.c_str());
609  HT_MAYBE_FAIL(format("recover-server-ranges-%s-phantom-commit-ranges",
610  m_type_str.c_str()));
611  }
612  catch (Exception &e) {
613  HT_ERROR_OUT << e << HT_END;
614  future->failure(location, m_plan_generation, e.code(), e.what());
615  }
616  }
617 
618  if (!future->wait_for_completion(m_timeout)) {
619  bool retval = true;
621  future->get_error_map(error_map);
622  for (RecoveryStepFuture::ErrorMapT::iterator iter=error_map.begin();
623  iter != error_map.end(); ++iter) {
624  if (iter->second.first == Error::RANGESERVER_PHANTOM_RANGE_MAP_NOT_FOUND)
625  m_redo_set.insert(iter->first);
626  else
627  retval = false;
628  }
629  HT_INFO("commit failed");
630  return retval;
631  }
632 
633  return true;
634 }
635 
637  StringSet locations;
638  RangeServer::Client rsc(m_context->comm);
639  CommAddress addr;
640  bool success = true;
641  vector<QualifiedRangeSpec> acknowledged;
642  CharArena arena;
643  BalancePlanAuthority *bpa = m_context->get_balance_plan_authority();
644 
646  StringSet existing_locations, new_locations;
647  m_plan.receiver_plan.get_locations(existing_locations);
648  bpa->get_receiver_plan_locations(m_location, m_type, new_locations);
649  std::set_intersection(existing_locations.begin(), existing_locations.end(),
650  new_locations.begin(), new_locations.end(),
651  std::inserter(locations, locations.end()));
652  }
653  else
655 
656  // Erase locations marked for "redo"
657  for (const auto &location : m_redo_set)
658  locations.erase(location);
659 
660  for (const auto &location : locations) {
661  addr.set_proxy(location);
662  vector<QualifiedRangeSpec> specs;
663  vector<QualifiedRangeSpec *> range_ptrs;
664  map<QualifiedRangeSpec, int> response_map;
665  map<QualifiedRangeSpec, int>::iterator response_map_it;
666 
667  m_plan.receiver_plan.get_range_specs(location, specs);
668  for (auto &range : specs)
669  range_ptrs.push_back(&range);
670  try {
671  HT_INFOF("Issue acknowledge_load for %d ranges to %s",
672  (int)range_ptrs.size(), location.c_str());
673  HT_MAYBE_FAIL(format("recover-server-ranges-%s-14", m_type_str.c_str()));
674  rsc.acknowledge_load(addr, range_ptrs, response_map);
675  HT_MAYBE_FAIL(format("recover-server-ranges-%s-acknowledge-load",
676  m_type_str.c_str()));
677  response_map_it = response_map.begin();
678  while (response_map_it != response_map.end()) {
679  if (response_map_it->second != Error::OK)
680  HT_WARNF("Problem acknowledging load for %s[%s..%s] - %s",
681  response_map_it->first.table.id,
682  response_map_it->first.range.start_row,
683  response_map_it->first.range.end_row,
684  Error::get_text(response_map_it->second));
685  acknowledged.push_back(QualifiedRangeSpec(arena, response_map_it->first));
686  ++response_map_it;
687  }
688  HT_INFOF("acknowledge_load complete for %d ranges to %s",
689  (int)range_ptrs.size(), location.c_str());
690  }
691  catch (Exception &e) {
692  success = false;
693  HT_ERROR_OUT << e << HT_END;
694  }
695  }
696 
697  // Purge successfully acknowledged ranges from recovery plan(s)
698  if (!acknowledged.empty()) {
699  bpa->remove_from_receiver_plan(m_location, m_type, acknowledged);
700  for (const auto &spec : acknowledged)
702  }
703 
704  // at this point all the players have prepared or failed in
705  // creating phantom ranges
706  return success;
707 }
708 
std::set< String > StringSet
STL Set managing Strings.
Definition: StringExt.h:42
void encode_state(uint8_t **bufp) const override
Encode operation state.
char * decode_vstr(const uint8_t **bufp, size_t *remainp)
Decode a vstr (vint64, data, null).
void phantom_prepare_ranges(const CommAddress &addr, int64_t op_id, const String &location, int32_t plan_generation, const vector< QualifiedRangeSpec > &ranges, int32_t timeout)
Issues a "phantom_prepare_ranges" synchronous request.
Definition: Client.cc:771
#define HT_WARNF(msg,...)
Definition: Logger.h:290
void remove_from_receiver_plan(const String &location, int type, const vector< QualifiedRangeSpec > &ranges)
Removes ranges from a failover plan.
The FailureInducer simulates errors.
void execute() override
Executes (carries out) the operation.
ContextPtr m_context
Pointer to Master context.
Definition: Operation.h:553
std::string String
A String is simply a typedef to std::string.
Definition: String.h:44
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
Declarations for CommitLogReader.
virtual size_t encoded_length() const
Returns serialized object length.
Definition: Serializable.cc:37
Declarations for OperationProcessor.
Po::typed_value< String > * str(String *v=0)
Definition: Properties.h:166
void get_fragments(vector< int32_t > &fragments) const
Fills a vector with all of the fragment numbers that are part of this replay plan.
Definition: ReplayPlan.cc:58
std::mutex m_mutex
Mutex for serializing access to members
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.
Definition: Client.cc:163
PageArena memory allocator for STL classes.
void get_range_specs(vector< QualifiedRangeSpec > &specs) const
Definition: ReceiverPlan.cc:80
#define HT_INFO(msg)
Definition: Logger.h:271
STL namespace.
size_t encoded_length_vstr(size_t len)
Computes the encoded length of vstr (vint64, data, null)
std::map< String, std::pair< int32_t, String > > ErrorMapT
const char * get_text(int32_t state)
Definition: Operation.cc:609
void display_state(std::ostream &os) override
Write human readable operation state to output stream.
void decode_state(uint8_t version, const uint8_t **bufp, size_t *remainp) override
Decode operation state.
uint32_t decode_i32(const uint8_t **bufp, size_t *remainp)
Decode a 32-bit integer in little-endian order.
const String label() override
Human readable label for operation.
std::shared_ptr< Context > ContextPtr
Smart pointer to Context.
Definition: Context.h:265
void get_range_specs_and_states(vector< QualifiedRangeSpec > &specs, vector< RangeState > &states) const
Definition: ReceiverPlan.cc:94
#define HT_ASSERT(_e_)
Definition: Logger.h:396
OperationRecoverRanges(ContextPtr &context, const String &location, int type)
ReplayPlan replay_plan
Replay plan.
Definition: Plan.h:70
const String name() override
Name of operation used for exclusivity.
void replay_fragments(const CommAddress &addr, int64_t op_id, const String &recover_location, int32_t plan_generation, int32_t type, const vector< int32_t > &fragments, const Lib::RangeServerRecovery::ReceiverPlan &plan, int32_t replay_timeout)
Issues a synchronous "replay_fragments" request.
Definition: Client.cc:715
std::shared_ptr< RecoveryStepFuture > RecoveryStepFuturePtr
static time_point now() noexcept
Definition: fast_clock.cc:37
void decode_state_old(uint8_t version, const uint8_t **bufp, size_t *remainp) override
const char * USER
Definition: Operation.cc:50
virtual void encode(uint8_t **bufp) const
Writes serialized representation of object to a buffer.
Definition: Serializable.cc:64
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
uint16_t decode_i16(const uint8_t **bufp, size_t *remainp)
Decode a 16-bit integer in little-endian order.
void set_proxy(const String &str)
Sets address type to CommAddress::PROXY and proxy name to p.
Definition: CommAddress.h:76
void encode_i32(uint8_t **bufp, uint32_t val)
Encode a 32-bit integer in little-endian order.
Compatibility Macros for C/C++.
DependencySet m_obstructions_permanent
Set of permanent obstructions.
Definition: Operation.h:601
void phantom_commit_ranges(const CommAddress &addr, int64_t op_id, const String &location, int32_t plan_generation, const vector< QualifiedRangeSpec > &ranges, int32_t timeout)
Issues a "phantom_commit_ranges" synchronous request.
Definition: Client.cc:793
The PageArena allocator is simple and fast, avoiding individual mallocs/frees.
Definition: PageArena.h:69
#define HT_END
Definition: Logger.h:220
#define HT_ERROR_OUT
Definition: Logger.h:301
const char * METADATA
Definition: Operation.cc:48
virtual void decode(const uint8_t **bufp, size_t *remainp)
Reads serialized representation of object from a buffer.
Definition: Serializable.cc:70
#define HT_WARN_OUT
Definition: Logger.h:291
void get_locations(StringSet &locations) const
Fills a set of location strings that represent all of the locations (range servers) that are part of ...
Definition: ReplayPlan.cc:73
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
void remove(const QualifiedRangeSpec &qrs)
Definition: ReceiverPlan.cc:50
#define HT_FATALF(msg,...)
Definition: Logger.h:343
DependencySet m_obstructions
Set of obstructions.
Definition: Operation.h:598
Declarations for general-purpose utility functions.
void legacy_decode(const uint8_t **bufp, size_t *remainp, BalancePlan *plan)
Central authority for balance plans.
DependencySet m_dependencies
Set of dependencies.
Definition: Operation.h:595
#define HT_INFOF(msg,...)
Definition: Logger.h:272
void phantom_load(const CommAddress &addr, const String &location, int32_t plan_generation, const vector< int32_t > &fragments, const vector< QualifiedRangeSpec > &range_specs, const vector< RangeState > &range_states)
Issues a "phantom_load" synchronous request.
Definition: Client.cc:737
void decode_request(const uint8_t **bufp, size_t *remainp)
Client interface to RangeServer.
Definition: Client.h:63
const char * SYSTEM
Definition: Operation.cc:49
Abstract base class for master operations.
Definition: Operation.h:124
const char * ROOT
Definition: Operation.cc:47
This is a generic exception class for Hypertable.
Definition: Error.h:314
uint8_t encoding_version_state() const override
Returns version of encoding format of state.
Qualified (with table identifier) range specification.
#define HT_ERRORF(msg,...)
Definition: Logger.h:300
DependencySet m_exclusivities
Set of exclusivities.
Definition: Operation.h:592
void get_receiver_plan_locations(const String &location, int type, StringSet &locations)
Returns the list of receiver location for a recovery plan.
void get_locations(StringSet &locations) const
Definition: ReceiverPlan.cc:58
#define HT_MAYBE_FAIL(_label_)
ReceiverPlan receiver_plan
Receiver plan.
Definition: Plan.h:73
void complete_ok(std::vector< MetaLog::EntityPtr > &additional)
Definition: Operation.cc:436
Declarations for BalancePlanAuthority.
size_t encoded_length_state() const override
Encoded length of operation state.
Error codes, Exception handling, error logging.
#define HT_THROW(_code_, _msg_)
Definition: Error.h:478
md5 digest routines.
Address abstraction to hold either proxy name or IPv4:port address.
Definition: CommAddress.h:52
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