From: dan Date: Sat, 24 Mar 2012 16:43:55 +0000 (+0000) Subject: Add a comment to fts3SyncMethod() to justify the nMinMerge=64 constant. X-Git-Tag: mountain-lion~3^2~9^2~18 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0dfcdeb4f0b59fc06c8562385fdd161b6e3a04a9;p=thirdparty%2Fsqlite.git Add a comment to fts3SyncMethod() to justify the nMinMerge=64 constant. FossilOrigin-Name: af55ca5fc6778cb6d1a79a17dfa2d4e567ea1ccc --- diff --git a/ext/fts3/fts3.c b/ext/fts3/fts3.c index f874dfa7f3..cf9fe64ed9 100644 --- a/ext/fts3/fts3.c +++ b/ext/fts3/fts3.c @@ -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); diff --git a/manifest b/manifest index b3e124c856..b81062a1dd 100644 --- 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 diff --git a/manifest.uuid b/manifest.uuid index 9efe1a35d6..9b8d8efdbf 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2e06babf49de844d0e878d68114dbcc5ad4d6e54 \ No newline at end of file +af55ca5fc6778cb6d1a79a17dfa2d4e567ea1ccc \ No newline at end of file