Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: [DocDB] Add additional logging about SST files #25465

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/yb/rocksdb/db/compaction_picker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1363,9 +1363,9 @@ void UniversalCompactionPicker::SortedRun::DumpSizeInfo(
snprintf(out_buf, out_buf_size,
"file %" PRIu64 "[%" ROCKSDB_PRIszt
"] "
"with size %" PRIu64 " (compensated size %" PRIu64 ")",
"with size %" PRIu64 " (compensated size %" PRIu64 "), metadata size %" PRIu64,
file->fd.GetNumber(), sorted_run_count, file->fd.GetTotalFileSize(),
file->compensated_file_size);
file->compensated_file_size, file->fd.GetBaseFileSize());
} else {
snprintf(out_buf, out_buf_size,
"level %d[%" ROCKSDB_PRIszt
Expand Down
4 changes: 3 additions & 1 deletion src/yb/rocksdb/db/event_helpers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ void EventHelpers::LogAndNotifyTableFileCreation(
<< "job" << info.job_id
<< "event" << "table_file_creation"
<< "file_number" << fd.GetNumber()
<< "file_size" << fd.GetTotalFileSize();
<< "file_size" << fd.GetTotalFileSize()
<< "metadata_size" << fd.GetBaseFileSize()
<< "cache_key_prefix" << info.table_properties.cache_key_prefix;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"metadata_cache_key_prefix" ?


// table_properties
{
Expand Down
11 changes: 11 additions & 0 deletions src/yb/rocksdb/table/block_based_table_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@
#include <inttypes.h>
#include <stdio.h>

#include <iomanip>
#include <map>
#include <memory>
#include <sstream>
#include <string>
#include <unordered_map>
#include <utility>
Expand Down Expand Up @@ -457,6 +459,15 @@ BlockBasedTableBuilder::BlockBasedTableBuilder(
/* meta_block_checksum = */ 0,
&rep_->metadata_writer->compressed_cache_key_prefix);
}

// Convert the binary data in the prefix buffer to a single hex-formatted string for logging.
std::ostringstream hex_stream;
hex_stream << std::hex << std::setw(2) << std::setfill('0');
for (size_t i = 0; i < rep_->metadata_writer->compressed_cache_key_prefix.size; ++i) {
hex_stream << static_cast<unsigned int>(
static_cast<unsigned char>(rep_->metadata_writer->compressed_cache_key_prefix.data[i]));
}
rep_->props.cache_key_prefix = hex_stream.str();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can just use

rep_->props.metadata_cache_key_prefix = Slice(rep_->metadata_writer->compressed_cache_key_prefix.data, rep_->metadata_writer->compressed_cache_key_prefix.size).ToDebugHexString();

}
}

Expand Down
2 changes: 2 additions & 0 deletions src/yb/rocksdb/table_properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ struct TableProperties {
// The name of the filter policy used in this table.
// If no filter policy is used, `filter_policy_name` will be an empty string.
std::string filter_policy_name;
// Cache key prefix used for detecting collision of SST table.
std::string cache_key_prefix = "";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

metadata_cache_key_prefix_hex_str?
BTW, do we need data file cache key prefix as well?


// user collected properties
UserCollectedProperties user_collected_properties;
Expand Down