diff options
author | Brandon Nesterenko <brandon.nesterenko@mariadb.com> | 2022-07-05 07:12:49 -0600 |
---|---|---|
committer | Brandon Nesterenko <brandon.nesterenko@mariadb.com> | 2022-07-13 09:03:32 -0600 |
commit | 02e85aeafdc3fbe7d628e155880390c4d623f9b4 (patch) | |
tree | 32f48a3700b2b66d0317133fe374ec8ccf7aa7c6 /sql | |
parent | 96be3fe8416d312e08d67b36608e7b2d5a865d5d (diff) | |
download | mariadb-git-02e85aeafdc3fbe7d628e155880390c4d623f9b4.tar.gz |
MDEV-28487: sequences not respect value of binlog_row_image with select nextval(seq_gen)
Problem:
========
When using sequences, the function
sequence_definition::write(TABLE *table, bool all_fields)
is used to save DML/DDL updates to sequence tables (e.g. nextval,
setval, and alter). Prior to this patch, the value all_fields was
always false when invoked via nextval and setval, which forced the
bitmap to only include changed columns.
Solution:
========
Change all_fields when invoked via nextval and setval to be reliant
on binlog_row_image, such that it is false when binlog_row_image is
MINIMAL, and true otherwise.
Reviewed By:
===========
Andrei Elkin <andrei.elkin@mariadb.com>
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_sequence.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sql/sql_sequence.cc b/sql/sql_sequence.cc index e5fea586d06..40524702835 100644 --- a/sql/sql_sequence.cc +++ b/sql/sql_sequence.cc @@ -704,7 +704,9 @@ longlong SEQUENCE::next_value(TABLE *table, bool second_round, int *error) { longlong res_value, org_reserved_until, add_to; bool out_of_values; + THD *thd= table->in_use; DBUG_ENTER("SEQUENCE::next_value"); + DBUG_ASSERT(thd); *error= 0; if (!second_round) @@ -769,7 +771,8 @@ longlong SEQUENCE::next_value(TABLE *table, bool second_round, int *error) DBUG_RETURN(next_value(table, 1, error)); } - if (unlikely((*error= write(table, 0)))) + if (unlikely((*error= write(table, thd->variables.binlog_row_image != + BINLOG_ROW_IMAGE_MINIMAL)))) { reserved_until= org_reserved_until; next_free_value= res_value; @@ -836,7 +839,9 @@ int SEQUENCE::set_value(TABLE *table, longlong next_val, ulonglong next_round, longlong org_reserved_until= reserved_until; longlong org_next_free_value= next_free_value; ulonglong org_round= round; + THD *thd= table->in_use; DBUG_ENTER("SEQUENCE::set_value"); + DBUG_ASSERT(thd); write_lock(table); if (is_used) @@ -875,7 +880,8 @@ int SEQUENCE::set_value(TABLE *table, longlong next_val, ulonglong next_round, needs_to_be_stored) { reserved_until= next_free_value; - if (write(table, 0)) + if (write(table, + thd->variables.binlog_row_image != BINLOG_ROW_IMAGE_MINIMAL)) { reserved_until= org_reserved_until; next_free_value= org_next_free_value; |