Comment 100 for bug 317781

Revision history for this message
Ethan Tira-Thompson (ejtttje) wrote :

I strongly agree with Aigars Mahinovs in comment 98, the problem here is not the delayed sync to disk; the problem is the significant discrepancy in time between truncating the old data and syncing the new data. Particularly in case (2), the nice thing to do here is to make renaming a file depend on flushing pending data for the file: either delay syncing the rename, or force the flush on the data.

As a developer, I can understand how (1) would be risky if power loss occurred between the truncate and data flush. But (2) should be *made to be* a safe operation (even if not POSIX required), particularly if this can be done without a huge performance loss. By delaying the rename until after the data flush, this shouldn't be a problem.