SWC-DB  v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
SWC::Manager::Rangers Class Referencefinal

#include <swcdb/manager/Rangers.h>

+ Collaboration diagram for SWC::Manager::Rangers:

Public Member Functions

 Rangers (const Comm::IoContextPtr &app_io)
 
 Rangers (const Rangers &)=delete
 
 Rangers (Rangers &&)=delete
 
Rangersoperator= (const Rangers &)=delete
 
Rangersoperator= (Rangers &&)=delete
 
 ~Rangers () noexcept
 
SWC_CAN_INLINE bool running () const noexcept
 
void stop (bool shuttingdown=true)
 
bool empty () noexcept
 
void schedule_check (uint32_t t_ms=10000)
 
void schedule_run ()
 
void rgr_report (rgrid_t rgrid, int err, const Comm::Protocol::Rgr::Params::Report::RspRes &rsp)
 
Ranger::Ptr rgr_get (const rgrid_t rgrid)
 
void rgr_get (const rgrid_t rgrid, Comm::EndPoints &endpoints)
 
void rgr_get (const Ranger::Ptr &rgr, Comm::EndPoints &endpoints)
 
void rgr_list (const rgrid_t rgrid, RangerList &rangers)
 
rgrid_t rgr_set_id (const Comm::EndPoints &endpoints, rgrid_t opt_rgrid=0)
 
bool rgr_ack_id (rgrid_t rgrid, const Comm::EndPoints &endpoints)
 
rgrid_t rgr_had_id (rgrid_t rgrid, const Comm::EndPoints &endpoints)
 
void rgr_shutdown (rgrid_t rgrid, const Comm::EndPoints &endpoints)
 
void sync ()
 
void update_status (const RangerList &new_rgr_status, bool sync_all)
 
void range_loaded (Ranger::Ptr rgr, Range::Ptr range, int64_t revision, int err, bool failure=false, bool verbose=true)
 
void assign_ranges ()
 
bool update (const Column::Ptr &col, const DB::Schema::Ptr &schema, uint64_t req_id, bool ack_required)
 
void column_delete (const DB::Schema::Ptr &schema, uint64_t req_id, const Core::Vector< rgrid_t > &rgrids)
 
void column_compact (const Column::Ptr &col)
 
void need_health_check (const Column::Ptr &col)
 
void health_check_finished (const ColumnHealthCheck::Ptr &chk)
 
void wait_health_check (cid_t cid=DB::Schema::NO_CID)
 
void print (std::ostream &out)
 

Public Attributes

const Config::Property::Value_uint16_g::Ptr cfg_rgr_failures
 
const Config::Property::Value_int32_g::Ptr cfg_delay_rgr_chg
 
const Config::Property::Value_int32_g::Ptr cfg_chk_assign
 
const Config::Property::Value_int32_g::Ptr cfg_assign_due
 
const Config::Property::Value_int32_g::Ptr cfg_column_health_chk
 
const Config::Property::Value_int32_g::Ptr cfg_column_health_chkers
 
const Config::Property::Value_int32_g::Ptr cfg_column_health_chkers_delay
 

Private Member Functions

void assign_ranges_run ()
 
void next_rgr (const Range::Ptr &range, Ranger::Ptr &rgr_set)
 
void health_check_columns ()
 
Ranger::Ptr rgr_set (const Comm::EndPoints &endpoints, rgrid_t opt_rgrid=0)
 
void changes (const RangerList &hosts, bool sync_all=false)
 
void _changes (const RangerList &hosts, bool sync_all=false)
 

Private Attributes

Core::AtomicBool m_run
 
Core::MutexSptd m_mutex
 
asio::high_resolution_timer m_timer
 
RangerList m_rangers
 
RangersResources m_rangers_resources
 
Core::StateRunning m_assign
 
Core::Atomic< int32_t > m_assignments
 
Core::MutexSptd m_mutex_columns_check
 
ColumnHealthChecks m_columns_check
 
int64_t m_columns_check_ts
 

Detailed Description

Definition at line 18 of file Rangers.h.

Constructor & Destructor Documentation

◆ Rangers() [1/3]

SWC::Manager::Rangers::Rangers ( const Comm::IoContextPtr app_io)

Definition at line 25 of file Rangers.cc.

◆ Rangers() [2/3]

SWC::Manager::Rangers::Rangers ( const Rangers )
delete

◆ Rangers() [3/3]

SWC::Manager::Rangers::Rangers ( Rangers &&  )
delete

◆ ~Rangers()

SWC::Manager::Rangers::~Rangers ( )
inlinenoexcept

Definition at line 37 of file Rangers.h.

