Do not search for promotable segments following an FTS 'optimize' operation or creation of a new segment on the oldest existing level.

FossilOrigin-Name: 34f6b4b8e4cb8ea45fd518672dc96335d1ce06ab
This commit is contained in:
dan 2014-05-14 19:49:17 +00:00
parent a0b7ca90b7
commit 5b34f15a82
4 changed files with 15 additions and 10 deletions

View File

@ -378,7 +378,7 @@ static int fts3SqlStmt(
/* Return segments in order from oldest to newest.*/ /* Return segments in order from oldest to newest.*/
/* 37 */ "SELECT level, idx, end_block " /* 37 */ "SELECT level, idx, end_block "
"FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ?" "FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ? "
"ORDER BY level DESC, idx ASC", "ORDER BY level DESC, idx ASC",
/* Update statements used while promoting segments */ /* Update statements used while promoting segments */
@ -3194,7 +3194,9 @@ static int fts3SegmentMerge(
if( pWriter ){ if( pWriter ){
rc = fts3SegWriterFlush(p, pWriter, iNewLevel, iIdx); rc = fts3SegWriterFlush(p, pWriter, iNewLevel, iIdx);
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
rc = fts3PromoteSegments(p, iNewLevel, pWriter->nLeafData); if( iLevel==FTS3_SEGCURSOR_PENDING || iNewLevel<iMaxLevel ){
rc = fts3PromoteSegments(p, iNewLevel, pWriter->nLeafData);
}
} }
} }
@ -3232,6 +3234,8 @@ int sqlite3Fts3PendingTermsFlush(Fts3Table *p){
if( rc==SQLITE_ROW ){ if( rc==SQLITE_ROW ){
p->nAutoincrmerge = sqlite3_column_int(pStmt, 0); p->nAutoincrmerge = sqlite3_column_int(pStmt, 0);
if( p->nAutoincrmerge==1 ) p->nAutoincrmerge = 8; if( p->nAutoincrmerge==1 ) p->nAutoincrmerge = 8;
}else if( rc==SQLITE_DONE ){
p->nAutoincrmerge = 0;
} }
rc = sqlite3_reset(pStmt); rc = sqlite3_reset(pStmt);
} }

View File

@ -1,5 +1,5 @@
C Fix\sa\sproblem\sto\sdo\swith\sloading\sthe\svalue\sof\sthe\sFTS\sautomerge\ssetting\sfrom\sthe\sdatabase. C Do\snot\ssearch\sfor\spromotable\ssegments\sfollowing\san\sFTS\s'optimize'\soperation\sor\screation\sof\sa\snew\ssegment\son\sthe\soldest\sexisting\slevel.
D 2014-05-14T18:45:27.234 D 2014-05-14T19:49:17.392
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in dd2b1aba364ff9b05de41086f74407f285c57670 F Makefile.in dd2b1aba364ff9b05de41086f74407f285c57670
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -96,7 +96,7 @@ F ext/fts3/fts3_tokenizer.h 64c6ef6c5272c51ebe60fc607a896e84288fcbc3
F ext/fts3/fts3_tokenizer1.c 5c98225a53705e5ee34824087478cf477bdb7004 F ext/fts3/fts3_tokenizer1.c 5c98225a53705e5ee34824087478cf477bdb7004
F ext/fts3/fts3_unicode.c 92391b4b4fb043564c6539ea9b8661e3bcba47b9 F ext/fts3/fts3_unicode.c 92391b4b4fb043564c6539ea9b8661e3bcba47b9
F ext/fts3/fts3_unicode2.c 0113d3acf13429e6dc38e0647d1bc71211c31a4d F ext/fts3/fts3_unicode2.c 0113d3acf13429e6dc38e0647d1bc71211c31a4d
F ext/fts3/fts3_write.c 6cb17b13b08fa2f36c8079726207736246a7176c F ext/fts3/fts3_write.c e58c8df149436dcc85e2face5516b75a01c7a583
F ext/fts3/fts3speed.tcl b54caf6a18d38174f1a6e84219950d85e98bb1e9 F ext/fts3/fts3speed.tcl b54caf6a18d38174f1a6e84219950d85e98bb1e9
F ext/fts3/mkfts3amal.tcl 252ecb7fe6467854f2aa237bf2c390b74e71f100 F ext/fts3/mkfts3amal.tcl 252ecb7fe6467854f2aa237bf2c390b74e71f100
F ext/fts3/tool/fts3view.c 6cfc5b67a5f0e09c0d698f9fd012c784bfaa9197 F ext/fts3/tool/fts3view.c 6cfc5b67a5f0e09c0d698f9fd012c784bfaa9197
@ -1008,7 +1008,7 @@ F test/tkt4018.test 7c2c9ba4df489c676a0a7a0e809a1fb9b2185bd1
F test/tokenize.test ce430a7aed48fc98301611429595883fdfcab5d7 F test/tokenize.test ce430a7aed48fc98301611429595883fdfcab5d7
F test/tpch01.test 8f4ac52f62f3e9f6bce0889105aecdf0275e331b F test/tpch01.test 8f4ac52f62f3e9f6bce0889105aecdf0275e331b
F test/trace.test 4b36a41a3e9c7842151af6da5998f5080cdad9e5 F test/trace.test 4b36a41a3e9c7842151af6da5998f5080cdad9e5
F test/trace2.test e7a988fdd982cdec62f1f1f34b0360e6476d01a0 F test/trace2.test 93b47ca6996c66b47f57224cfb146f34e07df382
F test/trans.test 6e1b4c6a42dba31bd65f8fa5e61a2708e08ddde6 F test/trans.test 6e1b4c6a42dba31bd65f8fa5e61a2708e08ddde6
F test/trans2.test 62bd045bfc7a1c14c5ba83ba64d21ade31583f76 F test/trans2.test 62bd045bfc7a1c14c5ba83ba64d21ade31583f76
F test/trans3.test 373ac5183cc56be69f48ae44090e7f672939f732 F test/trans3.test 373ac5183cc56be69f48ae44090e7f672939f732
@ -1172,7 +1172,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P 21491a9bc686e63bec32f1a67103622f1160a2f9 P 7268119f74602929b372b88eca7b3c3b4964f7d5
R 67348fc4be2e8c129b7e6e89a490a40b R 38e0e000cd94731b650020d6321d9a1b
U dan U dan
Z e904ec03ef68eb7c18f9e542f40d2d02 Z 73a15f3066e0e6dc1f73e5ba383c60f7

View File

@ -1 +1 @@
7268119f74602929b372b88eca7b3c3b4964f7d5 34f6b4b8e4cb8ea45fd518672dc96335d1ce06ab

View File

@ -136,6 +136,7 @@ ifcapable fts3 {
"-- SELECT (SELECT max(idx) FROM 'main'.'x1_segdir' WHERE level = ?) + 1" "-- SELECT (SELECT max(idx) FROM 'main'.'x1_segdir' WHERE level = ?) + 1"
"-- SELECT coalesce((SELECT max(blockid) FROM 'main'.'x1_segments') + 1, 1)" "-- SELECT coalesce((SELECT max(blockid) FROM 'main'.'x1_segments') + 1, 1)"
"-- REPLACE INTO 'main'.'x1_segdir' VALUES(?,?,?,?,?,?)" "-- REPLACE INTO 'main'.'x1_segdir' VALUES(?,?,?,?,?,?)"
"-- SELECT level, idx, end_block FROM 'main'.'x1_segdir' WHERE level BETWEEN ? AND ? ORDER BY level DESC, idx ASC"
} }
do_trace_test 2.3 { do_trace_test 2.3 {