SWC-DB  v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
RangeBlock.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 #include "swcdb/core/Checksum.h"
10 
11 
12 namespace SWC { namespace Ranger {
13 
14 
17  Blocks* blocks, State state) {
18  return new Block(interval, blocks, state);
19 }
20 
23  Blocks* a_blocks, State state)
24  : blocks(a_blocks), next(nullptr), prev(nullptr),
25  m_mutex(),
26  m_cells(
27  DB::Cells::Mutable(
28  blocks->range->cfg->key_seq,
29  blocks->range->cfg->cell_versions(),
30  blocks->range->cfg->cell_ttl(),
31  blocks->range->cfg->column_type())),
32  m_releasable_bytes(0),
33  m_mutex_intval(),
34  m_split_rev(0),
35  m_prev_key_end(), m_key_end(interval.key_end),
36  m_mutex_state(),
37  m_processing(0), m_state(state), m_loader(nullptr) {
40  sizeof(*this) + sizeof(Ptr));
41 }
42 
44 Block::~Block() noexcept {
47  sizeof(*this) + sizeof(Ptr) + m_releasable_bytes);
48 }
49 
51 size_t Block::_releasing_size() const noexcept {
52  return sizeof(*this) + sizeof(Ptr) + m_key_end.size + m_prev_key_end.size;
53 }
54 
57  return this;
58 }
59 
60 void Block::schema_update() noexcept {
63  blocks->range->cfg->cell_versions(),
64  blocks->range->cfg->cell_ttl(),
65  blocks->range->cfg->column_type(),
66  loaded()
67  );
68 }
69 
72  m_prev_key_end.copy(key);
73 }
74 
78 }
79 
83 }
84 
87  m_key_end.copy(key);
88 }
89 
92  m_key_end.free();
93 }
94 
96 bool Block::is_consist(const DB::Cells::Interval& intval) const {
97  return
98  (intval.key_end.empty() || m_prev_key_end.empty() ||
100  == Condition::GT)
101  &&
102  (intval.key_begin.empty() || is_in_end(intval.key_begin));
103 }
104 
106 bool Block::is_in_end(const DB::Cell::Key& key) const {
108  return _is_in_end(key);
109 }
110 
112 bool Block::_is_in_end(const DB::Cell::Key& key) const {
113  return m_key_end.empty() || (!key.empty() &&
115  != Condition::GT);
116 }
117 
119 bool Block::is_next(const DB::Specs::Interval& spec) const {
120  if(includes_end(spec)) {
122  return (spec.offset_key.empty() || _is_in_end(spec.offset_key)) &&
123  _includes_begin(spec);
124  }
125  return false;
126 }
127 
129 bool Block::includes(const DB::Specs::Interval& spec) const {
130  if(includes_end(spec)) {
132  return _includes_begin(spec);
133  }
134  return false;
135 }
136 
139  return m_key_end.empty() ||
141 }
142 
144 bool Block::includes_end(const DB::Specs::Interval& spec) const {
145  return m_prev_key_end.empty() ||
147 }
148 
151  struct Task {
152  Block* blk;
153  uint32_t sz;
155  Task(Block* a_blk) noexcept
156  : blk(a_blk), sz(blk->blocks->range->cfg->block_size()) {
158  }
159  void operator()() {
162  }
163  };
164  Env::Rgr::post(Task(this));
165 }
166 
169  uint32_t rev;
170  {
172  if(!_is_in_end(cell.key))
173  return false;
174  rev = m_split_rev;
175  }
176 
177  if(loaded()) {
179  if(rev != m_split_rev && !_is_in_end(cell.key))
180  return false; // split-could-happen (blk is now next)
181  if(loaded()) {
182  m_cells.add_raw(cell, true);
183  splitter(true);
184  }
185  }
186  return true;
187 }
188 
190 void Block::load_final(const DB::Cells::MutableVec& vec_cells) {
192  for(auto cells : vec_cells) {
193  if(!cells->scan_after(m_prev_key_end, m_key_end, m_cells, false))
194  break;
195  splitter(false);
196  }
198  splitter(true);
199 
201  ssize_t sz = m_cells.size_of_internal();
203  }
205  m_state.store(State::LOADED);
206 }
207 
208 SWC_SHOULD_NOT_INLINE
209 size_t Block::load_cells(const uint8_t* buf, size_t remain,
210  uint32_t revs, size_t avail,
211  bool& was_splitted, bool synced) {
212  size_t count = 0;
213  size_t added = 0;
214  size_t offset_hint = 0;
215 
217  if(revs > blocks->range->cfg->cell_versions())
218  // schema change from more to less results in dups
219  synced = false;
220  else if(!synced && m_cells.empty())
221  synced = true;
222 
223  try { for(DB::Cells::Cell cell; remain; ++count) {
224 
225  cell.read(&buf, &remain, false);
226 
227  if(!m_prev_key_end.empty() &&
229  != Condition::GT)
230  continue;
231 
232  if(!m_key_end.empty() &&
234  == Condition::GT)
235  break;
236 
237  if(cell.has_expired(m_cells.ttl))
238  continue;
239 
240  synced
241  ? m_cells.add_sorted(cell)
242  : m_cells.add_raw(cell, &offset_hint, false);
243 
244  if(!(++added % 1000) && splitter(false)) {
245  was_splitted = true;
246  offset_hint = 0;
247  }
248 
249  } } catch(...) {
252  SWC_LOG_OSTREAM << "Cell trunclated at count="
253  << count << '/' << avail << " remain=" << remain;
255  m_key_end.print(SWC_LOG_OSTREAM << " < key <= ");
256  e.print(SWC_LOG_OSTREAM << ' ');
257  );
258  }
260  ssize_t sz = m_cells.size_of_internal();
262  }
263  return added;
264 }
265 
267 bool Block::splitter(bool loaded) {
268  return _need_split() && blocks->_split(ptr(), loaded);
269 }
270 
272  {
273  State at(State::NONE);
276  switch(at) {
277  case State::NONE: {
278  m_loader = new BlockLoader(ptr());
279  m_loader->add(req);
280  break;
281  }
282  case State::LOADING: {
283  m_loader->add(req);
284  return ScanState::QUEUED;
285  }
286  case State::LOADED: {
287  goto proceed;
288  }
289  }
290  }
291  m_loader->run();
292  return ScanState::QUEUED;
293 
294  proceed: switch(req->type) {
295  case ReqScan::Type::BLK_PRELOAD: {
297  return ScanState::RESPONDED;
298  }
299  default:
300  return _scan(req, true);
301  }
302 }
303 
305  do {
306  auto& q = m_loader->q_req.front();
307  switch(q.req->type) {
308  case ReqScan::Type::BLK_PRELOAD: {
310  break;
311  }
312  default: {
313  struct Task {
314  Block* blk;
315  ReqScan::Ptr req;
317  Task(Block* a_blk, ReqScan::Ptr&& a_req) noexcept
318  : blk(a_blk), req(std::move(a_req)) { }
320  Task(Task&& other) noexcept
321  : blk(other.blk), req(std::move(other.req)) { }
322  Task(const Task&) = delete;
323  Task& operator=(Task&&) = delete;
324  Task& operator=(const Task&) = delete;
325  ~Task() noexcept { }
326  void operator()() { blk->_scan(req); }
327  };
328  if(!m_loader->error) {
329  q.req->profile.add_block_load(
331  Env::Rgr::post(Task(this, std::move(q.req)));
332  break;
333  }
336  int err = m_loader->error;
337  q.req->response(err);
338  }
339  }
340  m_loader->q_req.pop();
341  } while(!m_loader->q_req.empty());
342 
344  delete m_loader;
345  m_loader = nullptr;
346 }
347 
348 Block::Ptr Block::split(bool loaded) {
349  Block::Ptr blk = nullptr;
350  if(m_mutex.try_lock()) {
351  blk = _split(loaded);
352  m_mutex.unlock();
353  }
354  return blk;
355 }
356 
357 Block::Ptr Block::_split(bool loaded) {
358  if(loaded && Env::Rgr::res().need_ram(m_cells.size_of_internal()/2))
359  loaded = false;
360  Block::Ptr blk = Block::make(
362  blocks,
363  loaded ? State::LOADED : State::NONE
364  );
365  if(!m_cells.split(blk->m_cells,
366  blocks->range->cfg->block_cells(),
367  blocks->range->cfg->block_size(),
368  loaded)) {
369  delete blk;
370  return nullptr;
371  }
372  {
374  ++m_split_rev;
375  blk->m_key_end.move(m_key_end);
378  }
379 
381  if(loaded)
383  ssize_t sz = m_cells.size_of_internal();
386  }
387  _add(blk);
388  return blk;
389 }
390 
393  blk->prev = ptr();
394  if(next) {
395  blk->next = next;
396  next->prev = blk;
397  }
398  next = blk;
399 }
400 
401 size_t Block::release() {
402  size_t released = 0;
403  if(!m_processing && loaded() && m_mutex.try_lock()) {
404  bool support;
405  if(!m_processing && loaded() && m_mutex_state.try_full_lock(support)) {
406  auto at(State::LOADED);
407  if(!m_loader && !m_processing &&
409  released += m_releasable_bytes.exchange(0);
410  m_cells.free();
411  }
412  m_mutex_state.unlock(support);
413  }
414  m_mutex.unlock();
415  }
416  if(released && DB::Types::SystemColumn::is_data(blocks->range->cfg->cid))
418  return released;
419 }
420 
424 }
425 
429 }
430 
432 bool Block::loaded() const noexcept {
433  return m_state == State::LOADED;
434 }
435 
437 bool Block::need_load() const noexcept {
438  return m_state == State::NONE;
439 }
440 
442 bool Block::processing() noexcept {
443  bool busy = m_processing ||
444  m_state == State::LOADING ||
445  !m_mutex.try_lock();
446  if(!busy) {
447  bool support;
448  busy = m_processing ||
449  m_state == State::LOADING ||
450  !m_mutex_state.try_full_lock(support);
451  if(!busy) {
452  busy = m_processing ||
453  m_state == State::LOADING ||
454  m_loader;
455  m_mutex_state.unlock(support);
456  }
457  m_mutex.unlock();
458  }
459  return busy;
460 }
461 
463 size_t Block::size() {
465  return _size();
466 }
467 
469 size_t Block::_size() const noexcept {
470  return m_cells.size();
471 }
472 
476  return m_cells.size_bytes();
477 }
478 
482  return m_cells.size_of_internal();
483 }
484 
486 bool Block::_need_split() const noexcept {
487  auto sz = _size();
488  return sz > 1 &&
489  (sz >= blocks->range->cfg->block_cells() * 2 ||
490  m_cells.size_bytes() >= blocks->range->cfg->block_size() * 2) &&
491  !m_cells.has_one_key();
492 }
493 
494 void Block::print(std::ostream& out) {
495  out << "Block(state=" << int(m_state.load())
497  << ' ' << m_prev_key_end << " < key <= ";
498  {
500  out << m_key_end;
501  }
502 
503  out << ' ';
504  if(m_mutex.try_lock()) {
505  m_cells.print(out);
506  m_mutex.unlock();
507  } else {
508  out << "CellsLocked";
509  }
510  out << " processing=" << m_processing.load() << ')';
511 }
512 
513 Block::ScanState Block::_scan(const ReqScan::Ptr& req, bool synced) {
514  // if(is_next(req->spec)) // ?has-changed(split)
515  int err = Error::OK;
516  uint64_t ts = Time::now_ns();
517  try {
518  if(req->has_update()) {
520  m_cells.scan(req.get());
521  req->update(m_cells);
522  } else {
524  m_cells.scan(req.get());
525  }
526  } catch (...) {
529  err = e.code();
530  }
531  req->profile.add_block_scan(ts);
532 
534 
535  if(err || req->reached_limits()) {
536  if(req->with_block())
537  req->block = ptr();
539  req->response(err);
540  return ScanState::RESPONDED;
541  }
542 
543  if(req->release_block)
544  release();
545 
546  if(!synced)
547  blocks->scan(req, ptr());
548 
549  return ScanState::SYNCED;
550 }
551 
552 
553 
554 }}
SWC::Ranger::Block::m_mutex
std::shared_mutex m_mutex
Definition: RangeBlock.h:142
SWC::DB::Cells::Mutable::add_raw
SWC_CAN_INLINE void add_raw(const DynamicBuffer &cells, bool finalized)
Definition: Mutable.h:436
SWC::Core::AtomicBase::compare_exchange_weak
constexpr SWC_CAN_INLINE bool compare_exchange_weak(T &at, T value) noexcept
Definition: Atomic.h:52
SWC::DB::Cells::Mutable::back
constexpr SWC_CAN_INLINE Cell & back() noexcept
Definition: Mutable.h:203
SWC::Env::Rgr::res
static SWC_CAN_INLINE System::Resources & res() noexcept
Definition: RangerEnv.h:131
SWC::Ranger::Block::blocks
Blocks * blocks
Definition: RangeBlock.h:41
SWC::DB::Cells::Interval::key_end
DB::Cell::Key key_end
Definition: Interval.h:225
SWC::Ranger::Block::includes_end
bool includes_end(const DB::Specs::Interval &spec) const
Definition: RangeBlock.cc:144
SWC::Error::Exception::code
constexpr SWC_CAN_INLINE int code() const noexcept
Definition: Exception.h:51
SWC_LOG_OSTREAM
#define SWC_LOG_OSTREAM
Definition: Logger.h:44
SWC::Ranger::BlockLoader::count_fragments
size_t count_fragments
Definition: RangeBlockLoader.h:24
SWC::Ranger::Block::is_next
bool is_next(const DB::Specs::Interval &spec) const
Definition: RangeBlock.cc:119
SWC::DB::Cells::Mutable::size
constexpr SWC_CAN_INLINE size_t size() const noexcept
Definition: Mutable.h:175
SWC::Ranger::Block::m_split_rev
uint32_t m_split_rev
Definition: RangeBlock.h:147
SWC::Ranger::Block::make
static Ptr make(const DB::Cells::Interval &interval, Blocks *blocks, State state=State::NONE)
Definition: RangeBlock.cc:16
SWC::Ranger::Block::load_cells
size_t load_cells(const uint8_t *buf, size_t remain, uint32_t revs, size_t avail, bool &was_splitted, bool synced=false)
Definition: RangeBlock.cc:209
SWC::Ranger::Block
Definition: RangeBlock.h:23
SWC::Ranger::Block::processing
bool processing() noexcept
Definition: RangeBlock.cc:442
SWC_LOG_OUT
#define SWC_LOG_OUT(pr, _code_)
Definition: Logger.h:178
SWC::Time::now_ns
SWC_CAN_INLINE int64_t now_ns() noexcept
Definition: Time.h:43
SWC::Ranger::Block::next
Block::Ptr next
Definition: RangeBlock.h:42
SWC::Core::ScopedLock
Definition: MutexLock.h:41
SWC::Ranger::Block::m_key_end
DB::Cell::Key m_key_end
Definition: RangeBlock.h:149
SWC::Ranger::Block::State
State
Definition: RangeBlock.h:28
SWC::DB::Types::SystemColumn::is_data
constexpr SWC_CAN_INLINE bool is_data(cid_t cid) noexcept
Definition: SystemColumn.h:46
SWC::Condition::GT
@ GT
Definition: Comparators.h:30
SWC::Ranger::BlockLoader::q_req
std::queue< ReqQueue > q_req
Definition: RangeBlockLoader.h:40
SWC::Ranger::Block::schema_update
void schema_update() noexcept
Definition: RangeBlock.cc:60
SWC::DB::Cells::Mutable::configure
void configure(const uint32_t revs, const uint64_t ttl_ns, const Types::Column typ, bool finalized)
Definition: Mutable.cc:13
SWC::Ranger::Block::processing_increment
void processing_increment() noexcept
Definition: RangeBlock.cc:422
SWC::Core::SharedLock
Definition: MutexLock.h:19
SWC::System::Resources::more_mem_future
SWC_CAN_INLINE void more_mem_future(size_t sz) noexcept
Definition: Resources.h:104
SWC::Ranger::Block::add_logged
bool add_logged(const DB::Cells::Cell &cell)
Definition: RangeBlock.cc:168
SWC::DB::Types::to_string
const char *SWC_CONST_FUNC to_string(Column typ) noexcept
Definition: Column.cc:38
SWC::Core::MutexSptd::scope
Definition: MutexSptd.h:96
SWC::Ranger::Block::size
size_t size()
Definition: RangeBlock.cc:463
SWC::Ranger::BlockLoader::add
void add(const ReqScan::Ptr &req)
Definition: RangeBlockLoader.cc:78
SWC::Ranger::Block::m_releasable_bytes
Core::Atomic< size_t > m_releasable_bytes
Definition: RangeBlock.h:144
SWC::Ranger::Block::includes
bool includes(const DB::Specs::Interval &spec) const
Definition: RangeBlock.cc:129
SWC::Ranger::Block::_scan
ScanState _scan(const ReqScan::Ptr &req, bool synced=false)
Definition: RangeBlock.cc:513
SWC::Ranger::Block::ptr
Ptr ptr()
Definition: RangeBlock.cc:56
SWC::Ranger::Block::_is_in_end
bool _is_in_end(const DB::Cell::Key &key) const
Definition: RangeBlock.cc:112
SWC::DB::Cells::Cell
Definition: Cell.h:92
SWC::Core::MutexSptd::unlock
SWC_CAN_INLINE void unlock(const bool &support) noexcept
Definition: MutexSptd.h:71
SWC::Ranger::Block::is_in_end
bool is_in_end(const DB::Cell::Key &key) const
Definition: RangeBlock.cc:106
SWC::Ranger::Block::size_bytes
size_t size_bytes()
Definition: RangeBlock.cc:474
SWC::DB::Cell::Key
Definition: CellKey.h:24
SWC::Ranger::ReqScanBlockLoader::Ptr
std::shared_ptr< ReqScanBlockLoader > Ptr
Definition: ReqScan.h:99
SWC::Ranger::Block::prev
Block::Ptr prev
Definition: RangeBlock.h:43
SWC::DB::Cells::Cell::key
DB::Cell::Key key
Definition: Cell.h:357
SWC::Error::Exception::print
void print(std::ostream &out) const
Definition: Exception.cc:170
SWC::Ranger::Block::m_loader
BlockLoader * m_loader
Definition: RangeBlock.h:154
SWC::Ranger::Block::_split
Ptr _split(bool loaded)
Definition: RangeBlock.cc:357
SWC::Ranger::Block::_free_key_end
void _free_key_end()
Definition: RangeBlock.cc:91
SWC::Core::MutexAtomic::scope
Definition: MutexAtomic.h:77
SWC::Ranger::Block::scan
ScanState scan(const ReqScan::Ptr &req)
Definition: RangeBlock.cc:271
SWC::DB::Specs::Interval::is_in_previous
bool is_in_previous(const Types::KeySeq key_seq, const DB::Cell::Key &prev) const
Definition: SpecsInterval.h:352
SWC::Ranger::Block::~Block
~Block() noexcept
Definition: RangeBlock.cc:44
SWC::DB::Cells::Mutable::add_sorted
SWC_CAN_INLINE void add_sorted(const Cell &cell, bool no_value=false)
Definition: Mutable.h:413
SWC::DB::Cell::Key::empty
constexpr SWC_CAN_INLINE bool empty() const noexcept
Definition: CellKey.h:186
SWC::Ranger::Block::m_prev_key_end
DB::Cell::Key m_prev_key_end
Definition: RangeBlock.h:148
SWC::Core::AtomicBase::store
constexpr SWC_CAN_INLINE void store(T v) noexcept
Definition: Atomic.h:37
SWC::Error::OK
@ OK
Definition: Error.h:45
SWC::Condition::Comp
Comp
Definition: Comparators.h:27
SWC::Ranger::Block::Block
Block(const DB::Cells::Interval &interval, Blocks *blocks, State state=State::NONE)
Definition: RangeBlock.cc:22
SWC::System::Resources::more_mem_releasable
SWC_CAN_INLINE void more_mem_releasable(size_t sz) noexcept
Definition: Resources.h:114
SWC::DB::Cells::Mutable::scan
SWC_CAN_INLINE void scan(ReqScan *req) const
Definition: Mutable.h:544
SWC_CAN_INLINE
#define SWC_CAN_INLINE
Definition: Compat.h:102
SWC::Ranger::BlockLoader::error
int error
Definition: RangeBlockLoader.h:41
SWC::Ranger::Block::m_state
Core::Atomic< State > m_state
Definition: RangeBlock.h:153
SWC::Ranger::Blocks::processing_decrement
void processing_decrement()
Definition: RangeBlocks.cc:45
SWC::Ranger::Block::release
size_t release()
Definition: RangeBlock.cc:401
SWC::System::Resources::less_mem_releasable
SWC_CAN_INLINE void less_mem_releasable(size_t sz) noexcept
Definition: Resources.h:119
SWC::Ranger::Block::_cond_key_end
Condition::Comp _cond_key_end(const DB::Cell::Key &key) const
Definition: RangeBlock.cc:81
SWC::Ranger::Block::preload
void preload()
Definition: RangeBlock.cc:150
SWC_CURRENT_EXCEPTION
#define SWC_CURRENT_EXCEPTION(_msg_)
Definition: Exception.h:119
SWC::Ranger::Block::splitter
bool splitter(bool loaded)
Definition: RangeBlock.cc:267
SWC::Ranger::Block::ScanState
ScanState
Definition: RangeBlock.h:34
SWC
The SWC-DB C++ namespace 'SWC'.
Definition: main.cc:12
SWC::Ranger::Blocks::_split
bool _split(Block::Ptr blk, bool loaded)
Definition: RangeBlocks.cc:241
SWC::DB::Cells::Mutable::free
SWC_CAN_INLINE void free() noexcept
Definition: Mutable.h:157
SWC::DB::Cell::Key::size
uint32_t size
Definition: CellKey.h:256
SWC::Ranger::Block::m_mutex_intval
Core::MutexAtomic m_mutex_intval
Definition: RangeBlock.h:146
SWC::DB::Cell::Key::copy
void copy(const Key &other)
Definition: CellKey.h:314
SWC::System::Resources::adj_mem_releasable
SWC_CAN_INLINE void adj_mem_releasable(ssize_t sz) noexcept
Definition: Resources.h:124
SWC::Ranger::BlockLoader
Definition: RangeBlockLoader.h:19
SWC::Ranger::Block::size_of_internal
size_t size_of_internal()
Definition: RangeBlock.cc:480
SWC::DB::Types::MngrRange::QUEUED
@ QUEUED
Definition: MngrRangeState.h:21
SWC::Ranger::Block::m_cells
DB::Cells::Mutable m_cells
Definition: RangeBlock.h:143
SWC::DB::Specs::Interval::is_matching_begin
bool is_matching_begin(const Types::KeySeq key_seq, const DB::Cell::Key &key) const
Definition: SpecsInterval.h:265
SWC::DB::Cells::Mutable::empty
constexpr SWC_CAN_INLINE bool empty() const noexcept
Definition: Mutable.h:185
SWC::Ranger::Blocks::scan
void scan(ReqScan::Ptr req, Block::Ptr blk_ptr=nullptr)
Definition: RangeBlocks.cc:126
SWC::LOG_ERROR
@ LOG_ERROR
Definition: Logger.h:32
SWC::System::Resources::less_mem_future
SWC_CAN_INLINE void less_mem_future(size_t sz) noexcept
Definition: Resources.h:109
SWC::Ranger::Block::_includes_begin
bool _includes_begin(const DB::Specs::Interval &spec) const
Definition: RangeBlock.cc:138
SWC::Condition::NONE
@ NONE
Definition: Comparators.h:28
SWC::Ranger::Block::loaded
bool loaded() const noexcept
Definition: RangeBlock.cc:432
SWC::DB::Cells::Mutable::size_of_internal
constexpr SWC_CAN_INLINE size_t size_of_internal() const noexcept
Definition: Mutable.h:190
SWC::Core::AtomicBase::exchange
constexpr SWC_CAN_INLINE T exchange(T value) noexcept
Definition: Atomic.h:47
SWC::DB::Cells::Mutable::ttl
uint64_t ttl
Definition: Mutable.h:74
SWC::DB::Cells::Mutable::print
void print(std::ostream &out, bool with_cells=false) const
Definition: Mutable.cc:140
SWC::Ranger::Block::_size
size_t _size() const noexcept
Definition: RangeBlock.cc:469
Checksum.h
RangeBlocks.h
SWC::Ranger::ReqScanBlockLoader
Definition: ReqScan.h:97
SWC::DB::Cell::Key::free
SWC_CAN_INLINE void free() noexcept
Definition: CellKey.h:73
SWC::Ranger::Block::print
void print(std::ostream &out)
Definition: RangeBlock.cc:494
SWC::Ranger::Block::loader_loaded
void loader_loaded()
Definition: RangeBlock.cc:304
SWC::DB::Cells::Mutable::key_seq
const Types::KeySeq key_seq
Definition: Mutable.h:71
SWC::DB::Cells::Mutable::has_one_key
constexpr SWC_CAN_INLINE bool has_one_key() const noexcept
Definition: Mutable.h:218
SWC::DB::Specs::Interval
Definition: SpecsInterval.h:25
SWC::Ranger::BlockLoader::count_cs_blocks
size_t count_cs_blocks
Definition: RangeBlockLoader.h:23
SWC::Ranger::Block::m_mutex_state
Core::MutexSptd m_mutex_state
Definition: RangeBlock.h:151
SWC::Core::AtomicBase::load
constexpr SWC_CAN_INLINE T load() const noexcept
Definition: Atomic.h:42
SWC::DB::Types::MngrColumn::LOADING
@ LOADING
Definition: MngrColumnState.h:19
SWC::Ranger::Block::is_consist
bool is_consist(const DB::Cells::Interval &intval) const
Definition: RangeBlock.cc:96
SWC::Ranger::Block::_add
void _add(Ptr blk)
Definition: RangeBlock.cc:392
SWC::DB::Specs::Interval::offset_key
Cell::Key offset_key
Definition: SpecsInterval.h:244
SWC::Ranger::Block::_set_key_end
void _set_key_end(const DB::Cell::Key &key)
Definition: RangeBlock.cc:86
SWC::Ranger::Block::processing_decrement
void processing_decrement() noexcept
Definition: RangeBlock.cc:427
SWC::Ranger::Block::m_processing
Core::Atomic< size_t > m_processing
Definition: RangeBlock.h:152
SWC::Ranger::Blocks
Definition: RangeBlocks.h:23
SWC::DB::Cells::Mutable::finalize_raw
SWC_CAN_INLINE void finalize_raw()
Definition: Mutable.h:496
SWC::Ranger::Block::Ptr
Block * Ptr
Definition: RangeBlock.h:26
SWC::DB::Cells::MutableVec
Definition: MutableVec.h:20
SWC::Ranger::Block::need_load
bool need_load() const noexcept
Definition: RangeBlock.cc:437
SWC::DB::Cell::Key::print
void print(std::ostream &out) const
Definition: CellKey.cc:182
SWC::Ranger::Blocks::range
RangePtr range
Definition: RangeBlocks.h:29
SWC::Ranger::Block::operator=
Block & operator=(const Block &)=delete
SWC::Env::Rgr::post
static SWC_CAN_INLINE void post(T_Handler &&handler)
Definition: RangerEnv.h:114
SWC::DB::Cells::Mutable::size_bytes
constexpr SWC_CAN_INLINE size_t size_bytes() const noexcept
Definition: Mutable.h:180
SWC::DB::Cell::Key::move
void move(Key &other) noexcept
Definition: CellKey.h:302
SWC::Core::Atomic::fetch_sub
constexpr SWC_CAN_INLINE T fetch_sub(T v) noexcept
Definition: Atomic.h:88
SWC::DB::Cells::Interval
Definition: Interval.h:17
SWC::Core::Atomic::fetch_add
constexpr SWC_CAN_INLINE T fetch_add(T v) noexcept
Definition: Atomic.h:93
SWC::Ranger::BlockLoader::run
void run()
Definition: RangeBlockLoader.cc:83
SWC::DB::Cells::Mutable::split
SWC_CAN_INLINE bool split(Mutable &cells, size_t count, size_t bytes, bool loaded)
Definition: Mutable.h:583
SWC::Core::MutexSptd::try_full_lock
bool try_full_lock(bool &support) noexcept
Definition: MutexSptd.h:55
SWC::Ranger::ReqScan::Ptr
std::shared_ptr< ReqScan > Ptr
Definition: ReqScan.h:30
SWC::Ranger::Block::load_final
void load_final(const DB::Cells::MutableVec &cells)
Definition: RangeBlock.cc:190
SWC::Ranger::Block::_need_split
bool _need_split() const noexcept
Definition: RangeBlock.cc:486
SWC::Error::Exception
Definition: Exception.h:21
SWC::Ranger::Block::_releasing_size
size_t _releasing_size() const noexcept
Definition: RangeBlock.cc:51
SWC::DB::KeySeq::compare
Condition::Comp compare(const Types::KeySeq seq, const Cell::Key &key, const Cell::Key &other) SWC_ATTRIBS((SWC_ATTRIB_O3))
Definition: KeyComparator.h:294
SWC::Ranger::Block::split
Ptr split(bool loaded)
Definition: RangeBlock.cc:348
SWC::DB::Cells::Interval::key_begin
DB::Cell::Key key_begin
Definition: Interval.h:224
SWC::Ranger::Block::_set_prev_key_end
void _set_prev_key_end(const DB::Cell::Key &key)
Definition: RangeBlock.cc:71
RangeBlock.h