> On Dec 12, 2017, at 10:47 AM, Simon Slavin <slav...@bigfraud.org> wrote: > > See this thread: > > <http://sqlite.1065341.n5.nabble.com/SQLITE-vs-OSX-mmap-inevitable-catalog-corruption-td85620.html > > <http://sqlite.1065341.n5.nabble.com/SQLITE-vs-OSX-mmap-inevitable-catalog-corruption-td85620.html>>
That thread reported SQLite database corruption when writeable mmap was enabled, but didn't identify what caused it. There was also the following observation by Török Edwin, which no one ever replied to: >> I notice that SQLite doesn't use msync, and msync(2) says 'Without use of >> this call there is no guarantee that changes are written back before >> munmap(2) is called'. >> Is f(data)sync enough to ensure changed mmap pages are written to the disk? That sounds pretty suspicious to me; maybe the problem was just that sqlite needed to call msync? > This is the thread which led to memory mapping being disabled for writing on > macOS, as discussed here: > > <http://sqlite.1065341.n5.nabble.com/Re-Database-corruption-and-PRAGMA-fullfsync-on-macOS-td95366i20.html > > <http://sqlite.1065341.n5.nabble.com/Re-Database-corruption-and-PRAGMA-fullfsync-on-macOS-td95366i20.html>> Yup, and I was heavily involved in that thread :) Again, there was only circumstantial evidence that mmap was causing problems; no one seems to have gotten to the bottom of it. I’m skeptical about mmap being broken on Macs, since there are other production databases such as Realm* that use it heavily. (Though I am not sure whether Realm uses writeable mappings.) —Jens * and LMDB, but I am not sure if LMDB is in use on macOS. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users