|
Zero
0.1.0
|
Component that consumes a partially-sorted log record stream and generates indexed runs from it. More...
#include <logarchive_writer.h>
Classes | |
| struct | BlockHeader |
Public Member Functions | |
| BlockAssembly (ArchiveIndex *index, unsigned level=1, bool compression=true) | |
| virtual | ~BlockAssembly () |
| bool | start (run_number_t run) |
| bool | add (logrec_t *lr) |
| void | finish () |
| void | shutdown () |
| bool | hasPendingBlocks () |
| void | resetWriter () |
| PageID | getCurrentMaxPID () |
Static Public Member Functions | |
| static run_number_t | getRunFromBlock (const char *b) |
| static lsn_t | getLSNFromBlock (const char *b) |
| static size_t | getEndOfBlock (const char *b) |
| static PageID | getMaxPIDFromBlock (const char *b) |
Private Attributes | |
| char * | dest |
| AsyncRingBuffer * | writebuf |
| WriterThread * | writer |
| ArchiveIndex * | archIndex |
| size_t | blockSize |
| size_t | pos |
| size_t | fpos |
| lsn_t | maxLSNInBlock |
| int | maxLSNLength |
| run_number_t | lastRun |
| PageID | currentPID |
| size_t | currentPIDpos |
| size_t | currentPIDfpos |
| lsn_t | currentPIDprevLSN |
| bool | enableCompression |
| size_t | bucketSize |
| std::vector< pair< PageID, size_t > > | buckets |
| size_t | nextBucket |
| unsigned | level |
| PageID | maxPID |
| size_t | spaceToReserve |
Component that consumes a partially-sorted log record stream and generates indexed runs from it.
This class serves two purposes:
The writer thread is controlled solely using an asynchronous ring buffer. This works because the writer should keep writing as long as there are blocks available – unlike the reader thread, which must stop once a certain LSN is reached.
Each generated block contains a header, which specifies the run number, the offset up to which valid log records are found within that block, and the LSN of the last log record in the block. The run number is used by the writer thread to write blocks to the correct run file – once it changes from one block to another, it must close the currently generated run file an open a new one. The LSN in the last block header is then used to rename the file with the correct LSN range. (We used to control these LSN boundaries with an additional queue structure, but it required too many dependencies between modules that are otherwise independent)
| BlockAssembly::BlockAssembly | ( | ArchiveIndex * | index, |
| unsigned | level = 1, |
||
| bool | compression = true |
||
| ) |
|
virtual |
| bool BlockAssembly::add | ( | logrec_t * | lr | ) |
| void BlockAssembly::finish | ( | ) |
|
inline |
|
static |
|
static |
|
static |
|
static |
| bool BlockAssembly::hasPendingBlocks | ( | ) |
|
inline |
| void BlockAssembly::shutdown | ( | ) |
| bool BlockAssembly::start | ( | run_number_t | run | ) |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
1.8.12