Skip to content

bug: new snapshot generated even if mutation stmt does not mutate table data at all #19173

@dantengsky

Description

@dantengsky

Search before asking

  • I had searched in the issues and found no similar issues.

Version

mysql> select version();
+----------------------------------------------------------------------------------------+
| version()                                                                              |
+----------------------------------------------------------------------------------------+
| 8.0.90-v1.2.860-nightly-a3fb83aaca(rust-1.94.0-nightly-2025-12-26T14:34:01.487415000Z) |
+----------------------------------------------------------------------------------------+
1 row in set (0.021 sec)
Read 1 rows, 1.00 B in 0.007 sec., 142.31 rows/sec., 142.31 B/sec.

What's Wrong?

mysql> use default;
Database changed
mysql> create or replace table target (c int);
Query OK, 0 rows affected (0.063 sec)

mysql> create or replace table empty like target;
Query OK, 0 rows affected (0.093 sec)

mysql> merge into target using (select c from empty) s on s.c = target.c when matched then update * when not matched then insert *;
+-------------------------+------------------------+
| number of rows inserted | number of rows updated |
+-------------------------+------------------------+
|                       0 |                      0 |
+-------------------------+------------------------+
1 row in set (0.135 sec)
Read 0 rows, 0.00 B in 0.053 sec., 0 rows/sec., 0.00 B/sec.

mysql>
mysql> select count() from fuse_snapshot('default', 'target'); -- expects 0
+---------+
| count() |
+---------+
|       1 |
+---------+
1 row in set (0.032 sec)
Read 1 rows, 243.00 B in 0.021 sec., 48.69 rows/sec., 11.56 KiB/sec.

How to Reproduce?

use default;
create or replace table target (c int);
create or replace table empty like target;
merge into target using (select c from empty) s on s.c = t.c when matched update * when not matched insert *;


select count() from fuse_snapshot('default', 'target'); -- expects 0

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: something isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions