Details
-
Bug
-
Status: Open (View Workflow)
-
Minor
-
Resolution: Unresolved
-
10.11, 11.4, 11.8, 12.3, 13.1, 13.2, 13.3
Description
Likely cause: old code, not a recent change. The %-192s format came with MDEV-5281 in CS 10.0.7, commit 1387e71531495b1224bfafd6867ae5fae9cf469c, which added the check for rows in the wrong partition. Commit c0c62196cafb41f5f653ad9d4887ee3af7ffcf10 in CS 10.4.2 removed the line break before "Please REPAIR the table!" and put no space in its place.
--source include/have_partition.inc
|
call mtr.add_suppression("corrupted: row in wrong partition"); |
CREATE TABLE t1 (a INT) PARTITION BY LIST (a) (PARTITION p1 VALUES IN (1, 2), PARTITION pd DEFAULT); |
INSERT INTO t1 VALUES (1), (2); |
--error 0,ER_ROW_IN_WRONG_PARTITION
|
ALTER TABLE t1 REORGANIZE PARTITION p1 INTO (PARTITION p1 VALUES IN (1)); |
SET @log= LOAD_FILE(@@log_error); |
--let $padded= query_get_value(SELECT @log LIKE "%Table ' %" AS p, p, 1)
|
if ($padded) |
{
|
--die The error log line for the row in the wrong partition pads the table name with spaces to 192 characters |
}
|
DROP TABLE t1; |
Leads to:
|
CS 13.1.2 c8e6ab229f030119c19f3208d40f415decb41dae (Debug, Clang 22.1.8-20260622) Build 19/11/2026 |
mysqltest: At line 11: The error log line for the row in the wrong partition pads the table name with spaces to 192 characters
|
|
CS 13.1.2 c8e6ab229f030119c19f3208d40f415decb41dae (Debug, Clang 22.1.8-20260622) Build 19/11/2026 |
2026-11-27 18:10:40 4 [ERROR] Table ' t1' corrupted: row in wrong partition: (0 != 1) a:2Please REPAIR the table!
|
The error log line pads the table name with spaces to 192 characters, with the spaces before the name. There is also no space between the row and "Please REPAIR the table!". The client gets ERROR 1863 (HY000): Found a row in wrong partition (0 != 1) a:2. The table is not corrupted: the ALTER TABLE is refused, the rows stay where they were, and CHECK TABLE gives OK.
MySQL has no DEFAULT partition, so there the row came from EXCHANGE PARTITION ... WITHOUT VALIDATION, and an UPDATE logged the line:
|
MySQL |
+--------+----------------------------------+
|
| MySQL | Table name in the error log line |
|
+--------+----------------------------------+
|
| 5.7.44 | 't1' |
|
| 8.0.36 | 't1' followed by 190 spaces |
|
| 9.1.0 | 't1' followed by 190 spaces |
|
+--------+----------------------------------+
|
From the code it seems that ha_partition::print_error() in sql/ha_partition.cc logs the table name with %-192s, a width of at least 192 characters. my_vsnprintf() ignores the flag for left alignment, as include/mysql/service_my_snprintf.h notes, so the name is right-aligned. The two messages of ha_partition::check_misplaced_rows(), "failed to move/insert a row" and "Delete from part ... failed", use the same format.
Attachments
Issue Links
- relates to
-
MDEV-41873 COALESCE PARTITION on a LINEAR HASH or LINEAR KEY table fails with "Found a row in wrong partition"
-
- Open
-