This is something changed in SQLITE itself.  These tests are on Windows 10 
using the current MinGW compiler with the same configuration and windows 
headers.

For the current head of trunk:

2015-08-15 12:17:05 [D:\Temp]
>type test.sql

pragma journal_mode=wal;
pragma journal_mode;
create table test(test);
insert into test values (1),(2),(3);
select * from test;

2015-08-15 12:17:08 [D:\Temp]
>type test.py

import apsw

cn = apsw.Connection('test.db', apsw.SQLITE_OPEN_READONLY)
print cn.cursor().execute('select * from test').fetchall()
cn.close()

2015-08-15 12:17:16 [D:\Temp]
>type test2.py

import apsw

cn = apsw.Connection('test.db')
print cn.cursor().execute('select * from test').fetchall()
cn.close()

2015-08-15 12:17:20 [D:\Temp]
>dir
2015-08-15  12:11               151 test.py
2015-08-15  12:12               137 test.sql
2015-08-15  12:16               124 test2.py
               3 File(s)            412 bytes

2015-08-15 12:17:25 [D:\Temp]
>sqlite test.db < test.sql
wal
wal
1
2
3

2015-08-15 12:17:37 [D:\Temp]
>dir
2015-08-15  12:17             8,192 test.db
2015-08-15  12:11               151 test.py
2015-08-15  12:12               137 test.sql
2015-08-15  12:16               124 test2.py

2015-08-15 12:17:39 [D:\Temp]
>test.py
[(1,), (2,), (3,)]

2015-08-15 12:17:43 [D:\Temp]
>dir
2015-08-15  12:17             8,192 test.db
2015-08-15  12:17            32,768 test.db-shm
2015-08-15  12:17                 0 test.db-wal
2015-08-15  12:11               151 test.py
2015-08-15  12:12               137 test.sql
2015-08-15  12:16               124 test2.py

2015-08-15 12:17:45 [D:\Temp]
>test2.py
[(1,), (2,), (3,)]

2015-08-15 12:17:49 [D:\Temp]
>dir
2015-08-15  12:17             8,192 test.db
2015-08-15  12:11               151 test.py
2015-08-15  12:12               137 test.sql
2015-08-15  12:16               124 test2.py


For version 3.8.10:

2015-08-15 12:29:12 [D:\Temp]
>sqlite test.db < test.sql
wal
wal
1
2
3

2015-08-15 12:29:23 [D:\Temp]
>dir
2015-08-15  12:29             8,192 test.db
2015-08-15  12:11               151 test.py
2015-08-15  12:12               137 test.sql
2015-08-15  12:16               124 test2.py

2015-08-15 12:29:24 [D:\Temp]
>test.py
[(1,), (2,), (3,)]

2015-08-15 12:29:36 [D:\Temp]
>dir
2015-08-15  12:29             8,192 test.db
2015-08-15  12:11               151 test.py
2015-08-15  12:12               137 test.sql
2015-08-15  12:16               124 test2.py

2015-08-15 12:29:37 [D:\Temp]
>test2.py
[(1,), (2,), (3,)]

2015-08-15 12:29:42 [D:\Temp]
>dir
2015-08-15  12:29             8,192 test.db
2015-08-15  12:11               151 test.py
2015-08-15  12:12               137 test.sql
2015-08-15  12:16               124 test2.py


> -----Original Message-----
> From: sqlite-users-bounces at mailinglists.sqlite.org [mailto:sqlite-users-
> bounces at mailinglists.sqlite.org] On Behalf Of R.Smith
> Sent: Saturday, 15 August, 2015 11:59
> To: sqlite-users at mailinglists.sqlite.org
> Subject: Re: [sqlite] journal files not always removed
> 
> Also, make sure that folder is not a shared resource or inside a shared
> resource that is visible from any other network node or machine.
> 
> This piece, describing the same symptom for Internet Explorer temporary
> files, may help:
> https://support.microsoft.com/en-us/kb/814782
> 
> What happens when you make the DB, set WAL mode, do a Query, then wait 2
> minutes doing nothing, then close the DB. Do the temp files still loiter?
> 
> 
> On 2015-08-15 07:28 PM, Ashwin Hirschi wrote:
> >
> > Hello,
> >
> > 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.
> >
> > If the database is opened in read-write mode, everything is fine.
> > Lastly, I'm having the issue on a Windows 10 machine and am not
> > currently able to test anywhere else...
> >
> > So, can anyone else reproduce the above scenario?
> >
> > Ashwin.
> >
> > P.S. I've also checked some older SQLite versions. It looks like this
> > unfortunate "non-cleanup" was introduced in 3.8.11.
> > _______________________________________________
> > sqlite-users mailing list
> > sqlite-users at mailinglists.sqlite.org
> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> 
> _______________________________________________
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



Reply via email to