Repository navigation
Description
Is there an existing issue for the same bug?
- I have checked the existing issues.
Branch Name
4.0-dev
Commit ID
Other Environment Information
- Workflow: matrixorigin/mo-nightly-regression Big Data Test
- Run: https://github.com/matrixorigin/mo-nightly-regression/actions/runs/26542826587
- Failed job: Query 1Y / 07 DDL, https://github.com/matrixorigin/mo-nightly-regression/actions/runs/26542826587/job/78199518606
- MatrixOne image: matrixone-dev/matrixone:commit-83cc163
- Namespace: mo-big-data-commit-83cc163-20260527
- Cluster: nightly-regression-dis
- Test file: tools/mo-regression-test/cases/big_data_test/04_QUERIES/15_write_ddl_100M.sql on mo-nightly-regression big_data branch
- SQL timeout: MO_REGRESSION_SQL_TIMEOUT=1800
Actual Behavior
alter table ... add PRIMARY KEY (col3,col4) on big_data_test.table_basic_for_alter_100M failed with MySQL error 2013:
2026-05-28 08:50:02,695 [INFO] alter table big_data_test.table_basic_for_alter_100M add PRIMARY KEY (col3,col4)
2026-05-28 08:52:18,834 [ERROR] (2013, 'Lost connection to MySQL server during query')
2026-05-28 08:52:18,834 [ERROR] SQL execution failed: alter table big_data_test.table_basic_for_alter_100M add PRIMARY KEY (col3,col4)
Actual Result:
(2013, 'Lost connection to MySQL server during query')
Expect Result:
empty set
The following cleanup step also failed because the composite primary key was not created:
alter table big_data_test.table_basic_for_alter_100M drop PRIMARY KEY
Actual Result:
(1091, "Can't DROP 'PRIMARY'; check that column/key exists")
Expect Result:
empty set
The same DDL test continued afterward and ended with execute_failed, compare_failed.
Expected Behavior
alter table big_data_test.table_basic_for_alter_100M add PRIMARY KEY (col3,col4) should complete successfully and return an empty result, the same as the single-column primary key case in the same test.
Steps to Reproduce
Run the big-data DDL query case against MatrixOne 4.0-dev commit 83cc1630b37a7a790420edc5aef2f97fb7cf3ba5:
-- single-column PK succeeds first
alter table big_data_test.table_basic_for_alter_100M add PRIMARY KEY (col4);
select count(*) from big_data_test.table_basic_for_alter_100M;
alter table big_data_test.table_basic_for_alter_100M drop PRIMARY KEY;
select count(*) from big_data_test.table_basic_for_alter_100M;
-- composite PK fails with error 2013
alter table big_data_test.table_basic_for_alter_100M add PRIMARY KEY (col3,col4);
select count(*) from big_data_test.table_basic_for_alter_100M;
alter table big_data_test.table_basic_for_alter_100M drop PRIMARY KEY;Source test case:
tools/mo-regression-test/cases/big_data_test/04_QUERIES/15_write_ddl_100M.sql
Additional information
Before the failing statement, the same job successfully completed:
alter table big_data_test.table_basic_for_alter_100M add PRIMARY KEY (col4) -- cost: 196257.69ms
alter table big_data_test.table_basic_for_alter_100M drop PRIMARY KEY -- cost: 298035.12ms
The failing composite primary key statement disconnected after about 136 seconds, which is below the configured 1800s SQL timeout.
Activity
[-][Bug]: ADD composite primary key on 100M table loses MySQL connection[/-][+][Bug]: big data regression: ADD composite primary key on 100 million rows table oom[/+]Ariznawlll commentedon May 28, 2026
Additional memory / metrics notes from the failed run:
What we can confirm from Actions logs
Query 1Y / 07 DDL: around2026-05-28 08:50:02 ~ 08:52:18CST.OOMKilled,out of memory,signal: killed,panic, andfatal error; none appeared in the DDL job log.Query 1Y / 08 DMLat about2026-05-28 09:11:27CSTInsert 10Y / 03 PK Index Insertat about2026-05-28 09:49:00CSTInsert 10Y / 04 Com PK Index Insertat about2026-05-28 09:54:56CSTInsert 10Y / 07 Write Insertat about2026-05-28 10:22:46CSTRelevant resource / profiling config
From
big-data-tke.yamlin this run:55GieachGOMEMLIMIT=25000MiB12GiGOGC=20055GiGOMEMLIMIT=35000MiB5GiGOGC=2006GieachProfiling / metrics were enabled on DN and CN:
Suggested metrics to check
Please check the following time window first:
2026-05-28 08:45:00 ~ 09:00:00CST for the DDL failure2026-05-28 08:40:00 ~ 10:25:00CST to compare with the later error-2013 jobsPromQL examples:
Current hypothesis
There is no direct OOMKilled evidence in Actions logs, but multiple jobs in the same run hit error 2013. If Grafana shows CN/proxy memory close to limit or pod restarts around the listed timestamps, this issue is likely related to resource pressure / process restart / connection reset. If there are no restarts but RSS or malloc metrics spike heavily, it may be a memory pressure path inside CN/DN during heavy DDL/write workloads.
[-][Bug]: big data regression: ADD composite primary key on 100 million rows table oom[/-][+][Bug]: big data regression: ADD composite primary key and update table on 100 million rows table oom[/+]Ariznawlll commentedon May 28, 2026
Additional note for the
UPDATEOOM / connection-loss case in the same nightly run:Failed job
Query 1Y / 08 DMLmo-nightly-regressionbig_databranch:tools/mo-regression-test/cases/big_data_test/04_QUERIES/15_write_dml_100M.sqlThe failing statement is the 10M-row update on a cloned 100M-row table with PK/index:
Log evidence
The previous 1M-row update finished successfully, then this 10M-row update ran for about 90s and the client got MySQL error 2013:
After the connection loss, the following check query returned a sum lower than expected by
10000000, which is consistent with the 10M-row update not being committed/applied successfully:Why this is relevant to the DDL OOM issue
This is not the same SQL path as
ALTER TABLE ... ADD PRIMARY KEYorCREATE INDEX, but it is another large write path against a PK/indexed table. It likely exercises heavy update/delete+insert/index maintenance memory usage. From the Actions log alone we still only see client-sideLost connection to MySQL server during query; the log does not directly showOOMKilledor a Go panic. To confirm whether this is really OOM, please correlate CN/proxy/DN pod memory and restart events around2026-05-28 09:09:57 ~ 09:11:27CST.Suggested focus window:
If pod metrics show CN/proxy memory hitting the limit or container restart/OOMKilled at that time, then the update case should be treated as another reproducible large-write OOM symptom in addition to the DDL failure.
Ariznawlll commentedon May 28, 2026
Follow-up code-path analysis for the
UPDATEfailure:The failed table is created with both a primary key and indexes:
The failed SQL updates
col3, which is the secondary-index column:So this is not a simple in-place column update. In the planner/executor it becomes a multi-step DML pipeline:
buildTableUpdate()builds a SELECT over the target rows, adds the updated expression, then appends a sink.buildUpdatePlans()first builds delete-side plans, then builds insert-side plans for the new row image.col3is indexed,buildDeleteIndexPlans()detects that the secondary key is updated and builds hidden index-table maintenance throughbuildDeleteRegularIndex().buildDeleteRegularIndex()does both:appendPreInsertPlan()+makeOneInsertPlan()MultiUpdate.compileMultiUpdate()may useUpdateWriteS3first, thenUpdateFlushS3Infoto apply the buffered delete/insert actions.Relevant code locations:
pkg/sql/plan/build_update.go:buildTableUpdate()/selectUpdateTables()pkg/sql/plan/build_dml_util.go:buildUpdatePlans()pkg/sql/plan/build_dml_util.go:buildDeleteIndexPlans()skips unaffected indexes, but will process this one becausecol3is updatedpkg/sql/plan/build_dml_util.go:buildDeleteRegularIndex()handles delete + insert for the hidden index table in update modepkg/sql/compile/compile.go:compileMultiUpdate()choosesUpdateWriteS3for large resultspkg/sql/colexec/multi_update/multi_update.go:update_s3()/updateFlushS3Info()/updateOneBatch()apply the buffered actionsCurrent hypothesis:
The update failure is probably related to the large update + secondary-index maintenance path rather than only the base table update. Updating 10M rows on a table with
key(col3)means MO needs to rewrite the affected main rows and maintain the hidden secondary index rows. This has a similar memory-pressure shape to the DDL/index cases because both paths create large derived write streams into hidden/index tables, but the exact entry path is DMLMultiUpdate, not DDLCREATE INDEX/ALTER TABLE.The Actions log still only proves client-side error 2013. It does not directly show OOMKilled. The key confirmation remains pod/container metrics around
2026-05-28 09:09:57 ~ 09:11:27 CST, especially CN/proxy memory, restarts, andOOMKilledtermination reason.Ariznawlll commentedon Jun 4, 2026
commit:47459ce08ae1347e9a5375e5a6093f7182a72064
https://github.com/matrixorigin/mo-nightly-regression/actions/runs/26859858247/job/79226774405
已修复