Skip to content

fix(function): format IPv4-compatible IPv6 addresses - #28447

Merged
XuPeng-SH merged 3 commits into
mainfrom
codex/issue-28389-inet6-compat
Sep 9, 2026
Merged

XuPeng-SH merged 3 commits into
mainfrom
codex/issue-28389-inet6-compat

Conversation

@XuPeng-SH

Copy link
Copy Markdown
Contributor

Fixes #28389

Problem

INET6_NTOA() formats IPv4-compatible IPv6 values with hexadecimal tails instead of the MySQL-compatible dotted-decimal form. For example, the 16-byte value 000000000000000000000000C0000201 was returned as ::c000:201 instead of ::192.0.2.1.

The binary value produced by INET6_ATON() is already correct; this is a formatting-only compatibility bug.

Root cause

The 16-byte path delegated every non-mapped address to Go's net.IP.String(). Go emits canonical hexadecimal IPv6 text and does not implement MySQL's IPv4-compatible rendering rule.

MySQL's ipv6_to_str() renders the tail as dotted decimal only when the first six IPv6 hextets are zero and the seventh hextet is non-zero. This intentionally keeps values such as ::1 and ::100 in hexadecimal form.

Change

  • Centralize the 4-byte/16-byte INET6_NTOA conversion used by constant, nullable-vector, and ordinary-vector paths.
  • Preserve existing 4-byte IPv4, IPv4-mapped, ordinary IPv6, NULL, and invalid-length behavior.
  • Format only the MySQL-compatible IPv4-compatible subset as ::a.b.c.d.
  • Add focused unit coverage for dotted, hexadecimal, mapped, ordinary, zero, IPv4, and invalid-length boundaries.
  • Add BVT coverage for constant, expression round-trip, mixed vector/table, mapped, ordinary IPv6, and NULL paths.

Validation

  • go test ./pkg/sql/plan/function ./pkg/sql/plan -count=1
  • go test -race ./pkg/sql/plan/function -run 'TestInet6NtoaString|TestInet6Ntoa|TestIsIPv4' -count=1
  • go vet -mod=readonly -vettool=/Users/xupeng/code/bin/molint ./pkg/sql/plan/function
  • targeted golangci-lint with .golangci.yml: 0 issues
  • mo-tester BVT: 14/14 successful, 0 failed
  • real MatrixOne service comparison against MySQL 8.4.10 confirms ::127.0.0.1, ::192.0.2.1, ::255.255.255.255, while ::1 and ::100 remain unchanged
  • git diff --check passed

Risk and performance

The change is limited to textual formatting after the existing input-length and mapped-address checks. It adds one fixed-size prefix check for 16-byte non-mapped values; no catalog, storage, network, or query-plan behavior changes. Existing outputs outside the targeted IPv4-compatible formatting rule are preserved.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@XuPeng-SH

Copy link
Copy Markdown
Contributor Author

已处理并更新 PR 分支:

  • 分支已 rebase 到最新 main(23bb644098)。当前 head:2f51a22171。
  • 修复真实 CI 回归:IPv4-compatible 格式化改变后,既有 func_ip_generated_columns BVT 的 row 6 expected 仍是 ::c000:201;已更新为 MySQL 兼容的 ::192.0.2.1。
  • 新增提交:2f51a22171 test(function): update IPv4-compatible generated column result。
  • INET6_NTOA 定向 UT 通过;同一组 -race 通过。
  • 原 CI 的 Coverage failure 仍是 producer profile 不完整导致的基础设施阻断,不是代码 failure。
  • 已将更新后的 head 推回原 PR feature ref,未触碰 main。

@XuPeng-SH
XuPeng-SH merged commit 45a1dbd into main Sep 9, 2026
22 of 25 checks passed
@XuPeng-SH
XuPeng-SH deleted the codex/issue-28389-inet6-compat branch September 9, 2026 01:50
XuPeng-SH added a commit that referenced this pull request Sep 9, 2026
## Summary

HAKeeper can report a failed MORPC transport generation as
`ErrBackendClosed` instead of EOF. The managed client previously reset
that generation but returned the error directly, so a transient
control-plane disconnect escaped as a SQL failure during
`TestIssue26640CrossAccountRestoreRebindsPrivileges`.

This change:

- retries the transport-generation errors (`ErrBackendClosed`,
connect/admission failures, connection reset) through the caller's
existing deadline;
- makes `managedHAKeeperClient.Close` terminal, prevents late failures
from recreating a transport, and makes concurrent `Close` calls join the
same cleanup result;
- consolidates the retry regressions into deterministic table-driven
tests, including deadline, business-error, in-flight-close, and
concurrent-close cases.

The retry is bounded by every public HAKeeper request context. An
allocation whose response is lost may consume an ID range, as the
existing EOF retry already did, but the server's monotonic allocator
prevents duplicate IDs from being returned.

## Root cause and scope

- #28443 failed before its restore/privilege assertions. The embedded
LogService first reported checker/raft timing pressure, then MORPC
returned `backend connection closed` while allocating an ID. The failure
was a downstream control-plane transport error; the deeper first
scheduler/WAL/IO fault is not proven by that job.
- #28447 is a separate MORPC stream-sequence-gap failure. It was already
fixed by merged #28358, which is in this branch's base. The exact
regression test passes repeatedly on current main, so this PR
intentionally does not duplicate that dispatch implementation.

Fixes #28452

Related: #28443, #28447, #28313, #28358

## Validation

- `TestIssue26640CrossAccountRestoreRebindsPrivileges`: `-count=3`,
passed.
- `TestIssue28313EmptyRemoteDispatch`: `-count=5`, passed.
- HAKeeper retry/close focused tests: normal and `-race -count=100`,
passed.
- `pkg/logservice`: normal and race package runs passed with the known
unrelated flaky `TestNewServiceClosesStoreOnReplicaStartFailure`
excluded; that test still fails independently with listener address
collisions/store-close leakage.
- `go vet ./pkg/logservice` with the repository CGo flags and `git diff
--check`, passed.

## CI triage for run 34300098985

The source changes in this PR are limited to pkg/logservice. In the
exact-head CI run:

- Shared build, SCA, normal UT, Compose BVT, and Standalone BVT passed.
- The UT coverage producer failed only at the unrelated existing test
pkg/sql/compile/TestIssue27261StopSendingDuringParallelReaderBuildStaysGraceful,
which returned context canceled; the producer report recorded no build
failures and two failed events in pkg/sql/compile.
- The downstream coverage merge failed because the required UT producer
artifact was incomplete (prerequisites_ready=false); it did not
calculate a coverage verdict.
- The same TestIssue27261 test passed locally 10 times, and the PR
retry/close focused tests passed locally 20 times normally and 100 times
under -race; go vet and git diff --check passed.

No unrelated compile/pipeline change is included to mask this flaky
coverage-only failure. This PR was not rebased and the existing PR base
was not changed.
XuPeng-SH added a commit that referenced this pull request Sep 9, 2026
## Summary

Fixes #28282.

The CDC watermark race regression test could fail before exercising the
lock contract. The fixture task was committed through CN0, while CN1 had
not necessarily consumed the corresponding logtail. In `drop_wins`, the
guarded watermark INSERT on CN1 could therefore complete with
`AffectedRows=0` without requesting the task-row lock; an empty holder
wait graph was then reported as a 30-second flaky timeout.

This change:

- establishes a real CN1 visibility barrier with an independent
autocommit read before starting either race ordering;
- uses a unique UUID task ID for each ordering so an older fixture
generation cannot satisfy that barrier;
- reports contender completion before lock admission immediately,
including transaction ID, last statement, affected rows, and error;
- preserves both lock orderings, exact waiter transaction-ID validation,
transaction cleanup/join, and final zero task/watermark assertions.

No production CDC or lock-service code is changed.

## Validation

- focused two-CN regression: pass;
- focused regression with `-race`: pass;
- `TestCDCRaceTxn` and `TestCDCWaiterProbe` with `-race -count=3`: pass;
- full `pkg/tests/issues` with the known unrelated
`TestIssue28313EmptyRemoteDispatch` flaky skipped: pass;
- `go vet ./pkg/tests/issues` with repository CGo headers/libs: pass;
- `git diff --check`: pass.

An unfiltered owning-package run still reproduced the pre-existing
`TestIssue28313EmptyRemoteDispatch` / shuffle receiver lifecycle flaky
tracked by #28447; it does not touch this change.
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
)

Fixes matrixorigin#28389

## Problem

