0.7 migration can deadlock with a live released 0.6 fleet on awa.deferred_jobs

オープン
#877 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
postgresql, rust
領域
backend, databases

調査の方向性

Start with rolling_upgrade_rehearsal_test -- --ignored and reproduce the failing 0.6.3 cell with Postgres log_lock_waits enabled and a lower deadlock_timeout. Trace the migration step that alters awa.deferred_jobs and the 0.6.3 promotion, rescue, or retry path to identify the lock order; compare that path with 0.6.19. Done when the deadlock is reproducible and a fix or operational requirement is supported by the rehearsal.

索引モデルが issue の本文から書いたものです。

説明

What was seen

A full local run of rolling_upgrade_rehearsal_test -- --ignored against awa-pg==0.6.3 failed test_binary_first_current_refuses_v040_then_rolls_after_migration. migrations::run hit a Postgres deadlock (40P01): the current migration's ALTER TABLE awa.deferred_jobs was waiting on a 0.6.3 backend, which was waiting on the migration. The cell passed 2 of 2 when rerun alone, so the deadlock is intermittent. The 6-cell run against 0.6.19 passed (#876).

Why it matters

0.6.2 and later are supported rolling-upgrade sources, and the upgrade guide allows migrating while a 0.6 fleet runs. A deadlock aborts the migration transaction. It can be retried, but an operator following the guide gets an error partway through.

To find out

  • Which migration step issues the ALTER TABLE awa.deferred_jobs, and what lock it takes.
  • What the 0.6.3 backend was doing (promotion, rescue or retry into deferred_jobs) and which lock it already held when it waited on the migration. Lock order is a likely cause: the migration locks another table first, then deferred_jobs, while the 0.6 path takes them in the opposite order.
  • Whether 0.6.19 can hit the same cycle, or whether the 0.6 path changed between 0.6.3 and 0.6.19.
  • Fix options:
    • take the migration's locks in the order the runtime uses;
    • add a lock_timeout and retry around that step;
    • document that this migration needs a quiet window for that table.

The failing cell's evidence (Postgres log with the deadlock detail) was not kept. Reproduce with the rehearsal against 0.6.3, log_lock_waits = on and deadlock_timeout lowered.

主要言語
Rust
スター
37
フォーク
8
平均マージ
14時間 16分
マージ済み PR(30日)
244

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

hardbyte/awa のほかの issue

hardbyte/awa の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。