2
0
Fork 0
mirror of git://git.savannah.gnu.org/guix/data-service.git synced 2023-12-14 03:23:03 +01:00
Commit graph

935 commits

Author SHA1 Message Date
Christopher Baines
f02c245652 Add another guard clause in to the data deletion code
I've see this error [1] which may relate to the derivation-output-details-id
not being a number, so this check should confirm if there is a issue.

1: Throw to key `psql-query-error' with args `(fatal-error "PGRES_FATAL_ERROR" "ERROR:  invalid input syntax for integer: \"\"\n")'.
2020-10-10 13:34:54 +01:00
Christopher Baines
4f3be14c16 Split the jobs metric in to succeede, queued and failed
Rather than just completed or not.
2020-10-09 20:19:28 +01:00
Christopher Baines
5267bde603 Add Prometheus metrics for indexes specifically 2020-10-09 19:42:14 +01:00
Christopher Baines
2fa9f151f6 Include the base commit and target commit in the compare output
This makes it easier to make other requests with the response body.
2020-10-09 19:35:38 +01:00
Christopher Baines
3cb8ce51fc Include tablespace as a label for table metrics
As this will make it easier to tell where space is going.
2020-10-09 19:35:31 +01:00
Christopher Baines
6023aa8caf Improve select-job-for-commit
It now returns #f or a list, rather than the empty list or a nested list.
2020-10-09 19:31:51 +01:00
Christopher Baines
51204aefca Clarify that the derivations comparison only is for packages
As it excludes the channel instances and system tests.
2020-10-09 19:31:21 +01:00
Christopher Baines
853aaa6a7c Use letpar& for systems and targets in render-compare/derivations 2020-10-09 19:30:48 +01:00
Christopher Baines
8daf35e2df Change the derivation comparison targets
To be targets, rather than systems.
2020-10-09 19:29:58 +01:00
Christopher Baines
1f55718d75 Link to the revisions in the comparison header 2020-10-09 19:29:38 +01:00
Christopher Baines
da8586f62d Guard against errors when recording job stderr output
This might help at least handle errors when inserting data in to PostgreSQL.
2020-10-09 19:28:06 +01:00
Christopher Baines
2c463fcdab Guard against derivation IDs that aren't numbers
I saw an error suggesting that something came back that wasn't a number, and
this should give a more informative error.
2020-10-09 19:27:04 +01:00
Christopher Baines
f1eb2d3bd2 Change table-schema to detect when there are no results
This might give more insight to the [1] errors occuring for some builds.

1: error: couldn't find data for locale in ()
2020-10-08 17:36:21 +01:00
Christopher Baines
062397e82b Just use map rather than par-map& for deleting derivations
As I think par-map& is probably no faster.
2020-10-08 08:20:03 +01:00
Christopher Baines
936fda57c5 Make the derivation deletion batch size configurable 2020-10-08 07:52:03 +01:00
Christopher Baines
b540abaeba Reduce the derivation deletion batch size 2020-10-08 07:49:28 +01:00
Christopher Baines
03ea66cf33 Use the git repository fetch with authentication value 2020-10-07 18:51:30 +01:00
Christopher Baines
9f9c23010e Support storing whether to authenticate commits by git repository
To allow using the Guix Data Service when commits aren't authenticated.
2020-10-07 18:50:13 +01:00
Christopher Baines
888d9fcb98 Avoid locking up the thread pool channel on letpar& exceptions
Previously, if an exception occurred during the processing of any but the last
letpar& expression, the replies for the other expressions would never be
fetched, resulting in that thread in the pool just waiting for a receiver for
the message.

To avoid this, make sure to read all the replies before raising any
exceptions.
2020-10-04 15:38:31 +01:00
Christopher Baines
a8d5ea4654 Fix the no latest revision behaviour for the latest revision links
Previously the render-unknown-revision procedure would error, as it wasn't
meant for this purpose.
2020-10-04 15:12:26 +01:00
Christopher Baines
f68166514f Actually delete more of the data for a revision
Previously the package_derivations table wasn't considered, which would mean
derivations would still be referenced. This commit fixes that, along with also
deleting unreferenced entries in some linter related tables.
2020-10-04 15:11:21 +01:00
Christopher Baines
48673b32cb Fix delete-unreferenced-derivations 2020-10-04 13:23:15 +01:00
Christopher Baines
93c9813546 Fix the implementation of par-map&
It was pretty wrong...
2020-10-04 13:22:35 +01:00
Christopher Baines
d2646e7110 Remove some non-existent imports 2020-10-04 13:22:24 +01:00
Christopher Baines
a24d3e934d Extract out the ability to delete a range of commits
Some revisions have got disassociated from branches, probably because they
were associated with multiple branches in the first place. This should allow
deleting them.
2020-10-04 12:18:57 +01:00
Christopher Baines
fe7da1ba57 Remove some unnecessary parallel-via-thread-pool-channel calls
As these were causing errors because they were nested in letpar&.
2020-10-04 11:29:51 +01:00
Christopher Baines
96b65f16fb Avoid fiber deadlocks
Channels don't represent some channel on which messages travel, at least not a
very long one because it can't accommodate any messages. They simply represent
a direct exchange of the message between a sender and receiver. Because of
this, put-message blocks the fiber, and if all the threads on the other end
are waiting for replies to be received, then you have a deadlock.

