Repository navigation
Conversation
FeatureStoreDataSetSorter removed each item from the remaining set by the item's own :key. When that differed from the hash key (for example an FDv2 put-object whose envelope key differs from object.key), nothing was removed and the sort looped forever while holding the store lock. Track items by their map key, as the Go and Java SDKs do. SDK-3813
This branch has not been deployed
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.
Requirements
Related issues
SDK-3813. Found while reviewing the work for #504.
Describe the solution you've provided
FeatureStoreDataSetSorter.add_with_dependencies_firstremoved each item fromremaining_itemsbyitem[:key].to_sym. When the hash key differed from the item's own:key, nothing was removed anduntil remaining_items.empty?never ended. One trigger is an FDv2put-objectwhose envelope key differs fromobject.key, with a writable persistent store: the sort runs insideset_basiswhile holding theStorelock, so the data system spins at 100% CPU and every evaluation blocks. A string-keyed collection hung the same way.The sorter now tracks and outputs items by their map key. This matches Go (
internal/toposort) and Java (DataModelDependencies), which both key the sort by the collection key.Describe alternatives you've considered
Rejecting or normalizing a mismatched key in
protocolv2.rb. Go and Java store a put-object under its envelope key and do not compare it withobject.key, so the parser is left as it is.Additional context
python-server-sdk's sorter (
ldclient/feature_store.py_add_with_dependencies_first) deletes by the item's own key too. There it raisesKeyErrorinstead of looping, so the store init fails. That is tracked separately and not fixed here.