Skip to content

test: fence optimistic snapshot commits before fixture cleanup - #28544

Merged
XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/fix-28259-registry
Sep 9, 2026
Merged

XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/fix-28259-registry

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Sep 9, 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:

Addresses #28259's shared-fixture CI failure. Keep the issue open pending CI/manual validation.

What this PR does / why we need it:

Root cause and scope

The quota test reuses a cluster initialized with pessimistic transaction-client defaults, then changes only runtime transaction mode/isolation to Optimistic/SI. It does not change the client's construction-time freshness policy. Pessimistic defaults sacrifice freshness without CN-based consistency; normally initialized optimistic clients enable CN-based consistency.

DROP SNAPSHOT's background transaction inherits the temporary optimistic mode. Its commit can return before that write is applied on CN readers, and it does not advance the pessimistic lock-service commit timestamp. Returning from the subtest and restoring runtime mode did not establish a cross-session visibility boundary for the subsequent DROP ACCOUNT, which opens a Pessimistic/RC background transaction through the independent sys session.

This permits the following stale-write mechanism:

  1. An optimistic registry replacement commits but is not yet visible at the reader frontier.
  2. A new pessimistic cleanup reads the preceding version. The optimistic commit is not represented by the lock timestamp used to detect a stale read.
  3. Cleanup writes its replacement using that older row ID.
  4. A later RC statement advances the snapshot and can see the newer committed row plus cleanup's own insertion.

This is not evidence that no-op UPDATE itself is intrinsically invalid, nor justification to remove the write-conflict barriers.

Evidence

Three retained CI artifacts first log a registry gate UPDATE with AffectedRows=2 during the quota test's account cleanup, followed by snapshot-test failures:

The original quota test with added external row-ID probes also failed locally, without any kernel change: before cleanup it returned one row ending -34; afterward it returned two distinct rows ending -37 and -36. The first internal cleanup gate already affected two rows.

A separate controlled experiment reproduced the mechanism with an older pessimistic transaction, an intervening optimistic UPDATE, a no-op UPDATE at the older snapshot, and an explicit snapshot advance: the read returned two rows instead of one. That experiment also hit an unrelated internal-DROP cleanup error afterward; it is not presented as a passing test or included as a permanent test of unsupported mixed configuration. The historical CI artifacts do not contain the row-level timestamp trace needed to independently establish every step for each historical occurrence.

Fix

  • After optimistic scenario operations finish, capture one maximum committed timestamp across both CN clients. Wait for both CNs to apply that fixed frontier before restoring runtime mode and opening parent cleanup transactions.
  • Give the fence a fresh ten-second cancellation bound; attempt both waits and aggregate failures. Mode restoration remains independently deferred even if the fence fails.
  • Collect all concurrent creator results before assertions can unwind the mode. Use a bounded context for the actual SQL requests instead of timers that only stop the observer.
  • Retain bounded, SQL-visible singleton checks before and after the existing cleanup attempt. Observe actual row IDs without deduplicating them; collect at most three rows. Probe deadlines cannot consume the original DROP ACCOUNT cleanup deadline.

All original quota cases remain: quotas 1/2, disabled/unlimited, concurrent contenders, replacement, rejected creation without persisted residue, and absence of leaked retry errors.

Risk / performance / unhappy paths

Only the test file changes. No production transaction, lock, MVCC, DDL, or snapshot policy changes; no new cluster, sleeps, retries, or flushes. The new wait is a completion condition for already-committed work, not a delay chosen to make a test pass.

Check Closure
Ownership Scenario connections retain their original cleanup owners; probe and fence contexts each have a deferred cancellation.
Waiting SQL requests and the fixed-frontier fence are bounded; wait failure does not bypass mode restoration.
Growth Four creator results, two clients, at most three diagnostic rows; no unbounded work or logging.

A timed-out SQL client is not proof that every disconnected server transaction has terminated; that path fails the test and does not claim a successful transition. The existing account-cleanup helper ignores DROP errors, so the post-probe is explicitly after the cleanup attempt, not independent proof that DROP committed.

The fix closes this test's transition after completed optimistic work. It does not repair arbitrary concurrently mixed optimistic/pessimistic transactions or refresh a transaction already opened before another CN commits. The controlled experiment remains evidence for that separate protocol question; production immunity is not claimed.

