From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40894) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fg6bQ-0008DZ-Fa for guix-patches@gnu.org; Thu, 19 Jul 2018 06:56:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fg6bK-0006RF-LC for guix-patches@gnu.org; Thu, 19 Jul 2018 06:56:08 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:42530) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fg6bK-0006RA-Ft for guix-patches@gnu.org; Thu, 19 Jul 2018 06:56:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fg6bK-0003Qn-5g for guix-patches@gnu.org; Thu, 19 Jul 2018 06:56:02 -0400 Subject: [bug#32209] [PATCH] database: Use SQLite in Multi-thread mode. Resent-Message-ID: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40719) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fg6ak-0007sH-O5 for guix-patches@gnu.org; Thu, 19 Jul 2018 06:55:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fg6af-0005sp-Tn for guix-patches@gnu.org; Thu, 19 Jul 2018 06:55:26 -0400 Received: from mail.lassieur.org ([83.152.10.219]:59534) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fg6af-0005nz-J1 for guix-patches@gnu.org; Thu, 19 Jul 2018 06:55:21 -0400 Received: from newt.Parrot.Biz (smtp.parrot.biz [62.23.167.188]) by mail.lassieur.org (OpenSMTPD) with ESMTPSA id df973103 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for ; Thu, 19 Jul 2018 10:55:17 +0000 (UTC) From: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur Date: Thu, 19 Jul 2018 12:54:57 +0200 Message-Id: <20180719105457.32267-1-clement@lassieur.org> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 32209@debbugs.gnu.org This disables mutexing on database connection and prepared statement objects, thus making us responsible for serializing access to database connections and prepared statements. It may result in a performance improvement. * src/cuirass/database.scm (db-init, db-open): Pass the SQLITE_OPEN_NOMUTEX flag to SQLITE-OPEN. --- src/cuirass/database.scm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/cuirass/database.scm b/src/cuirass/database.scm index a84d0fa..6bf3bc4 100644 --- a/src/cuirass/database.scm +++ b/src/cuirass/database.scm @@ -195,7 +195,8 @@ database object." (format (current-error-port) "Removing leftover database ~a~%" db-name) (delete-file db-name)) (let ((db (sqlite-open db-name (logior SQLITE_OPEN_CREATE - SQLITE_OPEN_READWRITE)))) + SQLITE_OPEN_READWRITE + SQLITE_OPEN_NOMUTEX)))) (db-load db schema) (db-set-schema-version db (latest-db-schema-version)) db)) @@ -222,7 +223,9 @@ database object." ;; avoid SQLITE_LOCKED errors when we have several readers: ;; . (set-db-options (if (file-exists? db) - (db-upgrade (sqlite-open db SQLITE_OPEN_READWRITE)) + (db-upgrade + (sqlite-open db (logior SQLITE_OPEN_READWRITE + SQLITE_OPEN_NOMUTEX))) (db-init db)))) (define (db-close db) -- 2.18.0