45 lock_guard<mutex> lock(
m_mutex);
47 auto expire_time =
event->deadline();
53 request->
count = count;
54 request->
event = event;
72 if (expire_time > (*iter).second->expire_time)
74 (*iter).second->total_count += count;
75 (*iter).second->total_buffer_size += buffer.
size;
76 (*iter).second->requests.push_back(request);
82 lock_guard<mutex> lock(
m_mutex);
83 std::vector<UpdateRecTable *> updates;
90 if ((
m_counter % (*iter).second->commit_iteration) == 0) {
91 auto remove_iter = iter;
92 if (iter->second->expire_time > expire_time)
93 expire_time = iter->second->expire_time;
95 updates.push_back((*remove_iter).second);
102 if (!updates.empty())
uint32_t m_commit_interval
Cached copy of Hypertable.RangeServer.CommitInterval property.
A memory buffer of static size.
uint32_t count
Count of serialized key/value pairs in buffer.
std::vector< UpdateRequest * > requests
Vector of corresponding client requests.
chrono::time_point< fast_clock > time_point
Holds updates destined for a specific table.
virtual void trigger()
Processes queued updates that are ready to be committed.
std::map< ClusterTableIdPair, UpdateRecTable *, lt_ctip > m_table_map
std::shared_ptr< Event > EventPtr
Smart pointer to Event.
Declarations for RangeServer.
FlyweightString m_flyweight_strings
String cache for holding table IDs
ClockT::time_point expire_time
Request expiration time.
StaticBuffer buffer
Update buffer containing serialized key/value pairs.
EventPtr event
Event object of originating update requst.
GroupCommit(Apps::RangeServer *range_server)
Constructor.
void batch_update(std::vector< UpdateRecTable * > &updates, ClockT::time_point expire_time)
Compatibility Macros for C/C++.
Apps::RangeServer * m_range_server
Pointer to RangeServer.
virtual void add(EventPtr &event, uint64_t cluster_id, SchemaPtr &schema, const TableIdentifier &table, uint32_t count, StaticBuffer &buffer, uint32_t flags)
Adds a batch of updates to the group commit queue.
uint64_t cluster_id
Cluster from which these updates originated.
TableIdentifier id
Table identifier for destination table.
const char * get(const char *str)
Returns a copy of the string; this string is valid till the FlyweightString set is destructed...
Declarations for UpdateRequest.
Holds client update request and error state.
std::pair< uint64_t, TableIdentifier > ClusterTableIdPair
Structure for holding cluster ID / table identifier pair.
uint32_t commit_iteration
std::shared_ptr< Schema > SchemaPtr
Smart pointer to Schema.
Declarations for UpdateRecTable.
int m_counter
Trigger iteration counter.
uint64_t total_buffer_size
std::mutex m_mutex
Mutex to serialize concurrent access