Validation

Base: 5f598e70bb8be8fea970faa36c500e6b2a9bb2d3 (main). Local platform: macOS/arm64, Go 1.26.4, matching native artifacts.

  • Focused quota + fence tests passed: package 14.197s; both modes and all pure fence cases selected.
  • Pure fence cases cover capture-before-wait ordering, the maximum frontier applied on both CNs, first-wait failure without skipping the second, cancellation, and no commits.
  • Focused quota + fence race tests passed once: package 21.003s, no race report.
  • The quota + fence selection passed 20 consecutive -race runs: package 128.356s, 20/20 quota cases passed, no DATA RACE, exit code 0.
  • go vet -mod=readonly -tags matrixone_test ./pkg/tests/issues and git diff --check passed.
  • Covered owning-package run (-covermode=set -coverpkg=./pkg/..., GOMAXPROCS=7) failed, package 110.716s: TestIssue27666CDCWatermarkWriteSerializesWithDrop/drop_wins timed out waiting for the expected lock waiter. This failure occurred before the modified quota test ran. The quota test subsequently passed (1.07s), with exactly one registry row both before and after cleanup, and the fence tests passed. This is not reported as an all-green package run; the separate CDC failure is outside this patch.
  • Independent gpt-6-astra medium review found no blocker in the harness-only diff; the diagnostic deadline issue found earlier was corrected.

Passing local runs do not replace Linux CI or prove every historical failure is resolved.

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

@mergify mergify Bot added the kind/test-ci label Sep 9, 2026
@XuPeng-SH
XuPeng-SH merged commit 90b3528 into matrixorigin:main Sep 9, 2026
21 of 22 checks passed
@XuPeng-SH
XuPeng-SH deleted the codex/fix-28259-registry branch September 9, 2026 19:21
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…xorigin#28544)

## What type of PR is this?

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

## Which issue(s) this PR fixes:

Addresses matrixorigin#28259's shared-fixture CI failure. Keep the issue open
pending CI/manual validation.

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

### Root cause and scope

The quota test reuses a cluster initialized with pessimistic
transaction-client defaults, then changes only runtime transaction
mode/isolation to Optimistic/SI. It does not change the client's
construction-time freshness policy. Pessimistic defaults sacrifice
freshness without CN-based consistency; normally initialized optimistic
clients enable CN-based consistency.

DROP SNAPSHOT's background transaction inherits the temporary optimistic
mode. Its commit can return before that write is applied on CN readers,
and it does not advance the pessimistic lock-service commit timestamp.
Returning from the subtest and restoring runtime mode did not establish
a cross-session visibility boundary for the subsequent DROP ACCOUNT,
which opens a Pessimistic/RC background transaction through the
independent sys session.

This permits the following stale-write mechanism:

1. An optimistic registry replacement commits but is not yet visible at
the reader frontier.
2. A new pessimistic cleanup reads the preceding version. The optimistic
commit is not represented by the lock timestamp used to detect a stale
read.
3. Cleanup writes its replacement using that older row ID.
4. A later RC statement advances the snapshot and can see the newer
committed row plus cleanup's own insertion.

This is not evidence that no-op UPDATE itself is intrinsically invalid,
nor justification to remove the write-conflict barriers.

### Evidence

Three retained CI artifacts first log a registry gate UPDATE with
`AffectedRows=2` during the quota test's account cleanup, followed by
snapshot-test failures:

