mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Fix a problem that could cause a spurious SQLITE_NOMEM error when attempting
to resume an RBU operation if the previous client failed right after completing the incremental checkpoint. Also a "cannot vacuum wal db" error that could occur when resuming an RBU vacuum if an error (OOM or IO error) occurs during the incremental checkpoint. FossilOrigin-Name: 681d96eb822e606da53700867191d4738bda20c8
This commit is contained in:
66
ext/rbu/rbufault4.test
Normal file
66
ext/rbu/rbufault4.test
Normal file
@ -0,0 +1,66 @@
|
||||
# 2014 October 22
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
#***********************************************************************
|
||||
#
|
||||
|
||||
if {![info exists testdir]} {
|
||||
set testdir [file join [file dirname [info script]] .. .. test]
|
||||
}
|
||||
source $testdir/tester.tcl
|
||||
source $testdir/malloc_common.tcl
|
||||
set ::testprefix rbufault4
|
||||
|
||||
for {set tn 1} {1} {incr tn} {
|
||||
reset_db
|
||||
do_execsql_test 1.0 {
|
||||
CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c);
|
||||
CREATE INDEX i1b ON t1(b);
|
||||
CREATE INDEX i1c ON t1(c);
|
||||
INSERT INTO t1 VALUES(1, 2, 3);
|
||||
INSERT INTO t1 VALUES(4, 5, 6);
|
||||
}
|
||||
|
||||
forcedelete test.db2
|
||||
sqlite3rbu_vacuum rbu test.db test.db2
|
||||
for {set i 0} {$i < $tn} {incr i} { rbu step }
|
||||
set rc [rbu close]
|
||||
if {$rc!="SQLITE_OK"} {
|
||||
if {$rc!="SQLITE_DONE"} {error $rc}
|
||||
break
|
||||
}
|
||||
faultsim_save
|
||||
|
||||
do_faultsim_test $tn -faults oom-t* -prep {
|
||||
faultsim_restore
|
||||
} -body {
|
||||
sqlite3rbu_vacuum rbu test.db test.db2
|
||||
while 1 {
|
||||
set rc [rbu step]
|
||||
if {$rc=="SQLITE_DONE"} break
|
||||
if {$rc!="SQLITE_OK"} { error $rc }
|
||||
}
|
||||
} -test {
|
||||
catch {rbu close}
|
||||
faultsim_test_result {0 {}} {1 SQLITE_NOMEM} {1 SQLITE_IOERR_NOMEM}
|
||||
|
||||
sqlite3rbu_vacuum rbu test.db test.db2
|
||||
while {[rbu step]=="SQLITE_OK"} {}
|
||||
set trc [rbu close]
|
||||
if {$trc!="SQLITE_DONE"} { error "Got $trc instead of SQLITE_DONE!" }
|
||||
|
||||
set rc [db one {PRAGMA integrity_check}]
|
||||
if {$rc!="ok"} { error "Got $rc instead of ok!" }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
finish_test
|
||||
|
Reference in New Issue
Block a user