From 7a8ce6138bbc32e24444cd4534615388de223676 Mon Sep 17 00:00:00 2001 From: git-hulk Date: Wed, 6 Sep 2023 10:07:21 -0700 Subject: [PATCH] Export GetCompactionReasonString/GetFlushReasonString by moving them into listener.h (#11778) Summary: Currently, rocksdb users would use the event listener to catch the compaction/flush event and log them if any. But now the reason is an integer type instead of a human-readable string, so we would like to convert them into a human-readable string. Pull Request resolved: https://github.com/facebook/rocksdb/pull/11778 Reviewed By: jaykorean Differential Revision: D49012934 Pulled By: ajkr fbshipit-source-id: a4935b95d70c1be02aec65da7bf1c98a8cf8b933 --- include/rocksdb/listener.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/rocksdb/listener.h b/include/rocksdb/listener.h index 1e92e6bd1..3b08ccd87 100644 --- a/include/rocksdb/listener.h +++ b/include/rocksdb/listener.h @@ -161,6 +161,8 @@ ROCKSDB_ENUM_CLASS(CompactionReason, int, kNumOfReasons ); +const char* GetCompactionReasonString(CompactionReason compaction_reason); + ROCKSDB_ENUM_CLASS(FlushReason, int, kOthers = 0x00, kGetLiveFiles = 0x01, @@ -180,6 +182,8 @@ ROCKSDB_ENUM_CLASS(FlushReason, int, kWalFull = 0xd ); +const char* GetFlushReasonString(FlushReason flush_reason); + // TODO: In the future, BackgroundErrorReason will only be used to indicate // why the BG Error is happening (e.g., flush, compaction). We may introduce // other data structure to indicate other essential information such as