drh | 9a47736 | 2007-08-10 19:46:43 +0000 | [diff] [blame] | 1 | # 2007 Aug 10 |
| 2 | # |
| 3 | # The author disclaims copyright to this source code. In place of |
| 4 | # a legal notice, here is a blessing: |
| 5 | # |
| 6 | # May you do good and not evil. |
| 7 | # May you find forgiveness for yourself and forgive others. |
| 8 | # May you share freely, never taking more than you give. |
| 9 | # |
| 10 | #*********************************************************************** |
| 11 | # |
| 12 | # This test script reproduces the problem reported by ticket #2565, |
| 13 | # A database corruption bug that occurs in auto_vacuum mode when |
| 14 | # the soft_heap_limit is set low enough to be triggered. |
| 15 | # |
danielk1977 | 1bc7159 | 2008-07-08 17:13:59 +0000 | [diff] [blame] | 16 | # $Id: softheap1.test,v 1.5 2008/07/08 17:13:59 danielk1977 Exp $ |
drh | 9a47736 | 2007-08-10 19:46:43 +0000 | [diff] [blame] | 17 | |
| 18 | |
| 19 | set testdir [file dirname $argv0] |
| 20 | source $testdir/tester.tcl |
| 21 | |
danielk1977 | 4152e67 | 2007-09-12 17:01:45 +0000 | [diff] [blame] | 22 | ifcapable !integrityck { |
| 23 | finish_test |
| 24 | return |
| 25 | } |
| 26 | |
drh | 91fd4d4 | 2008-01-19 20:11:25 +0000 | [diff] [blame] | 27 | sqlite3_soft_heap_limit -1 |
| 28 | sqlite3_soft_heap_limit 0 |
drh | 9a47736 | 2007-08-10 19:46:43 +0000 | [diff] [blame] | 29 | sqlite3_soft_heap_limit 5000 |
| 30 | do_test softheap1-1.1 { |
| 31 | execsql { |
| 32 | PRAGMA auto_vacuum=1; |
| 33 | CREATE TABLE t1(x); |
drh | 3aefaba | 2007-08-12 20:07:58 +0000 | [diff] [blame] | 34 | INSERT INTO t1 VALUES(hex(randomblob(1000))); |
drh | 9a47736 | 2007-08-10 19:46:43 +0000 | [diff] [blame] | 35 | BEGIN; |
drh | 3aefaba | 2007-08-12 20:07:58 +0000 | [diff] [blame] | 36 | } |
| 37 | execsql { |
drh | 9a47736 | 2007-08-10 19:46:43 +0000 | [diff] [blame] | 38 | CREATE TABLE t2 AS SELECT * FROM t1; |
drh | 3aefaba | 2007-08-12 20:07:58 +0000 | [diff] [blame] | 39 | } |
| 40 | execsql { |
drh | 9a47736 | 2007-08-10 19:46:43 +0000 | [diff] [blame] | 41 | ROLLBACK; |
drh | 3aefaba | 2007-08-12 20:07:58 +0000 | [diff] [blame] | 42 | } |
| 43 | execsql { |
drh | 9a47736 | 2007-08-10 19:46:43 +0000 | [diff] [blame] | 44 | PRAGMA integrity_check; |
| 45 | } |
| 46 | } {ok} |
danielk1977 | 1bc7159 | 2008-07-08 17:13:59 +0000 | [diff] [blame] | 47 | |
dan | c1a60c5 | 2010-06-07 14:28:16 +0000 | [diff] [blame] | 48 | sqlite3_soft_heap_limit $cmdlinearg(soft-heap-limit) |
drh | 9a47736 | 2007-08-10 19:46:43 +0000 | [diff] [blame] | 49 | finish_test |