On 2016/06/29 4:28 PM, Simon Slavin wrote:
On 29 Jun 2016, at 10:17am, R Smith <rsm...@rsweb.co.za> wrote:
I know I can write nonsense over the file, but I was hoping to be able to cause
specific common corruptions, like Invalid-Schema, Missing Index entries,
Missing pages etc. with this command. It need not be fancy, just find the first
table that can be corrupted in the DB, and mess with it enough to fail an
integrity check, but still work if possible.
Trouble is that whatever checking you develop might spot precisely the fault
that the simulator introduces but not a slightly different one. For instance
if there's something special about the last row in a page it might spot all
missing rows in the index except if the missing row is the last one on the page.
Of course, but that's an aside wish for me, the main aim here is to
enable the systems we make to be tested for reporting of and surviving
of corrupted DBs for different styles of corruption. One that can
repeatedly be invoked in a test suite even.
Agreed though, this will never be enough for developing recovery
mechanisms, though they, if working correctly, should at a minimum
report and deal with these basic corruptions too.
I prefer your idea of opening the file and randomly overwriting a few bytes.
Of course some of them will just be values in unindexed fields, so there would
be no damage SQLite could notice.
Yes quite, but I was actually making this exact thing when I realised
it's quite useless - I'm testing something that will near NEVER happen.
In real world, it is far more likely to find an Index missing some
entries or a Schema being unreadable or page-count wrong etc, than
random data being zapped into your DB file by virtue of Neutrino's from
Sol (or a stray cataclysm).
Like when car manufacturers test the integrity of their roll-cages, they
don't drop airplanes on the roof of the car - though it's not 100%
inconceivable that this might occur in life, but they rather ram it
head-first into some barrier - exactly the most common type of accident
out there. This is what I'm trying to achieve with the request.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users