Repository navigation
Description
Is there an existing issue for the same bug?
- I have checked the existing issues.
Branch Name
main
Commit ID
Incident: a2d9070974cd42fc11ac530e52f962a696df9089
Still present in current main: ffc8d9f0625c76e87ba967984ce19db2d082b0ba
Other Environment Information
- TKE distributed deployment: 3 CN, 1 TN, 3 LogService, 2 Proxy
- Namespace:
mo-main-commit-a2d907097-20260901 - Workload:
mo-loadconcurrent account lifecycle tests - Run: https://github.com/matrixorigin/mo-nightly-regression/actions/runs/33523792810
- Failing job: https://github.com/matrixorigin/mo-nightly-regression/actions/runs/33523792810/job/100133983379
Actual Behavior
The normal-concurrency create_drop_account case completed, but
create_drop_account_high caused account lifecycle operations to wait for
roughly 60-100 seconds and then fail at the client connection timeout.
The high-concurrency case started at 2026-09-02 05:32:36 UTC:
CREATE side:
VUSER : 50
SUCCESS : 260
RT_MAX : 75574 ms
RT_AVG : 64650.75 ms
DROP side:
VUSER : 20
SUCCESS : 764
ERROR : 37
RT_MAX : 100089 ms
RT_AVG : 4947.66 ms
The failed requests were DROP ACCOUNT IF EXISTS ... statements. They
reported:
Communications link failure
The last packet successfully received from the server was about 100,000
milliseconds ago.
This is not evidence of a network disconnect by itself. It is the client-side
surface after the SQL request receives no response for the JDBC timeout.
Proven Regression Cause
PR #27370, merge commit dae2725bef5c81dcb9b5d2fab9a48afe37e2c760,
added this call inside every CREATE ACCOUNT transaction:
inheritViewMetadataRevalidation(ctx, bh, serviceID, newTenantID)Code:
matrixone/pkg/frontend/authenticate.go
Lines 10610 to 10612 in ffc8d9f
if rtnErr = inheritViewMetadataRevalidation(ctx, bh, ses.GetService(), newTenant.GetTenantID()); rtnErr != nil { return rtnErr } matrixone/pkg/frontend/authenticate.go
Lines 10629 to 10652 in ffc8d9f
func inheritViewMetadataRevalidation( ctx context.Context, bh BackgroundExec, serviceID string, accountID uint32, ) error { if err := bh.Exec(ctx, catalog.ViewMetadataLifecycleGateSQL); err != nil { if !compile.ViewMetadataRefreshEnabled(serviceID) && (moerr.IsMoErrCode(err, moerr.ErrNoSuchTable) || moerr.IsMoErrCode(err, moerr.ErrBadDB)) { return nil } return err } err := bh.Exec(ctx, fmt.Sprintf( "insert into %s.%s (%s) select %d,0,0,0,'%s','%s',0,0,0,0,0,'','','','',d.source_relation_kind,'',0,null,0,d.dependency_generation "+ "from %s.%s d where d.account_id=0 and d.target_relation_id=0 and d.dependency_ordinal=0 "+ "and d.source_relation_kind in ('%s','%s','%s','%s') and not exists (select 1 from %s.%s a "+ "where a.account_id=%d and a.target_relation_id=0 and a.dependency_ordinal=0)", catalog.MO_CATALOG, catalog.MO_VIEW_DEPENDENCIES, catalog.MoViewDependenciesColumns, accountID, catalog.LegacyViewScanCursorDatabase, catalog.LegacyViewScanCursorRelation, catalog.MO_CATALOG, catalog.MO_VIEW_DEPENDENCIES, catalog.ViewRefreshStatusRevalidateRequired, catalog.ViewRefreshStatusRevalidateScan, catalog.ViewRefreshStatusActivated, catalog.ViewRefreshStatusLegacyScan, catalog.MO_CATALOG, catalog.MO_VIEW_DEPENDENCIES, accountID))
The function unconditionally executes:
SELECT rel_id
FROM mo_catalog.mo_tables
WHERE account_id = 0
AND reldatabase = 'mo_catalog'
AND relname = 'mo_view_refresh'
FOR UPDATE;Definition:
matrixone/pkg/catalog/view_metadata.go
Lines 30 to 31 in ffc8d9f
const ViewMetadataLifecycleGateSQL = "select rel_id from mo_catalog.mo_tables " + "where account_id=0 and reldatabase='mo_catalog' and relname='mo_view_refresh' for update"
All concurrent account creations therefore contend for the same system-account
catalog row. The lock is held in the surrounding account-creation transaction,
which converts independent tenant creation into one global serial queue.
Concurrent DROP work then overlaps the backed-up account lifecycle workload and
eventually reaches its 100-second client timeout.
CN logs in the incident window contain hundreds of long lock waits on the same
mo_catalog/mo_view_refresh row key. Before #27370, comparable concurrent
account runs had no such gate-row wait burst.
ViewMetadataRefreshEnabled=false does not avoid the lock. The code executes
the FOR UPDATE first and only consults that flag while handling a
missing-table/missing-database error.
No commit between the incident revision and current main changes either
inheritViewMetadataRevalidation or ViewMetadataLifecycleGateSQL.
Therefore the regression remains reachable on current main.
PR #27370 references #26227, but #26227 tracks stale View schema metadata. It
does not track this account-concurrency regression.
Expected Behavior
Creating unrelated accounts must not serialize on one global catalog row.
Concurrent CREATE/DROP ACCOUNT operations should either make bounded progress
or return a database error; they must not stall until the client reports a
connection failure.
The View metadata lifecycle must retain its correctness fence without placing
the whole account-creation transaction behind one globally exclusive row lock.
Steps to Reproduce
1. Deploy a distributed MatrixOne cluster containing PR #27370.
2. Run the normal account concurrency case as a control:
./start.sh -h <proxy> -c cases/ddl/create_drop_account/ -g
3. Run the high-concurrency case:
./start.sh -h <proxy> -c cases/ddl/create_drop_account_high/ -g
4. Use 50 CREATE workers and 20 DROP workers, as in run 33523792810.
5. Record CREATE/DROP latency and query CN lockservice logs for the
mo_catalog.mo_view_refresh row.
Expected discriminator:
- a revision before
dae2725bef5does not show the global gate-row wait
queue; dae2725bef5and current main do;- a valid fix must remove the queue while preserving View metadata lifecycle
correctness and transaction atomicity.
Additional information
- Regression-introducing PR: refactor(view): add inactive metadata lifecycle #27370
- Related feature issue, not a duplicate: [Bug]: View metadata stays stale after source column type changes #26227
- Duplicate searches included
CREATE ACCOUNT timeout,DROP ACCOUNT timeout,mo_view_refresh lock,ViewMetadataLifecycleGateSQL, and
Communications link failure account. - Historical [Bug]: bvt 'create account acc01 admin_name = 'test_account' identified by '111'' failed with 'MO does not return result in 300000 ms.'; #20223, [Bug]: create accounts 50 concurrent number test mo oom #20839, [Bug]: main tke regression: create and drop account concurrent test report table does not exist #21932, and [MO BUG]: DROP ACCOUNT causes transient permission denied errors for concurrent operations on other accounts #26315 have different causes and do
not cover this regression. - Impact: availability and severe latency regression in account lifecycle
operations. No persistent data corruption was observed in this run.
Activity
fix: preserve account lifecycle ordering under concurrency (#29234)
Ariznawlll commentedon Oct 2, 2026
测试版本
maind50a2d475a406829f67127fef7b2ad4abc1c1d3d原问题验证
在上述 commit 运行 issue 对应的定向回归。并发 CREATE ACCOUNT 共享 lifecycle gate,但不再因 View metadata 全局串行而超时;temporary alter 保持 optimistic transaction。
Happy Path 覆盖
覆盖多 account 并发创建和正常 refresh。
Unhappy Path 覆盖
覆盖 view refresh failure、temporary alter 与并发 lifecycle;失败不泄漏 gate。
白盒验证
关联修复 #28436、#29234 已进入当前
main。直接执行并检查的定向测试为:pkg/tests/issues/issue_28079_test.go的三个 lifecycle regression tests。回归测试
本问题依赖内部故障注入、并发时序、catalog/optimizer 状态或多组件协议边界,无法由普通 SQL golden 稳定构造,因此不放入 MOTR;回归保留在 MatrixOne UT/BVT 层。对应定向测试在精确 commit 上通过,且未修改用户工作区。
测试证据
d50a2d475a406829f67127fef7b2ad4abc1c1d3dpkg/tests/issues/issue_28079_test.go的三个 lifecycle regression tests测试结论
测试通过。