From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur Subject: bug#32234: [PATCH 2/2] database: Serialize all database accesses in a thread. Date: Mon, 27 Aug 2018 15:18:09 +0200 Message-ID: <87a7p8aqy6.fsf@lassieur.org> References: <20180806192736.1747-1-clement@lassieur.org> <20180806192736.1747-2-clement@lassieur.org> <87zhxih2no.fsf@gnu.org> <87lg8tb4rz.fsf@lassieur.org> <20180827144120.13c76371@scratchpost.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47154) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fuHQ9-0002yp-N8 for bug-guix@gnu.org; Mon, 27 Aug 2018 09:19:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fuHQ6-0006d7-Gn for bug-guix@gnu.org; Mon, 27 Aug 2018 09:19:05 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:56897) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fuHQ6-0006cc-CC for bug-guix@gnu.org; Mon, 27 Aug 2018 09:19:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fuHQ6-0004UN-3p for bug-guix@gnu.org; Mon, 27 Aug 2018 09:19:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-reply-to: <20180827144120.13c76371@scratchpost.org> List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Danny Milosavljevic Cc: 32234@debbugs.gnu.org Hi Danny, Danny Milosavljevic writes: > Hi Cl=C3=A9ment, > > in the future I plan on making the actual bin/evaluate use another databa= se connection > in order for the web interface to be isolated while it's querying. I don't understand... bin/evaluate doesn't query the database at all. I don't know why it would need to. > Otherwise - as it is now in master - it can happen that while you are que= rying one > page, half of the things have different values than you requested - which= is really > weird. > > For example right now you could query for a row with status=3D42 and get = back data with > status=3D43 (because it has been changed in the mean time). Could you please show an example that I can reproduce? I don't understand what you mean. > It's better to have serializable transaction isolation to prevent this. = That means > that each connection will have its own worldview that is fixed at the beg= inning of > the connection's transaction. The worldview will update only once a new = transaction > starts. With that patch, database queries are serialized, which means that if query1, query2 and query3 are sent in that order, they will be executed in that order, one after the other. I don't understand why using a different connection would improve things. > Therefore, it would be good for writers to have their own connection in t= he long run > (really, for the readers to have their own connection - but that comes ou= t the same). Currently, there is only one connection that is shared by the writers and readers. Having one 'read connection' and one 'write connection' would be possible and make sense if both of them live in a separate thread and use the SQLite multithreading feature so that writing and reading proceed concurrently. Is that what you mean? Cl=C3=A9ment