SWC-DB  v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
ColumnHealthCheck.cc
Go to the documentation of this file.
1 /*
2  * SWC-DB© Copyright since 2019 Alex Kashirin <kashirin.alex@gmail.com>
3  * License details at <https://github.com/kashirin-alex/swc-db/#license>
4  */
5 
6 
7 
13 
14 
15 namespace SWC { namespace Manager {
16 
17 
20  const ColumnHealthCheck::Ptr& a_col_checker,
21  const Ranger::Ptr& a_rgr)
22  : col_checker(a_col_checker), rgr(a_rgr),
23  m_mutex(),
24  m_ranges(), m_checkings(0),
25  m_success(0), m_failures(0) {
26 }
27 
29  if(!m_success && m_failures) // && m_success < m_failures)
30  rgr->failures.fetch_add(1);
31 }
32 
35  _add_range(range);
36 }
37 
39  if(rgr->state == DB::Types::MngrRangerState::ACK) {
41  col_checker->col->need_health_check(
42  col_checker->check_ts, col_checker->check_intval,
43  ranges, rgr->rgrid, more
44  );
45  if(!ranges.empty()) {
46  for(auto& range : ranges)
47  add_range(range);
48  return true;
49  }
50  }
51  return false;
52 }
53 
55  int err, uint8_t flags) {
56  uint8_t more;
57  {
59  --m_checkings;
60  while(!m_ranges.empty() && m_checkings < 10) {
61  auto r = m_ranges.front();
62  if(r->assigned() && r->get_rgr_id() == rgr->rgrid)
63  _add_range(r);
64  m_ranges.pop();
65  }
66  size_t sz = m_checkings + m_ranges.size();
67  more = sz < 10 ? 10 - sz : 0;
68  }
69 
70  if(err == Error::COMM_CONNECT_ERROR) {
71  m_failures.fetch_add(1);
72  } else {
73  m_success.fetch_add(1);
74  if(!err) {
75  rgr->failures.store(0);
77  col_checker->add_mergeable(range);
78  }
79  } else if(err == Error::RGR_NOT_LOADED_RANGE) {
80  col_checker->col->set_unloaded(range);
82  }
83  }
84 
85  SWC_LOGF((err ? LOG_WARN : LOG_DEBUG),
86  "Column-Health FINISH range(" SWC_FMT_LU "/" SWC_FMT_LU") rgr=" SWC_FMT_LU
87  " err=%d(%s)",
88  range->cfg->cid, range->rid, rgr->rgrid.load(),
89  err, Error::get_text(err));
90 
91  if(more)
92  add_ranges(more);
93  col_checker->finishing(true);
94 }
95 
97  if(m_checkings == 10) {
98  m_ranges.push(range);
99  } else {
100  col_checker->completion.increment();
101  ++m_checkings;
103  new Comm::Protocol::Rgr::Req::RangeIsLoaded(shared_from_this(), range)
104  ));
106  "Column-Health START range(" SWC_FMT_LU "/" SWC_FMT_LU
107  ") rgr=" SWC_FMT_LU,
108  range->cfg->cid, range->rid, rgr->rgrid.load());
109  }
110 }
111 
112 
113 
114 
117  int64_t a_check_ts,
118  uint32_t a_check_intval)
119  : col(a_col),
120  check_ts(a_check_ts),
121  check_intval(a_check_intval),
122  completion(1),
123  m_check(), m_mutex(),
125  SWC_LOGF(LOG_DEBUG, "Column-Health START cid(" SWC_FMT_LU ")",
126  col->cfg->cid);
127 }
128 
129 void ColumnHealthCheck::run(bool initial) {
130  if(m_check.running())
131  return;
132 
134  col->need_health_check(check_ts, check_intval, ranges, 0, 100);
135 
136  RangerCheck::Ptr checker;
137  rgrid_t rgrid;
138  for(auto& range : ranges) {
139  if(!range->assigned())
140  continue;
141  rgrid = range->get_rgr_id();
142  {
144  auto it = std::find_if(
146  [rgrid](const RangerCheck::Ptr& _checker) {
147  return rgrid == _checker->rgr->rgrid; }
148  );
149  checker = it == m_checkers.cend() ? nullptr : *it;
150  }
151  if(!checker) {
152  auto rgr = Env::Mngr::rangers()->rgr_get(rgrid);
153  if(!rgr || rgr->state != DB::Types::MngrRangerState::ACK)
154  continue;
155 
157  checker = m_checkers.emplace_back(
158  new RangerCheck(shared_from_this(), rgr));
159 
160  } else if(checker->rgr->state != DB::Types::MngrRangerState::ACK) {
161  continue;
162  }
163 
164  checker->add_range(range);
165  }
166 
167  m_check.stop();
168 
169  if(initial)
170  finishing(false);
171 }
172 
175  range->print(SWC_LOG_OSTREAM << "RANGE-CAN-MERGE: ");
176  );
179 }
180 
181 void ColumnHealthCheck::finishing(bool finished_range) {
182  if(finished_range)
183  run(false);
184 
186  "Column-Health finishing cid(" SWC_FMT_LU ") in-process=" SWC_FMT_LU,
187  col->cfg->cid, completion.count());
188  if(!completion.is_last())
189  return;
190 
191  m_checkers.clear();
192 
193  if(m_mergeable_ranges.empty()) {
194  /*
195  if(col->state() == Error::OK) {
196  // match ranger's rids to mngr assignments (dup. unload from all Rangers)
197  RangerList rangers;
198  Env::Mngr::rangers()->rgr_get(0, rangers);
199  }
200  */
201  SWC_LOGF(LOG_DEBUG, "Column-Health FINISH cid(" SWC_FMT_LU ")",
202  col->cfg->cid);
203  Env::Mngr::rangers()->health_check_finished(shared_from_this());
204  return;
205  }
206 
207  ColumnMerger::Ptr merger(new ColumnMerger(
208  shared_from_this(), std::move(m_mergeable_ranges)));
209  if(DB::Types::SystemColumn::is_master(col->cfg->cid)) {
210  return merger->run_master();
211  }
212 
214  col->cfg->key_seq, DB::Types::SystemColumn::get_range_type(col->cfg->cid));
216  auto& key_intval = spec.key_intervals.add();
217  key_intval.start.reserve(2);
218  key_intval.start.add(std::to_string(col->cfg->cid), Condition::EQ);
219  key_intval.start.add("", Condition::FIP);
220 
223  [merger, meta_cid]
225  int err = _hdlr->state_error;
226  if(!err) {
227  auto _col = _hdlr->get_columnn(meta_cid);
228  if(!(err = _col->error()) && !_col->empty())
229  _col->get_cells(merger->cells);
230  }
231  (err || merger->cells.empty())
232  ? merger->completion()
233  : merger->run();
234  },
235  false,
236  Env::Mngr::io()
237  );
238  hdlr->scan(col->cfg->key_seq, meta_cid, std::move(spec));
239 }
240 
241 
242 
245  const ColumnHealthCheck::Ptr& a_col_checker,
246  Core::Vector<Range::Ptr>&& ranges) noexcept
247  : col_checker(a_col_checker),
248  m_ranges(std::move(ranges)), cells(),
249  m_mutex(), m_mergers() {
250 }
251 
254  sorted.reserve(m_ranges.size());
255  for(auto& range : m_ranges) {
256  bool added = false;
257  for(auto it=sorted.cbegin(); it != sorted.cend(); ++it) {
258  if((*it)->after(range)) {
259  sorted.insert(it, range);
260  added = true;
261  break;
262  }
263  }
264  if(!added)
265  sorted.push_back(range);
266  }
267 
269  for(auto& range : sorted) {
270  auto left = col_checker->col->left_sibling(range);
271  if(!left) {
272  group.push_back(range);
273  } else if(group.empty()) {
274  group.push_back(left); // group-merge-to-this-range
275  group.push_back(range);
276  } else if(left->rid == group.back()->rid) {
277  group.push_back(range);
278  } else {
279  if(group.size() > 1)
281  new RangesMerger(shared_from_this(), std::move(group)));
282  group.push_back(left); // group-merge-to-this-range
283  group.push_back(range);
284  }
285  }
286  if(group.size() > 1)
288  new RangesMerger(shared_from_this(), std::move(group)));
289 
290  if(m_mergers.empty()) {
292  "Column-Health FINISH cid(" SWC_FMT_LU ") not-mergeable=" SWC_FMT_LD,
293  col_checker->col->cfg->cid, int64_t(m_ranges.size()));
295  } else {
297  "Column-Health MERGE cid(" SWC_FMT_LU ") merger-groups=" SWC_FMT_LD,
298  col_checker->col->cfg->cid, int64_t(m_mergers.size()));
299  completion();
300  }
301 }
302 
305  Range::Ptr left = nullptr;
306  for(auto& cell : cells) {
307  //SWC_LOG_OUT(LOG_DEBUG,
308  // cell->print(SWC_LOG_OSTREAM, DB::Types::Column::SERIAL); );
309 
310  StaticBuffer v;
311  cell->get_value(v, false);
312  const uint8_t* ptr = v.base;
313  size_t remain = v.size;
315  DB::Cell::Key key_end; // skip-through
316  key_end.decode(&ptr, &remain, false);
318  rid_t rid = Serialization::decode_vi64(&ptr, &remain);
319 
320  Range::Ptr range = col_checker->col->get_range(rid);
321  if(!range) {
322  m_mergers.clear();
323  break;
324  }
325  if(!left) {
326  group.push_back(range);
327  } else if(group.empty()) {
328  group.push_back(left); // group-merge-to-this-range
329  group.push_back(range);
330  } else if(left->rid == group.back()->rid) {
331  group.push_back(range);
332  } else {
333  if(group.size() > 1)
334  m_mergers.emplace_back(
335  new RangesMerger(shared_from_this(), std::move(group)));
336  group.push_back(left); // group-merge-to-this-range
337  group.push_back(range);
338  }
339  left = range;
340  }
341  if(group.size() > 1)
342  m_mergers.emplace_back(
343  new RangesMerger(shared_from_this(), std::move(group)));
344 
345  if(m_mergers.empty()) {
347  "Column-Health FINISH cid(" SWC_FMT_LU ") not-mergeable=" SWC_FMT_LD,
348  col_checker->col->cfg->cid, int64_t(m_ranges.size()));
350  } else {
352  "Column-Health MERGE cid(" SWC_FMT_LU ") merger-groups=" SWC_FMT_LD,
353  col_checker->col->cfg->cid, int64_t(m_mergers.size()));
354  completion();
355  }
356 }
357 
359  if(m_mergers.empty()) {
360  SWC_LOGF(LOG_DEBUG, "Column-Health FINISH cid(" SWC_FMT_LU ") MERGE",
361  col_checker->col->cfg->cid);
363  return;
364  }
365  auto merger = m_mergers.back();
366  m_mergers.erase(m_mergers.cend() - 1);
367  merger->run();
368 }
369 
370 
371 
374  const ColumnMerger::Ptr& a_col_merger,
375  Core::Vector<Range::Ptr>&& ranges) noexcept
376  : col_merger(a_col_merger),
377  m_mutex(), m_err(Error::OK),
378  m_ranges(std::move(ranges)),
379  m_ready() {
380 }
381 
383  for(auto& range : m_ranges) {
384  auto rgrid = range->get_rgr_id();
385  if(rgrid) {
386  auto rgr = Env::Mngr::rangers()->rgr_get(rgrid);
387  if(rgr) {
390  rgr, shared_from_this(), range)
391  ));
393  "Column-Health MERGE-UNLOAD range(" SWC_FMT_LU "/" SWC_FMT_LU
394  ") rgr=" SWC_FMT_LU,
395  range->cfg->cid, range->rid, rgr->rgrid.load());
396  continue;
397  }
398  }
399  handle(range, Error::OK, false);
400  }
401 }
402 
404  const Range::Ptr& _range, int err,
405  bool empty) {
406  {
408  if(err) {
409  if(!m_err)
410  m_err = err;
411  m_ready.push_back(nullptr);
412  } else if(!empty && m_ranges.front() != _range) {
414  "Column-Health MERGE-UNLOAD range(" SWC_FMT_LU "/" SWC_FMT_LU ")"
415  " NOT-EMPTY cancelling-merge",
416  _range->cfg->cid, _range->rid);
417  m_ready.push_back(_range);
418  if(!m_err)
419  m_err = Error::CANCELLED;
420  } else if(col_merger->col_checker->col->set_merging(_range)) {
421  m_ready.push_back(_range);
422  } else {
423  m_ready.push_back(nullptr);
424  if(!m_err)
426  }
427  if(m_ranges.size() > m_ready.size())
428  return;
429  }
430 
431  if(m_err) { // CANCEL-MERGE
432  col_merger->col_checker->col->state(m_err=Error::OK);
433  if(m_err != Error::COLUMN_MARKED_REMOVED) {
434  for(auto& range : m_ready) {
435  if(range) // reset merge state
436  col_merger->col_checker->col->set_unloaded(range);
437  }
439  }
440  return col_merger->completion();
441  }
442  m_ready.clear();
443 
444  Range::Ptr main_range = m_ranges.front(); //group-merge-to-this-range
445  m_ranges.erase(m_ranges.cbegin());
446 
447  const std::string main_range_path =
449  main_range->cfg->cid, main_range->rid);
450  const std::string main_cs_path =
452  main_range_path, DB::RangeBase::CELLSTORES_DIR);
453 
455  csid_t last_cs_id;
456 
457  const auto& fs = Env::FsInterface::interface();
458  FS::DirentList files;
459 
460  // get last used cs-id
461  fs->readdir(err, main_cs_path, files);
462  if(err)
463  goto finalize;
464 
465  {
466  FS::IdEntries_t entries;
467  entries.reserve(files.size());
468  for(auto& entry : files) {
469  if(entry.name.find(".cs", entry.name.length()-3) != std::string::npos) {
470  auto idn = entry.name.substr(0, entry.name.length()-3);
471  entries.push_back(strtoull(idn.c_str(), nullptr, 0));
472  }
473  }
474  std::sort(entries.begin(), entries.end());
475  if(entries.empty()) {
476  err = Error::CANCELLED;
477  goto finalize;
478  }
479  last_cs_id = entries.back();
480  }
481 
482  for(auto& range : m_ranges) {
483  // sanity check if no-logs exist
484  const std::string range_path = DB::RangeBase::get_path(
485  range->cfg->cid, range->rid);
486  files.clear();
487  fs->readdir(
488  err,
490  files);
491  if(err || !files.empty()) // sanity-check
492  goto finalize;
493 
494  // read cs files to move/rename (expect one)
495  const std::string cs_path = DB::RangeBase::get_path_on_range(
496  range_path, DB::RangeBase::CELLSTORES_DIR);
497  fs->readdir(err, cs_path, files);
498  if(err || files.size() != 1 || !files.front().name.ends_with(".cs"))
499  goto finalize;
500 
501  // rename to main-range cs-path
502  const std::string to_cs = DB::RangeBase::get_path_cs(
503  main_range_path, DB::RangeBase::CELLSTORES_DIR, ++last_cs_id);
504  fs->rename(err, cs_path + files.front().name, to_cs);
505  if(err)
506  goto finalize;
507 
508  // delete the R/rid folder
509  fs->rmdir(err, range_path);
510  merged.push_back(range);
511  range = nullptr;
512  }
513 
514 
515  finalize:
516 
517  for(auto& range : merged)
518  col_merger->col_checker->col->remove_range(range->rid);
519 
520  if(!merged.empty() &&
521  !DB::Types::SystemColumn::is_master(main_range->cfg->cid)) {
525  main_range->cfg->key_seq,
526  DB::Types::SystemColumn::get_range_type(main_range->cfg->cid));
527  auto& col = hdlr->create(
528  meta_cid, main_range->cfg->key_seq, 1, 0, DB::Types::Column::SERIAL);
529  for(auto& cell : col_merger->cells) {
530  StaticBuffer v;
531  cell->get_value(v, false);
532  const uint8_t* ptr = v.base;
533  size_t remain = v.size;
535  DB::Cell::Key key_end; // skip-through
536  key_end.decode(&ptr, &remain, false);
538  rid_t rid = Serialization::decode_vi64(&ptr, &remain);
539 
540  for(auto& range : merged) {
541  if(rid == range->rid) {
542  cell->flag = DB::Cells::DELETE_LE;
543  cell->free(); // no-need-value-data
544  col->add(*cell);
545  break;
546  }
547  }
548  }
549  hdlr->commit_if_need();
550  hdlr->wait();
551  }
552 
553 
554  for(auto& range : m_ranges) {
555  if(range) // reset unmerged state
556  col_merger->col_checker->col->set_unloaded(range);
557  }
558 
559  #ifdef SWC_RANGER_WITH_RANGEDATA
560  if(!merged.empty()) // delete expired/outdated range.data file
561  fs->remove(err, DB::RangeBase::get_path_range_data(main_range_path));
562  #endif
563 
564  col_merger->col_checker->col->set_unloaded(main_range);
566 
568  "Column-Health MERGE GROUP cid(" SWC_FMT_LU
569  ") ranges(" SWC_FMT_LD "/" SWC_FMT_LD ") to range(" SWC_FMT_LU ")",
570  main_range->cfg->cid, int64_t(merged.size()), int64_t(m_ranges.size()),
571  main_range->rid);
572  return col_merger->completion();
573 }
574 
575 
576 }}
577 
578 
SWC::Manager::ColumnHealthCheck::ColumnHealthCheck
ColumnHealthCheck(const Column::Ptr &col, int64_t check_ts, uint32_t check_intval)
Definition: ColumnHealthCheck.cc:116
SWC::Manager::ColumnHealthCheck::RangerCheck::RangerCheck
RangerCheck(const ColumnHealthCheck::Ptr &col_checker, const Ranger::Ptr &rgr)
Definition: ColumnHealthCheck.cc:19
SWC::Core::Vector::front
constexpr SWC_CAN_INLINE reference front() noexcept
Definition: Vector.h:243
SWC::Manager::ColumnHealthCheck::m_checkers
Core::Vector< RangerCheck::Ptr > m_checkers
Definition: ColumnHealthCheck.h:127
SWC::Manager::ColumnHealthCheck::RangerCheck
Definition: ColumnHealthCheck.h:31
SWC::Core::StateRunning::stop
constexpr SWC_CAN_INLINE void stop() noexcept
Definition: StateRunning.h:32
SWC::DB::RangeBase::get_path_cs
static const std::string get_path_cs(const std::string &range_path, const std::string &folder, const csid_t csid)
Definition: RangeBase.h:81
SWC::client::Query::Select::Handlers::Common::make
static SWC_CAN_INLINE Ptr make(const Clients::Ptr &clients, Cb_t &&cb=nullptr, bool rsp_partials=false, const Comm::IoContextPtr &io=nullptr, Clients::Flag executor=Clients::DEFAULT)
Definition: Common.h:26
SWC::Error::RGR_NOT_LOADED_RANGE
@ RGR_NOT_LOADED_RANGE
Definition: Error.h:91
SWC::client::Query::Select::Handlers::Common::Ptr
std::shared_ptr< Common > Ptr
Definition: Common.h:22
SWC::Manager::ColumnHealthCheck::finishing
void finishing(bool finished_range)
Definition: ColumnHealthCheck.cc:181
SWC_LOG_OSTREAM
#define SWC_LOG_OSTREAM
Definition: Logger.h:44
SWC::DB::Specs::Interval::key_intervals
KeyIntervals key_intervals
Definition: SpecsInterval.h:239
SWC::Manager::ColumnHealthCheck::ColumnMerger::RangesMerger::handle
void handle(const Range::Ptr &range, int err, bool empty)
Definition: ColumnHealthCheck.cc:403
SWC::Env::Clients::get
static SWC_CAN_INLINE client::Clients::Ptr & get() noexcept
Definition: Clients.h:299
SWC_LOGF
#define SWC_LOGF(priority, fmt,...)
Definition: Logger.h:188
SWC::DB::Specs::KeyInterval::start
Key start
Definition: SpecsKeyIntervals.h:19
SWC::Core::Vector::clear
SWC_CAN_INLINE void clear() noexcept(_NoExceptDestructor)
Definition: Vector.h:120
SWC::Manager::ColumnHealthCheck::ColumnMerger::RangesMerger
Definition: ColumnHealthCheck.h:84
SWC::Manager::ColumnHealthCheck::ColumnMerger::col_checker
const ColumnHealthCheck::Ptr col_checker
Definition: ColumnHealthCheck.h:68
SWC_LOG_OUT
#define SWC_LOG_OUT(pr, _code_)
Definition: Logger.h:178
SWC::Manager::ColumnHealthCheck::ColumnMerger::m_ranges
Core::Vector< Range::Ptr > m_ranges
Definition: ColumnHealthCheck.h:69
SWC::DB::RangeBase::get_path_on_range
static const std::string get_path_on_range(const std::string &range_path, const std::string &path)
Definition: RangeBase.h:52
SWC::Manager::ColumnHealthCheck::col
const Column::Ptr col
Definition: ColumnHealthCheck.h:24
SWC::Manager::ColumnHealthCheck::Ptr
std::shared_ptr< ColumnHealthCheck > Ptr
Definition: ColumnHealthCheck.h:23
SWC::Comm::Protocol::Rgr::Req::RangeUnoadForMerge::Ptr
std::shared_ptr< RangeUnoadForMerge > Ptr
Definition: RangeUnoadForMerge.h:17
SWC::Error::get_text
const char * get_text(const int err) noexcept
Definition: Error.cc:173
SWC::Manager::ColumnHealthCheck::m_check
Core::StateRunning m_check
Definition: ColumnHealthCheck.h:125
SWC::Env::FsInterface::interface
static SWC_CAN_INLINE FS::Interface::Ptr & interface() noexcept
Definition: Interface.h:150
SWC::LOG_INFO
@ LOG_INFO
Definition: Logger.h:35
RangeIsLoaded.h
SWC::csid_t
uint32_t csid_t
Definition: Identifiers.h:19
SWC::Core::MutexSptd::scope
Definition: MutexSptd.h:96
SWC::Manager::ColumnHealthCheck::m_mergeable_ranges
Core::Vector< Range::Ptr > m_mergeable_ranges
Definition: ColumnHealthCheck.h:128
SWC::DB::Cells::DELETE_LE
@ DELETE_LE
Definition: Cell.h:63
RangeUnoadForMerge.h
SWC::Manager::ColumnHealthCheck::RangerCheck::Ptr
std::shared_ptr< RangerCheck > Ptr
Definition: ColumnHealthCheck.h:34
SWC::DB::Cell::Key
Definition: CellKey.h:24
SWC::Manager::Range::Ptr
std::shared_ptr< Range > Ptr
Definition: Range.h:24
SWC::Manager::ColumnHealthCheck::check_intval
const int32_t check_intval
Definition: ColumnHealthCheck.h:26
SWC::Manager::ColumnHealthCheck::RangerCheck::add_ranges
bool add_ranges(uint8_t more)
Definition: ColumnHealthCheck.cc:38
SWC::DB::Types::SystemColumn::is_master
constexpr SWC_CAN_INLINE bool is_master(cid_t cid) noexcept
Definition: SystemColumn.h:31
SWC::Manager::ColumnHealthCheck::RangerCheck::handle
void handle(const Range::Ptr &range, int err, uint8_t flags)
Definition: ColumnHealthCheck.cc:54
SWC::DB::Cell::Key::decode
void decode(const uint8_t **bufp, size_t *remainp, bool owner)
Definition: CellKey.h:337
SWC::client::Query::Update::Handlers::Common::make
static SWC_CAN_INLINE Ptr make(const Clients::Ptr &clients, Cb_t &&cb=nullptr, const Comm::IoContextPtr &io=nullptr, Clients::Flag executor=Clients::DEFAULT)
Definition: Common.h:24
SWC::DB::Types::SystemColumn::get_range_type
constexpr SWC_CAN_INLINE Range get_range_type(cid_t cid) noexcept
Definition: SystemColumn.h:51
SWC::DB::Types::MngrRangerState::ACK
const uint8_t ACK
Definition: MngrRangerState.h:18
SWC::Error::OK
@ OK
Definition: Error.h:45
SWC::DB::RangeBase::get_path
static const std::string get_path(const cid_t cid)
Definition: RangeBase.h:38
SWC::Core::Vector::empty
constexpr SWC_CAN_INLINE bool empty() const noexcept
Definition: Vector.h:168
SWC_CAN_INLINE
#define SWC_CAN_INLINE
Definition: Compat.h:102
SWC::LOG_DEBUG
@ LOG_DEBUG
Definition: Logger.h:36
CellValueSerialFields.h
SWC::Manager::ColumnHealthCheck::ColumnMerger::completion
void completion()
Definition: ColumnHealthCheck.cc:358
SWC::Manager::ColumnHealthCheck::RangerCheck::add_range
void add_range(const Range::Ptr &range)
Definition: ColumnHealthCheck.cc:33
SWC::Condition::FIP
@ FIP
Definition: Comparators.h:75
SWC::Core::Vector::back
constexpr SWC_CAN_INLINE reference back() noexcept
Definition: Vector.h:254
SWC::Manager::ColumnHealthCheck::ColumnMerger::RangesMerger::RangesMerger
RangesMerger(const ColumnMerger::Ptr &col_merger, Core::Vector< Range::Ptr > &&ranges) noexcept
Definition: ColumnHealthCheck.cc:373
SWC::Core::Vector::end
constexpr SWC_CAN_INLINE iterator end() noexcept
Definition: Vector.h:227
SWC::DB::Specs::KeyIntervals::add
KeyInterval & add()
Definition: SpecsKeyIntervals.cc:28
SWC::Core::Buffer::base
value_type * base
Definition: Buffer.h:131
SWC
The SWC-DB C++ namespace 'SWC'.
Definition: main.cc:12
SWC::Core::Buffer
Definition: Buffer.h:18
SWC::Core::Buffer::size
size_t size
Definition: Buffer.h:130
SWC::Manager::ColumnHealthCheck::completion
Core::CompletionCounter< uint64_t > completion
Definition: ColumnHealthCheck.h:27
SWC::Condition::EQ
@ EQ
Definition: Comparators.h:32
SWC::DB::RangeBase::CELLSTORES_DIR
static constexpr const char CELLSTORES_DIR[]
Definition: RangeBase.h:21
SWC::Error::COMM_CONNECT_ERROR
@ COMM_CONNECT_ERROR
Definition: Error.h:65
SWC::DB::RangeBase::LOG_DIR
static constexpr const char LOG_DIR[]
Definition: RangeBase.h:22
SWC::Comm::Resolver::sort
void sort(const Networks &nets, const EndPoints &endpoints, EndPoints &sorted)
Definition: Resolver.cc:243
SWC::Manager::Ranger::Ptr
std::shared_ptr< Ranger > Ptr
Definition: Ranger.h:21
SWC::Core::StateRunning::running
constexpr SWC_CAN_INLINE bool running() noexcept
Definition: StateRunning.h:37
SWC::rgrid_t
uint64_t rgrid_t
Definition: Identifiers.h:18
SWC::DB::Types::SystemColumn::get_sys_cid
uint8_t SWC_CONST_FUNC get_sys_cid(KeySeq col_seq, Range col_type) noexcept
Definition: SystemColumn.cc:71
SWC::Manager::ColumnHealthCheck::check_ts
const int64_t check_ts
Definition: ColumnHealthCheck.h:25
SWC::Manager::Rangers::rgr_get
Ranger::Ptr rgr_get(const rgrid_t rgrid)
Definition: Rangers.cc:164
SWC::Manager::ColumnHealthCheck::ColumnMerger::run_master
void run_master()
Definition: ColumnHealthCheck.cc:252
SWC_FMT_LU
#define SWC_FMT_LU
Definition: Compat.h:98
SWC::cid_t
uint64_t cid_t
Definition: Identifiers.h:16
SWC::Core::CompletionCounter::count
constexpr SWC_CAN_INLINE CountT count() const noexcept
Definition: CompletionCounter.h:42
SWC::Manager::ColumnHealthCheck::ColumnMerger::run
void run()
Definition: ColumnHealthCheck.cc:303
SWC::Manager::ColumnHealthCheck::m_mutex
Core::MutexSptd m_mutex
Definition: ColumnHealthCheck.h:126
SWC::Comm::Protocol::Rgr::Params::RangeIsLoadedRsp::CAN_MERGE
@ CAN_MERGE
Definition: RangeIsLoaded.h:57
SWC::Core::Vector< Range::Ptr >
SWC::Manager::ColumnHealthCheck::ColumnMerger::RangesMerger::run
void run()
Definition: ColumnHealthCheck.cc:382
SWC::DB::Specs::Interval
Definition: SpecsInterval.h:25
SWC::Manager::Rangers::assign_ranges
void assign_ranges()
Definition: Rangers.cc:544
SWC::DB::Cell::Serial::Value::skip_type_and_id
SWC_CAN_INLINE void skip_type_and_id(const uint8_t **bufp, size_t *remainp)
Definition: CellValueSerialField.h:61
SWC::Core::Vector::cend
constexpr SWC_CAN_INLINE const_iterator cend() const noexcept
Definition: Vector.h:232
SWC::Error::COLUMN_MARKED_REMOVED
@ COLUMN_MARKED_REMOVED
Definition: Error.h:102
SWC::Comm::Protocol::Rgr::Req::RangeUnoadForMerge
Definition: RangeUnoadForMerge.h:15
SWC::Serialization::decode_vi64
constexpr SWC_CAN_INLINE uint64_t decode_vi64(const uint8_t **bufp, size_t *remainp)
Definition: Serialization.h:302
SWC::rid_t
uint64_t rid_t
Definition: Identifiers.h:17
SWC::Manager::ColumnHealthCheck::RangerCheck::_add_range
void _add_range(const Range::Ptr &range)
Definition: ColumnHealthCheck.cc:96
SWC::Comm::Protocol::Rgr::Req::RangeIsLoaded::Ptr
std::shared_ptr< RangeIsLoaded > Ptr
Definition: RangeIsLoaded.h:18
SWC::Manager::ColumnHealthCheck::ColumnMerger::Ptr
std::shared_ptr< ColumnMerger > Ptr
Definition: ColumnHealthCheck.h:67
SWC::Manager::ColumnHealthCheck::run
void run(bool initial=true)
Definition: ColumnHealthCheck.cc:129
SWC::LOG_WARN
@ LOG_WARN
Definition: Logger.h:33
SWC::Manager::Rangers::health_check_finished
void health_check_finished(const ColumnHealthCheck::Ptr &chk)
Definition: Rangers.cc:510
SWC::Manager::Column::Ptr
std::shared_ptr< Column > Ptr
Definition: Column.h:24
SWC::Manager::ColumnHealthCheck::add_mergeable
void add_mergeable(const Range::Ptr &range)
Definition: ColumnHealthCheck.cc:173
SWC::Core::CompletionCounter::is_last
constexpr SWC_CAN_INLINE bool is_last() noexcept
Definition: CompletionCounter.h:37
SWC::Manager::ColumnHealthCheck::ColumnMerger::ColumnMerger
ColumnMerger(const ColumnHealthCheck::Ptr &col_checker, Core::Vector< Range::Ptr > &&ranges) noexcept
Definition: ColumnHealthCheck.cc:244
SWC::Env::Mngr::io
static SWC_CAN_INLINE Comm::IoContextPtr io() noexcept
Definition: MngrEnv.h:33
flags
uint8_t flags
Flags.
Definition: Header.h:55
SWC::DB::Types::Column::SERIAL
@ SERIAL
SWC::Core::Vector::push_back
SWC_CAN_INLINE void push_back(ArgsT &&... args)
Definition: Vector.h:331
SWC::Error::CANCELLED
@ CANCELLED
Definition: Error.h:56
SWC_FMT_LD
#define SWC_FMT_LD
Definition: Compat.h:99
SWC::Core::Vector::cbegin
constexpr SWC_CAN_INLINE const_iterator cbegin() const noexcept
Definition: Vector.h:216
SWC::Core::to_string
SWC_CAN_INLINE std::string to_string(const BitFieldInt< T, SZ > &v)
Definition: BitFieldInt.h:263
Common.h
SWC::Core::Vector::size
constexpr SWC_CAN_INLINE size_type size() const noexcept
Definition: Vector.h:189
SWC::Manager::ColumnHealthCheck::ColumnMerger::m_mergers
Core::Vector< RangesMerger::Ptr > m_mergers
Definition: ColumnHealthCheck.h:108
SWC::Core::Vector::emplace_back
SWC_CAN_INLINE reference emplace_back(ArgsT &&... args)
Definition: Vector.h:349
ColumnHealthCheck.h
SWC::Comm::Protocol::Rgr::Req::RangeIsLoaded
Definition: RangeIsLoaded.h:16
SWC::Core::Vector::insert
SWC_CAN_INLINE iterator insert(size_type offset, ArgsT &&... args)
Definition: Vector.h:367
SWC::Manager::ColumnHealthCheck::RangerCheck::~RangerCheck
~RangerCheck() noexcept
Definition: ColumnHealthCheck.cc:28
SWC::Env::Mngr::rangers
static SWC_CAN_INLINE Manager::Rangers * rangers() noexcept
Definition: MngrEnv.h:69
SWC::Core::Vector::reserve
SWC_CAN_INLINE void reserve(size_type cap)
Definition: Vector.h:288
RangeUnoadForMerge.cc
SWC::Manager::ColumnHealthCheck::ColumnMerger
Definition: ColumnHealthCheck.h:64
SWC::Core::Vector::begin
constexpr SWC_CAN_INLINE iterator begin() noexcept
Definition: Vector.h:211