mariadb/mysql-test/suite/galera/r/MDEV-37366.result
Hemant Dangi 88d43afd33 MDEV-37366: Inconsistency detected - create sequence
Issue:

When applying 'SELECT NEXT VALUE..' on applier node with
binlog_row_image=MINIMAL and log-binlog enabled, applier
node fails with below error:

Slave SQL: Could not execute Write_rows_v1 event on table monitor.seq_moni_num; Unknown error, Error_code: 1105; handler error No Error!; the event's master log FIRST, end_log_pos 0, Internal MariaDB error code: 1105

To reproduce run below command on the first/active node:

> CREATE SEQUENCE `seq_test` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 0 cache 1000 nocycle ENGINE=InnoDB;
> SELECT NEXT VALUE FOR seq_test;
> SELECT NEXT VALUE FOR seq_test;

The applier node will leave the cluster after executing
the 'SELECT NEXT VALUE' with below error:

ERROR] Slave SQL: Could not execute Write_rows_v1 event on table test.seq_test; Unknown error, Error_code: 1105; handler error No Error!; the event's master log FIRST, end_log_pos 0, Internal MariaDB error code: 1105
[Warning] WSREP: Event 3 Write_rows_v1 apply failed: 195, seqno 14511334511

Solution:

When binary loggging is enabled and binlog_row_image is set to
'MINIMAL', then 'SELECT NEXT VALUE' fails to apply on applier node.
It fails with error HA_ERR_SEQUENCE_INVALID_DATA 195 in
sequence_definition::check_and_adjust() because sequence variables
like min_value, max_value, start are 0.

The marking of all columns in 'TABLE::mark_columns_per_binlog_row_image()'
will prevent update/set column values for the sequence table.
For the sequence table column bitmap sent from master is only used.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2025-08-13 21:01:19 +02:00

27 lines
1.1 KiB
Text

connection node_2;
connection node_1;
connection node_1;
connection node_2;
connection node_1;
SET SESSION binlog_row_image=minimal;
CREATE SEQUENCE `seq_test` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 0 cache 1000 nocycle ENGINE=InnoDB;
SHOW CREATE TABLE seq_test;
Table Create Table
seq_test CREATE TABLE `seq_test` (
`next_not_cached_value` bigint(21) NOT NULL,
`minimum_value` bigint(21) NOT NULL,
`maximum_value` bigint(21) NOT NULL,
`start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
`increment` bigint(21) NOT NULL COMMENT 'increment value',
`cache_size` bigint(21) unsigned NOT NULL,
`cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
`cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=InnoDB SEQUENCE=1
SELECT NEXT VALUE FOR seq_test;
NEXT VALUE FOR seq_test
1
SELECT NEXT VALUE FOR seq_test;
NEXT VALUE FOR seq_test
3
connection node_2;
DROP SEQUENCE seq_test;