Skip to content

test: add MongoDB and UUID issue regressions - #27516

Merged
XuPeng-SH merged 7 commits into
matrixorigin:mainfrom
Ariznawlll:codex/mongodb-issue-regressions-27414-27418-27417-27415-24727
Aug 24, 2026
Merged

XuPeng-SH merged 7 commits into
matrixorigin:mainfrom
Ariznawlll:codex/mongodb-issue-regressions-27414-27418-27417-27415-24727

Conversation

@Ariznawlll

Copy link
Copy Markdown
Collaborator

What changed

Validation

  • make test-mongodb-e2e-local
  • go test ./test/mongodb -run ...
  • go test ./pkg/sql/parsers/dialect/mysql -run TestMongoDBSQLSurfaceAndRedaction
  • .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=30m ./pkg/tests/issues -run ^TestIssue(24727MultiRowPreparedInsertUUIDStrings|26875)

@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 →

@Ariznawlll
Ariznawlll force-pushed the codex/mongodb-issue-regressions-27414-27418-27417-27415-24727 branch from 37368f3 to e27c616 Compare August 24, 2026 02:36
@Ariznawlll

Copy link
Copy Markdown
Collaborator Author

@XuPeng-SH Fixed in bb62f31.

  1. The concurrent-test data race is removed. The held port-plan process now writes stdout/stderr to a temporary file rather than a shared strings.Builder; the file is read only after Cmd.Wait() returns, so there is no os/exec copy goroutine sharing Go memory with assertions.

  2. The lease holder now receives the Bash parent PID and polls os.getppid() every 50 ms. Normal cleanup still terminates it through the EXIT trap. If the Bash process is SIGKILLed or crashes, reparenting changes PPID and the holder exits, closing its flock without relying on the parent trap. This is POSIX/macOS/Linux compatible and avoids Linux-only PDEATHSIG.

Added TestMongoDBLocalE2EPortPlanReleasesLeaseAfterParentDeath: it starts a held plan in an isolated lease directory, SIGKILLs the parent Bash, and requires a retry for the same explicit base to succeed. The regression failed before the change with already leased and passes now.

Verified:

  • bash -n optools/mongodb_ci.bash
  • go test ./test/mongodb -count=1
  • go test -race ./test/mongodb -run 'TestMongoDBLocalE2EPortPlan(UsesOneReservedBlock|ValidatesOverrides|LeasesPortBlockAcrossProcesses|ReleasesLeaseAfterParentDeath)$' -count=5
  • 64 concurrent held port-plan allocations: 64 successes, 64 unique bases
  • shell-level SIGKILL reproduction: the same explicit base became available again after parent death.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Deep re-review of exact head bb62f31. Both prior blockers are closed: test output no longer has concurrent strings.Builder access, and the lease holder now exits after parent death. Focused lease tests passed at count=20 and race count=5; bash syntax and shellcheck passed.

@iamlinjunhong iamlinjunhong left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed exact head bb62f314eee8eb6b4f58fa3db6d7e0e3a6f5a6ff against merge base a4465b3846c770b8f3e2c313a624afd8534427da, including the complete diff, review history, conversation, and the delta from fd812a9. The latest commit closes the previously reported strings.Builder race and orphaned lease-holder path; focused normal and race tests pass. One P1 blocker remains: the default lock namespace varies with TMPDIR, so concurrent jobs on the same host can still lease the same block. No additional P0/P2/P3 findings were confirmed.

Validation: bash -n; isolated file-level MongoDB tests; full file-level -race; adaptive focused race runs (T=2.89s/B=30s/N=10 and T=1.03s/B=30s/N=29); deterministic cross-TMPDIR reproduction.

Comment thread optools/mongodb_ci.bash Outdated

acquire_port_block_lease() {
local base="$1" lease_dir status_file status=""
lease_dir="${MO_MONGODB_PORT_LEASE_DIR:-${TMPDIR:-/tmp}/mo-mongodb-port-leases-$(id -u)}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P1] Use a host-stable namespace for the default lease files. This path includes each process’s TMPDIR, so two runs on the same host with different per-job temp directories lock different files for the same base. On exact head bb62f31, I held base 49280 with TMPDIR=A: a second process with TMPDIR=A exited 1 as already leased, while a second process with TMPDIR=B exited 0 and returned the same 49280 plan while the first holder was still alive. In real E2E runs both processes can therefore pass availability during the long build and later race to bind LogService/TN/CN/frontend/status, preserving the parallel-startup flake this lease is meant to remove. Please use a host-stable default lock directory (the explicit override can remain) and cover two distinct TMPDIR values in the cross-process regression.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 3e3a219.

The default lease namespace is now /tmp/mo-mongodb-port-leases-$(id -u), independent of TMPDIR; MO_MONGODB_PORT_LEASE_DIR remains the explicit override. This gives all processes under the same host user the same per-base flock path even when CI assigns job-specific temp directories.

TestMongoDBLocalE2EPortPlanLeasesPortBlockAcrossProcesses now deliberately starts the holder with one TMPDIR and attempts the same explicit base from a second, distinct TMPDIR. Before this change it failed because the second process succeeded; it now requires and observes already leased.

Verified:

  • go test ./test/mongodb -count=1
  • focused port-plan -race -count=5
  • bash -n optools/mongodb_ci.bash
  • 64 simultaneous held port-plan allocations alternating between two TMPDIR values: 64 successes, 64 unique bases, 0 duplicates.

@XuPeng-SH
XuPeng-SH merged commit 6a40418 into matrixorigin:main Aug 24, 2026
17 of 20 checks passed
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What changed
- extend the local MongoDB E2E for matrixorigin#27414, matrixorigin#27415, matrixorigin#27417, and matrixorigin#27418
- isolate the E2E frontend, status, LogService, TN, and CN ports so it
does not attach to a developer cluster
- cover single/composite PK INSERT SELECT and fast duplicate-key
rejection
- add embedded-cluster protocol coverage for matrixorigin#24727 across binary
prepare, client interpolation, direct Exec, transaction Exec, and
explicit Prepare

## Validation
- `make test-mongodb-e2e-local`
- `go test ./test/mongodb -run ...`
- `go test ./pkg/sql/parsers/dialect/mysql -run
TestMongoDBSQLSurfaceAndRedaction`
- `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=30m
./pkg/tests/issues -run
^TestIssue(24727MultiRowPreparedInsertUUIDStrings|26875)`

---------

Co-authored-by: XuPeng-SH <[email protected]>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What changed
- extend the local MongoDB E2E for matrixorigin#27414, matrixorigin#27415, matrixorigin#27417, and matrixorigin#27418
- isolate the E2E frontend, status, LogService, TN, and CN ports so it
does not attach to a developer cluster
- cover single/composite PK INSERT SELECT and fast duplicate-key
rejection
- add embedded-cluster protocol coverage for matrixorigin#24727 across binary
prepare, client interpolation, direct Exec, transaction Exec, and
explicit Prepare

## Validation
- `make test-mongodb-e2e-local`
- `go test ./test/mongodb -run ...`
- `go test ./pkg/sql/parsers/dialect/mysql -run
TestMongoDBSQLSurfaceAndRedaction`
- `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=30m
./pkg/tests/issues -run
^TestIssue(24727MultiRowPreparedInsertUUIDStrings|26875)`

---------

Co-authored-by: XuPeng-SH <[email protected]>

This branch was previously deployed

1 inactive deployment
ci — 2cb08522 Deployed Aug 24, 2026 by XuPeng-SH via Matrixone Utils CI / Coverage #48004
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Denotes a PR that changes [500,999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants