-
Notifications
You must be signed in to change notification settings - Fork 74
Change streaming cursors to start from last sync #2697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change streaming cursors to start from last sync #2697
Conversation
How to use the Graphite Merge QueueAdd the label mergequeue to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
Claude finished @neekolas's task —— View job Code Review - November 3, 2025, 7:44 PM UTC
Review Findings1. Behavior Change: Missing Topics Not Returned (Critical)The new In Ok(topics_of_kind
.into_iter()
.map(|topic| {
let cursor = cursors.remove(topic.identifier()).unwrap_or_default();
(topic.clone(), cursor)
})
.collect())✅ Good: This correctly returns default cursors for missing topics. However, in Ok(topics
.map(|topic| (topic.clone(), self.latest(topic).unwrap_or_default()))
.collect())✅ Good: This also returns default cursors. But in usage at let cursor = cursors.get(topic).cloned().unwrap_or_default().max();
2. Missing Test Coverage for
|
Batch-fetch latest cursors per topic to start streaming from the last sync by replacing
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2697 +/- ##
==========================================
- Coverage 77.33% 77.32% -0.02%
==========================================
Files 359 361 +2
Lines 53002 53161 +159
==========================================
+ Hits 40991 41105 +114
- Misses 12011 12056 +45 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
dd9bba8 to
e15dcf4
Compare
e15dcf4 to
0d5d147
Compare
Merge activity
|
### TL;DR Refactored cursor store API to efficiently handle multiple topics at once with the new `latest_for_topics` method. ### What changed? - Replaced `latest_maybe_missing_per` with a more efficient `latest_for_topics` method that handles multiple topics in a single call - Updated implementations in `InMemoryCursorStore` and MLS cursor store to support batch processing of topics - Modified the streams implementation to use the new API when subscribing to group and welcome messages - Made `TopicKind` derive `Hash` to support using it as a key in HashMaps ### How to test? - Verify that subscribing to group messages and welcome messages works correctly - Test with multiple topics to ensure the batch processing functions as expected - Check that cursor retrieval maintains the same behavior as before but with improved efficiency ### Why make this change? This change improves performance by reducing the number of database calls when working with multiple topics. Instead of making separate calls for each topic, we now batch them together, which is especially beneficial when subscribing to multiple groups or installations simultaneously. The new API is also cleaner and more intuitive for handling collections of topics.
### TL;DR Refactored cursor store API to efficiently handle multiple topics at once with the new `latest_for_topics` method. ### What changed? - Replaced `latest_maybe_missing_per` with a more efficient `latest_for_topics` method that handles multiple topics in a single call - Updated implementations in `InMemoryCursorStore` and MLS cursor store to support batch processing of topics - Modified the streams implementation to use the new API when subscribing to group and welcome messages - Made `TopicKind` derive `Hash` to support using it as a key in HashMaps ### How to test? - Verify that subscribing to group messages and welcome messages works correctly - Test with multiple topics to ensure the batch processing functions as expected - Check that cursor retrieval maintains the same behavior as before but with improved efficiency ### Why make this change? This change improves performance by reducing the number of database calls when working with multiple topics. Instead of making separate calls for each topic, we now batch them together, which is especially beneficial when subscribing to multiple groups or installations simultaneously. The new API is also cleaner and more intuitive for handling collections of topics.
0d5d147 to
cbe0d63
Compare
### TL;DR Refactored cursor store API to efficiently handle multiple topics at once with the new `latest_for_topics` method. ### What changed? - Replaced `latest_maybe_missing_per` with a more efficient `latest_for_topics` method that handles multiple topics in a single call - Updated implementations in `InMemoryCursorStore` and MLS cursor store to support batch processing of topics - Modified the streams implementation to use the new API when subscribing to group and welcome messages - Made `TopicKind` derive `Hash` to support using it as a key in HashMaps ### How to test? - Verify that subscribing to group messages and welcome messages works correctly - Test with multiple topics to ensure the batch processing functions as expected - Check that cursor retrieval maintains the same behavior as before but with improved efficiency ### Why make this change? This change improves performance by reducing the number of database calls when working with multiple topics. Instead of making separate calls for each topic, we now batch them together, which is especially beneficial when subscribing to multiple groups or installations simultaneously. The new API is also cleaner and more intuitive for handling collections of topics.
### TL;DR Refactored cursor store API to efficiently handle multiple topics at once with the new `latest_for_topics` method. ### What changed? - Replaced `latest_maybe_missing_per` with a more efficient `latest_for_topics` method that handles multiple topics in a single call - Updated implementations in `InMemoryCursorStore` and MLS cursor store to support batch processing of topics - Modified the streams implementation to use the new API when subscribing to group and welcome messages - Made `TopicKind` derive `Hash` to support using it as a key in HashMaps ### How to test? - Verify that subscribing to group messages and welcome messages works correctly - Test with multiple topics to ensure the batch processing functions as expected - Check that cursor retrieval maintains the same behavior as before but with improved efficiency ### Why make this change? This change improves performance by reducing the number of database calls when working with multiple topics. Instead of making separate calls for each topic, we now batch them together, which is especially beneficial when subscribing to multiple groups or installations simultaneously. The new API is also cleaner and more intuitive for handling collections of topics.

TL;DR
Refactored cursor store API to efficiently handle multiple topics at once with the new
latest_for_topicsmethod.What changed?
latest_maybe_missing_perwith a more efficientlatest_for_topicsmethod that handles multiple topics in a single callInMemoryCursorStoreand MLS cursor store to support batch processing of topicsTopicKindderiveHashto support using it as a key in HashMapsHow to test?
Why make this change?
This change improves performance by reducing the number of database calls when working with multiple topics. Instead of making separate calls for each topic, we now batch them together, which is especially beneficial when subscribing to multiple groups or installations simultaneously. The new API is also cleaner and more intuitive for handling collections of topics.