Member Function Documentation

◆ _changes()

void SWC::Manager::Rangers::_changes ( const RangerList hosts,
bool  sync_all = false 
)
private

Definition at line 766 of file Rangers.cc.

References SWC::Core::Vector< T, SizeT, GROW_SZ >::cbegin(), SWC::Core::Vector< T, SizeT, GROW_SZ >::cend(), SWC::Core::Vector< T, SizeT, GROW_SZ >::empty(), SWC::Condition::from(), SWC::LOG_DEBUG, SWC::Manager::MngrRole::req_mngr_inchain(), SWC::Env::Mngr::role(), SWC_LOG_OSTREAM, and SWC_LOG_OUT.

Referenced by changes(), and next_rgr().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ assign_ranges()

void SWC::Manager::Rangers::assign_ranges ( )

Definition at line 544 of file Rangers.cc.

References assign_ranges_run(), cfg_assign_due, SWC::Config::Property::Value_int32_g::get(), m_assign, m_assignments, m_run, SWC::Env::Mngr::mngd_columns(), SWC::Env::Mngr::post(), SWC::Core::StateRunning::running(), schedule_check(), and SWC_CAN_INLINE.

Referenced by SWC::Manager::ColumnHealthCheck::ColumnMerger::RangesMerger::handle(), SWC::Manager::ColumnHealthCheck::RangerCheck::handle(), range_loaded(), SWC::Comm::Protocol::Mngr::Handler::range_unloaded(), schedule_run(), SWC::Comm::Protocol::Rgr::Req::RangeUnload::unloaded(), and SWC::Manager::MngdColumns::update_status().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ assign_ranges_run()

void SWC::Manager::Rangers::assign_ranges_run ( )
private

Definition at line 559 of file Rangers.cc.

References SWC::Core::Atomic< T, OrderT >::add_rslt(), cfg_assign_due, cfg_chk_assign, SWC::Env::Mngr::columns(), SWC::Core::Vector< T, SizeT, GROW_SZ >::empty(), SWC::Config::Property::Value_int32_g::get(), SWC::LOG_DEBUG, m_assign, m_assignments, m_mutex, m_rangers, m_run, next_rgr(), SWC::Error::OK, schedule_check(), SWC::Env::Mngr::schemas(), SWC::Core::StateRunning::stop(), SWC_FMT_LU, and SWC_LOGF.

Referenced by assign_ranges().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ changes()

void SWC::Manager::Rangers::changes ( const RangerList hosts,
bool  sync_all = false 
)
private

Definition at line 756 of file Rangers.cc.

References _changes(), cfg_delay_rgr_chg, SWC::Config::Property::Value_int32_g::get(), m_mutex, SWC::Env::Mngr::mngd_columns(), and schedule_check().

Referenced by range_loaded(), rgr_ack_id(), rgr_report(), rgr_shutdown(), sync(), and update_status().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ column_compact()

void SWC::Manager::Rangers::column_compact ( const Column::Ptr col)

Definition at line 481 of file Rangers.cc.

References SWC::DB::Types::MngrRangerState::ACK, cfg_rgr_failures, SWC::Config::Property::Value_uint16_g::get(), m_mutex, and m_rangers.

Referenced by SWC::Comm::Protocol::Mngr::Handler::column_compact().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ column_delete()

void SWC::Manager::Rangers::column_delete ( const DB::Schema::Ptr schema,
uint64_t  req_id,
const Core::Vector< rgrid_t > &  rgrids 
)

Definition at line 467 of file Rangers.cc.

References m_mutex, and m_rangers.

Referenced by SWC::Manager::MngdColumns::update_status().

+ Here is the caller graph for this function:

◆ empty()

SWC_CAN_INLINE bool SWC::Manager::Rangers::empty ( )
noexcept

Definition at line 85 of file Rangers.cc.

References SWC::Core::Vector< T, SizeT, GROW_SZ >::empty(), m_mutex, and m_rangers.

+ Here is the call graph for this function:

◆ health_check_columns()

void SWC::Manager::Rangers::health_check_columns ( )
private

◆ health_check_finished()

void SWC::Manager::Rangers::health_check_finished ( const ColumnHealthCheck::Ptr chk)

Definition at line 510 of file Rangers.cc.

References SWC::Core::Vector< T, SizeT, GROW_SZ >::cbegin(), SWC::Core::Vector< T, SizeT, GROW_SZ >::cend(), SWC::Core::Vector< T, SizeT, GROW_SZ >::erase(), health_check_columns(), m_columns_check, and m_mutex_columns_check.