`INET6_NTOA()` formats IPv4-compatible IPv6 values with hexadecimal
tails instead of the MySQL-compatible dotted-decimal form. For example,
the 16-byte value `000000000000000000000000C0000201` was returned as
`::c000:201` instead of `::192.0.2.1`.

The binary value produced by `INET6_ATON()` is already correct; this is
a formatting-only compatibility bug.

## Root cause

The 16-byte path delegated every non-mapped address to Go's
`net.IP.String()`. Go emits canonical hexadecimal IPv6 text and does not
implement MySQL's IPv4-compatible rendering rule.

MySQL's `ipv6_to_str()` renders the tail as dotted decimal only when the
first six IPv6 hextets are zero and the seventh hextet is non-zero. This
intentionally keeps values such as `::1` and `::100` in hexadecimal
form.

## Change

- Centralize the 4-byte/16-byte `INET6_NTOA` conversion used by
constant, nullable-vector, and ordinary-vector paths.
- Preserve existing 4-byte IPv4, IPv4-mapped, ordinary IPv6, NULL, and
invalid-length behavior.
- Format only the MySQL-compatible IPv4-compatible subset as
`::a.b.c.d`.
- Add focused unit coverage for dotted, hexadecimal, mapped, ordinary,
zero, IPv4, and invalid-length boundaries.
- Add BVT coverage for constant, expression round-trip, mixed
vector/table, mapped, ordinary IPv6, and NULL paths.

## Validation

- `go test ./pkg/sql/plan/function ./pkg/sql/plan -count=1`
- `go test -race ./pkg/sql/plan/function -run
'TestInet6NtoaString|TestInet6Ntoa|TestIsIPv4' -count=1`
- `go vet -mod=readonly -vettool=/Users/xupeng/code/bin/molint
./pkg/sql/plan/function`
- targeted `golangci-lint` with `.golangci.yml`: 0 issues
- mo-tester BVT: 14/14 successful, 0 failed
- real MatrixOne service comparison against MySQL 8.4.10 confirms
`::127.0.0.1`, `::192.0.2.1`, `::255.255.255.255`, while `::1` and
`::100` remain unchanged
- `git diff --check` passed

## Risk and performance

The change is limited to textual formatting after the existing
input-length and mapped-address checks. It adds one fixed-size prefix
check for 16-byte non-mapped values; no catalog, storage, network, or
query-plan behavior changes. Existing outputs outside the targeted
IPv4-compatible formatting rule are preserved.
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…gin#28453)

## Summary

HAKeeper can report a failed MORPC transport generation as
`ErrBackendClosed` instead of EOF. The managed client previously reset
that generation but returned the error directly, so a transient
control-plane disconnect escaped as a SQL failure during
`TestIssue26640CrossAccountRestoreRebindsPrivileges`.

This change:

- retries the transport-generation errors (`ErrBackendClosed`,
connect/admission failures, connection reset) through the caller's
existing deadline;
- makes `managedHAKeeperClient.Close` terminal, prevents late failures
from recreating a transport, and makes concurrent `Close` calls join the
same cleanup result;
- consolidates the retry regressions into deterministic table-driven
tests, including deadline, business-error, in-flight-close, and
concurrent-close cases.

The retry is bounded by every public HAKeeper request context. An
allocation whose response is lost may consume an ID range, as the
existing EOF retry already did, but the server's monotonic allocator
prevents duplicate IDs from being returned.

## Root cause and scope

- matrixorigin#28443 failed before its restore/privilege assertions. The embedded
LogService first reported checker/raft timing pressure, then MORPC
returned `backend connection closed` while allocating an ID. The failure
was a downstream control-plane transport error; the deeper first
scheduler/WAL/IO fault is not proven by that job.
- matrixorigin#28447 is a separate MORPC stream-sequence-gap failure. It was already
fixed by merged matrixorigin#28358, which is in this branch's base. The exact
regression test passes repeatedly on current main, so this PR
intentionally does not duplicate that dispatch implementation.

Fixes matrixorigin#28452

Related: matrixorigin#28443, matrixorigin#28447, matrixorigin#28313, matrixorigin#28358

## Validation

