Skip to content

fix(embed): retain port leases across cluster restarts - #30514

Merged
XuPeng-SH merged 4 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/fix-embed-port-restart-20261018
Oct 18, 2026
Merged

XuPeng-SH merged 4 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/fix-embed-port-restart-20261018

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

Related to #441.

Original failure: PR #30116 UT job.

What this PR does / why we need it:

Full-cluster Close → Start released the port-range file lock between generations, allowing another constructor to acquire the original range and make restart fail. Add Cluster.Stop() through the existing dependency-aware shutdown: release completed admission and retain the port lease; final Close releases it. Incomplete cleanup retains its owners and dependencies. Migrate intermediate shutdowns in the ten restart consumer files, retaining final cleanup and recovery oracles. No new lifecycle state, allocator, retry or background work is introduced.

Rebased onto main 799523418e9f, preserving #30517's fresh query context after the two-CN restart alongside Stop.

Also fix the TestSnapshotMeta failure from this PR's Ubuntu UT job. The #30381 optimization installed snapshots dated one second in the past after GC had already reclaimed older objects. Use a fresh timestamp after the existing GC-disable step and keep ten ordered nanosecond offsets. All metadata, checkpoint, restart and DoCheck assertions remain; no sleeps, new fixture or production-GC changes are added. A controlled historical-time reproduction fails with three extra old system-table objects; the current-time control passes.

Validation on Go 1.27.1, macOS/arm64, repository CGo runner:

  • Fresh complete pkg/embed normal and race suites: 131 test roots / 457 named passes in each mode, plus two existing skips.
  • TAE owning package in CI short/tagged configuration: 265 roots / 298 named passes, plus the existing TestUpdate skip. Exact TestSnapshotMeta passes ordinary normal and CI-mode -short -tags=matrixone_test -race; all 17 adaptive race repetitions pass.
  • Fresh complete multicn normal suite and exact TestViewDescriptionTwoCN race pass, covering the rebased context handling and retained port lease together.
  • Previously validated unchanged migrated consumers (Arrow persistence/rollout, MEDIUMINT, AUTO_ID_CACHE reconfiguration, defaults persistence and accepted-commit recovery) retain normal/race evidence. Original deterministic real-flock, cleanup/admission stress and old-behavior negative control remain applicable.
  • Incremental gofmt, vet, pinned molint and configured golangci-lint over all six affected packages: zero issues.

Existing external-MySQL and per-service CN-restart skips in embed, and the existing TestUpdate skip in TAE, remain unchanged. No changed target scenario is skipped.

Runtime cost is confined to the original embedded lifecycle change: stopped clusters retain their existing port lease until final Close. Query execution gains no work. The fixture correction retains one clock read and ten additions. GitHub CI for the updated revision remains pending.

@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

XuPeng-SH commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-xupeng · done

Commit: e0919fda18591e544801cf2cca3c00b24021fc2e

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

mo-bot review · mo-bot-xupeng · review

Commit: e0919fda18591e544801cf2cca3c00b24021fc2e

Assessment: approve

Reviewed the complete 14-file delta, lifecycle owners, callers, tests and supplied comments. Stop retains port leases through the existing teardown path while preserving final cleanup and failure ownership. No actionable defects found.

Model: gpt-6-astra / xhigh

Session: 01a14d34-4e51-79a3-a62d-6c9c16279dc8 · slot 0 · generation 0

Validation:

  • Linux/amd64, Go 1.27.1: 131 pkg/embed test roots passed in normal and race modes; every changed subcase was verified.

  • All seven migrated consumer scenarios across four packages passed in normal and race modes.

  • Race stress passed: 100 lease-continuity, 100 cleanup-ownership and 15 admission repetitions. Restoring the old port-release behavior failed the regression test as expected.

  • Formatting, diff whitespace and go vet for all five affected packages passed. Native provenance matched current candidate inputs.

  • Commands, source fingerprints, exit receipts and retained logs were reconciled in /home/xupeng/.local/state/mo-bot/jobs/edddc9ba7c35949f7c50f010/attempt-1/evidence-index.json. coverage-ledger.json and final-audit.log confirm coverage and unchanged source.

Limitations:

  • Two initial whole-package runs reached the executor's 600-second limit; completed results were retained and unfinished tests passed in bounded groups.

  • Two unchanged tests remain skipped: TestRestartCN and TestCDCMySQL8TargetIdentityBVT, which requires an external MySQL fixture.

  • Validation was on Linux. Frozen CI was pending; author macOS claims lacked retained receipts. Issue #441's body was absent, so issue-specific assessment is limited to the PR's stated restart contract.

@XuPeng-SH

XuPeng-SH commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-xupeng · superseded

Commit: 54de11363838d061e49f2ff574a9f573fc1d2b3b

"interrupted"

@XuPeng-SH

XuPeng-SH commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-xupeng · done

Commit: c5330d6cdc0af6b5ff096499c30e5303a2c45277

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

mo-bot review · mo-bot-xupeng · review

Commit: c5330d6cdc0af6b5ff096499c30e5303a2c45277

Assessment: approve

Reviewed the complete 15-file delta, callers, cleanup ownership, restart compatibility, snapshot fixture and supplied comments. Stop preserves port leases through the existing shutdown implementation; final Close retains cleanup responsibility. No actionable defects or material validation gaps remain.

Model: gpt-6-astra / xhigh

Session: 01a14d34-4e51-79a3-a62d-6c9c16279dc8 · slot 0 · generation 0

Validation:

  • Source remained unchanged. Command, source, exit and log reconciliation passed: checks/1792331638063337967-3.json. Evidence indexes and logs are retained under /home/xupeng/.local/state/mo-bot/jobs/793748f7feefc7c4bd2b32f5/attempt-1.

  • Isolation preflight and repository-owned verification of current native inputs passed.

  • Seven current-head SQL restart scenarios passed normally and with -race across four packages, including ArrowLoadBVT/ClusterRestartPersistence. Both consumers-normal-final.jsonl and consumers-race-final.jsonl contain successful package terminal results.

  • Reconciled semantically matching retained embed evidence: 131 root tests passed in normal and race modes, plus focused lease/cleanup/admission stress and a negative control demonstrating premature lease release. Unchanged TestSnapshotMeta passed normal and race checks.

  • Complete CI-short TAE inventory coverage: 265 passes and one unchanged TestUpdate skip. Combined 116 retained passes, 123 current-head passes and 26 resumed passes using the preserved current-head binary through the supplied isolated executor. See tae-coverage.json and final-audit.log.

Limitations:

  • Embed and TAE coverage was assembled across bounded invocations, not single uninterrupted whole-package runs. Timeouts remain partial evidence; setup failures were excluded. Unchanged embed skips were TestRestartCN and TestCDCMySQL8TargetIdentityBVT.

  • Frozen CI was incomplete; author macOS summaries without retained receipts were not counted as verified validation. Reviewed execution evidence is Linux amd64.

  • Linked issue #441's body was unavailable in the frozen evidence; assessment covers the explicit restart and snapshot contracts supplied with the PR.

This branch was previously deployed

1 inactive deployment
ci — 872c3a1e Deployed Oct 18, 2026 by XuPeng-SH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/api-change kind/bug Something isn't working kind/test-ci size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants