Fix and/or improve comments in wal.c. No code changes.

FossilOrigin-Name: ee9991be082202c6637adb47affc777e7917be04
This commit is contained in:
drh 2010-06-23 22:00:35 +00:00
parent 346e426753
commit cd28508e58
3 changed files with 29 additions and 11 deletions

View File

@ -1,5 +1,8 @@
C Add\stest\scase\sfor\sSQLITE_FULL\serrors\sto\spagerfault.test.\sRemove\sa\sNEVER\smacro\sin\spager.c\sthat\sthis\shits. -----BEGIN PGP SIGNED MESSAGE-----
D 2010-06-23T19:27:36 Hash: SHA1
C Fix\sand/or\simprove\scomments\sin\swal.c.\s\sNo\scode\schanges.
D 2010-06-23T22:00:36
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in a5cad1f8f3e021356bfcc6c77dc16f6f1952bbc3 F Makefile.in a5cad1f8f3e021356bfcc6c77dc16f6f1952bbc3
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -226,7 +229,7 @@ F src/vdbeblob.c 258a6010ba7a82b72b327fb24c55790655689256
F src/vdbemem.c 2a82f455f6ca6f78b59fb312f96054c04ae0ead1 F src/vdbemem.c 2a82f455f6ca6f78b59fb312f96054c04ae0ead1
F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2 F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2
F src/vtab.c a0f8a40274e4261696ef57aa806de2776ab72cda F src/vtab.c a0f8a40274e4261696ef57aa806de2776ab72cda
F src/wal.c 563b7030efc55fe1ef105bd865876f2bf74f281b F src/wal.c 51b5d2259d86a26125007d3d788da5a2a2715b1a
F src/wal.h 4ace25262452d17e7d3ec970c89ee17794004008 F src/wal.h 4ace25262452d17e7d3ec970c89ee17794004008
F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f
F src/where.c 1c895bef33d0dfc7ed90fb1f74120435d210ea56 F src/where.c 1c895bef33d0dfc7ed90fb1f74120435d210ea56
@ -825,7 +828,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
P 1727a81fed65bebfea43e0bda271584096d82785 P 3e9680c4c18140d083b24e05a21ea6792aef2487
R 7a852c823aafd5a6b2955a7dd5f8280a R 128d792d7f9b9a40582f4d46c120cca4
U dan U drh
Z 7f4e2d2171817ab7dccd91b04d1a7459 Z 369983deae2c52862083f493477e4ceb
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFMIoQHoxKgR168RlERAkTMAJ4y6IEC74XLF+DMxIuBS7Lmcv3IqQCeJXdd
wPN5UVQx6y4hhnn2sGwnj/w=
=O5UN
-----END PGP SIGNATURE-----

View File

@ -1 +1 @@
3e9680c4c18140d083b24e05a21ea6792aef2487 ee9991be082202c6637adb47affc777e7917be04

View File

@ -31,7 +31,7 @@
** used to determine which frames within the WAL are valid and which ** used to determine which frames within the WAL are valid and which
** are leftovers from prior checkpoints. ** are leftovers from prior checkpoints.
** **
** The WAL header is 24 bytes in size and consists of the following six ** The WAL header is 32 bytes in size and consists of the following eight
** big-endian 32-bit unsigned integer values: ** big-endian 32-bit unsigned integer values:
** **
** 0: Magic number. 0x377f0682 or 0x377f0683 ** 0: Magic number. 0x377f0682 or 0x377f0683
@ -45,7 +45,7 @@
** **
** Immediately following the wal-header are zero or more frames. Each ** Immediately following the wal-header are zero or more frames. Each
** frame consists of a 24-byte frame-header followed by a <page-size> bytes ** frame consists of a 24-byte frame-header followed by a <page-size> bytes
** of page data. The frame-header is broken into 6 big-endian 32-bit unsigned ** of page data. The frame-header is six big-endian 32-bit unsigned
** integer values, as follows: ** integer values, as follows:
** **
** 0: Page number. ** 0: Page number.
@ -81,6 +81,11 @@
** s1 += x[i+1] + s0; ** s1 += x[i+1] + s0;
** endfor ** endfor
** **
** Note that s0 and s1 are both weighted checksums using fibonacci weights
** in reverse order (the largest fibonacci weight occurs on the first element
** of the sequence being summed.) The s1 value spans all 32-bit
** terms of the sequence whereas s0 omits the final term.
**
** On a checkpoint, the WAL is first VFS.xSync-ed, then valid content of the ** On a checkpoint, the WAL is first VFS.xSync-ed, then valid content of the
** WAL is transferred into the database, then the database is VFS.xSync-ed. ** WAL is transferred into the database, then the database is VFS.xSync-ed.
** The VFS.xSync operations serve as write barriers - all writes launched ** The VFS.xSync operations serve as write barriers - all writes launched
@ -1076,16 +1081,19 @@ static int walIndexRecover(Wal *pWal){
pWal->szPage = szPage; pWal->szPage = szPage;
pWal->nCkpt = sqlite3Get4byte(&aBuf[12]); pWal->nCkpt = sqlite3Get4byte(&aBuf[12]);
memcpy(&pWal->hdr.aSalt, &aBuf[16], 8); memcpy(&pWal->hdr.aSalt, &aBuf[16], 8);
/* Verify that the WAL header checksum is correct */
walChecksumBytes(pWal->hdr.bigEndCksum==SQLITE_BIGENDIAN, walChecksumBytes(pWal->hdr.bigEndCksum==SQLITE_BIGENDIAN,
aBuf, WAL_HDRSIZE-2*4, 0, pWal->hdr.aFrameCksum aBuf, WAL_HDRSIZE-2*4, 0, pWal->hdr.aFrameCksum
); );
if( pWal->hdr.aFrameCksum[0]!=sqlite3Get4byte(&aBuf[24]) if( pWal->hdr.aFrameCksum[0]!=sqlite3Get4byte(&aBuf[24])
|| pWal->hdr.aFrameCksum[1]!=sqlite3Get4byte(&aBuf[28]) || pWal->hdr.aFrameCksum[1]!=sqlite3Get4byte(&aBuf[28])
){ ){
goto finished; goto finished;
} }
/* Verify that the version number on the WAL format is one that
** are able to understand */
version = sqlite3Get4byte(&aBuf[4]); version = sqlite3Get4byte(&aBuf[4]);
if( version!=WAL_MAX_VERSION ){ if( version!=WAL_MAX_VERSION ){
rc = SQLITE_CANTOPEN_BKPT; rc = SQLITE_CANTOPEN_BKPT;