Skip to content

Commit

Permalink
Support flush reasons above 12 in Java integration (facebook#13246)
Browse files Browse the repository at this point in the history
Summary:
FlushReason enum in C++ has members up to 15, but in Java, the mirroring FlushReason only supports reason codes up to 12. This causes exceptions when adding a flush listener.

Pull Request resolved: facebook#13246

Reviewed By: pdillinger

Differential Revision: D68241620

Pulled By: jaykorean

fbshipit-source-id: 1e2856dad28dff0cbb1772f5a8ea03cc1e224088
  • Loading branch information
rpuch authored and facebook-github-bot committed Jan 17, 2025
1 parent 9798807 commit b98c21b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions include/rocksdb/listener.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ enum class FlushReason : int {
kWalFull = 0xd,
// SwitchMemtable will not be called for this flush reason.
kCatchUpAfterErrorRecovery = 0xe,

// When adding flush reason, make sure to also add it to FlushReason in Java.
};

const char* GetFlushReasonString(FlushReason flush_reason);
Expand Down
5 changes: 4 additions & 1 deletion java/src/main/java/org/rocksdb/FlushReason.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ public enum FlushReason {
DELETE_FILES((byte) 0x08),
AUTO_COMPACTION((byte) 0x09),
MANUAL_FLUSH((byte) 0x0a),
ERROR_RECOVERY((byte) 0xb);
ERROR_RECOVERY((byte) 0x0b),
ERROR_RECOVERY_RETRY_FLUSH((byte) 0x0c),
WAL_FULL((byte) 0x0d),
CATCH_UP_AFTER_ERROR_RECOVERY((byte) 0x0e);

private final byte value;

Expand Down

0 comments on commit b98c21b

Please sign in to comment.