SQLite Forum

WAL/SHM files do not get deleted with ReadOnly flag
Login

WAL/SHM files do not get deleted with ReadOnly flag

(1.1) Originally by Vladimir (I-Vladimir) with edits by Richard Hipp (drh) on 2021-09-08 13:47:31 from 1.0 [source]

Hi,
Open/Close ReadWrite - wal file deleted.
Open/Close ReadOnly  - wal/shm files retained.
Is that by design?
Thanks

(2) By Simon Slavin (slavin) on 2021-09-08 18:11:01 in reply to 1.1 [link] [source]

The 'ReadOnly' status tells SQLite that it should not make any changes.

(3) By Vladimir (I-Vladimir) on 2021-09-08 19:52:39 in reply to 2 [link] [source]

I agree, but with ReadWrite FullMitex option set, wal file get created and deleted with Close, while ReadOnly close doesn't delete it leaving impression that there still open connection.

(4) By Keith Medcalf (kmedcalf) on 2021-09-08 21:37:54 in reply to 3 [link] [source]

That would be a mistaken impression. It would be perspicacious to keep track of whether a connection is open or not directly rather than by relying on magical signals from the gods.

Sometimes when a connection is closed it is sunny out, sometimes it is not. Whether or not the sun is shining (like testing whether or not the WAL file exists) is not a recommended way to tell if a connection is open.