|
|
@ -469,6 +469,7 @@ Version::Version(ColumnFamilyData* cfd, VersionSet* vset, |
|
|
|
refs_(0), |
|
|
|
refs_(0), |
|
|
|
// cfd is nullptr if Version is dummy
|
|
|
|
// cfd is nullptr if Version is dummy
|
|
|
|
num_levels_(cfd == nullptr ? 0 : cfd->NumberLevels()), |
|
|
|
num_levels_(cfd == nullptr ? 0 : cfd->NumberLevels()), |
|
|
|
|
|
|
|
finalized_(false), |
|
|
|
files_(new std::vector<FileMetaData*>[num_levels_]), |
|
|
|
files_(new std::vector<FileMetaData*>[num_levels_]), |
|
|
|
files_by_size_(num_levels_), |
|
|
|
files_by_size_(num_levels_), |
|
|
|
next_file_to_compact_by_size_(num_levels_), |
|
|
|
next_file_to_compact_by_size_(num_levels_), |
|
|
@ -486,6 +487,7 @@ void Version::Get(const ReadOptions& options, |
|
|
|
GetStats* stats, |
|
|
|
GetStats* stats, |
|
|
|
const Options& db_options, |
|
|
|
const Options& db_options, |
|
|
|
bool* value_found) { |
|
|
|
bool* value_found) { |
|
|
|
|
|
|
|
assert(finalized_); |
|
|
|
Slice ikey = k.internal_key(); |
|
|
|
Slice ikey = k.internal_key(); |
|
|
|
Slice user_key = k.user_key(); |
|
|
|
Slice user_key = k.user_key(); |
|
|
|
const Comparator* ucmp = cfd_->internal_comparator().user_comparator(); |
|
|
|
const Comparator* ucmp = cfd_->internal_comparator().user_comparator(); |
|
|
@ -651,6 +653,8 @@ bool Version::UpdateStats(const GetStats& stats) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Version::Finalize(std::vector<uint64_t>& size_being_compacted) { |
|
|
|
void Version::Finalize(std::vector<uint64_t>& size_being_compacted) { |
|
|
|
|
|
|
|
assert(!finalized_); |
|
|
|
|
|
|
|
finalized_ = true; |
|
|
|
// Pre-sort level0 for Get()
|
|
|
|
// Pre-sort level0 for Get()
|
|
|
|
if (cfd_->options()->compaction_style == kCompactionStyleUniversal) { |
|
|
|
if (cfd_->options()->compaction_style == kCompactionStyleUniversal) { |
|
|
|
std::sort(files_[0].begin(), files_[0].end(), NewestFirstBySeqNo); |
|
|
|
std::sort(files_[0].begin(), files_[0].end(), NewestFirstBySeqNo); |
|
|
|