diff options
author | Hans-Christoph Steiner <hans@eds.org> | 2012-09-20 18:34:42 -0400 |
---|---|---|
committer | Hans-Christoph Steiner <hans@eds.org> | 2012-09-20 18:34:42 -0400 |
commit | 734b4f890763e4efafe865ba476c43cc8d1a2214 (patch) | |
tree | d561d2fad0788619f4b8e230073f6af1d416934e /test/walpersist.test | |
parent | 396b08286e7bb56e0e6440aaf1345c18e72ee22e (diff) | |
parent | 487e15dc239ccdb3344d1c99ce120e872bab4a74 (diff) |
Merge tag 'upstream/2.0.6'
Upstream version 2.0.6
Diffstat (limited to 'test/walpersist.test')
-rw-r--r-- | test/walpersist.test | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/test/walpersist.test b/test/walpersist.test index 175dcbf..692728d 100644 --- a/test/walpersist.test +++ b/test/walpersist.test @@ -67,7 +67,60 @@ do_test walpersist-1.11 { list [file exists test.db] [file exists test.db-wal] [file exists test.db-shm] } {1 1 1} - +# Make sure the journal_size_limit works to limit the size of the +# persisted wal file. In persistent-wal mode, any non-negative +# journal_size_limit causes the WAL file to be truncated to zero bytes +# when closing. +# +forcedelete test.db test.db-shm test.db-wal +do_test walpersist-2.1 { + sqlite3 db test.db + db eval { + PRAGMA journal_mode=WAL; + PRAGMA wal_autocheckpoint=OFF; + PRAGMA journal_size_limit=12000; + CREATE TABLE t1(x); + INSERT INTO t1 VALUES(randomblob(50000)); + UPDATE t1 SET x=randomblob(50000); + } + expr {[file size test.db-wal]>100000} +} {1} +do_test walpersist-2.2 { + file_control_persist_wal db 1 + db close + concat [file exists test.db-wal] [file size test.db-wal] +} {1 0} +do_test walpersist-2.3 { + sqlite3 db test.db + execsql { PRAGMA integrity_check } +} {ok} +do_test 3.1 { + catch {db close} + forcedelete test.db test.db-shm test.db-wal + sqlite3 db test.db + execsql { + PRAGMA page_size = 1024; + PRAGMA journal_mode = WAL; + PRAGMA wal_autocheckpoint=128; + PRAGMA journal_size_limit=16384; + CREATE TABLE t1(a, b, PRIMARY KEY(a, b)); + } +} {wal 128 16384} +do_test 3.2 { + for {set i 0} {$i<200} {incr i} { + execsql { INSERT INTO t1 VALUES(randomblob(500), randomblob(500)) } + } + file_control_persist_wal db 1 + db close +} {} +do_test walpersist-3.3 { + file size test.db-wal +} {0} +do_test walpersist-3.4 { + sqlite3 db test.db + execsql { PRAGMA integrity_check } +} {ok} + finish_test |