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. 41
      utilities/blob_db/blob_compaction_filter.cc
  2. 5
      utilities/blob_db/blob_db_impl.h

@ -175,11 +175,13 @@ bool BlobIndexCompactionFilterBase::OpenNewBlobFileIfNeeded() const {
assert(blob_db_impl);
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()) {
ROCKS_LOG_ERROR(blob_db_impl->db_options_.info_log,
"Error opening new blob file during GC, status: %s",
s.ToString().c_str());
ROCKS_LOG_ERROR(
blob_db_impl->db_options_.info_log,
"Error opening new blob file during compaction/GC, status: %s",
s.ToString().c_str());
blob_file_.reset();
writer_.reset();
return false;
@ -202,11 +204,12 @@ bool BlobIndexCompactionFilterBase::ReadBlobFromOldFile(
blob, compression_type);
if (!s.ok()) {
ROCKS_LOG_ERROR(blob_db_impl->db_options_.info_log,
"Error reading blob during GC, key: %s (%s), status: %s",
key.ToString(/* output_hex */ true).c_str(),
blob_index.DebugString(/* output_hex */ true).c_str(),
s.ToString().c_str());
ROCKS_LOG_ERROR(
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(),
blob_index.DebugString(/* output_hex */ true).c_str(),
s.ToString().c_str());
return false;
}
@ -248,11 +251,12 @@ bool BlobIndexCompactionFilterBase::WriteBlobToNewFile(
const BlobDBImpl* const blob_db_impl = context_.blob_db_impl;
assert(blob_db_impl);
ROCKS_LOG_ERROR(
blob_db_impl->db_options_.info_log,
"Error writing blob to new file %s during GC, key: %s, status: %s",
blob_file_->PathName().c_str(),
key.ToString(/* output_hex */ true).c_str(), s.ToString().c_str());
ROCKS_LOG_ERROR(blob_db_impl->db_options_.info_log,
"Error writing blob to new file %s during compaction/GC, "
"key: %s, status: %s",
blob_file_->PathName().c_str(),
key.ToString(/* output_hex */ true).c_str(),
s.ToString().c_str());
return false;
}
@ -294,16 +298,17 @@ bool BlobIndexCompactionFilterBase::CloseAndRegisterNewBlobFile() const {
s = blob_db_impl->CloseBlobFile(blob_file_);
// 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_);
}
assert(blob_file_->Immutable());
if (!s.ok()) {
ROCKS_LOG_ERROR(blob_db_impl->db_options_.info_log,
"Error closing new blob file %s during GC, status: %s",
blob_file_->PathName().c_str(), s.ToString().c_str());
ROCKS_LOG_ERROR(
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_.reset();

@ -240,8 +240,9 @@ class BlobDBImpl : public BlobDB {
// 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_
// 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
// locks on write_mutex_ and the blob file's mutex_ can be avoided.
// to a single thread (like in the case of new files written during
// compaction/GC), the locks on write_mutex_ and the blob file's mutex_ can be
// avoided.
Status CloseBlobFile(std::shared_ptr<BlobFile> bfile);
// Close a file if its size exceeds blob_file_size

Loading…
Cancel
Save