News for hackers. Stuff that matters.
Re:Samsung's 970 EVO SSDs Reviewed – 500GB and 1TB by stefan_ on Tuesday April 24, 2018 @02:51PM (#16915485)
So what happens when you have "power-loss capacitors"? Since these things are limited the drive races to empty its buffers onto the SSD and then shuts down. It does not ask the host "are you done writing", so now instead you lose whatever the host had in its buffers. The host is gone anyway when the drive loses power.

No. Data loss protection needs to be built into the software itself, fixing that on the SSD level doesn't make a lot of sense. If anything, you install a UPS, and then of course you don't need to pay extra for SSD capacitors because the whole system keeps running through power loss and shuts down gracefully.

Re:Samsung's 970 EVO SSDs Reviewed – 500GB and 1TB by _wmd on Tuesday April 24, 2018 @03:13PM (#16915657)
The buffers maintained by the OS and drive are totally different, the entire point of having huge buffers in the device is so that it can agglomerate and reorder otherwise totally unrelated writes into flash banks it is presently convenient to write to.

When the OS flushes stuff to the device, it is done such that metadata writes reach the disk in an order that ensures a recoverable filesystem image on power failure. If the device does not preserve that ordering all bets are off. The mapping that goes on inside a SSD is of sufficient complexity that it's much easier to simply guarantee the device has enough independent power to ensure all acknowledged writes are persisted after acknowledgement, and that means capacitors, or best case, data (e.g. committed, acked DB transactions) that magically disappear during a power loss event.

You cannot have a device that temporarily writes to RAM and tells the host computer "OK that's on disk now" (i.e. every SSD in existence with a throughput exceeding a few MB/sec) be reliable without an independent source of power to ensure that RAM reaches flash in every situation

Re:Samsung's 970 EVO SSDs Reviewed – 500GB and 1TB by londons_explore on Wednesday April 25, 2018 @08:59AM (#16921098)
SD cards are the same. Many cards you can unplug from the host, only to find something that successfully fsync()'ed actually wasn't persisted to the underlying storage.
Re:Samsung's 970 EVO SSDs Reviewed – 500GB and 1TB by whitepoplar on Tuesday April 24, 2018 @02:57PM (#16915542)
Power-loss capacitors are needed because without them, flush commands issued by the OS return bogus values. Write confirmations are meaningless if the data isn't actually written to disk.
Re:Samsung's 970 EVO SSDs Reviewed – 500GB and 1TB by mindslight on Tuesday April 24, 2018 @03:18PM (#16915698)
It's actually even worse than this, in that long-ago written data could be in the process of being refreshed/remapped when power is lost. The drive's software should be designed to work atomically to prevent this, but that's a whole lot of edge testing we're hoping a company will do on its closed software.

Which is why things like cheap SD cards are notoriously unreliable, whereas Samsung SSDs are seen as decently reliable. What we really want is to get rid of these controller layers and let the OS directly manage the flash. But top of the line manufacturers are incentivized to decommodify their products to increase margins, and price-competitive manufacturers are inclined to stick to the same interface.

Re:Samsung's 970 EVO SSDs Reviewed – 500GB and 1TB by stefan_ on Tuesday April 24, 2018 @03:06PM (#16915608)
Doesn't software like databases that care about this already assume the OS flush return values are bogus?

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?

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.

Re:Samsung's 970 EVO SSDs Reviewed – 500GB and 1TB by makmanalp on Tuesday April 24, 2018 @07:56PM (#16917713)
> Doesn't software like databases that care about this already assume the OS flush return values are bogus?

Unsure of this (I would assume "it depends" and "probably not" because how else could it possibly know that anything is written to durable storage ever ever) but the idea is that if it didn't have to assume that life would be a lot easier.

> What's the scenario, the host experiences a power-loss, but was somehow anticipating it and managed to stop writing to the SSD?

If I understood your question correctly, databases and similar stuff write data in a way to try to solve exactly this problem, with write-ahead logs and such where you first write quickly and inexpensively to the log and then write to the database.