Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add a test to ensure that "PRAGMA wal_checkpoint = FULL" invokes the busy-handler to wait on read-locks. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
f068fb116286b1dbdee9c168900348cf |
User & Date: | dan 2020-06-30 18:21:45.061 |
Context
2020-07-01
| ||
14:07 | Fix a problem with VM code generated for some aggregate SELECT statements that feature min()/max() aggregates both with and without FILTER clauses. (check-in: 2094da753f user: dan tags: trunk) | |
2020-06-30
| ||
18:21 | Add a test to ensure that "PRAGMA wal_checkpoint = FULL" invokes the busy-handler to wait on read-locks. (check-in: f068fb1162 user: dan tags: trunk) | |
15:32 | Avoid a potential buffer overread in fts3 when processing corrupt records. (check-in: 4d0cfb1236 user: dan tags: trunk) | |
Changes
Changes to test/busy2.test.
︙ | ︙ | |||
45 46 47 48 49 50 51 52 53 54 | do_test 1.$tn.4 { sql2 { COMMIT } } {} } finish_test | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | do_test 1.$tn.4 { sql2 { COMMIT } } {} } #------------------------------------------------------------------------- do_multiclient_test tn { # Make the db a WAL mode db. And add a table and a row to it. Then open # a second connection within process 1. Process 1 now has connections # [db] and [db1.2], process 2 has connection [db2] only. # # Configure all connections to use a 1000 ms timeout. # do_test 2.$tn.0 { sql1 { PRAGMA journal_mode = wal; CREATE TABLE t1(a, b); INSERT INTO t1 VALUES(1, 2); } code2 { db2 timeout 1000 } code1 { sqlite3 db1.2 test.db db1.2 timeout 1000 db timeout 1000 db1.2 eval {SELECT * FROM t1} } } {1 2} # Take a read lock with [db] in process 1. # do_test 2.$tn.1 { sql1 { BEGIN; SELECT * FROM t1; } } {1 2} # Insert a row using [db2] in process 2. Then try a passive checkpoint. # It fails to checkpoint the final frame (due to the readlock taken by # [db]), and returns in less than 250ms. do_test 2.$tn.2 { sql2 { INSERT INTO t1 VALUES(3, 4) } set us [lindex [time { set res [code2 { db2 eval { PRAGMA wal_checkpoint } }] }] 0] list [expr $us < 250000] $res } {1 {0 4 3}} # Now try a FULL checkpoint with [db2]. It returns SQLITE_BUSY. And takes # over 950ms to do so. do_test 2.$tn.3 { set us [lindex [time { set res [code2 { db2 eval { PRAGMA wal_checkpoint = FULL } }] }] 0] list [expr $us > 950000] $res } {1 {1 4 3}} # Passive checkpoint with [db1.2] (process 1). No SQLITE_BUSY, returns # in under 250ms. do_test 2.$tn.4 { set us [lindex [time { set res [code1 { db1.2 eval { PRAGMA wal_checkpoint } }] }] 0] list [expr $us < 250000] $res } {1 {0 4 3}} # Full checkpoint with [db1.2] (process 1). SQLITE_BUSY returned in # a bit over 950ms. do_test 2.$tn.5 { set us [lindex [time { set res [code1 { db1.2 eval { PRAGMA wal_checkpoint = FULL } }] }] 0] list [expr $us > 950000] $res } {1 {1 4 3}} code1 { db1.2 close } } finish_test |