Enable LevelDb to create a new log file if current log file is too large.

Summary: Enable LevelDb to create a new log file if current log file is too large.

Test Plan:
Write a script and manually check the generated info LOG.

Task ID: 1803577

Blame Rev:

Reviewers: dhruba, heyongqiang

Reviewed By: heyongqiang

CC: zshao

Differential Revision: https://reviews.facebook.net/D6003
This commit is contained in:
Kai Liu
2012-10-26 14:55:02 -07:00
parent 3a91b78b23
commit d50f8eb603
5 changed files with 56 additions and 13 deletions

View File

@@ -223,9 +223,9 @@ class WritableFile {
virtual Status Flush() = 0;
virtual Status Sync() = 0; // sync data
/*
/*
* Sync data and/or metadata as well.
* By default, sync only metadata.
* By default, sync only metadata.
* Override this method for environments where we need to sync
* metadata as well.
*/
@@ -249,11 +249,15 @@ class WritableFile {
// An interface for writing log messages.
class Logger {
public:
enum { DO_NOT_SUPPORT_GET_LOG_FILE_SIZE = -1 };
Logger() { }
virtual ~Logger();
// Write an entry to the log file with the specified format.
virtual void Logv(const char* format, va_list ap) = 0;
virtual size_t GetLogFileSize() const {
return DO_NOT_SUPPORT_GET_LOG_FILE_SIZE;
}
private:
// No copying allowed

View File

@@ -246,6 +246,13 @@ struct Options {
// every compaction run.
uint64_t delete_obsolete_files_period_micros;
// Specify the maximal size of the info log file. If the log file
// is larger than `max_log_file_size`, a new info log file will
// be created.
// If max_log_file_size == 0, all logs will be written to one
// log file.
size_t max_log_file_size;
// Create an Options object with default values for all fields.
Options();