RATIS-2581. Add pluggable file destroyer by HTHou · Pull Request #1499 · apache/ratis · GitHub
Skip to content

RATIS-2581. Add pluggable file destroyer#1499

Open
HTHou wants to merge 1 commit into
apache:masterfrom
HTHou:ratis-2581-file-destroyer
Open

RATIS-2581. Add pluggable file destroyer#1499
HTHou wants to merge 1 commit into
apache:masterfrom
HTHou:ratis-2581-file-destroyer

Conversation

@HTHou

@HTHou HTHou commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Add a pluggable file destroyer for Ratis local storage cleanup paths.

The default destroyer preserves the existing behavior using regular filesystem delete and truncate operations. Embedders may install a custom destroyer through FileUtils so that Ratis-managed files can use the same destruction policy as the embedding system.

This patch also routes several normal cleanup paths through FileUtils so they use the configured destroyer, including atomic output stream temporary-file cleanup, zero-size open log segment cleanup, recursive delete cleanup, and buffered log file truncation. Delete-on-exit paths remain on native File.deleteOnExit() to preserve the JDK shutdown ordering semantics.

https://issues.apache.org/jira/browse/RATIS-2581

How was this patch tested?

  • Added TestFileUtils#testRatisFileDestroyerHook.
  • Ran git diff --check and git diff --cached --check.
  • Ran ./mvnw -pl ratis-common -Dtest=TestFileUtils test.
  • Ran ./mvnw -pl ratis-server -am -DskipTests compile.

@HTHou HTHou changed the title RATIS-2581. Add pluggable file destruction hook RATIS-2581. Add pluggable file destroyer Jun 30, 2026
@HTHou HTHou marked this pull request as ready for review June 30, 2026 07:58
@HTHou HTHou force-pushed the ratis-2581-file-destroyer branch 3 times, most recently from b5117d0 to cb7edeb Compare June 30, 2026 09:48
@HTHou HTHou force-pushed the ratis-2581-file-destroyer branch from cb7edeb to 7bd1336 Compare June 30, 2026 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant