Skip to content

test(lockservice): isolate forwarded lock timeout assertion - #27813

Merged
mergify[bot] merged 1 commit into
matrixorigin:mainfrom
gouhongshen:agent/issue-27810-41d94ceb
Aug 28, 2026
Merged

test(lockservice): isolate forwarded lock timeout assertion#27813
mergify[bot] merged 1 commit into
matrixorigin:mainfrom
gouhongshen:agent/issue-27810-41d94ceb

Conversation

@gouhongshen

@gouhongshen gouhongshen commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • BUG
  • Test and CI

Which issue(s) this PR fixes:

Related to #27810

What this PR does / why we need it:

The race failure was a test-fixture timing error, not a lockservice production failure. The test used LockWaitTimeout = 1 for both the uncontended forwarded holder setup and the blocked waiter assertion. Each Lock call receives an independent end-to-end effective deadline, so scheduling, binding, forwarding, and owner admission can legitimately exhaust the holder setup request before the test reaches the waiter assertion.

This change leaves the holder request on the existing service safety deadline, preserving the background-context deadline-injection coverage. It applies the one-second lock wait timeout only to the subsequent conflicting waiter, which is the operation whose ErrLockWaitTimeout behavior and timing the test asserts. No production code or protocol behavior changes.

Issue-to-test proof:

Tests run:

  • Before rebase: pkg/lockservice, normal mode (105.036s) and race mode (110.050s).
  • Rebased onto main at 67ac89c: TestForwardLockUsesEffectiveLockDeadline, normal mode.
  • Rebased onto main at 67ac89c: TestForwardLockUsesEffectiveLockDeadline, race mode (test body 1.27s; command exit status 0).
  • Rebased onto main at 67ac89c: TestForwardLockUsesEffectiveLockDeadline, race mode, count=23 (29.508s; exit status 0).
  • Rebased onto main at 4cbdc2c: TestForwardLockUsesEffectiveLockDeadline, normal and race modes.
  • Rebased onto main at 2e1be09: TestForwardLockUsesEffectiveLockDeadline, normal mode (1.13s) and race mode (1.14s).
  • Rebased onto main at 52336df: TestForwardLockUsesEffectiveLockDeadline, normal mode (1.16s) and race mode (1.99s).
  • Rebased onto main at 0d7f4dd: TestForwardLockUsesEffectiveLockDeadline, normal mode (1.13s) and race mode (1.15s).
  • Rebased onto main at 117714d: TestForwardLockUsesEffectiveLockDeadline, normal mode (test body 1.14s; package 1.439s) and race mode (test body 1.18s; package 2.986s).

BVT is not applicable: this is an internal lockservice forwarding fixture and does not change SQL-visible behavior.

Residual risk:

  • Validation ran on macOS arm64 with the repository CGo test wrapper; Ubuntu x86 CI remains the cross-platform confirmation. The changed assertion no longer charges holder setup against the waiter-specific one-second budget.

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

@gouhongshen

gouhongshen commented Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

Unrelated CI blocker: pkg/logservice.TestAllocateIDByKeyWaiterRetriesAfterRefillFailure timed out before its refill mock was admitted. The PR changes only a lockservice test; the independent logservice test liveness defect is tracked in #27818. Matrixone Utils CI / Coverage is its derived failure: its log reports that coverage merge was skipped because a required producer failed.

@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 review completed on exact head 24a27ae.

The test-only change correctly separates the uncontended forwarded holder setup from the waiter-specific one-second budget. Lock receives options by value and service-side deadline injection does not mutate the caller copy, so setting LockWaitTimeout = 1 after holder acquisition applies only to the conflicting waiter. The holder still exercises background-context safety-deadline injection, while the waiter retains the intended timeout/error and timing oracle.

Unhappy-path/liveness: the waiter remains bounded by its effective deadline; harness teardown owns service/txn cleanup, and repeated race execution found no leaked or stale shared state. No production, protocol, or hot-path behavior changes.

Evidence: exact test selection was non-empty; focused normal passed; focused race -count=20 passed in 23.769s; exact-head Ubuntu/x86 UT, SCA, coverage, and BVT checks are green. No blocking findings.

@mergify mergify Bot added the queued label Aug 28, 2026
@mergify

mergify Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • Entered queue2026-08-28 19:33 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • Checks skipped · PR is already up-to-date
  • Merged2026-08-28 19:33 UTC · at 24a27ae24b261847dffd7ac5cb6ecf725b379723 · squash

This pull request spent 14 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)

@mergify
mergify Bot merged commit d3685c2 into matrixorigin:main Aug 28, 2026
25 of 26 checks passed
@mergify mergify Bot removed the queued label Aug 28, 2026
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/XS Denotes a PR that changes [1, 9] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants