When you encounter the error `1231: Cannot update partition` in MySQL, it likely indicates an issue with the partitioning scheme or constraints on the partition that prevent an update operation. Here are actionable steps you can take immediately to investigate and possibly resolve the issue:
SHOW CREATE TABLE your
table
name;
CHECK TABLE your
table
name FOR UPGRADE PARTITION;
SELECT partition
name, table
rows, data
length, index
length, data_free
FROM information_schema.partitions
WHERE tableschema = 'your
database
name' AND table
name = 'your
table
name';
SELECT partition
name, table
name, partition
ordinal
position, partition
method, partition
expression, table
rows, partition
description
FROM information_schema.partitions
WHERE tableschema = 'your
database
name' AND table
name = 'your
table
name' AND partition
name = 'your
partition_name';
ALTER TABLE your
table
name REORGANIZE PARTITION partition
to
reorganize INTO (
PARTITION newpartition
name VALUES LESS THAN (your_value),
PARTITION otherpartition
name VALUES LESS THAN MAXVALUE
);
tail -f /path/to/mysql/log/error.log
Proceed with the investigation in the order that best aligns with your recent activities or changes to the database that could have led to this error.
Let Dr. Droid create custom investigation plans for your infrastructure.
Book Demo