Repository navigation
fix: correct IPv4 and IPv6 function semantics - #28800
Conversation
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? |
b785b6d to
abd2719
Compare
|
CI triage and rebase update:
The branch was rebased onto current |
|
Pure rebase update: started from upstream PR head |
XuPeng-SH
left a comment
There was a problem hiding this comment.
GPT-6 medium deep review at exact head 30b5680.
P2 — explicit REAL INET_NTOA conversion rounds differently from MySQL. At pkg/sql/plan/function/func_unary.go:8099, INET_NTOA(CAST(1.5 AS DOUBLE)) uses round-to-even and yields .2 instead of MySQL's truncating .1; near the maximum IPv4 value the current path can return NULL instead of the maximum address.
P2 — mixed-version overload fence is absent. New overload IDs 4–8 are not covered by a protocol/admission/remote capability fence, so a distributed expression can reach an older CN whose registry only knows IDs 0–3 and fail overload lookup.
|
Scope completion after the review challenge:
Commit: Focused UT, focused race, and full native CGo-linked |
|
Follow-up after the exact-head re-review (
GPT-6 medium reviewed exact head |
|
Rebase conflict resolution update for |
XuPeng-SH
left a comment
There was a problem hiding this comment.
GPT-6 medium deep review at 363b00b450cdf1475f832ffeb5e20bfb86749467 — PASS; no blocking findings.
I reviewed the IPv4/IPv6 parser contract, strict dotted-quad validation for IS_IPV4, short-form compatibility retained only for INET_ATON, IPv6 and IPv4-mapped/compatible classification, numeric INET_NTOA range/rounding behavior, generated-column and persisted-expression rollout gates, and remote protocol dispatch. The current implementation separates strict consumers from MySQL short-form INET_ATON parsing and fences persisted expressions by the protocol-version marker, so a legacy serialized expression is not silently executed with the new semantics. Focused IP tests pass locally (go test -mod=readonly ./pkg/sql/plan/function -run 'Test.*(IP|Inet|INet|inet)' -count=1, 2.7s), and current-head CI is green. No concrete incorrect-result, rollout, or compatibility blocker found.
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #28214
Fixes #28215
Fixes #28216
Fixes #28217
What this PR does / why we need it:
INET_ATON, including one-, two-,three-, and four-part decimal forms. The mappings are
a→0.0.0.a,a.b→a.0.0.b,a.b.c→a.b.0.c, anda.b.c.dunchanged. Leadingzeroes are decimal, every part remains bounded to
0..255, and malformedsigns, whitespace, empty parts, excess parts, and out-of-range parts return
NULL.IS_IPV4and the IPv4 form ofINET6_ATONon the strict four-partparser; adding historical
INET_ATONabbreviations does not broaden thoseconsumers.
INET_NTOAinput signedness and type-specific conversion. Validateafter conversion/rounding, before narrowing, so negative or out-of-range
values cannot wrap into another IPv4 address. DECIMAL remains exact and
rounds half away from zero; FLOAT/DOUBLE uses ties-to-even and rejects
non-finite values.
(including IPv4-mapped IPv6) remains sixteen bytes, and mapped formatting
includes
::ffff:.IS_IPV6recognizes mapped values,IS_IPV4does not,and IPv4-compatible classification excludes
::and::1.No shared cache, background work, or retained state is introduced. The short
form parser uses fixed-size stack storage and bounded arithmetic; ordinary
four-part and numeric paths remain vectorized.
Validation
./.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -run 'TestIPv4ParsingPolicies|TestIPFunctionRegisteredExecutors|TestIPFunctionsSelectionMasksInvalidRows' ./pkg/sql/plan/function— pass.-race— pass../.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s ./pkg/sql/plan/function— pass (12.8s).-race -count=1— pass (33.2s).golangci-lint --new-from-rev=30b568022b3c -- ./pkg/sql/plan/functionwith the repository native include flags —
0 issues.license-eye -c .licenserc.yml header checkon the four changed files —valid/ignored as expected.
gofmtandgit diff --check— pass.test/distributed/cases/function/func_misc_inet.testand itsreviewed
.resultnow cover scalar, VARCHAR-column, short-form, leading-zero,malformed, and mapped-IPv6 controls. A clean service-side mo-tester run is
still pending; no BVT pass is claimed here.
The prior CheckpointChaos2 timeout was a pre-existing timing-sensitive test
covered by #20956 and is unrelated to this function change. The PR remains on
the non-default feature branch; CI is not being awaited for this update.
Rollout compatibility
Additional validation
TestPersistedIPFunctionProtocolAdmission,TestPersistedIPFunctionProtocolAdmissionAcrossOwners, andTestPersistedIPFunctionProtocolAdmissionForCatalogBuilderspass.TestPersistedIPFunctionAlterTargetAdmissionpasses for v70/v71 and replacement/no-replacement ALTER targets../.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=180s ./pkg/sql/plan ./pkg/sql/compile— pass.363b00b450— no P0–P2 blocker.The earlier review note claiming REAL
INET_NTOAshould round 1.5 to 1 was withdrawn after checking MySQL'sItem_float::val_int()behavior (rint, ties-to-even); no code change is required for that point.Rebase correction
mainalready uses MORPC v71 for checked integer arithmetic (fix(function): preserve mixed integer arithmetic domains #28704). The IP semantic fence and all persisted-IP admission checks therefore use the next protocol epoch, v72; the main v71 detector and sender/receiver checks are preserved unchanged.363b00b450and found no P0–P2 blocker. The prior v71-labelled experimental build is not part of the supported upgrade chain.