From cb9cb1c4b41755e2487456632acc61501c21aeb3 Mon Sep 17 00:00:00 2001 From: Yang Zhang Date: Tue, 2 Jan 2024 21:07:55 -0800 Subject: [PATCH] Revert to copy Signed-off-by: Yang Zhang --- db/column_family.cc | 11 ++++------- db/column_family.h | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/db/column_family.cc b/db/column_family.cc index 76eac06a417..8d26cf89862 100644 --- a/db/column_family.cc +++ b/db/column_family.cc @@ -50,13 +50,10 @@ ColumnFamilyHandleImpl::ColumnFamilyHandleImpl( } } -ColumnFamilyHandleImpl::ColumnFamilyHandleImpl(ColumnFamilyHandleImpl&& other) { - cfd_ = other.cfd_; - db_ = other.db_; - mutex_ = other.mutex_; - other.cfd_ = nullptr; - other.db_ = nullptr; - other.mutex_ = nullptr; +ColumnFamilyHandleImpl::ColumnFamilyHandleImpl( + const ColumnFamilyHandleImpl& other) + : cfd_(other.cfd_), db_(other.db_), mutex_(other.mutex_) { + cfd_->Ref(); } ColumnFamilyHandleImpl::~ColumnFamilyHandleImpl() { diff --git a/db/column_family.h b/db/column_family.h index 07692e5dadc..1a3ca3797dd 100644 --- a/db/column_family.h +++ b/db/column_family.h @@ -162,7 +162,7 @@ class ColumnFamilyHandleImpl : public ColumnFamilyHandle { // create while holding the mutex ColumnFamilyHandleImpl( ColumnFamilyData* cfd, DBImpl* db, InstrumentedMutex* mutex); - ColumnFamilyHandleImpl(ColumnFamilyHandleImpl&& other); + ColumnFamilyHandleImpl(const ColumnFamilyHandleImpl& other); // destroy without mutex virtual ~ColumnFamilyHandleImpl(); virtual ColumnFamilyData* cfd() const { return cfd_; }