[core] Tolerate retracting an absent secondary index key - #10280
Open
LuciferYang wants to merge 1 commit into
Open
LuciferYang wants to merge 1 commit into
LuciferYang wants to merge 1 commit into
Conversation
InMemorySetState.retract dereferenced the per-key set without a null check, unlike the RocksDB sibling. The lookup refresh path retracts DELETE and UPDATE_BEFORE rows unconditionally while predicate-filtered INSERTs never add the secondary key, so a filtered-out row's delete crashed the lookup operator with an NPE. Skip the removal when the key is absent. Assisted-by: GLM-5.3
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.
Purpose
InMemorySetState.retractdidvalues.get(wrapBytes(serializeKey(key))).remove(...)with no null check, so retracting a key that was never added throws aNullPointerException. This is reachable in alookup.cache = MEMORYsecondary-index lookup join with a filter:SecondaryIndexLookupTable.refreshRowonly adds to the index state when the predicate passes (+I/+U) but retracts unconditionally on-D/-U, so a row that was filtered out is never added, and its later retract crashes the lookup refresh. The disk-backed siblingLocalKvSetState.retractalready treats an absent key as a no-op, so the same join crashes only inMEMORYcache mode.This adds the null guard so
InMemorySetState.retractno-ops on an absent key, matching the disk-backed contract. The present-key path is unchanged.This closes #10279.
Tests
InMemorySetStateTest#testRetractOnAbsentKeyIsNoOppins that retracting an absent key is a no-op. Without the fix it throwsNullPointerException.API and Format
No.
Documentation
No.