[MDEV-33184] Replicated REPAIR TABLE writes an error in the log when normal REPAIR does not Created: 2024-01-04  Updated: 2024-01-04

Status: Open
Project: MariaDB Server
Component/s: Replication
Affects Version/s: 10.4, 10.5, 10.6, 10.11, 11.0, 11.1, 11.2, 11.3
Fix Version/s: 10.4, 10.5, 10.6, 10.11, 11.0, 11.1, 11.2, 11.3

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Andrei Elkin
Resolution: Unresolved Votes: 0
Labels: None


 Description   

--source include/have_partition.inc
--source include/master-slave.inc
 
create table t (a int, key(a)) partition by range (a) (
  partition p0 values less than (10),
  partition p1 values less than (100)
);
 
insert into t values (5),(50);
 
--sync_slave_with_master
flush tables;
--let $datadir= `select @@datadir`
--move_file $datadir/test/t#P#p0.MYD $datadir/test/tmp
--move_file $datadir/test/t#P#p1.MYD $datadir/test/t#P#p0.MYD
--move_file $datadir/test/tmp $datadir/test/t#P#p1.MYD
 
--connection master
repair table t;
--sync_slave_with_master
 
--connection master
drop table t;
--source include/rpl_end.inc

The test case above imitates a situation when rows ended up in wrong partitions in the table on the slave. It is something that can happen due to a previous malfunctioning of some kind, or can legally occur in 11.4+ if a table was previously altered with WITHOUT VALIDATION clause.

Such table is easily fixed by REPAIR TABLE. When it is executed directly on the server with the corrupt table, it writes its output in a form of "warnings" (they are not real warnings produced by the SQL statement, but the message type in the result set):

repair table t;
Table	Op	Msg_type	Msg_text
test.t	repair	warning	Moved 1 misplaced rows
test.t	repair	warning	Moved 1 misplaced rows
test.t	repair	status	OK

Nothing shows up in the log.

However, when REPAIR is replicated and executed by the slave thread, as in the test case above, it instead writes ERROR messages in the error log:

10.4 87a5d16911bb94d383480fdd49e20876ed1400f2

2024-01-04 22:32:15 12 [ERROR] Moved 1 misplaced rows
2024-01-04 22:32:15 12 [ERROR] Moved 1 misplaced rows

It can be argued that it does need to write something since there are no interactive messages, but in any case it shouldn't be an error, since a) in the corresponding statement result it's just a warning, and b) REPAIR succeeds and no action is expected from the user.


Generated at Thu Feb 08 10:37:00 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.