Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add test cases for running multiple RBU operations within the same process concurrently. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
407b5ed35c178bb0dbc69c8b90265203 |
User & Date: | dan 2018-01-11 16:16:03.148 |
Context
2018-01-11
| ||
17:33 | Change zipfile to be a WITHOUT ROWID virtual table and table-valued function. (check-in: 931201f64e user: dan tags: trunk) | |
16:16 | Add test cases for running multiple RBU operations within the same process concurrently. (check-in: 407b5ed35c user: dan tags: trunk) | |
14:50 | Minor formatting changes in zipfile.c. No logical code differences. (check-in: 4f68bed3b9 user: drh tags: trunk) | |
Changes
Added ext/rbu/rbumulti.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 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 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | # 2018 January 11 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # # This file contains tests of multiple RBU operations running # concurrently within the same process. # source [file join [file dirname [info script]] rbu_common.tcl] set ::testprefix rbumulti db close sqlite3_shutdown sqlite3_config_uri 1 autoinstall_test_functions proc build_db {db} { $db eval { CREATE TABLE t1(a PRIMARY KEY, b, c); CREATE INDEX i1 ON t1(b); CREATE INDEX i2 ON t1(c); WITH s(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<500 ) INSERT INTO t1 SELECT randomblob(10), randomblob(100), randomblob(100) FROM s; } } proc build_rbu {db} { $db eval { CREATE TABLE data_t1(a, b, c, rbu_control); WITH s(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<100 ) INSERT INTO data_t1 SELECT randomblob(10), randomblob(100), randomblob(100), 0 FROM s; } } proc step_rbu2 {bOpenClose openr1 openr2} { forcedelete teststate.db1 forcedelete teststate.db2 if {$bOpenClose!=0 && $bOpenClose!=1} { error $bOpenClose } if {$bOpenClose==0} { eval $openr1 eval $openr2 } set b1 0 set b2 0 while {$b1==0 || $b2==0} { if {$bOpenClose==1} { if {$b1==0} { eval $openr1 teststate.db1 } if {$b2==0} { eval $openr2 teststate.db2 } } if {$b1==0} { set rc1 [r1 step] if {$rc1 != "SQLITE_OK"} { set b1 1 } } if {$b2==0} { set rc2 [r2 step] if {$rc2 != "SQLITE_OK"} { set b2 1 } } if {$bOpenClose==1} { if {$b1==0} { r1 close } if {$b2==0} { r2 close } } } set rc1 [r1 close] set rc2 [r2 close] list $rc1 $rc2 } for {set i 0} {$i<=3} {incr i} { if {$i & 0x01} { sqlite3rbu_create_vfs -default myrbu "" } set bOpenClose [expr $i>>1] forcedelete test.db forcedelete test.db2 forcedelete rbu.db forcedelete rbu.db2 do_test 1.$i.0 { sqlite3 db test.db sqlite3 db2 test.db2 build_db db build_db db2 sqlite3 rbu1 rbu.db sqlite3 rbu2 rbu.db2 build_rbu rbu1 build_rbu rbu2 rbu1 close rbu2 close } {} set m1 [db eval {SELECT md5sum(a, b, c) FROM t1}] set m2 [db2 eval {SELECT md5sum(a, b, c) FROM t1}] do_test 1.$i.1 { step_rbu2 $bOpenClose { sqlite3rbu r1 test.db rbu.db } { sqlite3rbu r2 test.db2 rbu.db2 } } {SQLITE_DONE SQLITE_DONE} do_execsql_test -db db 1.$i.2.1 { PRAGMA integrity_check } ok do_execsql_test -db db2 1.$i.2.2 { PRAGMA integrity_check } ok do_execsql_test -db db 1.$i.3.1 { SELECT md5sum(a, b, c)==$m1 FROM t1 } 0 do_execsql_test -db db2 1.$i.3.2 { SELECT md5sum(a, b, c)==$m2 FROM t1 } 0 catch { db close } catch { db2 close } #----------------------------------------------------------------------- forcedelete test.db2 forcedelete test.db forcedelete rbu.db2 do_test 1.$i.4 { sqlite3 db test.db sqlite3 db2 test.db2 build_db db build_db db2 sqlite3 rbu2 rbu.db2 build_rbu rbu2 rbu2 close } {} set m1 [db eval {SELECT md5sum(a, b, c) FROM t1}] set m2 [db2 eval {SELECT md5sum(a, b, c) FROM t1}] do_test 1.$i.5 { step_rbu2 $bOpenClose { sqlite3rbu_vacuum r1 test.db } { sqlite3rbu r2 test.db2 rbu.db2 } } {SQLITE_DONE SQLITE_DONE} do_execsql_test -db db 1.$i.6.1 { SELECT md5sum(a, b, c)==$m1 FROM t1 } 1 do_execsql_test -db db2 1.$i.6.2 { SELECT md5sum(a, b, c)==$m2 FROM t1 } 0 do_execsql_test -db db 1.$i.7.1 { PRAGMA integrity_check } ok do_execsql_test -db db2 1.$i.7.2 { PRAGMA integrity_check } ok catch { db close } catch { db2 close } if {$i & 0x01} { sqlite3rbu_destroy_vfs myrbu } } finish_test |