From 84bce14f773d5a569efc20036d1eb470b85fd028 Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 26 Mar 2012 10:47:03 +0000 Subject: [PATCH] Add a comment to explain how the FTS integrity-check works. FossilOrigin-Name: 64e8a116f39434a3b7347f01a47f88eef3276742 --- ext/fts3/fts3_write.c | 23 +++++++++++++++++++++++ manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/ext/fts3/fts3_write.c b/ext/fts3/fts3_write.c index 872b1f0d60..b0f38b72e8 100644 --- a/ext/fts3/fts3_write.c +++ b/ext/fts3/fts3_write.c @@ -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 ** 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( Fts3Table *p /* FTS3 table handle */ diff --git a/manifest b/manifest index 418d5baf3b..f0ab85f06c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\san\sexperimental\sintegrity-check\sfunction\sto\sFTS. -D 2012-03-26T10:36:55.434 +C Add\sa\scomment\sto\sexplain\show\sthe\sFTS\sintegrity-check\sworks. +D 2012-03-26T10:47:03.798 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2f37e468503dbe79d35c9f6dffcf3fae1ae9ec20 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.h 66dec98e365854b6cd2d54f1a96bb6d428fc5a68 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/mkfts3amal.tcl 252ecb7fe6467854f2aa237bf2c390b74e71f100 F ext/icu/README.txt bf8461d8cdc6b8f514c080e4e10dc3b2bbdfefa9 @@ -999,7 +999,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 -P 3cb6a879f1220db03a66429d63330e27e8ca6e49 -R a8a5e3d4a755c2fc6211bbe12afb7dcc +P 40fc8804743dfb005991e9c5ef7b0ebcb3c2e731 +R a29b15091e6e8965fd03216fe1c6e4ff U dan -Z 32d9f92fc095c5c84155b7497aaefe53 +Z 4197780953b43ba749fe7b7fcb72124a diff --git a/manifest.uuid b/manifest.uuid index afcb8fab6b..427ed8ce6b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -40fc8804743dfb005991e9c5ef7b0ebcb3c2e731 \ No newline at end of file +64e8a116f39434a3b7347f01a47f88eef3276742 \ No newline at end of file -- 2.47.2