[PATCH] db: use WAL journaling mode for higher concurrency

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Peter Stuge peter at stuge.se
Thu Feb 20 23:52:08 UTC 2014


Alexey Shamrin wrote:
> > > WAL journaling mode is persistent; it stays in effect after closing and
> > > reopening the database. WAL mode database requires SQLite >= 3.7.0.
> > Think about this some more. It's not enough to state dependencies in
> > a commit message, you need to put them in the build system. A patch
> > to do this will need to touch configure.ac, and I think it would be
> > wise to make the requirement optional.
> 
> Is it really needed in this particular case? OpenBSC would continue
> working with SQLite < 3.7.0. It would just ignore `journal_mode = WAL`
> and keep using `DELETE` mode. The only thing that won't work is
> downgrading from newer SQLite to older while keeping the same database
> file. Older SQLite would refuse to open the database that was once
> opened in WAL mode. The file could be downgraded by changing
> journal_mode on it. But only newer SQLite could do it. Do you think
> something must be done about it?

Thanks for explaining in more detail! I do think something more needs
to be done but I'm no longer so sure what I'd prefer..

I think it would be good to have a build-time (configure) option to
explicitly enable WAL journalling and thus also require the newer
SQLite version.

I also think that a version of OpenBSC built without WAL enabled
has to be able to recognize databases created by OpenBSC built *with*
WAL enabled, and tell the user what needs to be done to make the
database work.

Finally, maybe the database version number should also be bumped, to
allow OpenBSC using >=3.7 to know whether a database needs WAL or not.


> > > All credit belongs Ivan Kluchnikov who diagnosed and fixed this issue.
> > Then the commit should list him as author, right?
> 
> As far as I understand, Ivan noticed the problem, opened the database
> with sqlite3 command, entered `PRAGMA journal_mode = WAL` and noticed
> the problem was now gone. Then he told me about it and suggested to
> write a patch. I found where to put this command in OpenBSC source,
> tested that it indeed persists WAL mode in the file, wrote the commit
> message and sent it to mailing list.

Oh ok, yes, then I think you should be the author and actually some
more of the above explanation could easily be in the commit message. :)


//Peter




More information about the OpenBSC mailing list