>> I've recently found SQLite doesn't always remove its journal files  
>> anymore.
>>
>> The issue seems to occur when opening WAL databases in read-only mode
>> (i.e. using SQLITE_OPEN_READONLY).
>>
>> A scenario to reproduce this (using version 3.8.11.1) looks like:
>>
>> 1. open a WAL database in read-only mode
>> 2. prepare & finalize a query
>> 3. close the database
>>
>> The "-shm" and "-wal" journal files are created during the prepare() in
>> step 2. But, after step 3, they're both still present.
>
> I am not able to reproduce the observed behavior on either Ubuntu,
> Win7, or Win8.  Please provide additional clues.

Here's a verbatim replay on my Windows 10 machine using the sqlite(3)  
commandline-tool (downloaded-but-renamed from sqlite.org):

=====

c:\prj\demo>dir /b

c:\prj\demo>sqlite test.db
SQLite version 3.8.11.1 2015-07-29 20:00:57
Enter ".help" for usage hints.
sqlite> create table person(name text, email text);
sqlite> pragma journal_mode=wal;
wal
sqlite> .exit

c:\prj\demo>dir /b
test.db

c:\prj\demo>sqlite file:test.db?mode=ro
SQLite version 3.8.11.1 2015-07-29 20:00:57
Enter ".help" for usage hints.
sqlite> .tables
person
sqlite> .exit

c:\prj\demo>dir /b
test.db
test.db-shm
test.db-wal

=====

The used folder is a regular, non-shared folder.

Running the same scenario using the official commandline tool for the  
older version 3.8.10.2 works exactly as expected (i.e. without any journal  
files remaining).

That last bit has me believing this is not related to the virus scanner  
(Windows Defender, btw.), but something must have changed in the SQLite  
code...

Ashwin.

Reply via email to