WAL mode

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

WAL mode

Niti Agarwal
The databases I'm working with are write ahead logging (WAL) databases.
According to the SQLite documentation, the shm and wal files are supposed
to be deleted upon completion of the program. However, these files are
still there after execution of this program. The documentation says the
files might still be there if the program does not complete cleanly, but
I'm just not seeing that. Any insight?
Thanks,
Niti
_______________________________________________
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 mode

R Smith


On 2017/02/08 7:21 PM, Niti Agarwal wrote:
> The databases I'm working with are write ahead logging (WAL) databases.
> According to the SQLite documentation, the shm and wal files are supposed
> to be deleted upon completion of the program. However, these files are
> still there after execution of this program. The documentation says the
> files might still be there if the program does not complete cleanly, but
> I'm just not seeing that. Any insight?

This might be unrelated to your specific problem and you don't mention
the OS - but I have seen this happen on combinations of Windows
virtualisation and/or Anti-Virus holding open the newly appearing files
for checking so it can't be deleted in a short time-frame. Ensure your
DB is in a non-system-protective folder (such as my documents) and
anti-virus is killed, then try again - if it still happens, we need to
check more.


_______________________________________________
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 mode

Jens Alfke-2
In reply to this post by Niti Agarwal

> On Feb 8, 2017, at 9:21 AM, Niti Agarwal <[hidden email]> wrote:
>
> According to the SQLite documentation, the shm and wal files are supposed
> to be deleted upon completion of the program.

Are you explicitly closing the database before your program exits?
(In other words, I think saying “upon completion of the program” is incorrect; it’s really “upon closing the database”.)

—Jens
_______________________________________________
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 mode

Simon Slavin-3
In reply to this post by Niti Agarwal

On 8 Feb 2017, at 5:21pm, Niti Agarwal <[hidden email]> wrote:

> The databases I'm working with are write ahead logging (WAL) databases.
> According to the SQLite documentation, the shm and wal files are supposed
> to be deleted upon completion of the program. However, these files are
> still there after execution of this program.

Does your program check whether _close() returns an error code ?

Does your program execute sqlite3_shutdown() and check to see whether it returns an error code ?

Simon.
_______________________________________________
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 mode

Jens Alfke-2

> On Feb 8, 2017, at 9:46 AM, Simon Slavin <[hidden email]> wrote:
>
> Does your program execute sqlite3_shutdown() and check to see whether it returns an error code ?

Never noticed that function before … the docs say it’s "designed to aid in process initialization and shutdown on embedded systems. Workstation applications using SQLite normally do not need to invoke either of these routines.”

Are you suggesting calling this just for troubleshooting why the side files don’t get deleted?

—Jens
_______________________________________________
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 mode

Simon Slavin-3

On 8 Feb 2017, at 6:26pm, Jens Alfke <[hidden email]> wrote:

> On Feb 8, 2017, at 9:46 AM, Simon Slavin <[hidden email]> wrote:
>
>> Does your program execute sqlite3_shutdown() and check to see whether it returns an error code ?
>
> Never noticed that function before … the docs say it’s "designed to aid in process initialization and shutdown on embedded systems. Workstation applications using SQLite normally do not need to invoke either of these routines.”
>
> Are you suggesting calling this just for troubleshooting why the side files don’t get deleted?

Right.  Troubleshooting only.

One doesn’t usually bother with _shutdown().  If you’ve closed all your SQLite files correctly then SQLite doesn’t use many resources, and the ones it does use will be correctly released by program termination.  But if closing a file isn’t doing what it should do, trying a 'super-close' might do something interesting.

Simon.
_______________________________________________
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 mode

Niti Agarwal
In reply to this post by Jens Alfke-2
Yes, I am closing the DB before program exits. Like this: db.Close().
I am using Sqlite3 with Golang.
Regards,
Niti

On Wed, Feb 8, 2017 at 11:08 PM, Jens Alfke <[hidden email]> wrote:

>
> > On Feb 8, 2017, at 9:21 AM, Niti Agarwal <[hidden email]> wrote:
> >
> > According to the SQLite documentation, the shm and wal files are supposed
> > to be deleted upon completion of the program.
>
> Are you explicitly closing the database before your program exits?
> (In other words, I think saying “upon completion of the program” is
> incorrect; it’s really “upon closing the database”.)
>
> —Jens
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users