Skip to content

test(iscp): prepare sink fixtures and avoid redundant target DDL - #29051

Merged
XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/iscp-watermark-progress
Sep 17, 2026
Merged

XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/iscp-watermark-progress

Conversation

@XuPeng-SH

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:

Follow-up to #28967 and #28969, already closed by #28976. Related to #28419.

What this PR does / why we need it:

In PR #29043's race UT failure, TestISCPExecutor7 exhausted its 10-second watermark wait while the mock consumer was still creating its destination database. The Running-status commit took 2.60 seconds, followed by a target-database commit taking 7.21 seconds. Engine/heavy-wave isolation from #28976 was already active. The iteration log printed during teardown is a deferred producer-exit log, not evidence that the worker only started then.

Prepare empty sink tables before registration in Executor7/8 and UpdateJobSpec, sharing the existing InvalidTimestamp setup pattern. Batch database/table creation into one executor-owned transaction, with rollback on statement errors. Keep the original watermark targets, deadlines, deletion/job-type transitions and fault barriers. Extend Executor7/8 with bidirectional source/sink data checks; retain cold-start, non-system-tenant and cancellation integration controls.

Fresh CN mock consumers now check the target in a tenant-scoped metadata transaction. An existing target bypasses two redundant DDL statements on every iteration. Confirmed absence retains the original idempotent cold DDL; lookup/commit/cancellation errors propagate. The lookup transaction finishes before DDL, with no cache or readiness state shared across consumer instances, so a later dropped target is checked again.

Performance and limits

Warm initialization replaces two SQL DDL paths with one metadata transaction. Cold initialization adds that lookup; the four prepared fixtures still perform real schema creation with one fewer write commit each. Executor7/8 add six read-only comparison queries in total. The observed UpdateJobSpec target DDL count falls from six to two. No shard concurrency, test timeout, retry, WAL durability or IndexSync consumer behavior changes.

The CI trace establishes the delayed fixture DDL, not the underlying cause of slow TN commits. This removes that avoidable dependency from functional progress waits; it does not guarantee that arbitrary status/data commit stalls cannot exceed the original deadline. Local timings are smoke comparisons, not a prediction of total Ubuntu CI duration.

Validation

macOS/arm64, Go 1.26.4, isolated native build:

  • Full pkg/iscp normal/race: PASS (0.928s / 2.336s).
  • Twelve deterministic readiness/ownership/error scenarios, including fresh warm consumers, cold/missing targets, drop between iterations, tenant context, partial acquisition, lookup/commit/DDL failures and cancellation: PASS; 100 exact-test race repetitions PASS.
  • Deterministic negative control: overlay only the baseline consumer source while retaining the new warm-target test. It fails with a warm target must not execute DDL; the candidate passes 100 race repetitions. This reproduces the redundant-DDL contract violation, not the historical CI slow-commit timeout (the unmodified local Executor7 baseline also passed).
  • Eight real engine race controls (Executor1/6/7/8, UpdateJobSpec, InvalidTimestamp, CancelIteration1/2): PASS. After the batching refinement, all four affected controls pass again, totaling 7.13s versus 7.30s before, including the added data assertions.
  • Same-process adaptive race controls: Executor7 x22, Executor8 x17, UpdateJobSpec x10 and InvalidTimestamp x22 all PASS. Counts were fixed before running from the measured test-body budget; no failed-test retries.
  • Full engine package normal: PASS, 136.009s versus 136.987s baseline. An intermediate pre-batching run was 147.346s; single-run timing variation is not a CI performance guarantee.
  • Scoped formatting, default go-test vet, golangci-lint and diff checks: PASS, zero lint issues.
  • Full engine package race: PASS, 172.938s.

No new BVT: the changed consumer is the CN test consumer; existing real engine integration supplies the data, transaction, tenant and recovery oracles. CI will remain pending at delivery.

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

Choose a reason for hiding this comment

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

Astra medium deep review at exact head 9f5aa57. COMMENT ONLY (self-authored PR).\n\nNo actionable P0/P1/P2 findings. Reviewed target readiness and tenant-scoped lookup, cold-DLL fallback/error propagation, partial-acquisition rollback, bounded cancellation cleanup, fixture setup/isolation, transaction ownership, teardown, and bidirectional row correctness oracles. No new shared cache, goroutine, unbounded accumulation, leak, or lifecycle issue found.\n\nTwelve deterministic scenarios cover warm/cold targets, fresh consumers, target removal, tenant context, acquisition/lookup/commit/DDL failures, and cancellation. Exact-head CI passed; Ubuntu race logs show Executor7, Executor8, and InvalidTimestamp passing, and engine shards succeeded. git diff --check passed.\n\nResidual note: removing fixture DDL from propagation waits reduces timing coupling, but unchanged 10-second waits were not independently stress-tested under arbitrary commit stalls.

@XuPeng-SH
XuPeng-SH merged commit e66c9da into matrixorigin:main Sep 17, 2026
15 of 19 checks passed
XuPeng-SH added a commit that referenced this pull request Sep 17, 2026
## What type of PR is this?

- [ ] API-change
- [x] BUG
- [x] Improvement
- [ ] Documentation
- [ ] Feature
- [x] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

Fixes #28655
Related to #28419

## What this PR does / why we need it:

`TestCheckLeaseFailed` can exhaust its initial 10-second watermark wait
before it reaches the lease-rejection scenario. In the reported CI
failure, cold sink database/table commits consumed about five seconds,
followed by a roughly 3.45-second data commit. The sink preparation
introduced by #29051 did not cover this test.

Prepare the empty sink before registering the job using the existing
single-transaction fixture helper. Keep real data propagation and all
lease-rejection deadlines/assertions, and add a bidirectional
source/sink comparison before injecting the failure. Generate only the
two rows the test uses.

Defer executor Stop so it joins background work before the earlier
lease-stub reset and engine/RPC teardown. Previously, testing cleanup
ran Stop after those function defers, allowing background requests
against closed dependencies on early failures.

This changes one test only. It removes cold DDL from the propagation
budget and combines two setup commits into one; it does not promise
elimination of unrelated slow-commit watermark failures. Cold-target
coverage remains in the existing engine tests.

Validation (macOS arm64, Go 1.26.4, repository CGo wrapper,
`matrixone_test`, `-short`):

- Exact test under race: PASS, then 21/21 same-process repetitions PASS
(`-count=21`).
- Full `./pkg/vm/engine/test`, normal `-count=1`: PASS, 151.836s,
including the changed test and unchanged cold-target
`TestISCPExecutor3`.
- Incremental golangci-lint for the changed package: 0 issues; default
test vet, gofmt and diff checks passed.
- Same-host single-run race test body: 1.49s before / 1.40s after. This
is a smoke comparison, not a statistical CI speedup claim. Logs confirm
sink DDL moved before registration and uses one transaction instead of
two.

Historical Ubuntu/x86 CI supplied the timeout evidence; it was not
reproduced locally. CI for this PR has not been awaited.

This branch was previously deployed

1 inactive deployment
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/enhancement 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