From: dan Date: Fri, 18 Mar 2016 10:29:47 +0000 (+0000) Subject: Add tests for the changes on this branch. Fix a problem with calls to the new progres... X-Git-Tag: version-3.12.0~34^2~5 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=fe485c0e56050c1963bc7b5a3599628a3fe45212;p=thirdparty%2Fsqlite.git Add tests for the changes on this branch. Fix a problem with calls to the new progress indicator API made after an rbu update has been resumed. FossilOrigin-Name: bf82321724d3b0feb51e26d9b76090e03cc3964a --- diff --git a/ext/rbu/rbuprogress.test b/ext/rbu/rbuprogress.test index 9fcd014065..005aec5b24 100644 --- a/ext/rbu/rbuprogress.test +++ b/ext/rbu/rbuprogress.test @@ -13,7 +13,6 @@ source [file join [file dirname [info script]] rbu_common.tcl] set ::testprefix rbuprogress - # Create a simple RBU database. That expects to write to a table: # # CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c); @@ -58,29 +57,51 @@ do_test 1.10 { } {SQLITE_DONE} #------------------------------------------------------------------------- - -proc do_sp_test {tn target rbu reslist} { +# +proc do_sp_test {tn bReopen target rbu reslist} { uplevel [list do_test $tn [subst -nocommands { - sqlite3rbu rbu $target $rbu + if {$bReopen==0} { sqlite3rbu rbu $target $rbu } set res [list] while 1 { + if {$bReopen} { sqlite3rbu rbu $target $rbu } set rc [rbu step] if {[set rc] != "SQLITE_OK"} { error "error 1" } lappend res [lindex [rbu stage_progress] 0] if {[lindex [set res] end]==10000} break + if {$bReopen} { rbu close } } if {[set res] != [list $reslist]} { - error "reslist is incorrect (expect=$reslist got=[set res])" + error "1. reslist incorrect (expect=$reslist got=[set res])" } # One step to clean up the temporary tables used to update the only # target table in the rbu database. And one more to move the *-oal - # file to *-wal. + # file to *-wal. After each of these steps, the progress remains + # at "10000 0". + # rbu step + set res [rbu stage_progress] + if {[set res] != [list 10000 0]} { + error "2. reslist incorrect (expect=10000 0 got=[set res])" + } rbu step + set res [rbu stage_progress] + if {[set res] != [list 10000 0]} { + error "3. reslist incorrect (expect=10000 0 got=[set res])" + } # Do the checkpoint. - while {[rbu step]=="SQLITE_OK"} { } + while {[rbu step]=="SQLITE_OK"} { + foreach {a b} [rbu stage_progress] {} + if {[set a]!=10000 || [set b]<=0 || [set b]>10000} { + error "4. reslist incorrect (expect=10000 1..10000 got=[set a] [set b])" + } + } + + set res [rbu stage_progress] + if {[set res] != [list 10000 10000]} { + error "5. reslist is incorrect (expect=10000 10000 got=[set res])" + } rbu close }] {SQLITE_DONE}] @@ -93,87 +114,90 @@ proc create_db_file {filename sql} { tmpdb close } -reset_db -do_test 2.1.0 { - execsql { - CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c); - } - create_db_file rbu.db { - CREATE TABLE data_t1(a, b, c, rbu_control); - INSERT INTO data_t1 VALUES(4, 4, 4, 0); - INSERT INTO data_t1 VALUES(5, 5, 5, 0); - - CREATE TABLE rbu_count(tbl, cnt); - INSERT INTO rbu_count VALUES('data_t1', 2); - } -} {} -do_sp_test 2.1.1 test.db rbu.db {5000 10000} - -reset_db -do_test 2.2.0 { - execsql { CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c) } - create_rbu1 rbu.db -} {rbu.db} -do_sp_test 2.2.1 test.db rbu.db {3333 6666 10000} - -reset_db -do_test 2.3.0 { - execsql { - CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c); - CREATE INDEX i1 ON t1(b); - INSERT INTO t1 VALUES(1, 1, 1); - INSERT INTO t1 VALUES(2, 2, 2); - INSERT INTO t1 VALUES(3, 3, 3); - } - create_db_file rbu.db { - CREATE TABLE data_t1(a, b, c, rbu_control); - INSERT INTO data_t1 VALUES(4, 4, 4, 0); - INSERT INTO data_t1 VALUES(2, NULL, NULL, 1); - INSERT INTO data_t1 VALUES(5, NULL, NULL, 1); +foreach {bReopen} { 0 1 } { - CREATE TABLE rbu_count(tbl, cnt); - INSERT INTO rbu_count VALUES('data_t1', 3); - } -} {} -do_sp_test 2.3.1 test.db rbu.db {1666 3333 6000 8000 10000} - -reset_db -do_test 2.4.0 { - execsql { - CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c); - CREATE INDEX i1 ON t1(b); - INSERT INTO t1 VALUES(1, 1, 1); - INSERT INTO t1 VALUES(2, 2, 2); - INSERT INTO t1 VALUES(3, 3, 3); - } - create_db_file rbu.db { - CREATE TABLE data_t1(a, b, c, rbu_control); - INSERT INTO data_t1 VALUES(2, 4, 4, '.xx'); - - CREATE TABLE rbu_count(tbl, cnt); - INSERT INTO rbu_count VALUES('data_t1', 1); - } -} {} -do_sp_test 2.4.1 test.db rbu.db {3333 6666 10000} - -reset_db -do_test 2.5.0 { - execsql { - CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c); - CREATE INDEX i1 ON t1(b); - INSERT INTO t1 VALUES(1, 1, 1); - INSERT INTO t1 VALUES(2, 2, 2); - INSERT INTO t1 VALUES(3, 3, 3); - } - create_db_file rbu.db { - CREATE TABLE data_t1(a, b, c, rbu_control); - INSERT INTO data_t1 VALUES(4, NULL, 4, '.xx'); - - CREATE TABLE rbu_count(tbl, cnt); - INSERT INTO rbu_count VALUES('data_t1', 1); - } -} {} -do_sp_test 2.5.1 test.db rbu.db {10000} + reset_db + do_test 2.$bReopen.1.0 { + execsql { + CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c); + } + create_db_file rbu.db { + CREATE TABLE data_t1(a, b, c, rbu_control); + INSERT INTO data_t1 VALUES(4, 4, 4, 0); + INSERT INTO data_t1 VALUES(5, 5, 5, 0); + + CREATE TABLE rbu_count(tbl, cnt); + INSERT INTO rbu_count VALUES('data_t1', 2); + } + } {} + do_sp_test 2.$bReopen.1.1 $bReopen test.db rbu.db {5000 10000} + + reset_db + do_test 2.$bReopen.2.0 { + execsql { CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c) } + create_rbu1 rbu.db + } {rbu.db} + do_sp_test 2.$bReopen.2.1 $bReopen test.db rbu.db {3333 6666 10000} + + reset_db + do_test 2.$bReopen.3.0 { + execsql { + CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c); + CREATE INDEX i1 ON t1(b); + INSERT INTO t1 VALUES(1, 1, 1); + INSERT INTO t1 VALUES(2, 2, 2); + INSERT INTO t1 VALUES(3, 3, 3); + } + create_db_file rbu.db { + CREATE TABLE data_t1(a, b, c, rbu_control); + INSERT INTO data_t1 VALUES(4, 4, 4, 0); + INSERT INTO data_t1 VALUES(2, NULL, NULL, 1); + INSERT INTO data_t1 VALUES(5, NULL, NULL, 1); + + CREATE TABLE rbu_count(tbl, cnt); + INSERT INTO rbu_count VALUES('data_t1', 3); + } + } {} + do_sp_test 2.$bReopen.3.1 $bReopen test.db rbu.db {1666 3333 6000 8000 10000} + + reset_db + do_test 2.$bReopen.4.0 { + execsql { + CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c); + CREATE INDEX i1 ON t1(b); + INSERT INTO t1 VALUES(1, 1, 1); + INSERT INTO t1 VALUES(2, 2, 2); + INSERT INTO t1 VALUES(3, 3, 3); + } + create_db_file rbu.db { + CREATE TABLE data_t1(a, b, c, rbu_control); + INSERT INTO data_t1 VALUES(2, 4, 4, '.xx'); + + CREATE TABLE rbu_count(tbl, cnt); + INSERT INTO rbu_count VALUES('data_t1', 1); + } + } {} + do_sp_test 2.$bReopen.4.1 $bReopen test.db rbu.db {3333 6666 10000} + + reset_db + do_test 2.$bReopen.5.0 { + execsql { + CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c); + CREATE INDEX i1 ON t1(b); + INSERT INTO t1 VALUES(1, 1, 1); + INSERT INTO t1 VALUES(2, 2, 2); + INSERT INTO t1 VALUES(3, 3, 3); + } + create_db_file rbu.db { + CREATE TABLE data_t1(a, b, c, rbu_control); + INSERT INTO data_t1 VALUES(4, NULL, 4, '.xx'); + + CREATE TABLE rbu_count(tbl, cnt); + INSERT INTO rbu_count VALUES('data_t1', 1); + } + } {} + do_sp_test 2.$bReopen.5.1 $bReopen test.db rbu.db {10000} +} finish_test diff --git a/ext/rbu/sqlite3rbu.c b/ext/rbu/sqlite3rbu.c index 31d462b2b7..4b2529bf34 100644 --- a/ext/rbu/sqlite3rbu.c +++ b/ext/rbu/sqlite3rbu.c @@ -3207,6 +3207,7 @@ sqlite3rbu *sqlite3rbu_open( p->eStage = RBU_STAGE_OAL; }else{ p->eStage = pState->eStage; + p->nPhaseOneStep = pState->nPhaseOneStep; } p->nProgress = pState->nProgress; p->iOalSz = pState->iOalSz; diff --git a/manifest b/manifest index e0a85e57cc..7cbf1886a9 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\san\sAPI\sto\sindicate\sthe\spercentage\sprogress\sof\san\srbu\supdate. -D 2016-03-17T21:06:42.412 +C Add\stests\sfor\sthe\schanges\son\sthis\sbranch.\sFix\sa\sproblem\swith\scalls\sto\sthe\snew\sprogress\sindicator\sAPI\smade\safter\san\srbu\supdate\shas\sbeen\sresumed. +D 2016-03-18T10:29:47.529 F Makefile.in f53429fb2f313c099283659d0df6f20f932c861f F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc df0bf9ff7f8b3f4dd9fb4cc43f92fe58f6ec5c66 @@ -242,9 +242,9 @@ F ext/rbu/rbudiff.test 6cc806dc36389292f2a8f5842d0103721df4a07d F ext/rbu/rbufault.test cc0be8d5d392d98b0c2d6a51be377ea989250a89 F ext/rbu/rbufault2.test 9a7f19edd6ea35c4c9f807d8a3db0a03a5670c06 F ext/rbu/rbufts.test 828cd689da825f0a7b7c53ffc1f6f7fdb6fa5bda -F ext/rbu/rbuprogress.test d63b70f838a20422dce6445bcaed10890e506d02 +F ext/rbu/rbuprogress.test c4a9b3262bc0cafbf19709b56fbda0c3a9e69ac2 F ext/rbu/rbusave.test 0f43b6686084f426ddd040b878426452fd2c2f48 -F ext/rbu/sqlite3rbu.c 9bcf35b2f1d8eaf1c82b47bead114b2289ea06c6 +F ext/rbu/sqlite3rbu.c c89f1e59eb09257e126d2cdcb3c5588e16a44fee F ext/rbu/sqlite3rbu.h f8ee94f95fc80a35b7cb7ef3f2f5ea740b662477 F ext/rbu/test_rbu.c 5b6d31af188193d929234d1cd08ee967df092f66 F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761 @@ -1457,10 +1457,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 97b0e88cc7c3d677217d0bfab4cb4a34a4abb238 -R 9de86de419de6ede9128347e06885dfc -T *branch * rbu-percent-progress -T *sym-rbu-percent-progress * -T -sym-trunk * +P ffc58d2c2576a5b6e1c2c7112612c5760e711afd +R b5c08658920cbd4a66ad9300ad32e622 U dan -Z f4146c58d33c341586c7f6e824f90dbe +Z 25ebcfe6c5065c93d73006dcdc7ea2c0 diff --git a/manifest.uuid b/manifest.uuid index ca52cccd3f..a1b8da46e4 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ffc58d2c2576a5b6e1c2c7112612c5760e711afd \ No newline at end of file +bf82321724d3b0feb51e26d9b76090e03cc3964a \ No newline at end of file