all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#32209] [PATCH] database: Use SQLite in Multi-thread mode.
@ 2018-07-19 10:54 Clément Lassieur
  2018-07-20 12:55 ` Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: Clément Lassieur @ 2018-07-19 10:54 UTC (permalink / raw)
  To: 32209

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:
   ;; <https://www.sqlite.org/wal.html>.
   (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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [bug#32209] [PATCH] database: Use SQLite in Multi-thread mode.
  2018-07-19 10:54 [bug#32209] [PATCH] database: Use SQLite in Multi-thread mode Clément Lassieur
@ 2018-07-20 12:55 ` Ludovic Courtès
  2018-07-20 13:23   ` bug#32209: " Clément Lassieur
  0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2018-07-20 12:55 UTC (permalink / raw)
  To: Clément Lassieur; +Cc: 32209

Hello!

Clément Lassieur <clement@lassieur.org> skribis:

> 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.

Could you copy (part of) the paragraph above as a comment above the
‘sqlite-open’ call in ‘db-open’?

Then I guess you can go ahead and push!

Thank you,
Ludo’.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#32209: [PATCH] database: Use SQLite in Multi-thread mode.
  2018-07-20 12:55 ` Ludovic Courtès
@ 2018-07-20 13:23   ` Clément Lassieur
  0 siblings, 0 replies; 3+ messages in thread
From: Clément Lassieur @ 2018-07-20 13:23 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 32209-done

Ludovic Courtès <ludo@gnu.org> writes:

> Hello!
>
> Clément Lassieur <clement@lassieur.org> skribis:
>
>> 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.
>
> Could you copy (part of) the paragraph above as a comment above the
> ‘sqlite-open’ call in ‘db-open’?

Done, and pushed.  Thanks!

Clément

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-07-20 13:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-19 10:54 [bug#32209] [PATCH] database: Use SQLite in Multi-thread mode Clément Lassieur
2018-07-20 12:55 ` Ludovic Courtès
2018-07-20 13:23   ` bug#32209: " Clément Lassieur

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.