Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Update test cases to taken deferred statement-journal opening into account. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | memjournal-exp |
Files: | files | file ages | folders |
SHA1: |
5b2fe5219ab9ad15969e3374894a7597 |
User & Date: | drh 2016-03-04 14:23:10.937 |
Context
2016-03-04
| ||
14:43 | Defer opening and writing statement journals until the size reaches a threshold (currently 64KiB). (check-in: cb9302cca4 user: drh tags: trunk) | |
14:23 | Update test cases to taken deferred statement-journal opening into account. (Closed-Leaf check-in: 5b2fe5219a user: drh tags: memjournal-exp) | |
13:08 | Merge changes from trunk. (check-in: a87305dfd4 user: drh tags: memjournal-exp) | |
Changes
Changes to test/conflict.test.
︙ | ︙ | |||
281 282 283 284 285 286 287 | # cmd An UPDATE command to execute against table t1 # t0 True if there is an error from $cmd # t1 Content of "b" column of t1 assuming no error in $cmd # t2 Content of "x" column of t3 # t3 Number of temporary files for tables # t4 Number of temporary files for statement journals # | | | > > | | | | 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | # cmd An UPDATE command to execute against table t1 # t0 True if there is an error from $cmd # t1 Content of "b" column of t1 assuming no error in $cmd # t2 Content of "x" column of t3 # t3 Number of temporary files for tables # t4 Number of temporary files for statement journals # # Update (2007-08-21): Since temporary table files are now opened lazily, # and none of the following tests use large quantities of data, t3 is always 0. # # Update (2016-03-04): Subjournals now also open lazily, so t4 is also always 0. # foreach {i conf1 cmd t0 t1 t2 t3 t4} { 1 {} UPDATE 1 {6 7 8 9} 1 0 0 2 REPLACE UPDATE 0 {7 6 9} 1 0 0 3 IGNORE UPDATE 0 {6 7 3 9} 1 0 0 4 FAIL UPDATE 1 {6 7 3 4} 1 0 0 5 ABORT UPDATE 1 {1 2 3 4} 1 0 0 6 ROLLBACK UPDATE 1 {1 2 3 4} 0 0 0 7 REPLACE {UPDATE OR IGNORE} 0 {6 7 3 9} 1 0 0 8 IGNORE {UPDATE OR REPLACE} 0 {7 6 9} 1 0 0 9 FAIL {UPDATE OR IGNORE} 0 {6 7 3 9} 1 0 0 10 ABORT {UPDATE OR REPLACE} 0 {7 6 9} 1 0 0 11 ROLLBACK {UPDATE OR IGNORE} 0 {6 7 3 9} 1 0 0 12 {} {UPDATE OR IGNORE} 0 {6 7 3 9} 1 0 0 13 {} {UPDATE OR REPLACE} 0 {7 6 9} 1 0 0 14 {} {UPDATE OR FAIL} 1 {6 7 3 4} 1 0 0 15 {} {UPDATE OR ABORT} 1 {1 2 3 4} 1 0 0 16 {} {UPDATE OR ROLLBACK} 1 {1 2 3 4} 0 0 0 } { if {$t0} {set t1 {UNIQUE constraint failed: t1.a}} if {[info exists TEMP_STORE] && $TEMP_STORE==3} { set t3 0 } else { set t3 [expr {$t3+$t4}] |
︙ | ︙ |
Changes to test/conflict2.test.
︙ | ︙ | |||
282 283 284 285 286 287 288 289 290 | # t1 Content of "b" column of t1 assuming no error in $cmd # t2 Content of "x" column of t3 # t3 Number of temporary files for tables # t4 Number of temporary files for statement journals # # Update: Since temporary table files are now opened lazily, and none # of the following tests use large quantities of data, t3 is always 0. # foreach {i conf1 cmd t0 t1 t2 t3 t4} { | > > > | | | | | | | | | | | 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | # t1 Content of "b" column of t1 assuming no error in $cmd # t2 Content of "x" column of t3 # t3 Number of temporary files for tables # t4 Number of temporary files for statement journals # # Update: Since temporary table files are now opened lazily, and none # of the following tests use large quantities of data, t3 is always 0. # # Update (2016-03-04): Subjournals now only open when their size # exceeds 64KB. # foreach {i conf1 cmd t0 t1 t2 t3 t4} { 1 {} UPDATE 1 {6 7 8 9} 1 0 0 2 REPLACE UPDATE 0 {7 6 9} 1 0 0 3 IGNORE UPDATE 0 {6 7 3 9} 1 0 0 4 FAIL UPDATE 1 {6 7 3 4} 1 0 0 5 ABORT UPDATE 1 {1 2 3 4} 1 0 0 6 ROLLBACK UPDATE 1 {1 2 3 4} 0 0 0 7 REPLACE {UPDATE OR IGNORE} 0 {6 7 3 9} 1 0 0 8 IGNORE {UPDATE OR REPLACE} 0 {7 6 9} 1 0 0 9 FAIL {UPDATE OR IGNORE} 0 {6 7 3 9} 1 0 0 10 ABORT {UPDATE OR REPLACE} 0 {7 6 9} 1 0 0 11 ROLLBACK {UPDATE OR IGNORE} 0 {6 7 3 9} 1 0 0 12 {} {UPDATE OR IGNORE} 0 {6 7 3 9} 1 0 0 13 {} {UPDATE OR REPLACE} 0 {7 6 9} 1 0 0 14 {} {UPDATE OR FAIL} 1 {6 7 3 4} 1 0 0 15 {} {UPDATE OR ABORT} 1 {1 2 3 4} 1 0 0 16 {} {UPDATE OR ROLLBACK} 1 {1 2 3 4} 0 0 0 } { # When using in-memory journals, no temporary files are required for # statement journals. if {[permutation] == "inmemory_journal"} { set t4 0 } |
︙ | ︙ |
Changes to test/exclusive.test.
︙ | ︙ | |||
416 417 418 419 420 421 422 423 424 | BEGIN; INSERT INTO abc VALUES(1, 2, 3); INSERT INTO abc SELECT a+1, b+1, c+1 FROM abc; } } {} do_test exclusive-5.1 { # Three files are open: The db, journal and statement-journal. set sqlite_open_file_count expr $sqlite_open_file_count-$extrafds | > | | 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 | BEGIN; INSERT INTO abc VALUES(1, 2, 3); INSERT INTO abc SELECT a+1, b+1, c+1 FROM abc; } } {} do_test exclusive-5.1 { # Three files are open: The db, journal and statement-journal. # (2016-03-04) The statement-journal is now opened lazily set sqlite_open_file_count expr $sqlite_open_file_count-$extrafds } [expr 2 - ($TEMP_STORE>=2)] do_test exclusive-5.2 { execsql { COMMIT; } # One file open: the db. set sqlite_open_file_count expr $sqlite_open_file_count-$extrafds |
︙ | ︙ | |||
442 443 444 445 446 447 448 449 450 | expr $sqlite_open_file_count-$extrafds } {2} do_test exclusive-5.4 { execsql { INSERT INTO abc SELECT a+10, b+10, c+10 FROM abc; } # Three files are open: The db, journal and statement-journal. set sqlite_open_file_count expr $sqlite_open_file_count-$extrafds | > | > | | 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 | expr $sqlite_open_file_count-$extrafds } {2} do_test exclusive-5.4 { execsql { INSERT INTO abc SELECT a+10, b+10, c+10 FROM abc; } # Three files are open: The db, journal and statement-journal. # 2016-03-04: The statement-journal open is deferred set sqlite_open_file_count expr $sqlite_open_file_count-$extrafds } [expr 2 - ($TEMP_STORE>=2)] do_test exclusive-5.5 { execsql { COMMIT; } # Three files are still open: The db, journal and statement-journal. # 2016-03-04: The statement-journal open is deferred set sqlite_open_file_count expr $sqlite_open_file_count-$extrafds } [expr 2 - ($TEMP_STORE>=2)] do_test exclusive-5.6 { execsql { PRAGMA locking_mode = normal; SELECT * FROM abc; } } {normal 1 2 3 2 3 4 5 6 7 11 12 13 12 13 14 15 16 17} do_test exclusive-5.7 { |
︙ | ︙ |
Changes to test/stmt.test.
︙ | ︙ | |||
42 43 44 45 46 47 48 | set sqlite_open_file_count } {2} do_test stmt-1.4 { execsql { INSERT INTO t1 SELECT a+1, b+1 FROM t1; } set sqlite_open_file_count | > | > | | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | set sqlite_open_file_count } {2} do_test stmt-1.4 { execsql { INSERT INTO t1 SELECT a+1, b+1 FROM t1; } set sqlite_open_file_count # 2016-03-04: statement-journal open deferred } {2} do_test stmt-1.5 { execsql COMMIT set sqlite_open_file_count } {1} do_test stmt-1.6.1 { execsql { BEGIN; INSERT INTO t1 SELECT a+2, b+2 FROM t1; } set sqlite_open_file_count } {2} do_test stmt-1.6.2 { execsql { INSERT INTO t1 SELECT a+4, b+4 FROM t1 } set sqlite_open_file_count # 2016-03-04: statement-journal open deferred } {2} do_test stmt-1.7 { execsql COMMIT set sqlite_open_file_count } {1} proc filecount {testname sql expected} { |
︙ | ︙ | |||
80 81 82 83 84 85 86 | filecount stmt-2.1 { INSERT INTO t1 VALUES(9, 9) } 2 filecount stmt-2.2 { REPLACE INTO t1 VALUES(9, 9) } 2 filecount stmt-2.3 { INSERT INTO t1 SELECT 9, 9 } 2 filecount stmt-2.4 { INSERT INTO t1 SELECT 9, 9; INSERT INTO t1 SELECT 10, 10; | | | | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | filecount stmt-2.1 { INSERT INTO t1 VALUES(9, 9) } 2 filecount stmt-2.2 { REPLACE INTO t1 VALUES(9, 9) } 2 filecount stmt-2.3 { INSERT INTO t1 SELECT 9, 9 } 2 filecount stmt-2.4 { INSERT INTO t1 SELECT 9, 9; INSERT INTO t1 SELECT 10, 10; } 2 do_test stmt-2.5 { execsql { CREATE INDEX i1 ON t1(b) } } {} filecount stmt-2.6 { REPLACE INTO t1 VALUES(5, 5); REPLACE INTO t1 VALUES(5, 5); } 2 finish_test |
Changes to test/tempdb.test.
︙ | ︙ | |||
72 73 74 75 76 77 78 | INSERT INTO t1 VALUES(1, 2, 3); INSERT INTO t1 VALUES(4, 5, 6); INSERT INTO t2 VALUES(7, 8, 9); INSERT INTO t2 SELECT * FROM t1; } catchsql { INSERT INTO t1 SELECT * FROM t2 } set sqlite_open_file_count | | | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | INSERT INTO t1 VALUES(1, 2, 3); INSERT INTO t1 VALUES(4, 5, 6); INSERT INTO t2 VALUES(7, 8, 9); INSERT INTO t2 SELECT * FROM t1; } catchsql { INSERT INTO t1 SELECT * FROM t2 } set sqlite_open_file_count } [expr 1 + (0==$jrnl_in_memory)] do_test tempdb-2.3 { execsql { PRAGMA temp_store = 'memory'; ROLLBACK; BEGIN; INSERT INTO t1 VALUES(1, 2, 3); INSERT INTO t1 VALUES(4, 5, 6); |
︙ | ︙ |