1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-01 06:27:03 +03:00

Add experimental unix-only file-control to grow and truncate the database file by a configurable chunk size.

FossilOrigin-Name: 7cf0e851d4c5e826ea22ed08291b7c91d7b1abc7
This commit is contained in:
dan
2010-07-27 18:34:15 +00:00
parent d2de9f4e68
commit 6e09d69c92
6 changed files with 169 additions and 25 deletions

56
test/fallocate.test Normal file
View File

@ -0,0 +1,56 @@
# 2010 July 28
#
# 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.
#
#***********************************************************************
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
if {$::tcl_platform(platform)!="unix"} {
finish_test
return
}
file_control_chunksize_test db main [expr 1024*1024]
do_test fallocate-1.1 {
execsql {
PRAGMA page_size = 1024;
PRAGMA auto_vacuum = 1;
CREATE TABLE t1(a, b);
}
file size test.db
} [expr 1*1024*1024]
do_test fallocate-1.2 {
execsql { INSERT INTO t1 VALUES(1, zeroblob(1024*900)) }
file size test.db
} [expr 1*1024*1024]
do_test fallocate-1.3 {
execsql { INSERT INTO t1 VALUES(2, zeroblob(1024*900)) }
file size test.db
} [expr 2*1024*1024]
do_test fallocate-1.4 {
execsql { DELETE FROM t1 WHERE a = 1 }
file size test.db
} [expr 1*1024*1024]
do_test fallocate-1.5 {
execsql { DELETE FROM t1 WHERE a = 2 }
file size test.db
} [expr 1*1024*1024]
do_test fallocate-1.6 {
execsql { PRAGMA freelist_count }
} {0}
finish_test