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

Use human readable string instead of the integer when printing flush/compaction reason #1962

Merged
merged 6 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
31 changes: 29 additions & 2 deletions src/storage/event_listener.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,20 @@ bool IsDiskQuotaExceeded(const rocksdb::Status &bg_error) {
return err_msg.find(exceeded_quota_str) != std::string::npos;
}

void EventListener::OnCompactionBegin(rocksdb::DB *db, const rocksdb::CompactionJobInfo &ci) {
LOG(INFO) << "[event_listener/compaction_begin] column family: " << ci.cf_name << ", job_id: " << ci.job_id
<< ", compaction reason: " << rocksdb::GetCompactionReasonString(ci.compaction_reason)
<< ", output compression type: " << CompressType2String(ci.compression)
<< ", base input level(files): " << ci.base_input_level << "(" << ci.input_files.size() << ")"
<< ", output level(files): " << ci.output_level << "(" << ci.output_files.size() << ")"
<< ", input bytes: " << ci.stats.total_input_bytes << ", output bytes:" << ci.stats.total_output_bytes
<< ", is_manual_compaction:" << (ci.stats.is_manual_compaction ? "yes" : "no")
<< ", elapsed(micro): " << ci.stats.elapsed_micros;
git-hulk marked this conversation as resolved.
Show resolved Hide resolved
git-hulk marked this conversation as resolved.
Show resolved Hide resolved
}

void EventListener::OnCompactionCompleted(rocksdb::DB *db, const rocksdb::CompactionJobInfo &ci) {
LOG(INFO) << "[event_listener/compaction_completed] column family: " << ci.cf_name << ", job_id: " << ci.job_id
<< ", compaction reason: " << static_cast<int>(ci.compaction_reason)
<< ", compaction reason: " << rocksdb::GetCompactionReasonString(ci.compaction_reason)
<< ", output compression type: " << CompressType2String(ci.compression)
<< ", base input level(files): " << ci.base_input_level << "(" << ci.input_files.size() << ")"
<< ", output level(files): " << ci.output_level << "(" << ci.output_files.size() << ")"
Expand All @@ -88,9 +99,25 @@ void EventListener::OnCompactionCompleted(rocksdb::DB *db, const rocksdb::Compac
storage_->CheckDBSizeLimit();
}

void EventListener::OnSubcompactionBegin(const rocksdb::SubcompactionJobInfo &si) {
LOG(INFO) << "[event_listener/subcompaction_begin] column family: " << si.cf_name << ", job_id: " << si.job_id
<< ", compaction reason: " << rocksdb::GetCompactionReasonString(si.compaction_reason)
<< ", output compression type: " << CompressType2String(si.compression);
}

void EventListener::OnSubcompactionCompleted(const rocksdb::SubcompactionJobInfo &si) {
LOG(INFO) << "[event_listener/subcompaction_begin] column family: " << si.cf_name << ", job_id: " << si.job_id
git-hulk marked this conversation as resolved.
Show resolved Hide resolved
<< ", compaction reason: " << rocksdb::GetCompactionReasonString(si.compaction_reason)
<< ", output compression type: " << CompressType2String(si.compression)
<< ", base input level(files): " << si.base_input_level << ", output level(files): " << si.output_level
<< ", input bytes: " << si.stats.total_input_bytes << ", output bytes:" << si.stats.total_output_bytes
<< ", is_manual_compaction:" << (si.stats.is_manual_compaction ? "yes" : "no")
<< ", elapsed(micro): " << si.stats.elapsed_micros;
}

void EventListener::OnFlushBegin(rocksdb::DB *db, const rocksdb::FlushJobInfo &fi) {
LOG(INFO) << "[event_listener/flush_begin] column family: " << fi.cf_name << ", thread_id: " << fi.thread_id
<< ", job_id: " << fi.job_id << ", reason: " << static_cast<int>(fi.flush_reason);
<< ", job_id: " << fi.job_id << ", reason: " << rocksdb::GetFlushReasonString(fi.flush_reason);
}

void EventListener::OnFlushCompleted(rocksdb::DB *db, const rocksdb::FlushJobInfo &fi) {
Expand Down
4 changes: 4 additions & 0 deletions src/storage/event_listener.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ class EventListener : public rocksdb::EventListener {
~EventListener() override = default;
void OnFlushBegin(rocksdb::DB *db, const rocksdb::FlushJobInfo &fi) override;
void OnFlushCompleted(rocksdb::DB *db, const rocksdb::FlushJobInfo &fi) override;
void OnCompactionBegin(rocksdb::DB *db, const rocksdb::CompactionJobInfo &ci) override;
void OnCompactionCompleted(rocksdb::DB *db, const rocksdb::CompactionJobInfo &ci) override;
void OnSubcompactionBegin(const rocksdb::SubcompactionJobInfo &si) override;
void OnSubcompactionCompleted(const rocksdb::SubcompactionJobInfo &si) override;

void OnBackgroundError(rocksdb::BackgroundErrorReason reason, rocksdb::Status *status) override;
void OnTableFileDeleted(const rocksdb::TableFileDeletionInfo &info) override;
void OnStallConditionsChanged(const rocksdb::WriteStallInfo &info) override;
Expand Down
Loading