Details
-
Bug
-
Status: Closed (View Workflow)
-
Blocker
-
Resolution: Fixed
-
10.11, 11.4
-
Can result in hang or crash
-
Q3/2025 Galera Development
Description
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.
|
void TABLE::mark_columns_per_binlog_row_image() |
{
|
...
|
/* if there is no PK, then mark all columns for the BI. */ |
if (s->primary_key >= MAX_KEY) |
{
|
bitmap_set_all(read_set);
|
rpl_write_set= read_set;
|
}
|
...
|
}
|
|
int Rows_log_event::update_sequence() |
{
|
...
|
|
if (!bitmap_is_set(table->rpl_write_set, MIN_VALUE_FIELD_NO) || |
...
|
{
|
/* This event come from a setval function executed on the master. |
Update the sequence next_number and round, like we do with setval()
|
*/
|
...
|
return table->s->sequence->set_value(table, nextval, round, 0) > 0; |
}
|
...
|
}
|