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 );
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));
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 );
}
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);
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');
}
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++;
}
-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
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
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