30 #include <boost/algorithm/string.hpp>
44 catch (std::bad_alloc &e) {
48 catch (std::exception &e) {
50 HT_ERRORF(
"caught std::exception: %s", e.what());
54 HT_ERROR(
"caught unknown exception here");
60 uint32_t timeout_ms, uint32_t flags)
61 : m_callback(this), m_timeout_ms(timeout_ms), m_flags(flags), m_flush_delay(0),
62 m_last_error(
Error::
OK), m_last_op(0), m_unflushed_updates(false) {
67 m_flush_delay = props->get_i32(
"Hypertable.Mutator.FlushDelay");
202 m_queue->wait_for_buffer(lock, &app_handler);
204 lock_guard<mutex> lock(
m_mutex);
209 lock_guard<mutex> lock(
m_mutex);
231 lock_guard<mutex> lock(
m_mutex);
261 lock_guard<mutex> lock(
m_mutex);
269 if (failed_cells && failed_cells->size() > 0)
272 this_thread::sleep_for(chrono::milliseconds(2000));
279 lock_guard<mutex> lock(
m_mutex);
283 out <<
"Failed: (" << v.first.row_key <<
"," << v.first.column_family;
285 if (v.first.column_qualifier && *(v.first.column_qualifier))
286 out <<
":" << v.first.column_qualifier;
288 out <<
"," << v.first.timestamp <<
") - "
299 lock_guard<mutex> lock(
m_mutex);
307 lock_guard<mutex> lock(
m_mutex);
void wait_for_flush_completion(TableMutatorAsync *mutator)
FailedMutations m_failed_mutations
void set_last_error(int32_t error)
CellsBuilderPtr m_failed_cells
std::ostream & show_failed(const Exception &, std::ostream &=std::cout)
Show failed mutations.
std::shared_ptr< RangeLocator > RangeLocatorPtr
Smart pointer to RangeLocator.
void save_last(const KeySpec &key, const void *value, size_t value_len)
virtual void set_delete(const KeySpec &key)
Deletes an entire row, a column family in a particular row, or a specific cell within a row...
const void * m_last_value
virtual void set(const KeySpec &key, const void *value, uint32_t value_len)
Inserts a cell into the table.
Provides the ability to mutate a table in the form of adding and deleting rows and cells...
Cells::const_iterator m_last_cells_it
Represents an open table.
virtual void set_cells(const Cells &cells)
Insert a bunch of cells into the table (atomically if cells are in the same range/row) ...
virtual ~TableMutator()
Destructor for TableMutator object Make sure buffers are flushed and unsynced rangeservers get synced...
const char * get_text(int error)
Returns a descriptive error message.
std::shared_ptr< Properties > PropertiesPtr
Compatibility Macros for C/C++.
std::shared_ptr< ApplicationQueueInterface > ApplicationQueueInterfacePtr
Smart pointer to ApplicationQueueInterface.
virtual bool retry(uint32_t timeout_ms=0)
Retries the last operation.
std::shared_ptr< CellsBuilder > CellsBuilderPtr
Smart pointer to CellsBuilder.
Entry point to AsyncComm service.
virtual void run()=0
Carries out the request.
bool has_outstanding_unlocked()
TableMutatorAsyncPtr m_mutator
This is a generic exception class for Hypertable.
Base clase for application handlers.
std::condition_variable m_cond
#define HT_ERRORF(msg,...)
TableMutator(PropertiesPtr &props, Comm *comm, Table *table, RangeLocatorPtr &range_locator, uint32_t timeout_ms, uint32_t flags=0)
Constructs the TableMutator object.
virtual void flush()
Flushes the accumulated mutations to their respective range servers.
void update_error(int error, FailedMutations &failures)
TableMutatorQueuePtr m_queue
String extensions and helpers: sets, maps, append operators etc.
#define HT_THROW(_code_, _msg_)
uint32_t m_last_value_len
std::vector< FailedMutation > FailedMutations
Cells::const_iterator m_last_cells_end