-wal and -shm files left behind by libsqlite3.dylib

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

-wal and -shm files left behind by libsqlite3.dylib

Carsten Müncheberg-2
When loading and using /usr/lib/libsqlite3.dylib (3.19.3) which is shipped
with MacOS 10.13.6 I noticed that the -wal and -shm files are not deleted
when closing the last connection to a database. I tested this with the
sqlite3 command line tool. It does not happen when I compile and link
SQLite myself.

Is this expected behavior or some kind of bug?

Carsten
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: -wal and -shm files left behind by libsqlite3.dylib

Richard Hipp-3
On 1/28/19, Carsten Müncheberg <[hidden email]> wrote:
> When loading and using /usr/lib/libsqlite3.dylib (3.19.3) which is shipped
> with MacOS 10.13.6 I noticed that the -wal and -shm files are not deleted
> when closing the last connection to a database. I tested this with the
> sqlite3 command line tool. It does not happen when I compile and link
> SQLite myself.
>
> Is this expected behavior or some kind of bug?

My guess is that Apple is enabling persistent WAL mode
(https://www.sqlite.org/c3ref/c_fcntl_begin_atomic_write.html#sqlitefcntlpersistwal)
by default on their build of the SQLite library.

--
D. Richard Hipp
[hidden email]
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: -wal and -shm files left behind by libsqlite3.dylib

Carsten Müncheberg-2
Am Mo., 28. Jan. 2019 um 20:01 Uhr schrieb Richard Hipp <[hidden email]>:

> On 1/28/19, Carsten Müncheberg <[hidden email]> wrote:
> > When loading and using /usr/lib/libsqlite3.dylib (3.19.3) which is
> shipped
> > with MacOS 10.13.6 I noticed that the -wal and -shm files are not deleted
> > when closing the last connection to a database. I tested this with the
> > sqlite3 command line tool. It does not happen when I compile and link
> > SQLite myself.
> >
> > Is this expected behavior or some kind of bug?
>
> My guess is that Apple is enabling persistent WAL mode
> (
> https://www.sqlite.org/c3ref/c_fcntl_begin_atomic_write.html#sqlitefcntlpersistwal
> )
> by default on their build of the SQLite library.
>

Must be it, thanks for the swift reply.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: -wal and -shm files left behind by libsqlite3.dylib

Scott Perry
In reply to this post by Carsten Müncheberg-2
This is expected behaviour. As Richard guessed, the system libsqlite3.dylib is built with SQLITE_ENABLE_PERSIST_WAL. For Darwin systems, the compromise of keeping the extra 4MiB (max) file around is generally worth the reduced I/O overhead that results from creating, resizing, and unlinking files.

If you need, you can still override this behaviour using the SQLITE_FCNTL_PERSIST_WAL opcode to the sqlite3_file_control() interface.

Scott


On Jan 28, 2019, at 10:32, Carsten Müncheberg <[hidden email]> wrote:

>
> When loading and using /usr/lib/libsqlite3.dylib (3.19.3) which is shipped
> with MacOS 10.13.6 I noticed that the -wal and -shm files are not deleted
> when closing the last connection to a database. I tested this with the
> sqlite3 command line tool. It does not happen when I compile and link
> SQLite myself.
>
> Is this expected behavior or some kind of bug?
>
> Carsten

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users