Add test cases to cover fts5 integrity-check code.
FossilOrigin-Name: 1d018c35b9e81982df036f5e62a4a42219b54e02
This commit is contained in:
parent
b77ebd828b
commit
6609bab24d
@ -4854,7 +4854,6 @@ static void fts5IndexIntegrityCheckEmpty(
|
||||
if( i>=iNoRowid && 0!=fts5LeafFirstRowidOff(pLeaf) ) p->rc = FTS5_CORRUPT;
|
||||
}
|
||||
fts5DataRelease(pLeaf);
|
||||
if( p->rc ) break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4921,7 +4920,7 @@ static void fts5IndexIntegrityCheckSegment(
|
||||
if( pSeg->pgnoFirst==0 ) return;
|
||||
|
||||
fts5IndexPrepareStmt(p, &pStmt, sqlite3_mprintf(
|
||||
"SELECT segid, term, (pgno>>1), (pgno & 1) FROM '%q'.'%q_idx' WHERE segid=%d",
|
||||
"SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d",
|
||||
pConfig->zDb, pConfig->zName, pSeg->iSegid
|
||||
));
|
||||
|
||||
|
@ -154,8 +154,6 @@ do_test 3.9 {
|
||||
|
||||
do_3_test 3.10
|
||||
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Test that segments that end unexpectedly are identified as corruption.
|
||||
#
|
||||
@ -252,6 +250,90 @@ foreach rowid [db eval {SELECT rowid FROM x1_data WHERE rowid>100}] {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
reset_db
|
||||
do_execsql_test 6.1.0 {
|
||||
CREATE VIRTUAL TABLE t1 USING fts5(a);
|
||||
INSERT INTO t1 VALUES('bbbbb ccccc');
|
||||
SELECT quote(block) FROM t1_data WHERE rowid>100;
|
||||
} {X'000000180630626262626201020201056363636363010203040A'}
|
||||
do_execsql_test 6.1.1 {
|
||||
UPDATE t1_data SET block =
|
||||
X'000000180630626262626201020201056161616161010203040A'
|
||||
WHERE rowid>100;
|
||||
}
|
||||
do_catchsql_test 6.1.2 {
|
||||
INSERT INTO t1(t1) VALUES('integrity-check');
|
||||
} {1 {database disk image is malformed}}
|
||||
|
||||
#-------
|
||||
reset_db
|
||||
do_execsql_test 6.2.0 {
|
||||
CREATE VIRTUAL TABLE t1 USING fts5(a);
|
||||
INSERT INTO t1(t1, rank) VALUES('pgsz', 32);
|
||||
INSERT INTO t1 VALUES('aa bb cc dd ee');
|
||||
SELECT pgno, quote(term) FROM t1_idx;
|
||||
} {2 X'' 4 X'3064'}
|
||||
do_execsql_test 6.2.1 {
|
||||
UPDATE t1_idx SET term = X'3065' WHERE pgno=4;
|
||||
}
|
||||
do_catchsql_test 6.2.2 {
|
||||
INSERT INTO t1(t1) VALUES('integrity-check');
|
||||
} {1 {database disk image is malformed}}
|
||||
|
||||
#-------
|
||||
reset_db
|
||||
do_execsql_test 6.3.0 {
|
||||
CREATE VIRTUAL TABLE t1 USING fts5(a);
|
||||
INSERT INTO t1 VALUES('abc abcdef abcdefghi');
|
||||
SELECT quote(block) FROM t1_data WHERE id>100;
|
||||
} {X'0000001C043061626301020204036465660102030703676869010204040808'}
|
||||
do_execsql_test 6.3.1 {
|
||||
BEGIN;
|
||||
UPDATE t1_data SET block =
|
||||
X'0000001C043061626301020204036465660102035003676869010204040808'
|
||||
------------------------------------------^^---------------------
|
||||
WHERE id>100;
|
||||
}
|
||||
do_catchsql_test 6.3.2 {
|
||||
INSERT INTO t1(t1) VALUES('integrity-check');
|
||||
} {1 {database disk image is malformed}}
|
||||
do_execsql_test 6.3.3 {
|
||||
ROLLBACK;
|
||||
BEGIN;
|
||||
UPDATE t1_data SET block =
|
||||
X'0000001C043061626301020204036465660102030750676869010204040808'
|
||||
--------------------------------------------^^-------------------
|
||||
WHERE id>100;
|
||||
}
|
||||
do_catchsql_test 6.3.3 {
|
||||
INSERT INTO t1(t1) VALUES('integrity-check');
|
||||
} {1 {database disk image is malformed}}
|
||||
do_execsql_test 6.3.4 {
|
||||
ROLLBACK;
|
||||
BEGIN;
|
||||
UPDATE t1_data SET block =
|
||||
X'0000001C043061626301020204036465660102030707676869010204040850'
|
||||
--------------------------------------------------------------^^-
|
||||
WHERE id>100;
|
||||
}
|
||||
do_catchsql_test 6.3.5 {
|
||||
INSERT INTO t1(t1) VALUES('integrity-check');
|
||||
} {1 {database disk image is malformed}}
|
||||
do_execsql_test 6.3.6 {
|
||||
ROLLBACK;
|
||||
BEGIN;
|
||||
UPDATE t1_data SET block =
|
||||
X'0000001C503061626301020204036465660102030707676869010204040808'
|
||||
----------^^-----------------------------------------------------
|
||||
WHERE id>100;
|
||||
}
|
||||
do_catchsql_test 6.3.5 {
|
||||
INSERT INTO t1(t1) VALUES('integrity-check');
|
||||
} {1 {database disk image is malformed}}
|
||||
|
||||
sqlite3_fts5_may_be_corrupt 0
|
||||
finish_test
|
||||
|
16
manifest
16
manifest
@ -1,5 +1,5 @@
|
||||
C Reformat\ssome\scode\sto\smake\sit\seasier\sto\smerge\swith\ssessions.\s\sNo\slogic\schanges.
|
||||
D 2015-09-15T13:42:16.601
|
||||
C Add\stest\scases\sto\scover\sfts5\sintegrity-check\scode.
|
||||
D 2015-09-15T14:39:17.597
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in f85066ce844a28b671aaeeff320921cd0ce36239
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
@ -112,7 +112,7 @@ F ext/fts5/fts5_buffer.c 64dcaf36a3ebda9e84b7c3b8788887ec325e12a4
|
||||
F ext/fts5/fts5_config.c 57ee5fe71578cb494574fc0e6e51acb9a22a8695
|
||||
F ext/fts5/fts5_expr.c 667faaf14a69a5683ac383acdc8d942cf32c3f93
|
||||
F ext/fts5/fts5_hash.c 4bf4b99708848357b8a2b5819e509eb6d3df9246
|
||||
F ext/fts5/fts5_index.c 437c907fec8b72c08394cda73cee84afca700a00
|
||||
F ext/fts5/fts5_index.c 4fdbc0a321e3a1d73741a623d7aea4db78d6a86d
|
||||
F ext/fts5/fts5_main.c 3fa906f6c0177caf8f82862bc70f37b28bb3305c
|
||||
F ext/fts5/fts5_storage.c 120f7b143688b5b7710dacbd48cff211609b8059
|
||||
F ext/fts5/fts5_tcl.c 6da58d6e8f42a93c4486b5ba9b187a7f995dee37
|
||||
@ -146,7 +146,7 @@ F ext/fts5/test/fts5config.test ad2ff42ddc856aed2d05bf89dc1c578c8a39ea3b
|
||||
F ext/fts5/test/fts5content.test 9a952c95518a14182dc3b59e3c8fa71cda82a4e1
|
||||
F ext/fts5/test/fts5corrupt.test c2ad090192708150d50d961278df10ae7a4b8b62
|
||||
F ext/fts5/test/fts5corrupt2.test 26c0a39dd9ff73207e6229f83b50b21d37c7658c
|
||||
F ext/fts5/test/fts5corrupt3.test 618a965b4fd2859f9ddb72413c9828a23828704b
|
||||
F ext/fts5/test/fts5corrupt3.test a1429635c30f922079189e35b2b631eb7463a2fb
|
||||
F ext/fts5/test/fts5dlidx.test ecba5e62ea8b26c33829961602069c546228046d
|
||||
F ext/fts5/test/fts5doclist.test 8edb5b57e5f144030ed74ec00ef6fa4294fed79b
|
||||
F ext/fts5/test/fts5ea.test b01e3a18cdfabbff8104a96a5242a06a68a998a0
|
||||
@ -1387,7 +1387,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
|
||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
|
||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||
P b26d8f79c62cb71b4c3ea5df9d0e09558bbbd794
|
||||
R c60068330077cac7ec52227493b03ae0
|
||||
U drh
|
||||
Z 9a77e7bf5b2e60419df2346d70a9c648
|
||||
P eade355fafec558fc13dc4b08ca0b07713a2cd84
|
||||
R 1694ed50f41ea37a05fbcbd009cf49d5
|
||||
U dan
|
||||
Z ab887f4a44598b0175c78de8cb058da9
|
||||
|
@ -1 +1 @@
|
||||
eade355fafec558fc13dc4b08ca0b07713a2cd84
|
||||
1d018c35b9e81982df036f5e62a4a42219b54e02
|
Loading…
Reference in New Issue
Block a user