Repository navigation
Conversation
endUpdate() applied valuesToSet before valuesToClear. A record modified in a delta arrives as a removed ordinal and an added ordinal carrying the same value, so the value was set and then immediately cleared: a record whose indexed value did not change dropped out of the set, and a record that started matching the predicate was never added. Don't clear values that the delta also sets. Netting the two sets, rather than only clearing first, also avoids a transient miss for concurrent readers, since the live set is updated in place when no resize is needed. The set-then-clear order dates back to a1145ab (2017-08-14), so every release that includes HollowSparseIntegerSet (v2.7.0 onward) is affected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
HollowSparseIntegerSet.endUpdate()appliedvaluesToSetbeforevaluesToClear. A record modified in a delta arrives asremovedOrdinal(old)+addedOrdinal(new)carrying the same value, so the value was set and then immediately cleared:Fix: drop values from
valuesToClearthat the delta also sets. Netting the two sets, rather than only reordering to clear-then-set, also avoids a transient miss for concurrent readers, because the live set is updated in place when no resize is needed. Also removes the two stale comments around the loops (duplicate counting was removed in 2017; "first clear" no longer matched the code).The class was originally written clear-then-set (7130286); a1145ab (2017-08-14) swapped the order, so every release since v2.7.0 is affected.
Testing
HollowSparseIntegerSetTest.testDeltaKeepsValuesOfModifiedRecords: a delta that renames a 2009 movie (must stay indexed) and moves another movie into 2009 (must be added). Fails without the fix.com.netflix.hollow.core.index.*tests pass (252).🤖 Generated with Claude Code