mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-14605 Changes to "ON UPDATE CURRENT_TIMESTAMP" fields are not
always logged properly with binlog_row_image=MINIMAL
There are two issues fixed in this commit.
The first is an observation of a multi-table UPDATE binlogged
in row-format in binlog_row_image=MINIMAL mode. While the UPDATE aims
at a table with an ON-UPDATE attribute its binlog after-image misses
to record also installed default value.
The reason for that turns out missed marking of default-capable fields
in TABLE::write_set.
This is fixed to mark such fields similarly to 10.2's MDEV-10134 patch (db7edfed17
)
that introduced it. The marking follows up 93d1e5ce0b841bed's idea
to exploit TABLE:rpl_write_set introduced there though,
and thus does not mess (in 10.1) with the actual MDEV-10134 agenda.
The patch makes formerly arg-less TABLE::mark_default_fields_for_write()
to accept an argument which would be TABLE:rpl_write_set.
The 2nd issue is extra columns in in binlog_row_image=MINIMAL before-image
while merely a packed primary key is enough. The test main.mysqlbinlog_row_minimal
always had a wrong result recorded.
This is fixed to invoke a function that intended for read_set
possible filtering and which is called (supposed to) in all type of MDL, UPDATE
including; the test results have gotten corrected.
At *merging* from 10.1->10.2 the 1st "main" part of the patch is unnecessary
since the bug is not observed in 10.2, so only hunks from
sql/sql_class.cc
are required.
This commit is contained in:
@@ -6137,6 +6137,8 @@ void TABLE::mark_columns_per_binlog_row_image()
|
||||
mark_columns_used_by_index_no_reset(s->primary_key, read_set);
|
||||
/* Only write columns that have changed */
|
||||
rpl_write_set= write_set;
|
||||
if (default_field)
|
||||
mark_default_fields_for_write(rpl_write_set);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -6283,7 +6285,7 @@ bool TABLE::has_default_function(bool is_update)
|
||||
Add all fields that have a default function to the table write set.
|
||||
*/
|
||||
|
||||
void TABLE::mark_default_fields_for_write()
|
||||
void TABLE::mark_default_fields_for_write(MY_BITMAP* bset)
|
||||
{
|
||||
Field **dfield_ptr, *dfield;
|
||||
enum_sql_command cmd= in_use->lex->sql_command;
|
||||
@@ -6294,7 +6296,7 @@ void TABLE::mark_default_fields_for_write()
|
||||
dfield->has_insert_default_function()) ||
|
||||
((sql_command_flags[cmd] & CF_UPDATES_DATA) &&
|
||||
dfield->has_update_default_function()))
|
||||
bitmap_set_bit(write_set, dfield->field_index);
|
||||
bitmap_set_bit(bset, dfield->field_index);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user