Add tests for and remove unreachable branches from fts5 in order to restore test coverage.
FossilOrigin-Name: 22589018ac3321f7bd89ce9fa69e57eae395e324
This commit is contained in:
parent
b80b8f482c
commit
d120a1e3ab
@ -236,7 +236,6 @@ int sqlite3Fts5PoslistWriterAppend(
|
||||
Fts5PoslistWriter *pWriter,
|
||||
i64 iPos
|
||||
){
|
||||
static const i64 colmask = ((i64)(0x7FFFFFFF)) << 32;
|
||||
int rc;
|
||||
if( fts5BufferGrow(&rc, pBuf, 5+5+5) ) return rc;
|
||||
sqlite3Fts5PoslistSafeAppend(pBuf, &pWriter->iPrev, iPos);
|
||||
|
@ -518,7 +518,6 @@ struct Fts5Iter {
|
||||
int nSeg; /* Size of aSeg[] array */
|
||||
int bRev; /* True to iterate in reverse order */
|
||||
u8 bSkipEmpty; /* True to skip deleted entries */
|
||||
u8 bFiltered; /* True if column-filter already applied */
|
||||
|
||||
i64 iSwitchRowid; /* Firstest rowid of other than aFirst[1] */
|
||||
Fts5CResult *aFirst; /* Current merge state (see above) */
|
||||
@ -2030,9 +2029,6 @@ static void fts5SegIterReverse(Fts5Index *p, Fts5SegIter *pIter){
|
||||
iPoslist = 4;
|
||||
}
|
||||
fts5IndexSkipVarint(pLeaf->p, iPoslist);
|
||||
assert( p->pConfig->eDetail==FTS5_DETAIL_NONE || iPoslist==(
|
||||
pIter->iLeafOffset - sqlite3Fts5GetVarintLen(pIter->nPos*2+pIter->bDel)
|
||||
));
|
||||
pIter->iLeafOffset = iPoslist;
|
||||
|
||||
/* If this condition is true then the largest rowid for the current
|
||||
@ -3095,7 +3091,7 @@ static void fts5IterSetOutputs_Nocolset(Fts5Iter *pIter, Fts5SegIter *pSeg){
|
||||
pIter->base.nData = pSeg->nPos;
|
||||
|
||||
assert( pIter->pIndex->pConfig->eDetail!=FTS5_DETAIL_NONE );
|
||||
assert( pIter->pColset==0 || pIter->bFiltered );
|
||||
assert( pIter->pColset==0 );
|
||||
|
||||
if( pSeg->iLeafOffset+pSeg->nPos<=pSeg->pLeaf->szLeaf ){
|
||||
/* All data is stored on the current page. Populate the output
|
||||
@ -3212,7 +3208,7 @@ static void fts5IterSetOutputCb(int *pRc, Fts5Iter *pIter){
|
||||
pIter->xSetOutputs = fts5IterSetOutputs_None;
|
||||
}
|
||||
|
||||
else if( pIter->pColset==0 || pIter->bFiltered ){
|
||||
else if( pIter->pColset==0 ){
|
||||
pIter->xSetOutputs = fts5IterSetOutputs_Nocolset;
|
||||
}
|
||||
|
||||
@ -3359,7 +3355,6 @@ static void fts5MultiIterNew2(
|
||||
if( pNew ){
|
||||
Fts5SegIter *pIter = &pNew->aSeg[1];
|
||||
|
||||
pNew->bFiltered = 1;
|
||||
pIter->flags = FTS5_SEGITER_ONETERM;
|
||||
if( pData->szLeaf>0 ){
|
||||
pIter->pLeaf = pData;
|
||||
@ -4704,11 +4699,7 @@ static void fts5MergePrefixLists(
|
||||
Fts5Buffer *p1, /* First list to merge */
|
||||
Fts5Buffer *p2 /* Second list to merge */
|
||||
){
|
||||
|
||||
if( p2->n ){
|
||||
if( p1->n==0 ){
|
||||
fts5BufferSwap(p1, p2);
|
||||
}else{
|
||||
i64 iLastRowid = 0;
|
||||
Fts5DoclistIter i1;
|
||||
Fts5DoclistIter i2;
|
||||
@ -4735,6 +4726,7 @@ static void fts5MergePrefixLists(
|
||||
if( i2.aPoslist==0 ) break;
|
||||
}
|
||||
else{
|
||||
/* Merge the two position lists. */
|
||||
i64 iPos1 = 0;
|
||||
i64 iPos2 = 0;
|
||||
int iOff1 = 0;
|
||||
@ -4746,7 +4738,6 @@ static void fts5MergePrefixLists(
|
||||
Fts5PoslistWriter writer;
|
||||
memset(&writer, 0, sizeof(writer));
|
||||
|
||||
/* Merge the two position lists. */
|
||||
fts5MergeAppendDocid(&out, iLastRowid, i2.iRowid);
|
||||
fts5BufferZero(&tmp);
|
||||
sqlite3Fts5BufferSize(&p->rc, &tmp, i1.nPoslist + i2.nPoslist);
|
||||
@ -4773,9 +4764,8 @@ static void fts5MergePrefixLists(
|
||||
sqlite3Fts5PoslistNext64(a1, i1.nPoslist, &iOff1, &iPos1);
|
||||
if( iPos1<0 ) break;
|
||||
}else{
|
||||
if( iPos2!=iPrev ){
|
||||
assert( iPos2!=iPrev );
|
||||
sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos2);
|
||||
}
|
||||
sqlite3Fts5PoslistNext64(a2, i2.nPoslist, &iOff2, &iPos2);
|
||||
if( iPos2<0 ) break;
|
||||
}
|
||||
@ -4787,11 +4777,9 @@ static void fts5MergePrefixLists(
|
||||
sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos1);
|
||||
}
|
||||
fts5BufferSafeAppendBlob(&tmp, &a1[iOff1], i1.nPoslist-iOff1);
|
||||
}
|
||||
else if( iPos2>=0 ){
|
||||
if( iPos2!=iPrev ){
|
||||
}else{
|
||||
assert( iPos2>=0 && iPos2!=iPrev );
|
||||
sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos2);
|
||||
}
|
||||
fts5BufferSafeAppendBlob(&tmp, &a2[iOff2], i2.nPoslist-iOff2);
|
||||
}
|
||||
|
||||
@ -4813,13 +4801,11 @@ static void fts5MergePrefixLists(
|
||||
fts5BufferSafeAppendBlob(&out, i2.aPoslist, i2.aEof - i2.aPoslist);
|
||||
}
|
||||
|
||||
error_out:
|
||||
fts5BufferSet(&p->rc, p1, out.n, out.p);
|
||||
fts5BufferFree(&tmp);
|
||||
fts5BufferFree(&out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void fts5SetupPrefixIter(
|
||||
Fts5Index *p, /* Index to read from */
|
||||
@ -5181,10 +5167,11 @@ int sqlite3Fts5IndexQuery(
|
||||
int bDesc = (flags & FTS5INDEX_QUERY_DESC)!=0;
|
||||
buf.p[0] = FTS5_MAIN_PREFIX;
|
||||
fts5SetupPrefixIter(p, bDesc, buf.p, nToken+1, pColset, &pRet);
|
||||
assert( pRet->pColset==0 );
|
||||
fts5IterSetOutputCb(&p->rc, pRet);
|
||||
if( p->rc==SQLITE_OK ){
|
||||
Fts5SegIter *pSeg = &pRet->aSeg[pRet->aFirst[1].iFirst];
|
||||
if( p->rc==SQLITE_OK && pSeg->pLeaf ) pRet->xSetOutputs(pRet, pSeg);
|
||||
if( pSeg->pLeaf ) pRet->xSetOutputs(pRet, pSeg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -333,7 +333,10 @@ int sqlite3Fts5PutVarint(unsigned char *p, u64 v){
|
||||
|
||||
|
||||
int sqlite3Fts5GetVarintLen(u32 iVal){
|
||||
#if 0
|
||||
if( iVal<(1 << 7 ) ) return 1;
|
||||
#endif
|
||||
assert( iVal>=(1 << 7) );
|
||||
if( iVal<(1 << 14) ) return 2;
|
||||
if( iVal<(1 << 21) ) return 3;
|
||||
if( iVal<(1 << 28) ) return 4;
|
||||
|
@ -243,5 +243,9 @@ foreach {tn opt} {
|
||||
do_catchsql_test 11.$tn "CREATE VIRTUAL TABLE f1 USING fts5(x, $opt)" $res
|
||||
}
|
||||
|
||||
do_catchsql_test 12.1 {
|
||||
INSERT INTO t1(t1, rank) VALUES('rank', NULL);;
|
||||
} {1 {SQL logic error or missing database}}
|
||||
|
||||
finish_test
|
||||
|
||||
|
18
manifest
18
manifest
@ -1,5 +1,5 @@
|
||||
C Further\sstreamlining\sof\sfts5\sprefix\squery\scode.
|
||||
D 2016-02-05T19:18:02.811
|
||||
C Add\stests\sfor\sand\sremove\sunreachable\sbranches\sfrom\sfts5\sin\sorder\sto\srestore\stest\scoverage.
|
||||
D 2016-02-05T21:09:26.310
|
||||
F Makefile.in 027c1603f255390c43a426671055a31c0a65fdb4
|
||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||
F Makefile.msc 72b7858f02017611c3ac1ddc965251017fed0845
|
||||
@ -100,11 +100,11 @@ F ext/fts5/extract_api_docs.tcl a36e54ec777172ddd3f9a88daf593b00848368e0
|
||||
F ext/fts5/fts5.h ff9c2782e8ed890b0de2f697a8d63971939e70c7
|
||||
F ext/fts5/fts5Int.h efb02807dbe5a2bfb0ea592a472d1171cb553d53
|
||||
F ext/fts5/fts5_aux.c b9bcce753ef5b451267b2232f0ca153ddeb3951d
|
||||
F ext/fts5/fts5_buffer.c ad4bb545c866eea6add1b0f84c2c5029cd689092
|
||||
F ext/fts5/fts5_buffer.c 2dac8e23c5b77fccecc234f1a1f37d75113b4e46
|
||||
F ext/fts5/fts5_config.c 0c384ebdd23fd055e2e50a93277b8d59da538238
|
||||
F ext/fts5/fts5_expr.c ff5c451a6d025909639ac0f0d0af0cc595b50feb
|
||||
F ext/fts5/fts5_hash.c 1b113977296cf4212c6ec667d5e3f2bd18036955
|
||||
F ext/fts5/fts5_index.c 9706959f2188d97d72df750519fee7baccef9964
|
||||
F ext/fts5/fts5_index.c 28f72130400cb54d179a9a120b7232915e3e7a4e
|
||||
F ext/fts5/fts5_main.c 6e23df904049edb498538bd3e22e53ec1ab6f4f7
|
||||
F ext/fts5/fts5_storage.c 2a1f44deae090cd711f02cec0c2af8e660360d24
|
||||
F ext/fts5/fts5_tcl.c f8731e0508299bd43f1a2eff7dbeaac870768966
|
||||
@ -112,7 +112,7 @@ F ext/fts5/fts5_test_mi.c 1ec66ffdf7632077fbd773b7a6df5153272ec070
|
||||
F ext/fts5/fts5_test_tok.c db08af63673c3a7d39f053b36fd6e065017706be
|
||||
F ext/fts5/fts5_tokenize.c 4d5c4f183c7d07d144bc219b92da1ea0e962fae3
|
||||
F ext/fts5/fts5_unicode2.c 78273fbd588d1d9bd0a7e4e0ccc9207348bae33c
|
||||
F ext/fts5/fts5_varint.c 3f86ce09cab152e3d45490d7586b7ed2e40c13f1
|
||||
F ext/fts5/fts5_varint.c a5aceacda04dafcbae725413d7a16818ecd65738
|
||||
F ext/fts5/fts5_vocab.c 3ef401a8d6932db56368de32f446eb9fe73aa623
|
||||
F ext/fts5/fts5parse.y 1647eba089b9b3fc058b4dc989d9da87d15b9580
|
||||
F ext/fts5/mkportersteps.tcl 5acf962d2e0074f701620bb5308155fa1e4a63ba
|
||||
@ -136,7 +136,7 @@ F ext/fts5/test/fts5auxdata.test 141a7cbffcceb1bd2799b4b29c183ff8780d586e
|
||||
F ext/fts5/test/fts5bigpl.test 04ee0d7eebbebf17c31f5a0b5c5f9494eac3a0cb
|
||||
F ext/fts5/test/fts5bigtok.test 981b2790f6fa02773c889bd35d42c6b97f80f0f4
|
||||
F ext/fts5/test/fts5columnsize.test a8cfef21ffa1c264b9f670a7d94eeaccb5341c07
|
||||
F ext/fts5/test/fts5config.test 83941309b94d002ed6f55d9cd814e0353c9ae013
|
||||
F ext/fts5/test/fts5config.test 8b2bc6dcc0eb06fa2b7dd65b2ce2db09e829e873
|
||||
F ext/fts5/test/fts5conflict.test 26f4e46c4d31e16221794832a990dc4e30e18de5
|
||||
F ext/fts5/test/fts5content.test 9a952c95518a14182dc3b59e3c8fa71cda82a4e1
|
||||
F ext/fts5/test/fts5corrupt.test c2ad090192708150d50d961278df10ae7a4b8b62
|
||||
@ -1426,7 +1426,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f
|
||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
|
||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||
P 1cac6c45eeb7dbbcda0c76ba7d3a2ca77bc725cd
|
||||
R 82ed27d217d52be944f2d4bee3dfe639
|
||||
P ca91bd8ac70a5b3fef127364f73ec675e58bb92c
|
||||
R bc449da6b3e9fd24816f80d5ebb5f8a2
|
||||
U dan
|
||||
Z ad1bc1867d7f59ff72d365283a40efbf
|
||||
Z 6b9788cdb90c1d425a4100a494ea3da5
|
||||
|
@ -1 +1 @@
|
||||
ca91bd8ac70a5b3fef127364f73ec675e58bb92c
|
||||
22589018ac3321f7bd89ce9fa69e57eae395e324
|
Loading…
Reference in New Issue
Block a user