Raito Bezarius
64a2f038b1
fix(local-store): invalidate phantom referrers at garbage collection time
...
Sometimes, a path can disappear from the `ValidPaths` table (I have 23
such cases on my 1.4TB Nix store).
When this occurs and you try to run a garbage collection,
`queryReferrers` will report no referrer because it's performing a
*RIGHT JOIN* between `Refs` and `ValidPaths`, finally, when you issue
the deletion SQL statement, this will throw an uncaught exception from
SQLite side regarding a foreign key violation because `reference` in
`Refs` is a foreign key to `ValidPaths` (which we are trying to delete).
Why can this happen?
Two reasons:
* `PRAGMA foreign_keys=off;` will disable deletion on cascade.
* Trigger recursion *limits*, a deletion on cascade is a *trigger*, when
a delete is issued and it triggers a bunch of deletion on cascade,
there's a documented limit by SQLite: https://www.sqlite.org/limits.html#max_trigger_depth
> Recursion limit on foreign key actions. The SQLITE_MAX_TRIGGER_DEPTH
> and SQLITE_LIMIT_TRIGGER_DEPTH settings determine the maximum
> allowable depth of trigger program recursion. For the purposes of
> these limits, foreign key actions are considered trigger programs. The
> PRAGMA recursive_triggers setting does not affect the operation of
> foreign key actions. It is not possible to disable recursive foreign
> key actions.
As I do not see easy ways to solve the root cause, garbage collection
should be self-healing in that regards, so I propose to invalidate
phantom referrers as we go.
As part of a work improving the consistency of the SQLite database, it
would make sense to count how many times this happen and try to find
ways to reproduce this issue.
Change-Id: I055a8a1d8c0e44d4388a411abe8e5a5e385f7b55
Signed-off-by: Raito Bezarius <raito@lix.systems >
2024-12-01 17:17:13 +01:00
..
2024-10-13 23:12:45 -07:00
2024-12-01 17:17:13 +01:00
2023-12-01 12:06:43 -05:00
2024-05-07 17:04:30 -06:00
2024-10-30 08:21:58 -07:00
2024-11-28 18:15:52 +01:00
2024-06-01 20:31:24 +02:00
2024-10-13 23:12:45 -07:00
2024-11-18 12:31:19 -08:00
2024-11-28 15:12:22 +00:00
2024-11-18 12:31:19 -08:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2024-10-30 15:12:35 +04:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2024-06-01 20:31:24 +02:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2024-03-07 10:46:47 +01:00
2023-12-01 12:06:43 -05:00
2024-03-07 10:46:47 +01:00
2024-08-25 19:55:47 +02:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2024-06-01 20:31:24 +02:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2024-10-05 16:21:19 +00:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2024-10-29 18:34:54 +01:00
2024-11-06 18:11:47 -08:00
2023-12-01 12:06:43 -05:00
2024-03-25 17:36:24 -06:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2024-10-30 15:12:35 +04:00
2024-05-03 16:26:16 +02:00
2024-06-01 20:31:24 +02:00
2024-03-04 08:57:44 +01:00
2023-12-01 12:06:43 -05:00
2024-10-15 11:15:42 +02:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2024-03-04 07:15:08 +01:00
2023-12-01 12:06:43 -05:00
2024-07-04 17:43:03 -06:00
2024-06-30 19:28:14 +02:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2024-05-08 19:31:43 +00:00
2024-05-08 19:31:43 +00:00
2024-03-07 10:46:47 +01:00
2024-03-29 22:57:40 -07:00
2024-08-01 15:41:30 -07:00
2024-09-28 14:52:06 +02:00
2023-12-01 12:06:43 -05:00
2024-08-17 15:48:10 +00:00
2024-08-17 15:48:10 +00:00
2023-12-01 12:06:43 -05:00
2024-06-01 20:31:24 +02:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2024-03-04 07:50:02 +01:00
2024-03-04 07:50:02 +01:00
2024-09-26 14:32:29 -07:00
2024-09-26 14:32:29 -07:00
2024-06-27 22:44:16 -07:00
2024-03-29 22:57:40 -07:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2024-07-19 20:55:55 +00:00
2024-04-25 23:24:21 -04:00
2024-04-25 23:24:21 -04:00
2023-12-01 12:06:43 -05:00
2024-10-14 17:19:22 +04:00
2024-11-01 11:59:59 +00:00
2024-03-07 10:46:47 +01:00
2024-01-11 07:21:16 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2024-06-01 20:31:24 +02:00
2024-03-04 07:21:01 +01:00
2024-05-06 18:56:40 +02:00
2024-06-24 14:00:43 -07:00
2023-12-01 12:06:43 -05:00
2024-10-18 11:40:04 +00:00
2024-04-08 15:40:12 -07:00
2024-03-29 22:57:40 -07:00
2024-05-31 07:54:18 +00:00
2024-04-08 15:40:12 -07:00
2024-03-04 07:26:34 +01:00
2024-12-01 17:17:13 +01:00
2024-05-30 03:07:21 +00:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2024-03-29 22:57:40 -07:00
2024-03-04 05:27:18 +01:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2024-03-29 22:57:40 -07:00
2023-12-01 12:06:43 -05:00
2024-07-09 13:55:05 +00:00
2024-03-07 03:34:00 +01:00
2024-03-07 03:34:00 +01:00
2024-03-07 03:34:00 +01:00
2024-06-24 14:00:43 -07:00
2024-05-24 15:15:42 -06:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2024-12-01 17:17:13 +01:00
2023-12-01 12:06:43 -05:00
2024-05-12 23:04:21 +02:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2024-08-17 15:48:10 +00:00
2024-06-24 14:00:43 -07:00
2024-06-24 14:00:43 -07:00
2024-03-29 22:57:40 -07:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2024-08-23 17:49:15 -07:00
2024-04-08 15:40:12 -07:00
2023-12-01 12:06:43 -05:00
2024-08-07 15:58:44 +03:00
2023-12-01 12:06:43 -05:00
2024-11-28 18:15:52 +01:00
2023-12-01 12:06:43 -05:00
2024-08-04 20:41:19 -07:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2024-03-04 07:50:55 +01:00
2024-03-04 07:50:55 +01:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2024-03-29 22:57:40 -07:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2024-03-04 08:17:32 +01:00
2023-12-01 12:06:43 -05:00
2024-10-13 23:12:45 -07:00
2024-06-23 11:52:49 +00:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2024-04-11 15:43:58 +03:00
2024-08-17 15:48:10 +00:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2024-03-14 14:30:38 -07:00
2023-12-01 12:06:43 -05:00
2024-05-28 04:20:00 +00:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00
2024-03-04 05:59:15 +01:00
2023-12-01 12:06:43 -05:00
2023-12-01 12:06:43 -05:00