Repository navigation
Description
Environment
- MatrixOne
maincommit:175a645a85994f2c95992d3aa8d6dacb6d9e167f. - Local two-CN launch based on the repository's
etc/launch-multi-cn/launch.toml; CN1 and CN2 use the shippedcn1.tomlandcn2.tomlLOCAL file-service settings. In both files,[[fileservice]] name = "LOCAL"hasdata-dir = "mo-data/local2". - CN1 and CN2 are separate
mo-serviceprocesses. This report is about the bundled local multi-CN configuration; it does not claim that deployments with isolated per-CN LOCAL directories have the same problem.
What happens
Starting CN2 while CN1 is processing a JOIN that has spilled to disk removes CN1's live spill files. CN1's query fails with ERROR 1105 (HY000): open .../mo-data/local2/__spill/probe_sub_<id>_10: no such file or directory (the missing file may be probe_<id>_<bucket> in another run).
This is not a result-comparison or SQL compatibility issue: a service lifecycle action in the provided multi-CN launch configuration invalidates another live CN's execution state.
Reproduction
- Launch the provided two-CN setup, with CN1 serving SQL and CN2 stopped. Create
jl(c1 INT NOT NULL, c2 INT NOT NULL) CLUSTER BY(c1)andjrwith the same schema. Populatejlwith 1,000,000 rows andjrwith 800,000 matching rows. To select the shuffle-join spill path, patchtable_statsrow counts to 5,000,000 and 4,000,000 as intest/distributed/cases/join/spill.sql. - On CN1, run
SET join_spill_mem=1000; SELECT COUNT(*), SUM(jl.c2+jr.c2) FROM jl JOIN jr ON jl.c1=jr.c1;.EXPLAIN ANALYZEfor this fixture confirmsshuffle: range(jl.c1),SpillRows=2800000, andSpillSize=52.17 MiB. - While that query is running and CN1 has files under
mo-data/local2/__spill, start CN2 with the shippedetc/launch-multi-cn/cn2.toml.
The CN1 query failed with the missing-spill-file error in 3/3 runs. Before starting CN2, the same query completed with COUNT(*)=800000 and SUM(...)=3200079200000. The failed query did not alter its input: afterward, the table counts and JOIN result were unchanged.
Control
Changing only CN2's LOCAL data-dir to mo-data/local3, then restarting CN2 at the same point in CN1's spilling JOIN, left the CN1 query running and returned the expected 800000 / 3200079200000. The provided cn2.toml value was restored after this control.
Code path / likely cause
cn1.tomlandcn2.tomlassign both CNs the same LOCAL directory.- On each service startup,
main.gocallsclearSpillFilesfor LOCAL; that function deletes all files in__spill, with no CN-ownership check.
Expected: starting/restarting CN2 must not remove CN1's live spill files. The bundled configurations should give each CN an isolated LOCAL path, or startup cleanup should be scoped to files owned by that CN.
Related but distinct: #27917 concerned shared transaction-trace storage in the local multi-CN launch. This report is about spill-file deletion during an active query.
Suggested regression placement: a multi-process integration/chaos test that observes a real SpillRows > 0 JOIN on CN1, restarts CN2, and asserts CN1 still returns the exact result. A single-process SQL case cannot exercise the destructive startup interaction.
Activity
fix: isolate bundled multi-CN spill directories (#30814)