Hi, Simon,

Von: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org]
> On 24 Mar 2014, at 5:23am, Roger Binns <rog...@rogerbinns.com> wrote:
> > On 21/03/14 15:24, Simon Slavin wrote:
> >> Checksums stored with the page index lists,
> >
> > SQLite already has the ability to carve out data on each page for
> > other uses.  For example the encryption extension uses this.
> 
> This would be better than nothing, but there is a problem with writing the
> checksum in the same operation that writes the page.  The two standard
> unlikely scenarios for data corruption (cosmic rays and static discharge)
> flip bits inside wires lines or inside RAM bits, and it's possible that the
> bit that gets flipped will be for the address of the sector being
> written/read rather than in the data being written/read.  So by storing the
> checksum in the page it checks you will get a sector that passes the checksum
> test, but has been written to the wrong place in storage and therefore
> corrupts the file.

Agreed.

> So the checksum should be stored away from the page it checks. 

Not agreed. Another way to solve this problem is to include the file offset
or sector number into the checksum - this will also detect "movements" of
data to the wrong place, without the need for an atomically writeable
"external" storage.

> My
> understanding of the SQLite file format suggests that the checksum could
> usefully be stored with the pointer to the page in the page store (TABLE /
> INDEX page list or whatever it's called) since it would be needed at the same
> time and the two could be retrieved in one operation.
> 
> > It couldn't be on by default for backwards compatibility reasons.
> > (WAL is another example of that.)
> 
> 
> Agreed.  Backward compatibility would be a problem for SQLite3 so it's not
> going to happen either way unless the file format is revised and more PRAGMAs
> added.  Maybe in SQLite4.





Best regards

Markus Schaber

CODESYS(r) a trademark of 3S-Smart Software Solutions GmbH

Inspiring Automation Solutions

3S-Smart Software Solutions GmbH
Dipl.-Inf. Markus Schaber | Product Development Core Technology
Memminger Str. 151 | 87439 Kempten | Germany
Tel. +49-831-54031-979 | Fax +49-831-54031-50

E-Mail: m.scha...@codesys.com | Web: http://www.codesys.com | CODESYS store: 
http://store.codesys.com
CODESYS forum: http://forum.codesys.com

Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade 
register: Kempten HRB 6186 | Tax ID No.: DE 167014915
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to