0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
Hypertable::Range Class Reference

Represents a table row range. More...

#include <Range.h>

Collaboration diagram for Hypertable::Range:
Collaboration graph
[legend]

Classes

class  MaintenanceData
 

Public Types

typedef std::map< String,
AccessGroupPtr
AccessGroupMap
 
typedef std::vector
< AccessGroupPtr
AccessGroupVector
 

Public Member Functions

 Range (Lib::Master::ClientPtr &, const TableIdentifier &, SchemaPtr &, const RangeSpec &, RangeSet *, const RangeState &, bool needs_compaction=false)
 
 Range (Lib::Master::ClientPtr &, SchemaPtr &, MetaLogEntityRangePtr &, RangeSet *)
 
virtual ~Range ()
 
void add (const Key &key, const ByteString value)
 This method must not fail. More...
 
void lock ()
 
void unlock ()
 
MetaLogEntityRangePtr metalog_entity ()
 
void create_scanner (ScanContextPtr &scan_ctx, MergeScannerRangePtr &scanner)
 
CellListScannercreate_scanner_pseudo_table (ScanContextPtr &scan_ctx, const String &table_name)
 Creates a scanner over the pseudo-table indicated by table_name. More...
 
void deferred_initialization ()
 
void deferred_initialization (uint32_t timeout_millis)
 
void deferred_initialization (std::chrono::fast_clock::time_point expire_time)
 
void get_boundary_rows (String &start, String &end)
 
String end_row ()
 
int64_t get_scan_revision (uint32_t timeout_ms)
 
void replay_transfer_log (CommitLogReader *commit_log_reader)
 Called before range has been flipped live so no locking needed. More...
 
MaintenanceDataget_maintenance_data (ByteArena &arena, time_t now, int flags, TableMutator *mutator=0)
 
void disable_maintenance ()
 
void enable_maintenance ()
 
void update_schema (SchemaPtr &schema)
 
void split ()
 
void relinquish ()
 
void compact (MaintenanceFlag::Map &subtask_map)
 
void purge_memory (MaintenanceFlag::Map &subtask_map)
 
void schedule_relinquish ()
 
bool get_relinquish () const
 
void recovery_initialize ()
 
void recovery_finalize ()
 This method is called when the range is offline so no locking is needed. More...
 
bool increment_update_counter ()
 
void decrement_update_counter ()
 
bool increment_scan_counter ()
 
void decrement_scan_counter ()
 
bool get_transfer_info (RangeTransferInfo &transfer_info, CommitLogPtr &transfer_log, int64_t *latest_revisionp, bool &wait_for_maintenance)
 
void add_read_data (uint64_t cells_scanned, uint64_t cells_returned, uint64_t bytes_scanned, uint64_t bytes_returned, uint64_t disk_bytes_read)
 
void add_bytes_written (uint64_t n)
 
void add_cells_written (uint64_t n)
 
bool need_maintenance ()
 
bool is_root ()
 
bool is_metadata ()
 
void drop ()
 
String get_name ()
 
int get_state ()
 
int32_t get_error ()
 
void set_needs_compaction (bool needs_compaction)
 
void set_compaction_type_needed (int compaction_type_needed)
 Sets type of compaction needed. More...
 
void acknowledge_load (uint32_t timeout_ms)
 
bool load_acknowledged ()
 
const std::string get_table_id ()
 Get table ID. More...
 

Private Member Functions

void initialize ()
 
void load_cell_stores ()
 
void split_install_log_rollback_metadata ()
 
bool cancel_maintenance ()
 
void relinquish_install_log ()
 
void relinquish_compact ()
 
void relinquish_finalize ()
 
bool estimate_split_row (CellList::SplitRowDataMapT &split_row_data, String &row)
 
void split_install_log ()
 
void split_compact_and_shrink ()
 
void split_notify_master ()
 

Private Attributes

uint64_t m_scans
 
uint64_t m_cells_scanned {}
 
uint64_t m_cells_returned {}
 
uint64_t m_cells_written {}
 
uint64_t m_updates {}
 
uint64_t m_bytes_scanned {}
 
uint64_t m_bytes_returned {}
 
uint64_t m_bytes_written {}
 
uint64_t m_disk_bytes_read {}
 
std::mutex m_mutex
 
std::mutex m_schema_mutex
 
Lib::Master::ClientPtr m_master_client
 
MetaLogEntityRangePtr m_metalog_entity
 
AccessGroupHintsFile m_hints_file
 
SchemaPtr m_schema
 
String m_name
 
TableIdentifier m_table
 
AccessGroupMap m_access_group_map
 
AccessGroupVector m_access_group_vector
 
std::vector< AccessGroupPtrm_column_family_vector
 
RangeMaintenanceGuard m_maintenance_guard
 
int64_t m_revision {TIMESTAMP_MIN}
 
int64_t m_latest_revision {TIMESTAMP_MIN}
 
int64_t m_split_threshold {}
 
String m_split_row
 
CommitLogPtr m_transfer_log
 
Barrier m_update_barrier
 
Barrier m_scan_barrier
 
bool m_split_off_high {}
 
bool m_is_root {}
 
bool m_is_metadata {}
 
bool m_unsplittable {}
 
uint64_t m_added_deletes [KEYSPEC_DELETE_MAX]
 
uint64_t m_added_inserts {}
 
RangeSetm_range_set
 
int32_t m_error {}
 
int m_compaction_type_needed {}
 
int64_t m_maintenance_generation {}
 
LoadMetricsRange m_load_metrics
 
bool m_dropped {}
 
bool m_capacity_exceeded_throttle {}
 
bool m_relinquish {}
 
bool m_initialized {}
 

Detailed Description

Represents a table row range.

Definition at line 69 of file Range.h.

Member Typedef Documentation

Definition at line 120 of file Range.h.

Definition at line 121 of file Range.h.

Constructor & Destructor Documentation

Range::Range ( Lib::Master::ClientPtr master_client,
const TableIdentifier identifier,
SchemaPtr schema,
const RangeSpec range,
RangeSet range_set,
const RangeState state,
bool  needs_compaction = false 
)

Definition at line 70 of file Range.cc.

Range::Range ( Lib::Master::ClientPtr master_client,
SchemaPtr schema,
MetaLogEntityRangePtr range_entity,
RangeSet range_set 
)

Definition at line 82 of file Range.cc.

virtual Hypertable::Range::~Range ( )
inlinevirtual

Definition at line 126 of file Range.h.

Member Function Documentation

void Range::acknowledge_load ( uint32_t  timeout_ms)

Definition at line 1708 of file Range.cc.

void Range::add ( const Key key,
const ByteString  value 
)

This method must not fail.

The caller assumes that it will succeed.

Definition at line 445 of file Range.cc.

void Hypertable::Range::add_bytes_written ( uint64_t  n)
inline

Definition at line 275 of file Range.h.

void Hypertable::Range::add_cells_written ( uint64_t  n)
inline

Definition at line 279 of file Range.h.

void Hypertable::Range::add_read_data ( uint64_t  cells_scanned,
uint64_t  cells_returned,
uint64_t  bytes_scanned,
uint64_t  bytes_returned,
uint64_t  disk_bytes_read 
)
inline

Definition at line 265 of file Range.h.

bool Range::cancel_maintenance ( )
private

Definition at line 555 of file Range.cc.

void Range::compact ( MaintenanceFlag::Map subtask_map)

Definition at line 1432 of file Range.cc.

void Range::create_scanner ( ScanContextPtr scan_ctx,
MergeScannerRangePtr scanner 
)

Definition at line 480 of file Range.cc.

CellListScanner * Range::create_scanner_pseudo_table ( ScanContextPtr scan_ctx,
const String table_name 
)

Creates a scanner over the pseudo-table indicated by table_name.

The following pseudo-tables are supported:

  • .cellstore.index

This method creates a CellListScannerBuffer and passes it into the AccessGroup::populate_cellstore_index_pseudo_table_scanner method of each one of its access groups AccessGroups, populating it with the pseudo-table cells.

Note
The scanner that is returned by this method will be owned by the caller and must be freed by the caller to prevent a memory leak.
Parameters
scan_ctxScanContext object
table_namePseudo-table name
Returns
Pointer to CellListScanner (to be freed by caller)

Definition at line 505 of file Range.cc.

void Hypertable::Range::decrement_scan_counter ( )
inline

Definition at line 229 of file Range.h.

void Hypertable::Range::decrement_update_counter ( )
inline

Definition at line 215 of file Range.h.

void Range::deferred_initialization ( )

Definition at line 179 of file Range.cc.

void Range::deferred_initialization ( uint32_t  timeout_millis)

Definition at line 193 of file Range.cc.

void Range::deferred_initialization ( std::chrono::fast_clock::time_point  expire_time)

Definition at line 204 of file Range.cc.

void Hypertable::Range::disable_maintenance ( )
inline

Definition at line 176 of file Range.h.

void Hypertable::Range::drop ( )
inline

Definition at line 289 of file Range.h.

void Hypertable::Range::enable_maintenance ( )
inline

Definition at line 180 of file Range.h.

String Hypertable::Range::end_row ( )
inline

Definition at line 165 of file Range.h.

bool Range::estimate_split_row ( CellList::SplitRowDataMapT split_row_data,
String row 
)
private

Definition at line 1086 of file Range.cc.

void Hypertable::Range::get_boundary_rows ( String start,
String end 
)
inline

