On Thu, 24 Nov 2016 08:54:47 -0500 Richard Hipp <d...@sqlite.org> wrote:
> On 11/24/16, Florian Weimer <fwei...@redhat.com> wrote: > > I'd like to replace the use of Berkeley DB in RPM with SQLite. > > > > The scenario is special in the follow way. There is no database > > server, all access goes directly to the database. Unprivileged > > users without write access to the RPM database are expected to run > > read-only queries against the database. Privileged users > > (basically, root) is expected to use locking to exclude concurrent > > writers. But read-only users should not be able to stop > > acquisition of a write lock. > > > > Is there a way to do this with SQLite? > > The readers can open the database using URI filenames > (https://www.sqlite.org/uri.html) with query parameters "mode=ro" and > "locking=0". That will prevent the readers from blocking the writer. > But, if a write happens in the middle of a read, the reader might see > inconsistent data and report SQLITE_CORRUPT. This is harmless in the > sense that the database file is not really corrupt (the reader is > merely seeing parts of the files from two different points in time) > and subsequent reads should still work. If you are unlucky, a write > that happens at the same time as a read might cause the reader to > return incorrect results, so the reader can never be 100% sure that > the answer it gets back is correct. If writer safely forces a schema change, that's no real change to schema, only an increase to schema_version pragma; the readers can check that condition at sqlite3_step. I don't know how to fire it, and changing directly pragma value is discouraged. > > How important is it to you that the reader always get a correct > answer? > -- > D. Richard Hipp > d...@sqlite.org --- --- Eduardo Morras <emorr...@yahoo.es> _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users