I am reading the old version of sqlite and I could not understand this part of the synchronization of all the pages. Code here.
** Writing all the dirty pages free in the database after synchronization is a ** Optimization not obvious. fsync () is an expensive operation so ** wants to minimize the number of times it is called. After a fsync () call, ** We are free to write dirty pages in the database. Is better ** to go ahead and write as many dirty pages as possible to minimize ** The risk of having to do another fsync () later. Writing dirty ** Free pages were observed in this way to make the operations of the database work. ** Up to 10 times faster.
If we synchronize first and then write dirty pages, how are all the pages synchronized?