blob: 685555366ed697d4597f8218930b2b8a2a5d6157 [file] [log] [blame]
drh9a477362007-08-10 19:46:43 +00001# 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#
danielk19771bc71592008-07-08 17:13:59 +000016# $Id: softheap1.test,v 1.5 2008/07/08 17:13:59 danielk1977 Exp $
drh9a477362007-08-10 19:46:43 +000017
18
19set testdir [file dirname $argv0]
20source $testdir/tester.tcl
21
danielk19774152e672007-09-12 17:01:45 +000022ifcapable !integrityck {
23 finish_test
24 return
25}
26
drh91fd4d42008-01-19 20:11:25 +000027sqlite3_soft_heap_limit -1
28sqlite3_soft_heap_limit 0
drh9a477362007-08-10 19:46:43 +000029sqlite3_soft_heap_limit 5000
30do_test softheap1-1.1 {
31 execsql {
32 PRAGMA auto_vacuum=1;
33 CREATE TABLE t1(x);
drh3aefaba2007-08-12 20:07:58 +000034 INSERT INTO t1 VALUES(hex(randomblob(1000)));
drh9a477362007-08-10 19:46:43 +000035 BEGIN;
drh3aefaba2007-08-12 20:07:58 +000036 }
37 execsql {
drh9a477362007-08-10 19:46:43 +000038 CREATE TABLE t2 AS SELECT * FROM t1;
drh3aefaba2007-08-12 20:07:58 +000039 }
40 execsql {
drh9a477362007-08-10 19:46:43 +000041 ROLLBACK;
drh3aefaba2007-08-12 20:07:58 +000042 }
43 execsql {
drh9a477362007-08-10 19:46:43 +000044 PRAGMA integrity_check;
45 }
46} {ok}
danielk19771bc71592008-07-08 17:13:59 +000047
danc1a60c52010-06-07 14:28:16 +000048sqlite3_soft_heap_limit $cmdlinearg(soft-heap-limit)
drh9a477362007-08-10 19:46:43 +000049finish_test