This is an automated email from the ASF dual-hosted git repository.
twice pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/kvrocks.git
The following commit(s) were added to refs/heads/unstable by this push:
new 7846492cb feat(event): add logging for blob file creation and deletion
(#3014)
7846492cb is described below
commit 7846492cbb807e0657b7ff9acf6b42f4b244f4c8
Author: Ryan Liao <[email protected]>
AuthorDate: Thu Jun 5 00:16:40 2025 -0400
feat(event): add logging for blob file creation and deletion (#3014)
Co-authored-by: mwish <[email protected]>
---
src/storage/event_listener.cc | 35 ++++++++++++++++++++++++++++-------
src/storage/event_listener.h | 6 ++++--
2 files changed, 32 insertions(+), 9 deletions(-)
diff --git a/src/storage/event_listener.cc b/src/storage/event_listener.cc
index 45cc59a0e..55d8843f3 100644
--- a/src/storage/event_listener.cc
+++ b/src/storage/event_listener.cc
@@ -34,7 +34,7 @@ std::string BackgroundErrorReason2String(const
rocksdb::BackgroundErrorReason re
return "unknown";
}
-std::string FileCreatedReason2String(const rocksdb::TableFileCreationReason
reason) {
+std::string TableFileCreatedReason2String(const
rocksdb::TableFileCreationReason reason) {
std::vector<std::string> file_created_reason = {"flush", "compaction",
"recovery", "misc"};
if (static_cast<size_t>(reason) < file_created_reason.size()) {
return file_created_reason[static_cast<size_t>(reason)];
@@ -42,6 +42,14 @@ std::string FileCreatedReason2String(const
rocksdb::TableFileCreationReason reas
return "unknown";
}
+std::string BlobFileCreatedReason2String(const rocksdb::BlobFileCreationReason
reason) {
+ std::vector<std::string> blob_file_created_reason = {"flush", "compaction",
"recovery"};
+ if (static_cast<size_t>(reason) < blob_file_created_reason.size()) {
+ return blob_file_created_reason[static_cast<size_t>(reason)];
+ }
+ return "unknown";
+}
+
std::string StallConditionType2String(const rocksdb::WriteStallCondition type)
{
switch (type) {
case rocksdb::WriteStallCondition::kDelayed:
@@ -169,11 +177,6 @@ void
EventListener::OnBackgroundError(rocksdb::BackgroundErrorReason reason, roc
error("[event_listener/background_error] reason: {}, bg_error: {}",
reason_str, error_str);
}
-void EventListener::OnTableFileDeleted(const rocksdb::TableFileDeletionInfo
&table_info) {
- info("[event_listener/table_file_deleted] db: {}, sst file: {}, status: {}",
table_info.db_name, table_info.file_path,
- table_info.status.ToString());
-}
-
void EventListener::OnStallConditionsChanged(const rocksdb::WriteStallInfo
&info) {
warn("[event_listener/stall_cond_changed] column family: {} write stall
condition was changed, from {} to {}",
info.cf_name, StallConditionType2String(info.condition.prev),
StallConditionType2String(info.condition.cur));
@@ -184,5 +187,23 @@ void EventListener::OnTableFileCreated(const
rocksdb::TableFileCreationInfo &tab
"[event_listener/table_file_created] column family: {}, file path: {},
file size: {}, job_id: {}, reason: {}, "
"status: {}",
table_info.cf_name, table_info.file_path, table_info.file_size,
table_info.job_id,
- FileCreatedReason2String(table_info.reason),
table_info.status.ToString());
+ TableFileCreatedReason2String(table_info.reason),
table_info.status.ToString());
+}
+
+void EventListener::OnTableFileDeleted(const rocksdb::TableFileDeletionInfo
&table_info) {
+ info("[event_listener/table_file_deleted] db: {}, sst file: {}, status: {}",
table_info.db_name, table_info.file_path,
+ table_info.status.ToString());
+}
+
+void EventListener::OnBlobFileCreated(const rocksdb::BlobFileCreationInfo
&blob_info) {
+ info(
+ "[event_listener/blob_file_created] column family: {}, file path: {},
blob count: {}, blob bytes: {}, job_id: {}"
+ ", reason: {}, status: {}",
+ blob_info.cf_name, blob_info.file_path, blob_info.total_blob_count,
blob_info.total_blob_bytes, blob_info.job_id,
+ BlobFileCreatedReason2String(blob_info.reason),
blob_info.status.ToString());
+}
+
+void EventListener::OnBlobFileDeleted(const rocksdb::BlobFileDeletionInfo
&blob_info) {
+ info("[event_listener/blob_file_deleted] db: {}, blob file: {}, status: {}",
blob_info.db_name, blob_info.file_path,
+ blob_info.status.ToString());
}
diff --git a/src/storage/event_listener.h b/src/storage/event_listener.h
index 6f16d69b1..6773000dc 100644
--- a/src/storage/event_listener.h
+++ b/src/storage/event_listener.h
@@ -37,9 +37,11 @@ class EventListener : public rocksdb::EventListener {
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;
- void OnTableFileCreated(const rocksdb::TableFileCreationInfo &info) override;
+ void OnTableFileCreated(const rocksdb::TableFileCreationInfo &table_info)
override;
+ void OnTableFileDeleted(const rocksdb::TableFileDeletionInfo &table_info)
override;
+ void OnBlobFileCreated(const rocksdb::BlobFileCreationInfo &blob_info)
override;
+ void OnBlobFileDeleted(const rocksdb::BlobFileDeletionInfo &blob_info)
override;
private:
engine::Storage *storage_ = nullptr;