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

Access group. More...

#include <AccessGroup.h>

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

Classes

class  CellStoreMaintenanceData
 
class  Hints
 
class  MaintenanceData
 

Public Member Functions

 AccessGroup (const TableIdentifier *identifier, SchemaPtr &schema, AccessGroupSpec *ag_spec, const RangeSpec *range, const Hints *hints=nullptr)
 
void add (const Key &key, const ByteString value)
 Adds a key/value pair. More...
 
void split_row_estimate_data_cached (CellList::SplitRowDataMapT &split_row_data)
 
void split_row_estimate_data_stored (CellList::SplitRowDataMapT &split_row_data)
 
void populate_cellstore_index_pseudo_table_scanner (CellListScannerBuffer *scanner)
 Populates scanner with data for .cellstore.index pseudo table. More...
 
void update_schema (SchemaPtr &schema, AccessGroupSpec *ag_spec)
 Currently supports only adding and deleting column families from AccessGroup. More...
 
void lock ()
 
void unlock ()
 
MergeScannerAccessGroupcreate_scanner (ScanContext *scan_ctx)
 
bool include_in_scan (ScanContext *scan_ctx)
 
uint64_t disk_usage ()
 
uint64_t memory_usage ()
 
void space_usage (int64_t *memp, int64_t *diskp)
 
void load_cellstore (CellStorePtr &cellstore)
 
void pre_load_cellstores ()
 
void post_load_cellstores ()
 
void measure_garbage (double *total, double *garbage)
 
void run_compaction (int maintenance_flags, Hints *hints)
 
uint64_t purge_memory (MaintenanceFlag::Map &subtask_map)
 
MaintenanceDataget_maintenance_data (ByteArena &arena, time_t now, int flags)
 
void stage_compaction ()
 
void unstage_compaction ()
 
const char * get_name ()
 
const char * get_full_name ()
 
void shrink (String &split_row, bool drop_high, Hints *hints)
 
void get_file_data (String &file_list, int64_t *block_countp, bool include_blocked)
 
void release_files (const std::vector< String > &files)
 
void recovery_initialize ()
 
void recovery_finalize ()
 
void dump_keys (std::ofstream &out)
 
void dump_garbage_tracker_statistics (std::ofstream &out)
 Prints human-readable representation of garbage tracker state to an output stream. More...
 
void set_next_csid (uint32_t nid)
 
void load_hints (Hints *hints)
 
String describe ()
 

Private Member Functions

void purge_stored_cells_from_cache ()
 
void merge_caches ()
 Assumes mutex is locked. More...
 
void range_dir_initialize ()
 
void recompute_compression_ratio (int64_t *total_index_entriesp=0)
 
bool find_merge_run (size_t *indexp=0, size_t *lenp=0)
 
void get_merge_info (bool &needs_merging, bool &end_merge)
 Gets merging compaction information. More...
 
void sort_cellstores_by_timestamp ()
 

Private Attributes

std::mutex m_mutex
 
std::mutex m_schema_mutex
 
std::mutex m_outstanding_scanner_mutex
 
std::condition_variable m_outstanding_scanner_cond
 
int32_t m_outstanding_scanner_count
 
TableIdentifierManaged m_identifier
 
SchemaPtr m_schema
 
std::set< uint8_t > m_column_families
 
String m_name
 
String m_full_name
 
String m_table_name
 
String m_range_dir
 
String m_start_row
 
String m_end_row
 
String m_range_name
 
std::vector< CellStoreInfom_stores
 
PropertiesPtr m_cellstore_props
 
CellCacheManagerPtr m_cell_cache_manager
 
uint32_t m_next_cs_id {}
 
uint64_t m_disk_usage {}
 
float m_compression_ratio {1.0}
 
int64_t m_earliest_cached_revision {TIMESTAMP_MAX}
 
int64_t m_earliest_cached_revision_saved {TIMESTAMP_MAX}
 
int64_t m_latest_stored_revision {TIMESTAMP_MIN}
 
int64_t m_latest_stored_revision_hint {TIMESTAMP_MIN}
 
LiveFileTracker m_file_tracker
 
AccessGroupGarbageTracker m_garbage_tracker
 
bool m_is_root {}
 
bool m_in_memory {}
 
bool m_recovering {}
 
bool m_needs_merging {}
 
bool m_end_merge {}
 
bool m_dirty {}
 
bool m_cellcache_needs_compaction {}
 

Detailed Description

Access group.

Definition at line 65 of file AccessGroup.h.

Constructor & Destructor Documentation

AccessGroup::AccessGroup ( const TableIdentifier identifier,
SchemaPtr schema,
AccessGroupSpec ag_spec,
const RangeSpec range,
const Hints hints = nullptr 
)

Definition at line 57 of file AccessGroup.cc.

Member Function Documentation

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

Adds a key/value pair.

This should be called with the CellCache locked Also, at the end of compaction processing, when m_cell_cache gets reset to a new value, the CellCache should be locked as well.

Parameters
keyKey
valueValue

Definition at line 153 of file AccessGroup.cc.

MergeScannerAccessGroup * AccessGroup::create_scanner ( ScanContext scan_ctx)

Definition at line 187 of file AccessGroup.cc.

String AccessGroup::describe ( )

Definition at line 854 of file AccessGroup.cc.

uint64_t AccessGroup::disk_usage ( )

Definition at line 300 of file AccessGroup.cc.

void AccessGroup::dump_garbage_tracker_statistics ( std::ofstream &  out)

Prints human-readable representation of garbage tracker state to an output stream.

This function prints the state of the garbage tracker to out by calling AccessGroupGarbageTracker::output_state() with the line prefix label being the fully qualified name of the access group.

Parameters
outOutput stream on which to print state

Definition at line 1248 of file AccessGroup.cc.

void AccessGroup::dump_keys ( std::ofstream &  out)

Definition at line 1222 of file AccessGroup.cc.

bool AccessGroup::find_merge_run ( size_t *  indexp = 0,
size_t *  lenp = 0 
)
private

Definition at line 1126 of file AccessGroup.cc.

void Hypertable::AccessGroup::get_file_data ( String file_list,
int64_t *  block_countp,
bool  include_blocked 
)
inline

Definition at line 211 of file AccessGroup.h.

const char* Hypertable::AccessGroup::get_full_name ( )
inline

Definition at line 207 of file AccessGroup.h.

AccessGroup::MaintenanceData * AccessGroup::get_maintenance_data ( ByteArena arena,
time_t  now,
int  flags 
)

Definition at line 344 of file AccessGroup.cc.

void Hypertable::AccessGroup::get_merge_info ( bool &  needs_merging,
bool &  end_merge 
)
inlineprivate

Gets merging compaction information.

Determines whether or not a merging compaction is needed, and if so, whether or not the "merge run" includes the end cell store (the one containing the most recent data) and therefore the cell cache can be included in the merging compaction.

Parameters
needs_mergingSet to true if merge is needed
end_mergeSet to true if merge run includes end cell store

Definition at line 258 of file AccessGroup.h.

const char* Hypertable::AccessGroup::get_name ( )
inline

Definition at line 205 of file AccessGroup.h.

bool AccessGroup::include_in_scan ( ScanContext scan_ctx)

Definition at line 268 of file AccessGroup.cc.

void AccessGroup::load_cellstore ( CellStorePtr cellstore)

Definition at line 436 of file AccessGroup.cc.

void AccessGroup::load_hints ( Hints hints)

Definition at line 846 of file AccessGroup.cc.

void Hypertable::AccessGroup::lock ( )
inline

Definition at line 159 of file AccessGroup.h.

void AccessGroup::measure_garbage ( double *  total,
double *  garbage 
)

Definition at line 458 of file AccessGroup.cc.

uint64_t AccessGroup::memory_usage ( )

Definition at line 307 of file AccessGroup.cc.

void AccessGroup::merge_caches ( )
private

Assumes mutex is locked.

Definition at line 1045 of file AccessGroup.cc.

void AccessGroup::populate_cellstore_index_pseudo_table_scanner ( CellListScannerBuffer scanner)

Populates scanner with data for .cellstore.index pseudo table.

For each CellStore that is part of the access group, the CellStore::populate_index_pseudo_table_scanner method is called with scanner to gather .cellstore.index pseudo table data.

Parameters
scannerPointer to CellListScannerBuffer to hold data

Definition at line 293 of file AccessGroup.cc.

void Hypertable::AccessGroup::post_load_cellstores ( )
inline

Definition at line 183 of file AccessGroup.h.

void Hypertable::AccessGroup::pre_load_cellstores ( )
inline

Definition at line 178 of file AccessGroup.h.

uint64_t AccessGroup::purge_memory ( MaintenanceFlag::Map subtask_map)

Definition at line 320 of file AccessGroup.cc.

void AccessGroup::purge_stored_cells_from_cache ( )
private

Definition at line 867 of file AccessGroup.cc.

void AccessGroup::range_dir_initialize ( )
private

HT_INFOF("Just initialized %s[%s..%s](%s) (pid=%d) to ID %u", m_table_name.c_str(), m_start_row.c_str(), m_end_row.c_str(), m_name.c_str(), (int)getpid(), (unsigned)m_next_cs_id);

Definition at line 1061 of file AccessGroup.cc.

void AccessGroup::recompute_compression_ratio ( int64_t *  total_index_entriesp = 0)
private

Definition at line 1106 of file AccessGroup.cc.

void Hypertable::AccessGroup::recovery_finalize ( )
inline

Definition at line 218 of file AccessGroup.h.

void Hypertable::AccessGroup::recovery_initialize ( )
inline

Definition at line 217 of file AccessGroup.h.

void AccessGroup::release_files ( const std::vector< String > &  files)

Definition at line 1009 of file AccessGroup.cc.

void AccessGroup::run_compaction ( int  maintenance_flags,
Hints hints 
)

Check for garbage and if threshold reached, change minor to major compaction. If GC compaction was requested and garbage threshold is not reached, skip compaction.

Install new CellCache and CellStore and update Live file tracker

Drop the compacted CellStores from the stores vector

Add the new cell store to the table vector, or delete it if it contains no entries

Definition at line 487 of file AccessGroup.cc.

void Hypertable::AccessGroup::set_next_csid ( uint32_t  nid)
inline

Definition at line 230 of file AccessGroup.h.

void AccessGroup::shrink ( String split_row,
bool  drop_high,
Hints hints 
)

Shrink the CellCache

Definition at line 899 of file AccessGroup.cc.

void AccessGroup::sort_cellstores_by_timestamp ( )
private

Definition at line 1217 of file AccessGroup.cc.

void AccessGroup::space_usage ( int64_t *  memp,
int64_t *  diskp 
)

Definition at line 312 of file AccessGroup.cc.

void AccessGroup::split_row_estimate_data_cached ( CellList::SplitRowDataMapT split_row_data)

Definition at line 279 of file AccessGroup.cc.

void AccessGroup::split_row_estimate_data_stored ( CellList::SplitRowDataMapT split_row_data)

Definition at line 285 of file AccessGroup.cc.

void AccessGroup::stage_compaction ( )

Definition at line 1021 of file AccessGroup.cc.

void Hypertable::AccessGroup::unlock ( )
inline

Definition at line 164 of file AccessGroup.h.

void AccessGroup::unstage_compaction ( )

Definition at line 1036 of file AccessGroup.cc.

void AccessGroup::update_schema ( SchemaPtr schema,
AccessGroupSpec ag_spec 
)

Currently supports only adding and deleting column families from AccessGroup.

Changing other attributes of existing AccessGroup is not supported. Schema is only updated if the new schema has a more recent generation number than the existing schema.

Definition at line 98 of file AccessGroup.cc.

Member Data Documentation

CellCacheManagerPtr Hypertable::AccessGroup::m_cell_cache_manager
private

Definition at line 284 of file AccessGroup.h.

bool Hypertable::AccessGroup::m_cellcache_needs_compaction {}
private

Definition at line 300 of file AccessGroup.h.

PropertiesPtr Hypertable::AccessGroup::m_cellstore_props
private

Definition at line 283 of file AccessGroup.h.

std::set<uint8_t> Hypertable::AccessGroup::m_column_families
private

Definition at line 274 of file AccessGroup.h.

float Hypertable::AccessGroup::m_compression_ratio {1.0}
private

Definition at line 287 of file AccessGroup.h.

bool Hypertable::AccessGroup::m_dirty {}
private

Definition at line 299 of file AccessGroup.h.

uint64_t Hypertable::AccessGroup::m_disk_usage {}
private

Definition at line 286 of file AccessGroup.h.

int64_t Hypertable::AccessGroup::m_earliest_cached_revision {TIMESTAMP_MAX}
private

Definition at line 288 of file AccessGroup.h.

int64_t Hypertable::AccessGroup::m_earliest_cached_revision_saved {TIMESTAMP_MAX}
private

Definition at line 289 of file AccessGroup.h.

bool Hypertable::AccessGroup::m_end_merge {}
private

Definition at line 298 of file AccessGroup.h.

String Hypertable::AccessGroup::m_end_row
private

Definition at line 280 of file AccessGroup.h.

LiveFileTracker Hypertable::AccessGroup::m_file_tracker
private

Definition at line 292 of file AccessGroup.h.

String Hypertable::AccessGroup::m_full_name
private

Definition at line 276 of file AccessGroup.h.

AccessGroupGarbageTracker Hypertable::AccessGroup::m_garbage_tracker
private

Definition at line 293 of file AccessGroup.h.

TableIdentifierManaged Hypertable::AccessGroup::m_identifier
private

Definition at line 272 of file AccessGroup.h.

bool Hypertable::AccessGroup::m_in_memory {}
private

Definition at line 295 of file AccessGroup.h.

bool Hypertable::AccessGroup::m_is_root {}
private

Definition at line 294 of file AccessGroup.h.

int64_t Hypertable::AccessGroup::m_latest_stored_revision {TIMESTAMP_MIN}
private

Definition at line 290 of file AccessGroup.h.

int64_t Hypertable::AccessGroup::m_latest_stored_revision_hint {TIMESTAMP_MIN}
private

Definition at line 291 of file AccessGroup.h.

std::mutex Hypertable::AccessGroup::m_mutex
private

Definition at line 267 of file AccessGroup.h.

String Hypertable::AccessGroup::m_name
private

Definition at line 275 of file AccessGroup.h.

bool Hypertable::AccessGroup::m_needs_merging {}
private

Definition at line 297 of file AccessGroup.h.

uint32_t Hypertable::AccessGroup::m_next_cs_id {}
private

Definition at line 285 of file AccessGroup.h.

std::condition_variable Hypertable::AccessGroup::m_outstanding_scanner_cond
private

Definition at line 270 of file AccessGroup.h.

int32_t Hypertable::AccessGroup::m_outstanding_scanner_count
private

Definition at line 271 of file AccessGroup.h.

std::mutex Hypertable::AccessGroup::m_outstanding_scanner_mutex
private

Definition at line 269 of file AccessGroup.h.

String Hypertable::AccessGroup::m_range_dir
private

Definition at line 278 of file AccessGroup.h.

String Hypertable::AccessGroup::m_range_name
private

Definition at line 281 of file AccessGroup.h.

bool Hypertable::AccessGroup::m_recovering {}
private

Definition at line 296 of file AccessGroup.h.

SchemaPtr Hypertable::AccessGroup::m_schema
private

Definition at line 273 of file AccessGroup.h.

std::mutex Hypertable::AccessGroup::m_schema_mutex
private

Definition at line 268 of file AccessGroup.h.

String Hypertable::AccessGroup::m_start_row
private

Definition at line 279 of file AccessGroup.h.

std::vector<CellStoreInfo> Hypertable::AccessGroup::m_stores
private

Definition at line 282 of file AccessGroup.h.

String Hypertable::AccessGroup::m_table_name
private

Definition at line 277 of file AccessGroup.h.


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