Commit graph

1379 commits

Author SHA1 Message Date
68850065d7 Extend the invalid parameter handling for more types 2023-05-22 17:34:39 +01:00
5f21458a8f Have render-compare/package-derivations provide invalid param info
So that this can be used by the qa-frontpage.

This should be improved and generalised.
2023-05-22 17:25:44 +01:00
54c7a1a880 Fix ignoring canceled builds
The previous changes only affected searching for package derivations, and they
also didn't work.
2023-05-18 12:31:58 +01:00
4208b5f148 Ignore canceled builds when querying package derivations
This will help when using this to submit builds, since you won't end up
ignoring derivations with canceled builds.
2023-05-18 11:25:14 +01:00
61f6619313 Add Guile internal time metrics
As this will help identify when the service restarts.
2023-05-14 22:45:19 +01:00
bbacbcd2aa Ensure the known and unknown keys appear 2023-05-09 13:45:36 +01:00
c50f6aeb34 Remove redundant match-lambda in select-package-output-availability-for-revision 2023-05-09 13:43:32 +01:00
47c482bdcc Set lock_timeout for some data deletion transactions
As these can cause deadlocks. This will probably cause errors, so some
retrying will need to be added.
2023-05-09 08:55:09 +01:00
3734a85650 Use the package_derivations system id in a query
Rather than the derivations system id, as this helps PostgreSQL run the query
faster.
2023-05-04 08:32:43 +01:00
639c6ff183 Further tweak fetching narinfos
Move the batching to the database, which should reduce memory usage while
removing the limit on the number of fetched narinfos.
2023-04-28 22:33:41 +02:00
8a19bcba13 Tweak fetching narinfos
Currently I'm seeing failures due to guile-gnutls not supporting suspendable
ports (write_wait_fd), so batch the requested outputs to try and avoid this.
2023-04-28 20:42:31 +02:00
688f4cd79d Set request timeouts for the thread pools
The request timeout should ensure that the operations don't back up if the
thread pool is overloaded.
2023-04-27 14:58:47 +02:00
638e0442c3 Support request timeouts in the thread pool 2023-04-27 14:58:44 +02:00
5bb7cf0c1c Change par-mapper' to use fetch-result-of-defered-thunks
So the fetch-result-of-defered-thunk procedure can be removed.
2023-04-27 11:59:01 +02:00
9f080524bc Split the thread pool used for database connections
In to two thread pools, a default one, and one reserved for essential
functionality.

There are some pages that use slow queries, so this should help stop those
pages block other operations.
2023-04-27 10:31:09 +02:00
4fa7a3601e Include distribution counts table in data deletion 2023-04-07 11:21:28 +01:00
1a0eaeb672 Improve performance of select-fixed-output-package-derivations-in-revision 2023-03-11 18:19:19 +00:00
a20b929e90 Fix query in get-count-for-next-level 2023-03-09 14:05:41 +00:00
519f0c6f67 Defer backfilling derivation distribution counts until later
After the migrations have run.
2023-03-09 09:39:47 +00:00
319439d05a Reorder some vacuum operations when loading revisions 2023-03-09 09:17:07 +00:00
659dcc6a0d Avoid a recursive CTE for finding blocked builds where possible
Use the new approach of looking up the distribution of the derivations, and
building a non recursive query specifically for this revision. This should
avoid PostgreSQL picking a poor plan for performing the query.
2023-03-09 08:36:51 +00:00
e39c9da028 Store the distribution of derivations related to packages
This might be generally useful, but I've been looking at it as it offers a way
to try and improve query performance when you want to select all the
derivations related to the packages for a revision.

The data looks like this (for a specified system and target):

┌───────┬───────┐
│ level │ count │
├───────┼───────┤
│    15 │     2 │
│    14 │     3 │
│    13 │     3 │
│    12 │     3 │
│    11 │    14 │
│    10 │    25 │
│     9 │    44 │
│     8 │    91 │
│     7 │  1084 │
│     6 │   311 │
│     5 │   432 │
│     4 │   515 │
│     3 │   548 │
│     2 │  2201 │
│     1 │ 21162 │
│     0 │ 22310 │
└───────┴───────┘

Level 0 reflects the number of packages. Level 1 is similar as you have all
the derivations for the package origins. The remaining levels contain less
packages since it's mostly just derivations involved in bootstrapping.

When using a recursive CTE to collect all the derivations, PostgreSQL assumes
that the each derivation has the same number of inputs, and this leads to a
large overestimation of the number of derivations per a revision. This in turn
can lead to PostgreSQL picking a slower way of running the query.

