> I’m the architect of Couchbase Lite and the lead developer for iOS and > macOS. I enabled SQLite’s memory-mapped I/O at least two years ago. I never > considered it could be problematic since (a) Brendan is IIRC the only > iOS/Mac developer who’s reported database corruption, and (b) I assumed > scenarios like this would be covered as part of SQLite testing, either by > SQLite themselves or by Apple. >
Well, perhaps the way I've been bundling the db.sqlite file within a package triggers this particular bug. Although a package is really just a sub-folder, so I don't see how that would make a difference. I'm not sure. But I've been testing more and more now and by disabling the memory mapped I/O, the database file corruption bug appears to be gone. It's all working great now. And I could easily cause the corruption prior to that. I just reverted back to the build that included the memory mapped I/O call and I was again able to corrupt the database file with the power failure. Then I again used the version that had memory mapped I/O disabled and I was no longer able to corrupt the database. So I've tested it both ways repeatedly and I think I'm going to conclude that the memory mapped I/O call is the culprit. Thanks again Deon for sharing your experience with memory mapped I/O in SQLite on macOS. And thanks Jens for starting this thread to try and get to the bottom of this problem. Brendan _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users