- `TestIssue26640CrossAccountRestoreRebindsPrivileges`: `-count=3`,
passed.
- `TestIssue28313EmptyRemoteDispatch`: `-count=5`, passed.
- HAKeeper retry/close focused tests: normal and `-race -count=100`,
passed.
- `pkg/logservice`: normal and race package runs passed with the known
unrelated flaky `TestNewServiceClosesStoreOnReplicaStartFailure`
excluded; that test still fails independently with listener address
collisions/store-close leakage.
- `go vet ./pkg/logservice` with the repository CGo flags and `git diff
--check`, passed.

## CI triage for run 34300098985

The source changes in this PR are limited to pkg/logservice. In the
exact-head CI run:

- Shared build, SCA, normal UT, Compose BVT, and Standalone BVT passed.
- The UT coverage producer failed only at the unrelated existing test
pkg/sql/compile/TestIssue27261StopSendingDuringParallelReaderBuildStaysGraceful,
which returned context canceled; the producer report recorded no build
failures and two failed events in pkg/sql/compile.
- The downstream coverage merge failed because the required UT producer
artifact was incomplete (prerequisites_ready=false); it did not
calculate a coverage verdict.
- The same TestIssue27261 test passed locally 10 times, and the PR
retry/close focused tests passed locally 20 times normally and 100 times
under -race; go vet and git diff --check passed.

No unrelated compile/pipeline change is included to mask this flaky
coverage-only failure. This PR was not rebased and the existing PR base
was not changed.
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…28542)

## Summary

Fixes matrixorigin#28282.

The CDC watermark race regression test could fail before exercising the
lock contract. The fixture task was committed through CN0, while CN1 had
not necessarily consumed the corresponding logtail. In `drop_wins`, the
guarded watermark INSERT on CN1 could therefore complete with
`AffectedRows=0` without requesting the task-row lock; an empty holder
wait graph was then reported as a 30-second flaky timeout.

This change:

- establishes a real CN1 visibility barrier with an independent
autocommit read before starting either race ordering;
- uses a unique UUID task ID for each ordering so an older fixture
generation cannot satisfy that barrier;
- reports contender completion before lock admission immediately,
including transaction ID, last statement, affected rows, and error;
- preserves both lock orderings, exact waiter transaction-ID validation,
transaction cleanup/join, and final zero task/watermark assertions.

No production CDC or lock-service code is changed.

## Validation

- focused two-CN regression: pass;
- focused regression with `-race`: pass;
- `TestCDCRaceTxn` and `TestCDCWaiterProbe` with `-race -count=3`: pass;
- full `pkg/tests/issues` with the known unrelated
`TestIssue28313EmptyRemoteDispatch` flaky skipped: pass;
- `go vet ./pkg/tests/issues` with repository CGo headers/libs: pass;
- `git diff --check`: pass.

An unfiltered owning-package run still reproduced the pre-existing
`TestIssue28313EmptyRemoteDispatch` / shuffle receiver lifecycle flaky
tracked by matrixorigin#28447; it does not touch this change.
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
)

Fixes matrixorigin#28389

## Problem

`INET6_NTOA()` formats IPv4-compatible IPv6 values with hexadecimal
tails instead of the MySQL-compatible dotted-decimal form. For example,
the 16-byte value `000000000000000000000000C0000201` was returned as
`::c000:201` instead of `::192.0.2.1`.

The binary value produced by `INET6_ATON()` is already correct; this is
a formatting-only compatibility bug.

## Root cause

The 16-byte path delegated every non-mapped address to Go's
`net.IP.String()`. Go emits canonical hexadecimal IPv6 text and does not
implement MySQL's IPv4-compatible rendering rule.

MySQL's `ipv6_to_str()` renders the tail as dotted decimal only when the
first six IPv6 hextets are zero and the seventh hextet is non-zero. This
intentionally keeps values such as `::1` and `::100` in hexadecimal
form.

## Change

- Centralize the 4-byte/16-byte `INET6_NTOA` conversion used by
constant, nullable-vector, and ordinary-vector paths.
- Preserve existing 4-byte IPv4, IPv4-mapped, ordinary IPv6, NULL, and
invalid-length behavior.
- Format only the MySQL-compatible IPv4-compatible subset as
`::a.b.c.d`.
- Add focused unit coverage for dotted, hexadecimal, mapped, ordinary,
zero, IPv4, and invalid-length boundaries.
- Add BVT coverage for constant, expression round-trip, mixed
vector/table, mapped, ordinary IPv6, and NULL paths.

## Validation