When it's known how many new derivations you should see at each level, it's
possible to inform PostgreSQL this by using LIMIT's at various points in the
query. This reassures the query planner that it's not going to be handling
lots of rows and helps it make better decisions about how to execute the
query.
2023-03-09 08:29:39 +00:00
55059558e7 Avoid logging when there are no processes to wait for 2023-03-09 08:24:01 +00:00
e9ccb66225 Fix counting derivations when there are lots 2023-03-09 08:17:14 +00:00
a6f239fb8a Add an extra index on blocked_builds
I think this might help with queries that don't use the build_server_id.
2023-03-05 10:21:14 +00:00
7e7cd3f5a9 Tweak the comparision query
This seems to generate better plans.
2023-03-05 10:18:30 +00:00
784c1da9ae Remove peek 2023-03-05 10:18:22 +00:00
bf41c6ebb1 Set current-guix-package when computing system test derivations
This is a bit ugly, but might speed up computing derivations for system tests.
2023-02-28 10:51:51 +00:00
2d96fbff48 Speed up deleting blocked_builds entries 2023-02-27 22:52:43 +00:00
1bce38a69d Move the delete-unreferenced-derivations advisory lock
To better prevent two processes running at the same time.
2023-02-27 22:48:54 +00:00
Leo Famulari
8c2f97eef8 Comparing package derivations: Fix inconsistent verbage.
Harmonize "Build change" options between the selection menu and the
documentation

* guix-data-service/web/compare/html.scm (compare/package-derivations):
Replace "Still broken" with "Still failing" in the "Build change" help text.

Signed-off-by: Christopher Baines <mail@cbaines.net>
2023-02-17 17:10:52 +00:00
f68822cad2 Include some useful numbers on the package derivations comparison
As it's frequently useful to know how many packages/builds some change has
affected.
2023-02-15 15:48:45 +00:00
1266d3d336 Remove redundant postgresql connection when deleting derivations 2023-02-14 20:59:21 +00:00
ebbcf36dc4 Delete blocked_builds entries when deleting derivations 2023-02-14 20:10:44 +00:00
5874c4ee37 Delete git_branches entries
When deleting data for a branch.
2023-02-14 19:57:30 +00:00
9872367c01 Avoid errors dropping partition tables if they don't exist 2023-02-13 20:10:23 +00:00
078516e0ab Improve dropping package_derivation_by_guix_revision_range partitions 2023-02-13 19:26:44 +00:00
6be113f99d Adjust render procedures to not use procedures for responses
The newer Guile Fibers web server will use the chunked transfer encoding when
a procedure is used and the content length is unspecified. This is good for
large responses, but unnecessary here. Also, there's a bug with the charset so
these changes to respond with correctly encoded bytevectors to avoid that.
2023-02-09 11:49:41 +00:00
0ce5af2c59 Tweak behaviour when the response body is a procedure
Newer versions of Guile Fibers will now use chunked encoding when a procedure
is used (and no content length is set). This is good, but not always what is
wanted, and there's also an issue with the port encoding.

This commit switches to responding with a string/bytevector when more
appropriate, plus explicitly setting the port encoding where that's needed.
2023-02-09 10:39:24 +00:00
3ba8418656 Allow skipping processing system tests
Generating system test derivations are difficult, since you generally need to
do potentially expensive builds for the system you're generating the system
tests for. You might not want to disable grafts for instance because you might
be trying to test whatever the test is testing in the context of grafts being
enabled.

I'm looking at skipping the system tests on data.guix.gnu.org, because they're
not used and quite expensive to compute.
2023-02-08 14:56:48 +00:00
9e9fc1ba04 Skip some metrics that apply for each branch
As data.qa.guix.gnu.org has lots of branches and 100,000+ metrics, and this is
causing Prometheus to time out fetching the metrics.

I'm not sure there's much value in these metrics, so cut them out for now.
2023-02-02 15:04:20 +01:00
d29ef3ed9b Enable database connection instrumentation in the server 2023-01-01 12:43:19 +00:00
05c437d26a Support instrumenting the number of database connections
Since this is now quite dynamic, it's useful to have a metric for it.
2023-01-01 12:43:06 +00:00
926cb2a5e1 Pull the metrics registry out of the controller
This will allow for instrumenting low level database functionality, before
anything starts using the database.
2023-01-01 12:27:34 +00:00
7b69611755 Expose metrics from pg_stats 2022-11-29 11:09:55 +00:00
9f05f5f4f9 Only sometimes attempt manually computing n_distinct values
For derivation_inputs.
2022-11-29 10:36:46 +00:00
6ada1cb845 Guard against divide by 0 in update-derivation-outputs-statistics 2022-11-28 13:17:20 +00:00
1a0c5599eb Do derivation inputs and outputs housekeeping at the end of each job
This should help with query performance, as the recursive queries using
derivation_inputs and derivation_outputs are particularly sensitive to the
n_distinct values for these tables.
2022-11-28 11:36:12 +00:00
38b3657013 Use advisory locks to avoid deadlocks during data deletion
In the case where multiple data deleting processes end up running at the same
time.
2022-11-28 10:26:46 +00:00
ad93a780d3 Improve the inferior cleanup when computing package derivations 2022-11-24 12:37:49 +00:00