Skip to content

[Bug]: mo-dump backups are unrestorable when the table has generated columns #30682

Closed as not planned

Description

@Ariznawlll

Bug or Feature Request

Bug

Description

mo-dump exports computed values of generated columns in the INSERT statements of its SQL dumps — producing backup files that cannot be restored into MatrixOne itself. The replay fails with:

ERROR 20301 (HY000): invalid input: the value specified for generated column 'b' in table 'g' is not allowed

Both STORED and VIRTUAL generated columns are affected. MatrixOne (like MySQL) rejects explicit values for generated columns, and mo-dump's own output violates that rule — a self-inconsistency where the tool's "MODUMP SUCCESS" output is unreplayable on the same server, same schema, same data.

Since dump files start with DROP DATABASE IF EXISTS ..., a failed replay leaves the target database partially restored (schema + earlier tables exist, the offending table is dropped or empty) — the familiar silent-data-loss blast radius of the dump-fidelity family.

Minimal end-to-end repro (100% deterministic):

CREATE DATABASE gen;
CREATE TABLE gen.g (
  id INT PRIMARY KEY,
  a INT,
  b INT GENERATED ALWAYS AS (a*2) STORED,
  c INT GENERATED ALWAYS AS (a+b) VIRTUAL
);
INSERT INTO gen.g (id, a) VALUES (1,5), (2,7);
$ ./mo-dump -h ... -P 16001 -u root -p *** -db gen > gen.sql
# (exit 0; file ends with "MODUMP SUCCESS"; DDL part is perfect, including
#  `b` int GENERATED ALWAYS AS ((a * 2)) STORED / `c` ... VIRTUAL)

$ grep "INSERT INTO \`g\`" gen.sql
INSERT INTO `g` VALUES (2,7,14,21),(1,10,20,30);
#                                 ^^^^^^^^^^^  generated columns b,c included as literals!

$ mysql -h ... < gen.sql
ERROR 20301 (HY000) at line 29: invalid input: the value specified for generated column 'b' in table 'g' is not allowed

The table itself refuses what the dumper wrote: INSERT INTO g VALUES (1,5,10,15) directly → same error (positive control that this is the server's intentional semantics, aligned with MySQL).

Expected behavior

mysqldump emits INSERTs listing only non-generated columns for such tables (e.g. INSERT INTO g (id,a) VALUES ...), which replays cleanly and lets the engine recompute b/c. mo-dump should do the same (column-listed INSERT excluding generated columns). An engine-side alternative (accept-and-recompute instead of reject) would diverge from MySQL semantics and is not recommended.

Versions

  • mo-dump: matrixorigin/mo_dump@324c33d (origin/main HEAD, 2026-10-20)
  • MatrixOne: commit b24d1b3 (2026-10-16), v3.x dev, macOS arm64

Additional context

Activity

  1. added
    kind/bug
    on Oct 20, 2026
  2. added this to the MO-202610 milestone on Oct 20, 2026
  3. XuPeng-SH commented on Oct 22, 2026

    @XuPeng-SH
    Contributor

    This report is now tracked together with #30673. The canonical issue retains explicit acceptance cases for the behavior described here. This is an administrative duplicate/consolidation closure only; the underlying defect is not claimed fixed. The original description and discussion remain available on this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions