Locates containing range given a key. More...
#include <RangeLocator.h>
Public Member Functions | |
RangeLocator (PropertiesPtr &cfg, ConnectionManagerPtr &conn_mgr, Hyperspace::SessionPtr &hyperspace, uint32_t timeout_ms) | |
Constructor. More... | |
~RangeLocator () | |
Destructor. More... | |
void | find_loop (const TableIdentifier *table, const char *row_key, RangeLocationInfo *range_loc_infop, Timer &timer, bool hard) |
Locates the range that contains the given row key. More... | |
int | find (const TableIdentifier *table, const char *row_key, RangeLocationInfo *range_loc_infop, Timer &timer, bool hard) |
Locates the range that contains the given row key. More... | |
bool | invalidate (const TableIdentifier *table, const char *row_key) |
Invalidates the cached entry for the given row key. More... | |
void | invalidate_host (const std::string &hostname) |
void | set_root_stale () |
Sets the "root stale" flag. More... | |
LocationCachePtr | location_cache () |
Returns the location cache. More... | |
void | clear_error_history () |
Clears the error history. More... | |
void | dump_error_history () |
Displays the error history. More... | |
Private Member Functions | |
void | initialize (Timer &timer) |
void | hyperspace_disconnected () |
void | hyperspace_reconnected () |
int | process_metadata_scanblocks (std::vector< ScanBlock > &scan_blocks, Timer &timer) |
int | read_root_location (Timer &timer) |
void | initialize () |
Assumes access is serialized via m_hyperspace_mutex. More... | |
int | connect (CommAddress &addr, Timer &timer) |
Private Attributes | |
std::mutex | m_mutex |
ConnectionManagerPtr | m_conn_manager |
Hyperspace::SessionPtr | m_hyperspace |
LocationCachePtr | m_cache |
uint64_t | m_root_file_handle |
Hyperspace::HandleCallbackPtr | m_root_handler |
bool | m_root_stale |
RangeLocationInfo | m_root_range_info |
Lib::RangeServer::Client | m_range_server |
uint8_t | m_startrow_cid |
uint8_t | m_location_cid |
TableIdentifier | m_metadata_table |
std::deque< Exception > | m_last_errors |
bool | m_hyperspace_init |
bool | m_hyperspace_connected |
std::mutex | m_hyperspace_mutex |
uint32_t | m_timeout_ms |
RangeLocatorHyperspaceSessionCallback | m_hyperspace_session_callback |
std::string | m_toplevel_dir |
uint32_t | m_metadata_readahead_count |
uint32_t | m_max_error_queue_length |
uint32_t | m_metadata_retry_interval |
uint32_t | m_root_metadata_retry_interval |
Friends | |
class | RangeLocatorHyperspaceSessionCallback |
Locates containing range given a key.
This class does the METADATA range searching to find the location of the range that contains a row key.
Definition at line 67 of file RangeLocator.h.
RangeLocator::RangeLocator | ( | PropertiesPtr & | cfg, |
ConnectionManagerPtr & | conn_mgr, | ||
Hyperspace::SessionPtr & | hyperspace, | ||
uint32_t | timeout_ms | ||
) |
Constructor.
Loads the METADATA schema and the root range address from Hyperspace. Installs a RootFileHandler to handle root range location changes.
cfg | reference to config properties |
conn_mgr | smart pointer to connection manager |
hyperspace | smart pointer to Hyperspace session |
timeout_ms | timeout in milliseconds |
Definition at line 112 of file RangeLocator.cc.
RangeLocator::~RangeLocator | ( | ) |
|
inline |
Clears the error history.
Definition at line 146 of file RangeLocator.h.
|
private |
Definition at line 671 of file RangeLocator.cc.
|
inline |
Displays the error history.
Definition at line 154 of file RangeLocator.h.
int RangeLocator::find | ( | const TableIdentifier * | table, |
const char * | row_key, | ||
RangeLocationInfo * | range_loc_infop, | ||
Timer & | timer, | ||
bool | hard | ||
) |
Locates the range that contains the given row key.
table | pointer to table identifier structure |
row_key | row key to locate |
range_loc_infop | address of RangeLocationInfo to hold result |
timer | reference to timer object |
hard | don't consult cache |
If key is on ROOT metadata range, return root range information
at this point, we didn't find it so we need to do a METADATA lookup
Find second level METADATA range from root
Find actual range from second-level METADATA range
Definition at line 271 of file RangeLocator.cc.
void RangeLocator::find_loop | ( | const TableIdentifier * | table, |
const char * | row_key, | ||
RangeLocationInfo * | range_loc_infop, | ||
Timer & | timer, | ||
bool | hard | ||
) |
Locates the range that contains the given row key.
table | pointer to table identifier structure |
row_key | row key to locate |
range_loc_infop | address of RangeLocationInfo to hold result |
timer | reference to timer object |
hard | don't consult cache |
Definition at line 232 of file RangeLocator.cc.
|
private |
Definition at line 142 of file RangeLocator.cc.
|
private |
Definition at line 149 of file RangeLocator.cc.
|
private |
|
private |
Assumes access is serialized via m_hyperspace_mutex.
Definition at line 159 of file RangeLocator.cc.
|
inline |
Invalidates the cached entry for the given row key.
table | pointer to table identifier structure |
row_key | row key to invalidate |
Definition at line 116 of file RangeLocator.h.
|
inline |
Definition at line 122 of file RangeLocator.h.
|
inline |
Returns the location cache.
Definition at line 139 of file RangeLocator.h.
|
private |
Definition at line 470 of file RangeLocator.cc.
|
private |
NOTE: This block assumes that a change of root address means the old server has died. If root changes in the future can happen even when the original root server is still alive, this will have to change.
Definition at line 612 of file RangeLocator.cc.
|
inline |
Sets the "root stale" flag.
Causes methods to reread the root range location before doing METADATA scans.
Definition at line 134 of file RangeLocator.h.
|
friend |
Definition at line 162 of file RangeLocator.h.
|
private |
Definition at line 175 of file RangeLocator.h.
|
private |
Definition at line 173 of file RangeLocator.h.
|
private |
Definition at line 174 of file RangeLocator.h.
|
private |
Definition at line 186 of file RangeLocator.h.
|
private |
Definition at line 185 of file RangeLocator.h.
|
private |
Definition at line 187 of file RangeLocator.h.
|
private |
Definition at line 189 of file RangeLocator.h.
|
private |
Definition at line 184 of file RangeLocator.h.
|
private |
Definition at line 182 of file RangeLocator.h.
|
private |
Definition at line 192 of file RangeLocator.h.
|
private |
Definition at line 191 of file RangeLocator.h.
|
private |
Definition at line 193 of file RangeLocator.h.
|
private |
Definition at line 183 of file RangeLocator.h.
|
private |
Definition at line 172 of file RangeLocator.h.
|
private |
Definition at line 180 of file RangeLocator.h.
|
private |
Definition at line 176 of file RangeLocator.h.
|
private |
Definition at line 177 of file RangeLocator.h.
|
private |
Definition at line 194 of file RangeLocator.h.
|
private |
Definition at line 179 of file RangeLocator.h.
|
private |
Definition at line 178 of file RangeLocator.h.
|
private |
Definition at line 181 of file RangeLocator.h.
|
private |
Definition at line 188 of file RangeLocator.h.
|
private |
Definition at line 190 of file RangeLocator.h.