fix(jdbc): handle trailing-slash mismatch in optimized sibling overlap check#5003
fix(jdbc): handle trailing-slash mismatch in optimized sibling overlap check#5003vigneshio wants to merge 2 commits into
Conversation
dimas-b
left a comment
There was a problem hiding this comment.
Thanks for the fix, @vigneshio !
0f9d42e to
4499504
Compare
dimas-b
left a comment
There was a problem hiding this comment.
LGTM 👍 Thanks again, @vigneshio !
Please resolve conflicts.
e05866b to
b8be0c4
Compare
|
Let's collect some more reviews since it's not a trivial area of the codebase 😅 |
… fix Disable ADD_TRAILING_SLASH_TO_LOCATION in overlap profiles so parent locations are stored without a trailing slash, and assert the stored location remains slash-less. Without that, default slash normalization masked the OPTIMIZED_SIBLING_CHECK false negative this PR fixes.
b8be0c4 to
96f6f7c
Compare
|
Thanks for bringing this PR to my attention. I'm not opposed to the changes, but I have two general questions before approving:
|
Thanks for taking a look, @adutra
ltree + I think this PR is the least worst portable fix for the false-negative, and both ideas could be separate optimizations later. WDYT? |
flyingImer
left a comment
There was a problem hiding this comment.
The fix looks right to me, and it's fixing a real false negative, isChildOf only drops candidates, it never adds one back, so a missed ancestor stays missed. I wonder how you're planning to fold this in with #5029 though, the two step on the same lines: this PR deletes the loop #5029 patches, and your new tests here still assert / and //, exactly what #5029 removes.
Plan is to land this one first since it's the correctness fix, then rebase #5029 on top. on the tests - yeah, this pr still emits |
TBH I still think that
Why not? For example, #4981 is introducing a migration script.
Agreed – I was just thinking out loud. |
|
I'm a bit confused... Are we ok to merge this "as is"? 🤔 |
Fixes a false-negative in the JDBC optimized location-overlap check (
OPTIMIZED_SIBLING_CHECK).When an ancestor location was stored in
location_without_schemewithout a trailing slash, the generated overlap query could not find it: the ancestor equality terms always ended in/, and theLIKEclause only matched descendants. The Java post-filter (isChildOf) never ran on the missing row, so nested table/namespace locations could be created under existing prefixes.Changes
QueryGenerator.generateOverlapQuerynow emits each ancestor prefix in both slash-terminated and non-slash-terminated forms.LIKEpattern is now slash-terminated so it matches true descendants (e.g.//bucket/ns/tA/child) without matching unrelated sibling prefixes (e.g.//bucket/ns/tA_backup).QueryGeneratorTestexpectations and added coverage for a location without a trailing slash.Checklist