iRowid = sqlite3Fts5IterRowid(pIter);
if( (bDesc==0 && iLast>iRowid) || (bDesc && iLast<iRowid) ){
- sqlite3Fts5IterNextFrom(pIter, iLast);
- if( sqlite3Fts5IterEof(pIter) ){
+ int rc = sqlite3Fts5IterNextFrom(pIter, iLast);
+ if( rc || sqlite3Fts5IterEof(pIter) ){
+ *pRc = rc;
*pbEof = 1;
return 1;
}
*/
static void fts5SegIterLoadNPos(Fts5Index *p, Fts5SegIter *pIter){
if( p->rc==SQLITE_OK ){
+ const u8 *a = &pIter->pLeaf->p[pIter->iLeafOffset];
int iOff = pIter->iLeafOffset; /* Offset to read at */
- if( iOff>=pIter->pLeaf->n ){
- assert( 0 );
- fts5SegIterNextPage(p, pIter);
- if( pIter->pLeaf==0 ){
- if( p->rc==SQLITE_OK ) p->rc = FTS5_CORRUPT;
- return;
- }
- iOff = 4;
- }
- iOff += fts5GetPoslistSize(pIter->pLeaf->p+iOff, &pIter->nPos,&pIter->bDel);
- pIter->iLeafOffset = iOff;
+ pIter->iLeafOffset += fts5GetPoslistSize(a, &pIter->nPos,&pIter->bDel);
}
}
u8 *a = pIter->pLeaf->p;
int iRowidOffset = 0;
- while( p->rc==SQLITE_OK && i<n ){
+ while( 1 ){
i64 iDelta = 0;
int nPos;
int bDummy;
--- /dev/null
+# 2014 June 17
+#
+# The author disclaims copyright to this source code. In place of
+# a legal notice, here is a blessing:
+#
+# May you do good and not evil.
+# May you find forgiveness for yourself and forgive others.
+# May you share freely, never taking more than you give.
+#
+#*************************************************************************
+#
+# This file is focused on OOM errors.
+#
+
+source [file join [file dirname [info script]] fts5_common.tcl]
+source $testdir/malloc_common.tcl
+set testprefix fts5fault2
+
+# If SQLITE_ENABLE_FTS3 is defined, omit this file.
+ifcapable !fts5 {
+ finish_test
+ return
+}
+
+set doc [string trim [string repeat "x y z " 200]]
+do_execsql_test 1.0 {
+ CREATE TABLE t1(a INTEGER PRIMARY KEY, x);
+ CREATE VIRTUAL TABLE x1 USING fts5(x, content='t1', content_rowid='a');
+ INSERT INTO x1(x1, rank) VALUES('pgsz', 32);
+ WITH input(a,b) AS (
+ SELECT 1, $doc UNION ALL
+ SELECT a+1, ($doc || CASE WHEN (a+1)%100 THEN '' ELSE ' xyz' END)
+ FROM input WHERE a < 1000
+ )
+ INSERT INTO t1 SELECT * FROM input;
+
+ INSERT INTO x1(x1) VALUES('rebuild');
+}
+
+do_faultsim_test 1.1 -faults oom-* -prep {
+} -body {
+ execsql { SELECT rowid FROM x1 WHERE x1 MATCH 'z AND xyz' }
+} -test {
+ faultsim_test_result {0 {100 200 300 400 500 600 700 800 900 1000}}
+}
+
+do_faultsim_test 1.2 -faults oom-* -prep {
+} -body {
+ execsql { SELECT rowid FROM x1 WHERE x1 MATCH 'z + xyz' ORDER BY 1 DESC}
+} -test {
+ faultsim_test_result {0 {1000 900 800 700 600 500 400 300 200 100}}
+}
+
+finish_test
+
-C Fix\sproblems\swith\sdoclist-indexes\sinvolving\svery\slarge\srowids.
-D 2015-04-22T20:14:46.893
+C Add\sextra\sOOM\stests\sfor\sfts5.
+D 2015-04-22T20:58:24.232
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in faaf75b89840659d74501bea269c7e33414761c1
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F ext/fts5/fts5_aux.c fcea18b1a2a3f95a498b52aba2983557d7678a22
F ext/fts5/fts5_buffer.c 3ba56cc6824c9f7b1e0695159e0a9c636f6b4a23
F ext/fts5/fts5_config.c 0847facc8914f57ea4452c43ce109200dc65e894
-F ext/fts5/fts5_expr.c 5215137efab527577d36bdf9e44bfc2ec3e1be98
+F ext/fts5/fts5_expr.c 05da381ab26031243266069302c6eb4094b2c5dd
F ext/fts5/fts5_hash.c 3cb5a3d04dd2030eb0ac8d544711dfd37c0e6529
-F ext/fts5/fts5_index.c 446f70d131e8d12a464f2fb7a4d0348e8334f45f
+F ext/fts5/fts5_index.c 7c9615a83e0ca928817e81be65e266f639f45532
F ext/fts5/fts5_storage.c ac0f0937059c8d4f38a1f13aa5f2c2cd7edf3e0d
F ext/fts5/fts5_tcl.c 617b6bb96545be8d9045de6967c688cd9cd15541
F ext/fts5/fts5_tokenize.c c07f2c2f749282c1dbbf46bde1f6d7095c740b8b
F ext/fts5/test/fts5ea.test 04695560a444fcc00c3c4f27783bdcfbf71f030c
F ext/fts5/test/fts5eb.test 728a1f23f263548f5c29b29dfb851b5f2dbe723e
F ext/fts5/test/fts5fault1.test ed71717a479bef32d05f02d9c48691011d160d4d
+F ext/fts5/test/fts5fault2.test 000ecebf28b8f2cd520f44c70962625ee11d65ac
F ext/fts5/test/fts5near.test 3f9f64e16cac82725d03d4e04c661090f0b3b947
F ext/fts5/test/fts5optimize.test 0028c90a7817d3e576d1148fc8dff17d89054e54
F ext/fts5/test/fts5porter.test 50322599823cb8080a99f0ec0c39f7d0c12bcb5e
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 9797482ded7de985e3b20aedec5e4d81f55065c8
-R 0cda6877e1c22250889225fbc6083da5
+P 1e5994097e4c740c5173ea9718c3935728fdb86f
+R 8fd8d325057a6a764b3fb8036f0655cc
U dan
-Z 27e6fd1a7355db699b5f202767df6e93
+Z a76fe5c70a2f59aae49b2624efc313d4
-1e5994097e4c740c5173ea9718c3935728fdb86f
\ No newline at end of file
+2dd59b5762c944b3bdd270e95c6739cd4f530bfa
\ No newline at end of file