Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix an issue preventing RBU vacuum from working with virtual tables. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
3bd85fa5a9a489fd505c973e37c33a76 |
User & Date: | dan 2016-06-01 10:37:50.553 |
Context
2016-06-03
| ||
13:35 | Enhance the sqlite3_load_extension() interface to permit extensions to return SQLITE_OK_LOAD_PERMANENTLY which will prevents unloading when the database connection closes. (check-in: 5908aa4dc5 user: drh tags: trunk) | |
2016-06-01
| ||
10:37 | Fix an issue preventing RBU vacuum from working with virtual tables. (check-in: 3bd85fa5a9 user: dan tags: trunk) | |
05:02 | Fix compilation issues with the VFS stat extension. (check-in: f6e956525b user: mistachkin tags: trunk) | |
Changes
Changes to ext/rbu/rbu_common.tcl.
︙ | ︙ | |||
31 32 33 34 35 36 37 38 | sqlite3rbu rbu $target $rbu set rc [rbu step] rbu close if {$rc != "SQLITE_OK"} break } set rc } | > > > > > > > > > > > > > > > > > | 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 | sqlite3rbu rbu $target $rbu set rc [rbu step] rbu close if {$rc != "SQLITE_OK"} break } set rc } proc do_rbu_vacuum_test {tn step} { uplevel [list do_test $tn.1 { if {$step==0} { sqlite3rbu_vacuum rbu test.db state.db } while 1 { if {$step==1} { sqlite3rbu_vacuum rbu test.db state.db } set rc [rbu step] if {$rc!="SQLITE_OK"} break if {$step==1} { rbu close } } rbu close } {SQLITE_DONE}] uplevel [list do_execsql_test $tn.2 { PRAGMA integrity_check } ok] } |
Changes to ext/rbu/rbuvacuum.test.
︙ | ︙ | |||
13 14 15 16 17 18 19 | # contains tests to ensure that the sqlite3rbu_vacuum() API works as # expected. # source [file join [file dirname [info script]] rbu_common.tcl] set ::testprefix rbuvacuum | < < < < < < < < < < < < < < < < < | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # contains tests to ensure that the sqlite3rbu_vacuum() API works as # expected. # source [file join [file dirname [info script]] rbu_common.tcl] set ::testprefix rbuvacuum foreach step {0 1} { set ::testprefix rbuvacuum-step=$step reset_db # Simplest possible vacuum. do_execsql_test 1.0 { |
︙ | ︙ | |||
399 400 401 402 403 404 405 | sqlite3_create_collation_v2 $db1 length length_cmp noop sqlite3_create_collation_v2 $db2 length length_cmp noop while {[rbu step]=="SQLITE_OK"} {} list [catch { rbu close } msg] $msg } {0 SQLITE_DONE} | < | 382 383 384 385 386 387 388 389 390 391 392 | sqlite3_create_collation_v2 $db1 length length_cmp noop sqlite3_create_collation_v2 $db2 length length_cmp noop while {[rbu step]=="SQLITE_OK"} {} list [catch { rbu close } msg] $msg } {0 SQLITE_DONE} catch { db close } finish_test |
Added ext/rbu/rbuvacuum2.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 | # 2016 June 1 # # 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 for the RBU module. More specifically, it # contains tests to ensure that the sqlite3rbu_vacuum() API works as # expected. # source [file join [file dirname [info script]] rbu_common.tcl] foreach step {0 1} { set ::testprefix rbuvacuum2-$step #------------------------------------------------------------------------- # Test that a database that contains fts3 tables can be vacuumed. # ifcapable fts3 { reset_db do_execsql_test 1.1 { CREATE VIRTUAL TABLE t1 USING fts3(z, y); INSERT INTO t1 VALUES('fix this issue', 'at some point'); } do_rbu_vacuum_test 1.2 $step do_execsql_test 1.3 { SELECT * FROM t1; } {{fix this issue} {at some point}} do_execsql_test 1.4 { SELECT rowid FROM t1 WHERE t1 MATCH 'fix'; } {1} do_execsql_test 1.5 { INSERT INTO t1 VALUES('a b c', 'd e f'); INSERT INTO t1 VALUES('l h i', 'd e f'); DELETE FROM t1 WHERE docid = 2; INSERT INTO t1 VALUES('a b c', 'x y z'); } do_rbu_vacuum_test 1.6 $step do_execsql_test 1.7 { INSERT INTO t1(t1) VALUES('integrity-check'); SELECT * FROM t1; } { {fix this issue} {at some point} {l h i} {d e f} {a b c} {x y z} } } #------------------------------------------------------------------------- # Test that a database that contains fts5 tables can be vacuumed. # ifcapable fts5 { reset_db do_execsql_test 2.1 { CREATE VIRTUAL TABLE t1 USING fts5(z, y); INSERT INTO t1 VALUES('fix this issue', 'at some point'); } do_rbu_vacuum_test 2.2 $step do_execsql_test 2.3 { SELECT * FROM t1; } {{fix this issue} {at some point}} do_execsql_test 2.4 { SELECT rowid FROM t1 ('fix'); } {1} do_execsql_test 2.5 { INSERT INTO t1 VALUES('a b c', 'd e f'); INSERT INTO t1 VALUES('l h i', 'd e f'); DELETE FROM t1 WHERE rowid = 2; INSERT INTO t1 VALUES('a b c', 'x y z'); } do_rbu_vacuum_test 2.6 $step do_execsql_test 2.7 { INSERT INTO t1(t1) VALUES('integrity-check'); SELECT * FROM t1; } { {fix this issue} {at some point} {l h i} {d e f} {a b c} {x y z} } } #------------------------------------------------------------------------- # Test that a database that contains an rtree table can be vacuumed. # ifcapable rtree { reset_db do_execsql_test 3.1 { CREATE VIRTUAL TABLE rt USING rtree(id, x1, x2); INSERT INTO rt VALUES(1, 45, 55); INSERT INTO rt VALUES(2, 50, 60); INSERT INTO rt VALUES(3, 55, 65); } do_rbu_vacuum_test 3.2 $step do_execsql_test 3.3 { SELECT * FROM rt; } {1 45.0 55.0 2 50.0 60.0 3 55.0 65.0} do_execsql_test 3.4.1 { SELECT rowid FROM rt WHERE x2>51 AND x1 < 51 } {1 2} do_execsql_test 3.4.2 { SELECT rowid FROM rt WHERE x2>59 AND x1 < 59 } {2 3} do_rbu_vacuum_test 3.5 $step do_execsql_test 3.6.1 { SELECT rowid FROM rt WHERE x2>51 AND x1 < 51 } {1 2} do_execsql_test 3.6.2 { SELECT rowid FROM rt WHERE x2>59 AND x1 < 59 } {2 3} } ifcapable trigger { reset_db do_execsql_test 4.1 { CREATE TABLE t1(a, b, c); INSERT INTO t1 VALUES(1, 2, 3); CREATE VIEW v1 AS SELECT * FROM t1; CREATE TRIGGER tr1 AFTER INSERT ON t1 BEGIN SELECT 1; END; } do_execsql_test 4.2 { SELECT * FROM sqlite_master; } { table t1 t1 2 {CREATE TABLE t1(a, b, c)} view v1 v1 0 {CREATE VIEW v1 AS SELECT * FROM t1} trigger tr1 t1 0 {CREATE TRIGGER tr1 AFTER INSERT ON t1 BEGIN SELECT 1; END} } do_rbu_vacuum_test 4.3 $step do_execsql_test 4.4 { SELECT * FROM sqlite_master; } { table t1 t1 2 {CREATE TABLE t1(a, b, c)} view v1 v1 0 {CREATE VIEW v1 AS SELECT * FROM t1} trigger tr1 t1 0 {CREATE TRIGGER tr1 AFTER INSERT ON t1 BEGIN SELECT 1; END} } } } finish_test |
Changes to ext/rbu/sqlite3rbu.c.
︙ | ︙ | |||
917 918 919 920 921 922 923 | ** left in the RBU handle passed as the first argument. A copy of the ** error code is returned. */ static int rbuObjIterFirst(sqlite3rbu *p, RbuObjIter *pIter){ int rc; memset(pIter, 0, sizeof(RbuObjIter)); | | > > < > | 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 | ** left in the RBU handle passed as the first argument. A copy of the ** error code is returned. */ static int rbuObjIterFirst(sqlite3rbu *p, RbuObjIter *pIter){ int rc; memset(pIter, 0, sizeof(RbuObjIter)); rc = prepareFreeAndCollectError(p->dbRbu, &pIter->pTblIter, &p->zErrmsg, sqlite3_mprintf( "SELECT rbu_target_name(name, type='view') AS target, name " "FROM sqlite_master " "WHERE type IN ('table', 'view') AND target IS NOT NULL " " %s " "ORDER BY name" , rbuIsVacuum(p) ? "AND rootpage!=0 AND rootpage IS NOT NULL" : "")); if( rc==SQLITE_OK ){ rc = prepareAndCollectError(p->dbMain, &pIter->pIdxIter, &p->zErrmsg, "SELECT name, rootpage, sql IS NULL OR substr(8, 6)=='UNIQUE' " " FROM main.sqlite_master " " WHERE type='index' AND tbl_name = ?" ); |
︙ | ︙ |