Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix a problem in fts5fault1.test. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | fts5 |
Files: | files | file ages | folders |
SHA1: |
a21d60cb2ac6463c012d82d1970d90da |
User & Date: | dan 2015-04-21 20:13:38.631 |
Context
2015-04-22
| ||
09:40 | Update this branch with latest trunk changes. (check-in: 9797482ded user: dan tags: fts5) | |
2015-04-21
| ||
20:13 | Fix a problem in fts5fault1.test. (check-in: a21d60cb2a user: dan tags: fts5) | |
19:07 | Fix an fts5 problem with large deletes. (check-in: e50e8031d6 user: dan tags: fts5) | |
Changes
Changes to ext/fts5/fts5_index.c.
︙ | ︙ | |||
1469 1470 1471 1472 1473 1474 1475 | } pIter->iOff = iOff; } return pIter->bEof; } | | > | < < | < | | < < | > > > > < < < < | | | | | | | < < < < < < < < < | < | 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 | } pIter->iOff = iOff; } return pIter->bEof; } static Fts5DlidxIter *fts5DlidxIterInit( Fts5Index *p, /* Fts5 Backend to iterate within */ int bRev, /* True for ORDER BY ASC */ int iIdx, int iSegid, /* Segment iSegid within index iIdx */ int iLeafPg /* Leaf page number to load dlidx for */ ){ Fts5DlidxIter *pIter; pIter = (Fts5DlidxIter*)fts5IdxMalloc(p, sizeof(Fts5DlidxIter)); if( pIter==0 ) return 0; pIter->pData = fts5DataRead(p, FTS5_DOCLIST_IDX_ROWID(iIdx, iSegid, iLeafPg)); if( pIter->pData==0 ){ sqlite3_free(pIter); pIter = 0; }else{ pIter->iLeafPgno = iLeafPg; if( bRev==0 ){ fts5DlidxIterFirst(pIter); }else{ fts5DlidxIterLast(pIter); } } return pIter; } /* ** Free a doclist-index iterator object allocated by fts5DlidxIterInit(). */ static void fts5DlidxIterFree(Fts5DlidxIter *pIter){ if( pIter ){ |
︙ | ︙ | |||
2026 2027 2028 2029 2030 2031 2032 | int nPos; iOff += fts5GetPoslistSize(&pLeaf->p[iOff], &nPos, &bDummy); iOff += nPos; } } } | | | 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 | int nPos; iOff += fts5GetPoslistSize(&pLeaf->p[iOff], &nPos, &bDummy); iOff += nPos; } } } pIter->pDlidx = fts5DlidxIterInit(p, bRev, iIdx, iSeg, pIter->iTermLeafPgno); } /* ** Initialize the object pIter to point to term pTerm/nTerm within segment ** pSeg, index iIdx. If there is no such term in the index, the iterator ** is set to EOF. ** |
︙ | ︙ | |||
3971 3972 3973 3974 3975 3976 3977 | int iSegid, /* Segment id to load from */ int iLeaf /* Load doclist-index for this leaf */ ){ Fts5DlidxIter *pDlidx = 0; i64 cksum1 = 13; i64 cksum2 = 13; | | | | 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 | int iSegid, /* Segment id to load from */ int iLeaf /* Load doclist-index for this leaf */ ){ Fts5DlidxIter *pDlidx = 0; i64 cksum1 = 13; i64 cksum2 = 13; for(pDlidx=fts5DlidxIterInit(p, 0, iIdx, iSegid, iLeaf); fts5DlidxIterEof(p, pDlidx)==0; fts5DlidxIterNext(pDlidx) ){ assert( pDlidx->iLeafPgno>iLeaf ); cksum1 = (cksum1 ^ ( (i64)(pDlidx->iLeafPgno) << 32 )); cksum1 = (cksum1 ^ pDlidx->iRowid); } fts5DlidxIterFree(pDlidx); pDlidx = 0; for(pDlidx=fts5DlidxIterInit(p, 1, iIdx, iSegid, iLeaf); fts5DlidxIterEof(p, pDlidx)==0; fts5DlidxIterPrev(pDlidx) ){ assert( pDlidx->iLeafPgno>iLeaf ); cksum2 = (cksum2 ^ ( (i64)(pDlidx->iLeafPgno) << 32 )); cksum2 = (cksum2 ^ pDlidx->iRowid); } |
︙ | ︙ | |||
4059 4060 4061 4062 4063 4064 4065 | if( iter.bDlidx ){ Fts5DlidxIter *pDlidx = 0; /* For iterating through doclist index */ int iPrevLeaf = iter.iLeaf; int iSegid = pSeg->iSegid; int iPg; i64 iKey; | | | 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 | if( iter.bDlidx ){ Fts5DlidxIter *pDlidx = 0; /* For iterating through doclist index */ int iPrevLeaf = iter.iLeaf; int iSegid = pSeg->iSegid; int iPg; i64 iKey; for(pDlidx=fts5DlidxIterInit(p, 0, iIdx, iSegid, iter.iLeaf); fts5DlidxIterEof(p, pDlidx)==0; fts5DlidxIterNext(pDlidx) ){ /* Check any rowid-less pages that occur before the current leaf. */ for(iPg=iPrevLeaf+1; iPg<pDlidx->iLeafPgno; iPg++){ iKey = FTS5_SEGMENT_ROWID(iIdx, iSegid, 0, iPg); |
︙ | ︙ |
Changes to ext/fts5/test/fts5fault1.test.
︙ | ︙ | |||
27 28 29 30 31 32 33 | # 1: CREATE VIRTUAL TABLE # 2: INSERT statement # 3: DELETE statement # 4: MATCH expressions # # | < < | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | # 1: CREATE VIRTUAL TABLE # 2: INSERT statement # 3: DELETE statement # 4: MATCH expressions # # faultsim_save_and_close do_faultsim_test 1 -prep { faultsim_restore_and_reopen } -body { execsql { CREATE VIRTUAL TABLE t1 USING fts5(a, b, prefix='1, 2, 3') } } -test { faultsim_test_result {0 {}} |
︙ | ︙ | |||
313 314 315 316 317 318 319 | execsql { SELECT rowid FROM x1 WHERE x1 MATCH 'x*' } } -test { faultsim_test_result [list 0 $::res] } | < < > < | | 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 | execsql { SELECT rowid FROM x1 WHERE x1 MATCH 'x*' } } -test { faultsim_test_result [list 0 $::res] } #------------------------------------------------------------------------- # Segment promotion. # do_test 9.0 { reset_db db func rnddoc fts5_rnddoc execsql { CREATE VIRTUAL TABLE s2 USING fts5(x); INSERT INTO s2(s2, rank) VALUES('pgsz', 32); INSERT INTO s2(s2, rank) VALUES('automerge', 0); } for {set i 1} {$i <= 16} {incr i} { execsql { INSERT INTO s2 VALUES(rnddoc(5)) } } fts5_level_segs s2 } {0 1} set insert_doc [db one {SELECT rnddoc(160)}] faultsim_save_and_close do_faultsim_test 9.1 -faults oom-* -prep { faultsim_restore_and_reopen } -body { execsql { INSERT INTO s2 VALUES($::insert_doc) } } -test { faultsim_test_result {0 {}} if {$testrc==0} { set ls [fts5_level_segs s2] if {$ls != "2 0"} { error "fts5_level_segs says {$ls}" } } } finish_test |