Repository navigation
Description
Environment
| Field | Value |
|---|---|
| Cluster | mo-chaos-4-0-dev-4164cfb-202606242212 |
| Namespace | mo-chaos-4-0-dev-4164cfb-202606242212 |
| Build / image | matrixone:commit-cb94136cf |
| Endpoint | 10.222.6.253:6001 |
| Artifact root | /data1/chaos-test/28087898861_4164cfb |
| Workload | TPCC 10 warehouses / 10 terminals + chaos (kill CN/DN/Log, mem/network stress) |
| Analysis window | 2026-06-24 22:12 CST (deploy) → 2026-06-29 15:21 CST (~4.7d; tests stopped by ops) |
Scope: MatrixOne distributed read consistency for single-statement cross-table aggregate used by TPCC ConsistencyCheck query #5 — transient bmsql_oorder.o_ol_cnt vs bmsql_order_line district mismatch that self-heals within one verify cycle (~35s).
Out of scope: Permanent TPCC data corruption (ytd / D_NEXT_O_ID drift), duplicate-key (1062) defects, Payment 20638 ambiguous commit (see 7cbeacd durable corruption issue).
Summary
During chaos long-run on 4164cfb / cb94136cf, TPCC runVerify.sh / io.mo.ConsistencyCheck reported 2 failures (out of 7701 verify runs, 0.026%) on this SQL only:
(SELECT o_w_id, o_d_id, sum(o_ol_cnt) FROM bmsql_oorder GROUP BY o_w_id, o_d_id)
EXCEPT
(SELECT ol_w_id, ol_d_id, count(ol_o_id) FROM bmsql_order_line GROUP BY ol_w_id, ol_d_id);Both failures recovered on the next verify cycle (same check PASS). After 2026-06-26 18:00 CST, 3822 consecutive PASS with 0 FAIL until test stop.
This is NOT permanent data corruption. Evidence:
| Check | Result |
|---|---|
| pass / fail | 7701 / 2 |
| Max consecutive FAIL | 1 |
| Fail → PASS interval | ~35s (#1: 04:36:16 → 04:36:51) and ~31s (#2: 10:22:14 → 10:22:45) |
Other ConsistencyCheck queries (ytd, D_NEXT_O_ID, dup having count(1)>1) |
0 failures |
ErrorCode 1062 / Duplicate entry / 20638 (full run) |
0 |
| Jun 26 fail windows ±5min | 0×1062, 0×20638 |
| Post-incident window (Jun 26 18:00+) | 3822 pass / 0 fail |
MatrixOne issue (same class as 83cc163 read-skew): under chaos + concurrent NewOrder, a single EXCEPT over district aggregates on bmsql_oorder and bmsql_order_line can observe different effective snapshot / LogTail apply watermarks across partitions, producing transient district-level skew. When in-flight NewOrders complete and LogTail catches up, the check passes again.
Release gate: PASSED — transient only; distinguish from 7cbeacd permanent corruption.
Failing SQL invariant
TPCC invariant per district:
NewOrder sets o_ol_cnt and inserts matching order_line rows in one transaction (jTPCCTData.executeNewOrder → db.commit()). Exception rows in the log are the left side (sum(o_ol_cnt) per (w_id, d_id)), meaning the reader saw more committed order headers than matching line counts at snapshot time.
Timeline (2 failures)
| # | Fail time (CST) | Next PASS | Self-heal | Nearby chaos | Exception scope |
|---|---|---|---|---|---|
| 1 | 06-26 04:36:16 | 04:36:51 | 35s | task_mem_cn active 04:33:04–04:38:04 (fail at +3m12s into CN mem stress) |
73 districts across w_id 3–9 |
| 2 | 06-26 10:22:14 | 10:22:45 | 31s | task_kill_dn 10:05, task_kill_log 10:11, task_mem_dn cleanup 10:21:36 (fail 38s after DN mem stress ends) |
37 districts across w_id 3,4,6,7 |
Last PASS before each fail:
| Fail | Last PASS |
|---|---|
| #1 | 04:35:44 |
| #2 | 10:21:40 |
Fail #1 exception sample (left = sum(o_ol_cnt))
w_id d_id sum(o_ol_cnt)
3 7 46565
3 9 47391
4 1 49851
5 10 44798
6 7 54869
...
(73 rows total; warehouses 3–9 all represented.)
Fail #2 exception sample
w_id d_id sum(o_ol_cnt)
3 1 50581
3 10 52019
4 1 59966
6 5 63526
7 9 75357
...
(37 rows; warehouses 3, 4, 6, 7; partial district coverage on wh 4.)
What this is NOT
| Ruled out | Evidence |
|---|---|
| Duplicate key / dup insert | 0 ErrorCode 1062, 0 Duplicate entry entire run |
| Payment ambiguous commit (20638) | 0 in benchmarksql-error-10-10.log |
| Permanent ytd / order-id drift | 0 ytd / D_NEXT_O_ID consistency fails |
| Durable txn corruption | Max consecutive FAIL = 1; 3822 pass after Jun 26 18:00 |
| Chaos kill causing durable loss | Would stay FAIL; other consistency queries would also fail |
| 7cbeacd class defect | That run: 5506 fail, 6209×1062, ytd drift billions, never recovered |
Root cause analysis
Symptom
District-level EXCEPT returns many rows; ~30–35s later same query returns empty.
Mechanism
- Concurrent NewOrder (10 terminals, multi-CN) commits
bmsql_oorder+bmsql_order_linein one txn across partitions (PARTITION BY KEY(o_w_id)). ConsistencyCheckruns query [#4] Add a new document: CHANGELOG.md #5 as auto-commitStatement.executeQuery()(RR default on MO).- During CN mem stress (Add README.md #1) or DN kill + log kill + DN mem stress chain (integrate mysql parser from pingcap #2), LogTail apply / CN read path is perturbed; single
EXCEPTscans both tables with per-districtSUM/COUNT. - Reader sees committed
oorderheaders (o_ol_cnt) for multiple districts before all matchingorder_linerows are visible in the same logical snapshot → district aggregate mismatch on the left side only. - After apply catches up (~seconds, bounded by next 30s verify), aggregates align → PASS.
Multi-district / multi-warehouse blast radius (73 and 37 rows) is consistent with global snapshot watermark lag, not a single bad order row.
Earliest fixable defect
| # | Defect | Layer |
|---|---|---|
| R1 | Single SELECT with multi-table aggregates must use one consistent snapshot across all partitions; LogTail apply must not return partial post-commit visibility for related tables | MO pkg/vm/engine/disttae |
| R2 | NewOrder commit visibility: bmsql_oorder and bmsql_order_line of same txn must become visible atomically at one CommitTimestamp |
MO txn / disttae apply |
| R3 | ConsistencyCheck has no retry — any transient skew fails verify immediately |
TPCC harness (ConsistencyCheck.java) |
Expected vs actual
| Expected (RR, one SQL statement) | Actual |
|---|---|
EXCEPT subqueries see same committed view |
2/7701 checks show district skew (0.026%) |
| Skew implies dup or missing rows at rest | 0×1062; max consecutive FAIL = 1 |
| Chaos FAIL = durable inconsistency | 2/2 self-healed within one verify period |
Proposed fixes
P1 — MatrixOne (read / snapshot) — same as 83cc163
pkg/vm/engine/disttae: for a single read-only statement, ensure all partitions share the sameSnapshotTimestampand reads block until LogTail apply watermark ≥ snapshot for all subscribed partitions.- NewOrder commit visibility: header + line rows visible atomically at one
CommitTimestamp. - Regression: chaos soak with
runVerify.shevery 30s; query [#4] Add a new document: CHANGELOG.md #5 fail rate < 1/10000; per-order JOIN 0 rows at fail instant and after 60s.
P2 — Chaos / TPCC harness (parallel)
ConsistencyCheck.java: retry query [#4] Add a new document: CHANGELOG.md #5 up to 3× with 5s sleep beforeexit(1).- Replace district
EXCEPTwith per-order JOIN (more precise):
SELECT o.o_w_id, o.o_d_id, o.o_id, o.o_ol_cnt, COUNT(ol.ol_number) AS lines
FROM bmsql_oorder o
LEFT JOIN bmsql_order_line ol
ON o.o_w_id = ol.ol_w_id AND o.o_d_id = ol.ol_d_id AND o.o_id = ol.ol_o_id
GROUP BY o.o_w_id, o.o_d_id, o.o_id, o.o_ol_cnt
HAVING o.o_ol_cnt <> COUNT(ol.ol_number)
LIMIT 10;- Chaos pass criteria: FAIL only on 3 consecutive query [#4] Add a new document: CHANGELOG.md #5 failures or per-order JOIN rows still present after 60s.
P3 — Ops / release gate
Treat single ol_cnt EXCEPT fail with PASS on next cycle and 0×1062/20638 as transient (non-blocking); block release only on sustained FAIL or dup/20638 storms (per 7cbeacd pattern).
Reproduce
- Deploy
mo-chaos-4-0-dev-4164cfb-*class cluster (commit-4164cfborcb94136cf). - Run chaos TPCC (
props_10.mo: 10 wh, 10 terminals) +runVerify.shevery 30s + full chaos loop (kill CN/DN/Log, mem/network). - Run >24h.
- Observe rare query [#4] Add a new document: CHANGELOG.md #5
EXCEPTfailures (this run: 2 in ~4.7d); confirm:- Next verify PASS within ~35s
- 0
1062/20638at fail time - 0 ytd /
D_NEXT_O_IDfails
check log:128 /data1/chaos-test/28087898861_4164cfb/mo-chaos/test-tool/mo-tpcc/check.log
Activity
fix(disttae): fence latest logtail reads with pending table apply (#2…
fix(disttae): fence latest logtail reads with pending table apply (ma…
fix(disttae): fence latest logtail reads with pending table apply (#2…
fix(disttae): fence latest logtail reads with pending table apply (ma…
fix(disttae): fence latest logtail reads with pending table apply (ma…
fix(disttae): fence latest logtail reads with pending table apply (ma…