Oh, yes, check null size for new database is incorrect in WAL mode. I
replace this script by more simple:
==========================
http://mobigroup.ru/files/test.tcl

#!/usr/bin/tclsh8.5
package require sqlite3

sqlite3 db grow.db
db eval {pragma cache_size=32000}
db eval {pragma journal_mode=WAL}
db eval {PRAGMA synchronous=normal}

db eval {CREATE VIRTUAL TABLE role USING fts3(id INTEGER PRIMARY KEY, uuid
TEXT);}

for {set j 1} {$j<=200} {incr j} {
  puts $j
  db transaction {
    for {set i 0} {$i<100000} {incr i} {
      db eval {insert into role (uuid) values (hex(randomblob(16)))}
    }
  }
}

db close
==========================

After step between 40 and 45 WAL journal starts grow:

$ ls -lh|grep grow
-rw-r--r-- 1 veter veter 358M Июл  7 07:09 grow.db
-rw-r--r-- 1 veter veter  32K Июл  7 07:08 grow.db-shm
-rw-r--r-- 1 veter veter  23M Июл  7 07:09 grow.db-wal
$ ls -lh|grep grow
-rw-r--r-- 1 veter veter 358M Июл  7 07:09 grow.db
-rw-r--r-- 1 veter veter  32K Июл  7 07:08 grow.db-shm
-rw-r--r-- 1 veter veter 105M Июл  7 07:09 grow.db-wal
$ ls -lh|grep grow
-rw-r--r-- 1 veter veter 374M Июл  7 07:09 grow.db
-rw-r--r-- 1 veter veter 256K Июл  7 07:09 grow.db-shm
-rw-r--r-- 1 veter veter 228M Июл  7 07:09 grow.db-wal

There is only single process:

$ ls -lh|grep grow
-rw-r--r-- 1 veter veter 862M Июл  7 07:11 grow.db
-rw-r--r-- 1 veter veter 256K Июл  7 07:10 grow.db-shm
-rw-r--r-- 1 veter veter 254M Июл  7 07:11 grow.db-wal
$ fuser grow.db
grow.db:             16190
$ ps aux|grep 16190|grep -v grep
veter    16190 84.8  3.2 304372 273136 pts/1   Dl+  07:07   3:48
/usr/bin/tclsh8.5 ./test.tcl
$ ls -lh|grep grow
-rw-r--r-- 1 veter veter 862M Июл  7 07:11 grow.db
-rw-r--r-- 1 veter veter 256K Июл  7 07:10 grow.db-shm
-rw-r--r-- 1 veter veter 254M Июл  7 07:11 grow.db-wal

-- 
Best regards, Alexey Pechnikov.
http://pechnikov.tel/
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to