Repository navigation
Database: Route locking reads to writable servers. - #244
Merged
Merged
Conversation
Recognize FOR SHARE and LOCK IN SHARE MODE alongside FOR UPDATE using the existing conservative possible-write heuristic. Cover primary and replica selection and record HyperDB 082a127 in the parity ledger. Props rebeccahum, vnsavage. See Automattic/HyperDB#192.
There was a problem hiding this comment.
🔵 Needs a closer look
Critical-risk database routing and persistent primary-affinity changes require an explicit human release decision because isolated tests do not establish live MySQL/MariaDB locking behavior.
No open issues 🎉
What changed in this PR
Ports HyperDB’s locking-read routing behavior into LudicrousDB’s connection selection while preserving conservative possible-write classification.
Changes:
- Routes
FOR UPDATE,FOR SHARE, andLOCK IN SHARE MODEto writable servers, with conservative handling of ambiguous comments. - Adds classification, writable-routing, primary-affinity, and scan-performance tests.
- Advances the upstream parity ledger through commit
082a127.
No actionable findings.
| File | Description |
|---|---|
UPSTREAM.md |
Records the upstream baseline and locking-read port. |
tests/LudicrousDBTest.php |
Adds routing, SQL edge-case, and performance coverage. |
ludicrousdb/includes/class-ludicrousdb.php |
Detects locking reads and routes ambiguous comment cases conservatively. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FOR UPDATE,FOR SHARE, andLOCK IN SHARE MODEthrough writable connections.082a127.Compatibility
This is a focused port of Automattic/HyperDB#192. It preserves the PHP 7.4 and WordPress 6.4 floors and does not change public APIs.
Validation
This remains a draft because a database drop-in routing change needs an explicit release decision.
Props rebeccahum, vnsavage.