commit: 7f3c6d37d21e703e364474c5d730584e3367442f
parent 39787baaef26153da283eb6bbd150a05bef69da8
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Mon, 13 Mar 2023 22:21:46 +0100
notes/unix-defects: Filesystem lack of transactions
Diffstat:
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/notes/index.xhtml b/notes/index.xhtml
@@ -52,7 +52,7 @@
<tr><td><a href="systems.json">systems.json</a></td><td data-value="642" data-type="int">642 B</td><td>2023-01-09 20:04:17</td></tr>
<tr><td><a href="tips.md">tips.md</a></td><td data-value="174" data-type="int">174 B</td><td>2021-01-17 06:20:02</td></tr>
<tr><td><a href="tuple_truth_table.txt">tuple_truth_table.txt</a></td><td data-value="792" data-type="int">792 B</td><td>2021-01-17 06:20:02</td></tr>
- <tr><td><a href="unix-defects">unix-defects</a></td><td data-value="4912" data-type="int">4 912 B</td><td>2023-03-08 22:29:32</td></tr>
+ <tr><td><a href="unix-defects">unix-defects</a></td><td data-value="5785" data-type="int">5 785 B</td><td>2023-03-13 21:22:22</td></tr>
<tr><td><a href="zfs">zfs</a></td><td data-value="1262" data-type="int">1 262 B</td><td>2021-01-17 06:20:02</td></tr>
</tbody>
</table>
diff --git a/notes/unix-defects.xhtml b/notes/unix-defects.xhtml
@@ -62,6 +62,17 @@
Compare this to Haiku
</p>
+ <h3 id="fs_atom">Filesystem lack of transactions</h3>
+ <p>
+ On Unixes, thanks to the lack of grouping writes into transactions (ie. <code>BEGIN … COMMIT</code> in SQL). The only way to get atomicity is to do manual Copy-on-Write: Copy to a temporary location, write there and then rename to the final destination, meaning you need to have full control over it to avoid race-conditions. And for atomicity over multiple files, a common parent directory is needed, otherwise you're in a bad state between the first rename and the last one.
+ </p>
+ <p>It also means:
+ <ul>
+ <li>Can't do safe operating system updates without ignoring the traditional hierarchy or separating in different filesystems (luckily ZFS subvolumes exists)</li>
+ <li>Horribly slow, you need to copy the file(s), even with hardlinking the ones you're not writing to, it takes a very long time</li>
+ </ul>
+ </p>
+
<h2>See Also</h2>
<ul>
<li><a href="https://utcc.utoronto.ca/~cks/space/blog/unix/CLibraryAPIRequiresC">The Unix C library API can only be reliably used from C</a></li>