Marc-André Bombeck
add6d1fadc
fix(restore): order the restore and the consolidation passes by one lock
...
A restore on a freshly booted instance failed its clearing step with a
deadlock (40P01) while the boot-time step consolidation was folding the
same account. A consolidation day updates or mints the day's total and
then soft-deletes the day's per-sample rows; the restore deletes every
reading of the account in one statement. When the restore reached a
day's samples before its total, each side held what the other needed
next.
The restore already took an advisory lock per account before its first
delete. Every day transaction of the passes built on runConsolidation
(step and mean consolidation, the per-sample cumulative drain, the dense
intraday retention) now takes the same lock in shared mode as its first
statement. A restore that starts mid-day waits for that day to commit;
a day that would start while a restore runs is refused at once, and the
pass leaves that account for its next run instead of folding rows the
restore is about to replace. The passes still share the lock with each
other.
A new integration test builds the lock order that deadlocked, with a
row trigger holding the consolidation on the day's total while the
restore starts; before this change the consolidation was cancelled with
a deadlock. A guard test requires every transaction in a pass on
runConsolidation to open with the shared lock.
Refs #1031
2026-09-28 00:34:11 +02:00
..
2026-09-25 07:39:06 +02:00
2026-05-10 10:34:32 +02:00
2026-08-06 18:21:40 +02:00
2026-09-25 07:39:06 +02:00
2026-09-27 13:21:18 +02:00
2026-05-09 20:46:20 +02:00
2026-09-25 07:39:06 +02:00
2026-09-25 08:51:00 +02:00
2026-09-26 01:02:48 +02:00
2026-09-26 19:54:38 +02:00
2026-06-19 22:20:31 +02:00
2026-05-10 11:05:40 +02:00
2026-07-29 13:42:04 +02:00
2026-09-24 07:54:59 +02:00
2026-09-24 08:51:52 +02:00
2026-09-24 09:22:50 +02:00
2026-09-24 09:19:43 +02:00
2026-09-24 09:19:43 +02:00
2026-09-24 09:07:16 +02:00
2026-09-24 10:17:00 +02:00
2026-06-28 19:26:16 +02:00
2026-08-30 14:40:43 +02:00
2026-07-04 14:46:19 +02:00
2026-05-16 19:46:43 +02:00
2026-05-14 23:49:32 +02:00
2026-08-06 14:10:28 +02:00
2026-09-10 00:37:15 +02:00
2026-07-29 14:20:56 +02:00
2026-07-16 08:48:41 +02:00
2026-07-21 13:08:28 +02:00
2026-09-25 02:05:19 +02:00
2026-09-26 20:11:45 +02:00
2026-09-11 12:37:54 +02:00
2026-07-19 11:41:12 +02:00
2026-09-24 07:53:28 +02:00
2026-09-26 15:55:57 +02:00
2026-07-18 02:09:33 +02:00
2026-09-24 12:08:39 +02:00
2026-09-26 01:49:02 +02:00
2026-09-25 07:39:06 +02:00
2026-09-25 07:39:06 +02:00
2026-09-26 19:54:40 +02:00
2026-09-25 07:39:06 +02:00
2026-09-25 07:39:06 +02:00
2026-09-26 19:22:03 +02:00
2026-09-27 13:13:50 +02:00
2026-09-28 00:06:47 +02:00
2026-09-27 13:21:18 +02:00
2026-09-27 14:17:42 +02:00
2026-09-26 01:02:48 +02:00
2026-09-25 07:39:06 +02:00
2026-09-26 19:54:38 +02:00
2026-06-28 14:00:55 +02:00
2026-09-25 21:55:14 +02:00
2026-07-20 00:40:20 +02:00
2026-06-14 14:26:58 +02:00
2026-09-24 09:19:43 +02:00
2026-06-19 22:20:31 +02:00
2026-06-27 22:40:01 +02:00
2026-06-27 20:37:35 +02:00
2026-09-27 14:08:49 +02:00
2026-05-10 11:05:40 +02:00
2026-09-24 08:03:04 +02:00
2026-09-26 10:41:02 +02:00
2026-07-21 01:34:29 +02:00
2026-07-26 18:34:42 +02:00
2026-09-11 12:55:52 +02:00
2026-09-11 12:37:54 +02:00
2026-09-24 09:19:43 +02:00
2026-07-16 23:32:28 +02:00
2026-05-10 16:11:12 +02:00
2026-05-11 02:38:17 +02:00
2026-09-27 13:04:30 +02:00
2026-07-24 18:28:41 +02:00
2026-09-24 12:11:21 +02:00
2026-08-22 16:14:54 +02:00
2026-09-24 09:29:00 +02:00
2026-06-01 19:54:26 +02:00
2026-07-15 22:49:07 +02:00
2026-08-13 22:07:57 +02:00
2026-09-26 15:55:57 +02:00
2026-09-03 07:42:59 +02:00
2026-09-26 19:58:50 +02:00
2026-09-25 02:05:19 +02:00
2026-09-26 16:23:14 +02:00
2026-09-24 08:11:14 +02:00
2026-08-02 09:04:36 +02:00
2026-09-10 12:23:59 +02:00
2026-08-08 01:02:08 +02:00
2026-09-24 12:30:39 +02:00
2026-09-24 12:37:51 +02:00
2026-09-09 23:03:38 +02:00
2026-09-25 13:48:31 +02:00
2026-09-03 01:47:52 +02:00
2026-07-20 00:40:20 +02:00
2026-08-03 09:52:02 +02:00
2026-09-11 12:22:47 +02:00
2026-07-17 14:29:07 +02:00
2026-07-17 14:29:07 +02:00
2026-09-27 21:20:24 +02:00
2026-09-26 16:23:14 +02:00
2026-07-20 12:24:15 +02:00
2026-08-08 14:27:36 +02:00
2026-09-26 22:11:27 +02:00
2026-09-05 17:06:34 +02:00
2026-09-26 14:42:13 +02:00
2026-07-08 22:05:05 +02:00
2026-09-26 00:38:26 +02:00
2026-07-22 04:14:15 +02:00
2026-09-25 07:25:29 +02:00
2026-07-21 13:08:28 +02:00
2026-08-01 19:35:16 +02:00
2026-08-01 19:26:47 +02:00
2026-08-10 05:32:58 +02:00
2026-08-10 05:32:59 +02:00
2026-09-27 13:07:10 +02:00
2026-08-08 15:06:10 +02:00
2026-09-25 08:11:37 +02:00
2026-08-08 15:54:19 +02:00
2026-09-26 01:49:02 +02:00
2026-09-26 01:49:02 +02:00
2026-09-27 09:59:34 +02:00
2026-09-27 10:37:37 +02:00
2026-09-03 05:30:08 +02:00
2026-09-26 19:54:38 +02:00
2026-06-22 09:00:39 +02:00
2026-06-22 09:00:39 +02:00
2026-09-27 13:07:17 +02:00
2026-07-19 13:40:03 +02:00
2026-07-21 00:36:40 +02:00
2026-09-27 20:42:54 +02:00
2026-07-29 14:18:20 +02:00
2026-07-29 14:22:49 +02:00
2026-08-07 06:11:36 +02:00
2026-08-10 05:32:59 +02:00
2026-09-24 10:52:04 +02:00
2026-08-12 22:52:03 +02:00
2026-09-25 07:39:06 +02:00
2026-08-07 14:16:17 +02:00
2026-08-06 01:29:07 +02:00
2026-05-09 18:08:11 +02:00
2026-09-24 09:03:58 +02:00
2026-09-24 09:19:43 +02:00
2026-05-10 01:30:06 +02:00
2026-05-10 11:05:40 +02:00
2026-06-28 19:23:57 +02:00
2026-09-24 09:06:22 +02:00
2026-09-24 19:40:27 +02:00
2026-07-07 15:55:50 +02:00
2026-06-19 22:20:31 +02:00
2026-06-11 02:19:28 +02:00
2026-07-27 14:35:34 +02:00
2026-07-28 14:00:44 +02:00
2026-07-27 14:35:33 +02:00
2026-07-26 18:02:35 +02:00
2026-09-25 00:31:30 +02:00
2026-07-29 15:59:27 +02:00
2026-08-31 19:38:08 +02:00
2026-09-26 01:02:48 +02:00
2026-09-27 13:21:18 +02:00
2026-09-24 09:39:27 +02:00
2026-09-10 04:01:14 +02:00
2026-09-10 01:09:50 +02:00
2026-08-06 02:36:08 +02:00
2026-08-07 05:24:11 +02:00
2026-08-07 05:11:02 +02:00
2026-09-09 20:06:48 +02:00
2026-09-10 04:41:38 +02:00
2026-07-29 15:59:12 +02:00
2026-09-26 13:29:36 +02:00
2026-09-28 00:06:47 +02:00
2026-07-25 15:03:44 +02:00
2026-06-19 22:20:31 +02:00
2026-06-19 22:20:31 +02:00
2026-09-25 06:55:17 +02:00
2026-09-24 07:56:33 +02:00
2026-05-31 14:36:17 +02:00
2026-07-25 15:03:44 +02:00
2026-08-06 20:56:16 +02:00
2026-09-25 08:04:30 +02:00
2026-06-19 22:20:31 +02:00
2026-07-26 00:45:08 +02:00
2026-06-19 22:20:31 +02:00
2026-06-10 11:18:00 +02:00
2026-08-06 02:00:35 +02:00
2026-08-06 02:00:35 +02:00
2026-08-06 02:00:35 +02:00
2026-09-25 10:31:22 +02:00
2026-08-10 07:58:48 +02:00
2026-08-07 06:02:31 +02:00
2026-07-29 15:59:12 +02:00
2026-06-19 22:20:31 +02:00
2026-09-10 07:40:05 +02:00
2026-07-25 18:41:40 +02:00
2026-09-26 15:21:42 +02:00
2026-08-06 18:54:20 +02:00
2026-08-08 01:03:05 +02:00
2026-09-25 07:39:06 +02:00
2026-08-08 09:58:22 +02:00
2026-08-08 09:58:50 +02:00
2026-08-08 15:30:38 +02:00
2026-06-14 11:31:52 +02:00
2026-06-05 03:45:04 +02:00
2026-06-27 19:33:10 +02:00
2026-06-19 22:20:31 +02:00
2026-08-08 15:30:00 +02:00
2026-07-28 14:01:11 +02:00
2026-08-08 03:03:38 +02:00
2026-06-27 19:33:10 +02:00
2026-08-06 13:47:42 +02:00
2026-09-11 13:43:19 +02:00
2026-07-30 23:30:28 +02:00
2026-09-25 02:05:19 +02:00
2026-09-26 20:18:55 +02:00
2026-09-26 22:08:51 +02:00
2026-09-26 22:42:40 +02:00
2026-09-10 18:58:21 +02:00
2026-09-10 05:07:15 +02:00
2026-07-25 11:36:18 +02:00
2026-09-26 15:55:57 +02:00
2026-09-25 02:05:19 +02:00
2026-07-27 23:15:38 +02:00
2026-09-27 09:59:34 +02:00
2026-08-09 06:53:57 +02:00
2026-07-26 14:37:57 +02:00
2026-07-22 04:14:15 +02:00
2026-07-19 02:31:45 +02:00
2026-09-10 04:55:19 +02:00
2026-09-09 22:55:53 +02:00
2026-09-26 19:54:38 +02:00
2026-08-06 17:52:10 +02:00
2026-08-06 19:33:15 +02:00
2026-08-06 18:21:40 +02:00
2026-09-10 15:35:52 +02:00
2026-09-06 15:36:35 +02:00
2026-09-26 20:06:36 +02:00
2026-07-29 13:42:04 +02:00
2026-09-28 00:34:11 +02:00
2026-09-25 07:39:06 +02:00
2026-07-14 11:56:29 +02:00
2026-09-26 16:56:02 +02:00
2026-06-26 13:24:30 +02:00
2026-09-26 20:06:36 +02:00
2026-06-19 22:20:31 +02:00
2026-07-23 15:16:48 +02:00
2026-09-26 22:34:21 +02:00
2026-05-21 23:13:21 +02:00
2026-09-10 15:32:35 +02:00
2026-09-02 11:51:09 +02:00
2026-09-27 00:17:01 +02:00
2026-07-07 22:00:14 +02:00
2026-09-09 20:06:48 +02:00
2026-08-14 02:33:07 +02:00
2026-08-22 13:04:33 +02:00
2026-08-07 00:01:27 +02:00
2026-09-24 10:17:00 +02:00
2026-08-07 06:11:36 +02:00
2026-08-07 06:11:36 +02:00
2026-09-27 00:52:11 +02:00
2026-08-14 14:27:58 +02:00
2026-09-24 10:32:41 +02:00
2026-09-02 13:01:23 +02:00
2026-08-05 23:58:30 +02:00
2026-08-07 14:30:10 +02:00
2026-07-26 14:04:44 +02:00
2026-06-04 10:05:47 +02:00
2026-07-29 16:08:41 +02:00
2026-07-15 22:49:07 +02:00
2026-09-26 20:06:36 +02:00
2026-09-26 01:02:48 +02:00
2026-09-25 14:10:56 +02:00
2026-09-10 10:49:12 +02:00
2026-08-03 10:34:48 +02:00
2026-09-27 13:46:38 +02:00
2026-08-02 02:00:08 +02:00
2026-09-24 08:15:16 +02:00
2026-06-19 22:20:31 +02:00
2026-08-08 21:01:25 +02:00
2026-08-08 14:36:08 +02:00
2026-09-10 11:11:38 +02:00
2026-08-08 23:00:39 +02:00
2026-09-24 09:44:51 +02:00
2026-09-26 20:22:12 +02:00
2026-06-05 08:10:13 +02:00
2026-07-22 04:14:15 +02:00
2026-08-08 01:05:31 +02:00
2026-05-17 15:36:38 +02:00
2026-07-18 02:30:33 +02:00
2026-05-24 22:22:30 +02:00
2026-05-14 23:49:32 +02:00
2026-05-17 15:36:38 +02:00
2026-09-27 09:59:34 +02:00
2026-08-08 09:53:09 +02:00
2026-07-22 04:14:15 +02:00
2026-09-27 15:11:43 +02:00
2026-07-20 00:40:20 +02:00