mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
WAL log retention policy based on archive size.
Summary: Archive cleaning will still happen every WAL_ttl seconds but archived logs will be deleted only if archive size is greater then a WAL_size_limit value. Empty archived logs will be deleted evety WAL_ttl. Test Plan: 1. Unit tests pass. 2. Benchmark. Reviewers: emayanke, dhruba, haobo, sdong, kailiu, igor Reviewed By: emayanke CC: leveldb Differential Revision: https://reviews.facebook.net/D13869
This commit is contained in:
@@ -264,9 +264,10 @@ class DB {
|
||||
// seq_number. If the sequence number is non existent, it returns an iterator
|
||||
// at the first available seq_no after the requested seq_no
|
||||
// Returns Status::Ok if iterator is valid
|
||||
// Must set WAL_ttl_seconds to a large value to use this api, else the WAL
|
||||
// files will get cleared aggressively and the iterator might keep getting
|
||||
// invalid before an update is read.
|
||||
// Must set WAL_ttl_seconds or WAL_size_limit_MB to large values to
|
||||
// use this api, else the WAL files will get
|
||||
// cleared aggressively and the iterator might keep getting invalid before
|
||||
// an update is read.
|
||||
virtual Status GetUpdatesSince(SequenceNumber seq_number,
|
||||
unique_ptr<TransactionLogIterator>* iter) = 0;
|
||||
|
||||
|
||||
@@ -489,15 +489,20 @@ struct Options {
|
||||
// be issued on this database.
|
||||
bool disable_auto_compactions;
|
||||
|
||||
// The number of seconds a WAL(write ahead log) should be kept after it has
|
||||
// been marked as Not Live. If the value is set. The WAL files are moved to
|
||||
// the archive directory and deleted after the given TTL.
|
||||
// If set to 0, WAL files are deleted as soon as they are not required by
|
||||
// the database.
|
||||
// If set to std::numeric_limits<uint64_t>::max() the WAL files will never be
|
||||
// deleted.
|
||||
// Default : 0
|
||||
// The following two fields affect how archived logs will be deleted.
|
||||
// 1. If both set to 0, logs will be deleted asap and will not get into
|
||||
// the archive.
|
||||
// 2. If WAL_ttl_seconds is 0 and WAL_size_limit_MB is not 0,
|
||||
// WAL files will be checked every 10 min and if total size is greater
|
||||
// then WAL_size_limit_MB, they will be deleted starting with the
|
||||
// earliest until size_limit is met. All empty files will be deleted.
|
||||
// 3. If WAL_ttl_seconds is not 0 and WAL_size_limit_MB is 0, then
|
||||
// WAL files will be checked every WAL_ttl_secondsi / 2 and those which
|
||||
// are older than WAL_ttl_seconds will be deleted.
|
||||
// 4. If both are not 0, WAL files will be checked every 10 min and both
|
||||
// checks will be performed with ttl being first.
|
||||
uint64_t WAL_ttl_seconds;
|
||||
uint64_t WAL_size_limit_MB;
|
||||
|
||||
// Number of bytes to preallocate (via fallocate) the manifest
|
||||
// files. Default is 4mb, which is reasonable to reduce random IO
|
||||
|
||||
@@ -16,7 +16,9 @@ typedef std::vector<std::unique_ptr<LogFile>> VectorLogPtr;
|
||||
enum WalFileType {
|
||||
/* Indicates that WAL file is in archive directory. WAL files are moved from
|
||||
* the main db directory to archive directory once they are not live and stay
|
||||
* there for a duration of WAL_ttl_seconds which can be set in Options
|
||||
* there until cleaned up. Files are cleaned depending on archive size
|
||||
* (Options::WAL_size_limit_MB) and time since last cleaning
|
||||
* (Options::WAL_ttl_seconds).
|
||||
*/
|
||||
kArchivedLogFile = 0,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user