diff --git a/db/db_impl/db_impl_compaction_flush.cc b/db/db_impl/db_impl_compaction_flush.cc index a5c57eeb2..f9e578738 100644 --- a/db/db_impl/db_impl_compaction_flush.cc +++ b/db/db_impl/db_impl_compaction_flush.cc @@ -1037,7 +1037,7 @@ Status DBImpl::CompactFilesImpl( } if (output_file_names != nullptr) { - for (const auto newf : c->edit()->GetNewFiles()) { + for (const auto& newf : c->edit()->GetNewFiles()) { (*output_file_names) .push_back(TableFileName(c->immutable_cf_options()->cf_paths, newf.second.fd.GetNumber(), @@ -1137,7 +1137,7 @@ void DBImpl::NotifyOnCompactionBegin(ColumnFamilyData* cfd, Compaction* c, } } } - for (const auto newf : c->edit()->GetNewFiles()) { + for (const auto& newf : c->edit()->GetNewFiles()) { const FileMetaData& meta = newf.second; const FileDescriptor& desc = meta.fd; const uint64_t file_number = desc.GetNumber();