Referenced by SWC::Manager::ColumnHealthCheck::ColumnMerger::completion(), SWC::Manager::ColumnHealthCheck::finishing(), SWC::Manager::ColumnHealthCheck::ColumnMerger::run(), and SWC::Manager::ColumnHealthCheck::ColumnMerger::run_master().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ need_health_check()

void SWC::Manager::Rangers::need_health_check ( const Column::Ptr col)

Definition at line 497 of file Rangers.cc.

References SWC::Core::Vector< T, SizeT, GROW_SZ >::cbegin(), SWC::Core::Vector< T, SizeT, GROW_SZ >::cend(), health_check_columns(), m_columns_check, and m_mutex_columns_check.

+ Here is the call graph for this function:

◆ next_rgr()

void SWC::Manager::Rangers::next_rgr ( const Range::Ptr range,
Ranger::Ptr rgr_set 
)
private

Definition at line 610 of file Rangers.cc.

References _changes(), SWC::DB::Types::MngrRangerState::ACK, cfg_rgr_failures, SWC::Env::Mngr::columns(), SWC::Core::Vector< T, SizeT, GROW_SZ >::empty(), SWC::DB::RgrData::endpoints, SWC::Config::Property::Value_uint16_g::get(), SWC::Comm::has_endpoint(), SWC::DB::Types::SystemColumn::is_data(), SWC::Env::Mngr::is_shuttingdown(), m_mutex, m_rangers, SWC::DB::Types::MngrRangerState::MARKED_OFFLINE, SWC::Core::Vector< T, SizeT, GROW_SZ >::push_back(), SWC::Manager::Columns::set_rgr_unassigned(), and SWC::DB::Types::MngrRangerState::SHUTTINGDOWN.

Referenced by assign_ranges_run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator=() [1/2]

Rangers& SWC::Manager::Rangers::operator= ( const Rangers )
delete

Referenced by health_check_columns().

+ Here is the caller graph for this function:

◆ operator=() [2/2]

Rangers& SWC::Manager::Rangers::operator= ( Rangers &&  )
delete

◆ print()

void SWC::Manager::Rangers::print ( std::ostream &  out)

Definition at line 537 of file Rangers.cc.

References m_mutex, and m_rangers.

◆ range_loaded()

void SWC::Manager::Rangers::range_loaded ( Ranger::Ptr  rgr,
Range::Ptr  range,
int64_t  revision,
int  err,
bool  failure = false,
bool  verbose = true 
)

Definition at line 403 of file Rangers.cc.

References SWC::DB::Types::MngrRangerState::ACK, assign_ranges(), cfg_assign_due, changes(), SWC::Core::Atomic< T, OrderT >::fetch_sub(), SWC::Config::Property::Value_int32_g::get(), SWC::LOG_DEBUG, m_assignments, SWC::Error::print(), SWC::Core::Vector< T, SizeT, GROW_SZ >::push_back(), schedule_check(), SWC::Error::SERVER_SHUTTING_DOWN, SWC::DB::Types::MngrRangerState::SHUTTINGDOWN, SWC_LOG_OSTREAM, and SWC_LOG_OUT.

Referenced by SWC::Comm::Protocol::Rgr::Req::RangeLoad::loaded().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rgr_ack_id()

bool SWC::Manager::Rangers::rgr_ack_id ( rgrid_t  rgrid,
const Comm::EndPoints endpoints 
)

Definition at line 206 of file Rangers.cc.

References SWC::DB::Types::MngrRangerState::ACK, changes(), SWC::Comm::has_endpoint(), m_mutex, m_rangers, SWC::Core::Vector< T, SizeT, GROW_SZ >::push_back(), and schedule_check().

+ Here is the call graph for this function:

◆ rgr_get() [1/3]

void SWC::Manager::Rangers::rgr_get ( const Ranger::Ptr rgr,
Comm::EndPoints endpoints 
)

Definition at line 185 of file Rangers.cc.

References m_mutex.

◆ rgr_get() [2/3]

Ranger::Ptr SWC::Manager::Rangers::rgr_get ( const rgrid_t  rgrid)

Definition at line 164 of file Rangers.cc.

References m_mutex, and m_rangers.

Referenced by SWC::Comm::Protocol::Rgr::Req::ColumnsUnload::handle(), SWC::Comm::Protocol::Mngr::Handler::rgr_get(), SWC::Manager::ColumnHealthCheck::ColumnMerger::RangesMerger::run(), and SWC::Manager::ColumnHealthCheck::run().

+ Here is the caller graph for this function:

◆ rgr_get() [3/3]

SWC_CAN_INLINE void SWC::Manager::Rangers::rgr_get ( const rgrid_t  rgrid,
Comm::EndPoints endpoints 
)

