Update some log messages in BlobDB to account for compaction filters (#7128)

Summary:
https://github.com/facebook/rocksdb/pull/6850, which added compaction
filter support to BlobDB, reused elements of the BlobDB GC mechanism.
This patch updates some log messages in this logic to account for this
fact; namely, it replaces mentions of "GC" with "compaction/GC" to avoid
confusion in cases when GC is not enabled.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/7128

Test Plan: `make check`

Reviewed By: zhichao-cao

Differential Revision: D22535371

Pulled By: ltamasi

fbshipit-source-id: 1f14f3b02ab9983728bbca1cf680420208d9a195
main
Levi Tamasi 4 years ago committed by Facebook GitHub Bot
parent de8c92a596
commit 687fbd0270
  1. 29
      utilities/blob_db/blob_compaction_filter.cc
  2. 5
      utilities/blob_db/blob_db_impl.h

@ -175,10 +175,12 @@ bool BlobIndexCompactionFilterBase::OpenNewBlobFileIfNeeded() const {
assert(blob_db_impl); assert(blob_db_impl);
const Status s = blob_db_impl->CreateBlobFileAndWriter( const Status s = blob_db_impl->CreateBlobFileAndWriter(
/* has_ttl */ false, ExpirationRange(), "GC", &blob_file_, &writer_); /* has_ttl */ false, ExpirationRange(), "compaction/GC", &blob_file_,
&writer_);
if (!s.ok()) { if (!s.ok()) {
ROCKS_LOG_ERROR(blob_db_impl->db_options_.info_log, ROCKS_LOG_ERROR(
"Error opening new blob file during GC, status: %s", blob_db_impl->db_options_.info_log,
"Error opening new blob file during compaction/GC, status: %s",
s.ToString().c_str()); s.ToString().c_str());
blob_file_.reset(); blob_file_.reset();
writer_.reset(); writer_.reset();
@ -202,8 +204,9 @@ bool BlobIndexCompactionFilterBase::ReadBlobFromOldFile(
blob, compression_type); blob, compression_type);
if (!s.ok()) { if (!s.ok()) {
ROCKS_LOG_ERROR(blob_db_impl->db_options_.info_log, ROCKS_LOG_ERROR(
"Error reading blob during GC, key: %s (%s), status: %s", blob_db_impl->db_options_.info_log,
"Error reading blob during compaction/GC, key: %s (%s), status: %s",
key.ToString(/* output_hex */ true).c_str(), key.ToString(/* output_hex */ true).c_str(),
blob_index.DebugString(/* output_hex */ true).c_str(), blob_index.DebugString(/* output_hex */ true).c_str(),
s.ToString().c_str()); s.ToString().c_str());
@ -248,11 +251,12 @@ bool BlobIndexCompactionFilterBase::WriteBlobToNewFile(
const BlobDBImpl* const blob_db_impl = context_.blob_db_impl; const BlobDBImpl* const blob_db_impl = context_.blob_db_impl;
assert(blob_db_impl); assert(blob_db_impl);
ROCKS_LOG_ERROR( ROCKS_LOG_ERROR(blob_db_impl->db_options_.info_log,
blob_db_impl->db_options_.info_log, "Error writing blob to new file %s during compaction/GC, "
"Error writing blob to new file %s during GC, key: %s, status: %s", "key: %s, status: %s",
blob_file_->PathName().c_str(), blob_file_->PathName().c_str(),
key.ToString(/* output_hex */ true).c_str(), s.ToString().c_str()); key.ToString(/* output_hex */ true).c_str(),
s.ToString().c_str());
return false; return false;
} }
@ -294,15 +298,16 @@ bool BlobIndexCompactionFilterBase::CloseAndRegisterNewBlobFile() const {
s = blob_db_impl->CloseBlobFile(blob_file_); s = blob_db_impl->CloseBlobFile(blob_file_);
// Note: we delay registering the new blob file until it's closed to // Note: we delay registering the new blob file until it's closed to
// prevent FIFO eviction from processing it during the GC run. // prevent FIFO eviction from processing it during compaction/GC.
blob_db_impl->RegisterBlobFile(blob_file_); blob_db_impl->RegisterBlobFile(blob_file_);
} }
assert(blob_file_->Immutable()); assert(blob_file_->Immutable());
if (!s.ok()) { if (!s.ok()) {
ROCKS_LOG_ERROR(blob_db_impl->db_options_.info_log, ROCKS_LOG_ERROR(
"Error closing new blob file %s during GC, status: %s", blob_db_impl->db_options_.info_log,
"Error closing new blob file %s during compaction/GC, status: %s",
blob_file_->PathName().c_str(), s.ToString().c_str()); blob_file_->PathName().c_str(), s.ToString().c_str());
} }

@ -240,8 +240,9 @@ class BlobDBImpl : public BlobDB {
// Close a file by appending a footer, and removes file from open files list. // Close a file by appending a footer, and removes file from open files list.
// REQUIRES: lock held on write_mutex_, write lock held on both the db mutex_ // REQUIRES: lock held on write_mutex_, write lock held on both the db mutex_
// and the blob file's mutex_. If called on a blob file which is visible only // and the blob file's mutex_. If called on a blob file which is visible only
// to a single thread (like in the case of new files written during GC), the // to a single thread (like in the case of new files written during
// locks on write_mutex_ and the blob file's mutex_ can be avoided. // compaction/GC), the locks on write_mutex_ and the blob file's mutex_ can be
// avoided.
Status CloseBlobFile(std::shared_ptr<BlobFile> bfile); Status CloseBlobFile(std::shared_ptr<BlobFile> bfile);
// Close a file if its size exceeds blob_file_size // Close a file if its size exceeds blob_file_size

Loading…
Cancel
Save