[MDEV-24407] Wrong result or Assertion `old_part_id == m_last_part' failed in ha_partition::update_row on slave Created: 2020-12-15  Updated: 2023-07-24  Resolved: 2023-07-24

Status: Closed
Project: MariaDB Server
Component/s: Replication, Versioned Tables
Affects Version/s: 10.3, 10.4, 10.5, 10.6, 10.7
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Alice Sherepa Assignee: Aleksey Midenkov
Resolution: Cannot Reproduce Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-15395 Wrong result or Assertion `old_part_i... Closed

 Description   

--source include/have_binlog_format_mixed.inc
--source include/master-slave.inc
--source include/have_partition.inc
 
 create table t1 ( i1 int, i2 int)  with system versioning partition by system_time limit 2
(partition ver_p1 history, partition ver_p2 history, partition ver_pn current);
  
insert into t1 values (1, 0), (1, 0);
delete from t1 where i1 = 1 ;
insert into t1 values (1, 0);
 update  t1 set i2 = 1 limit 1;
 
--sync_slave_with_master
select * from t1;
 
--connection master
drop table t1;
--sync_slave_with_master
--connection master
--source include/rpl_end.inc

Reproducible with myisam, aria, innodb
on 10.5-debug:

10.5 8677c14e65f436db00be5ae

mariadbd: /10.5/sql/ha_partition.cc:4510: virtual int ha_partition::update_row(const uchar*, const uchar*): Assertion `old_part_id == m_last_part' failed.
201215 10:13:25 [ERROR] mysqld got signal 6 ;
 
Server version: 10.5.9-MariaDB-debug-log
 
??:0(__assert_fail)[0x7fe17e824102]
sql/ha_partition.cc:4511(ha_partition::update_row(unsigned char const*, unsigned char const*))[0x55ae3b8e7405]
sql/handler.cc:7197(handler::ha_update_row(unsigned char const*, unsigned char const*))[0x55ae3b061edc]
sql/log_event_server.cc:8344(Update_rows_log_event::do_exec_row(rpl_group_info*))[0x55ae3b3c6d5f]
sql/log_event_server.cc:5669(Rows_log_event::do_apply_event(rpl_group_info*))[0x55ae3b3b1a52]
sql/log_event.h:1498(Log_event::apply_event(rpl_group_info*))[0x55ae3a5ee835]
sql/slave.cc:4004(apply_event_and_update_pos_apply(Log_event*, THD*, rpl_group_info*, int))[0x55ae3a5d0b30]
sql/slave.cc:4166(apply_event_and_update_pos(Log_event*, THD*, rpl_group_info*))[0x55ae3a5d1608]
sql/slave.cc:4483(exec_relay_log_event(THD*, Relay_log_info*, rpl_group_info*))[0x55ae3a5d2c6c]
sql/slave.cc:5660(handle_slave_sql)[0x55ae3a5da5bb]
perfschema/pfs.cc:2203(pfs_spawn_thread)[0x55ae3b92f28e]
nptl/pthread_create.c:487(start_thread)[0x7fe17f2e6fa3]
x86_64/clone.S:97(clone)[0x7fe17e8ed4cf]
 
Query (0x61200009445b): UPDATE  t1 SET i2 = 1 LIMIT 1

Wrong result on the slave: On non-debug 10.3-10.5 + on debug-build for 10.3-10.4:
with mixed binlog format:

 
MariaDB [test]> select * from t1;
+------+------+
| i1   | i2   |
+------+------+
|    1 |    0 |
|    1 |    1 |
+------+------+
2 rows in set (0.001 sec)

with row binlog format:

select * from t1;
i1	i2
1	0
1	0
1	1



 Comments   
Comment by Alice Sherepa [ 2020-12-15 ]

the test case from MDEV-15395 is also returning incorrect results:

--source include/have_partition.inc
--source include/master-slave.inc
--source include/have_binlog_format_row.inc
 
CREATE TABLE t1 (i INT) WITH SYSTEM VERSIONING PARTITION BY system_time LIMIT 8 ( PARTITION p1 HISTORY, PARTITION p2 HISTORY, PARTITION pn CURRENT );
INSERT INTO t1 VALUES (1);
UPDATE t1 SET i = 1;
UPDATE t1 SET i = 0;
 
SELECT * FROM t1;
 
--sync_slave_with_master
 
# Cleanup
SELECT * FROM t1;
 
--connection master
DROP TABLE t1;
--sync_slave_with_master
--connection master
--source include/rpl_end.inc

connection slave;
SELECT * FROM t1;
i
1
0

Comment by Aleksey Midenkov [ 2023-07-24 ]

Doesn't reproduce in 10.4 3e7561cf35a

Generated at Thu Feb 08 09:29:45 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.