Add a comment to explain how the FTS integrity-check works.

FossilOrigin-Name: 64e8a116f39434a3b7347f01a47f88eef3276742
This commit is contained in:
dan 2012-03-26 10:47:03 +00:00
parent cbcd9f5357
commit 84bce14f77
3 changed files with 30 additions and 7 deletions

View File

@ -4901,6 +4901,29 @@ static int fts3IntegrityCheck(Fts3Table *p, int *pbOk){
** **
** Or, if an error (e.g. an OOM or IO error) occurs, return an SQLite ** Or, if an error (e.g. an OOM or IO error) occurs, return an SQLite
** error code. ** error code.
**
** The integrity-check works as follows. For each token and indexed token
** prefix in the document set, a 64-bit checksum is calculated (by code
** in fts3ChecksumEntry()) based on the following:
**
** + The index number (0 for the main index, 1 for the first prefix
** index etc.),
** + The token (or token prefix) text itself,
** + The language-id of the row it appears in,
** + The docid of the row it appears in,
** + The column it appears in, and
** + The tokens position within that column.
**
** The checksums for all entries in the index are XORed together to create
** a single checksum for the entire index.
**
** The integrity-check code calculates the same checksum in two ways:
**
** 1. By scanning the contents of the FTS index, and
** 2. By scanning and tokenizing the content table.
**
** If the two checksums are identical, the integrity-check is deemed to have
** passed.
*/ */
static int fts3DoIntegrityCheck( static int fts3DoIntegrityCheck(
Fts3Table *p /* FTS3 table handle */ Fts3Table *p /* FTS3 table handle */

View File

@ -1,5 +1,5 @@
C Add\san\sexperimental\sintegrity-check\sfunction\sto\sFTS. C Add\sa\scomment\sto\sexplain\show\sthe\sFTS\sintegrity-check\sworks.
D 2012-03-26T10:36:55.434 D 2012-03-26T10:47:03.798
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 2f37e468503dbe79d35c9f6dffcf3fae1ae9ec20 F Makefile.in 2f37e468503dbe79d35c9f6dffcf3fae1ae9ec20
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -78,7 +78,7 @@ F ext/fts3/fts3_test.c 6b7cc68aef4efb084e1449f7d20c4b20d3bdf6b4
F ext/fts3/fts3_tokenizer.c 3da7254a9881f7e270ab28e2004e0d22b3212bce F ext/fts3/fts3_tokenizer.c 3da7254a9881f7e270ab28e2004e0d22b3212bce
F ext/fts3/fts3_tokenizer.h 66dec98e365854b6cd2d54f1a96bb6d428fc5a68 F ext/fts3/fts3_tokenizer.h 66dec98e365854b6cd2d54f1a96bb6d428fc5a68
F ext/fts3/fts3_tokenizer1.c 5c98225a53705e5ee34824087478cf477bdb7004 F ext/fts3/fts3_tokenizer1.c 5c98225a53705e5ee34824087478cf477bdb7004
F ext/fts3/fts3_write.c a95e0f29a438bbba69ef686c75f03fbdf7ac79ac F ext/fts3/fts3_write.c 554368a941e89bf556d653d72eac4ceb8c5a30ef
F ext/fts3/fts3speed.tcl b54caf6a18d38174f1a6e84219950d85e98bb1e9 F ext/fts3/fts3speed.tcl b54caf6a18d38174f1a6e84219950d85e98bb1e9
F ext/fts3/mkfts3amal.tcl 252ecb7fe6467854f2aa237bf2c390b74e71f100 F ext/fts3/mkfts3amal.tcl 252ecb7fe6467854f2aa237bf2c390b74e71f100
F ext/icu/README.txt bf8461d8cdc6b8f514c080e4e10dc3b2bbdfefa9 F ext/icu/README.txt bf8461d8cdc6b8f514c080e4e10dc3b2bbdfefa9
@ -999,7 +999,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
P 3cb6a879f1220db03a66429d63330e27e8ca6e49 P 40fc8804743dfb005991e9c5ef7b0ebcb3c2e731
R a8a5e3d4a755c2fc6211bbe12afb7dcc R a29b15091e6e8965fd03216fe1c6e4ff
U dan U dan
Z 32d9f92fc095c5c84155b7497aaefe53 Z 4197780953b43ba749fe7b7fcb72124a

View File

@ -1 +1 @@
40fc8804743dfb005991e9c5ef7b0ebcb3c2e731 64e8a116f39434a3b7347f01a47f88eef3276742