Skip to content

fix: preserve native transaction and lock semantics - #391

Merged
chubes4 merged 10 commits into
mainfrom
fix/native-transaction-lock-parity
Sep 9, 2026
Merged

fix: preserve native transaction and lock semantics#391
chubes4 merged 10 commits into
mainfrom
fix/native-transaction-lock-parity

Conversation

@chubes4

@chubes4 chubes4 commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

Repair native savepoint semantics outside transactions, add root-scoped advisory locks with logical connection ownership, and support conditional option-value updates under the existing mutation lock.

Lock files remain stable across ownership transfer to avoid split-inode races. Reentrant acquisition, release/close, stale-file handling and multisite ownership have independent-process coverage. Supported waits are explicitly bounded to10 seconds. Conditional option updates use supported ASCII nonbinary collation semantics; explicit BINARY comparison remains byte-exact. Unsupported Unicode collation remains an explicit limitation.

Verification

Exact candidate:3fb04a00c169895f861c0f4dde9ea531cdb237b7, based on main91ef5e7.

  • Parent independently passed option-query, advisory-lock, WPDB lifecycle and transaction probes on Linux at the exact candidate.
  • Cross-process CAS contenders produce one affected row and one winner. The pre-opened lock-waiter test prevents regression of the split-inode race.
  • Savepoint behavior was compared with MariaDB11.4 for autocommit on/off and preserves inactive-session state.
  • Real paired DME VenueProfileMutationsTest on WordPress7.1/PHP8.3.32/PHPUnit9.6.35: native24 total =19 passed,1 failed,3 errors,1 skipped; MySQL8.4 control24 total =23 passed,1 skipped.
  • Prior lock and conditional-update failures no longer recur. Loaded candidate hashes were checked in the actual managed runtime during investigation, separately from recipe revision metadata.

Remaining venue differences are explicit: native accepts a foreign-site attachment that MySQL rejects; three tests require physical mysqli access. Event-upsert unit tests rewrite lock queries to SELECT1, whose support is separate work in #393. No full consumer-parity claim is made.

Reproduction

php tests/smoke-native-option-query.php
php tests/smoke-native-advisory-locks.php
php tests/smoke-native-wpdb-lifecycle.php
php tests/probe-native-transaction-semantics.php

For the paired consumer run, use wp-codebox's managed multisite wordpress.phpunit command with plugin-slug=data-machine-events, test-file=tests/Integration/VenueProfileMutationsTest.php, database-type=mdi-native versus mysql, the pinned DME source88d55a907b12638e88baee5b492501dbed5c2665, Data Machine dependency31befb659aaa5268e79a0c28a16321c3ee5e1108, and managed wp-phpunit harness. Override the MDI extra-plugin source with this candidate without retaining the bundled archive digest, and verify loaded PHP file hashes.

Supports #377, which remains open. No release or deployment is included.

AI Assistance

OpenAI GPT-5.6 Terra (openai/gpt-5.6-terra) via OpenCode implemented repairs and ran paired consumer verification. GPT-6 Astra (openai/gpt-6-astra) via OpenCode reviewed lock races, result semantics, source provenance and collation, independently reran the exact candidate's Linux gates, and finalized this scoped improvement under Chris Huber's direction.

@chubes4
chubes4 marked this pull request as ready for review September 9, 2026 12:23
@chubes4
chubes4 merged commit fe66476 into main Sep 9, 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