Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add workload to the stress test that executes all the other SQL DML queries against the in-memory database. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
d391517f83c023ea73535898f0901aca |
User & Date: | mistachkin 2012-10-15 18:37:35.877 |
Context
2012-10-15
| ||
21:13 | Update SQLite core library to latest trunk. check-in: 633898547f user: mistachkin tags: trunk | |
18:37 | Add workload to the stress test that executes all the other SQL DML queries against the in-memory database. check-in: d391517f83 user: mistachkin tags: trunk | |
12:56 | Test suite infrastructure enhancements. check-in: 91e1dcb907 user: mistachkin tags: trunk | |
Changes
Changes to Tests/stress.eagle.
︙ | ︙ | |||
58 59 60 61 62 63 64 | return $result } ############################################################################# proc isExpectedError { error } { return [expr {[regexp -- {\sno such table: t1\s} $error] || \ | | > | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | return $result } ############################################################################# proc isExpectedError { error } { return [expr {[regexp -- {\sno such table: t1\s} $error] || \ [regexp -- {\sdatabase is locked\s} $error] || \ [regexp -- {\sdatabase table is locked\s} $error]}] } ############################################################################# proc waitForTest { {extra 0} } { after [expr {int((rand() * 1000) + $extra)}] } |
︙ | ︙ | |||
428 429 430 431 432 433 434 | # # NOTE: Workload #3, "small" SELECT statements. # lappend ::times(3) [lindex [time { setupDb $dstFileName "" "" "" "" "" true false for {set index 1} {$index <= $count1} {incr index} { if {[catch { | < < | > | 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 | # # NOTE: Workload #3, "small" SELECT statements. # lappend ::times(3) [lindex [time { setupDb $dstFileName "" "" "" "" "" true false for {set index 1} {$index <= $count1} {incr index} { if {[catch { set reader [sql execute -execute reader \ -format dataReader -alias $db [appendArgs \ "SELECT x, y FROM " $table " WHERE z = 'small';"]] while {[$reader Read]} { # # NOTE: Do nothing. # } unset -nocomplain reader showTest C |
︙ | ︙ | |||
464 465 466 467 468 469 470 | # # NOTE: Workload #4, "big" SELECT statements. # lappend ::times(4) [lindex [time { setupDb $dstFileName "" "" "" "" "" true false for {set index 1} {$index <= $count1} {incr index} { if {[catch { | < < | > | 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 | # # NOTE: Workload #4, "big" SELECT statements. # lappend ::times(4) [lindex [time { setupDb $dstFileName "" "" "" "" "" true false for {set index 1} {$index <= $count1} {incr index} { if {[catch { set reader [sql execute -execute reader \ -format dataReader -alias $db [appendArgs \ "SELECT x, y FROM " $table " WHERE z = 'big';"]] while {[$reader Read]} { # # NOTE: Do nothing. # } unset -nocomplain reader showTest D |
︙ | ︙ | |||
500 501 502 503 504 505 506 | # # NOTE: Workload #5, "small" INSERT statements. # lappend ::times(5) [lindex [time { setupDb $dstFileName "" "" "" "" "" true false for {set index 1} {$index <= $count1} {incr index} { if {[catch { | | < | | | 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 | # # NOTE: Workload #5, "small" INSERT statements. # lappend ::times(5) [lindex [time { setupDb $dstFileName "" "" "" "" "" true false for {set index 1} {$index <= $count1} {incr index} { if {[catch { sql execute $db [appendArgs "INSERT INTO " $table \ "(x, y, z) VALUES('" [format %lX [expr {random()}]] \ "', '" [base64 encode -- [expr {randstr($count2)}]] \ "', 'small');"] showTest E } error]} then { if {[isExpectedError $error]} then { showTest e } else { failTest e $error |
︙ | ︙ | |||
531 532 533 534 535 536 537 | # # NOTE: Workload #6, "big" INSERT statements. # lappend ::times(6) [lindex [time { setupDb $dstFileName "" "" "" "" "" true false for {set index 1} {$index <= $count1} {incr index} { if {[catch { | | < | | 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 | # # NOTE: Workload #6, "big" INSERT statements. # lappend ::times(6) [lindex [time { setupDb $dstFileName "" "" "" "" "" true false for {set index 1} {$index <= $count1} {incr index} { if {[catch { sql execute $db [appendArgs "INSERT INTO " $table \ "(x, y, z) VALUES('" [format %lX [expr {random()}]] \ "', RANDOMBLOB(" $count3 "), 'big');"] showTest F } error]} then { if {[isExpectedError $error]} then { showTest f } else { failTest f $error |
︙ | ︙ | |||
591 592 593 594 595 596 597 | # NOTE: Workload #8, "big" UPDATE statements. # lappend ::times(8) [lindex [time { setupDb $dstFileName "" "" "" "" "" true false for {set index 1} {$index <= $count1} {incr index} { if {[catch { sql execute $db [appendArgs "UPDATE " $table \ | | < | | 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 | # NOTE: Workload #8, "big" UPDATE statements. # lappend ::times(8) [lindex [time { setupDb $dstFileName "" "" "" "" "" true false for {set index 1} {$index <= $count1} {incr index} { if {[catch { sql execute $db [appendArgs "UPDATE " $table \ " SET y = RANDOMBLOB(" $count3 ") WHERE x LIKE '" \ [format %X $index] "%' AND z = 'big';"] showTest H } error]} then { if {[isExpectedError $error]} then { showTest h } else { failTest h $error } |
︙ | ︙ | |||
969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 | failTest q $error } } } cleanupDb $dstFileName db false true false }] 0] }] } -body { for {set index(0) 0} {$index(0) < $count(0)} {incr index(0)} { sql execute $db "CREATE TABLE IF NOT EXISTS t1(x PRIMARY KEY, y, z);" unset -nocomplain thread foreach index(1) [lsort -integer [array names workload]] { if {[lsearch -exact $noWorkload $index(1)] == -1} then { set thread($index(1)) [object create -alias System.Threading.Thread \ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 | failTest q $error } } } cleanupDb $dstFileName db false true false }] 0] }] ############################################################################# # WORKLOAD #18 (R) # ############################################################################# set workload(18) [list \ [list srcFileName dstFileName table count1 count2 count3] { # # NOTE: Workload #18, execute queries against the in-memory database # lappend ::times(18) [lindex [time { setupDb $srcFileName "" "" "" "" "" false false true true for {set index 1} {$index <= $count1} {incr index} { if {[catch { # # NOTE: Workload #18.3, "small" SELECT statements. # set reader [sql execute -execute reader \ -format dataReader -alias $db [appendArgs \ "SELECT x, y FROM " $table " WHERE z = 'small';"]] while {[$reader Read]} { # # NOTE: Do nothing. # } unset -nocomplain reader # # NOTE: Workload #18.4, "big" SELECT statements. # set reader [sql execute -execute reader \ -format dataReader -alias $db [appendArgs \ "SELECT x, y FROM " $table " WHERE z = 'big';"]] while {[$reader Read]} { # # NOTE: Do nothing. # } unset -nocomplain reader # # NOTE: Workload #18.5, "small" INSERT statements. # sql execute $db [appendArgs "INSERT INTO " $table \ "(x, y, z) VALUES('" [format %lX [expr {random()}]] \ "', '" [base64 encode -- [expr {randstr($count2)}]] \ "', 'small');"] # # NOTE: Workload #18.6, "big" INSERT statements. # sql execute $db [appendArgs "INSERT INTO " $table \ "(x, y, z) VALUES('" [format %lX [expr {random()}]] \ "', RANDOMBLOB(" $count3 "), 'big');"] # # NOTE: Workload #18.7, "small" UPDATE statements. # sql execute $db [appendArgs "UPDATE " $table \ " SET y = '" [base64 encode -- [expr {randstr($count2)}]] \ "' WHERE x LIKE '" [format %X $index] "%' AND z = 'small';"] # # NOTE: Workload #18.8, "big" UPDATE statements. # sql execute $db [appendArgs "UPDATE " $table \ " SET y = RANDOMBLOB(" $count3 ") WHERE x LIKE '" \ [format %X $index] "%' AND z = 'big';"] # # NOTE: Workload #18.9, "small" DELETE statements. # sql execute $db [appendArgs "DELETE FROM " $table \ " WHERE x LIKE '" [format %X $index] "%' AND z = 'small';"] # # NOTE: Workload #18.10, "big" DELETE statements. # sql execute $db [appendArgs "DELETE FROM " $table \ " WHERE x LIKE '" [format %X $index] "%' AND z = 'big';"] # # NOTE: Workload #18.11, VACUUM statement. # sql execute $db "VACUUM;" # # NOTE: Workload #18.14, PRAGMA integrity check statement. # set result [sql execute -execute scalar $db \ "PRAGMA integrity_check;"] if {$result ne "ok"} then { error [appendArgs "integrity check failed: " $result] } showTest R } error]} then { if {[isExpectedError $error]} then { showTest r } else { failTest r $error } } } cleanupDb $srcFileName db false true false }] 0] }] } -body { for {set index(0) 0} {$index(0) < $count(0)} {incr index(0)} { sql execute $srcDb "CREATE TABLE IF NOT EXISTS t1(x PRIMARY KEY, y, z);" sql execute $db "CREATE TABLE IF NOT EXISTS t1(x PRIMARY KEY, y, z);" unset -nocomplain thread foreach index(1) [lsort -integer [array names workload]] { if {[lsearch -exact $noWorkload $index(1)] == -1} then { set thread($index(1)) [object create -alias System.Threading.Thread \ |
︙ | ︙ |