To avoid this situation, spawn new fibers to send the messages. I think this
works at least, although I'm unsure how sensible it is.
2020-10-04 10:18:53 +01:00
Christopher Baines
55eaaaeeac Bump the copyright date in the footer
Later is better than never...
2020-10-03 21:42:18 +01:00
Christopher Baines
c3c9c07f9a Completely rework the way db connections are handled during requests
Previously, a connection was passed through the code handling the
request. When queries were performed, this could block the thread though,
potentially leaving the server unable to serve other requests.

Instead, this now runs queries in a pool of threads. This should remove the
possibility of blocking the threads used by the web server, and in doing so,
some of the queries have been parallelised.

I''m still not sure about the naming and syntax, but I think the functionality
is a sort of step forward.
2020-10-03 21:35:31 +01:00
Christopher Baines
e2e55c69de Rework the shortlived PostgreSQL specific connection channel
In to a generic thing more like (ice-9 futures). Including copying some bits
from the (ice-9 threads) module and adapting them to work with this fibers
approach, rather than futures. The advantage being that using fibers channels
doesn't block the threads being used by fibers, whereas futures would.
2020-10-03 21:32:46 +01:00
Christopher Baines
18b6dd9e6d Stop opening a PostgreSQL connection per request
This was good in that it avoided having to deal with long running connections,
but it probably takes some time to open the connection, and these changes are
a step towards offloading the PostgreSQL queries to other threads, so they
don't block the threads for fibers.
2020-10-03 09:22:29 +01:00
Christopher Baines
9723a18df4 Add some utilities to work with PostgreSQL connections in threads 2020-10-03 09:20:39 +01:00
Christopher Baines
1bdc8855ba Extract out opening PostgreSQL connections
So this can be reused.
2020-10-03 08:55:56 +01:00
Christopher Baines
470573b318 Delete derivation_source_files that are unreferenced
This will also delete unreferenced derivation_source_file_nars.
2020-10-02 20:15:23 +01:00
Christopher Baines
e2a7705d3d Add an index for derivation_sources.derivation_source_file_id
As this speeds up deleting derivation_source_files.
2020-10-02 20:15:23 +01:00
Christopher Baines
71afa93981 Make with-postgresql-connection work with multiple values 2020-10-02 20:15:23 +01:00
Christopher Baines
841f5fb186 Change a constraint to add ON DELETE CASCADE
I've not used these in many places, to try and avoid hiding deleting data, but
in this case, this will allow more easily deleting the derivation source file
nars, by just deleting the derivation_source_files table entry.
2020-10-02 20:15:10 +01:00
Christopher Baines
125a35fce5 Reformat lint warning related query 2020-10-02 17:52:07 +01:00
Christopher Baines
af40c1ac13 Speed up a query for derivation builds
This change removes a sequential scan from the query plan, making it much
faster.
2020-10-02 17:51:55 +01:00
Christopher Baines
6e0e33addf Change the autovacuum config for some tables
Looking at data for the the patches deployment of the Guix Data Service, these
tables look like they might benefit from vacuuming/analyzing more often, so
adjust the configuration so this will hopefully happen.
2020-10-01 22:30:39 +01:00
Christopher Baines
c05a8e4e9f COALESCE a couple more pg_stat fields
As apparently they can be NULL.
2020-10-01 22:00:52 +01:00
Christopher Baines
7f49756bac Track some pg_stat metrics
Hopefully this'll help track database things better.
2020-10-01 21:43:41 +01:00
Christopher Baines
404f39a9ee Drop default thread count for make-postgresql-connection-channel
At least for data deletion, 4 seems unnecessary.
2020-10-01 19:41:13 +01:00
Christopher Baines
54654417a3 Delete derivations in parallel
In an attempt to make this faster.
2020-10-01 19:15:32 +01:00
Christopher Baines
16600b1a43 Remove the deleting derivations progress output
As this is harder to do when deleting derivations in parallel.
2020-10-01 19:14:56 +01:00
Christopher Baines
fb4c7ecd4c Delete derivations through a channel
Not much different from before, but this will allow parallelising things.
2020-10-01 19:14:11 +01:00
Christopher Baines
614f9888a5 Add some utilities to use PostgreSQL/Squee through a channel
To allow for some concurrency.
2020-10-01 19:13:30 +01:00
Christopher Baines
3330f034a4 Remove a now redundant part of the maybe-delete-derivation query
As this is covered by the big query selecting the derivation ids.
2020-09-30 20:34:33 +01:00
Christopher Baines
d844b325e2 Stop recursing now that derivation deletion selection is smarter
As this probably won't help with performance.
2020-09-30 20:07:41 +01:00
Christopher Baines
47af6c9661 Attempt to speed up derivation deletion
Stop querying for the file-name, as it's unused. Rather than fetching all ids,
then looking at each to see if it can be deleted, do some imperfect but not
too slow checks in the initial query.
2020-09-30 19:38:56 +01:00