Live data from Hacker News

Disks Lie: Building a WAL that actually survives

blog.canoozie.net

31–40 of 53 posts

Re: Disks Lie: Building a WAL that actually survives

#31

Earlier quoted context omitted.

> Unix is dumb I don't know. Now async I/O is all the rage and that is the same idea.

The syscall is literally called "sync", though.

I think it is a way of the OS to shoehorn async into a synchronously written application.

Re: Disks Lie: Building a WAL that actually survives

#32
post #21
post #13

I worked with a greybeard that instilled in me that when we were about to do some RAID maintenance that we would always run sync twice. The second to make sure it immediately returns. And I added a third for my own anxiety.

You need to sync twice because Unix is dumb: "According to the standard specification (e.g., POSIX.1-2001), sync() schedules the writes, but may return before the actual writing is done." https://man7.org/linux/man-pages/man2/sync.2.html

Then how do you know the writes are done after the second sync?

Re: Disks Lie: Building a WAL that actually survives

#34
post #27

> Submit the write to the primary file > Link fsync to that write (IOSQE_IO_LINK) > The fsync's completion queue entry only arrives after the write completes > Repeat for secondary file Wait, so the OS can re-order the fsync() to happen before the write request it is supposed to be syncing? Is there a citation or link to some code for that? It seems too ridiculous to be real. > O_DSYNC: Synchronous writes. Don't retu…

> Wait, so the OS can re-order the fsync() to happen before the write request it is supposed to be syncing? Is there a citation or link to some code for that? It seems too ridiculous to be real.

This is an io_uring-specific thing. It doesn't guarantee any ordering between operations submitted at the same time, unless you explicitly ask it to with the `IOSQE_IO_LINK` they mentioned.

Otherwise it's as if you called write() from one thread and fsync() from another, before waiting for the write() call to return. That obviously defeats the point of using fsync() so you wouldn't do that.

> If you call fsync(), [O_DSYNC] isn't needed correct? And if you use [O_DSYNC], then fsync() isn't needed right?

I believe you're right.

Re: Disks Lie: Building a WAL that actually survives

#35

> Conclusion > A production-grade WAL isn't just code, it's a contract. I hate that I'm now suspicious of this formulation.

In what sense? The phrasing is just a generalization, production-grade anything needs consideration of the needs and goals of the project.

https://en.wikipedia.org/wiki/Wikipedia:Signs_of_AI_writing

the language technique of negative parallel construction is a classic signal for AI writing

Re: Disks Lie: Building a WAL that actually survives

#36
post #32
post #21

Earlier quoted context omitted.

You need to sync twice because Unix is dumb: "According to the standard specification (e.g., POSIX.1-2001), sync() schedules the writes, but may return before the actual writing is done." https://man7.org/linux/man-pages/man2/sync.2.html

Then how do you know the writes are done after the second sync?

AFAIK multiple syncs can't happen at the same time so the second sync implicitly waits for the first one to complete.

Re: Disks Lie: Building a WAL that actually survives

#37

Earlier quoted context omitted.

In what sense? The phrasing is just a generalization, production-grade anything needs consideration of the needs and goals of the project.

“ isn’t just , it’s ” is an AI smell.

Wouldn't that just be because the construction is common in the training materials, which means it's a common construction in human writing?

Re: Disks Lie: Building a WAL that actually survives

#38
post #29

Earlier quoted context omitted.

> Unix is dumb I don't know. Now async I/O is all the rage and that is the same idea.

If they had a sync() system call and a wait_for_sync_to_finish() system call then you'd be right. But they didn't have those.

https://news.ycombinator.com/item?id=46268127 (To quote yourself :-) )

Re: Disks Lie: Building a WAL that actually survives

#39
post #37

Earlier quoted context omitted.

“ isn’t just , it’s ” is an AI smell.

Wouldn't that just be because the construction is common in the training materials, which means it's a common construction in human writing?

It must be, but any given article is likely to not be the average of the training material, and thus has a different expectedness of such a construction.

Re: Disks Lie: Building a WAL that actually survives

#40
post #27

> Submit the write to the primary file > Link fsync to that write (IOSQE_IO_LINK) > The fsync's completion queue entry only arrives after the write completes > Repeat for secondary file Wait, so the OS can re-order the fsync() to happen before the write request it is supposed to be syncing? Is there a citation or link to some code for that? It seems too ridiculous to be real. > O_DSYNC: Synchronous writes. Don't retu…

> Wait, so the OS can re-order the fsync() to happen before the write request it is supposed to be syncing? Is there a citation or link to some code for that? It seems too ridiculous to be real. This is an io_uring-specific thing. It doesn't guarantee any ordering between operations submitted at the same time, unless you explicitly ask it to with the `IOSQE_IO_LINK` they mentioned. Otherwise it's as if you called wri…

I guess I'm a bit confused why the author recommends using this flag and fsync.

Related: I would think that grouping your writes and then fsyncing rather than fsyncing every time would be more efficient but it looks like a previous commenter did some testing and that isn't always the case https://news.ycombinator.com/item?id=15535814

Post reply on HN