Definition at line 174 of file Rangers.cc.

References SWC::DB::Types::MngrRangerState::ACK, m_mutex, and m_rangers.

◆ rgr_had_id()

rgrid_t SWC::Manager::Rangers::rgr_had_id ( rgrid_t  rgrid,
const Comm::EndPoints endpoints 
)

Definition at line 236 of file Rangers.cc.

References SWC::Comm::has_endpoint(), m_mutex, m_rangers, and rgr_set_id().

+ Here is the call graph for this function:

◆ rgr_list()

void SWC::Manager::Rangers::rgr_list ( const rgrid_t  rgrid,
RangerList rangers 
)

Definition at line 190 of file Rangers.cc.

References m_mutex, m_rangers, and SWC::Core::Vector< T, SizeT, GROW_SZ >::push_back().

+ Here is the call graph for this function:

◆ rgr_report()

◆ rgr_set()

Ranger::Ptr SWC::Manager::Rangers::rgr_set ( const Comm::EndPoints endpoints,
rgrid_t  opt_rgrid = 0 
)
private

Definition at line 699 of file Rangers.cc.

References SWC::DB::Types::MngrRangerState::ACK, SWC::Core::Vector< T, SizeT, GROW_SZ >::begin(), SWC::Core::Vector< T, SizeT, GROW_SZ >::cend(), SWC::Env::Mngr::columns(), SWC::Core::Vector< T, SizeT, GROW_SZ >::emplace_back(), SWC::Comm::equal_endpoints(), SWC::Core::Vector< T, SizeT, GROW_SZ >::erase(), SWC::Comm::has_endpoint(), m_mutex, m_rangers, and SWC::Manager::Columns::set_rgr_unassigned().

Referenced by rgr_set_id().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rgr_set_id()

rgrid_t SWC::Manager::Rangers::rgr_set_id ( const Comm::EndPoints endpoints,
rgrid_t  opt_rgrid = 0 
)

Definition at line 201 of file Rangers.cc.

References rgr_set().

Referenced by rgr_had_id().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rgr_shutdown()

void SWC::Manager::Rangers::rgr_shutdown ( rgrid_t  rgrid,
const Comm::EndPoints endpoints 
)

◆ running()

SWC_CAN_INLINE bool SWC::Manager::Rangers::running ( ) const
inlinenoexcept

Definition at line 40 of file Rangers.h.

References m_run.

Referenced by SWC::Comm::Protocol::Rgr::Req::RangeUnoadForMerge::handle(), SWC::Comm::Protocol::Rgr::Req::RangeIsLoaded::valid(), SWC::Comm::Protocol::Rgr::Req::RangeLoad::valid(), SWC::Comm::Protocol::Rgr::Req::RangeUnload::valid(), and SWC::Comm::Protocol::Rgr::Req::RangeUnoadForMerge::valid().

+ Here is the caller graph for this function:

◆ schedule_check()

void SWC::Manager::Rangers::schedule_check ( uint32_t  t_ms = 10000)

Definition at line 90 of file Rangers.cc.

References SWC::LOG_DEBUG, m_mutex, m_run, m_timer, schedule_run(), SWC_CAN_INLINE, and SWC_LOGF.

Referenced by SWC::Manager::MngrRole::apply_role_changes(), assign_ranges(), assign_ranges_run(), SWC::Manager::MngdColumns::change_active(), changes(), health_check_columns(), range_loaded(), rgr_ack_id(), rgr_shutdown(), and schedule_run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ schedule_run()

void SWC::Manager::Rangers::schedule_run ( )

Definition at line 118 of file Rangers.cc.

References assign_ranges(), cfg_column_health_chk, SWC::Manager::RangersResources::check(), SWC::Config::Property::Value_int32_g::get(), health_check_columns(), m_mutex, m_rangers, m_rangers_resources, SWC::Env::Mngr::mngd_columns(), SWC::DB::Types::MngrRole::RANGERS, SWC::Env::Mngr::role(), and schedule_check().

Referenced by schedule_check().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ stop()

void SWC::Manager::Rangers::stop ( bool  shuttingdown = true)

Definition at line 55 of file Rangers.cc.

References SWC::Core::Vector< T, SizeT, GROW_SZ >::cbegin(), SWC::Core::Vector< T, SizeT, GROW_SZ >::empty(), SWC::Core::Vector< T, SizeT, GROW_SZ >::erase(), SWC::Core::Vector< T, SizeT, GROW_SZ >::front(), SWC::LOG_INFO, m_assign, m_mutex, m_rangers, m_run, m_timer, SWC::Core::StateRunning::running(), SWC::Core::StateRunning::stop(), SWC::Core::AtomicBase< T, OrderT >::store(), SWC_LOG, and wait_health_check().

