Skip to content

[MINOR][CORE][3.5] Avoid accidental collisions in SHS using LevelDB - #58616

Closed
holdenk wants to merge 1 commit into
apache:branch-3.5from
holdenk:111-kvstore-index-validation-branch-3.5
Closed

holdenk wants to merge 1 commit into
apache:branch-3.5from
holdenk:111-kvstore-index-validation-branch-3.5

Conversation

@holdenk

@holdenk holdenk commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

String index values are copied verbatim into store keys, so an embedded key separator (0x00) corrupts the index key structure and mixes entries across range scans and deletes. Fail fast with IllegalArgumentException in LevelDBTypeInfo and RocksDBTypeInfo instead.

This is a backport of 23fdef7

@pan3793 pan3793 changed the title [MINOR][CORE][BACKPORT] Avoid accidental collisions in SHS using LevelDB [MINOR][CORE][3.5] Avoid accidental collisions in SHS using LevelDB Sep 8, 2026

@HyukjinKwon HyukjinKwon left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the backport! Reviewed against branch-3.5. One structural issue; the code itself looks good.

This PR bundles a commit that is already on branch-3.5. There are two commits here:

  • cfeb182 -- "Improve handling of fetches with null and non-null stream ids": changes OneForOneStreamManager and three network-common test suites.
  • 4182b12 -- "[MINOR][CORE] Avoid accidental collisions in SHS using LevelDB": the KVStore change the PR body describes.

The first commit is already merged to branch-3.5 as 3551b280 (same commit message), and OneForOneStreamManager.java is byte-for-byte identical between this PR's head and the current branch-3.5 tip. GitHub's compare reports the branch as diverged (ahead 2 / behind 2). The large network-common diff shown by gh pr diff is only an artifact of diffing against the older merge-base rather than the current branch tip.

Could you rebase onto the latest branch-3.5? The duplicate network commit will drop out, leaving only the KVStore change, which matches the title and description. As-is, the network portion of the diff adds nothing over what is already on the branch and makes the PR harder to read.

The KVStore change itself LGTM. 4182b12 is a faithful backport of master's 23fdef7 (same four files, +9 lines each). The key-separator (0x00) check is correct: getBytes(UTF_8) emits a 0x00 byte only for the U+0000 character, and the array key path routes each element back through the same String branch, so the test case that passes a String array whose element contains an embedded 0x00 is genuinely exercised. Failing fast is the right behavior, since such values were silently corrupting index keys before.

nit: the description covers only the KVStore backport; please also mention (or, after the rebase, drop) the network change so the PR body matches its contents.

@holdenk
holdenk force-pushed the 111-kvstore-index-validation-branch-3.5 branch from 4182b12 to 9b8f3c2 Compare September 10, 2026 11:00
@holdenk
holdenk force-pushed the 111-kvstore-index-validation-branch-3.5 branch 2 times, most recently from 34f0e91 to 825f887 Compare September 18, 2026 01:13
String index values are copied verbatim into store keys, so an embedded
key separator (0x00) corrupts the index key structure and mixes entries
across range scans and deletes. Fail fast with IllegalArgumentException
in LevelDBTypeInfo and RocksDBTypeInfo instead.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Holden Karau <holden@pigscanfly.ca>
@holdenk
holdenk force-pushed the 111-kvstore-index-validation-branch-3.5 branch from 825f887 to 7998c08 Compare September 24, 2026 06:18
asf-gitbox-commits pushed a commit that referenced this pull request Sep 25, 2026
String index values are copied verbatim into store keys, so an embedded key separator (0x00) corrupts the index key structure and mixes entries across range scans and deletes. Fail fast with IllegalArgumentException in LevelDBTypeInfo and RocksDBTypeInfo instead.

This is a backport of 23fdef7

Closes #58616 from holdenk/111-kvstore-index-validation-branch-3.5.

Lead-authored-by: Holden Karau <holden@pigscanfly.ca>
Co-authored-by: Holden Karau <holden.karau@snowflake.com>
Signed-off-by: Holden Karau <holden.karau@snowflake.com>
@holdenk

holdenk commented Sep 25, 2026

Copy link
Copy Markdown
Contributor Author

Merged to 3.5

@holdenk holdenk closed this Sep 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants