]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add test file incrvacuum3.test. No code changes. incr-vacuum-opt
authordan <dan@noemail.net>
Mon, 25 Feb 2013 12:06:55 +0000 (12:06 +0000)
committerdan <dan@noemail.net>
Mon, 25 Feb 2013 12:06:55 +0000 (12:06 +0000)
FossilOrigin-Name: bf57534188e044fb341315bfc05b7927e66a04e0

manifest
manifest.uuid
test/incrvacuum3.test [new file with mode: 0644]

index cf75f0f4f97f9a7d21ca0aeea9c6db307408df39..f11324d902b5057a38de731e9f1815485c7b1b7b 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Catch\sa\sdropped\serror\scode\sin\sbackup.c.
-D 2013-02-25T07:12:40.512
+C Add\stest\sfile\sincrvacuum3.test.\sNo\scode\schanges.
+D 2013-02-25T12:06:55.032
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in a48faa9e7dd7d556d84f5456eabe5825dd8a6282
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -534,6 +534,7 @@ F test/incrblob_err.test d2562d2771ebffd4b3af89ef64c140dd44371597
 F test/incrblobfault.test 917c0292224c64a56ef7215fd633a3a82f805be0
 F test/incrvacuum.test d2a6ddf5e429720b5fe502766af747915ccf6c32
 F test/incrvacuum2.test 379eeb8740b0ef60c372c439ad4cbea20b34bb9b
+F test/incrvacuum3.test 1159ec2b3e7bafbde5718867bc7328ba58863313
 F test/incrvacuum_ioerr.test 293f2714571255539c8c789da2f7de4ec3f7101e
 F test/index.test b5429732b3b983fa810e3ac867d7ca85dae35097
 F test/index2.test ee83c6b5e3173a3d7137140d945d9a5d4fdfb9d6
@@ -1034,7 +1035,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
 F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
-P ba33bb059ed4f4547da2880dbc8bd827c06fae34
-R 2d999113323b8a278783fe6edad2f381
+P ac8ca3ecee4d81bf522b330033e5d85638063670
+R 4eb400824b32ad5749b8b0c556f7d2a9
 U dan
-Z 36585c74ecb2f209e8dc6af8304c9567
+Z 4b0cde4b14de44a514d78f31b4dd5809
index 1e72101c48925942542a41430f90d55e2fcb8e4f..3341d99e0ae6bbf485e54618fe5ae4c33453a28d 100644 (file)
@@ -1 +1 @@
-ac8ca3ecee4d81bf522b330033e5d85638063670
\ No newline at end of file
+bf57534188e044fb341315bfc05b7927e66a04e0
\ No newline at end of file
diff --git a/test/incrvacuum3.test b/test/incrvacuum3.test
new file mode 100644 (file)
index 0000000..ed2d471
--- /dev/null
@@ -0,0 +1,137 @@
+# 2013 Feb 25
+#
+# 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 implements regression tests for the SQLite library, focusing
+# on the incremental vacuum feature.
+#
+# The tests in this file were added at the same time as optimizations 
+# were made to:
+#
+#   * Truncate the database after a rollback mode commit, and
+#
+#   * Avoid moving pages to locations from which they may need to be moved
+#     a second time if an incremental-vacuum proccess is allowed to vacuum
+#     the entire database.
+#
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+set testprefix incrvacuum3
+
+# If this build of the library does not support auto-vacuum, omit this
+# whole file.
+ifcapable {!autovacuum || !pragma} {
+  finish_test
+  return
+}
+
+proc check_on_disk {} {
+
+  # Copy the files for database "test.db" to "test2.db".
+  forcedelete test2.db test2.db-journal test2.db-wal
+  forcecopy test.db test2.db
+  if {[file exists test.db-journal]} { 
+    forcecopy test.db-journal test2.db-journal 
+  }
+  if {[file exists test.db-wal]} { 
+    forcecopy test.db-wal test2.db-wal 
+  }
+
+  # Open "test2.db" and check it is Ok.
+  sqlite3 dbcheck test2.db
+  set ret [dbcheck eval { PRAGMA integrity_check }]
+  dbcheck close
+  set ret
+}
+
+# Run these tests once in rollback journal mode, and once in wal mode.
+#
+foreach {T jrnl_mode} {
+  1 delete
+  2 wal
+} {
+  catch { db close }
+  forcedelete test.db test.db-journal test.db-wal
+  sqlite3 db test.db
+  db eval {
+    PRAGMA cache_size = 5;
+    PRAGMA page_size = 1024;
+    PRAGMA auto_vacuum = 2;
+  }
+  db eval "PRAGMA journal_mode = $jrnl_mode"
+  
+  foreach {tn sql} {
+    1 {
+      CREATE TABLE t1(x UNIQUE);
+      INSERT INTO t1 VALUES(randomblob(400));
+      INSERT INTO t1 VALUES(randomblob(400));
+      INSERT INTO t1 SELECT randomblob(400) FROM t1;    --   4
+      INSERT INTO t1 SELECT randomblob(400) FROM t1;    --   8
+      INSERT INTO t1 SELECT randomblob(400) FROM t1;    --  16
+      INSERT INTO t1 SELECT randomblob(400) FROM t1;    --  32
+      INSERT INTO t1 SELECT randomblob(400) FROM t1;    --  64
+      INSERT INTO t1 SELECT randomblob(400) FROM t1;    -- 128
+      INSERT INTO t1 SELECT randomblob(400) FROM t1;    -- 256
+    }
+  
+    2 {
+      DELETE FROM t1 WHERE rowid%8;
+    }
+  
+    3 { 
+      BEGIN;
+        PRAGMA incremental_vacuum = 100;
+        INSERT INTO t1 SELECT randomblob(400) FROM t1;    --  64
+        INSERT INTO t1 SELECT randomblob(400) FROM t1;    -- 128
+        INSERT INTO t1 SELECT randomblob(400) FROM t1;    -- 256
+      ROLLBACK;
+    }
+  
+    4 { 
+      BEGIN;
+        SAVEPOINT one;
+          PRAGMA incremental_vacuum = 100;
+          SAVEPOINT two;
+            INSERT INTO t1 SELECT randomblob(400) FROM t1;    --  64
+            INSERT INTO t1 SELECT randomblob(400) FROM t1;    -- 128
+            INSERT INTO t1 SELECT randomblob(400) FROM t1;    -- 256
+    }
+  
+    5 {   ROLLBACK to two }
+  
+    6 { ROLLBACK to one }
+  
+    7 { 
+        INSERT INTO t1 SELECT randomblob(400) FROM t1;    --  64
+        PRAGMA incremental_vacuum = 1000;
+        INSERT INTO t1 SELECT randomblob(400) FROM t1;    -- 128
+        INSERT INTO t1 SELECT randomblob(400) FROM t1;    -- 256
+      ROLLBACK;
+    }
+  
+    8 { 
+      BEGIN;
+        INSERT INTO t1 SELECT randomblob(400) FROM t1;    --  64
+        PRAGMA incremental_vacuum = 1000;
+        INSERT INTO t1 SELECT randomblob(400) FROM t1;    --  128
+      COMMIT;
+    }
+  } {
+    do_execsql_test $T.1.$tn.1 $sql
+    do_execsql_test $T.1.$tn.2 {PRAGMA integrity_check} ok
+    do_test         $T.1.$tn.3 { check_on_disk }        ok
+  }
+
+  do_execsql_test $T.1.x.1 { PRAGMA freelist_count   } 0
+  do_execsql_test $T.1.x.2 { SELECT count(*) FROM t1 } 128
+}
+
+finish_test
+