]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add a comment to fts3SyncMethod() to justify the nMinMerge=64 constant.
authordan <dan@noemail.net>
Sat, 24 Mar 2012 16:43:55 +0000 (16:43 +0000)
committerdan <dan@noemail.net>
Sat, 24 Mar 2012 16:43:55 +0000 (16:43 +0000)
FossilOrigin-Name: af55ca5fc6778cb6d1a79a17dfa2d4e567ea1ccc

ext/fts3/fts3.c
manifest
manifest.uuid

index f874dfa7f3c7ae2a623a1566065b8a6f63a98d55..cf9fe64ed9376a3d1d3b4082e782b3b53abff10d 100644 (file)
@@ -3103,7 +3103,28 @@ static int fts3UpdateMethod(
 ** hash-table to the database.
 */
 static int fts3SyncMethod(sqlite3_vtab *pVtab){
+
+  /* Following an incremental-merge operation, assuming that the input
+  ** segments are not completely consumed (the usual case), they are updated
+  ** in place to remove the entries that have already been merged. This
+  ** involves updating the leaf block that contains the smallest unmerged
+  ** entry and each block (if any) between the leaf and the root node. So
+  ** if the height of the input segment b-trees is N, and input segments
+  ** are merged eight at a time, updating the input segments at the end
+  ** of an incremental-merge requires writing (8*(1+N)) blocks. N is usually
+  ** small - often between 0 and 2. So the overhead of the incremental
+  ** merge is somewhere between 8 and 24 blocks. To avoid this overhead
+  ** dwarfing the actual productive work accomplished, the incremental merge
+  ** is only attempted if it will write at least 64 leaf blocks. Hence
+  ** nMinMerge.
+  **
+  ** Of course, updating the input segments also involves deleting a bunch
+  ** of blocks from the segments table. But this is not considered overhead
+  ** as it would also be required by a crisis-merge that used the same input 
+  ** segments.
+  */
   const int nMinMerge = 64;       /* Minimum amount of incr-merge work to do */
+
   Fts3Table *p = (Fts3Table*)pVtab;
   int rc = sqlite3Fts3PendingTermsFlush(p);
 
index b3e124c8560b15e9acdad5475719cd7ea05ee512..b81062a1dde75bc75695190caf9e74a0d3de7bcf 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\sbug\sin\sdebugging\scode\senabled\swhen\sFTS3_LOG_MERGES\sis\sdefined.
-D 2012-03-24T16:18:08.837
+C Add\sa\scomment\sto\sfts3SyncMethod()\sto\sjustify\sthe\snMinMerge=64\sconstant.
+D 2012-03-24T16:43:55.163
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 2f37e468503dbe79d35c9f6dffcf3fae1ae9ec20
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -63,7 +63,7 @@ F ext/fts3/README.content fdc666a70d5257a64fee209f97cf89e0e6e32b51
 F ext/fts3/README.syntax a19711dc5458c20734b8e485e75fb1981ec2427a
 F ext/fts3/README.tokenizers 998756696647400de63d5ba60e9655036cb966e9
 F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d
-F ext/fts3/fts3.c eb3a57bb7913e83727f6bcb1142375df5637478f
+F ext/fts3/fts3.c 10988e19ba78d846e5979a5118843e22822a0147
 F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe
 F ext/fts3/fts3Int.h 6d4ffaca18df57533a7d6240dbdd835c4f3f096a
 F ext/fts3/fts3_aux.c 5205182bd8f372782597888156404766edf5781e
@@ -997,7 +997,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
 F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a
 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
-P 67a0cffc9d07be7f09dad9d019a18160711295cd
-R b9a75c391c5508df678e65c2562d628a
-U drh
-Z 4e5e71ac5e6024845db251d7d739e1ab
+P 2e06babf49de844d0e878d68114dbcc5ad4d6e54
+R 432c0c36d101ff48a9d07485fc32e9b8
+U dan
+Z 314cc4329e06c95183ea81ebec52b3f5
index 9efe1a35d698629d58a3eeeb48ed957964095c60..9b8d8efdbfc7f4f553981d2a5df640322f6dfe92 100644 (file)
@@ -1 +1 @@
-2e06babf49de844d0e878d68114dbcc5ad4d6e54
\ No newline at end of file
+af55ca5fc6778cb6d1a79a17dfa2d4e567ea1ccc
\ No newline at end of file