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

UniversalCompactionPicker::SortedRun::DumpSizeInfo already prints som… #23538

Open
wants to merge 1 commit 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
26 changes: 26 additions & 0 deletions src/yb/rocksdb/db/compaction_picker.h
Original file line number Diff line number Diff line change
Expand Up @@ -390,3 +390,29 @@ CompressionType GetCompressionType(const ImmutableCFOptions& ioptions,
const bool enable_compression = true);

} // namespace rocksdb

// Add these new methods
uint64_t GetMetadataSize() const {
// Implementation depends on how metadata size is stored
return file->fd.GetMetadataSize();
}

uint64_t GetDataSize() const {
// Implementation depends on how data size is stored
return file->fd.GetDataSize();
}

void DumpSizeInfo(char* out_buf, size_t out_buf_size, bool print_path) const {
if (file != nullptr) {
snprintf(out_buf, out_buf_size,
"file %" PRIu64 "[%s] "
"size %" PRIu64 " : metadata size %" PRIu64 " : data size %" PRIu64,
file->fd.GetNumber(),
print_path ? file->fd.GetPathId().c_str() : "",
file->fd.GetFileSize(),
GetMetadataSize(),
GetDataSize());
} else {
snprintf(out_buf, out_buf_size, "n/a");
}
}
20 changes: 17 additions & 3 deletions src/yb/rocksdb/table/table_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ class TableBuilder {
// REQUIRES: Either Finish() or Abandon() has been called.
virtual ~TableBuilder() {}

// Get the block cache prefix as a series of bytes in hexadecimal
virtual std::string GetBlockCachePrefixHex() const = 0;

// Add key,value to the table being constructed.
// REQUIRES: key is after any previously added key according to comparator.
// REQUIRES: Finish(), Abandon() have not been called
Expand All @@ -103,9 +106,14 @@ class TableBuilder {
// Return non-ok iff some error has been detected.
virtual Status status() const = 0;

// Finish building the table.
// REQUIRES: Finish(), Abandon() have not been called
virtual Status Finish() = 0;
virtual Status Finish() {
// ... (existing code) ...

// Log the block cache prefix
std::string prefix_hex = GetBlockCachePrefixHex();
ROCKS_LOG_INFO(ioptions_.info_log, "SST file created with block cache prefix: %s",
prefix_hex.c_str());
}

// Indicate that the contents of this builder should be abandoned.
// If the caller is not going to call Finish(), it must call Abandon()
Expand All @@ -125,6 +133,12 @@ class TableBuilder {
// metadata is stored in base file while data is split among data files (S-Blocks).
virtual uint64_t BaseFileSize() const = 0;

// Get the size of the file's metadata
virtual uint64_t MetadataSize() const = 0;

// Get the size of the file's data
virtual uint64_t DataSize() const = 0;

// If the user defined table properties collector suggest the file to
// be further compacted.
virtual bool NeedCompact() const { return false; }
Expand Down