Open a savepoint within the FTS3 optimize() function.

FossilOrigin-Name: 4924fbb244bd1b7103e29e045812cb1c4d2d81c8
This commit is contained in:
dan 2009-12-01 13:48:13 +00:00
parent 612b1d5cd0
commit 3acb07d6c3
4 changed files with 27 additions and 15 deletions

View File

@ -2155,9 +2155,18 @@ int sqlite3Fts3UpdateMethod(
** there was any data to flush) into a single segment.
*/
int sqlite3Fts3Optimize(Fts3Table *p){
int rc = sqlite3Fts3PendingTermsFlush(p);
int rc;
rc = sqlite3_exec(p->db, "SAVEPOINT fts3", 0, 0, 0);
if( rc==SQLITE_OK ){
rc = fts3SegmentMerge(p, -1);
rc = sqlite3Fts3PendingTermsFlush(p);
if( rc==SQLITE_OK ){
rc = fts3SegmentMerge(p, -1);
}
if( rc==SQLITE_OK ){
rc = sqlite3_exec(p->db, "RELEASE fts3", 0, 0, 0);
}else{
sqlite3_exec(p->db, "ROLLBACK TO fts3 ; RELEASE fts3", 0, 0, 0);
}
}
return rc;
}

View File

@ -1,5 +1,5 @@
C Fix\sa\ssegfault\sthat\scan\soccur\swhen\squerying\san\sempty\sFTS3\stable.\sAlso\srestore\sthe\srowid/docid\sconflict\shandling\sto\swork\sas\sit\sdid\sin\sversion\s3.6.20.
D 2009-12-01T12:00:22
C Open\sa\ssavepoint\swithin\sthe\sFTS3\soptimize()\sfunction.
D 2009-12-01T13:48:14
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in c5827ead754ab32b9585487177c93bb00b9497b3
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -68,7 +68,7 @@ F ext/fts3/fts3_snippet.c 39cf30a7916b2562867d52176e87b6d7de02aea0
F ext/fts3/fts3_tokenizer.c 36f78d1a43a29b0feaec1ced6da9e56b9c653d1f
F ext/fts3/fts3_tokenizer.h 7ff73caa3327589bf6550f60d93ebdd1f6a0fb5c
F ext/fts3/fts3_tokenizer1.c 0a5bcc579f35de5d24a9345d7908dc25ae403ee7
F ext/fts3/fts3_write.c 3ca5d8b24cdf6fcf18676a629ea44ab6cbe9e868
F ext/fts3/fts3_write.c 1d75e1be899ba8068ae88fe658f678e890b02f8f
F ext/fts3/mkfts3amal.tcl 252ecb7fe6467854f2aa237bf2c390b74e71f100
F ext/icu/README.txt 3b130aa66e7a681136f6add198b076a2f90d1e33
F ext/icu/icu.c 12e763d288d23b5a49de37caa30737b971a2f1e2
@ -326,7 +326,7 @@ F test/descidx3.test 3394ad4d089335cac743c36a14129d6d931c316f
F test/diskfull.test 0cede7ef9d8f415d9d3944005c76be7589bb5ebb
F test/distinctagg.test 1a6ef9c87a58669438fc771450d7a72577417376
F test/e_fkey.test fd1fcf89badd5f2773d7ac04775b5ff3488eda17
F test/e_fts3.test 2750245de8425f11f5b07463f0c6efdfad49a936
F test/e_fts3.test 8a1dd987d08a655c24be7e898fcbf1e7655ffbab
F test/enc.test e54531cd6bf941ee6760be041dff19a104c7acea
F test/enc2.test 6d91a5286f59add0cfcbb2d0da913b76f2242398
F test/enc3.test 5c550d59ff31dccdba5d1a02ae11c7047d77c041
@ -775,7 +775,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
P 6d112bfd53998b8f6693d3f2edbcd5ab4cdf5fb1
R 85871751503ef5eb36e53f4cac58d258
P c022f66b5a65aa54d5ebd55cfe941118a2042280
R 485d559dfdae9a83053e9af2113a2fa7
U dan
Z 01db46b86c86cc6015cde0a44e9285a0
Z 93dd7c80e5edb7b19676b5d0865cea7e

View File

@ -1 +1 @@
c022f66b5a65aa54d5ebd55cfe941118a2042280
4924fbb244bd1b7103e29e045812cb1c4d2d81c8

View File

@ -162,7 +162,6 @@ do_error_test fts3-1.2.1.10 {
} {SQL logic error or missing database}
# Test the optimize() function example:
if 0 {
ddl_test 1.2.2.1 { CREATE VIRTUAL TABLE docs USING fts3 }
write_test 1.2.2.2 docs_content {
INSERT INTO docs VALUES('Others translate the first clause as');
@ -174,13 +173,12 @@ write_test 1.2.2.4 docs_content {
INSERT INTO docs VALUES('the book is dedicated to Solomon.');
}
read_test 1.2.2.5 { SELECT count(*) FROM docs_segdir } {3}
set DO_MALLOC_TEST 1
#set DO_MALLOC_TEST 1
write_test 1.2.2.6 docs_segdir {
INSERT INTO docs
SELECT * FROM (SELECT optimize(docs) FROM docs LIMIT 1) WHERE 0;
}
read_test 1.2.2.7 { SELECT count(*) FROM docs_segdir } {1}
}
ddl_test 1.2.2.8 { DROP TABLE docs }
##########################################################################
# Test the examples in section 1.3 (querying FTS3 tables)
@ -273,6 +271,7 @@ read_test 1.4.1.16 {
SELECT * FROM docs WHERE docs MATCH '"lin* app*"'
} [concat $R(8) $R(9)]
ddl_test 1.4.1.17 { DROP TABLE docs }
unset R
ddl_test 1.4.2.1 { CREATE VIRTUAL TABLE docs USING fts3() }
write_test 1.4.2.2 docs_content {
@ -293,7 +292,11 @@ foreach {tn query hit} {
}
ddl_test 1.4.2.10 { DROP TABLE docs }
unset R
##########################################################################
# Test the example in section 3.1 (set operators with enhanced syntax).
#
set sqlite_fts3_enable_parentheses 1
ddl_test 1.5.1.1 { CREATE VIRTUAL TABLE docs USING fts3() }
# TODO: Change numbering after here...