diff options
author | Monty <monty@mariadb.org> | 2021-01-26 02:20:05 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2021-05-19 22:54:12 +0200 |
commit | 85d6278fed9e2279117854d86219408f9787bd97 (patch) | |
tree | 5d34017eac64d94fd89fe9fe9a595c44d3576b53 /client/mysqlbinlog.cc | |
parent | db9398ba5e385143e6c64af472962f62fa892959 (diff) | |
download | mariadb-git-85d6278fed9e2279117854d86219408f9787bd97.tar.gz |
Change replication to use uchar for all buffers instead of char
This change is to get rid of randomly failing tests, especially those
that reads random position of the binary log. From looking at the logs
it's clear that some failures is because of a read char (with value >= 128)
is converted to a big long value. Using uchar everywhere makes this much
less likely to happen.
Another benefit is that a lot of cast of char to uchar could be removed.
Other things:
- Removed some extra space before '=' and '+=' in assignments
- Fixed indentations and lines > 80 characters
- Replace '16' with 'element_size' (from class definition) in
Gtid_list_log_event()
Diffstat (limited to 'client/mysqlbinlog.cc')
-rw-r--r-- | client/mysqlbinlog.cc | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 81c2e66be46..0d4ec1d50af 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -216,7 +216,7 @@ Log_event* read_remote_annotate_event(uchar* net_buf, ulong event_len, memcpy(event_buf, net_buf, event_len); event_buf[event_len]= 0; - if (!(event= Log_event::read_log_event((const char*) event_buf, event_len, + if (!(event= Log_event::read_log_event(event_buf, event_len, error_msg, glob_description_event, opt_verify_binlog_checksum))) { @@ -227,7 +227,7 @@ Log_event* read_remote_annotate_event(uchar* net_buf, ulong event_len, Ensure the event->temp_buf is pointing to the allocated buffer. (TRUE = free temp_buf on the event deletion) */ - event->register_temp_buf((char*)event_buf, TRUE); + event->register_temp_buf(event_buf, TRUE); return event; } @@ -512,8 +512,7 @@ Exit_status Load_log_processor::load_old_format_file(NET* net, error("Illegal length of packet read from net."); return ERROR_STOP; } - if (my_write(file, (uchar*) net->read_pos, - (uint) packet_len, MYF(MY_WME|MY_NABP))) + if (my_write(file, net->read_pos, (uint) packet_len, MYF(MY_WME|MY_NABP))) return ERROR_STOP; } @@ -2350,7 +2349,7 @@ static Exit_status handle_event_text_mode(PRINT_EVENT_INFO *print_event_info, } else { - if (!(ev= Log_event::read_log_event((const char*) net->read_pos + 1 , + if (!(ev= Log_event::read_log_event(net->read_pos + 1 , *len - 1, &error_msg, glob_description_event, opt_verify_binlog_checksum))) @@ -2362,7 +2361,7 @@ static Exit_status handle_event_text_mode(PRINT_EVENT_INFO *print_event_info, If reading from a remote host, ensure the temp_buf for the Log_event class is pointing to the incoming stream. */ - ev->register_temp_buf((char *) net->read_pos + 1, FALSE); + ev->register_temp_buf(net->read_pos + 1, FALSE); } Log_event_type type= ev->get_type_code(); @@ -2463,7 +2462,7 @@ static Exit_status handle_event_raw_mode(PRINT_EVENT_INFO *print_event_info, const char* logname, uint logname_len) { const char *error_msg; - const unsigned char *read_pos= mysql->net.read_pos + 1; + const uchar *read_pos= mysql->net.read_pos + 1; Log_event_type type; DBUG_ENTER("handle_event_raw_mode"); DBUG_ASSERT(opt_raw_mode && remote_opt); @@ -2476,7 +2475,7 @@ static Exit_status handle_event_raw_mode(PRINT_EVENT_INFO *print_event_info, if (type == ROTATE_EVENT || type == FORMAT_DESCRIPTION_EVENT) { Log_event *ev; - if (!(ev= Log_event::read_log_event((const char*) read_pos , + if (!(ev= Log_event::read_log_event(read_pos , *len - 1, &error_msg, glob_description_event, opt_verify_binlog_checksum))) @@ -2489,7 +2488,7 @@ static Exit_status handle_event_raw_mode(PRINT_EVENT_INFO *print_event_info, If reading from a remote host, ensure the temp_buf for the Log_event class is pointing to the incoming stream. */ - ev->register_temp_buf((char *) read_pos, FALSE); + ev->register_temp_buf(const_cast<uchar*>(read_pos), FALSE); if (type == ROTATE_EVENT) { |