Accumulates phantom update data for a phantom range. More...
#include <FragmentData.h>
Public Member Functions | |
FragmentData () | |
Constructor. More... | |
virtual | ~FragmentData () |
Destructor. More... | |
void | add (EventPtr &event) |
Adds an Event object representing a call to RangeServer::phantom_update(). More... | |
void | clear () |
Clears the state. More... | |
void | merge (TableIdentifier &table, RangePtr &range, CommitLogPtr &log) |
Adds accumulated data to phantom range and its transfer log. More... | |
Private Attributes | |
vector< EventPtr > | m_data |
Vector of RangeServer::phantom_update() events. More... | |
int64_t | m_memory_consumption {} |
Amount of memory accumulated (for memory tracking) More... | |
Accumulates phantom update data for a phantom range.
The recovery of a range server involves the phantom loading of its ranges into new range servers and then replaying its commit log to reconstruct the in-memory state of each recovered range. This replaying of the commit log involves reading each commit log file fragment and sending the commits found within the fragment, to the range servers that hold the phantom ranges to which they apply, by calling RangeServer::phantom_update(). Once the commit log replay is complete, a transfer log will be created for each phantom range to contain this commit log data. This transfer log is associated with each phantom range so that once they get flipped live, any subsequent restart of the range server can reconstruct the in-memory state for the range by replaying the transfer log. This class really exists as just an optimization to avoid copying the data received via RangeServer::phantom_update(). It does this in the following two ways:
Definition at line 70 of file FragmentData.h.
|
inline |
Constructor.
Definition at line 75 of file FragmentData.h.
|
virtual |
Destructor.
Subtracts m_memory_consumption from global memory tracker
Definition at line 38 of file FragmentData.cc.
void FragmentData::add | ( | EventPtr & | event | ) |
Adds an Event object representing a call to RangeServer::phantom_update().
Adds event
to m_data and adds the amount of memory consumed by event
to both the global memory tracker and m_memory_consumption.
event | RangeServer::phantom_update() event |
Definition at line 42 of file FragmentData.cc.
void FragmentData::clear | ( | ) |
Clears the state.
Clears the m_data vector, subtracts m_memory_consumption from global memory tracker, and then sets m_memory_consumption to 0.
Definition at line 50 of file FragmentData.cc.
void FragmentData::merge | ( | TableIdentifier & | table, |
RangePtr & | range, | ||
CommitLogPtr & | log | ||
) |
Adds accumulated data to phantom range and its transfer log.
For each accumulated event object, decodes the data held within the object (see RangeServerProtocol::create_request_phantom_update() for encoding format) and adds the data to the phantom range range
and also writes the data to the phantom range's transfer log log
.
table | Table identifier of phantom range |
range | Pointer to phantom range object |
log | Phantom range's transfer log |
Definition at line 57 of file FragmentData.cc.
|
private |
Vector of RangeServer::phantom_update() events.
Definition at line 112 of file FragmentData.h.
|
private |
Amount of memory accumulated (for memory tracking)
Definition at line 115 of file FragmentData.h.