Repository navigation
Description
Summary
After a controlled 3 CN to 1 CN topology comparison for ordered-set percentile, DROP DATABASE consistently returns ERROR 20702: lock table bind changed. The ordered-set query results themselves pass; the failure occurs only during test cleanup.
Environment
- Branch: main
- MatrixOne commit: 9b7c2c2
- Deployment: TKE distributed cluster; workload first runs with 3 Working CN, then scales to 1 Working CN using the same 10,000,000-row fixture. This is controlled scale-down, not Chaos or CloneSet replacement.
- Test scripts: mo-nightly-regression commits a7d7890d690ae8b43b492f409da275a6dc7d70be and 8041f318ae57535411f2684bcc6a3db3914113eb
Reproduction
- Start the distributed TKE cluster with 3 Working CN.
- Create the 10,000,000-row ordered-set percentile fixture, including hot/cold skew_g groups.
- Execute percentile_cont and percentile_disc for ASC/DESC and p=.25/.5/.95; compare the 3-CN results with the same fixture after controlled scale-down to 1 CN.
- After all result and topology assertions pass, execute DROP DATABASE for the temporary test database.
Expected
DROP DATABASE succeeds and the test finishes successfully.
Actual
Both executions completed all functional assertions successfully, including same-fixture 3-CN to 1-CN comparison, then failed at identical cleanup SQL:
ERROR 20702 (HY000): lock table bind changed
The workflow-level namespace cleanup succeeded in both runs, so the isolated namespace was removed.
Stability
Stable reproduction: 2/2 focused TKE executions on the same MatrixOne main commit.
- Run 36371110052, query job 108768278275, Nightly a7d7890: https://github.com/matrixorigin/mo-nightly-regression/actions/runs/36371110052/job/108768278275
Artifact: https://github.com/matrixorigin/mo-nightly-regression/actions/runs/36371110052/artifacts/10949632272 - Run 36373963633, query job 108776647960, Nightly 8041f318: https://github.com/matrixorigin/mo-nightly-regression/actions/runs/36373963633/job/108776647960
Artifact: https://github.com/matrixorigin/mo-nightly-regression/actions/runs/36373963633/artifacts/10950788116
Artifact ZIP SHA-256: 4de8541e9ff25caead6da378a219e22d6aba1905054992686f12bf88d398711c
Scope and related issue
This is not an ordered-set percentile result mismatch: all R029 functional assertions passed before cleanup. It may be related to the LockService/CN-topology class in #28637, but that issue used CloneSet replacement; this reproducer uses controlled 3-to-1 scale-down, so the root cause is not yet confirmed as the same.
Requested investigation
Please investigate LockService binding reconciliation after controlled CN scale-down, specifically why a subsequent DROP DATABASE can return 20702 after otherwise successful distributed aggregate queries.
Activity
fix: evict idle lock routes after CN scale-down (#30269)
gouhongshen commentedon Oct 16, 2026
Reproduction record from MatrixOne CI (unrelated PR run):
MatrixOne ALL CIrun 38882194805, job116916731411— Matrixone UT Coverage execution / UT Coverage on Ubuntu/x86, attempt 1, head6a2b64bb829e46429309e8f7743c7956db855cdf(which containsmainthroughb3d6b21fe9, including fix: evict idle lock routes after CN scale-down #30269).pkg/tests/issues/isolated / TestDropDatabaseAfterCNScaleDown—--- FAIL: TestDropDatabaseAfterCNScaleDown (26.50s). This is the isolated embedded-cluster root added by fix: evict idle lock routes after CN scale-down #30269 as the regression test for this issue's bug class (3 CN, warm a global lifecycle lock on every CN, scale down to one survivor, thendrop database idle_route_after_scalemust succeed without a client retry). In the failing test's output window the survival CN loggedERROR cn-service frontend/session.go:4828 lock table bind changedon amoadminsession at10:23:20.785561Z— the sameERROR 20702: lock table bind changedclass reported here.pkg/lockservice,pkg/tests/issues/isolated/,pkg/embed, orpkg/frontendproduction code (git diff origin/main...HEAD -- pkg/lockservice pkg/tests/issues/isolated/ pkg/embedis empty), and the failing test exercises DROP DATABASE/lock-table-bind lifecycle after controlled scale-down, which none of the PR's files are on.go testassertion output is not echoed in the job's downloadable log (the job prints only the FAIL summary plus panic-like teardown context).Failed coverage UT packages(FAIL github.com/matrixorigin/matrixone/pkg/tests/issues/isolated) andFailure details(TestDropDatabaseAfterCNScaleDown: --- FAIL (26.50s)).Recorded 2026-10-16T11:00Z by the issue-fix loop for PR #29798. Tracked from this PR's CI-blockers comment until verified resolved.
slyunnn commentedon Oct 21, 2026
Regression and extended verification for #29447 (2026-10-21)
Verification Environment
main:a648b13e53cf0a07ff19211203a69e37b2d1dd93—feat(plan): add opt-in derived view query planning (#30551). The Nightly workflow pinned this full SHA, resolved thecommit-a648b13image to immutable digestsha256:d0e1bcd6b3724ac175096b05ba23e8556973646203ad239b942341e6c0d20797, and deployed it to TKE.3 CN / 1 TN / 3 Log service pods / 2 Proxy pods, then controlled scale-down to1 CNwith the same fixture. SQL used PyMySQL's MySQL text protocol through Proxy port6001. Direct CN endpoints were not used for this TKE replay.3 CNcluster and MySQL text-protocol connections to individual CNs. The separate-process local comparison run used3 CN / 1 TN / 1 Log service / Proxy, with Proxy6001and CN ports16001/16002/16003, but its binary was built from the earlier63a964a82fbaae4759cfabb45655e0185bc0979c; it is supporting evidence, not the latest-main acceptance run.4f9f2e33c9f5a046936550c884db6c1066d6c749—fix: evict idle lock routes after CN scale-down.What Was Covered
main,TestDropDatabaseAfterCNScaleDownpassed3/3uninstrumented local runs and10/10runs with-covermode=atomicover the isolated test and LockService packages. It warms lock routes on all3CNs, retires the owner, and asserts the first post-scaleDROP DATABASEsucceeds without a client retry.10,000,000-row report recorded3working CN backends before scale-down and1afterward, withtopology_consistency.pass=trueand identical same-fixture result sets.DROP DATABASE IF EXISTSthrough Proxy6001without20702; its report hasstatus=passed,cleanup_error=null, and no stage failures. The workflow's TKE environment cleanup job also succeeded.3to1, and surviving pods had0restarts. Nolock table bind changedor20702appears in the collected pod logs.idle_lock_route_scale_down_test.go:122: the firstDROP DATABASE idle_route_after_scalereturnedError 20702 (HY000): lock table bind changed. Its diagnostic artifact showstable-id: 2exhausting the10slock retry budget. This is a real test assertion failure, not merely background logging.a648b13e; the local coverage loop used macOS/arm64 and only the targeted packages. No direct-CN TKE SQL or separate MOTR replay was performed for this topology-controlled case.Findings
The original TKE scale-down/cleanup scenario now passes on the tested latest-main commit, and the targeted local regression passes repeatedly. However, the post-fix Linux/x86 coverage failure proves the first post-scale
DROP DATABASEcan still return20702under at least one timing/environment condition. The failing lock operation was ontable-id: 2(mo_catalog.mo_tables), while the existing isolated test's explicit route-readiness probe watchesmo_feature_registry; this difference is a diagnostic clue, not a confirmed root cause. Please have the MatrixOne development team investigate binding reconciliation and retry exhaustion for catalog DDL after CN owner retirement. No MatrixOne source change is made in this test-only work.MOTR / BVT Coverage
TestDropDatabaseAfterCNScaleDown: latest-main3/3normal and10/10targeted atomic-coverage runs.topology_consistencyworkflow: run #39539175517, diagnostic artifact. No new MOTR/BVT file or issue-specific PR was added because SQL alone cannot deterministically control CN lock ownership and the existing Go/Nightly regressions already cover the topology transition.3 CN → 1 CNtransition while reusing a10,000,000-row fixture; this execution boundary and its cleanup cannot be established by merely increasing rows in a single-node SQL test.Final Conclusion
Partially fixed. The original
10,000,000-row TKE scenario passes on pinned latestmain, including the first cleanupDROP DATABASE, but the post-fix Linux/x86 coverage failure of the same first-drop assertion remains unexplained and has not been independently rerun on this exact main commit. MatrixOne service-code investigation belongs to development; our scope is testing and evidence only.slyunnn commentedon Oct 23, 2026
Additional catalog DDL evidence after abrupt CN loss (2026-10-23)
Following the separate
20702observation during #30574 verification, I reproduced catalog DDL failures without runningmo_dumpor restoring a dump. I am adding the evidence here to avoid a duplicate report; equivalence to this issue's controlled scale-down root cause is not confirmed.Environment
origin/main:bc84bd142600b745503e225cb89cb1526df8d35e—fix(plan): eliminate unobserved sorts below scalar COUNT (#30828); clean source, freshly rebuilt binary, Go1.27.1, Linux/arm64,TYPECHECK=1. Binary-versionand SQLgit_version()matchedbc84bd1426.2 CN / 1 TN / 1 Log service / Proxy. Proxy127.0.0.1:6001, CN1127.0.0.1:16001, CN2127.0.0.1:16002were reachable before and after testing. Only the separately running, task-owned CN2 was terminated; CN1/TN/LOG/Proxy remained running.COM_QUERY), fresh connections for DDL assertions. DDL was actually executed directly through CN116001; CN216002handled fixture setup and the active stream. Proxy6001was used for version/health/cleanup checks, not for a faulted DDL replay.Standalone reproduction sequence
t(id INT PRIMARY KEY), thenINSERTone row. Through CN1, verifyCOUNT(*)=1,SUM(id)=1and a no-faultCREATE DATABASE/DROP DATABASEcontrol.SELECT result, LPAD(CAST(result AS CHAR),200,'x') FROM generate_series(1,200000) g. Read the first row and confirm the tagged query is still active inSHOW PROCESSLISTbefore fault injection. No export tool or dump file is involved.SIGKILLonly to CN2; verify exit137. On a fresh CN1 connection, execute a singleCREATE DATABASE <unique_offline_name>and record its first result without a client retry. Check the original table remains readable.git_version(). On fresh CN1 connections, execute oneCREATE DATABASE <unique_online_name>and oneDROP DATABASE <fixture_name>, recording each first result. SQL connectivity/version readiness is not asserted to prove allocator retirement or complete recovery.Observed results
4serial fault cycles: an initial3-cycle run plus1additional recheck. The4/4no-fault create/drop controls passed; sourceCOUNT(*)=1,SUM(id)=1remained correct after every loss.CREATE DATABASEwhile CN2 was offline:20702,lock table bind changedin2/4cycles, with client-observed elapsed times28.128sand32.216s; the other2passed (21.914s,0.854s). This is timing/ownership dependent, not a claim of deterministic failure on every kill.CREATE DATABASEafter CN2 became SQL-connectable:20702in1/4cycles (10.326s); the other3passed (10.253s,0.242s,0.248s). First post-restartDROP DATABASEpassed in4/4cycles. Successful later operations do not erase the earlier first-attempt failures.lock retry budget exhausted for backend availability error,retry-budget: 10s, ontable-id: 1(mo_catalog.mo_database) andtable-id: 272438(mo_catalog.mo_database_defaultsin this fixture). The latter failed within the internalINSERT INTO mo_catalog.mo_database_defaults (...)belonging to the failedCREATE DATABASE. The wall-clock SQL latency can exceed the logged lock retry budget.20702evidence above is the actual DDL server response, also matched in server logs.Scope and follow-up
The earlier #30574 restore failed at line
4,CREATE DATABASE, notDROP DATABASE. Its symptom is independent of invokingmo_dump, but an exact shared root cause with #29447 is still unproven: this probe uses abruptSIGKILLplus restart (2 CN), whereas the original case uses controlled3 CN → 1 CNretirement. The failing catalog table IDs also differ from the earlier coverage failure ontable-id: 2.#30269 is already in the tested main. Follow-up #30832 remains open and was not tested here; its description targets acknowledged lock retirement on orderly shutdown and explicitly retains failure detection for abrupt failures. These results do not establish whether that PR resolves this abrupt-loss case. Please confirm whether this variant belongs under #29447 or needs a separate lock-recovery issue.
No production source, existing test, issue state, assignee or priority label was changed. No duplicate MOTR SQL case was added: the fault/lifecycle boundary needs an integration harness, and SQL-only replay would not reproduce it. No additional TKE/performance or arbitrary larger-data run was performed; the
200,000generated rows only hold a real stream in flight, while the DDL fixture has one row. This comment is failure evidence / recovery-scope clarification, not acceptance of seamless failover or a newFixedconclusion.fix: recover legacy JSONLINE and retire locks on CN shutdown (#30832)
XuPeng-SH commentedon Oct 23, 2026
PR #30832 合并状态更新(2026-10-23)
PR #30832 已合并(head
6bd96852121915fd2a03e0b1c85bbfb4f46b72cb,merge commit5fe68a88e48ae115856b18deaeecc4953101a0be)。其目标包括 orderly CN shutdown 时向 allocator 报告完成 drain,并有 PR review 报告称受控 scale-down 回归通过;这些结果来自 PR/review 记录,本轮未在本地复跑。这不能验证 issue #29447 的所有场景:该 PR 明确保留 abrupt CN failure / control-plane unavailable 的既有 failure detection;相关评论中的 abrupt-loss
20702变体也未确认与本 issue 同根因。另有 Mergify 记录显示CI Required在 head6bd9685失败离队,GitHub 当前 combined status 未返回 checks。因此保留 issue open,仍需针对失败变体和最终合并提交确认。gouhongshen commentedon Oct 23, 2026
CI reproduction record —
TestDropDatabaseAfterCatalogCleanupDuringCNScaleDown(cleanupDuringRetirement variant), 2026-10-23T12:49ZMatrixOne ALL CIrun 39949830119 (attempt 1, Mergify merge-queue speculative check,pull_request_target), job 120401431840 — Matrixone UT Coverage execution / UT Coverage on Ubuntu/x86, at queue headb2992ed7f7d0c057729ff7ff868a3179a0e2770f(in-place merge of PR fix(disttae): hand alpha stats workers a detached table stock snapshot #30926 head6f3a042b8e192f33343a78680f9e633c0d8060f9with main5fb586e1429386260b900171f65ffa844f49c981, which contains fix: recover legacy JSONLINE and retire locks on CN shutdown #30832 — the PR that added this cleanup-during-retirement variant of the first-post-scale-DROP fixture).--- FAIL: TestDropDatabaseAfterCatalogCleanupDuringCNScaleDown (189.05s)inpkg/tests/issues/isolated. The survivor CN2-cn-14005executeddrop database idle_route_after_scale; inside that statement the internaldelete from mo_catalog.mo_database_defaults where account_id=0 and database_id=272687(table-id 272438) exhausted the lock retry budget —lockop/lock_op.go:1734 lock retry budget exhausted for backend availability error {"table-id": 272438, "error": "lock table bind changed", "retry-budget": "10s"}— and surfacedError 20702 (HY000): lock table bind changedto the client. The assertionthe first post-scale DROP must succeed without a client retry(idle_lock_route_scale_down_test.go:160) failed.lock retry budget exhausted ... retry-budget: 10son catalog tables, and specifically table-id 272438 =mo_catalog.mo_database_defaults, the same table-id recorded in the 2026-10-23T07:34Z evidence comment above. It also reproduces the still-unexplained coverage-run failure of the first-drop assertion noted in the 2026-10-21 verification comment (that one on the non-cleanup variant, table-id 2). The retry-exhaustion/binding-reconciliation root cause requested there remains unfixed, and this variant adds the second-departing-CN catalog cleanup before origin close.pkg/vm/engine/disttae/mo_table_stats.go+ its test — a detached-snapshot handoff for the statistics collector's alpha workers. It changes no lockservice/lockop, catalog DDL,internal sql executor, heartbeat, or embedded-fixture code the failing statement exercises. The failing test file does not exist anywhere in the PR branch (4f9182f8ac); it only entered this head via main through the merge-queue in-place merge. The same first-drop failure class was already recorded from an unrelated PR's coverage run on 2026-10-16.Failed coverage UT packages/Failure details, and the run'sut-coverage-diagnostics-attempt-1artifact (ut-coverage-incident.mdplus the full failed-test output, where the failure excerpt above is verbatim; assertion atidle_lock_route_scale_down_test.go:160/42).Recorded 2026-10-23T12:49Z by the issue-fix loop for PR #30926. Tracked from that PR's CI-blockers comment until verified resolved.
XuPeng-SH commentedon Oct 23, 2026
Follow-up on PR #30962 scale-down regression coverage (2026-10-23)
PR #30962 merged at head
8260bcdfd983e4417f24c5ec11606fafe2db8850(merge commit06b8ce7bab7a57003e25c52a45f5712105e71788) and broadens the readiness probe to inspect cached catalog routes before the first post-scale DROP. The final test still only assertsrequire.NotEmpty(cachedCatalogBinds), however. The fixture retires two CN owners, but this assertion does not prove the captured set contains a route for each departing owner; the later eviction/allocator checks iterate only that captured set. It can therefore pass while validating only one of the two retiring owners.Please make the regression sensitive to both owners—for example, assert that the captured pre-retirement binds include both non-survivor service IDs (and explicitly warm a catalog route for each if needed). This is a test-coverage gap in the readiness gate; I am not claiming the merged production fix is incorrect. I could not independently run MatrixOne tests in this workspace.
slyunnn commentedon Oct 26, 2026
Regression and extended verification for #29447 (2026-10-26)
Verification Environment
origin/main:5fe08a3307e246e1ab9951ab690b50557af0f509—fix(ci): preserve SCA compatibility and explain full-scan fallback (#31142). The clean test checkout matched this SHA. The Linux/arm64 Go1.27.1binary was rebuilt withTYPECHECK=1and restarted; binary-version, current-startISCP-Task Start, and SQLgit_version()=5fe08a3307confirmed the running version.2 CN / 1 TN / 1 Log service / Proxy. Proxy127.0.0.1:6001, CN1127.0.0.1:16001, and CN2127.0.0.1:16002were all connected and reported the current build. The controlled scale-down regression itself started an isolated embedded3 CN → 1 CNtopology and used MySQL text-protocol SQL connections directly to its CNs. The separate abrupt-loss probe used PyMySQLCOM_QUERYdirectly on CN1/CN2; Proxy was used for health and cleanup verification, not as the originalDROProute.4f9f2e33c9f5a046936550c884db6c1066d6c749—fix: evict idle lock routes after CN scale-down; #30832, merge5fe68a88e48ae115856b18deaeecc4953101a0be—fix: recover legacy JSONLINE and retire locks on CN shutdown. Both are included in the testedmain.What Was Covered
TestDropDatabaseAfterCNScaleDownpassed in normal and atomic-coverage modes (2/2). It starts3CNs, warms catalog lock routes, retires2CNs, and requires the firstDROP DATABASEon the survivor to succeed without a client retry.TestDropDatabaseAfterCatalogCleanupDuringCNScaleDownpassed in both modes (2/2), including transaction cleanup during owner retirement. The two test roots and two modes completed4/4with exit status0.200,000-row stream on CN2 was confirmed withSHOW PROCESSLIST, then CN2 wasSIGKILLed (exit 137). CN1's firstCREATE DATABASEwhile CN2 was offline returned20702: lock table bind changedin2/2cycles. After CN2 reached SQL readiness, the firstCREATE DATABASEand firstDROP DATABASEalso returned20702in2/2cycles each.20702occurred in an embedded test log; it was not the asserted first-DROPresult.10,000,000-row replay, Linux/x86 UT Coverage, or direct-Proxy execution of the embedded transition. The existing readiness probe checks cached catalog routes but does not prove that both departing CN IDs are represented; a passing test cannot establish that stronger two-owner condition.Findings
The reported controlled
3 CN → 1 CNfirst-DROPcontract passed on thismain, including the cleanup interleaving and atomic instrumentation. The abrupt CN-loss extension still produced client-visible20702on catalog DDL. PR #30832 specifically addresses orderly drain; abrupt failures still follow failure detection. These results do not establish that both failure paths share one root cause.MOTR / BVT Coverage
The existing isolated MatrixOne Go tests directly control CN retirement and assert the first SQL
DROP. The prior TKE run #39539175517 covered the10,000,000-row original through Proxy, but used the oldera648b13ebuild and is not a latest-main pass. No duplicate SQL-only MOTR case was added because it cannot deterministically control lock ownership and CN retirement.Large-data regression on this latest commit is not required to decide the lock-route contract: owner retirement and route convergence, not row count, trigger it;
1persisted row covers the controlled transition. The200,000-row stream was used only to keep the faulted query active, not as a throughput or row-count oracle.Final Conclusion
Partially fixed. Controlled scale-down first-
DROP DATABASEpassed4/4focused latest-main runs. The distinct abrupt-loss catalog DDL path still fails with20702, and latest Linux/x86/TKE plus both-owner readiness proof remain unverified. The issue remains open for developer assessment; no service source or issue metadata was changed.aptend commentedon Oct 26, 2026
请按原始问题范围关闭 #29447。现有证据已经支持关闭,不应再把“双 owner 覆盖”等测试增强建议升级为关闭前置条件。
本 issue 报告的是受控 3 CN → 1 CN 缩容后,首次 DROP DATABASE 返回 20702。对应修复 #30269、#30832,以及后续 readiness 修正 #30962 均已合并,验收证据也已经存在:
“双 owner”可以作为后续测试增强独立跟进。该建议本身没有给出最终修复版本在原受控缩容场景下的新失败,不能仅凭潜在覆盖改进继续无限延长本 issue 的验收范围。
SIGKILL/重启后的 catalog DDL 失败是另一种故障模型,且目前尚未证明与本 issue 同根因。已有的真实失败证据应整理到新的 issue,独立调查和跟踪,不应继续挂在本 issue 下阻塞原问题关闭。
请关闭本 issue。后续如发现新的故障或原场景的新复现,请另开 issue,附运行版本、最小复现步骤和日志。测试增强建议与新的故障报告都不应继续充当本 issue 的关闭门槛。
slyunnn commentedon Oct 26, 2026
QA scope correction and closure recommendation — #29447 (2026-10-26)
Following the developer's scope clarification, I am narrowing the acceptance verdict to the reported original fault: the first
DROP DATABASEafter a controlled3 CN → 1 CNscale-down must succeed without client retry.The relevant fixes #30269 (
4f9f2e33c9f5a046936550c884db6c1066d6c749), #30832 (5fe68a88e48ae115856b18deaeecc4953101a0be), and readiness follow-up #30962 (06b8ce7bab7a57003e25c52a45f5712105e71788) are all ancestors of the verifiedmaincommit5fe08a3307e246e1ab9951ab690b50557af0f509. On that freshly built runtime,TestDropDatabaseAfterCNScaleDownandTestDropDatabaseAfterCatalogCleanupDuringCNScaleDownpassed in normal and atomic-coverage modes:4/4focused runs, retaining the first-attemptDROP DATABASEassertion. The test topology is the original controlled3 CN → 1 CNtransition, not merely a SQL connectivity check; see the execution record.I also correct one statement in my earlier comment: I did not personally rerun Linux/x86, but the existing official Linux/x86 UT job and Linux/x86 Coverage job both completed successfully. Thus “no x86 validation” must not be treated as a closure blocker. The suggested two-departing-owner readiness assertion is worthwhile follow-up test hardening, but no new failure of the original controlled scale-down contract has been shown on the final fix; it is not an acceptance prerequisite.
The
SIGKILL/restart catalog-DDL20702observations are real, but they use a different failure model and have not been shown to share the original root cause. They now have an independent investigation issue: #31184. Neither that issue nor a new10,000,000-row TKE run is needed to decide this lock-route first-DROPcontract; the defect depends on owner retirement and route convergence rather than row count.Final conclusion for the original scope: Fixed. This supersedes the broader Partially fixed wording in my earlier comment, which conflated the separate abrupt-loss observation with this issue's acceptance criteria. #29447 can be closed; any future reproduction of the controlled first-
DROPfailure should be reported with its exact build, topology, first-attempt result, and lock-route logs.