Referenced by SWC::Manager::MngrRole::apply_role_changes(), and SWC::Manager::MngrRole::stop().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sync()

SWC_CAN_INLINE void SWC::Manager::Rangers::sync ( )

Definition at line 277 of file Rangers.cc.

References changes(), and m_rangers.

Referenced by SWC::Manager::MngdColumns::require_sync().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

bool SWC::Manager::Rangers::update ( const Column::Ptr col,
const DB::Schema::Ptr schema,
uint64_t  req_id,
bool  ack_required 
)

Definition at line 442 of file Rangers.cc.

References SWC::DB::Types::MngrRangerState::ACK, cfg_rgr_failures, SWC::Config::Property::Value_uint16_g::get(), m_mutex, and m_rangers.

Referenced by SWC::Manager::MngdColumns::update_status().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update_status()

◆ wait_health_check()

void SWC::Manager::Rangers::wait_health_check ( cid_t  cid = DB::Schema::NO_CID)

Definition at line 521 of file Rangers.cc.

References SWC::Core::Vector< T, SizeT, GROW_SZ >::cbegin(), SWC::Core::Vector< T, SizeT, GROW_SZ >::cend(), m_columns_check, m_mutex_columns_check, and SWC::DB::SchemaPrimitives::NO_CID.

Referenced by SWC::Manager::MngdColumns::remove(), and stop().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ cfg_assign_due

const Config::Property::Value_int32_g::Ptr SWC::Manager::Rangers::cfg_assign_due

Definition at line 24 of file Rangers.h.

Referenced by assign_ranges(), assign_ranges_run(), and range_loaded().

◆ cfg_chk_assign

const Config::Property::Value_int32_g::Ptr SWC::Manager::Rangers::cfg_chk_assign

Definition at line 23 of file Rangers.h.

Referenced by assign_ranges_run().

◆ cfg_column_health_chk

const Config::Property::Value_int32_g::Ptr SWC::Manager::Rangers::cfg_column_health_chk

Definition at line 26 of file Rangers.h.

Referenced by health_check_columns(), and schedule_run().

◆ cfg_column_health_chkers

const Config::Property::Value_int32_g::Ptr SWC::Manager::Rangers::cfg_column_health_chkers

Definition at line 27 of file Rangers.h.

Referenced by health_check_columns().

◆ cfg_column_health_chkers_delay

const Config::Property::Value_int32_g::Ptr SWC::Manager::Rangers::cfg_column_health_chkers_delay

Definition at line 28 of file Rangers.h.

Referenced by health_check_columns().

◆ cfg_delay_rgr_chg

const Config::Property::Value_int32_g::Ptr SWC::Manager::Rangers::cfg_delay_rgr_chg

Definition at line 22 of file Rangers.h.

Referenced by changes().

◆ cfg_rgr_failures

const Config::Property::Value_uint16_g::Ptr SWC::Manager::Rangers::cfg_rgr_failures

Definition at line 21 of file Rangers.h.

Referenced by column_compact(), next_rgr(), rgr_report(), and update().

◆ m_assign

Core::StateRunning SWC::Manager::Rangers::m_assign
private

Definition at line 120 of file Rangers.h.

Referenced by assign_ranges(), assign_ranges_run(), and stop().

◆ m_assignments

Core::Atomic<int32_t> SWC::Manager::Rangers::m_assignments
private

Definition at line 121 of file Rangers.h.

Referenced by assign_ranges(), assign_ranges_run(), and range_loaded().

◆ m_columns_check

ColumnHealthChecks SWC::Manager::Rangers::m_columns_check
private

◆ m_columns_check_ts

int64_t SWC::Manager::Rangers::m_columns_check_ts
private

Definition at line 125 of file Rangers.h.

Referenced by health_check_columns().

◆ m_mutex

◆ m_mutex_columns_check

Core::MutexSptd SWC::Manager::Rangers::m_mutex_columns_check
private

◆ m_rangers

◆ m_rangers_resources

RangersResources SWC::Manager::Rangers::m_rangers_resources
private

Definition at line 118 of file Rangers.h.

Referenced by rgr_report(), and schedule_run().

◆ m_run

Core::AtomicBool SWC::Manager::Rangers::m_run
private

◆ m_timer

asio::high_resolution_timer SWC::Manager::Rangers::m_timer
private

Definition at line 116 of file Rangers.h.

Referenced by schedule_check(), and stop().


The documentation for this class was generated from the following files: