Skip to content

PHOENIX-7815 Make WAL sync durability configurable#2434

Merged
tkhurana merged 1 commit into
apache:PHOENIX-7562-feature-newfrom
tkhurana:PHOENIX-7815
May 1, 2026
Merged

PHOENIX-7815 Make WAL sync durability configurable#2434
tkhurana merged 1 commit into
apache:PHOENIX-7562-feature-newfrom
tkhurana:PHOENIX-7815

Conversation

@tkhurana
Copy link
Copy Markdown
Contributor

Summary

  • Make the replication log writer's sync durability configurable via the existing hbase.wal.hsync HBase property (default false, matching HRegion.DEFAULT_WAL_HSYNC).
  • When hbase.wal.hsync=true, sync() calls hsync() (forces fsync to disk). When false (the default), it calls hflush() (flushes to datanode memory only), trading durability for lower latency.
  • Plumbs the flag through LogFileWriterContext into both HDFSDataOutput and AsyncFSDataOutput, which previously hard-coded hsync() in sync().

Changes

  • LogFileWriterContext: read hbase.wal.hsync from config (defaults to HRegion.DEFAULT_WAL_HSYNC = false); add getUseHsync()/setUseHsync(); include useHsync in toString().
  • HDFSDataOutput / AsyncFSDataOutput: accept useHsync in constructor; sync() dispatches to hsync() or hflush() based on the flag.
  • LogFileWriter: propagate context.getUseHsync() when constructing HDFSDataOutput.
  • Tests: LogFileFormatTest updated for the new constructor arg; LogFileWriterSyncTest adds testSyncWithHflush and sets hbase.wal.hsync=true explicitly in the existing hsync test.

Test plan

  • mvn test -pl phoenix-core -Dtest=LogFileWriterSyncTest — 5/5 pass
  • mvn test -pl phoenix-core -Dtest=LogFileFormatTest — 16/16 pass
  • mvn spotless:apply clean

@tkhurana tkhurana requested a review from lokiore April 30, 2026 20:11
Copy link
Copy Markdown
Contributor

@lokiore lokiore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tkhurana tkhurana merged commit cdcd3e7 into apache:PHOENIX-7562-feature-new May 1, 2026
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.

2 participants