Skip to content

test(objectio): synchronize dedupLoad waiter admission - #27782

Merged
mergify[bot] merged 2 commits into
matrixorigin:mainfrom
gouhongshen:agent/issue-27760-34bce304
Aug 28, 2026
Merged

test(objectio): synchronize dedupLoad waiter admission#27782
mergify[bot] merged 2 commits into
matrixorigin:mainfrom
gouhongshen:agent/issue-27760-34bce304

Conversation

@gouhongshen

@gouhongshen gouhongshen commented Aug 28, 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 #27760

What this PR does / why we need it:

Root cause

The three dedupLoad waiter tests used a 10 ms scheduler sleep as the phase trigger. The existing started channel only proves that the owner entered its loader; it does not prove that the second goroutine acquired metaLoadMu and found the existing metaLoadCalls[key] entry. Under coverage or other load-sensitive scheduling, the owner could be released first, complete, and delete the call. The delayed second goroutine would then become a new owner and run its sentinel loader, producing the reported unexpected waiter load error. This is a test synchronization defect; the production dedupLoad ownership protocol is unchanged.

The first barrier revision also left the admission wait unbounded: if the waiter returned early or the internal seam changed, the test could hang instead of reporting the failed phase transition.

Changes

  • Add a reusable test-only context whose Done method observes the existing waiter branch. In dedupLoad, that method is evaluated only after an existing owner call has been found.
  • Add a shared admission helper that selects among waiter admission, waiter completion, and a one-second watchdog. The watchdog is diagnostic only; the normal phase transition still comes from the Done observation.
  • On early waiter completion or watchdog expiry, cancel the waiter context, release the owner through the test-provided release callback, drain both completion channels with bounded waits, and then report a diagnostic failure.
  • Replace the scheduler sleeps in TestDedupLoadWaiterGetsSuccessfulOwnerValue, TestDedupLoadCleansUpAfterPanic, and TestDedupLoadCleansUpAfterLoadCancel with the admission helper.
  • Keep the existing success, panic-cleanup, cancellation, map-cleanup, and no-second-load assertions intact. The timeout test is unchanged because its 10 ms duration is the behavior under test, not an admission trigger.

Issue-to-test proof

  • TestDedupLoadWaiterGetsSuccessfulOwnerValue waits until the waiter has observed the in-flight owner, then releases it and verifies the waiter gets []byte("ok") without invoking its sentinel loader.
  • TestDedupLoadCleansUpAfterPanic proves an admitted waiter receives the incomplete-load error, the call entry is removed, and a later owner can load successfully.
  • TestDedupLoadCleansUpAfterLoadCancel proves an admitted waiter receives context.Canceled and its loader is never called.
  • The shared admission helper covers early waiter completion and watchdog failure paths by canceling/releasing both sides, bounded-draining their completion channels, and failing with an explicit diagnostic.
  • No BVT is added: this change is confined to an internal _test.go synchronization protocol and does not change SQL, frontend, wire, or production behavior.

Tests run

  • make -j8 NATIVE_BUILD_JOBS=8 cgo
  • .agents/skills/mo-dev/scripts/mo-cgo-test -list '^TestDedupLoad(CleansUpAfterPanic|WaiterGetsSuccessfulOwnerValue|CleansUpAfterLoadCancel)$' ./pkg/objectio
  • The three changed tests with -v -count=1.
  • The three changed tests with -race -count=100.
  • Full pkg/objectio unit tests with -count=1.
  • go vet -mod=readonly ./pkg/objectio with the repository CGo include and library paths.
  • git diff --check

Residual risks

The change is test-only and adds no production synchronization, allocation, I/O, or runtime overhead. The barrier intentionally observes the existing waiter-admission call through a local context wrapper. If that internal test seam changes, the helper now reports either early waiter completion or a bounded admission timeout and attempts bounded cleanup of both test goroutines instead of silently relying on scheduler timing.

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

Blocking test-lifecycle issue on exact head 955853109432c603eb75f51e94e8059cf747591e.

