-
zig
General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.
Arguably, one should call `flush()` on the file first. Resource allocation must always succeed; otherwise a lot of invariants break. This is why Zig's close method[0] ignores errors (with the exception of `EBADF`).
[0]: https://github.com/ziglang/zig/blob/fb0028a0d7b43a2a5dd05f07...
-
InfluxDB
InfluxDB – Built for High-Performance Time Series Workloads. InfluxDB 3 OSS is now GA. Transform, enrich, and act on time series data directly in the database. Automate critical tasks and eliminate the need to move data externally. Download now.
-
That nobody has gone through the effort of collating its requirements and writing an RFC after https://github.com/rust-lang/rfcs/pull/770 was closed (back in 2015).
I assume a big issue is that this is full of edge cases up the ass, and the value is somewhat limited in the sense that if you know you want durable writes you'll sync() and know you're fucked if you get an error, but close() does not guarantee a sync to disk, as the linux man page indicates:
> A successful close does not guarantee that the data has been successfully saved to disk, as the kernel uses the buffer cache to defer writes.
-
"if you are creating a file, to ensure full synchronisation you also need to fsync the parent directory, otherwise the file can be fsynced but the update to the directory lost."
And if you need this in Java you still have resort to ugly hacks.
https://github.com/apache/lucene/issues/7231
-
MySQL
MySQL Server, the world's most popular open source database, and MySQL Cluster, a real-time, open source transactional database.
-
It doesn't really break the described scenario (implemented in my package https://github.com/dchest/safefile), because its guarantee is that the write is atomic, not that the write will not fail. Atomic means that either file is created/replaced fully or not created/not replaced at all. That is, no partial write is done. It doesn't protect against power failures (did disk firmware write out the contents after the OS commanded it to? Did OS perform fsync of file and fsync of directory in the correct order?), and fsyncing the parent directory only works on certain filesystems (I assume ZFS will have to sync the whole dnode tree before power failure).
-
Confused why this is showing as being 9 hours old when I remember seeing it on the front page a couple days ago. Search also seems to confirm this: https://hn.algolia.com/?dateRange=pastWeek&page=0&prefix=fal...
-
CppCoreGuidelines
The C++ Core Guidelines are a set of tried-and-true guidelines, rules, and best practices about coding in C++
> close a file (which ironically is the poster child for RAII)
Yes, I call this "RAII is a lie" (T-shirt pending).
Closing file descriptors is univerally used to showcase RAII, but it should never be used for that.
C++ has the same problem:
https://github.com/isocpp/CppCoreGuidelines/issues/2203
In there, it is acknowledged that a manual Close() should always be provided, and used if you want guarantees.
> is a bad pattern
Good that Rust at least figured it out early that it's a bad pattern!
Never use RAII in situations where the cleanup can fail!
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives