Skip to content

Sync with upstream trunk (1 commit) - #10

Open
batonac wants to merge 1 commit into
d1-supportfrom
upstream-sync
Open

Sync with upstream trunk (1 commit)#10
batonac wants to merge 1 commit into
d1-supportfrom
upstream-sync

Conversation

@batonac

@batonac batonac commented Sep 2, 2026

Copy link
Copy Markdown
Member

Automated sync of WordPress/sqlite-database-integration@trunk into d1-support.

This pull request tracks every upstream commit that has not landed on d1-support yet.
It is updated in place as upstream moves, and merges itself once the merge is clean and
every check is green. While it is open, it needs a person.

Upstream commits (1)

Merge conflicts (1 files)

d1-support cannot absorb these changes automatically, so this branch mirrors the
upstream trunk and no checks will run until the conflicts are resolved:

  • packages/mysql-on-sqlite/src/sqlite/class-wp-mysql-on-sqlite.php

Resolve them by merging the base branch into this one:

git fetch origin
git checkout -B upstream-sync origin/upstream-sync
git merge origin/d1-support   # resolve the conflicts, then commit
git push origin upstream-sync

Branch shape: mirror. Maintained by upstream-sync.yml. Closing this pull request is not permanent — the next scheduled run reopens it. Disable the workflow to stop the sync.

## What?

Align SQL savepoint handling with MySQL semantics.

A standalone `SAVEPOINT` in the default autocommit mode no longer opens
an SQLite transaction. It is discarded immediately, so following writes
use the normal `BEGIN IMMEDIATE` wrapper and commit independently.

Inside explicit transactions, track active savepoint names to emulate
MySQL behavior for nested savepoints, reused and case-insensitive names,
`ROLLBACK TO`, `RELEASE`, and missing-savepoint error 1305.
Missing-savepoint errors leave the surrounding transaction active.

Add regression coverage across the MySQL-on-SQLite, concurrency, PDO
API, and WordPress integration test suites.

## Why?

SQLite treats a standalone `SAVEPOINT` as opening a transaction, but
MySQL does not. Passing it through to SQLite created a hidden
transaction on PHP versions before 8.4. Subsequent writes then either
attempted a nested `BEGIN IMMEDIATE` or bypassed the normal
write-locking path, depending on how the transaction state was tracked.

The original Data Machine reproduction relied on SQLite-only behavior:
issuing a bare `SAVEPOINT`, performing a write, and committing with
`RELEASE SAVEPOINT`. Real MySQL and MariaDB discard the standalone
savepoint, so the later release reports error 1305. That downstream
issue is tracked in Extra-Chill/data-machine#3436.

> [!NOTE]
> Consumers that relied on a bare `SAVEPOINT` opening a transaction on
SQLite must open an explicit transaction instead, matching MySQL
behavior.

Fixes WordPress#495

---------

Co-authored-by: Jan Jakeš <jan@jakes.pro>
@batonac batonac added upstream-sync Automated sync with the WordPress upstream upstream-conflict Upstream sync needs a manual merge labels Sep 2, 2026
@batonac

batonac commented Sep 2, 2026

Copy link
Copy Markdown
Member Author

This sync does not merge cleanly into d1-support. 1 file(s) conflict:

  • packages/mysql-on-sqlite/src/sqlite/class-wp-mysql-on-sqlite.php

Checks cannot run until this is resolved — GitHub has no merge commit to test. Resolve
by merging the base branch into this one, and the pull request merges itself once the
suites go green:

git fetch origin
git checkout -B upstream-sync origin/upstream-sync
git merge origin/d1-support   # resolve the conflicts, then commit
git push origin upstream-sync
93b276adb5ea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

upstream-conflict Upstream sync needs a manual merge upstream-sync Automated sync with the WordPress upstream

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants