#
# MDEV-18686 Verify that the Annotate_rows_log_event is written only
# once per statement into binlog.
#
--source include/galera_cluster.inc

CREATE TABLE t1 (f1 INT PRIMARY KEY);

#
# Unit ROW
#
SET SESSION wsrep_trx_fragment_unit='ROWS';
SET SESSION wsrep_trx_fragment_size=1;

--let $start_pos= query_get_value(SHOW MASTER STATUS, Position, 1)

INSERT INTO t1 VALUES (1), (2);

#
# Unit BYTE
#
SET SESSION wsrep_trx_fragment_unit='BYTES';
SET SESSION wsrep_trx_fragment_size=1;

INSERT INTO t1 VALUES (3), (4);

#
# Unit STATEMENT
#
SET SESSION wsrep_trx_fragment_unit='STATEMENTS';
SET SESSION wsrep_trx_fragment_size=1;

INSERT INTO t1 VALUES (5), (6);

#
# Reset to default settings
#
SET SESSION wsrep_trx_fragment_unit=default;
SET SESSION wsrep_trx_fragment_size=default;

--replace_regex /table_id: [0-9]+/table_id: #/ /xid=[0-9]+/xid=#/
--replace_column 2 # 5 #
--eval SHOW BINLOG EVENTS IN 'mysqld-bin.000002' FROM $start_pos

DROP TABLE t1;
