Skip to content

[PHP] Download db.sql before applying MySQL database pulls - #607

Closed
adamziel wants to merge 1 commit into
codex/resume-database-pull-applyfrom
codex/mysql-db-pull-confirmed-replay
Closed

[PHP] Download db.sql before applying MySQL database pulls#607
adamziel wants to merge 1 commit into
codex/resume-database-pull-applyfrom
codex/mysql-db-pull-confirmed-replay

Conversation

@adamziel

@adamziel adamziel commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

db-pull --sql-output=mysql now downloads all of db.sql before it changes MySQL.

Background

The direct MySQL path executed SQL while it arrived. If that process stopped, the saved source position could not say whether MySQL committed, rolled back, or was still running a query.

This change

MySQL output now uses the database-only pull sequence: preflight, file-backed db-pull, then db-apply. The existing MySQL options become target options for db-apply, and the direct mysqli::multi_query() path is removed.

A stopped download continues from the last saved file size and source position. MySQL remains untouched until the download finishes. If applying the SQL stops, the next process opens a new connection and starts db.sql from the beginning. That runs the SQL mode, foreign-key, unique-check, and autocommit settings again.

Existing unfinished direct-MySQL work remains rejected instead of being guessed or converted.

This is PR 5 of 5: #590#591#595#582#607.

Testing

The focused E2E stops after a file position is saved, checks that MySQL is still untouched, runs the same command again, and compares the finished target with the source. Its tables also require the SQL mode and foreign-key settings from the dump header.

@github-actions

github-actions Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Pull pipeline performance — large-directory

Site: large-directory · 2,000+ plus targeted file-transfer scenarios files · 10,000 posts · 25,000 postmeta · PHP 8.5.9

Stage PR trunk Δ Status Details
playground-sqlite-db-pull 9.84 s 9.93 s ⚪ -95 ms (-1.0%) condition=db-pull in PHP.wasm
runtime=php.wasm 8.3
wp_mysql_parser=enabled
mode=lexer
native_lexer=verified
native_token_stream=WP_MySQL_Native_Token_Stream
native_token_count=18
native_parser=selected
trunk: condition=db-pull in PHP.wasm
runtime=php.wasm 8.3
wp_mysql_parser=enabled
mode=lexer
native_lexer=verified
native_token_stream=WP_MySQL_Native_Token_Stream
native_token_count=18
native_parser=selected
playground-sqlite-db-apply 3.83 s 3.83 s ⚪ -3 ms (-0.1%) condition=db-apply to SQLite in PHP.wasm
runtime=php.wasm 8.3
wp_mysql_parser=enabled
mode=parser
native_lexer=verified
native_token_stream=WP_MySQL_Native_Token_Stream
native_token_count=18
native_parser=verified
native_ast=WP_MySQL_Native_Parser_Node
sqlite_driver_parser=verified
trunk: condition=db-apply to SQLite in PHP.wasm
runtime=php.wasm 8.3
wp_mysql_parser=enabled
mode=parser
native_lexer=verified
native_token_stream=WP_MySQL_Native_Token_Stream
native_token_count=18
native_parser=verified
native_ast=WP_MySQL_Native_Parser_Node
sqlite_driver_parser=verified
Total 13.67 s 13.76 s ⚪ -99 ms (-0.7%)

Numbers carry runner noise; treat single-run deltas as directional, not authoritative.

📈 Trunk performance history — commit-by-commit timeline.

@adamziel
adamziel force-pushed the codex/mysql-db-pull-confirmed-replay branch from 34beb98 to 8a382b8 Compare August 14, 2026 11:38
@adamziel
adamziel force-pushed the codex/resume-database-pull-apply branch 2 times, most recently from c77fa57 to 12d65b5 Compare August 14, 2026 12:53
@adamziel adamziel changed the title [PHP] Route MySQL db-pull through confirmed dump replay [PHP] Download db.sql before applying MySQL database pulls Aug 14, 2026
@adamziel
adamziel force-pushed the codex/mysql-db-pull-confirmed-replay branch from 8a382b8 to e47499b Compare August 14, 2026 12:55
@adamziel
adamziel force-pushed the codex/resume-database-pull-apply branch from 12d65b5 to cfae355 Compare August 14, 2026 12:58
@adamziel

Copy link
Copy Markdown
Collaborator Author

Closing this draft. It is being replaced by a smaller target-database checkpoint stack.

@adamziel adamziel closed this Aug 14, 2026
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.

1 participant