Dmitrii Kovalkov
edd60730c8
safekeeper: use last_log_term in mconf switch + choose most advanced sk in pull timeline ( #12778 )
...
## Problem
I discovered two bugs corresponding to safekeeper migration, which
together might lead to a data loss during the migration. The second bug
is from a hadron patch and might lead to a data loss during the
safekeeper restore in hadron as well.
1. `switch_membership` returns the current `term` instead of
`last_log_term`. It is used to choose the `sync_position` in the
algorithm, so we might choose the wrong one and break the correctness
guarantees.
2. The current `term` is used to choose the most advanced SK in
`pull_timeline` with higher priority than `flush_lsn`. It is incorrect
because the most advanced safekeeper is the one with the highest
`(last_log_term, flush_lsn)` pair. The compute might bump term on the
least advanced sk, making it the best choice to pull from, and thus
making committed log entries "uncommitted" after `pull_timeline`
Part of https://databricks.atlassian.net/browse/LKB-1017
## Summary of changes
- Return `last_log_term` in `switch_membership`
- Use `(last_log_term, flush_lsn)` as a primary key for choosing the
most advanced sk in `pull_timeline` and deny pulling if the `max_term`
is higher than on the most advanced sk (hadron only)
- Write tests for both cases
- Retry `sync_safekeepers` in `compute_ctl`
- Take into the account the quorum size when calculating `sync_position`
2025-07-31 09:29:25 +00:00
..
2025-07-10 08:06:33 +00:00
2025-03-30 18:58:33 +00:00
2025-07-10 10:07:21 +00:00
2025-03-30 18:58:33 +00:00
2024-10-08 14:32:26 -05:00
2025-03-30 18:58:33 +00:00
2025-07-24 14:42:39 +00:00
2025-03-30 18:58:33 +00:00
2025-07-29 22:20:05 +00:00
2025-07-09 17:16:06 +00:00
2025-03-30 18:58:33 +00:00
2025-07-04 10:25:03 +00:00
2025-07-15 14:36:28 +00:00
2025-03-30 18:58:33 +00:00
2025-07-24 16:44:45 +00:00
2025-03-30 18:58:33 +00:00
2025-03-30 18:58:33 +00:00
2024-11-25 09:01:05 +00:00
2025-07-22 12:00:20 +00:00
2025-07-30 19:10:33 +00:00
2025-07-23 16:12:46 +00:00
2025-05-20 09:03:36 +00:00
2025-05-06 22:19:15 +00:00
2024-11-08 12:19:18 -06:00
2025-07-15 10:45:49 +00:00
2025-03-30 18:58:33 +00:00
2025-04-24 13:51:09 +00:00
2025-06-18 10:01:05 +00:00
2025-07-25 00:01:59 +00:00
2025-03-30 18:58:33 +00:00
2025-06-05 11:43:04 +00:00
2024-10-08 14:32:26 -05:00
2025-03-30 18:58:33 +00:00
2025-03-30 18:58:33 +00:00
2025-05-29 13:01:10 +00:00
2025-07-10 08:06:33 +00:00
2025-03-30 18:58:33 +00:00
2025-05-06 22:02:12 +00:00
2025-07-10 08:06:33 +00:00
2025-03-30 18:58:33 +00:00
2024-10-18 15:07:36 +03:00
2025-07-22 17:55:07 +00:00
2025-03-30 18:58:33 +00:00
2025-03-30 18:58:33 +00:00
2025-04-04 18:04:39 +00:00
2024-10-08 14:32:26 -05:00
2025-05-06 07:24:27 +00:00
2025-07-25 00:01:59 +00:00
2025-07-22 11:04:03 +00:00
2025-07-24 14:00:22 +00:00
2025-05-30 12:14:36 +00:00
2025-06-05 18:53:14 +00:00
2025-03-30 18:58:33 +00:00
2025-03-30 18:58:33 +00:00
2025-02-03 12:44:47 +00:00
2025-03-30 18:58:33 +00:00
2025-03-30 18:58:33 +00:00
2025-05-28 07:00:52 +00:00
2025-03-31 19:49:32 +00:00
2025-07-30 22:05:51 +00:00
2025-04-08 03:52:50 +00:00
2025-07-22 12:00:20 +00:00
2025-03-30 18:58:33 +00:00
2025-03-30 18:58:33 +00:00
2025-02-03 12:44:47 +00:00
2025-04-09 13:16:15 +00:00
2024-10-08 14:32:26 -05:00
2025-03-30 18:58:33 +00:00
2025-04-23 14:03:19 +00:00
2025-06-17 17:46:35 +00:00
2025-03-30 18:58:33 +00:00
2025-07-15 20:22:57 +00:00
2025-03-30 18:58:33 +00:00
2025-06-19 11:17:01 +00:00
2025-03-30 18:58:33 +00:00
2025-03-30 18:58:33 +00:00
2025-06-25 13:40:38 +00:00
2025-07-23 18:56:37 +00:00
2024-11-19 22:29:57 +02:00
2025-04-14 09:05:29 +00:00
2025-07-10 14:39:38 +00:00
2025-03-30 18:58:33 +00:00
2025-04-04 17:30:58 +00:00
2025-03-30 18:58:33 +00:00
2025-04-28 17:24:55 +00:00
2025-04-11 09:38:05 +00:00
2025-07-17 08:57:36 +00:00
2025-07-02 16:30:47 +00:00
2025-03-30 18:58:33 +00:00
2025-03-30 18:58:33 +00:00
2025-06-10 05:32:03 +00:00
2025-05-30 15:20:46 +00:00
2025-03-30 18:58:33 +00:00
2025-07-23 22:37:27 +00:00
2025-03-30 18:58:33 +00:00
2025-02-25 12:23:04 +00:00
2025-02-03 12:44:47 +00:00
2025-04-02 10:43:05 +00:00
2025-03-30 18:58:33 +00:00
2025-03-30 18:58:33 +00:00
2025-03-30 18:58:33 +00:00
2025-06-10 08:46:29 +00:00
2025-05-12 15:48:48 +00:00
2025-03-30 18:58:33 +00:00
2025-07-23 17:43:43 +00:00
2025-03-30 18:58:33 +00:00
2025-07-29 14:23:42 +00:00
2025-03-30 18:58:33 +00:00
2025-07-23 16:12:46 +00:00
2025-03-30 18:58:33 +00:00
2025-07-23 20:11:34 +00:00
2025-05-20 15:38:27 +00:00
2025-07-21 18:16:28 +00:00
2025-05-09 07:48:30 +00:00
2025-06-20 10:33:11 +00:00
2025-06-06 11:54:07 +00:00
2025-07-31 09:29:25 +00:00
2025-03-30 18:58:33 +00:00
2025-07-24 18:41:29 +00:00
2025-02-28 21:07:21 +00:00
2025-05-12 15:48:48 +00:00
2025-04-25 14:28:56 +00:00
2025-07-25 18:09:34 +00:00
2025-06-19 11:17:01 +00:00
2025-07-09 15:22:54 +00:00
2025-03-30 18:58:33 +00:00
2025-06-05 11:43:04 +00:00
2025-06-05 11:43:04 +00:00
2025-06-12 08:10:22 +00:00
2025-03-30 18:58:33 +00:00
2025-03-30 18:58:33 +00:00
2025-07-29 09:47:39 +00:00
2025-03-30 18:58:33 +00:00
2025-03-30 18:58:33 +00:00
2025-07-28 16:27:55 +00:00
2025-03-30 18:58:33 +00:00
2025-06-27 15:14:55 +00:00
2025-03-30 18:58:33 +00:00
2025-07-11 18:56:39 +00:00
2025-06-23 22:26:38 +00:00
2025-03-30 18:58:33 +00:00
2025-03-30 18:58:33 +00:00
2025-03-30 18:58:33 +00:00
2024-10-08 14:32:26 -05:00
2024-10-28 17:47:15 -05:00
2025-03-30 18:58:33 +00:00
2024-11-14 17:19:13 +02:00
2025-06-19 11:17:01 +00:00
2025-07-30 19:10:33 +00:00
2025-07-04 10:25:03 +00:00
2025-07-14 16:37:04 +00:00
2025-03-30 18:58:33 +00:00