Skip to content

fix(dev-env): use -o so myloader drops existing tables before import#2871

Merged
sjinks merged 1 commit into
trunkfrom
fix/dev-env-myloader-overwrite-tables
Jun 5, 2026
Merged

fix(dev-env): use -o so myloader drops existing tables before import#2871
sjinks merged 1 commit into
trunkfrom
fix/dev-env-myloader-overwrite-tables

Conversation

@WRasada

@WRasada WRasada commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Problem

vip dev-env import sql fails for every MyDumper-format dump imported into an environment that has any pre-existing tables — which is all of them, since a fresh dev-env ships with the default WordPress tables. myloader exits with code 133 (SIGTRAP via GLib g_error) after:

** (myloader): CRITICAL **: Thread N using connection M - ERROR 1050: Table 'wp_...' already exists
** (myloader): ERROR **: Thread N: issue restoring ...-schema.sql

Retrying after a partial import fails instantly for the same reason.

Root cause

vip-container-images#1463 bumped mydumper 0.18.1 → 0.21.3 in the php image. In myloader ≥ 0.20, --overwrite-tables was deprecated in favor of -o/--drop-table and re-registered as a bare boolean that no longer sets the purge mode, which stays at its default FAIL (myloader_arguments.c#L206, myloader_restore_job.c#L43). No DROP TABLE is ever issued — the overwrite_table() switch falls through to its This should not happen branch — and the first colliding CREATE TABLE is fatal.

Fix

Pass -o instead of the long flag in getImportArgs() (src/commands/dev-env-import-sql.ts). -o is correct on every myloader version:

myloader -o resolves to
≤ 0.19 short form of --overwrite-tables
≥ 0.20 short form of --drop-table, defaulting to DROP mode

Testing

  • Reproduced the 133/ERROR 1050 failure against a populated dev-env DB with --overwrite-tables; instant failure (<1s).
  • With -o, myloader emits Dropping table or view (if exists) ... per table and a 201,721-table production-scale dump imports over a populated database end to end.

Changelog Description

Fixed

  • Dev-env: Fixed SQL imports of MyDumper-format backups failing with ERROR 1050: Table already exists when the local database contains existing tables

Related

🤖 Generated with Claude Code

myloader >= 0.20 deprecated --overwrite-tables into a no-op that no longer
sets the purge mode, so imports fail with ERROR 1050 on any pre-existing
table. -o maps to the correct behavior on every myloader version.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@sonarqubecloud

sonarqubecloud Bot commented Jun 5, 2026

Copy link
Copy Markdown

@sjinks sjinks merged commit c844390 into trunk Jun 5, 2026
19 checks passed
@sjinks sjinks deleted the fix/dev-env-myloader-overwrite-tables branch June 5, 2026 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants