Repository navigation
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep review completed against main@2004c61075 and head b7bb5536d1.
One coverage gap was found during review: the original teardown used execSQLRequire, so deleting it also deleted the implicit assertion that a data branch containing restored cyclic foreign keys remains droppable. Fixed in b7bb5536d1 by retaining that operation as an explicit product oracle under the main bounded test context, while leaving account/snapshot/auxiliary database cleanup to the dedicated cluster owner.
Reviewed from correctness, regression-contract, performance, and unhappy-path/lifecycle angles:
- all issue #26111 behavioral oracles remain covered;
- failure paths close SQL handles before cluster cleanup;
- retained fixture state cannot cross tests because the embedded cluster/data path is private;
- the catalog-size-dependent shared 30s teardown chain is gone;
- no production behavior, retry, or global timeout changes;
- no remaining blocking finding.
Validation on the final head:
- focused test PASS (13.03s);
- race PASS (19.16s, no race);
- repeated PASS 3/3 (15.93s / 13.08s / 15.88s);
- owning package PASS 7/7 (136.14s);
- diff check PASS.
CI for the new head is allowed to complete independently; the code review itself is clean.
## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Code Refactoring - [x] Test and CI ## Which issue(s) this PR fixes: Fixes matrixorigin#28098 ## Root cause `TestIssue26111DataBranchDatabaseWithCyclicForeignKeys` owns a fresh embedded cluster with a unique private data path, but also performed SQL pre-clean and deferred teardown for an account, a snapshot, and four databases. All deferred SQL cleanup shared one 30-second context. `DROP ACCOUNT` expands into many catalog DDL/DML operations, so its cost grows with the tenant catalog. In the failed CI run, functional assertions completed around 08:17:32; `DROP ACCOUNT` then consumed almost the entire cleanup budget, and the later `DROP DATABASE issue_26111_branch` inherited the expired context and failed. Connection-refused messages appeared only during subsequent cluster shutdown and were downstream noise. ## What this PR does - Remove fixture pre-clean that cannot be needed in a fresh private cluster. - Remove scale-dependent bulk SQL teardown; cluster ownership provides fixture isolation. - Preserve `DROP DATABASE issue_26111_branch` as an explicit product oracle under the main 180-second test context. A branch with restored cyclic foreign keys must remain droppable. This corrects lifecycle ownership; it does not increase a timeout or add retries. ## Correctness and coverage The regression still verifies: - existing-target rejection and restoration of session `foreign_key_checks`; - current-state and snapshot branches; - cross-account visibility; - copied rows and cyclic foreign-key metadata remapping; - FK enforcement in every created branch; - duplicate cross-account target rejection without partial mutation; - successful drop of a branch containing restored cyclic foreign keys. Snapshot, source, auxiliary target, and account deletion were fixture cleanup rather than contracts of issue matrixorigin#26111. `DROP ACCOUNT` lifecycle behavior remains independently covered by `TestIssue27719DropAccountCleansSQLTaskLifecycle`. ## Risk and unhappy paths - On any mid-test `FailNow`, opened `sql.DB` handles close through function defers before `t.Cleanup` closes the cluster. - No later test can observe retained SQL state: `StartTestCluster` allocates a separate cluster and data path for this fixture. - Body SQL and the explicit branch-drop oracle share the bounded 180-second context. - Removing the shared cleanup chain removes a wait path whose duration scaled with catalog size. - No production code, public SQL behavior, retry policy, or global timeout changes. ## Performance Same machine and focused command: - baseline: 16.52s; - revised focused run: 13.03s; - revised same-process repetitions: 15.93s, 13.08s, 15.88s. Local steady-state change is small. On the loaded CI runner, this removes the approximately 30-second teardown tail and eliminates its catalog-size sensitivity. ## Validation - focused test: PASS, 13.03s; - focused race test: PASS, 19.16s, no race; - same-process repetition: PASS 3/3; - owning package `./pkg/tests/issues/isolated`: PASS 7/7, 136.14s; - `git diff --check`: PASS.
## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Code Refactoring - [x] Test and CI ## Which issue(s) this PR fixes: Fixes matrixorigin#28098 ## Root cause `TestIssue26111DataBranchDatabaseWithCyclicForeignKeys` owns a fresh embedded cluster with a unique private data path, but also performed SQL pre-clean and deferred teardown for an account, a snapshot, and four databases. All deferred SQL cleanup shared one 30-second context. `DROP ACCOUNT` expands into many catalog DDL/DML operations, so its cost grows with the tenant catalog. In the failed CI run, functional assertions completed around 08:17:32; `DROP ACCOUNT` then consumed almost the entire cleanup budget, and the later `DROP DATABASE issue_26111_branch` inherited the expired context and failed. Connection-refused messages appeared only during subsequent cluster shutdown and were downstream noise. ## What this PR does - Remove fixture pre-clean that cannot be needed in a fresh private cluster. - Remove scale-dependent bulk SQL teardown; cluster ownership provides fixture isolation. - Preserve `DROP DATABASE issue_26111_branch` as an explicit product oracle under the main 180-second test context. A branch with restored cyclic foreign keys must remain droppable. This corrects lifecycle ownership; it does not increase a timeout or add retries. ## Correctness and coverage The regression still verifies: - existing-target rejection and restoration of session `foreign_key_checks`; - current-state and snapshot branches; - cross-account visibility; - copied rows and cyclic foreign-key metadata remapping; - FK enforcement in every created branch; - duplicate cross-account target rejection without partial mutation; - successful drop of a branch containing restored cyclic foreign keys. Snapshot, source, auxiliary target, and account deletion were fixture cleanup rather than contracts of issue matrixorigin#26111. `DROP ACCOUNT` lifecycle behavior remains independently covered by `TestIssue27719DropAccountCleansSQLTaskLifecycle`. ## Risk and unhappy paths - On any mid-test `FailNow`, opened `sql.DB` handles close through function defers before `t.Cleanup` closes the cluster. - No later test can observe retained SQL state: `StartTestCluster` allocates a separate cluster and data path for this fixture. - Body SQL and the explicit branch-drop oracle share the bounded 180-second context. - Removing the shared cleanup chain removes a wait path whose duration scaled with catalog size. - No production code, public SQL behavior, retry policy, or global timeout changes. ## Performance Same machine and focused command: - baseline: 16.52s; - revised focused run: 13.03s; - revised same-process repetitions: 15.93s, 13.08s, 15.88s. Local steady-state change is small. On the loaded CI runner, this removes the approximately 30-second teardown tail and eliminates its catalog-size sensitivity. ## Validation - focused test: PASS, 13.03s; - focused race test: PASS, 19.16s, no race; - same-process repetition: PASS 3/3; - owning package `./pkg/tests/issues/isolated`: PASS 7/7, 136.14s; - `git diff --check`: PASS.
## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Code Refactoring - [x] Test and CI ## Which issue(s) this PR fixes: Fixes matrixorigin#28098 ## Root cause `TestIssue26111DataBranchDatabaseWithCyclicForeignKeys` owns a fresh embedded cluster with a unique private data path, but also performed SQL pre-clean and deferred teardown for an account, a snapshot, and four databases. All deferred SQL cleanup shared one 30-second context. `DROP ACCOUNT` expands into many catalog DDL/DML operations, so its cost grows with the tenant catalog. In the failed CI run, functional assertions completed around 08:17:32; `DROP ACCOUNT` then consumed almost the entire cleanup budget, and the later `DROP DATABASE issue_26111_branch` inherited the expired context and failed. Connection-refused messages appeared only during subsequent cluster shutdown and were downstream noise. ## What this PR does - Remove fixture pre-clean that cannot be needed in a fresh private cluster. - Remove scale-dependent bulk SQL teardown; cluster ownership provides fixture isolation. - Preserve `DROP DATABASE issue_26111_branch` as an explicit product oracle under the main 180-second test context. A branch with restored cyclic foreign keys must remain droppable. This corrects lifecycle ownership; it does not increase a timeout or add retries. ## Correctness and coverage The regression still verifies: - existing-target rejection and restoration of session `foreign_key_checks`; - current-state and snapshot branches; - cross-account visibility; - copied rows and cyclic foreign-key metadata remapping; - FK enforcement in every created branch; - duplicate cross-account target rejection without partial mutation; - successful drop of a branch containing restored cyclic foreign keys. Snapshot, source, auxiliary target, and account deletion were fixture cleanup rather than contracts of issue matrixorigin#26111. `DROP ACCOUNT` lifecycle behavior remains independently covered by `TestIssue27719DropAccountCleansSQLTaskLifecycle`. ## Risk and unhappy paths - On any mid-test `FailNow`, opened `sql.DB` handles close through function defers before `t.Cleanup` closes the cluster. - No later test can observe retained SQL state: `StartTestCluster` allocates a separate cluster and data path for this fixture. - Body SQL and the explicit branch-drop oracle share the bounded 180-second context. - Removing the shared cleanup chain removes a wait path whose duration scaled with catalog size. - No production code, public SQL behavior, retry policy, or global timeout changes. ## Performance Same machine and focused command: - baseline: 16.52s; - revised focused run: 13.03s; - revised same-process repetitions: 15.93s, 13.08s, 15.88s. Local steady-state change is small. On the loaded CI runner, this removes the approximately 30-second teardown tail and eliminates its catalog-size sensitivity. ## Validation - focused test: PASS, 13.03s; - focused race test: PASS, 19.16s, no race; - same-process repetition: PASS 3/3; - owning package `./pkg/tests/issues/isolated`: PASS 7/7, 136.14s; - `git diff --check`: PASS.
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #28098
Root cause
TestIssue26111DataBranchDatabaseWithCyclicForeignKeysowns a fresh embedded cluster with a unique private data path, but also performed SQL pre-clean and deferred teardown for an account, a snapshot, and four databases.All deferred SQL cleanup shared one 30-second context.
DROP ACCOUNTexpands into many catalog DDL/DML operations, so its cost grows with the tenant catalog. In the failed CI run, functional assertions completed around 08:17:32;DROP ACCOUNTthen consumed almost the entire cleanup budget, and the laterDROP DATABASE issue_26111_branchinherited the expired context and failed. Connection-refused messages appeared only during subsequent cluster shutdown and were downstream noise.What this PR does
DROP DATABASE issue_26111_branchas an explicit product oracle under the main 180-second test context. A branch with restored cyclic foreign keys must remain droppable.This corrects lifecycle ownership; it does not increase a timeout or add retries.
Correctness and coverage
The regression still verifies:
foreign_key_checks;Snapshot, source, auxiliary target, and account deletion were fixture cleanup rather than contracts of issue #26111.
DROP ACCOUNTlifecycle behavior remains independently covered byTestIssue27719DropAccountCleansSQLTaskLifecycle.Risk and unhappy paths
FailNow, openedsql.DBhandles close through function defers beforet.Cleanupcloses the cluster.StartTestClusterallocates a separate cluster and data path for this fixture.Performance
Same machine and focused command:
Local steady-state change is small. On the loaded CI runner, this removes the approximately 30-second teardown tail and eliminates its catalog-size sensitivity.
Validation
./pkg/tests/issues/isolated: PASS 7/7, 136.14s;git diff --check: PASS.