Hello, Vlad! On Mon, 2017-03-20 at 18:43 +0200, Vlad Khorsun wrote: > > Another issue at play here is early "disk full" failure path during > > CCH_mark rather then write_page, but I am not sure it really matters in > > terms of possible database corruption - "careful write" should in theory > > take care of things even if write_page fails due to "disk full" > > condition. > > Practice shows that careful write can't help there. And i failed to see how > CW could help in case of out of disk condition for delta file, which contains > pages not in database order.
Let me try to explain. Careful write strategy can be explained as follows: Database is changed by a sequence of atomic page write operations and database and algorithms are designed in a way so that each IO operation preserves consistency of database as a whole. So we are dealing with ordered sequence of IO transactions posted during cache flush operations (write_page). When encountering write error proper handling would be to stop writing any further pages in sequence (this could be slightly relaxed if precedence is taken into account). This should guaranty that database stays consistent when IO write fails for as long as last written state is preserved. Direction of write (delta file or main database file) is not important. Only the sequence of IO transactions matters. I explained what engine should have been doing to handle IO errors properly. Engine does something else here (see it releases page locks on IO errors in down_grade, for example). I do not understand why is it doing what it does - maybe you can help my understanding here. BTW, our "delta file" logic is not unique, so engine should handle it properly. There are many filesystems (for example log-structured FS or compressed FS or "write anywhere" FS like ZFS) that can fail with out-of-disk space condition on random write. Nikolay Samofatov ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel