Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add extra OOM tests for fts5. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | fts5 |
Files: | files | file ages | folders |
SHA1: |
2dd59b5762c944b3bdd270e95c6739cd |
User & Date: | dan 2015-04-22 20:58:24.232 |
Context
2015-04-24
| ||
06:02 | Fix an fts5 build problem in main.mk. (check-in: 60045cedef user: dan tags: fts5) | |
2015-04-22
| ||
20:58 | Add extra OOM tests for fts5. (check-in: 2dd59b5762 user: dan tags: fts5) | |
20:14 | Fix problems with doclist-indexes involving very large rowids. (check-in: 1e5994097e user: dan tags: fts5) | |
Changes
Changes to ext/fts5/fts5_expr.c.
︙ | ︙ | |||
619 620 621 622 623 624 625 | int *pbEof /* OUT: Set to true if EOF */ ){ i64 iLast = *piLast; i64 iRowid; iRowid = sqlite3Fts5IterRowid(pIter); if( (bDesc==0 && iLast>iRowid) || (bDesc && iLast<iRowid) ){ | | | > | 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 | int *pbEof /* OUT: Set to true if EOF */ ){ i64 iLast = *piLast; i64 iRowid; iRowid = sqlite3Fts5IterRowid(pIter); if( (bDesc==0 && iLast>iRowid) || (bDesc && iLast<iRowid) ){ int rc = sqlite3Fts5IterNextFrom(pIter, iLast); if( rc || sqlite3Fts5IterEof(pIter) ){ *pRc = rc; *pbEof = 1; return 1; } iRowid = sqlite3Fts5IterRowid(pIter); assert( (bDesc==0 && iRowid>=iLast) || (bDesc==1 && iRowid<=iLast) ); } *piLast = iRowid; |
︙ | ︙ |
Changes to ext/fts5/fts5_index.c.
︙ | ︙ | |||
1557 1558 1559 1560 1561 1562 1563 1564 | ** Fts5SegIter.bDel ** ** Leave Fts5SegIter.iLeafOffset pointing to the first byte of the ** position list content (if any). */ static void fts5SegIterLoadNPos(Fts5Index *p, Fts5SegIter *pIter){ if( p->rc==SQLITE_OK ){ int iOff = pIter->iLeafOffset; /* Offset to read at */ | > < < < < < < < < < < | | 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 | ** Fts5SegIter.bDel ** ** Leave Fts5SegIter.iLeafOffset pointing to the first byte of the ** position list content (if any). */ 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 */ pIter->iLeafOffset += fts5GetPoslistSize(a, &pIter->nPos,&pIter->bDel); } } /* ** Fts5SegIter.iLeafOffset currently points to the first byte of the ** "nSuffix" field of a term. Function parameter nKeep contains the value ** of the "nPrefix" field (if there was one - it is passed 0 if this is |
︙ | ︙ | |||
1674 1675 1676 1677 1678 1679 1680 | */ static void fts5SegIterReverseInitPage(Fts5Index *p, Fts5SegIter *pIter){ int n = pIter->pLeaf->n; int i = pIter->iLeafOffset; u8 *a = pIter->pLeaf->p; int iRowidOffset = 0; | | | 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 | */ static void fts5SegIterReverseInitPage(Fts5Index *p, Fts5SegIter *pIter){ int n = pIter->pLeaf->n; int i = pIter->iLeafOffset; u8 *a = pIter->pLeaf->p; int iRowidOffset = 0; while( 1 ){ i64 iDelta = 0; int nPos; int bDummy; i += fts5GetPoslistSize(&a[i], &nPos, &bDummy); i += nPos; if( i>=n ) break; |
︙ | ︙ |
Added ext/fts5/test/fts5fault2.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | # 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 |