- `go test ./pkg/sql/plan/function ./pkg/sql/plan -count=1`
- `go test -race ./pkg/sql/plan/function -run
'TestInet6NtoaString|TestInet6Ntoa|TestIsIPv4' -count=1`
- `go vet -mod=readonly -vettool=/Users/xupeng/code/bin/molint
./pkg/sql/plan/function`
- targeted `golangci-lint` with `.golangci.yml`: 0 issues
- mo-tester BVT: 14/14 successful, 0 failed
- real MatrixOne service comparison against MySQL 8.4.10 confirms
`::127.0.0.1`, `::192.0.2.1`, `::255.255.255.255`, while `::1` and
`::100` remain unchanged
- `git diff --check` passed

## Risk and performance

The change is limited to textual formatting after the existing
input-length and mapped-address checks. It adds one fixed-size prefix
check for 16-byte non-mapped values; no catalog, storage, network, or
query-plan behavior changes. Existing outputs outside the targeted
IPv4-compatible formatting rule are preserved.
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…gin#28453)

## Summary

HAKeeper can report a failed MORPC transport generation as
`ErrBackendClosed` instead of EOF. The managed client previously reset
that generation but returned the error directly, so a transient
control-plane disconnect escaped as a SQL failure during
`TestIssue26640CrossAccountRestoreRebindsPrivileges`.

This change:

- retries the transport-generation errors (`ErrBackendClosed`,
connect/admission failures, connection reset) through the caller's
existing deadline;
- makes `managedHAKeeperClient.Close` terminal, prevents late failures
from recreating a transport, and makes concurrent `Close` calls join the
same cleanup result;
- consolidates the retry regressions into deterministic table-driven
tests, including deadline, business-error, in-flight-close, and
concurrent-close cases.

The retry is bounded by every public HAKeeper request context. An
allocation whose response is lost may consume an ID range, as the
existing EOF retry already did, but the server's monotonic allocator
prevents duplicate IDs from being returned.

## Root cause and scope

- matrixorigin#28443 failed before its restore/privilege assertions. The embedded
LogService first reported checker/raft timing pressure, then MORPC
returned `backend connection closed` while allocating an ID. The failure
was a downstream control-plane transport error; the deeper first
scheduler/WAL/IO fault is not proven by that job.
- matrixorigin#28447 is a separate MORPC stream-sequence-gap failure. It was already
fixed by merged matrixorigin#28358, which is in this branch's base. The exact
regression test passes repeatedly on current main, so this PR
intentionally does not duplicate that dispatch implementation.

Fixes matrixorigin#28452

Related: matrixorigin#28443, matrixorigin#28447, matrixorigin#28313, matrixorigin#28358

## Validation

- `TestIssue26640CrossAccountRestoreRebindsPrivileges`: `-count=3`,
passed.
- `TestIssue28313EmptyRemoteDispatch`: `-count=5`, passed.
- HAKeeper retry/close focused tests: normal and `-race -count=100`,
passed.
- `pkg/logservice`: normal and race package runs passed with the known
unrelated flaky `TestNewServiceClosesStoreOnReplicaStartFailure`
excluded; that test still fails independently with listener address
collisions/store-close leakage.
- `go vet ./pkg/logservice` with the repository CGo flags and `git diff
--check`, passed.

## CI triage for run 34300098985

The source changes in this PR are limited to pkg/logservice. In the
exact-head CI run:

- Shared build, SCA, normal UT, Compose BVT, and Standalone BVT passed.
- The UT coverage producer failed only at the unrelated existing test
pkg/sql/compile/TestIssue27261StopSendingDuringParallelReaderBuildStaysGraceful,
which returned context canceled; the producer report recorded no build
failures and two failed events in pkg/sql/compile.
- The downstream coverage merge failed because the required UT producer
artifact was incomplete (prerequisites_ready=false); it did not
calculate a coverage verdict.
- The same TestIssue27261 test passed locally 10 times, and the PR
retry/close focused tests passed locally 20 times normally and 100 times
under -race; go vet and git diff --check passed.

No unrelated compile/pipeline change is included to mask this flaky
coverage-only failure. This PR was not rebased and the existing PR base
was not changed.
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…28542)

## Summary

Fixes matrixorigin#28282.

