Skip to content

CASSANDRA-14380: Tolerate EINVAL and ENOTSUP on directory fsync - #5148

Open
cheeeee wants to merge 1 commit into
apache:trunkfrom
cheeeee:CASSANDRA-14380-trunk
Open

CASSANDRA-14380: Tolerate EINVAL and ENOTSUP on directory fsync#5148
cheeeee wants to merge 1 commit into
apache:trunkfrom
cheeeee:CASSANDRA-14380-trunk

Conversation

@cheeeee

@cheeeee cheeeee commented Sep 10, 2026

Copy link
Copy Markdown

Status: changes requested — not ready to merge

The published /dev/null test does not establish directory-fsync behavior, error propagation, or cross-platform support.

Verification correction

Earlier descriptions overstated correctness and/or test coverage. Those claims are withdrawn. AI-assisted source review has been performed; this is not maintainer approval. Previously mixed build artifacts are not accepted as verification evidence. Corrective changes and clean, targeted verification are in progress; the published head has not yet been replaced.

Published head under review: 89d1dcbfb4ba46a869696b7f8af5ef1fe0a0f52a.

In POSIX and Linux VFS (fs/sync.c: vfs_fsync_range), filesystems that do
not implement directory synchronization (e.g. CephFS, NFS, GlusterFS,
FUSE, OverlayFS in Kubernetes) return -EINVAL or -EOPNOTSUPP/ENOTSUP
when fsync() is called on a directory descriptor.

NativeLibrary.trySync() previously treated any non-zero return code as a
catastrophic storage hardware error, unconditionally throwing FSWriteError.
Under Cassandra's default disk_failure_policy (die or stop), this caused
immediate JVM termination on startup or during the first memtable flush
when deployed on Ceph or Kubernetes volumes.

Following the proven practice of PostgreSQL (src/backend/storage/file/fd.c)
and RocksDB (env/io_posix.cc), treat EINVAL and ENOTSUP as capability
limitations of the underlying filesystem rather than fatal storage failures:
log a rate-limited WARN via NoSpamLogger and do not escalate to FSWriteError.
Physical disk write failures (EIO, EROFS, ENOSPC) remain strictly fatal.

Define platform-resolved ENOTSUP and EINVAL constants in NativeLibrary
to ensure clean portability across Linux and macOS/BSD.

Fixes: CASSANDRA-14380
@cheeeee
cheeeee force-pushed the CASSANDRA-14380-trunk branch from 2c79ceb to 89d1dcb Compare September 11, 2026 01:06
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