Thank you for the explanation, especially the clarification about F_FULLFSYNC and newly created parent directories. I have one follow-up about a directory's state after a deletion.
For the same macOS 15.7.2 / local APFS scenario, please consider this proposed, untested sequence. The paths below are illustrative. Assume all relevant files and directories are on the same device, the device correctly honors flush requests, and no concurrent writes, deletions, or replacements occur.
SQLite has unlinked R/start.sqlite-journal as part of committing the initial catalog transaction in rollback-journal mode DELETE, and COMMIT has returned successfully. The catalog and journal are in the same directory R. I do not assume that the COMMIT return alone establishes power-loss durability.
All SQLite connections and other SQLite use of this catalog have actually ended. No uncommitted transaction or outstanding SQLite operation remains.
Native code opens the same existing R/start.sqlite without creating or truncating it, calls fcntl(fd, F_FULLFSYNC), and directly receives a successful return from that call. A failed call is not treated as successful by substituting a fallback synchronization result.
For this question, we do not rely on a separate successful directory fsync after the journal unlink. In particular, please consider the case where that directory sync was skipped or did not succeed.
Does the successful F_FULLFSYNC on the catalog file also make R's updated directory state after the unlink durable, so that the journal deletion survives an OS crash or sudden power loss occurring after that successful return, under the assumptions above? This includes any relevant unlink metadata still in filesystem memory, rather than only data already in the device's cache.
If this is not covered or requires additional conditions, please identify the documented, supported operation and ordering, if any, needed for this directory update, together with any applicability limits. If the guarantee is unspecified for this configuration, please distinguish that from an unsupported operation.
I am asking only about this filesystem synchronization boundary, not validation of the application's overall recovery protocol. I am not asking about interruptions before the successful F_FULLFSYNC return or arbitrary hardware failure. The proposed sequence has not been implemented or tested.
Thank you.
Topic:
App & System Services
SubTopic:
Core OS