Repository navigation
fix(mqtt): scope stored push messages to the topic instance - #14867
Conversation
Stored push messages now record the topic's internal id. Replay and publish-side deduplication use it, the replay index moves to (topicInternalId, sequence), and deleting a topic deletes its stored messages, so a topic recreated under the same id starts clean. Messages stored before this change have no internal id and are not replayed; the existing age-based prune removes them within the retention window. V25 migration adds the attribute and swaps the index. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Review complete. 🟠 1 high 💬 Inline comments (1)
The change binds offline-message dedup and replay to a per-topic-instance identifier so a recreated topic under the same id no longer inherits its predecessor's ledger state. A V25 migration drops the old
Reviewed commit: 4c07219 |
🟢 Tier S · Ready to mergeThis PR binds MQTT push-ledger rows and replay cursors to a topic’s internal instance ID, preventing messages from a deleted topic from crossing into a recreated topic with the same public ID. It also removes a topic’s ledger rows on deletion and adds a V25 migration plus adapter, replay, migration, and MQTT end-to-end coverage. Latest changes: The newest commits also scope the ledger’s unique index to the topic instance, swap the index during V25 migration, and cover reused message IDs and pre-upgrade ledger rows.
📂 Walkthrough · 10
🔇 Filtered out · 1Findings Hansi considered but did not post.
Merged |
Security rulesNo new WARNING or ERROR findings from security rules. 6 existing findings tracked in
|
There was a problem hiding this comment.
This PR re-keys MQTT push-ledger deduplication, replay, and cleanup from the stable topic id to a per-topic-instance topicInternalId, with a V25 migration and new unit/e2e tests.
Key findings
- 🟠 Unique index
(messageId, topic)contradicts newtopicInternalIddedup key — common.php:389
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
Deduplication looks a message up by (messageId, topicInternalId), but the unique index still covered (messageId, topic). A topic recreated under the same id, or a row written before the instance binding, made the lookup miss while the insert collided, so the publish failed. The index now covers (messageId, topicInternalId); NULLs are distinct under it, so pre-upgrade rows never block a publish. V25 drops the old index and creates the new one. Co-Authored-By: Claude Opus 5.5 <[email protected]>
What does this PR do?
Stored push messages now record the topic's internal id. Replay and publish-side deduplication use it, the replay index moves to (topicInternalId, sequence), and deleting a topic deletes its stored messages, so a topic recreated under the same id starts clean. Messages stored before this change have no internal id and are not replayed; the existing age-based prune removes them within the retention window. V25 migration adds the attribute and swaps the index.
Test Plan
New unit tests in tests/unit/Mqtt/ReplayCursorTest.php, push adapter and V25Test additions, and e2e testRecreatedTopicDoesNotReplayDeletedTopicMessages. MQTT e2e 39/39, Messaging e2e, full unit suite and migrate on all projects pass. Lint, PHPStan and Rector are clean.
Related PRs and Issues
Checklist
🤖 Generated with Claude Code