Provides the ability to mutate a table in the form of adding and deleting rows and cells. More...
#include <TableMutatorAsync.h>
Public Member Functions | |
TableMutatorAsync (PropertiesPtr &props, Comm *comm, ApplicationQueueInterfacePtr &app_queue, Table *table, RangeLocatorPtr &range_locator, uint32_t timeout_ms, ResultCallback *cb, uint32_t flags=0, bool explicit_block_only=false) | |
Constructs the TableMutatorAsync object. More... | |
TableMutatorAsync (std::mutex &mutex, std::condition_variable &cond, PropertiesPtr &props, Comm *comm, ApplicationQueueInterfacePtr &app_queue, Table *table, RangeLocatorPtr &range_locator, uint32_t timeout_ms, ResultCallback *cb, uint32_t flags=0, bool explicit_block_only=false, TableMutator *mutator=0) | |
virtual | ~TableMutatorAsync () |
Destructor for TableMutatorAsync object Make sure buffers are flushed and unsynced rangeservers get synced. More... | |
virtual uint64_t | memory_used () |
Returns the amount of memory used by the collected mutations in the current buffer. More... | |
uint64_t | get_resend_count () |
There are certain circumstances when mutations get flushed to the wrong range server due to stale range location information. More... | |
void | set (const KeySpec &key, const void *value, uint32_t value_len) |
Inserts a cell into the table. More... | |
void | set (const KeySpec &key, const char *value) |
Convenient helper for null-terminated values. More... | |
void | set (const KeySpec &key, const std::string &value) |
Convenient helper for std::string values. More... | |
void | set_delete (const KeySpec &key) |
Deletes an entire row, a column family in a particular row, or a specific cell within a row. More... | |
void | set_cells (const Cells &cells) |
Insert a bunch of cells into the table (atomically if cells are in the same range/row) More... | |
void | set_cells (Cells::const_iterator start, Cells::const_iterator end) |
Insert a bunch of cells into the table (atomically if cells are in the same range/row) More... | |
void | flush (bool sync=true) |
Flushes the current buffer accumulated mutations to their respective range servers. More... | |
void | buffer_finish (uint32_t id, int error, bool retry) |
This is where buffers call back into when their outstanding operations are complete. More... | |
void | cancel () |
bool | is_cancelled () |
void | get_unsynced_rangeservers (std::vector< CommAddress > &unsynced) |
TableMutatorAsyncScatterBufferPtr | get_outstanding_buffer (size_t id) |
bool | retry (uint32_t timeout_ms) |
void | update_outstanding (TableMutatorAsyncScatterBufferPtr &buffer) |
void | get_failed_mutations (FailedMutations &failed_mutations) |
bool | has_outstanding () |
bool | has_outstanding_unlocked () |
bool | needs_flush () |
SchemaPtr | schema () |
Public Member Functions inherited from Hypertable::ClientObject | |
virtual | ~ClientObject () |
Destructor. More... | |
Protected Member Functions | |
void | wait_for_completion () |
Private Types | |
enum | Operation { SET = 1, SET_CELLS, SET_DELETE, FLUSH } |
typedef std::map< uint32_t, TableMutatorAsyncScatterBufferPtr > | ScatterBufferAsyncMap |
Private Member Functions | |
void | flush_with_tablequeue (TableMutator *mutator, bool sync=true) |
void | initialize (PropertiesPtr &props) |
void | initialize_indices (PropertiesPtr &props) |
void | update_without_index (const Cell &cell) |
void | update_without_index (const Key &full_key, const ColumnFamilySpec *cf, const Cell &cell) |
void | update_without_index (const Key &full_key, const ColumnFamilySpec *cf, const void *value, size_t value_len) |
void | do_sync () |
Calls sync on any unsynced rangeservers and waits for completion. More... | |
void | to_full_key (const void *row, const char *cf, const void *cq, int64_t ts, int64_t rev, uint8_t flag, Key &full_key, ColumnFamilySpec **pcf=0) |
void | to_full_key (const KeySpec &key, Key &full_key, ColumnFamilySpec **cf=0) |
void | to_full_key (const Cell &cell, Key &full_key, ColumnFamilySpec **cf=0) |
void | update_unsynced_rangeservers (const CommAddressSet &unsynced) |
void | handle_send_exceptions (const String &info) |
bool | mutated () |
bool | key_uses_index (Key &key) |
void | update_with_index (Key &key, const ColumnFamilySpec *cf, const void *value, uint32_t value_len) |
Private Attributes | |
PropertiesPtr | m_props |
Comm * | m_comm |
ApplicationQueueInterfacePtr | m_app_queue |
Table * | m_table {} |
SchemaPtr | m_schema |
RangeLocatorPtr | m_range_locator |
TableIdentifierManaged | m_table_identifier |
uint64_t | m_memory_used {} |
uint64_t | m_max_memory {} |
ScatterBufferAsyncMap | m_outstanding_buffers |
TableMutatorAsyncScatterBufferPtr | m_current_buffer |
uint64_t | m_resends {} |
uint32_t | m_timeout_ms {} |
ResultCallback * | m_cb {} |
uint32_t | m_flags {} |
CommAddressSet | m_unsynced_rangeservers |
std::mutex | m_buffer_mutex |
std::mutex & | m_mutex |
std::mutex | m_member_mutex |
std::condition_variable | m_buffer_cond |
std::condition_variable & | m_cond |
uint32_t | m_next_buffer_id {} |
FailedMutations | m_failed_mutations |
TableMutatorAsyncPtr | m_index_mutator |
TableMutatorAsyncPtr | m_qualifier_index_mutator |
IndexMutatorCallbackPtr | m_imc |
TableMutator * | m_mutator {} |
bool | m_explicit_block_only {} |
bool | m_cancelled {} |
bool | m_mutated {} |
bool | m_use_index {} |
Static Private Attributes | |
static const uint32_t | ms_max_sync_retries = 5 |
Friends | |
class | TableMutator |
flush function reserved for use in TableMutator More... | |
class | IndexMutatorCallback |
Provides the ability to mutate a table in the form of adding and deleting rows and cells.
Objects of this class are used to collect mutations and periodically flush them to the appropriate range servers. There is a 1 MB buffer of mutations for each range server. When one of the buffers fills up all the buffers are flushed to their respective range servers.
Definition at line 61 of file TableMutatorAsync.h.
|
private |
Definition at line 264 of file TableMutatorAsync.h.
|
private |
Enumerator | |
---|---|
SET | |
SET_CELLS | |
SET_DELETE | |
FLUSH |
Definition at line 222 of file TableMutatorAsync.h.
TableMutatorAsync::TableMutatorAsync | ( | PropertiesPtr & | props, |
Comm * | comm, | ||
ApplicationQueueInterfacePtr & | app_queue, | ||
Table * | table, | ||
RangeLocatorPtr & | range_locator, | ||
uint32_t | timeout_ms, | ||
ResultCallback * | cb, | ||
uint32_t | flags = 0 , |
||
bool | explicit_block_only = false |
||
) |
Constructs the TableMutatorAsync object.
props | reference to properties smart pointer |
comm | pointer to the Comm layer |
app_queue | pointer to the Application Queue |
table | pointer to the table object |
range_locator | smart pointer to range locator |
timeout_ms | maximum time in milliseconds to allow methods to execute before throwing an exception |
cb | callback for this mutator |
flags | rangeserver client update command flags |
explicit_block_only | if true TableMutatorAsync will not auto_flush or wait_for_completion unless explicitly told to do so by caller |
Definition at line 63 of file TableMutatorAsync.cc.
TableMutatorAsync::TableMutatorAsync | ( | std::mutex & | mutex, |
std::condition_variable & | cond, | ||
PropertiesPtr & | props, | ||
Comm * | comm, | ||
ApplicationQueueInterfacePtr & | app_queue, | ||
Table * | table, | ||
RangeLocatorPtr & | range_locator, | ||
uint32_t | timeout_ms, | ||
ResultCallback * | cb, | ||
uint32_t | flags = 0 , |
||
bool | explicit_block_only = false , |
||
TableMutator * | mutator = 0 |
||
) |
Definition at line 75 of file TableMutatorAsync.cc.
|
virtual |
Destructor for TableMutatorAsync object Make sure buffers are flushed and unsynced rangeservers get synced.
Definition at line 106 of file TableMutatorAsync.cc.
void TableMutatorAsync::buffer_finish | ( | uint32_t | id, |
int | error, | ||
bool | retry | ||
) |
This is where buffers call back into when their outstanding operations are complete.
id | id of the buffer |
error | error code for finished buffer |
retry | true if buffer has retries |
Definition at line 643 of file TableMutatorAsync.cc.
void TableMutatorAsync::cancel | ( | ) |
Definition at line 449 of file TableMutatorAsync.cc.
|
private |
Calls sync on any unsynced rangeservers and waits for completion.
Commit log sync failed
Definition at line 543 of file TableMutatorAsync.cc.
void TableMutatorAsync::flush | ( | bool | sync = true | ) |
Flushes the current buffer accumulated mutations to their respective range servers.
sync | if false then theres no guarantee that the data is synced disk |
Definition at line 468 of file TableMutatorAsync.cc.
|
private |
Definition at line 472 of file TableMutatorAsync.cc.
|
inline |
Definition at line 187 of file TableMutatorAsync.h.
TableMutatorAsyncScatterBufferPtr TableMutatorAsync::get_outstanding_buffer | ( | size_t | id | ) |
Definition at line 619 of file TableMutatorAsync.cc.
|
inline |
There are certain circumstances when mutations get flushed to the wrong range server due to stale range location information.
When the correct location information is discovered, these mutations get resent to the proper range server. This method returns the number of mutations that were resent.
Definition at line 113 of file TableMutatorAsync.h.
void TableMutatorAsync::get_unsynced_rangeservers | ( | std::vector< CommAddress > & | unsynced | ) |
Definition at line 536 of file TableMutatorAsync.cc.
|
private |
Definition at line 42 of file TableMutatorAsync.cc.
|
inline |
Definition at line 191 of file TableMutatorAsync.h.
|
inline |
Definition at line 195 of file TableMutatorAsync.h.
|
private |
Definition at line 87 of file TableMutatorAsync.cc.
|
private |
Definition at line 127 of file TableMutatorAsync.cc.
bool TableMutatorAsync::is_cancelled | ( | ) |
Definition at line 454 of file TableMutatorAsync.cc.
|
private |
|
inlinevirtual |
Returns the amount of memory used by the collected mutations in the current buffer.
Definition at line 102 of file TableMutatorAsync.h.
|
inlineprivate |
Definition at line 254 of file TableMutatorAsync.h.
bool TableMutatorAsync::needs_flush | ( | ) |
Definition at line 459 of file TableMutatorAsync.cc.
bool Hypertable::TableMutatorAsync::retry | ( | uint32_t | timeout_ms | ) |
|
inline |
Definition at line 200 of file TableMutatorAsync.h.
void TableMutatorAsync::set | ( | const KeySpec & | key, |
const void * | value, | ||
uint32_t | value_len | ||
) |
Inserts a cell into the table.
key | key of the cell being inserted |
value | pointer to the value to store in the cell |
value_len | length of data pointed to by value |
Definition at line 192 of file TableMutatorAsync.cc.
|
inline |
Convenient helper for null-terminated values.
Definition at line 127 of file TableMutatorAsync.h.
|
inline |
Convenient helper for std::string values.
Definition at line 137 of file TableMutatorAsync.h.
|
inline |
Insert a bunch of cells into the table (atomically if cells are in the same range/row)
cells | a list of cells |
Definition at line 155 of file TableMutatorAsync.h.
void TableMutatorAsync::set_cells | ( | Cells::const_iterator | start, |
Cells::const_iterator | end | ||
) |
Insert a bunch of cells into the table (atomically if cells are in the same range/row)
start | Iterator pointing to start of cells to be inserted |
end | Iterator pointing to end of cells to be inserted |
Definition at line 294 of file TableMutatorAsync.cc.
void TableMutatorAsync::set_delete | ( | const KeySpec & | key | ) |
Deletes an entire row, a column family in a particular row, or a specific cell within a row.
key | key of the row or cell(s) being deleted |
Definition at line 350 of file TableMutatorAsync.cc.
|
private |
Definition at line 401 of file TableMutatorAsync.cc.
|
inlineprivate |
Definition at line 238 of file TableMutatorAsync.h.
|
inlineprivate |
Definition at line 244 of file TableMutatorAsync.h.
void TableMutatorAsync::update_outstanding | ( | TableMutatorAsyncScatterBufferPtr & | buffer | ) |
Definition at line 633 of file TableMutatorAsync.cc.
|
private |
Definition at line 628 of file TableMutatorAsync.cc.
|
private |
Definition at line 161 of file TableMutatorAsync.cc.
|
private |
Definition at line 237 of file TableMutatorAsync.cc.
|
private |
Definition at line 270 of file TableMutatorAsync.cc.
|
private |
Definition at line 277 of file TableMutatorAsync.cc.
|
protected |
Definition at line 155 of file TableMutatorAsync.cc.
|
friend |
Definition at line 214 of file TableMutatorAsync.h.
|
friend |
flush function reserved for use in TableMutator
Definition at line 207 of file TableMutatorAsync.h.
|
private |
Definition at line 270 of file TableMutatorAsync.h.
|
private |
Definition at line 287 of file TableMutatorAsync.h.
|
private |
Definition at line 284 of file TableMutatorAsync.h.
|
private |
Definition at line 296 of file TableMutatorAsync.h.
|
private |
Definition at line 281 of file TableMutatorAsync.h.
|
private |
Definition at line 269 of file TableMutatorAsync.h.
|
private |
Definition at line 288 of file TableMutatorAsync.h.
|
private |
Definition at line 278 of file TableMutatorAsync.h.
|
private |
Definition at line 295 of file TableMutatorAsync.h.
|
private |
Definition at line 290 of file TableMutatorAsync.h.
|
private |
Definition at line 282 of file TableMutatorAsync.h.
|
private |
Definition at line 293 of file TableMutatorAsync.h.
|
private |
Definition at line 291 of file TableMutatorAsync.h.
|
private |
Definition at line 276 of file TableMutatorAsync.h.
|
private |
Definition at line 286 of file TableMutatorAsync.h.
|
private |
Definition at line 275 of file TableMutatorAsync.h.
|
private |
Definition at line 297 of file TableMutatorAsync.h.
|
private |
Definition at line 294 of file TableMutatorAsync.h.
|
private |
Definition at line 285 of file TableMutatorAsync.h.
|
private |
Definition at line 289 of file TableMutatorAsync.h.
|
private |
Definition at line 277 of file TableMutatorAsync.h.
|
private |
Definition at line 268 of file TableMutatorAsync.h.
|
private |
Definition at line 292 of file TableMutatorAsync.h.
|
private |
Definition at line 273 of file TableMutatorAsync.h.
|
private |
Definition at line 279 of file TableMutatorAsync.h.
|
private |
Definition at line 272 of file TableMutatorAsync.h.
|
private |
Definition at line 271 of file TableMutatorAsync.h.
|
private |
Definition at line 274 of file TableMutatorAsync.h.
|
private |
Definition at line 280 of file TableMutatorAsync.h.
|
private |
Definition at line 283 of file TableMutatorAsync.h.
|
private |
Definition at line 298 of file TableMutatorAsync.h.
|
staticprivate |
Definition at line 266 of file TableMutatorAsync.h.