Ghostferry misses data for PK values of <= 0

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

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

  • #465 @driv3r による — マージされずにクローズ

評価

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

調査の方向性

Start with the DataIterator and DefaultBuildSelect/BuildSelect functions to trace how the first batch bounds primary-key values. Review the related BinlogStreamer, InlineVerifier, and BinlogWriter behavior described in the issue. Done means pre-existing rows with primary-key values -1 and 0 are handled or an explicit loading error is raised, with tests covering the affected cases.

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

説明

Bug

If a table t has a single column id bigint(20) (also the PK) with records -1, 0, 1, 2, 3. Ghostferry will silently not copy data where id <= 0. There are two related causes:

  1. For the negative number case, this is because Ghostferry assumes that the PK is an uint64.
  2. For the 0 case, the DefaultBuildSelect selects rows where PK > 0 in the first iteration, which misses the record for 0.

This only happens if Ghostferry is started and these records already exists in the database as only the DataIterator misses these records. The BinlogStreamer will stream these records if they are inserted. This also means the InlineVerifier will miss these records as well and will not emit an error unless these records are also UPDATEd during the course of the transfer. When the record is updated, since it doesn't exist on the target, the BinlogWriter won't be able to update it (as the previous state on the target database doesn't match what the binlog event suggests). This means the row will be added to a reverify queue. The subsequent fingerprinting attempt will always yield different result from the source and the target. This means that there is a chance for the InlineVerifier to catch this (which is how we found it), but it is not guaranteed.

The first case is hard to fix. Perhaps we should detect such record exists and raise an error during table loading. For the 0 case, we need to review the BuildSelect functions to make sure that 0 can be included.

主要言語
Go
スター
858
フォーク
77
平均マージ
10日 4時間
マージ済み PR(30日)
4

環境構築

  • Dockerfile または Docker Compose ファイルあり
  • プルリクエストのテンプレートなし
  • コントリビューションガイドなし

はじめの一歩

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

Shopify/ghostferry のほかの issue

Shopify/ghostferry の issue をすべて見る

似ている issue

Go の issue をもっと見る

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

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