Definition at line 161 of file Range.h.

int32_t Hypertable::Range::get_error ( )
inline

Definition at line 305 of file Range.h.

Range::MaintenanceData * Range::get_maintenance_data ( ByteArena arena,
time_t  now,
int  flags,
TableMutator mutator = 0 
)

Definition at line 561 of file Range.cc.

String Hypertable::Range::get_name ( )
inline

Definition at line 296 of file Range.h.

bool Hypertable::Range::get_relinquish ( ) const
inline

Definition at line 195 of file Range.h.

int64_t Range::get_scan_revision ( uint32_t  timeout_ms)

Definition at line 1699 of file Range.cc.

int Hypertable::Range::get_state ( )
inline

Definition at line 301 of file Range.h.

const std::string Hypertable::Range::get_table_id ( )
inline

Get table ID.

Returns
Table ID

Definition at line 334 of file Range.h.

bool Hypertable::Range::get_transfer_info ( RangeTransferInfo transfer_info,
CommitLogPtr transfer_log,
int64_t *  latest_revisionp,
bool &  wait_for_maintenance 
)
inline
Parameters
transfer_info
transfer_log
latest_revisionp
wait_for_maintenancetrue if this range has exceeded its capacity and future requests to this range need to be throttled till split/compaction reduces range size
Returns
true if transfer log installed

Definition at line 242 of file Range.h.

bool Hypertable::Range::increment_scan_counter ( )
inline

Definition at line 219 of file Range.h.

bool Hypertable::Range::increment_update_counter ( )
inline

Definition at line 205 of file Range.h.

void Range::initialize ( )
private

Determine split side

Definition at line 93 of file Range.cc.

bool Hypertable::Range::is_metadata ( )
inline

Definition at line 287 of file Range.h.

bool Hypertable::Range::is_root ( )
inline

Definition at line 285 of file Range.h.

bool Hypertable::Range::load_acknowledged ( )
inline

Definition at line 328 of file Range.h.

void Range::load_cell_stores ( )
private

Definition at line 263 of file Range.cc.

void Range::lock ( )

Definition at line 1612 of file Range.cc.

MetaLogEntityRangePtr Hypertable::Range::metalog_entity ( )
inline

Definition at line 132 of file Range.h.

bool Range::need_maintenance ( )

Definition at line 537 of file Range.cc.

void Range::purge_memory ( MaintenanceFlag::Map subtask_map)

Definition at line 1524 of file Range.cc.

void Range::recovery_finalize ( )

This method is called when the range is offline so no locking is needed.

Definition at line 1574 of file Range.cc.

void Hypertable::Range::recovery_initialize ( )
inline

Definition at line 197 of file Range.h.

void Range::relinquish ( )

Definition at line 660 of file Range.cc.

void Range::relinquish_compact ( )
private

Perform minor compactions

Definition at line 772 of file Range.cc.

void Range::relinquish_finalize ( )
private

Add the log removal task and remove range from RSML

Definition at line 823 of file Range.cc.

void Range::relinquish_install_log ( )
private

Persist RELINQUISH_LOG_INSTALLED Metalog state

Create and install the transfer log

Definition at line 712 of file Range.cc.

void Range::replay_transfer_log ( CommitLogReader commit_log_reader)

Called before range has been flipped live so no locking needed.

Definition at line 1641 of file Range.cc.

void Hypertable::Range::schedule_relinquish ( )
inline

Definition at line 194 of file Range.h.

void Hypertable::Range::set_compaction_type_needed ( int  compaction_type_needed)
inline

Sets type of compaction needed.

This method is different than set_needs_compaction() in that a type of cm

Definition at line 321 of file Range.h.

void Hypertable::Range::set_needs_compaction ( bool  needs_compaction)
inline

Definition at line 312 of file Range.h.

void Range::split ( )

Definition at line 896 of file Range.cc.

void Range::split_compact_and_shrink ( )
private

Perform major compactions

Shrink the range

Write existing hints file and new hints file. The hints array will have been setup by the call to shrink() for the existing range. The new_hints_file will get it's disk usage updated by subtracting the disk usage of the existing hints file from the original disk usage.

Create FS directories for this range

Persist SPLIT_SHRUNK MetaLog state

Definition at line 1128 of file Range.cc.

void Range::split_install_log ( )
private

Split row determination Algorithm:

TBD

Persist SPLIT_LOG_INSTALLED Metalog state

Create and install the transfer log

Definition at line 960 of file Range.cc.

void Range::split_install_log_rollback_metadata ( )
private

Definition at line 226 of file Range.cc.

void Range::split_notify_master ( )
private

NOTE: try the following crash and make sure that the master does not try to load the range twice.

Persist STEADY Metalog state and log removal task

Definition at line 1338 of file Range.cc.

