|
| | ArchiveIndex (const sm_options &options) |
| |
| virtual | ~ArchiveIndex () |
| |
| size_t | getBlockSize () const |
| |
| std::string | getArchDir () const |
| |
| lsn_t | getLastLSN () |
| |
| lsn_t | getLastLSN (unsigned level) |
| |
| lsn_t | getFirstLSN (unsigned level) |
| |
| rc_t | openNewRun (unsigned level) |
| |
| rc_t | append (char *data, size_t length, unsigned level) |
| |
| rc_t | closeCurrentRun (lsn_t runEndLSN, unsigned level, PageID maxPID=0) |
| |
| RunFile * | openForScan (const RunId &runid) |
| |
| void | closeScan (const RunId &runid) |
| |
| rc_t | readBlock (int fd, char *buf, size_t &offset, size_t readSize=0) |
| |
| void | listFiles (std::vector< std::string > &list, int level=-1) |
| |
| void | listFileStats (std::list< RunId > &list, int level=-1) |
| |
| void | deleteRuns (unsigned replicationFactor=0) |
| |
| size_t | getSkipLogrecSize () const |
| |
| void | newBlock (const vector< pair< PageID, size_t >> &buckets, unsigned level) |
| |
| rc_t | finishRun (lsn_t first, lsn_t last, PageID maxPID, int fd, off_t offset, unsigned level) |
| |
| template<class Input > |
| void | probe (std::vector< Input > &, PageID, PageID, lsn_t startLSN, lsn_t endLSN=lsn_t::null) |
| |
| void | getBlockCounts (RunFile *, size_t *indexBlocks, size_t *dataBlocks) |
| |
| void | loadRunInfo (RunFile *, const RunId &) |
| |
| void | startNewRun (unsigned level) |
| |
| unsigned | getMaxLevel () const |
| |
| size_t | getBucketSize () |
| |
| size_t | getRunCount (unsigned level) |
| |
| void | dumpIndex (ostream &out) |
| |
| void | dumpIndex (ostream &out, const RunId &runid) |
| |
| template<class OutputIter > |
| void | listRunsNonOverlapping (OutputIter out) |
| |
Encapsulates all file and I/O operations on the log archive.
The directory object serves the following purposes:
- Inspecting the existing archive files at startup in order to determine the last LSN persisted (i.e., from where to resume archiving) and to delete incomplete or already merged (TODO) files that can result from a system crash.
- Support run generation by providing operations to open a new run, append blocks of data to the current run, and closing the current run by renaming its file with the given LSN boundaries.
- Support scans by opening files given their LSN boundaries (which are determined by the archive index), reading arbitrary blocks of data from them, and closing them.
- In the near future, it should also support the new (i.e., instant-restore-enabled) asynchronous merge daemon (TODO).
- Support auxiliary file-related operations that are used, e.g., in tests and experiments. Currently, the only such operation is parseLSN.
- Author
- Caetano Sauer
| rc_t ArchiveIndex::openNewRun |
( |
unsigned |
level | ) |
|
Opens a new run file of the log archive, closing the current run if it exists. Upon closing, the file is renamed to contain the LSN range of the log records contained in that run. The upper boundary (lastLSN) is exclusive, meaning that it will be found on the beginning of the following run. This also allows checking the filenames for any any range of the LSNs which was "lost" when archiving.
We assume the rename operation is atomic, even in case of OS crashes.
| size_t ArchiveIndex::bucketSize |
|
private |
Whether this index uses variable-sized buckets, i.e., entries in the index refer to fixed ranges of page ID for which the amount of log records is variable. The number gives the size of a bucket in terms of number of page ID's (or segment size in the restore case). If this is zero, then the index behaves like a B-tree, in which a bucket corresponds to a block, therefore having fixed sizes (but variable number of log records, obviously).