Skip to content

test(iscp): wait for watermark transitions against the test context budget - #30385

Merged
XuPeng-SH merged 6 commits into
matrixorigin:mainfrom
ck89119:issue-30350-main
Oct 16, 2026
Merged

XuPeng-SH merged 6 commits into
matrixorigin:mainfrom
ck89119:issue-30350-main

Conversation

@ck89119

@ck89119 ck89119 commented Oct 16, 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:

issue #30350

What this PR does / why we need it:

TestFlushWatermark and TestISCPTableIDChange expired at change_handle_test.go's watermark wait assertions on the Ubuntu race UT runner, even though the ISCP watermark transition was still in progress. The job log shows the runner was heavily starved (ordinary commit latency 2.0-2.2s, executor ticks drifting to seconds), and the chain that makes a watermark visible — logtail pickup of the registered job, iteration execution (including sink DDL), durable final flush, and in-memory republish on a later apply pass — took 12-17s while the tests allowed a fixed 10s budget. The budget, not the transition, failed.

A fixed-second budget silently assumes scheduler speed. Every operation on that chain is already bounded by the test's own context deadline, and during one slow commit no intermediate progress signal exists, so no reliable shorter stall threshold is available. This change derives each wait's budget from the enclosing test context deadline via a small iscpWaitBudget(ctx, fallback) helper, keeping the original duration as fallback when the context has no deadline or less time remains. Assertions, polling tick, and helper semantics are unchanged; the dedicated blocked-getter timeout unit test keeps its literal budget. No product code changes; no sleeps, skips, or weakened assertions. Pass-path duration is unchanged (the wait returns as soon as the state is observed); only failure-mode detection moves to the test's existing 5-minute context budget.

Validation (macOS/arm64, race + short + matrixone_test tag; the original Linux/x86 starved environment is not reproducible locally, so this validates the wait-contract change rather than the original failure):

  • TestISCPTableIDChange and TestFlushWatermark, -count=3: pass
  • TestWaitForISCPWatermarkTimeoutDoesNotWaitForBlockedGetter (helper timeout semantics): pass
  • Smoke of 10 sibling tests covering every replaced call form (literal, watermarkWait var/const, plain ctx deadline variable): pass
  • go vet ./pkg/vm/engine/test, golangci-lint --new-from-rev: clean

…udget

Fixed-second budgets in waitForISCPWatermark(Absent) silently assumed
scheduler speed. The chain that makes a watermark visible (logtail
pickup, iteration DDL, durable flush, in-memory republish) consists of
operations each bounded by the test's own context deadline, so a
slow-but-progressing executor must be judged against that shared
budget rather than wall clock. On a starved race runner the chain took
12-17s while the tests allowed only 10s, expiring mid-transition.

Derive each wait's budget from the enclosing test context deadline via
iscpWaitBudget, keeping the original duration as fallback. Assertions,
tick, and helper semantics are unchanged; the blocked-getter timeout
unit test keeps its literal budget.

Fix matrixorigin#30350
TestStaleRead, TestInitSql, and TestCheckLeaseFailed root their ctx with
WithCancel/WithValue only; ctxWithTimeout carries the 5-minute deadline.
iscpWaitBudget(ctx, ...) therefore always returned the fallback and the
budget fix did not apply there. Pass ctxWithTimeout and add
TestISCPWaitBudgetHonorsContextDeadline to pin the deadline/fallback
branches, which passing smoke runs cannot distinguish.

Refs matrixorigin#30350
@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 Oct 16, 2026
@ck89119
ck89119 marked this pull request as ready for review October 16, 2026 08:18
@ck89119
ck89119 requested a review from XuPeng-SH as a code owner October 16, 2026 08:18
@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 16, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · done

Commit: edfc79092640eaa4e699f42e05e9f1e118ec6f85

Review completed. Read the assessment.

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

mo-bot review · mo-bot-local · review

Commit: edfc79092640eaa4e699f42e05e9f1e118ec6f85

Assessment: approve

The helper coherently reuses the executor’s existing deadline budget without changing watermark assertions, polling, fixtures, or cleanup. All 31 callers use the correct context. Production paths are unchanged; slower failure detection is an explicit, reasonable tradeoff.

Model: gpt-6-astra / xhigh

Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1

Validation:

  • Reviewed the complete delta, all 19 affected test roots, watermark observation, executor cancellation/cleanup, and supplied comments.

  • Static comparison proved existing behavior is unchanged apart from budget arguments. diff --check passed; formatter differences also exist unchanged in the base.

  • A standalone probe of the verbatim helper passed no-deadline, short, expired, inherited, and long-deadline cases. This used Go 1.25.5 and does not represent native package execution.

  • Reused frozen-head Ubuntu UT and Linux SCA success evidence. Local preflight, probe, and static-audit receipts were reconciled with retained logs in /home/xupeng/.local/state/mo-bot/jobs/ebaa88aa023c0be89874b24b/attempt-1/review-analysis.json.

Limitations:

  • Native integration tests and the original runner-starvation scenario were not rerun locally; raw CI and author logs were not supplied.

  • Failure waits can approach five minutes. The retained 10–30-second fallback floor can extend a wait beyond the context deadline; this preserves the documented fallback behavior.

@mergify mergify Bot added the queued label Oct 16, 2026
@mergify

mergify Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-16 10:47 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-10-16 11:07 UTC · at 5d56dc6d5f3409aac87d4df5a6b56bacd449ab0c

This pull request spent 20 minutes in the queue, with no time running CI.

Reason

Pull request #30385 has been dequeued

Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.

The author needs to enable "Allow edits from maintainers" on this pull request.

Hint

You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it.
If you do update this pull request, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Waiting for any of
  • check-neutral = CI Required
  • check-skipped = CI Required
  • check-success = CI Required
All conditions

Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).

  • Requeue this pull request

This branch was previously deployed

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

Labels

dequeued 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