Add an "isInit" field in the wal-index header that must be non-zero for
a valid header. Use this to detect an uninitialized wal-index. FossilOrigin-Name: a16fde190183d1ae252d1aa305b23fdb88c603dc
This commit is contained in:
parent
15d6809222
commit
4b82c387c9
18
manifest
18
manifest
@ -1,8 +1,8 @@
|
||||
-----BEGIN PGP SIGNED MESSAGE-----
|
||||
Hash: SHA1
|
||||
|
||||
C Fix\san\sinconsistent\s#ifdef\sin\swal.c.\s\sFix\sos_unix.c\sso\sthat\sit\sdoes\snot\sallow\nmoving\san\sSHM\slock\sdirectly\sexclusive\sto\sshared\swithout\sgoing\sthrough\sunlocked.
|
||||
D 2010-05-31T16:56:15
|
||||
C Add\san\s"isInit"\sfield\sin\sthe\swal-index\sheader\sthat\smust\sbe\snon-zero\sfor\na\svalid\sheader.\s\sUse\sthis\sto\sdetect\san\suninitialized\swal-index.
|
||||
D 2010-05-31T18:24:19
|
||||
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
||||
F Makefile.in a5cad1f8f3e021356bfcc6c77dc16f6f1952bbc3
|
||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||
@ -227,7 +227,7 @@ F src/vdbeblob.c 5327132a42a91e8b7acfb60b9d2c3b1c5c863e0e
|
||||
F src/vdbemem.c 2a82f455f6ca6f78b59fb312f96054c04ae0ead1
|
||||
F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2
|
||||
F src/vtab.c a0f8a40274e4261696ef57aa806de2776ab72cda
|
||||
F src/wal.c 0ccac00186c45061315676b1a17f68ec181606a2
|
||||
F src/wal.c a20a069a7ed79ea16cccbf0d83a34d5e2a7250a6
|
||||
F src/wal.h 1c1c9feb629b7f4afcbe0b47f80f47c5551d3a02
|
||||
F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f
|
||||
F src/where.c 75fee9e255b62f773fcadd1d1f25b6f63ac7a356
|
||||
@ -818,14 +818,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
||||
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
||||
P cc25cfa04630a43c1de26f2dbdacbe46c110a2b5
|
||||
R 12262d82072f7c372f85b91e7ec97bb1
|
||||
P 552658da2845c2323167b6c7db6e5c00090f280c
|
||||
R cd1f6d6abaca428c2e0680ad6a01cc30
|
||||
U drh
|
||||
Z b2a5a03b4797272b0d03b889e6006ebd
|
||||
Z 611237a4cf581f565db3251639fe3292
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
Version: GnuPG v1.4.6 (GNU/Linux)
|
||||
|
||||
iD8DBQFMA+oyoxKgR168RlERAv5qAJwI2G0xWyNj/habBep9Ebm7jU70XgCfTTIK
|
||||
D6l/MUB5JLrcq4YPmXmA4L0=
|
||||
=jHvO
|
||||
iD8DBQFMA/7XoxKgR168RlERAvMDAJ41dyIAjGkayTRj8Kw2ioAehVpN+QCfbTwC
|
||||
9y9JhOrCL2VhmOxcK/DziJQ=
|
||||
=4aF+
|
||||
-----END PGP SIGNATURE-----
|
||||
|
@ -1 +1 @@
|
||||
552658da2845c2323167b6c7db6e5c00090f280c
|
||||
a16fde190183d1ae252d1aa305b23fdb88c603dc
|
@ -260,7 +260,8 @@ typedef struct WalCkptInfo WalCkptInfo;
|
||||
*/
|
||||
struct WalIndexHdr {
|
||||
u32 iChange; /* Counter incremented each transaction */
|
||||
u16 bigEndCksum; /* True if checksums in WAL are big-endian */
|
||||
u8 isInit; /* 1 when initialized */
|
||||
u8 bigEndCksum; /* True if checksums in WAL are big-endian */
|
||||
u16 szPage; /* Database page size in bytes */
|
||||
u32 mxFrame; /* Index of last valid frame in the WAL */
|
||||
u32 nPage; /* Size of database in pages */
|
||||
@ -481,6 +482,7 @@ static void walIndexWriteHdr(Wal *pWal){
|
||||
WalIndexHdr *aHdr;
|
||||
|
||||
assert( pWal->writeLock );
|
||||
pWal->hdr.isInit = 1;
|
||||
walChecksumBytes(1, (u8*)&pWal->hdr, offsetof(WalIndexHdr, aCksum),
|
||||
0, pWal->hdr.aCksum);
|
||||
aHdr = (WalIndexHdr*)pWal->pWiData;
|
||||
@ -1563,11 +1565,9 @@ int walIndexTryHdr(Wal *pWal, int *pChanged){
|
||||
if( memcmp(&h1, &h2, sizeof(h1))!=0 ){
|
||||
return 1; /* Dirty read */
|
||||
}
|
||||
#if 0
|
||||
if( h1.szPage==0 ){
|
||||
if( h1.isInit==0 ){
|
||||
return 1; /* Malformed header - probably all zeros */
|
||||
}
|
||||
#endif
|
||||
walChecksumBytes(1, (u8*)&h1, sizeof(h1)-sizeof(h1.aCksum), 0, aCksum);
|
||||
if( aCksum[0]!=h1.aCksum[0] || aCksum[1]!=h1.aCksum[1] ){
|
||||
return 1; /* Checksum does not match */
|
||||
|
Loading…
x
Reference in New Issue
Block a user