Skip to content

PHOENIX-7815 Make WAL sync durability configurable#2434

Open
tkhurana wants to merge 1 commit intoapache:PHOENIX-7562-feature-newfrom
tkhurana:PHOENIX-7815
Open

PHOENIX-7815 Make WAL sync durability configurable#2434
tkhurana wants to merge 1 commit intoapache: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
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