diff options
author | Luis Soares <luis.soares@sun.com> | 2010-01-15 17:52:46 +0000 |
---|---|---|
committer | Luis Soares <luis.soares@sun.com> | 2010-01-15 17:52:46 +0000 |
commit | 2afa7085e90a257d92f97c8c064cb26c6f95cfae (patch) | |
tree | 4e680d68b35762adf3eb7e8f66e5abfc728a1d03 /sql/log.cc | |
parent | 54b2371e92a723ee9d44c282b3b1c5b7baf50f89 (diff) | |
download | mariadb-git-2afa7085e90a257d92f97c8c064cb26c6f95cfae.tar.gz |
BUG#49562: SBR out of sync when using numeric data types + user
variable
The User_var_log_event was not serializing the unsigned
flag. This would cause the slave to always assume signed values.
We fix this by extending the User_var_log_event to also contain
information on the unsigned_flag, meaning that it gets into the
binlog as well, therefore the slave will get this information as
well. Events without information on unsigned flag (old events)
are treated as they were before (always signed: unsigned_flag=
FALSE).
The information on the unsigned_flag, is shipped in an extra byte
appended to the end of the User_var_log_event and added by this
patch. This extra byte holds values for general purpose
User_var_log_event flags which are now packed in the binlog as
well. One of these flags contains information about whether the
value is signed or unsigned (currently this extra byte is only
used to hold data on the unsigned flag, in the future we can use
it to pack extra flags if there is the need to).
Diffstat (limited to 'sql/log.cc')
-rw-r--r-- | sql/log.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sql/log.cc b/sql/log.cc index 8781fb03031..ba3aed64f21 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -4455,12 +4455,19 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info) { BINLOG_USER_VAR_EVENT *user_var_event; get_dynamic(&thd->user_var_events,(uchar*) &user_var_event, i); + + /* setting flags for user var log event */ + uchar flags= User_var_log_event::UNDEF_F; + if (user_var_event->user_var_event->unsigned_flag) + flags|= User_var_log_event::UNSIGNED_F; + User_var_log_event e(thd, user_var_event->user_var_event->name.str, user_var_event->user_var_event->name.length, user_var_event->value, user_var_event->length, user_var_event->type, - user_var_event->charset_number); + user_var_event->charset_number, + flags); if (e.write(file)) goto err; } |