Commit 44668f8c authored by Connor's avatar Connor Committed by pingcap-github-bot

Add log for blob file range (#101)

parent 73221d42
...@@ -585,8 +585,10 @@ Status BlobGCJob::DeleteInputBlobFiles() { ...@@ -585,8 +585,10 @@ Status BlobGCJob::DeleteInputBlobFiles() {
edit.SetColumnFamilyID(blob_gc_->column_family_handle()->GetID()); edit.SetColumnFamilyID(blob_gc_->column_family_handle()->GetID());
for (const auto& file : blob_gc_->sampled_inputs()) { for (const auto& file : blob_gc_->sampled_inputs()) {
ROCKS_LOG_INFO(db_options_.info_log, ROCKS_LOG_INFO(db_options_.info_log,
"Titan add obsolete file [%" PRIu64 "]", "Titan add obsolete file [%" PRIu64 "] range [%s, %s]",
file->file_number()); file->file_number(),
file->smallest_key().ToString(true).c_str(),
file->largest_key().ToString(true).c_str());
metrics_.gc_num_files++; metrics_.gc_num_files++;
RecordInHistogram(stats_, TitanStats::GC_INPUT_FILE_SIZE, RecordInHistogram(stats_, TitanStats::GC_INPUT_FILE_SIZE,
file->file_size()); file->file_size());
......
...@@ -33,6 +33,7 @@ Status BlobStorage::GetBlobFilesInRanges(const RangePtr* ranges, size_t n, ...@@ -33,6 +33,7 @@ Status BlobStorage::GetBlobFilesInRanges(const RangePtr* ranges, size_t n,
const Slice* end = ranges[i].limit; const Slice* end = ranges[i].limit;
auto cmp = cf_options_.comparator; auto cmp = cf_options_.comparator;
std::string tmp;
// nullptr means the minimum or maximum. // nullptr means the minimum or maximum.
for (auto it = ((begin != nullptr) ? blob_ranges_.lower_bound(*begin) for (auto it = ((begin != nullptr) ? blob_ranges_.lower_bound(*begin)
: blob_ranges_.begin()); : blob_ranges_.begin());
...@@ -49,15 +50,19 @@ Status BlobStorage::GetBlobFilesInRanges(const RangePtr* ranges, size_t n, ...@@ -49,15 +50,19 @@ Status BlobStorage::GetBlobFilesInRanges(const RangePtr* ranges, size_t n,
(include_end && cmp->Compare(it->second->largest_key(), *end) <= 0) || (include_end && cmp->Compare(it->second->largest_key(), *end) <= 0) ||
(!include_end && cmp->Compare(it->second->largest_key(), *end) < 0)) { (!include_end && cmp->Compare(it->second->largest_key(), *end) < 0)) {
files->push_back(it->second->file_number()); files->push_back(it->second->file_number());
if (!tmp.empty()) {
tmp.append(" ");
}
tmp.append(std::to_string(it->second->file_number()));
} }
assert(it->second->smallest_key().empty() || assert(it->second->smallest_key().empty() ||
(!begin || cmp->Compare(it->second->smallest_key(), *begin) >= 0)); (!begin || cmp->Compare(it->second->smallest_key(), *begin) >= 0));
} }
ROCKS_LOG_INFO(db_options_.info_log, ROCKS_LOG_INFO(
"Get %" PRIuPTR " blob files in the range [%s, %s%c", db_options_.info_log,
files->size(), begin ? begin->ToString(true).c_str() : " ", "Get %" PRIuPTR " blob files [%s] in the range [%s, %s%c",
end ? end->ToString(true).c_str() : " ", files->size(), tmp.c_str(), begin ? begin->ToString(true).c_str() : " ",
include_end ? ']' : ')'); end ? end->ToString(true).c_str() : " ", include_end ? ']' : ')');
} }
return Status::OK(); return Status::OK();
} }
......
...@@ -68,8 +68,10 @@ class TitanDBImpl::FileManager : public BlobFileManager { ...@@ -68,8 +68,10 @@ class TitanDBImpl::FileManager : public BlobFileManager {
if (!s.ok()) return s; if (!s.ok()) return s;
ROCKS_LOG_INFO(db_->db_options_.info_log, ROCKS_LOG_INFO(db_->db_options_.info_log,
"Titan adding blob file [%" PRIu64 "]", "Titan adding blob file [%" PRIu64 "] range [%s, %s]",
file.first->file_number()); file.first->file_number(),
file.first->smallest_key().ToString(true).c_str(),
file.first->largest_key().ToString(true).c_str());
edit.AddBlobFile(file.first); edit.AddBlobFile(file.first);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment