diff options
author | dan <dan@noemail.net> | 2016-03-08 15:37:48 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2016-03-08 15:37:48 +0000 |
commit | c7dbce0f2a533a146ea556523e433e6f042c5334 (patch) | |
tree | 52cf7915389f75d4fb6369bd99e48229f4c59fbb | |
parent | 6702f761ea6e942b042952376e086c64b69d193a (diff) | |
download | sqlite-c7dbce0f2a533a146ea556523e433e6f042c5334.tar.gz sqlite-c7dbce0f2a533a146ea556523e433e6f042c5334.zip |
Update fts3/4 so that the 'merge=X,Y' command merges at least, instead of exactly, Y segments from a single level. This matches the documentation. 'merge=X,0' is, as it was in 3.11, an error.
FossilOrigin-Name: 64b3cb29159491cbfab7e01844b54408541ece5e
-rw-r--r-- | ext/fts3/fts3_write.c | 9 | ||||
-rw-r--r-- | manifest | 26 | ||||
-rw-r--r-- | manifest.uuid | 2 | ||||
-rw-r--r-- | test/backcompat.test | 10 | ||||
-rw-r--r-- | test/fts4growth.test | 40 | ||||
-rw-r--r-- | test/fts4langid.test | 2 | ||||
-rw-r--r-- | test/fts4merge.test | 25 | ||||
-rw-r--r-- | test/fts4merge3.test | 6 | ||||
-rw-r--r-- | test/fts4opt.test | 4 |
9 files changed, 61 insertions, 63 deletions
diff --git a/ext/fts3/fts3_write.c b/ext/fts3/fts3_write.c index 6a2299fcc..24039aef3 100644 --- a/ext/fts3/fts3_write.c +++ b/ext/fts3/fts3_write.c @@ -4840,11 +4840,8 @@ int sqlite3Fts3Incrmerge(Fts3Table *p, int nMerge, int nMin){ sqlite3_bind_int(pFindLevel, 1, MAX(2, nMin)); if( sqlite3_step(pFindLevel)==SQLITE_ROW ){ iAbsLevel = sqlite3_column_int64(pFindLevel, 0); - if( nMin<2 ){ - nSeg = sqlite3_column_int(pFindLevel, 1); - }else{ - nSeg = nMin; - } + nSeg = sqlite3_column_int(pFindLevel, 1); + assert( nSeg>=2 ); }else{ nSeg = -1; } @@ -4996,7 +4993,7 @@ static int fts3DoIncrmerge( nMin = fts3Getint(&z); } - if( z[0]!='\0' || nMin<0 || nMin==1 ){ + if( z[0]!='\0' || nMin<2 ){ rc = SQLITE_ERROR; }else{ rc = SQLITE_OK; @@ -1,5 +1,5 @@ -C Fix\sATTACH\sto\suse\sthe\ssymbolic\sname\sPAGER_SYNCHRONOUS_FULL\srather\sthan\nan\sinteger\sliteral. -D 2016-03-08T14:16:23.535 +C Update\sfts3/4\sso\sthat\sthe\s'merge=X,Y'\scommand\smerges\sat\sleast,\sinstead\sof\sexactly,\sY\ssegments\sfrom\sa\ssingle\slevel.\sThis\smatches\sthe\sdocumentation.\s'merge=X,0'\sis,\sas\sit\swas\sin\s3.11,\san\serror. +D 2016-03-08T15:37:48.202 F Makefile.in f53429fb2f313c099283659d0df6f20f932c861f F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc df0bf9ff7f8b3f4dd9fb4cc43f92fe58f6ec5c66 @@ -88,7 +88,7 @@ F ext/fts3/fts3_tokenizer.h 64c6ef6c5272c51ebe60fc607a896e84288fcbc3 F ext/fts3/fts3_tokenizer1.c 5c98225a53705e5ee34824087478cf477bdb7004 F ext/fts3/fts3_unicode.c a93f5edc0aff44ef8b06d7cb55b52026541ca145 F ext/fts3/fts3_unicode2.c c3d01968d497bd7001e7dc774ba75b372738c057 -F ext/fts3/fts3_write.c f56345c64387ca30bf91b91511082fa83d9b5178 +F ext/fts3/fts3_write.c fb0456fa1407758f82458417c76fe4b06c86be98 F ext/fts3/fts3speed.tcl b54caf6a18d38174f1a6e84219950d85e98bb1e9 F ext/fts3/mkfts3amal.tcl 252ecb7fe6467854f2aa237bf2c390b74e71f100 F ext/fts3/tool/fts3view.c 5d78b668f4e9598af9147f8999632599fb0d9dd5 @@ -482,7 +482,7 @@ F test/autoindex5.test 96f084a5e6024ea07cace5888df3223f3ea86990 F test/autovacuum.test 941892505d2c0f410a0cb5970dfa1c7c4e5f6e74 F test/autovacuum_ioerr2.test 8a367b224183ad801e0e24dcb7d1501f45f244b4 F test/avtrans.test 0252654f4295ddda3b2cce0e894812259e655a85 -F test/backcompat.test 19a1f337c68419b020a7481dd272a472c4ad8ef4 +F test/backcompat.test 28403f43d11624e696c5ef134c7c7d81015cd19e F test/backup.test b79299a536a4c6d919094786595b95be56d02014 F test/backup2.test 34986ef926ea522911a51dfdb2f8e99b7b75ebcf F test/backup4.test 2a2e4a64388090b152de753fd9e123f28f6a3bd4 @@ -744,17 +744,17 @@ F test/fts4aa.test 10aac8e9d62c7357590acfabe3fad01e9a9ce1cb F test/fts4check.test c3056eab9524232e4c9bdcd119912947e07bcc1c F test/fts4content.test 05716af19a899cd70d5cd916c580043c03f30db4 F test/fts4docid.test e33c383cfbdff0284685604d256f347a18fdbf01 -F test/fts4growth.test 60d6bb3f78e25b34f533797dd9f2f9402310a13a +F test/fts4growth.test e5390da74619cacc389711bac9349640b32c4f9a F test/fts4growth2.test 13ad4e76451af6e6906c95cdc725d01b00044269 F test/fts4incr.test 4e353a0bd886ea984e56fce9e77724fc923b8d0d -F test/fts4langid.test 9794addcc8faaee85ac60eceecdb52feb0c70f68 -F test/fts4merge.test 146563df4a90ccb7f111a6e11ab29bbfe9e6ce2c +F test/fts4langid.test 65a7332c9bc257919e259a304aa8a38c41655b9d +F test/fts4merge.test d2b39f6b1bd4a9738a13540e2d044cba11c43d47 F test/fts4merge2.test 5faa558d1b672f82b847d2a337465fa745e46891 -F test/fts4merge3.test aab02a09f50fe6baaddc2e159c3eabc116d45fc7 +F test/fts4merge3.test 8d9ccb4a3d41c4c617a149d6c4b13ad02de797d0 F test/fts4merge4.test d895b1057a7798b67e03455d0fa50e9ea836c47b F test/fts4noti.test 5553d7bb2e20bf4a06b23e849352efc022ce6309 F test/fts4onepass.test 7319d61a2ed1325fc54afd0c060a0513b462303a -F test/fts4opt.test f15c84305c4b78c665fc476d8569e27ab9a0d418 +F test/fts4opt.test 1901f696214c4e16a995dd7fdd70576fc5c41dbe F test/fts4unicode.test 27378af76394542cf490cf001d8d1505fe55f6a9 F test/full.test 6b3c8fb43c6beab6b95438c1675374b95fab245d F test/func.test ae97561957aba6ca9e3a7b8a13aac41830d701ef @@ -1454,7 +1454,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 3a65a1fc0fd2408c6984153801ec5dcd5211c897 -R 713ccf93fbf940d5f93658dc674d69a8 -U drh -Z 60af40306ae0297078d0f487c0fa1cd6 +P c4e192a0e5a408e198dbacb2752859a00d2b572f +R 3e8d6ecab7b420c32f9b7a175d510e4d +U dan +Z 45820e8758a67cfc47c6d8f8a214769a diff --git a/manifest.uuid b/manifest.uuid index 60ec4c1d2..5eb2c62ef 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c4e192a0e5a408e198dbacb2752859a00d2b572f
\ No newline at end of file +64b3cb29159491cbfab7e01844b54408541ece5e
\ No newline at end of file diff --git a/test/backcompat.test b/test/backcompat.test index ea7e6a9ee..fe8a83f0a 100644 --- a/test/backcompat.test +++ b/test/backcompat.test @@ -63,7 +63,7 @@ proc do_backcompat_test {rv bin1 bin2 script} { set v [split [db version] .] if {[llength $v]==3} {lappend v 0} set ::sqlite_libversion [format \ - "%d%.2d%.2d%2d" [lindex $v 0] [lindex $v 1] [lindex $v 2] [lindex $v 3] + "%d%.2d%.2d%.2d" [lindex $v 0] [lindex $v 1] [lindex $v 2] [lindex $v 3] ] } } @@ -420,6 +420,12 @@ ifcapable fts3 { if {[code1 { set ::sqlite_libversion }] >=3071200 && [code2 { set ::sqlite_libversion }] >=3071200 } { + if {[code1 { set ::sqlite_libversion }]<3120000} { + set res {0 {0 1} 1 0} + } else { + set res {1 0} + } + do_test backcompat-3.9 { sql1 { INSERT INTO t2(t2) VALUES('merge=100,4'); } sql2 { INSERT INTO t2(t2) VALUES('merge=100,4'); } @@ -428,7 +434,7 @@ ifcapable fts3 { sql2 { SELECT level, group_concat(idx, ' ') FROM t2_segdir GROUP BY level; } - } {0 {0 1} 1 0} + } $res do_test backcompat-3.10 { sql1 { INSERT INTO t2(t2) VALUES('integrity-check') } diff --git a/test/fts4growth.test b/test/fts4growth.test index e4b5f19ec..4dc221246 100644 --- a/test/fts4growth.test +++ b/test/fts4growth.test @@ -59,11 +59,11 @@ do_test 1.4 { INSERT INTO x1(x1) VALUES('merge=4,4'); SELECT level, end_block, length(root) FROM x1_segdir; } -} {0 {0 110} 110 0 {0 132} 132 0 {0 129} 129 1 {128 658} 2} +} {1 {224 921} 2} do_execsql_test 1.5 { SELECT length(block) FROM x1_segments; -} {658 {}} +} {921 {}} do_test 1.6 { foreach L { @@ -71,27 +71,33 @@ do_test 1.6 { {That perched above Dead Man's Creek, beside the mountain road.} {He turned the cycle down the hill and mounted for the fray,} {But 'ere he'd gone a dozen yards it bolted clean away.} + {It left the track, and through the trees, just like a silver steak,} {It whistled down the awful slope towards the Dead Man's Creek.} {It shaved a stump by half an inch, it dodged a big white-box:} {The very wallaroos in fright went scrambling up the rocks,} + {The wombats hiding in their caves dug deeper underground,} {As Mulga Bill, as white as chalk, sat tight to every bound.} {It struck a stone and gave a spring that cleared a fallen tree,} {It raced beside a precipice as close as close could be;} + {And then as Mulga Bill let out one last despairing shriek} {It made a leap of twenty feet into the Dead Man's Creek.} + {It shaved a stump by half an inch, it dodged a big white-box:} + {The very wallaroos in fright went scrambling up the rocks,} + {The wombats hiding in their caves dug deeper underground,} } { execsql { INSERT INTO x1 VALUES($L) } } execsql { SELECT level, end_block, length(root) FROM x1_segdir; } -} {1 {128 658} 2 1 {130 1377} 6 0 {0 117} 117} +} {1 {224 921} 2 1 {226 1230} 7 0 {0 98} 98} do_execsql_test 1.7 { - SELECT sum(length(block)) FROM x1_segments WHERE blockid IN (129, 130); -} {1377} + SELECT sum(length(block)) FROM x1_segments WHERE blockid IN (224,225,226) +} {1230} #------------------------------------------------------------------------- # @@ -131,24 +137,24 @@ do_execsql_test 2.5 { SELECT end_block FROM x2_segdir WHERE level=3; INSERT INTO x2(x2) VALUES('merge=4,4'); SELECT end_block FROM x2_segdir WHERE level=3; -} {{3828 -3430} {3828 -10191} {3828 -14109}} +} {{5588 -3950} {5588 -11766} {5588 -15541}} do_execsql_test 2.6 { SELECT sum(length(block)) FROM x2_segdir, x2_segments WHERE blockid BETWEEN start_block AND leaves_end_block AND level=3 -} {14109} +} {15541} do_execsql_test 2.7 { INSERT INTO x2(x2) VALUES('merge=1000,4'); SELECT end_block FROM x2_segdir WHERE level=3; -} {{3828 86120}} +} {{5588 127563}} do_execsql_test 2.8 { SELECT sum(length(block)) FROM x2_segdir, x2_segments WHERE blockid BETWEEN start_block AND leaves_end_block AND level=3 -} {86120} +} {127563} #-------------------------------------------------------------------------- # Test that delete markers are removed from FTS segments when possible. @@ -391,7 +397,7 @@ do_execsql_test 7.2 { } { 0 0 {118 117483} 0 1 {238 118006} 0 2 {358 118006} 0 3 {478 118006} 0 4 {598 118006} 0 5 {718 118006} - 1 0 {16014 -51226} + 1 0 {23694 -69477} } do_execsql_test 7.3 { @@ -400,7 +406,7 @@ do_execsql_test 7.3 { } { 0 0 {118 117483} 0 1 {238 118006} 0 2 {358 118006} 0 3 {478 118006} 0 4 {598 118006} 0 5 {718 118006} - 1 0 16014 + 1 0 23694 } do_execsql_test 7.4 { @@ -409,28 +415,26 @@ do_execsql_test 7.4 { } { 0 0 {118 117483} 0 1 {238 118006} 0 2 {358 118006} 0 3 {478 118006} 0 4 {598 118006} 0 5 {718 118006} - 1 0 16014 + 1 0 23694 } do_execsql_test 7.5 { INSERT INTO x6(x6) VALUES('merge=2500,4'); - SELECT level, idx, end_block FROM x6_segdir; + SELECT level, idx, start_block, leaves_end_block, end_block FROM x6_segdir; } { - 0 0 {598 118006} 0 1 {718 118006} 1 0 16014 + 1 0 719 1171 23694 } do_execsql_test 7.6 { INSERT INTO x6(x6) VALUES('merge=2500,2'); SELECT level, idx, start_block, leaves_end_block, end_block FROM x6_segdir; } { - 2 0 23695 24147 {41262 633507} + 1 0 719 1171 23694 } do_execsql_test 7.7 { SELECT sum(length(block)) FROM x6_segments - WHERE blockid BETWEEN 23695 AND 24147 -} {633507} - +} {635247} finish_test diff --git a/test/fts4langid.test b/test/fts4langid.test index eb3602b4b..fdb1876be 100644 --- a/test/fts4langid.test +++ b/test/fts4langid.test @@ -481,6 +481,6 @@ foreach lid [list 4 [expr 1<<30]] { do_execsql_test 5.4.$lid.5 { SELECT count(*) FROM t6_segdir; SELECT count(*) FROM t6_segments; - } {4 4} + } {1 2} } finish_test diff --git a/test/fts4merge.test b/test/fts4merge.test index 41f91fdc8..eac18311d 100644 --- a/test/fts4merge.test +++ b/test/fts4merge.test @@ -55,8 +55,6 @@ foreach mod {fts3 fts4} { do_execsql_test 1.3 { SELECT level, group_concat(idx, ' ') FROM t1_segdir GROUP BY level } { - 0 {0 1 2 3} - 1 {0 1 2 3 4 5 6} 2 {0 1 2 3} } @@ -71,7 +69,6 @@ foreach mod {fts3 fts4} { do_execsql_test 1.5 { SELECT level, group_concat(idx, ' ') FROM t1_segdir GROUP BY level } { - 2 {0 1} 3 0 } @@ -118,11 +115,7 @@ foreach mod {fts3 fts4} { INSERT INTO t2(t2) VALUES('merge=1000000,2'); SELECT level, group_concat(idx, ' ') FROM t2_segdir GROUP BY level } { - 0 0 - 2 0 - 3 0 4 0 - 6 0 } #------------------------------------------------------------------------- @@ -202,28 +195,27 @@ foreach mod {fts3 fts4} { INSERT INTO t1(t1) VALUES('merge=1,5'); SELECT level, group_concat(idx, ' ') FROM t1_segdir GROUP BY level; } { - 0 {0 1 2} 1 {0 1 2 3 4 5 6 7 8 9 10 11 12 13 14} 2 {0 1 2 3} } - do_execsql_test 5.4 {SELECT quote(value) from t1_stat WHERE rowid=1} {X'0105'} + do_execsql_test 5.4 {SELECT quote(value) from t1_stat WHERE rowid=1} {X'010F'} do_test 5.5 { foreach docid [execsql {SELECT docid FROM t1}] { execsql {INSERT INTO t1 SELECT * FROM t1 WHERE docid=$docid} } } {} - do_execsql_test 5.6 {SELECT quote(value) from t1_stat WHERE rowid=1} {X'0105'} + do_execsql_test 5.6 {SELECT quote(value) from t1_stat WHERE rowid=1} {X'010F'} do_execsql_test 5.7 { SELECT level, group_concat(idx, ' ') FROM t1_segdir GROUP BY level; SELECT quote(value) from t1_stat WHERE rowid=1; } { - 0 {0 1 2 3 4 5 6 7 8 9 10} + 0 {0 1 2 3 4 5 6 7} 1 {0 1 2 3 4 5 6 7 8 9 10 11 12} - 2 {0 1 2 3 4 5 6 7} - X'0105' + 2 {0 1 2 3 4 5 6 7} + X'010F' } do_execsql_test 5.8 { @@ -232,9 +224,8 @@ foreach mod {fts3 fts4} { SELECT level, group_concat(idx, ' ') FROM t1_segdir GROUP BY level; SELECT quote(value) from t1_stat WHERE rowid=1; } { - 0 {0 1 2 3 4} 1 {0 1 2 3 4 5 6 7 8 9 10 11 12 13} - 2 {0 1 2 3 4 5 6 7 8} X'0106' + 2 {0 1 2 3 4 5 6 7 8} X'010E' } do_test 5.8.1 { fts3_integrity_check t1 } ok @@ -252,7 +243,7 @@ foreach mod {fts3 fts4} { SELECT level, group_concat(idx, ' ') FROM t1_segdir GROUP BY level; SELECT quote(value) from t1_stat WHERE rowid=1; } { - 0 0 1 {0 1} 2 0 3 0 X'0106' + 0 {0 1 2 3 4 5 6 7 8 9 10 11} 1 0 2 0 3 0 X'010E' } do_execsql_test 5.11 { @@ -260,7 +251,7 @@ foreach mod {fts3 fts4} { SELECT level, group_concat(idx, ' ') FROM t1_segdir GROUP BY level; SELECT quote(value) from t1_stat WHERE rowid=1; } { - 0 0 1 {0 1} 2 0 3 0 X'' + 1 {0 1} 2 0 3 0 X'010E' } #------------------------------------------------------------------------- diff --git a/test/fts4merge3.test b/test/fts4merge3.test index 329b4d2cc..08b68b97d 100644 --- a/test/fts4merge3.test +++ b/test/fts4merge3.test @@ -62,7 +62,7 @@ do_all_bc_test { do_test 1.7 { sql2 { SELECT level, count(*) FROM t2_segdir GROUP BY level ORDER BY 1 - } } [list 0 1 2 18 3 5] + } } {2 15 3 5} # Using the old connection, insert many rows. do_test 1.8 { @@ -73,7 +73,7 @@ do_all_bc_test { do_test 1.9 { sql2 { SELECT level, count(*) FROM t2_segdir GROUP BY level ORDER BY 1 - } } [list 0 13 1 13 2 5 3 6] + } } [list 0 12 1 13 2 4 3 6] # Run a big incr-merge operation on the db. do_test 1.10 { sql1 { INSERT INTO t2(t2) VALUES('merge=2000,2') } } {} @@ -97,7 +97,7 @@ do_all_bc_test { do_test 1.15 { sql2 { SELECT level, count(*) FROM t2_segdir GROUP BY level ORDER BY 1 - } } {6 1} + } } {4 1} } } diff --git a/test/fts4opt.test b/test/fts4opt.test index 5638aff1b..1933c57b1 100644 --- a/test/fts4opt.test +++ b/test/fts4opt.test @@ -92,7 +92,7 @@ do_execsql_test 1.5 { do_test 1.6 { while 1 { set tc1 [db total_changes] - execsql { INSERT INTO t2(t2) VALUES('merge=5,0') } + execsql { INSERT INTO t2(t2) VALUES('merge=5,2') } set tc2 [db total_changes] if {($tc2 - $tc1) < 2} break } @@ -153,7 +153,7 @@ do_execsql_test 2.5 { do_test 2.6 { while 1 { set tc1 [db total_changes] - execsql { INSERT INTO t2(t2) VALUES('merge=5,0') } + execsql { INSERT INTO t2(t2) VALUES('merge=5,2') } set tc2 [db total_changes] if {($tc2 - $tc1) < 2} break } |