Skip to content

Commit

Permalink
Add copy constructor to ColumnFamilyHandleImpl (#353)
Browse files Browse the repository at this point in the history
* Add copy constructor for ColumnFamilyHandleImpl

Signed-off-by: Yang Zhang <[email protected]>
  • Loading branch information
v01dstar authored Jan 3, 2024
1 parent 938c016 commit dcf2f8d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions db/column_family.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ ColumnFamilyHandleImpl::ColumnFamilyHandleImpl(
}
}

ColumnFamilyHandleImpl::ColumnFamilyHandleImpl(
const ColumnFamilyHandleImpl& other)
: cfd_(other.cfd_), db_(other.db_), mutex_(other.mutex_) {
if (cfd_ != nullptr) {
cfd_->Ref();
}
}

ColumnFamilyHandleImpl::~ColumnFamilyHandleImpl() {
if (cfd_ != nullptr) {
#ifndef ROCKSDB_LITE
Expand Down
1 change: 1 addition & 0 deletions db/column_family.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ class ColumnFamilyHandleImpl : public ColumnFamilyHandle {
// create while holding the mutex
ColumnFamilyHandleImpl(
ColumnFamilyData* cfd, DBImpl* db, InstrumentedMutex* mutex);
ColumnFamilyHandleImpl(const ColumnFamilyHandleImpl& other);
// destroy without mutex
virtual ~ColumnFamilyHandleImpl();
virtual ColumnFamilyData* cfd() const { return cfd_; }
Expand Down

0 comments on commit dcf2f8d

Please sign in to comment.