Database restore loses data when a row is larger than max_allowed_packet

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

@rafaelmaeuer がすでに取り組んでいます。

2026年10月29日 から。

  • #249 @rafaelmaeuer による — オープン

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
mariadb, mysql, php
領域
backend, database

調査の方向性

The issue identifies the database dump and import code but names no files or tests. Start by tracing where dump rows are batched and where restore statements are executed, then inspect the open pull request for the proposed approach. Done means large rows are isolated, oversized statements are split during restore, and a lost connection stops the restore with a clear message.

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

説明

Describe the bug
Restoring a backup with large rows fails in the database step. BackWPup's dump batches rows into multi-row INSERTs and only starts a new one after the statement is already over 50000 characters, so a statement can take several multi-megabyte rows. When such a statement exceeds the database server's max_allowed_packet, the server drops the connection and data is lost.

To Reproduce

  1. Use a site with a large option row, e.g. All-In-One WP Security's aiowps_plugin_checksums (about 16 MB with ~40 plugins).
  2. Use a database server with the default max_allowed_packet of 16 MB (MariaDB/MySQL default).
  3. Create a backup including the database and restore it.

Observed
Database server log:

[Warning] Aborted connection ... (Got a packet bigger than 'max_allowed_packet' bytes)

With a direct mysqli connection, the restore log then contains hundreds of MySQL server has gone away errors and ends with ... SET FOREIGN_KEY_CHECKS = 1; everything after the failing statement is missing. In the reported case one INSERT INTO wp_options was about 18 MB (a 1.4 MB and a 16.7 MB row plus 50 small rows).

Expected behavior
Large rows are written into their own statement by the backup, oversized statements are split on restore, and a lost connection stops the restore with a clear message.

System

  • BackWPup 5.7.8 (same dump/import code as 4.x)
  • PHP 8.3, MariaDB with default max_allowed_packet (16 MB)

A fix is ready as a pull request.

主要言語
PHP
スター
96
フォーク
48
PR マージ指標
30日以内にマージされた PR はありません

環境構築

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

はじめの一歩

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

wp-media/backwpup のほかの issue

wp-media/backwpup の issue をすべて見る

似ている issue

PHP の issue をもっと見る

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

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