1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

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.*/
/* 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",
/* Update statements used while promoting segments */
@ -3194,7 +3194,9 @@ static int fts3SegmentMerge(
if( pWriter ){
rc = fts3SegWriterFlush(p, pWriter, iNewLevel, iIdx);
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 ){
p->nAutoincrmerge = sqlite3_column_int(pStmt, 0);
if( p->nAutoincrmerge==1 ) p->nAutoincrmerge = 8;
}else if( rc==SQLITE_DONE ){
p->nAutoincrmerge = 0;
}
rc = sqlite3_reset(pStmt);
}