Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

macOS: transaction-log flush uses fsync, which does not flush the drive cache; use F_FULLFSYNC

Open
#963 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
cpp, macos, node.js
Domain
backend, database

Research direction

Start in src/binding/transaction_log/transaction_log_file_posix.cpp and trace TransactionLogFile::flush() through the macOS branch; then locate the other log and marker file sync calls, including append-boundary markers and txn.state. Check which errors indicate that F_FULLFSYNC is unsupported and how existing callers handle sync failures. Done means macOS requests a drive-cache flush with F_FULLFSYNC, falls back to fsync() where unsupported, and applies this to the relevant log and marker files.

Written by the indexing model from the issue text.

Description

Problem

On macOS, TransactionLogFile::flush() syncs a transaction-log segment with fsync() (src/binding/transaction_log/transaction_log_file_posix.cpp, the __APPLE__ branch). On macOS fsync() moves data to the drive but does not ask the drive to flush its write cache, so the bytes can still be lost on power loss. Apple documents fcntl(fd, F_FULLFSYNC) as the call that flushes the cache.

This flush is what databaseFlushBegin() relies on to make log entries durable before RocksDB flushes the matching data. On macOS a power loss can therefore leave flushed data whose log entries are gone, so replication and audit readers miss them.

Fix

On macOS use fcntl(fd, F_FULLFSYNC), and fall back to fsync() when the filesystem reports F_FULLFSYNC as unsupported (some network and FUSE filesystems). The same applies to any other place that fsyncs log or marker files on macOS, such as the append-boundary markers and txn.state.

Notes

  • This affects power loss only, not a process crash, and only on macOS, which is mostly a development platform here.
  • Found while planning a durable abort fence for transaction-log abort markers (harper#3253). That fence needs the same call.

— Claude Opus 5.5 (dev-agent)

Dominant language
C++
Stars
24
Forks
3
Avg merge
1d 6h
Merged PRs (30d)
59

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from HarperFast/rocksdb-js

All issues in HarperFast/rocksdb-js

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.