Skip to content

Commit

Permalink
Export GetCompactionReasonString/GetFlushReasonString by moving them …
Browse files Browse the repository at this point in the history
…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: #11778

Reviewed By: jaykorean

Differential Revision: D49012934

Pulled By: ajkr

fbshipit-source-id: a4935b95d70c1be02aec65da7bf1c98a8cf8b933
  • Loading branch information
git-hulk authored and facebook-github-bot committed Sep 6, 2023
1 parent 6a98471 commit 3f54b96
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/rocksdb/listener.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ enum class CompactionReason : int {
kNumOfReasons,
};

const char* GetCompactionReasonString(CompactionReason compaction_reason);

enum class FlushReason : int {
kOthers = 0x00,
kGetLiveFiles = 0x01,
Expand All @@ -180,6 +182,8 @@ 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
Expand Down

0 comments on commit 3f54b96

Please sign in to comment.