Preserve file descriptors for journal files

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

Preserve file descriptors for journal files

krimskrams
Hi,

we currently switched from a simple file back-end to SQLite in our
application (no threads, single process) and use the following
settings:

sqlite3_config(SQLITE_CONFIG_SINGLETHREAD)
sqlite3_enable_shared_cache(0)
PRAGMA synchronous = OFF
PRAGMA journal_mode = TRUNCATE

It is quite common that the systems we use run out of file
descriptors. This is perfectly fine¹ and we could deal with this. With
SQLite we have the issue that it constantly re-opens the journal file
instead of keeping the file descriptor. Of course, when there are no
file descriptors left it can't open the journal file and fails. Is
there an option we missed? We're not sure how to fix this without
implementing a VFS.


Kind regards,

Frank

¹ just take it for granted, needs not to be fixed
_______________________________________________
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: Preserve file descriptors for journal files

Richard Hipp-3
On 7/4/19, [hidden email] <[hidden email]> wrote:

> Hi,
>
> we currently switched from a simple file back-end to SQLite in our
> application (no threads, single process) and use the following
> settings:
>
> sqlite3_config(SQLITE_CONFIG_SINGLETHREAD)
> sqlite3_enable_shared_cache(0)
> PRAGMA synchronous = OFF
> PRAGMA journal_mode = TRUNCATE
>
> It is quite common that the systems we use run out of file
> descriptors. This is perfectly fine¹ and we could deal with this. With
> SQLite we have the issue that it constantly re-opens the journal file
> instead of keeping the file descriptor. Of course, when there are no
> file descriptors left it can't open the journal file and fails. Is
> there an option we missed? We're not sure how to fix this without
> implementing a VFS.

Have you tried

    PRAGMA journal_mode=WAL;

Does your application have exclusive access to the database file?  If
so, then consider:

    PRAGMA locking_mode=EXCLUSIVE;

--
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: Preserve file descriptors for journal files

krimskrams
Hi,


On Sun, 7 Jul 2019 05:38:30 -0400

> Have you tried
>
>     PRAGMA journal_mode=WAL;
>
> Does your application have exclusive access to the database file?  If
> so, then consider:
>
>     PRAGMA locking_mode=EXCLUSIVE;

both options seem to work although the second one is not an option for
us. Thanks a lot!


Kind regards,

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