void Range::unlock ( )

Definition at line 1621 of file Range.cc.

void Range::update_schema ( SchemaPtr schema)

Definition at line 387 of file Range.cc.

Member Data Documentation

AccessGroupMap Hypertable::Range::m_access_group_map
private

Definition at line 375 of file Range.h.

AccessGroupVector Hypertable::Range::m_access_group_vector
private

Definition at line 376 of file Range.h.

uint64_t Hypertable::Range::m_added_deletes[KEYSPEC_DELETE_MAX]
private

Definition at line 390 of file Range.h.

uint64_t Hypertable::Range::m_added_inserts {}
private

Definition at line 391 of file Range.h.

uint64_t Hypertable::Range::m_bytes_returned {}
private

Definition at line 363 of file Range.h.

uint64_t Hypertable::Range::m_bytes_scanned {}
private

Definition at line 362 of file Range.h.

uint64_t Hypertable::Range::m_bytes_written {}
private

Definition at line 364 of file Range.h.

bool Hypertable::Range::m_capacity_exceeded_throttle {}
private

Definition at line 398 of file Range.h.

uint64_t Hypertable::Range::m_cells_returned {}
private

Definition at line 359 of file Range.h.

uint64_t Hypertable::Range::m_cells_scanned {}
private

Definition at line 358 of file Range.h.

uint64_t Hypertable::Range::m_cells_written {}
private

Definition at line 360 of file Range.h.

std::vector<AccessGroupPtr> Hypertable::Range::m_column_family_vector
private

Definition at line 377 of file Range.h.

int Hypertable::Range::m_compaction_type_needed {}
private

Definition at line 394 of file Range.h.

uint64_t Hypertable::Range::m_disk_bytes_read {}
private

Definition at line 365 of file Range.h.

bool Hypertable::Range::m_dropped {}
private

Definition at line 397 of file Range.h.

int32_t Hypertable::Range::m_error {}
private

Definition at line 393 of file Range.h.

AccessGroupHintsFile Hypertable::Range::m_hints_file
private

Definition at line 371 of file Range.h.

bool Hypertable::Range::m_initialized {}
private

Definition at line 400 of file Range.h.

bool Hypertable::Range::m_is_metadata {}
private

Definition at line 388 of file Range.h.

bool Hypertable::Range::m_is_root {}
private

Definition at line 387 of file Range.h.

int64_t Hypertable::Range::m_latest_revision {TIMESTAMP_MIN}
private

Definition at line 380 of file Range.h.

LoadMetricsRange Hypertable::Range::m_load_metrics
private

Definition at line 396 of file Range.h.

int64_t Hypertable::Range::m_maintenance_generation {}
private

Definition at line 395 of file Range.h.

RangeMaintenanceGuard Hypertable::Range::m_maintenance_guard
private

Definition at line 378 of file Range.h.

Lib::Master::ClientPtr Hypertable::Range::m_master_client
private

Definition at line 369 of file Range.h.

MetaLogEntityRangePtr Hypertable::Range::m_metalog_entity
private

Definition at line 370 of file Range.h.

std::mutex Hypertable::Range::m_mutex
private

Definition at line 367 of file Range.h.

String Hypertable::Range::m_name
private

Definition at line 373 of file Range.h.

RangeSet* Hypertable::Range::m_range_set
private

Definition at line 392 of file Range.h.

bool Hypertable::Range::m_relinquish {}
private

Definition at line 399 of file Range.h.

int64_t Hypertable::Range::m_revision {TIMESTAMP_MIN}
private

Definition at line 379 of file Range.h.

Barrier Hypertable::Range::m_scan_barrier
private

Definition at line 385 of file Range.h.

uint64_t Hypertable::Range::m_scans
private

Definition at line 357 of file Range.h.

SchemaPtr Hypertable::Range::m_schema
private

Definition at line 372 of file Range.h.

std::mutex Hypertable::Range::m_schema_mutex
private

Definition at line 368 of file Range.h.

bool Hypertable::Range::m_split_off_high {}
private

Definition at line 386 of file Range.h.

String Hypertable::Range::m_split_row
private

Definition at line 382 of file Range.h.

int64_t Hypertable::Range::m_split_threshold {}
private

Definition at line 381 of file Range.h.

TableIdentifier Hypertable::Range::m_table
private

Definition at line 374 of file Range.h.

CommitLogPtr Hypertable::Range::m_transfer_log
private

Definition at line 383 of file Range.h.

bool Hypertable::Range::m_unsplittable {}
private

Definition at line 389 of file Range.h.

Barrier Hypertable::Range::m_update_barrier
private

Definition at line 384 of file Range.h.

uint64_t Hypertable::Range::m_updates {}
private

Definition at line 361 of file Range.h.


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