Repository navigation
fix(databases): load transaction metadata once per database and table - #14190
Conversation
Security rulesNo new WARNING or ERROR findings from security rules. 6 existing findings tracked in
|
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
511a0aa to
d3251d9
Compare
The commit event loop called find() for the database and table documents on every staged operation. find() is not served from the document cache, so those lookups grew with the number of operations. Keep each document next to the adapter cache, the same way staged operations memoize a database and table. The commit event test covers two tables so a reused document cannot be reported as the other table. Fixes #14176
d3251d9 to
d9eec6d
Compare
getLastRequestForProject returns an empty array when no delivery matches. Fail there before reading payload fields.
|
@hansi-codes review |
🟢 Tier S · Ready to mergeThe transaction commit event loop now caches database metadata, collection metadata, and database adapters by their internal identifiers while publishing events. The E2E transaction test now commits operations across two collections and verifies each webhook payload uses the correct surface identifiers.
📂 Walkthrough · 2
Reviewed |
…mmit-metadata-cache-4f1b # Conflicts: # tests/e2e/Services/Databases/Transactions/TransactionsBase.php
|
Review complete. No issues found — approved ✅. This PR speeds up committing transaction operations that span multiple databases and collections by caching the resolved database document and collection metadata instead of re-resolving them per operation, and extends the transactions e2e suite with webhook-based verification of cross-collection commit behavior.
No findings met the review threshold; the refactor preserves the existing lookup semantics. Reviewed commit: 2c1322c |
What does this PR do?
Transaction commit republished events by calling
find()for the database document and the table document on every staged operation.find()is not served from the document cache, so a commit of N writes paid those two metadata queries N times (see #14176).The event loop now keeps each database document, table document, and database adapter, and loads each one once. This is the same
??=memoization used when operations are staged. The usage metrics loop is unchanged.TablesDB, DocumentsDB, and the legacy Databases API all commit through this action.
The schema map built with
getCollection()while applying operations is a different document (internal id, attributes, indexes). Events need the project metadata document (public id,documentSecurity, permissions), so that map is not reused. The post-commit read of the changed row is unchanged.Test Plan
php -lon the commit action andTransactionsBasetestCommitEventPayloadCarriesSurfaceIdsnow commits two tables and checks that each webhook payload carries its own database id and table idRelated PRs and Issues
Checklist