Skip to content

Checksum repair broken on MariaDB < 11.6: single-table DELETE with alias rejected #1570

Description

@svaroqui

Problem

RepairTableChecksum (cluster/cluster_chk.go) repairs diverged chunks on the master with:

DELETE FROM <schema>.<table> A WHERE <chunk condition>

This is a single-table DELETE with a table alias, which MariaDB only accepts since 11.6.1 (MDEV-33988). The backport to LTS lines was refused (MDEV-37227, Won't Fix), so on 10.5 / 10.6 / 10.11 / 11.4 the statement fails with error 1064 and cluster-checksum-repair cannot repair any chunk.

The alias cannot simply be dropped: the persisted chunkRangeCondition is built with A.-qualified primary-key predicates (A.pk >= ... AND A.pk <= ...).

Fix

Use the multi-table DELETE form, accepted by every MySQL and MariaDB version and semantically identical:

DELETE A FROM <schema>.<table> A WHERE <chunk condition>

Fixed in develop by 85546d9.

How it was found

Live use of cluster-checksum-repair against a MariaDB LTS server. The same syntax gap also affects user applications written against MySQL 8 (e.g. PrestaShop, which prompted MDEV-33988) — a good candidate for a workload advisory tag mapping the failing statement pattern to the MDEV.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions