mariadb/storage
Sujatha b347396181 MDEV-11094: Blackhole table updates on slave fail when row annotation is enabled
Problem:
=======
rpl_blackhole.test fails when executed with following options
mysqld=--binlog_annotate_row_events=1, mysqld=--replicate_annotate_row_events=1

Test output:
------------
worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 16000..16019
rpl.rpl_blackhole_bug 'mix'              [ pass ]    791
rpl.rpl_blackhole_bug 'row'              [ fail ]
Replicate_Wild_Ignore_Table
Last_Errno	1032
Last_Error	Could not execute Update_rows_v1 event on table test.t1; Can't find
record in 't1', Error_code: 1032; handler error HA_ERR_END_OF_FILE; the event's
master log master-bin.000001, end_log_pos 1510

Analysis:
=========
Enabling "replicate_annotate_row_events" on slave, Tells the slave to write
annotate rows events received from the master to its own binary log. The
received annotate events are applied after the Gtid event as shown below.
thd->query() will be set to the actual query received from the master, through
annotate event. Annotate_rows event should not be deleted after the event is
applied as the thd->query will be used to generate new Annotate_rows event
during applying the subsequent Rows events. After the last Rows event has been
applied, the saved Annotate_rows event (if any) will be deleted.

In balckhole engine all the DML operations are noops as they donot store any
data. They simply return success without doing any operation. But the existing
strictly expects thd->query() to be 'NULL' to identify that row based
replication is in use. This assumption will fail when row annotations are
enabled as the query is not 'NULL'. Hence various row based operations like
'update', 'delete', 'index lookup' will fail when row annotations are enabled.

Fix:
===
Extend the row based replication check to include row annotations as well.
i.e Either the thd->query() is NULL or thd->query() points to query and row
annotations are in use.
2019-05-29 15:18:52 +05:30
..
archive Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
blackhole MDEV-11094: Blackhole table updates on slave fail when row annotation is enabled 2019-05-29 15:18:52 +05:30
cassandra Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
connect Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
csv Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
example Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
federated Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
federatedx Remove unused declarations 2019-04-03 19:46:34 +03:00
heap Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
innobase MDEV-19614 SET GLOBAL innodb_ deadlock due to LOCK_global_system_variables 2019-05-28 10:54:30 +03:00
maria Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
mroonga Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
myisam Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
myisammrg Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
oqgraph Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
perfschema Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
sequence Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
sphinx MDEV-16544 - crash in ha_sphinx::create() 2018-08-04 22:53:16 +01:00
spider Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
test_sql_discovery Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
tokudb Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
xtradb MDEV-19614 SET GLOBAL innodb_ deadlock due to LOCK_global_system_variables 2019-05-28 10:54:30 +03:00