- [run 34382186709 / PR
matrixorigin#28450](https://github.com/matrixorigin/matrixone/actions/runs/34382186709/job/102570044807),
first anomaly 2026-09-09 17:38:46.882859 UTC.
- [run 34338613927 / PR
matrixorigin#28272](https://github.com/matrixorigin/matrixone/actions/runs/34338613927/job/102424080218),
first anomaly 2026-09-09 10:28:38.765051 UTC.
- [run 34006770056, attempt 2 / PR
matrixorigin#28145](https://github.com/matrixorigin/matrixone/actions/runs/34006770056/job/101422120263),
first anomaly 2026-09-06 03:51:34.820578 UTC.

The original quota test with added external row-ID probes also failed
locally, without any kernel change: before cleanup it returned one row
ending `-34`; afterward it returned two distinct rows ending `-37` and
`-36`. The first internal cleanup gate already affected two rows.

A separate controlled experiment reproduced the mechanism with an older
pessimistic transaction, an intervening optimistic UPDATE, a no-op
UPDATE at the older snapshot, and an explicit snapshot advance: the read
returned two rows instead of one. That experiment also hit an unrelated
internal-DROP cleanup error afterward; it is not presented as a passing
test or included as a permanent test of unsupported mixed configuration.
The historical CI artifacts do not contain the row-level timestamp trace
needed to independently establish every step for each historical
occurrence.

### Fix

- After optimistic scenario operations finish, capture one maximum
committed timestamp across both CN clients. Wait for both CNs to apply
that fixed frontier **before** restoring runtime mode and opening parent
cleanup transactions.
- Give the fence a fresh ten-second cancellation bound; attempt both
waits and aggregate failures. Mode restoration remains independently
deferred even if the fence fails.
- Collect all concurrent creator results before assertions can unwind
the mode. Use a bounded context for the actual SQL requests instead of
timers that only stop the observer.
- Retain bounded, SQL-visible singleton checks before and after the
existing cleanup attempt. Observe actual row IDs without deduplicating
them; collect at most three rows. Probe deadlines cannot consume the
original DROP ACCOUNT cleanup deadline.

All original quota cases remain: quotas 1/2, disabled/unlimited,
concurrent contenders, replacement, rejected creation without persisted
residue, and absence of leaked retry errors.

### Risk / performance / unhappy paths

Only the test file changes. No production transaction, lock, MVCC, DDL,
or snapshot policy changes; no new cluster, sleeps, retries, or flushes.
The new wait is a completion condition for already-committed work, not a
delay chosen to make a test pass.

| Check | Closure |
| --- | --- |
| Ownership | Scenario connections retain their original cleanup owners;
probe and fence contexts each have a deferred cancellation. |
| Waiting | SQL requests and the fixed-frontier fence are bounded; wait
failure does not bypass mode restoration. |
| Growth | Four creator results, two clients, at most three diagnostic
rows; no unbounded work or logging. |

A timed-out SQL client is not proof that every disconnected server
transaction has terminated; that path fails the test and does not claim
a successful transition. The existing account-cleanup helper ignores
DROP errors, so the post-probe is explicitly after the cleanup
**attempt**, not independent proof that DROP committed.

The fix closes this test's transition after completed optimistic work.
It does **not** repair arbitrary concurrently mixed
optimistic/pessimistic transactions or refresh a transaction already
opened before another CN commits. The controlled experiment remains
evidence for that separate protocol question; production immunity is not
claimed.

### Validation

Base: `5f598e70bb8be8fea970faa36c500e6b2a9bb2d3` (main). Local platform:
macOS/arm64, Go 1.26.4, matching native artifacts.

- Focused quota + fence tests passed: package 14.197s; both modes and
all pure fence cases selected.
- Pure fence cases cover capture-before-wait ordering, the maximum
frontier applied on both CNs, first-wait failure without skipping the
second, cancellation, and no commits.
- Focused quota + fence race tests passed once: package 21.003s, no race
report.
- The quota + fence selection passed **20 consecutive `-race` runs**:
package 128.356s, 20/20 quota cases passed, no `DATA RACE`, exit code 0.
- `go vet -mod=readonly -tags matrixone_test ./pkg/tests/issues` and
`git diff --check` passed.
- Covered owning-package run (`-covermode=set -coverpkg=./pkg/...`,
GOMAXPROCS=7) **failed**, package 110.716s:
`TestIssue27666CDCWatermarkWriteSerializesWithDrop/drop_wins` timed out
waiting for the expected lock waiter. This failure occurred before the
modified quota test ran. The quota test subsequently passed (1.07s),
with exactly one registry row both before and after cleanup, and the
fence tests passed. This is not reported as an all-green package run;
the separate CDC failure is outside this patch.
- Independent gpt-6-astra medium review found no blocker in the
harness-only diff; the diagnostic deadline issue found earlier was
corrected.

Passing local runs do not replace Linux CI or prove every historical
failure is resolved.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…xorigin#28544)

## What type of PR is this?

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

## Which issue(s) this PR fixes:

Addresses matrixorigin#28259's shared-fixture CI failure. Keep the issue open
pending CI/manual validation.

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

### Root cause and scope

The quota test reuses a cluster initialized with pessimistic
transaction-client defaults, then changes only runtime transaction
mode/isolation to Optimistic/SI. It does not change the client's
construction-time freshness policy. Pessimistic defaults sacrifice
freshness without CN-based consistency; normally initialized optimistic
clients enable CN-based consistency.

DROP SNAPSHOT's background transaction inherits the temporary optimistic
mode. Its commit can return before that write is applied on CN readers,
and it does not advance the pessimistic lock-service commit timestamp.
Returning from the subtest and restoring runtime mode did not establish
a cross-session visibility boundary for the subsequent DROP ACCOUNT,
which opens a Pessimistic/RC background transaction through the
independent sys session.

This permits the following stale-write mechanism:

1. An optimistic registry replacement commits but is not yet visible at
the reader frontier.
2. A new pessimistic cleanup reads the preceding version. The optimistic
commit is not represented by the lock timestamp used to detect a stale
read.
3. Cleanup writes its replacement using that older row ID.
4. A later RC statement advances the snapshot and can see the newer
committed row plus cleanup's own insertion.

This is not evidence that no-op UPDATE itself is intrinsically invalid,
nor justification to remove the write-conflict barriers.

### Evidence

Three retained CI artifacts first log a registry gate UPDATE with
`AffectedRows=2` during the quota test's account cleanup, followed by
snapshot-test failures:

- [run 34382186709 / PR
matrixorigin#28450](https://github.com/matrixorigin/matrixone/actions/runs/34382186709/job/102570044807),
first anomaly 2026-09-09 17:38:46.882859 UTC.
- [run 34338613927 / PR
matrixorigin#28272](https://github.com/matrixorigin/matrixone/actions/runs/34338613927/job/102424080218),
first anomaly 2026-09-09 10:28:38.765051 UTC.
- [run 34006770056, attempt 2 / PR
matrixorigin#28145](https://github.com/matrixorigin/matrixone/actions/runs/34006770056/job/101422120263),
first anomaly 2026-09-06 03:51:34.820578 UTC.

The original quota test with added external row-ID probes also failed
locally, without any kernel change: before cleanup it returned one row
ending `-34`; afterward it returned two distinct rows ending `-37` and
`-36`. The first internal cleanup gate already affected two rows.

A separate controlled experiment reproduced the mechanism with an older
pessimistic transaction, an intervening optimistic UPDATE, a no-op
UPDATE at the older snapshot, and an explicit snapshot advance: the read
returned two rows instead of one. That experiment also hit an unrelated
internal-DROP cleanup error afterward; it is not presented as a passing
test or included as a permanent test of unsupported mixed configuration.
The historical CI artifacts do not contain the row-level timestamp trace
needed to independently establish every step for each historical
occurrence.

### Fix

- After optimistic scenario operations finish, capture one maximum
committed timestamp across both CN clients. Wait for both CNs to apply
that fixed frontier **before** restoring runtime mode and opening parent
cleanup transactions.
- Give the fence a fresh ten-second cancellation bound; attempt both
waits and aggregate failures. Mode restoration remains independently
deferred even if the fence fails.
- Collect all concurrent creator results before assertions can unwind
the mode. Use a bounded context for the actual SQL requests instead of
timers that only stop the observer.
- Retain bounded, SQL-visible singleton checks before and after the
existing cleanup attempt. Observe actual row IDs without deduplicating
them; collect at most three rows. Probe deadlines cannot consume the
original DROP ACCOUNT cleanup deadline.

All original quota cases remain: quotas 1/2, disabled/unlimited,
concurrent contenders, replacement, rejected creation without persisted
residue, and absence of leaked retry errors.

### Risk / performance / unhappy paths

Only the test file changes. No production transaction, lock, MVCC, DDL,
or snapshot policy changes; no new cluster, sleeps, retries, or flushes.
The new wait is a completion condition for already-committed work, not a
delay chosen to make a test pass.

| Check | Closure |
| --- | --- |
| Ownership | Scenario connections retain their original cleanup owners;
probe and fence contexts each have a deferred cancellation. |
| Waiting | SQL requests and the fixed-frontier fence are bounded; wait
failure does not bypass mode restoration. |
| Growth | Four creator results, two clients, at most three diagnostic
rows; no unbounded work or logging. |

A timed-out SQL client is not proof that every disconnected server
transaction has terminated; that path fails the test and does not claim
a successful transition. The existing account-cleanup helper ignores
DROP errors, so the post-probe is explicitly after the cleanup
**attempt**, not independent proof that DROP committed.

The fix closes this test's transition after completed optimistic work.
It does **not** repair arbitrary concurrently mixed
optimistic/pessimistic transactions or refresh a transaction already
opened before another CN commits. The controlled experiment remains
evidence for that separate protocol question; production immunity is not
claimed.

### Validation

Base: `5f598e70bb8be8fea970faa36c500e6b2a9bb2d3` (main). Local platform:
macOS/arm64, Go 1.26.4, matching native artifacts.

- Focused quota + fence tests passed: package 14.197s; both modes and
all pure fence cases selected.
- Pure fence cases cover capture-before-wait ordering, the maximum
frontier applied on both CNs, first-wait failure without skipping the
second, cancellation, and no commits.
- Focused quota + fence race tests passed once: package 21.003s, no race
report.
- The quota + fence selection passed **20 consecutive `-race` runs**:
package 128.356s, 20/20 quota cases passed, no `DATA RACE`, exit code 0.
- `go vet -mod=readonly -tags matrixone_test ./pkg/tests/issues` and
`git diff --check` passed.
- Covered owning-package run (`-covermode=set -coverpkg=./pkg/...`,
GOMAXPROCS=7) **failed**, package 110.716s:
`TestIssue27666CDCWatermarkWriteSerializesWithDrop/drop_wins` timed out
waiting for the expected lock waiter. This failure occurred before the
modified quota test ran. The quota test subsequently passed (1.07s),
with exactly one registry row both before and after cleanup, and the
fence tests passed. This is not reported as an all-green package run;
the separate CDC failure is outside this patch.
- Independent gpt-6-astra medium review found no blocker in the
harness-only diff; the diagnostic deadline issue found earlier was
corrected.

Passing local runs do not replace Linux CI or prove every historical
failure is resolved.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…xorigin#28544)

## What type of PR is this?

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

## Which issue(s) this PR fixes:

Addresses matrixorigin#28259's shared-fixture CI failure. Keep the issue open
pending CI/manual validation.

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

### Root cause and scope

The quota test reuses a cluster initialized with pessimistic
transaction-client defaults, then changes only runtime transaction
mode/isolation to Optimistic/SI. It does not change the client's
construction-time freshness policy. Pessimistic defaults sacrifice
freshness without CN-based consistency; normally initialized optimistic
clients enable CN-based consistency.

DROP SNAPSHOT's background transaction inherits the temporary optimistic
mode. Its commit can return before that write is applied on CN readers,
and it does not advance the pessimistic lock-service commit timestamp.
Returning from the subtest and restoring runtime mode did not establish
a cross-session visibility boundary for the subsequent DROP ACCOUNT,
which opens a Pessimistic/RC background transaction through the
independent sys session.

This permits the following stale-write mechanism:

1. An optimistic registry replacement commits but is not yet visible at
the reader frontier.
2. A new pessimistic cleanup reads the preceding version. The optimistic
commit is not represented by the lock timestamp used to detect a stale
read.
3. Cleanup writes its replacement using that older row ID.
4. A later RC statement advances the snapshot and can see the newer
committed row plus cleanup's own insertion.

This is not evidence that no-op UPDATE itself is intrinsically invalid,
nor justification to remove the write-conflict barriers.

### Evidence

Three retained CI artifacts first log a registry gate UPDATE with
`AffectedRows=2` during the quota test's account cleanup, followed by
snapshot-test failures:

- [run 34382186709 / PR
matrixorigin#28450](https://github.com/matrixorigin/matrixone/actions/runs/34382186709/job/102570044807),
first anomaly 2026-09-09 17:38:46.882859 UTC.
- [run 34338613927 / PR
matrixorigin#28272](https://github.com/matrixorigin/matrixone/actions/runs/34338613927/job/102424080218),
first anomaly 2026-09-09 10:28:38.765051 UTC.
- [run 34006770056, attempt 2 / PR
matrixorigin#28145](https://github.com/matrixorigin/matrixone/actions/runs/34006770056/job/101422120263),
first anomaly 2026-09-06 03:51:34.820578 UTC.

The original quota test with added external row-ID probes also failed
locally, without any kernel change: before cleanup it returned one row
ending `-34`; afterward it returned two distinct rows ending `-37` and
`-36`. The first internal cleanup gate already affected two rows.

A separate controlled experiment reproduced the mechanism with an older
pessimistic transaction, an intervening optimistic UPDATE, a no-op
UPDATE at the older snapshot, and an explicit snapshot advance: the read
returned two rows instead of one. That experiment also hit an unrelated
internal-DROP cleanup error afterward; it is not presented as a passing
test or included as a permanent test of unsupported mixed configuration.
The historical CI artifacts do not contain the row-level timestamp trace
needed to independently establish every step for each historical
occurrence.

### Fix

- After optimistic scenario operations finish, capture one maximum
committed timestamp across both CN clients. Wait for both CNs to apply
that fixed frontier **before** restoring runtime mode and opening parent
cleanup transactions.
- Give the fence a fresh ten-second cancellation bound; attempt both
waits and aggregate failures. Mode restoration remains independently
deferred even if the fence fails.
- Collect all concurrent creator results before assertions can unwind
the mode. Use a bounded context for the actual SQL requests instead of
timers that only stop the observer.
- Retain bounded, SQL-visible singleton checks before and after the
existing cleanup attempt. Observe actual row IDs without deduplicating
them; collect at most three rows. Probe deadlines cannot consume the
original DROP ACCOUNT cleanup deadline.

All original quota cases remain: quotas 1/2, disabled/unlimited,
concurrent contenders, replacement, rejected creation without persisted
residue, and absence of leaked retry errors.

### Risk / performance / unhappy paths

Only the test file changes. No production transaction, lock, MVCC, DDL,
or snapshot policy changes; no new cluster, sleeps, retries, or flushes.
The new wait is a completion condition for already-committed work, not a
delay chosen to make a test pass.

| Check | Closure |
| --- | --- |
| Ownership | Scenario connections retain their original cleanup owners;
probe and fence contexts each have a deferred cancellation. |
| Waiting | SQL requests and the fixed-frontier fence are bounded; wait
failure does not bypass mode restoration. |
| Growth | Four creator results, two clients, at most three diagnostic
rows; no unbounded work or logging. |

A timed-out SQL client is not proof that every disconnected server
transaction has terminated; that path fails the test and does not claim
a successful transition. The existing account-cleanup helper ignores
DROP errors, so the post-probe is explicitly after the cleanup
**attempt**, not independent proof that DROP committed.

The fix closes this test's transition after completed optimistic work.
It does **not** repair arbitrary concurrently mixed
optimistic/pessimistic transactions or refresh a transaction already
opened before another CN commits. The controlled experiment remains
evidence for that separate protocol question; production immunity is not
claimed.

### Validation

Base: `5f598e70bb8be8fea970faa36c500e6b2a9bb2d3` (main). Local platform:
macOS/arm64, Go 1.26.4, matching native artifacts.

- Focused quota + fence tests passed: package 14.197s; both modes and
all pure fence cases selected.
- Pure fence cases cover capture-before-wait ordering, the maximum
frontier applied on both CNs, first-wait failure without skipping the
second, cancellation, and no commits.
- Focused quota + fence race tests passed once: package 21.003s, no race
report.
- The quota + fence selection passed **20 consecutive `-race` runs**:
package 128.356s, 20/20 quota cases passed, no `DATA RACE`, exit code 0.
- `go vet -mod=readonly -tags matrixone_test ./pkg/tests/issues` and
`git diff --check` passed.
- Covered owning-package run (`-covermode=set -coverpkg=./pkg/...`,
GOMAXPROCS=7) **failed**, package 110.716s:
`TestIssue27666CDCWatermarkWriteSerializesWithDrop/drop_wins` timed out
waiting for the expected lock waiter. This failure occurred before the
modified quota test ran. The quota test subsequently passed (1.07s),
with exactly one registry row both before and after cleanup, and the
fence tests passed. This is not reported as an all-green package run;
the separate CDC failure is outside this patch.
- Independent gpt-6-astra medium review found no blocker in the
harness-only diff; the diagnostic deadline issue found earlier was
corrected.

Passing local runs do not replace Linux CI or prove every historical
failure is resolved.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

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/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