diff options
author | jorlow@chromium.org <jorlow@chromium.org@62dab493-f737-651d-591e-8d6aee1b9529> | 2011-03-22 18:32:49 +0000 |
---|---|---|
committer | jorlow@chromium.org <jorlow@chromium.org@62dab493-f737-651d-591e-8d6aee1b9529> | 2011-03-22 18:32:49 +0000 |
commit | 13b72af77b2b7fed156c26107476f84d35e4481d (patch) | |
tree | d21e4ec2ca349fab041bda922f58303f1a2933a7 /db/version_set.h | |
parent | 9df5aa892ecf4f418f6777bcc18651ecd5f0d679 (diff) | |
download | leveldb-13b72af77b2b7fed156c26107476f84d35e4481d.tar.gz |
More changes from upstream.
git-svn-id: https://leveldb.googlecode.com/svn/trunk@12 62dab493-f737-651d-591e-8d6aee1b9529
Diffstat (limited to 'db/version_set.h')
-rw-r--r-- | db/version_set.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/db/version_set.h b/db/version_set.h index b8eee3d..0ea763d 100644 --- a/db/version_set.h +++ b/db/version_set.h @@ -139,6 +139,10 @@ class VersionSet { const InternalKey& begin, const InternalKey& end); + // Return the maximum overlapping data (in bytes) at next level for any + // file at a level >= 1. + int64 MaxNextLevelOverlappingBytes(); + // Create an iterator that reads over the compaction inputs for "*c". // The caller should delete the iterator when no longer needed. Iterator* MakeInputIterator(Compaction* c); @@ -195,6 +199,13 @@ class VersionSet { InternalKey* smallest, InternalKey* largest); + void GetRange2(const std::vector<FileMetaData*>& inputs1, + const std::vector<FileMetaData*>& inputs2, + InternalKey* smallest, + InternalKey* largest); + + void SetupOtherInputs(Compaction* c); + Env* const env_; const std::string dbname_; const Options* const options_; @@ -250,6 +261,10 @@ class Compaction { // Maximum size of files to build during this compaction. uint64_t MaxOutputFileSize() const { return max_output_file_size_; } + // Is this a trivial compaction that can be implemented by just + // moving a single input file to the next level (no merging or splitting) + bool IsTrivialMove() const; + // Add all inputs to this compaction as delete operations to *edit. void AddInputDeletions(VersionEdit* edit); @@ -258,6 +273,10 @@ class Compaction { // in levels greater than "level+1". bool IsBaseLevelForKey(const Slice& user_key); + // Returns true iff we should stop building the current output + // before processing "key". + bool ShouldStopBefore(const InternalKey& key); + // Release the input version for the compaction, once the compaction // is successful. void ReleaseInputs(); @@ -276,6 +295,12 @@ class Compaction { // Each compaction reads inputs from "level_" and "level_+1" std::vector<FileMetaData*> inputs_[2]; // The two sets of inputs + // State used to check for number of of overlapping grandparent files + // (parent == level_ + 1, grandparent == level_ + 2) + std::vector<FileMetaData*> grandparents_; + int grandparent_index_; // Index in grandparent_starts_ + int output_start_; // Index in grandparent_starts_ where output started + // State for implementing IsBaseLevelForKey // level_ptrs_ holds indices into input_version_->levels_: our state |