fix: Optimize creation of changesets from collections #335
+160
−62
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.
Previously, we worked to cache the changset -> collections process as it
is used in many different places. There are multiple places where a
changeset is created from a collection. With this change, we take
advantage of this knowledge, and pre-cache the collection that created
the changeset, preventing us from doing the conversion at all.
Note
Introduce NewChangeSetFromCollections and refactor data sources/tests to build and pass collections directly, avoiding redundant conversions.
NewChangeSetFromCollectionsto construct aChangeSetdirectly from[]ldstoretypes.Collection, caching collections and generatingchangesviacollectionsToChanges.internal/datasourcev2/fdv1_polling_data_source.go): useNewChangeSetFromCollectionswith existing collection data instead ofChangeSetBuilder.ldfiledatav2/file_data_source_impl.go): build flag/segment collections directly (viainsertDataIntoCollection) and return aChangeSetviaNewChangeSetFromCollections.ldtestdatav2: construct full-transfer collections for flags/segments and useNewChangeSetFromCollectionsto produce theChangeSet.Written by Cursor Bugbot for commit 392183b. This will update automatically on new commits. Configure here.