The CDC watermark race regression test could fail before exercising the
lock contract. The fixture task was committed through CN0, while CN1 had
not necessarily consumed the corresponding logtail. In `drop_wins`, the
guarded watermark INSERT on CN1 could therefore complete with
`AffectedRows=0` without requesting the task-row lock; an empty holder
wait graph was then reported as a 30-second flaky timeout.

This change:

- establishes a real CN1 visibility barrier with an independent
autocommit read before starting either race ordering;
- uses a unique UUID task ID for each ordering so an older fixture
generation cannot satisfy that barrier;
- reports contender completion before lock admission immediately,
including transaction ID, last statement, affected rows, and error;
- preserves both lock orderings, exact waiter transaction-ID validation,
transaction cleanup/join, and final zero task/watermark assertions.

No production CDC or lock-service code is changed.

## Validation

- focused two-CN regression: pass;
- focused regression with `-race`: pass;
- `TestCDCRaceTxn` and `TestCDCWaiterProbe` with `-race -count=3`: pass;
- full `pkg/tests/issues` with the known unrelated
`TestIssue28313EmptyRemoteDispatch` flaky skipped: pass;
- `go vet ./pkg/tests/issues` with repository CGo headers/libs: pass;
- `git diff --check`: pass.

An unfiltered owning-package run still reproduced the pre-existing
`TestIssue28313EmptyRemoteDispatch` / shuffle receiver lifecycle flaky
tracked by matrixorigin#28447; it does not touch this change.
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
)

Fixes matrixorigin#28389

## Problem

`INET6_NTOA()` formats IPv4-compatible IPv6 values with hexadecimal
tails instead of the MySQL-compatible dotted-decimal form. For example,
the 16-byte value `000000000000000000000000C0000201` was returned as
`::c000:201` instead of `::192.0.2.1`.

The binary value produced by `INET6_ATON()` is already correct; this is
a formatting-only compatibility bug.

## Root cause

The 16-byte path delegated every non-mapped address to Go's
`net.IP.String()`. Go emits canonical hexadecimal IPv6 text and does not
implement MySQL's IPv4-compatible rendering rule.

MySQL's `ipv6_to_str()` renders the tail as dotted decimal only when the
first six IPv6 hextets are zero and the seventh hextet is non-zero. This
intentionally keeps values such as `::1` and `::100` in hexadecimal
form.

## Change

- Centralize the 4-byte/16-byte `INET6_NTOA` conversion used by
constant, nullable-vector, and ordinary-vector paths.
- Preserve existing 4-byte IPv4, IPv4-mapped, ordinary IPv6, NULL, and
invalid-length behavior.
- Format only the MySQL-compatible IPv4-compatible subset as
`::a.b.c.d`.
- Add focused unit coverage for dotted, hexadecimal, mapped, ordinary,
zero, IPv4, and invalid-length boundaries.
- Add BVT coverage for constant, expression round-trip, mixed
vector/table, mapped, ordinary IPv6, and NULL paths.

## Validation

- `go test ./pkg/sql/plan/function ./pkg/sql/plan -count=1`
- `go test -race ./pkg/sql/plan/function -run
'TestInet6NtoaString|TestInet6Ntoa|TestIsIPv4' -count=1`
- `go vet -mod=readonly -vettool=/Users/xupeng/code/bin/molint
./pkg/sql/plan/function`
- targeted `golangci-lint` with `.golangci.yml`: 0 issues
- mo-tester BVT: 14/14 successful, 0 failed
- real MatrixOne service comparison against MySQL 8.4.10 confirms
`::127.0.0.1`, `::192.0.2.1`, `::255.255.255.255`, while `::1` and
`::100` remain unchanged
- `git diff --check` passed

## Risk and performance

The change is limited to textual formatting after the existing
input-length and mapped-address checks. It adds one fixed-size prefix
check for 16-byte non-mapped values; no catalog, storage, network, or
query-plan behavior changes. Existing outputs outside the targeted
IPv4-compatible formatting rule are preserved.
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…gin#28453)

## Summary

HAKeeper can report a failed MORPC transport generation as
`ErrBackendClosed` instead of EOF. The managed client previously reset
that generation but returned the error directly, so a transient
control-plane disconnect escaped as a SQL failure during
`TestIssue26640CrossAccountRestoreRebindsPrivileges`.

This change:

