From: drh Date: Fri, 9 Mar 2012 12:52:43 +0000 (+0000) Subject: Minor commenting and stylistic changes only. X-Git-Tag: mountain-lion~3^2~9^2~40 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=ab4f6385de75fdc97033eb77b6f79c21e6c10dfe;p=thirdparty%2Fsqlite.git Minor commenting and stylistic changes only. FossilOrigin-Name: a1747086c5e0c152fcf4bd9fa80a61b6f03f4a94 --- diff --git a/ext/fts3/fts3_write.c b/ext/fts3/fts3_write.c index 8f3b465181..302f284897 100644 --- a/ext/fts3/fts3_write.c +++ b/ext/fts3/fts3_write.c @@ -4132,9 +4132,18 @@ static int fts3IncrmergeChomp( return rc; } +/* +** Attempt an incremental merge that writes nMerge leaf pages. +** +** Incremental merges happen two segments at a time. The two +** segments to be merged are the two oldest segments (the ones with +** the smallest index) in the highest level that has at least +** nMin segments. Multiple segment pair merges might occur in +** an attempt to write the quota of nMerge leaf pages. +*/ static int fts3Incrmerge(Fts3Table *p, int nMerge, int nMin){ int rc = SQLITE_OK; /* Return code */ - int nRem = nMerge; + int nRem = nMerge; /* Number of leaf pages yet to be written */ assert( nMin>=2 ); @@ -4161,7 +4170,7 @@ static int fts3Incrmerge(Fts3Table *p, int nMerge, int nMin){ if( rc!=SQLITE_OK ) return rc; /* Open a cursor to iterate through the contents of indexes 0 and 1 of - ** the selected absolute level. */ + ** the selected absolute level. */ rc = fts3IncrmergeCsr(p, iAbsLevel, &csr); if( rc!=SQLITE_OK ) return rc; memset(&filter, 0, sizeof(Fts3SegFilter)); @@ -4171,13 +4180,13 @@ static int fts3Incrmerge(Fts3Table *p, int nMerge, int nMin){ assert( rc!=SQLITE_ABORT ); if( SQLITE_ROW==(rc = sqlite3Fts3SegReaderStep(p, &csr)) ){ rc = fts3IncrmergeWriter(p, iAbsLevel, csr.zTerm, csr.nTerm, &writer); - assert( rc!=SQLITE_ABORT ); + assert( rc!=SQLITE_ABORT ); if( rc==SQLITE_OK ){ do { rc = fts3IncrmergeAppend(p, &writer, &csr); - assert( rc!=SQLITE_ABORT ); + assert( rc!=SQLITE_ABORT ); if( rc==SQLITE_OK ) rc = sqlite3Fts3SegReaderStep(p, &csr); - assert( rc!=SQLITE_ABORT ); + assert( rc!=SQLITE_ABORT ); if( writer.nWork>=nRem && rc==SQLITE_ROW ) rc = SQLITE_OK; }while( rc==SQLITE_ROW ); } @@ -4197,10 +4206,15 @@ static int fts3Incrmerge(Fts3Table *p, int nMerge, int nMin){ return rc; } -static int fts3_isdigit(char c){ - return (c>='0' && c<='9'); -} - +/* +** Process statements of the form: +** +** INSERT INTO table(table) VALUES('merge=A,B'); +** +** A and B are integers that decode to be the number of leaf pages +** written for the merge, and the minimum number of segments on a level +** before it will be selected for a merge, respectively. +*/ static int fts3DoIncrmerge(Fts3Table *p, const char *zParam){ int rc; int nMin = (FTS3_MERGE_COUNT / 2); @@ -4208,7 +4222,7 @@ static int fts3DoIncrmerge(Fts3Table *p, const char *zParam){ const char *z = zParam; /* Read the first integer value */ - for(z=zParam; fts3_isdigit(z[0]); z++){ + for(z=zParam; z[0]>='0' && z[0]<='9'; z++){ nMerge = nMerge * 10 + (z[0] - '0'); } @@ -4217,7 +4231,7 @@ static int fts3DoIncrmerge(Fts3Table *p, const char *zParam){ if( z[0]==',' && z[1]!='\0' ){ z++; nMin = 0; - while( fts3_isdigit(z[0]) ){ + while( z[0]>='0' && z[0]<='9' ){ nMin = nMin * 10 + (z[0] - '0'); z++; } diff --git a/manifest b/manifest index b84b66edfd..4eabdd282c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\s'merge=?,?'\scommand\sto\sfts4.\sThis\sstill\sneeds\ssome\swork. -D 2012-03-08T18:39:03.077 +C Minor\scommenting\sand\sstylistic\schanges\sonly. +D 2012-03-09T12:52:43.195 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 3f79a373e57c3b92dabf76f40b065e719d31ac34 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 0dde8f307b8045565cf63797ba9acfaff1c50c68 -F ext/fts3/fts3_write.c 81b885ef5db55c2f92b8e5a33e51eb7557084e41 +F ext/fts3/fts3_write.c 80863b8ef7849c8c225071258e13326f30bf00f3 F ext/fts3/fts3speed.tcl b54caf6a18d38174f1a6e84219950d85e98bb1e9 F ext/fts3/mkfts3amal.tcl 252ecb7fe6467854f2aa237bf2c390b74e71f100 F ext/icu/README.txt bf8461d8cdc6b8f514c080e4e10dc3b2bbdfefa9 @@ -993,10 +993,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 -P b00ccda307caae597c143ab0586f90acb77f79cf -R a895af2ffe98328624a86f767eb1318f -T *branch * fts4-incr-merge -T *sym-fts4-incr-merge * -T -sym-trunk * -U dan -Z 1441d373e5b74aab517b4d814807ebb3 +P 741b8f897750eac3c9774fd65de7e40bb89781b1 +R ef47488babfef36b031a8c9c8f291bcb +U drh +Z 0b165accece5454f4134f86269851728 diff --git a/manifest.uuid b/manifest.uuid index b25709a4f0..046cc5983d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -741b8f897750eac3c9774fd65de7e40bb89781b1 \ No newline at end of file +a1747086c5e0c152fcf4bd9fa80a61b6f03f4a94 \ No newline at end of file