The admission observation is sound, but all three tests now wait on <-waiterCtx.admitted without a watchdog or an early-exit branch. admitted is closed only from Done(). If the waiter unexpectedly becomes an owner, returns before entering the waiter select, or a future dedupLoad regression bypasses that Done() evaluation, its result is buffered in waiterDone while the test goroutine blocks forever. The old test would report unexpected waiter load; the replacement turns that failure into a package-wide hang until the outer go test timeout. This contradicts the PR claim that the barrier will fail directly when the seam changes.

Please make each admission wait bounded and failure-diagnostic: select on admitted, waiter early completion, and a test timeout; on timeout/early exit also release/drain the owner so no goroutine is leaked. Keep the timeout only as a watchdog, not as the phase trigger. A small reusable helper can avoid duplicating this across the three tests.

Evidence: -race -count=100 -timeout=120s for all three changed tests passes on the current implementation, confirming the normal synchronization path. Q1-Q3: no production ownership or wait graph changed; the only remaining issue is the test failure path itself being unbounded.

@gouhongshen

Copy link
Copy Markdown
Contributor Author

Fixed in commit 32cf49b5fa055f9bcd24cb1470cc690d40810ffc. The review identified a valid test-lifecycle gap. waitForDedupLoadWaiterAdmission now selects among the admission signal, waiter completion, and a one-second watchdog. On early completion or timeout it cancels the waiter, releases the owner through the test-provided callback, bounded-drains both completion channels, and then reports a diagnostic failure. The normal path still releases the owner only after the Done-based admission observation. Revalidated the three changed tests, their race run with -count=100, the full pkg/objectio UT, and CGo-configured go vet; the PR description is updated.

@gouhongshen
gouhongshen requested a review from XuPeng-SH August 28, 2026 14:18
@matrix-meow matrix-meow added size/M Denotes a PR that changes [100,499] lines and removed size/S Denotes a PR that changes [10,99] lines labels Aug 28, 2026

@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-reviewed exact head 32cf49b, including the complete delta from previously reviewed head 9558531.

The previous hang blocker is fixed. The tests still use an exact waiter-admission phase barrier through context Done, but admission is now bounded to one second. A waiter that exits before admission or an admission timeout cancels the waiter, releases the blocked owner, and drains both goroutines with bounded waits before failing. Success paths observe owner/waiter completion before reading shared results, and cancellation/release operations are single-close or idempotent in their respective cases. No production code changes are introduced.

Validation on this exact head:

  • focused TestDedupLoad tests, count=100: PASS
  • focused TestDedupLoad tests under race, count=50: PASS
  • complete pkg/objectio package: PASS
  • diff check: PASS

No remaining correctness, race, leak, hang, performance, or unhappy-path blocker found.

@mergify

mergify Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • Entered queue2026-08-28 17:00 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue2026-08-28 17:05 UTC · at 7d0dae9f36beb7d67d6ec30ca2b8bf792de33086

This pull request spent 4 minutes 33 seconds in the queue, with no time running CI.

Waiting for
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64
    • check-success = Matrixone CI / SCA Test on Linux/arm64
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
    • check-success = Matrixone Utils CI / Coverage
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-skipped = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-success = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-success = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
All conditions
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64
    • check-success = Matrixone CI / SCA Test on Linux/arm64
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
    • check-success = Matrixone Utils CI / Coverage
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-skipped = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-success = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-success = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • github-review-approved [🛡 GitHub branch protection]

Reason

The pull request #27782 has been manually updated

Failing checks:

Requeued — the merge queue status continues in this comment ↓.

@mergify

mergify Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • Entered queue2026-08-28 18:04 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • Checks skipped · PR is already up-to-date
  • Merged2026-08-28 18:05 UTC · at 46173a1ab96e4ecca5061df94560e0cde4b338de · squash

This pull request spent 19 seconds in the queue, including 1 second running CI.

Required conditions to merge
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • github-review-approved [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / SCA Test on Linux/arm64
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Utils CI / Coverage
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-neutral = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-skipped = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-neutral = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)

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

Labels

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.

3 participants