tags 591298 + patch tags 591298 + pending thanks Hiya,
I've prepared an NMU for sqlite3 (versioned as 3.7.0-1.1) and will seek a sponsor in short order. Please let me know if I should not do this. Regards, Iain
diff -Nru sqlite3-3.7.0/debian/changelog sqlite3-3.7.0/debian/changelog --- sqlite3-3.7.0/debian/changelog 2010-07-25 10:00:52.000000000 +0100 +++ sqlite3-3.7.0/debian/changelog 2010-08-06 16:59:30.000000000 +0100 @@ -1,3 +1,11 @@ +sqlite3 (3.7.0-1.1) UNRELEASED; urgency=low + + * Non-maintainer upload. + * Backport fix from upstream bug 13f033c865 to fix performance + regression introduced in 3.7.0-1. (Closes: #591298) + + -- Iain Lane <la...@ubuntu.com> Fri, 06 Aug 2010 16:58:35 +0100 + sqlite3 (3.7.0-1) unstable; urgency=low * New major upstream version (closes: #590232). diff -Nru sqlite3-3.7.0/debian/patches/30-591298-performance-regression.patch sqlite3-3.7.0/debian/patches/30-591298-performance-regression.patch --- sqlite3-3.7.0/debian/patches/30-591298-performance-regression.patch 1970-01-01 01:00:00.000000000 +0100 +++ sqlite3-3.7.0/debian/patches/30-591298-performance-regression.patch 2010-08-06 17:05:09.000000000 +0100 @@ -0,0 +1,77 @@ +Index: sqlite3-3.7.0/src/where.c +=================================================================== +--- sqlite3-3.7.0.orig/src/where.c 2010-08-06 17:01:59.181948757 +0100 ++++ sqlite3-3.7.0/src/where.c 2010-08-06 17:05:05.985100100 +0100 +@@ -4048,6 +4048,8 @@ + int bestJ = -1; /* The value of j */ + Bitmask m; /* Bitmask value for j or bestJ */ + int isOptimal; /* Iterator for optimal/non-optimal search */ ++ int nUnconstrained; /* Number tables without INDEXED BY */ ++ Bitmask notIndexed; /* Mask of tables that cannot use an index */ + + memset(&bestPlan, 0, sizeof(bestPlan)); + bestPlan.rCost = SQLITE_BIG_DBL; +@@ -4089,6 +4091,8 @@ + ** algorithm may choose to use t2 for the outer loop, which is a much + ** costlier approach. + */ ++ nUnconstrained = 0; ++ notIndexed = 0; + for(isOptimal=(iFrom<nTabList-1); isOptimal>=0; isOptimal--){ + Bitmask mask; /* Mask of tables not yet ready */ + for(j=iFrom, pTabItem=&pTabList->a[j]; j<nTabList; j++, pTabItem++){ +@@ -4105,6 +4109,7 @@ + } + mask = (isOptimal ? m : notReady); + pOrderBy = ((i==0 && ppOrderBy )?*ppOrderBy:0); ++ if( pTabItem->pIndex==0 ) nUnconstrained++; + + assert( pTabItem->pTab ); + #ifndef SQLITE_OMIT_VIRTUALTABLE +@@ -4118,9 +4123,43 @@ + } + assert( isOptimal || (sCost.used¬Ready)==0 ); + +- if( (sCost.used¬Ready)==0 +- && (bestJ<0 || sCost.rCost<bestPlan.rCost +- || (sCost.rCost<=bestPlan.rCost && sCost.nRow<bestPlan.nRow)) ++ /* If an INDEXED BY clause is present, then the plan must use that ++ ** index if it uses any index at all */ ++ assert( pTabItem->pIndex==0 ++ || (sCost.plan.wsFlags & WHERE_NOT_FULLSCAN)==0 ++ || sCost.plan.u.pIdx==pTabItem->pIndex ); ++ ++ if( isOptimal && (sCost.plan.wsFlags & WHERE_NOT_FULLSCAN)==0 ){ ++ notIndexed |= m; ++ } ++ ++ /* Conditions under which this table becomes the best so far: ++ ** ++ ** (1) The table must not depend on other tables that have not ++ ** yet run. ++ ** ++ ** (2) A full-table-scan plan cannot supercede another plan unless ++ ** it is an "optimal" plan as defined above. ++ ** ++ ** (3) All tables have an INDEXED BY clause or this table lacks an ++ ** INDEXED BY clause or this table uses the specific ++ ** index specified by its INDEXED BY clause. This rule ensures ++ ** that a best-so-far is always selected even if an impossible ++ ** combination of INDEXED BY clauses are given. The error ++ ** will be detected and relayed back to the application later. ++ ** The NEVER() comes about because rule (2) above prevents ++ ** An indexable full-table-scan from reaching rule (3). ++ ** ++ ** (4) The plan cost must be lower than prior plans or else the ++ ** cost must be the same and the number of rows must be lower. ++ */ ++ if( (sCost.used¬Ready)==0 /* (1) */ ++ && (bestJ<0 || (notIndexed&m)!=0 /* (2) */ ++ || (sCost.plan.wsFlags & WHERE_NOT_FULLSCAN)!=0) ++ && (nUnconstrained==0 || pTabItem->pIndex==0 /* (3) */ ++ || NEVER((sCost.plan.wsFlags & WHERE_NOT_FULLSCAN)!=0)) ++ && (bestJ<0 || sCost.rCost<bestPlan.rCost /* (4) */ ++ || (sCost.rCost<=bestPlan.rCost && sCost.nRow<bestPlan.nRow)) + ){ + WHERETRACE(("... best so far with cost=%g and nRow=%g\n", + sCost.rCost, sCost.nRow)); diff -Nru sqlite3-3.7.0/debian/patches/series sqlite3-3.7.0/debian/patches/series --- sqlite3-3.7.0/debian/patches/series 2010-07-25 09:59:20.000000000 +0100 +++ sqlite3-3.7.0/debian/patches/series 2010-08-06 17:01:18.000000000 +0100 @@ -3,3 +3,4 @@ 10-520478-squash-bad-deps.patch 11-manpage-refers-to-sqlite3-doc.patch 20-hurd-locking-style.patch +30-591298-performance-regression.patch
signature.asc
Description: Digital signature