News for hackers. Stuff that matters.
Re:Samsung's 970 EVO SSDs Reviewed – 500GB and 1TB by imtringued on Wednesday April 25, 2018 @06:38AM (#16920253)
>Doesn't software like databases that care about this already assume the OS flush return values are bogus?

The best a database can do is prevent corruption. It cannot magically prevent data loss of writes that have never reached the platter or NAND.

>And it still doesn't solve the problem of the host buffers disappearing. What's the scenario, the host experiences a power-loss, but was somehow anticipating it and managed to stop writing to the SSD?

You solve the problem of host buffers disappearing by using fsync. The scenario is that fsync works correctly on powerloss.

Imagine you build an app consisting of 3 microservices. They are called Human, CPU and Disk.

The human sends a request via a website to the CPU. The CPU wants to save the host buffer in a database and sends a fsync request to the Disk. The Disk sends an "OK" response immediately but actually saves the data in the background. The CPU sends an "OK" response to the human. Everything is fine. Suddenly powerloss happens and the disk cannot save the data in time. The database is smart, it knows how to reconstruct some of the data until the point where the transaction log has been cut off. Beyond that though the data is gone and the "OK" sent to the Human is no longer valid.

Now imagine the same scenario with correct fsync. The CPU waits for the Disk and during a powerloss not only is the disk dead but the CPU is dead too and it therefore cannot send an "OK" response to the Human.

What if you don't use fsync? What if you pipe your data to /dev/null? Well, here is the tough news: Nobody can help you. If you don't write data to disk then it's gone.

There are no comments on this comment yet.