diff --git a/db/snapshot_impl.h b/db/snapshot_impl.h index c9ddabdec8..edaabade7a 100644 --- a/db/snapshot_impl.h +++ b/db/snapshot_impl.h @@ -56,6 +56,9 @@ class SnapshotList { count_ = 0; } + // No copy-construct. + SnapshotList(const SnapshotList&) = delete; + bool empty() const { return list_.next_ == &list_; } SnapshotImpl* oldest() const { assert(!empty()); return list_.next_; } SnapshotImpl* newest() const { assert(!empty()); return list_.prev_; } diff --git a/utilities/blob_db/blob_db_impl.cc b/utilities/blob_db/blob_db_impl.cc index da9a3d13ec..7cbd5809fa 100644 --- a/utilities/blob_db/blob_db_impl.cc +++ b/utilities/blob_db/blob_db_impl.cc @@ -1254,11 +1254,11 @@ bool BlobDBImpl::VisibleToActiveSnapshot( // [earliest_sequence, obsolete_sequence). But doing so will make the // implementation more complicated. SequenceNumber obsolete_sequence = bfile->GetObsoleteSequence(); - SequenceNumber oldest_snapshot = 0; + SequenceNumber oldest_snapshot = kMaxSequenceNumber; { // Need to lock DBImpl mutex before access snapshot list. InstrumentedMutexLock l(db_impl_->mutex()); - auto snapshots = db_impl_->snapshots(); + auto& snapshots = db_impl_->snapshots(); if (!snapshots.empty()) { oldest_snapshot = snapshots.oldest()->GetSequenceNumber(); }