Sašo Kiselkov
2013-04-24 12:28:32 UTC
I'm running into I/O errors when trying to access a sqlite3 database
which is using WAL from my app. While using journal_mode=delete,
everything is fine, but as soon as I switch over to journal_mode=wal, I
just get a load of I/O errors on any query, regardless if it is a SELECT
or UPDATE/INSERT.
All SQLite ops take place in a separate thread to prevent blocking the
main app thread (which is doing network io). The local filesystem where
database lives is ZFS (which has mmap support) on a recent build of
OpenIndiana (an OpenSolaris-derivative). I've downloaded the latest
stable SQLite release and compiled that with the default flags (which
has threading enabled, IIRC).
My SQL flow is as follows (this is my app creating a new DB and
populating it with its tables):
<open empty new database>
PRAMA journal_mode=WAL
BEGIN
DROP TABLE IF EXISTS `version` <- [I/O error]
After this the database looks like this:
-rw-r--r-- 1 root root 1.0K 2013-04-24 14:21 block.db
-rw-r--r-- 1 root root 0 2013-04-24 14:21 block.db-shm
-rw-r--r-- 1 root root 0 2013-04-24 14:21 block.db-wal
Strangely enough, working on the database through the sqlite3
command-line tool works just fine. Is there some magic of sqlite API
calls that needs to be executed to support WAL databases? Unfortunately,
my Google searched turned up dry so far...
Cheers,
--
Saso
which is using WAL from my app. While using journal_mode=delete,
everything is fine, but as soon as I switch over to journal_mode=wal, I
just get a load of I/O errors on any query, regardless if it is a SELECT
or UPDATE/INSERT.
All SQLite ops take place in a separate thread to prevent blocking the
main app thread (which is doing network io). The local filesystem where
database lives is ZFS (which has mmap support) on a recent build of
OpenIndiana (an OpenSolaris-derivative). I've downloaded the latest
stable SQLite release and compiled that with the default flags (which
has threading enabled, IIRC).
My SQL flow is as follows (this is my app creating a new DB and
populating it with its tables):
<open empty new database>
PRAMA journal_mode=WAL
BEGIN
DROP TABLE IF EXISTS `version` <- [I/O error]
After this the database looks like this:
-rw-r--r-- 1 root root 1.0K 2013-04-24 14:21 block.db
-rw-r--r-- 1 root root 0 2013-04-24 14:21 block.db-shm
-rw-r--r-- 1 root root 0 2013-04-24 14:21 block.db-wal
Strangely enough, working on the database through the sqlite3
command-line tool works just fine. Is there some magic of sqlite API
calls that needs to be executed to support WAL databases? Unfortunately,
my Google searched turned up dry so far...
Cheers,
--
Saso