all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Danny Milosavljevic <dannym@scratchpost.org>
Cc: guix-devel <guix-devel@gnu.org>
Subject: Re: Cuirass news
Date: Thu, 08 Feb 2018 23:21:58 +0100	[thread overview]
Message-ID: <871shvt94p.fsf@gnu.org> (raw)
In-Reply-To: <20180208172905.19e9e789@scratchpost.org> (Danny Milosavljevic's message of "Thu, 8 Feb 2018 17:29:05 +0100")

[-- Attachment #1: Type: text/plain, Size: 1800 bytes --]

Hi Danny,

Danny Milosavljevic <dannym@scratchpost.org> skribis:

> On Thu, 08 Feb 2018 14:37:58 +0100
> ludo@gnu.org (Ludovic Courtès) wrote:
>> We’re making progress!  :-)
>
> Nice!  I'm still checking a few loose ends but I think we're pretty okay now
> from a security standpoint - except for db-get-builds, which I'm amending
> right now.

Oh sorry, I think I did the same thing as you were sending this message:

  https://git.savannah.gnu.org/cgit/guix/guix-cuirass.git/commit/?id=8c7c93922bbe0513ff4c4ff3a6e554e3a72635b6

WDYT?

> Also, I'd like to get the number of distinct SQL statements down, so I'll
> propose another patch on guix-patches to do that.

Excellent.

> Also, I think sqlite-exec shouldn't call sqlite-finalize most of the time -
> otherwise the cached statement will be lost :P

Indeed!  Should we change ‘sqlite-finalize’ to a noop when called on a
cached statement?  (Otherwise users would have to keep track of whether
or not a statement is cached.)

Besides, on the big database on berlin, the initial:

  (db-get-builds db '((status pending)))

call takes a lot of time and memory.  I guess we’re doing something
wrong, but I’m not sure what.  The same query in the ‘sqlite3’ CLI is
snappy and does not consume much memory.

One of the things we’re doing wrong is that ‘Outputs’ table: each
‘db-format-build’ call triggers a lookup in that table.  We should
instead probably simply store output lists in the ‘Derivations’ table.

Thoughts?

Which also means we should have schema versioning and a way to upgrade…

> I've also reintroduced sqlite-bind-args in a nicer version, please pull:
> https://notabug.org/civodul/guile-sqlite3/pulls/3 .

It is OK with you to write it like this:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 958 bytes --]

diff --git a/sqlite3.scm b/sqlite3.scm
index 156c461..fa96bdb 100644
--- a/sqlite3.scm
+++ b/sqlite3.scm
@@ -38,6 +38,7 @@
             sqlite-prepare*
             sqlite-prepare
             sqlite-bind
+            sqlite-bind-arguments
             sqlite-column-names
             sqlite-step
             sqlite-fold
@@ -390,6 +391,21 @@
           (error "unexpected value" val)))
         (check-error (stmt->db stmt))))))
 
+(define (sqlite-bind-arguments stmt . args)
+  "Bind STMT parameters, one after another, to ARGS.
+Also bind named parameters to the respective ones."
+  (let loop ((i 1)
+             (args args))
+    (match args
+      (()
+       #f)
+      (((? keyword? kw) value . rest)
+       (sqlite-bind stmt (keyword->symbol kw) value)
+       (loop i rest))
+      ((arg . rest)
+       (sqlite-bind stmt i arg)
+       (loop (+ 1 i) rest)))))
+
 (define sqlite-column-count
   (let ((column-count
          (pointer->procedure

[-- Attachment #3: Type: text/plain, Size: 90 bytes --]


?

At some point we’ll also need a real test suite in guile-sqlite3…

Ludo’.

  reply	other threads:[~2018-02-08 22:22 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-24 22:12 Cuirass news Ludovic Courtès
2018-01-25 10:55 ` Mathieu Othacehe
2018-01-25 10:59   ` Mathieu Othacehe
2018-01-25 13:09     ` Ludovic Courtès
2018-01-26 14:30       ` Danny Milosavljevic
2018-01-27 16:01         ` Ludovic Courtès
2018-01-27 17:18           ` Danny Milosavljevic
2018-01-27 19:12             ` Danny Milosavljevic
2018-01-28 21:47             ` Ludovic Courtès
2018-01-28 22:23               ` Danny Milosavljevic
2018-01-29  9:57               ` Andy Wingo
2018-02-08 13:37             ` Ludovic Courtès
2018-02-08 16:29               ` Danny Milosavljevic
2018-02-08 22:21                 ` Ludovic Courtès [this message]
2018-02-08 23:05                   ` Danny Milosavljevic
2018-02-09  6:17                     ` Gábor Boskovits
2018-02-09  9:41                     ` Ludovic Courtès
2018-02-09 11:29                       ` Danny Milosavljevic
2018-02-09 16:53                         ` Ludovic Courtès
2018-02-09 17:06                           ` Danny Milosavljevic
2018-02-10 11:18                             ` Ludovic Courtès
2018-02-13  9:12                               ` Danny Milosavljevic
2018-02-14 13:43                                 ` Ludovic Courtès
2018-02-14 23:17                                   ` Ludovic Courtès
2018-02-19 15:35                                     ` Danny Milosavljevic
2018-02-19 15:35                                       ` [PATCH] database: Simplify 'db-get-builds' Danny Milosavljevic
2018-02-19 17:52                                       ` [PATCH] database: db-get-builds: Inline output selection Danny Milosavljevic
2018-02-19 22:08                                       ` Cuirass news Danny Milosavljevic
2018-03-02 13:21                                         ` Ludovic Courtès
2018-03-02 22:06                                           ` Ludovic Courtès
2018-03-02 23:29                                           ` Danny Milosavljevic
2018-02-14 23:21                                   ` Ludovic Courtès
2018-01-25 21:06 ` Ricardo Wurmus
2018-01-26 11:12   ` Ludovic Courtès
2018-01-25 22:28 ` Danny Milosavljevic
2018-01-26 10:47   ` Ludovic Courtès
2018-01-28 12:33     ` Cuirass frontend Danny Milosavljevic
2018-01-29 17:42       ` Ludovic Courtès
2018-01-26  0:46 ` Cuirass news Danny Milosavljevic
2018-01-27 17:27   ` Danny Milosavljevic
2018-01-28 21:48     ` Ludovic Courtès
2018-01-26 17:55 ` Jan Nieuwenhuizen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871shvt94p.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=dannym@scratchpost.org \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.