1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-31033 ER_KEY_NOT_FOUND upon online COPY ALTER on a partitioned table

The row events were applied "twice": once for the ha_partition, and one
more time for the underlying storage engine.

There's no such problem in binlog/rpl, because ha_partiton::row_logging
is normally set to false.

The fix makes the events replicate only when the handler is a root handler.
We will try to *guess* this by comparing it to table->file. The same
approach is used in the MDEV-21540 fix, 231feabd. The assumption is made,
that the row methods are only called for table->file (and never for a
cloned handler), hence the assertions are added in ha_innobase and
ha_myisam to make sure that this is true at least for those engines

Also closes MDEV-31040, however the test is not included, since we have no
convenient way to construct a deterministic version.
This commit is contained in:
Nikita Malyavin
2023-04-12 02:01:31 +03:00
committed by Sergei Golubchik
parent 0775c7bdc3
commit c76072db93
5 changed files with 68 additions and 21 deletions

View File

@ -1231,6 +1231,27 @@ a
223
889
drop table t1;
#
# MDEV-31033 ER_KEY_NOT_FOUND upon online COPY ALTER on a partitioned
# table
create table t (a int) partition by hash(a) partitions 2;
insert into t values (1),(3);
set debug_sync= 'alter_table_online_downgraded SIGNAL downgraded wait_for goon';
alter table t force, algorithm=copy, lock=none;
connection con1;
set debug_sync= 'now WAIT_FOR downgraded';
update t set a = a + 1;
insert t values (1),(2);
delete from t where a = 4 limit 1;
set debug_sync= 'now SIGNAL goon';
connection default;
select * from t;
a
2
2
1
drop table t;
set debug_sync= reset;
disconnect con1;
#
# End of 11.2 tests