On 6 Feb 2012, at 9:49pm, Nico Williams wrote: > On Mon, Feb 6, 2012 at 2:27 PM, Roger Binns <[email protected]> wrote: >> Approximately zero percent of SQLite databases will be on btrfs for the >> foreseeable future, even if you and I start using btrfs. Android 3 and >> above do support encrypting the filesystem which effectively gives you a >> lot of the checksumming, although filesystem implementations tend to care >> far more about metadata than file contents. > > Encryption is not enough. You really need block pointers to carry the > block checksum/hash/MAC/integrity tag.
File systems (FAT, NTFS, HTFS) already have block checksums. So do network file systems (AFP, SMB, NFS). Adding more to SQLite, whether at a row or page level, would catch only cases where the communication was correct at the storage level but wrong at the semantic level -- which /should/ mean it can catch /only/ bugs in SQLite. Problem is, what would you do if a checksum was wrong ? Signal it in a newly-invented result code ? Then what ? All apps would have to have some logic to cope with the situation. What should a simple app do about it ? How many more lines of code would that add to apps which use SQLite specially because of its low overheads ? I don't think it's worth doing this in a thin/light/fast system like SQLite. Not only does it all weight to the API, it also adds weight to any app which uses it. And the number of bugs that cause corruption that would be spotted this way seems to be low. Instead perhaps it would be better to look into logic which does simple monitoring at the structure level, e.g. checking that if a command should add three rows, it really does add three rows. (Although some sort of analysis of the corruption bugs previously found in SQLite should be undertaken first.) These can be enabled/disabled with a compilation flag, whereas a checksum can't because you always need to calculate it. Simon. _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

