unfriend ColumnFamilyData from VersionSet

Summary: as title

Test Plan:
make release
will run full test on all stacked diffs before committing

Reviewers: sdong, yhchiang, rven, igor

Reviewed By: igor

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D27591
main
Lei Jin 10 years ago
parent 834c67d77f
commit f981e08139
  1. 5
      db/column_family.cc
  2. 3
      db/version_set.cc
  3. 6
      db/version_set.h

@ -304,8 +304,9 @@ ColumnFamilyData::~ColumnFamilyData() {
if (dummy_versions_ != nullptr) {
// List must be empty
assert(dummy_versions_->next_ == dummy_versions_);
delete dummy_versions_;
assert(dummy_versions_->TEST_Next() == dummy_versions_);
bool deleted __attribute__((unused)) = dummy_versions_->Unref();
assert(deleted);
}
if (mem_ != nullptr) {

@ -2933,6 +2933,9 @@ ColumnFamilyData* VersionSet::CreateColumnFamily(
assert(edit->is_column_family_add_);
Version* dummy_versions = new Version(nullptr, this);
// Ref() dummy version once so that later we can call Unref() to delete it
// by avoiding calling "delete" explicitly (~Version is private)
dummy_versions->Ref();
auto new_cfd = column_family_set_->CreateColumnFamily(
edit->column_family_name_, edit->column_family_, dummy_versions,
cf_options);

@ -292,10 +292,14 @@ class Version {
// seconds/minutes (because of concurrent compactions).
static const size_t kNumberFilesToSort = 50;
// Return the next Version in the linked list. Used for debug only
Version* TEST_Next() const {
return next_;
}
private:
friend class VersionSet;
friend class DBImpl;
friend class ColumnFamilyData;
friend class ForwardIterator;
friend class InternalStats;

Loading…
Cancel
Save