- retries the transport-generation errors (`ErrBackendClosed`,
connect/admission failures, connection reset) through the caller's
existing deadline;
- makes `managedHAKeeperClient.Close` terminal, prevents late failures
from recreating a transport, and makes concurrent `Close` calls join the
same cleanup result;
- consolidates the retry regressions into deterministic table-driven
tests, including deadline, business-error, in-flight-close, and
concurrent-close cases.

The retry is bounded by every public HAKeeper request context. An
allocation whose response is lost may consume an ID range, as the
existing EOF retry already did, but the server's monotonic allocator
prevents duplicate IDs from being returned.

## Root cause and scope

- matrixorigin#28443 failed before its restore/privilege assertions. The embedded
LogService first reported checker/raft timing pressure, then MORPC
returned `backend connection closed` while allocating an ID. The failure
was a downstream control-plane transport error; the deeper first
scheduler/WAL/IO fault is not proven by that job.
- matrixorigin#28447 is a separate MORPC stream-sequence-gap failure. It was already
fixed by merged matrixorigin#28358, which is in this branch's base. The exact
regression test passes repeatedly on current main, so this PR
intentionally does not duplicate that dispatch implementation.

Fixes matrixorigin#28452

Related: matrixorigin#28443, matrixorigin#28447, matrixorigin#28313, matrixorigin#28358

## Validation

- `TestIssue26640CrossAccountRestoreRebindsPrivileges`: `-count=3`,
passed.
- `TestIssue28313EmptyRemoteDispatch`: `-count=5`, passed.
- HAKeeper retry/close focused tests: normal and `-race -count=100`,
passed.
- `pkg/logservice`: normal and race package runs passed with the known
unrelated flaky `TestNewServiceClosesStoreOnReplicaStartFailure`
excluded; that test still fails independently with listener address
collisions/store-close leakage.
- `go vet ./pkg/logservice` with the repository CGo flags and `git diff
--check`, passed.

## CI triage for run 34300098985

The source changes in this PR are limited to pkg/logservice. In the
exact-head CI run:

- Shared build, SCA, normal UT, Compose BVT, and Standalone BVT passed.
- The UT coverage producer failed only at the unrelated existing test
pkg/sql/compile/TestIssue27261StopSendingDuringParallelReaderBuildStaysGraceful,
which returned context canceled; the producer report recorded no build
failures and two failed events in pkg/sql/compile.
- The downstream coverage merge failed because the required UT producer
artifact was incomplete (prerequisites_ready=false); it did not
calculate a coverage verdict.
- The same TestIssue27261 test passed locally 10 times, and the PR
retry/close focused tests passed locally 20 times normally and 100 times
under -race; go vet and git diff --check passed.

No unrelated compile/pipeline change is included to mask this flaky
coverage-only failure. This PR was not rebased and the existing PR base
was not changed.
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…28542)

## Summary

Fixes matrixorigin#28282.

The CDC watermark race regression test could fail before exercising the
lock contract. The fixture task was committed through CN0, while CN1 had
not necessarily consumed the corresponding logtail. In `drop_wins`, the
guarded watermark INSERT on CN1 could therefore complete with
`AffectedRows=0` without requesting the task-row lock; an empty holder
wait graph was then reported as a 30-second flaky timeout.

This change:

- establishes a real CN1 visibility barrier with an independent
autocommit read before starting either race ordering;
- uses a unique UUID task ID for each ordering so an older fixture
generation cannot satisfy that barrier;
- reports contender completion before lock admission immediately,
including transaction ID, last statement, affected rows, and error;
- preserves both lock orderings, exact waiter transaction-ID validation,
transaction cleanup/join, and final zero task/watermark assertions.

No production CDC or lock-service code is changed.

## Validation

- focused two-CN regression: pass;
- focused regression with `-race`: pass;
- `TestCDCRaceTxn` and `TestCDCWaiterProbe` with `-race -count=3`: pass;
- full `pkg/tests/issues` with the known unrelated
`TestIssue28313EmptyRemoteDispatch` flaky skipped: pass;
- `go vet ./pkg/tests/issues` with repository CGo headers/libs: pass;
- `git diff --check`: pass.

An unfiltered owning-package run still reproduced the pre-existing
`TestIssue28313EmptyRemoteDispatch` / shuffle receiver lifecycle flaky
tracked by matrixorigin#28447; it does not touch this change.

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Compatibility]: INET6_NTOA formats IPv4-compatible IPv6 tails as hexadecimal

2 participants