Repository navigation
Conversation
(cherry picked from commit cef0b72)
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
APPROVE for head 1d14bc3, against 4.2-dev e93a5d2. No blocking findings.
Reviewed all four changed files and the sorted/linear prefix helpers, byte comparison, cached ObjectIO term dispatch and OR union consumers. The first owner of the invariant is the sorted selection factory: independently computed [start,end) is empty whenever start >= end. The change closes the negative-length allocation at that boundary. Keeping the two search predicates intact preserves shorter-upper-prefix matches such as lower=1221/upper=12; rejecting bytewise reversed arguments before searching would be incorrect. Empty offsets contribute no rows to an OR union and do not erase the other term.
The design is proportionate: one condition, no extra state/validation layer, fallback scan, per-row work, allocation or format change. Normal nonempty ranges retain the same computation. Existing numeric/string range helpers already use this empty-range invariant. No new concurrency, persistent-data or upgrade contract is introduced.
Test review: the existing six-key fixture is extended rather than duplicated; explicit offset oracles cover forward/equal/short-upper-prefix/reversed/missing/empty cases and are supplemented by the linear helper. The 256-row persisted-index BVT covers fresh/reused handles, forward/reversed/recovery, NULL, overlap, mixed OR and literal/no-index controls, with cleanup. The expected rows were inspected independently. Implementation is +1/-1, tests +177/-19, documentation +0/-0; the test growth covers distinct boundaries.
Verified identical stable patch-id with Main #29645 and checked the branch-specific ObjectIO consumer contract. Reused the author's exact-backport before/after helper and SQL/BVT validation recorded in #29644, and the current-head successful SCA, UT, coverage and multi-CN BVT checks. Local native test execution was blocked by missing branch-matching libmo; it is not reported as a local pass. No blocking validation gap remains given the branch-specific execution evidence and current-head CI.
Comment audit: no human review or inline thread is outstanding; only the Qodo pause notice. Scope remains #29644, not the separate parameter normalization/performance work in #29606.
What type of PR is this?
Which issue(s) this PR fixes:
issue #29644
What this PR does / why we need it:
Cherry-pick of Main PR #29645, commit
cef0b7215fd10bd31ec73c19c1ddf9f7889cf39a, onto fresh4.2-deve93a5d20524d17e2a89100ce609cf67a45d13aa6. Applied with-x, withoutconflicts or branch-specific adaptations. The Main PR was still open when
this user-requested backport was prepared; its patch content is identical.
The same reversed Prepared BETWEEN panic has been observed in the 4.2 Daily
and independently reproduced on an older 4.2 image. Sorted persisted-index
filtering independently searches lower/upper positions, but previously only
rejected
start == end. Reversed positions permit a negative-lengthselection allocation and a recovered SQL panic instead of an empty result.
Change the existing guard to
start >= end. Both binary-search comparisonsremain unchanged, including valid shorter-upper-prefix semantics. Previously
valid nonempty ranges keep the same searches, allocation and returned offsets.
No parameter conversion, planner, cache, distributed execution, index format
or other Main change is backported.
The original extended six-key helper UT and minimal 256-row persisted-index
Prepared BVT are included unchanged. The BVT covers reused/fresh handles,
forward/equal/overlapping/NULL bindings, mixed empty/nonempty OR ranges and
literal/no-secondary-index controls.
Tested with:
1d14bc3476ec3d491cb71c765e0e2258c02f92c5on an isolatedLinux amd64 instance on 50; fresh branch-matching CGo artifacts and complete
make buildsucceeded with Go 1.26.4..agents/skills/mo-dev/scripts/mo-cgo-test -v -count=1 -timeout=120s -run '^TestCollectOffsetsByPrefixBetweenFactory$' ./pkg/container/vector:all 13 subtests pass.
./pkg/container/vectorand./pkg/objectionormal tests pass;go vet -mod=readonly ./pkg/container/vector ./pkg/objectiopasses withmatching CGo settings.
int64and SQL PREPARE probe on a 32,768-row persistedsecondary index: reversed ranges now return the independently expected empty
result, and forward/NULL/rebind/recovery/literal/no-index controls are correct.
All eight in-scope result-oracle checks pass.
all seven non-reversed probe records match the historical 4.2 records exactly.
This backport does not claim to repair type-normalization/overflow behavior.
statements pass twice on the same instance, zero ignored/abnormal statements,
zero BVT database residue after each run, and SELECT 1 succeeds afterward.
git diff --check: no unresolved blockers. No additional normal-range scan,copy, allocation, synchronization or I/O.
This is a narrowly scoped longstanding boundary-defect repair, not an
unvalidated broad Prepared-range optimization. Existing 4.2 numerical and
performance issues outside #29644 are not claimed to be fixed.