https://bugs.openldap.org/show_bug.cgi?id=10296
Issue ID: 10296 Summary: Force a Mac OS full flush Product: LMDB Version: unspecified Hardware: All OS: Mac OS Status: UNCONFIRMED Keywords: needs_review Severity: normal Priority: --- Component: liblmdb Assignee: bugs@openldap.org Reporter: renault.cle@gmail.com Target Milestone: ---
Created attachment 1045 --> https://bugs.openldap.org/attachment.cgi?id=1045&action=edit Use a F_FULLFSYNC fcntl when committing on Mac OS
Hello Howard and Happy New Year,
As discussed in this issue [1], the LMDB durability is incorrect when committing. I propose the following patch that uses fcntl with the F_FULLFSYNC flag. The fcntl documentation is on this page [2].
Note that I kept the calls to msync/fsync for simplicity and because they don't cost much but feel free to skip them on Mac OS.
Have a nice day, kero
[1]: https://github.com/cberner/redb/pull/928#issuecomment-2567032808 [2]: https://developer.apple.com/library/archive/documentation/System/Conceptual/...
https://bugs.openldap.org/show_bug.cgi?id=10296
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Assignee|bugs@openldap.org |hyc@openldap.org Keywords|needs_review | Target Milestone|--- |0.9.34
https://bugs.openldap.org/show_bug.cgi?id=10296
Howard Chu hyc@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |CONFIRMED Ever confirmed|0 |1
--- Comment #1 from Howard Chu hyc@openldap.org --- Hi, thanks for the patch. There's a typo in it, the macro is F_FULLSYNC not F_FULLFSYNC. I'll just fix it and merge it.
https://bugs.openldap.org/show_bug.cgi?id=10296
--- Comment #2 from kero renault.cle@gmail.com --- Thank you, Howard, and my bad for that typo.
https://bugs.openldap.org/show_bug.cgi?id=10296
--- Comment #3 from Howard Chu hyc@openldap.org --- Fixed in git
https://bugs.openldap.org/show_bug.cgi?id=10296
Howard Chu hyc@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|CONFIRMED |RESOLVED Resolution|--- |TEST
--- Comment #4 from Howard Chu hyc@openldap.org --- (In reply to kero from comment #0)
Created attachment 1045 [details] Use a F_FULLFSYNC fcntl when committing on Mac OS
Hello Howard and Happy New Year,
As discussed in this issue [1], the LMDB durability is incorrect when committing. I propose the following patch that uses fcntl with the F_FULLFSYNC flag. The fcntl documentation is on this page [2].
Note that I kept the calls to msync/fsync for simplicity and because they don't cost much but feel free to skip them on Mac OS.
Sidenote: obviously the call to msync must remain, otherwise there's no guarantee that dirty pages get flushed at all, and then the fcntl would be a no-op.
https://bugs.openldap.org/show_bug.cgi?id=10296
--- Comment #5 from kero renault.cle@gmail.com --- Thanks for the info, Howard.
However, I am not sure about the difference between F_FULLFSYNC and F_FULLSYNC. Both seem to exist, but only the former is documented in the official Apple fcntl documentation [1]. On the other hand, this blog post [2] refers to both of them, and the Rust documentation [3] only refers to the former one.
Could you clarify this point for me, please?
[1]: https://developer.apple.com/library/archive/documentation/System/Conceptual/... [2]: https://mjtsai.com/blog/2022/02/17/apple-ssd-benchmarks-and-f_fullsync/ [3]: https://docs.rs/libc/latest/aarch64-apple-darwin/libc/index.html?search=F_FU...
https://bugs.openldap.org/show_bug.cgi?id=10296
--- Comment #6 from kero renault.cle@gmail.com --- Created attachment 1053 --> https://bugs.openldap.org/attachment.cgi?id=1053&action=edit Replace F_FULLSYNC by F_FULLFSYNC
Hey Howard,
I tried to use the patched version on the mdb.master3 branch (fc757af206) on macOS, but it doesn't compile. The F_FULLSYNC flag doesn't exist.
However, I tried using the F_FULLFSYNC flag, which compiled as expected. I linked a patch. Would you mind applying it to both branches, please?
Have a nice day, kero
https://bugs.openldap.org/show_bug.cgi?id=10296
--- Comment #7 from Quanah Gibson-Mount quanah@openldap.org ---
• ac89f424 by Howard Chu at 2025-02-19T09:15:27+00:00 ITS#10296 lmdb: fix typo in prev commit