Commit 85d6278f authored by Monty's avatar Monty Committed by Sergei Golubchik

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()
parent db9398ba
......@@ -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)
{
......
This diff is collapsed.
This diff is collapsed.
......@@ -1587,7 +1587,7 @@ bool Log_event::print_base64(IO_CACHE* file,
PRINT_EVENT_INFO* print_event_info,
bool do_print_encoded)
{
uchar *ptr= (uchar *)temp_buf;
uchar *ptr= temp_buf;
uint32 size= uint4korr(ptr + EVENT_LEN_OFFSET);
DBUG_ENTER("Log_event::print_base64");
......@@ -1602,31 +1602,31 @@ bool Log_event::print_base64(IO_CACHE* file,
switch (ev_type) {
case WRITE_ROWS_EVENT:
ptr[EVENT_TYPE_OFFSET]= DELETE_ROWS_EVENT;
ev= new Delete_rows_log_event((const char*) ptr, tmp_size,
ev= new Delete_rows_log_event(ptr, tmp_size,
glob_description_event);
ev->change_to_flashback_event(print_event_info, ptr, ev_type);
break;
case WRITE_ROWS_EVENT_V1:
ptr[EVENT_TYPE_OFFSET]= DELETE_ROWS_EVENT_V1;
ev= new Delete_rows_log_event((const char*) ptr, tmp_size,
ev= new Delete_rows_log_event(ptr, tmp_size,
glob_description_event);
ev->change_to_flashback_event(print_event_info, ptr, ev_type);
break;
case DELETE_ROWS_EVENT:
ptr[EVENT_TYPE_OFFSET]= WRITE_ROWS_EVENT;
ev= new Write_rows_log_event((const char*) ptr, tmp_size,
ev= new Write_rows_log_event(ptr, tmp_size,
glob_description_event);
ev->change_to_flashback_event(print_event_info, ptr, ev_type);
break;
case DELETE_ROWS_EVENT_V1:
ptr[EVENT_TYPE_OFFSET]= WRITE_ROWS_EVENT_V1;
ev= new Write_rows_log_event((const char*) ptr, tmp_size,
ev= new Write_rows_log_event(ptr, tmp_size,
glob_description_event);
ev->change_to_flashback_event(print_event_info, ptr, ev_type);
break;
case UPDATE_ROWS_EVENT:
case UPDATE_ROWS_EVENT_V1:
ev= new Update_rows_log_event((const char*) ptr, tmp_size,
ev= new Update_rows_log_event(ptr, tmp_size,
glob_description_event);
ev->change_to_flashback_event(print_event_info, ptr, ev_type);
break;
......@@ -1673,7 +1673,7 @@ bool Log_event::print_base64(IO_CACHE* file,
case TABLE_MAP_EVENT:
{
Table_map_log_event *map;
map= new Table_map_log_event((const char*) ptr, size,
map= new Table_map_log_event(ptr, size,
glob_description_event);
#ifdef WHEN_FLASHBACK_REVIEW_READY
if (need_flashback_review)
......@@ -1688,42 +1688,42 @@ bool Log_event::print_base64(IO_CACHE* file,
case WRITE_ROWS_EVENT:
case WRITE_ROWS_EVENT_V1:
{
ev= new Write_rows_log_event((const char*) ptr, size,
ev= new Write_rows_log_event(ptr, size,
glob_description_event);
break;
}
case DELETE_ROWS_EVENT:
case DELETE_ROWS_EVENT_V1:
{
ev= new Delete_rows_log_event((const char*) ptr, size,
ev= new Delete_rows_log_event(ptr, size,
glob_description_event);
break;
}
case UPDATE_ROWS_EVENT:
case UPDATE_ROWS_EVENT_V1:
{
ev= new Update_rows_log_event((const char*) ptr, size,
ev= new Update_rows_log_event(ptr, size,
glob_description_event);
break;
}
case WRITE_ROWS_COMPRESSED_EVENT:
case WRITE_ROWS_COMPRESSED_EVENT_V1:
{
ev= new Write_rows_compressed_log_event((const char*) ptr, size,
ev= new Write_rows_compressed_log_event(ptr, size,
glob_description_event);
break;
}
case UPDATE_ROWS_COMPRESSED_EVENT:
case UPDATE_ROWS_COMPRESSED_EVENT_V1:
{
ev= new Update_rows_compressed_log_event((const char*) ptr, size,
ev= new Update_rows_compressed_log_event(ptr, size,
glob_description_event);
break;
}
case DELETE_ROWS_COMPRESSED_EVENT:
case DELETE_ROWS_COMPRESSED_EVENT_V1:
{
ev= new Delete_rows_compressed_log_event((const char*) ptr, size,
ev= new Delete_rows_compressed_log_event(ptr, size,
glob_description_event);
break;
}
......@@ -3103,7 +3103,8 @@ int Table_map_log_event::rewrite_db(const char* new_db, size_t new_len,
// Create new temp_buf
ulong event_cur_len= uint4korr(temp_buf + EVENT_LEN_OFFSET);
ulong event_new_len= event_cur_len + len_diff;
char* new_temp_buf= (char*) my_malloc(PSI_NOT_INSTRUMENTED, event_new_len, MYF(MY_WME));
uchar* new_temp_buf= (uchar*) my_malloc(PSI_NOT_INSTRUMENTED, event_new_len,
MYF(MY_WME));
if (!new_temp_buf)
{
......@@ -3114,7 +3115,7 @@ int Table_map_log_event::rewrite_db(const char* new_db, size_t new_len,
}
// Rewrite temp_buf
char* ptr= new_temp_buf;
uchar *ptr= new_temp_buf;
size_t cnt= 0;
// Copy header and change event length
......@@ -3612,12 +3613,13 @@ bool Write_rows_log_event::print(FILE *file, PRINT_EVENT_INFO* print_event_info)
bool Write_rows_compressed_log_event::print(FILE *file,
PRINT_EVENT_INFO* print_event_info)
{
char *new_buf;
uchar *new_buf;
ulong len;
bool is_malloc = false;
if(!row_log_event_uncompress(glob_description_event,
checksum_alg == BINLOG_CHECKSUM_ALG_CRC32,
temp_buf, UINT_MAX32, NULL, 0, &is_malloc, &new_buf, &len))
temp_buf, UINT_MAX32, NULL, 0, &is_malloc,
&new_buf, &len))
{
free_temp_buf();
register_temp_buf(new_buf, true);
......@@ -3648,12 +3650,13 @@ bool Delete_rows_log_event::print(FILE *file,
bool Delete_rows_compressed_log_event::print(FILE *file,
PRINT_EVENT_INFO* print_event_info)
{
char *new_buf;
uchar *new_buf;
ulong len;
bool is_malloc = false;
if(!row_log_event_uncompress(glob_description_event,
checksum_alg == BINLOG_CHECKSUM_ALG_CRC32,
temp_buf, UINT_MAX32, NULL, 0, &is_malloc, &new_buf, &len))
temp_buf, UINT_MAX32, NULL, 0, &is_malloc,
&new_buf, &len))
{
free_temp_buf();
register_temp_buf(new_buf, true);
......@@ -3684,12 +3687,13 @@ bool
Update_rows_compressed_log_event::print(FILE *file,
PRINT_EVENT_INFO *print_event_info)
{
char *new_buf;
uchar *new_buf;
ulong len;
bool is_malloc= false;
if(!row_log_event_uncompress(glob_description_event,
checksum_alg == BINLOG_CHECKSUM_ALG_CRC32,
temp_buf, UINT_MAX32, NULL, 0, &is_malloc, &new_buf, &len))
temp_buf, UINT_MAX32, NULL, 0, &is_malloc,
&new_buf, &len))
{
free_temp_buf();
register_temp_buf(new_buf, true);
......
......@@ -1175,7 +1175,7 @@ Old_rows_log_event::Old_rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid,
#endif
Old_rows_log_event::Old_rows_log_event(const char *buf, uint event_len,
Old_rows_log_event::Old_rows_log_event(const uchar *buf, uint event_len,
Log_event_type event_type,
const Format_description_log_event
*description_event)
......@@ -1198,8 +1198,8 @@ Old_rows_log_event::Old_rows_log_event(const char *buf, uint event_len,
event_len, common_header_len,
post_header_len));
const char *post_start= buf + common_header_len;
DBUG_DUMP("post_header", (uchar*) post_start, post_header_len);
const uchar *post_start= buf + common_header_len;
DBUG_DUMP("post_header", post_start, post_header_len);
post_start+= RW_MAPID_OFFSET;
if (post_header_len == 6)
{
......@@ -2417,7 +2417,7 @@ Write_rows_log_event_old::Write_rows_log_event_old(THD *thd_arg,
Constructor used by slave to read the event from the binary log.
*/
#ifdef HAVE_REPLICATION
Write_rows_log_event_old::Write_rows_log_event_old(const char *buf,
Write_rows_log_event_old::Write_rows_log_event_old(const uchar *buf,
uint event_len,
const Format_description_log_event
*description_event)
......@@ -2530,12 +2530,13 @@ Delete_rows_log_event_old::Delete_rows_log_event_old(THD *thd_arg,
Constructor used by slave to read the event from the binary log.
*/
#ifdef HAVE_REPLICATION
Delete_rows_log_event_old::Delete_rows_log_event_old(const char *buf,
uint event_len,
const Format_description_log_event
*description_event)
: Old_rows_log_event(buf, event_len, PRE_GA_DELETE_ROWS_EVENT,
description_event),
Delete_rows_log_event_old::
Delete_rows_log_event_old(const uchar *buf,
uint event_len,
const Format_description_log_event
*description_event)
:Old_rows_log_event(buf, event_len, PRE_GA_DELETE_ROWS_EVENT,
description_event),
m_after_image(NULL), m_memory(NULL)
{
}
......@@ -2544,8 +2545,8 @@ Delete_rows_log_event_old::Delete_rows_log_event_old(const char *buf,
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
int
Delete_rows_log_event_old::do_before_row_operations(const Slave_reporting_capability *const)
int Delete_rows_log_event_old::
do_before_row_operations(const Slave_reporting_capability *const)
{
if ((m_table->file->ha_table_flags() & HA_PRIMARY_KEY_REQUIRED_FOR_POSITION) &&
m_table->s->primary_key < MAX_KEY)
......@@ -2636,7 +2637,7 @@ Update_rows_log_event_old::Update_rows_log_event_old(THD *thd_arg,
Constructor used by slave to read the event from the binary log.
*/
#ifdef HAVE_REPLICATION
Update_rows_log_event_old::Update_rows_log_event_old(const char *buf,
Update_rows_log_event_old::Update_rows_log_event_old(const uchar *buf,
uint event_len,
const
Format_description_log_event
......@@ -2652,12 +2653,14 @@ Update_rows_log_event_old::Update_rows_log_event_old(const char *buf,
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
int
Update_rows_log_event_old::do_before_row_operations(const Slave_reporting_capability *const)
Update_rows_log_event_old::
do_before_row_operations(const Slave_reporting_capability *const)
{
if (m_table->s->keys > 0)
{
// Allocate buffer for key searches
m_key= (uchar*)my_malloc(key_memory_log_event_old, m_table->key_info->key_length, MYF(MY_WME));
m_key= (uchar*)my_malloc(key_memory_log_event_old,
m_table->key_info->key_length, MYF(MY_WME));
if (!m_key)
return HA_ERR_OUT_OF_MEM;
}
......@@ -2667,8 +2670,8 @@ Update_rows_log_event_old::do_before_row_operations(const Slave_reporting_capabi
int
Update_rows_log_event_old::do_after_row_operations(const Slave_reporting_capability *const,
int error)
Update_rows_log_event_old::
do_after_row_operations(const Slave_reporting_capability *const, int error)
{
/*error= ToDo:find out what this should really be, this triggers close_scan in nbd, returning error?*/
m_table->file->ha_index_or_rnd_end();
......
......@@ -161,7 +161,7 @@ class Old_rows_log_event : public Log_event
Old_rows_log_event(THD*, TABLE*, ulong table_id,
MY_BITMAP const *cols, bool is_transactional);
#endif
Old_rows_log_event(const char *row_data, uint event_len,
Old_rows_log_event(const uchar *row_data, uint event_len,
Log_event_type event_type,
const Format_description_log_event *description_event);
......@@ -363,7 +363,7 @@ class Write_rows_log_event_old : public Old_rows_log_event
MY_BITMAP const *cols, bool is_transactional);
#endif
#ifdef HAVE_REPLICATION
Write_rows_log_event_old(const char *buf, uint event_len,
Write_rows_log_event_old(const uchar *buf, uint event_len,
const Format_description_log_event *description_event);
#endif
#if !defined(MYSQL_CLIENT)
......@@ -436,7 +436,7 @@ class Update_rows_log_event_old : public Old_rows_log_event
#endif
#ifdef HAVE_REPLICATION
Update_rows_log_event_old(const char *buf, uint event_len,
Update_rows_log_event_old(const uchar *buf, uint event_len,
const Format_description_log_event *description_event);
#endif
......@@ -511,7 +511,7 @@ class Delete_rows_log_event_old : public Old_rows_log_event
MY_BITMAP const *cols, bool is_transactional);
#endif
#ifdef HAVE_REPLICATION
Delete_rows_log_event_old(const char *buf, uint event_len,
Delete_rows_log_event_old(const uchar *buf, uint event_len,
const Format_description_log_event *description_event);
#endif
#if !defined(MYSQL_CLIENT)
......
......@@ -1331,14 +1331,14 @@ bool Query_log_event::write()
bool Query_compressed_log_event::write()
{
char *buffer;
uchar *buffer;
uint32 alloc_size, compressed_size;
bool ret= true;
compressed_size= alloc_size= binlog_get_compress_len(q_len);
buffer= (char*) my_safe_alloca(alloc_size);
buffer= (uchar*) my_safe_alloca(alloc_size);
if (buffer &&
!binlog_buf_compress(query, buffer, q_len, &compressed_size))
!binlog_buf_compress((uchar*) query, buffer, q_len, &compressed_size))
{
/*
Write the compressed event. We have to temporarily store the event
......@@ -1346,7 +1346,7 @@ bool Query_compressed_log_event::write()
*/
const char *query_tmp= query;
uint32 q_len_tmp= q_len;
query= buffer;
query= (char*) buffer;
q_len= compressed_size;
ret= Query_log_event::write();
query= query_tmp;
......@@ -2161,9 +2161,10 @@ Query_log_event::do_shall_skip(rpl_group_info *rgi)
bool
Query_log_event::peek_is_commit_rollback(const char *event_start,
Query_log_event::peek_is_commit_rollback(const uchar *event_start,
size_t event_len,
enum enum_binlog_checksum_alg checksum_alg)
enum enum_binlog_checksum_alg
checksum_alg)
{
if (checksum_alg == BINLOG_CHECKSUM_ALG_CRC32)
{
......@@ -3295,12 +3296,12 @@ Gtid_log_event::Gtid_log_event(THD *thd_arg, uint64 seq_no_arg,
fully contruct every Gtid_log_event() needlessly.
*/
bool
Gtid_log_event::peek(const char *event_start, size_t event_len,
Gtid_log_event::peek(const uchar *event_start, size_t event_len,
enum enum_binlog_checksum_alg checksum_alg,
uint32 *domain_id, uint32 *server_id, uint64 *seq_no,
uchar *flags2, const Format_description_log_event *fdev)
{
const char *p;
const uchar *p;
if (checksum_alg == BINLOG_CHECKSUM_ALG_CRC32)
{
......@@ -3321,7 +3322,7 @@ Gtid_log_event::peek(const char *event_start, size_t event_len,
p+= 8;
*domain_id= uint4korr(p);
p+= 4;
*flags2= (uchar)*p;
*flags2= *p;
return false;
}
......@@ -6006,14 +6007,15 @@ bool Rows_log_event::write_data_body()
bool Rows_log_event::write_compressed()
{
uchar *m_rows_buf_tmp = m_rows_buf;
uchar *m_rows_cur_tmp = m_rows_cur;
bool ret = true;
uchar *m_rows_buf_tmp= m_rows_buf;
uchar *m_rows_cur_tmp= m_rows_cur;
bool ret= true;
uint32 comlen, alloc_size;
comlen= alloc_size= binlog_get_compress_len((uint32)(m_rows_cur_tmp - m_rows_buf_tmp));
m_rows_buf = (uchar *)my_safe_alloca(alloc_size);
comlen= alloc_size= binlog_get_compress_len((uint32)(m_rows_cur_tmp -
m_rows_buf_tmp));
m_rows_buf= (uchar*) my_safe_alloca(alloc_size);
if(m_rows_buf &&
!binlog_buf_compress((const char *)m_rows_buf_tmp, (char *)m_rows_buf,
!binlog_buf_compress(m_rows_buf_tmp, m_rows_buf,
(uint32)(m_rows_cur_tmp - m_rows_buf_tmp), &comlen))
{
m_rows_cur= comlen + m_rows_buf;
......@@ -8447,9 +8449,8 @@ Log_event* wsrep_read_log_event(
char **arg_buf, size_t *arg_buf_len,
const Format_description_log_event *description_event)
{
char *head= (*arg_buf);
uchar *head= (uchar*) (*arg_buf);
uint data_len = uint4korr(head + EVENT_LEN_OFFSET);
char *buf= (*arg_buf);
const char *error= 0;
Log_event *res= 0;
DBUG_ENTER("wsrep_read_log_event");
......@@ -8460,15 +8461,16 @@ Log_event* wsrep_read_log_event(
goto err;
}
res= Log_event::read_log_event(buf, data_len, &error, description_event, false);
res= Log_event::read_log_event(head, data_len, &error, description_event,
false);
err:
if (!res)
{
DBUG_ASSERT(error != 0);
sql_print_error("Error in Log_event::read_log_event(): "
"'%s', data_len: %d, event_type: %d",
error,data_len,(uchar)head[EVENT_TYPE_OFFSET]);
"'%s', data_len: %u, event_type: %d",
error, data_len, (int) head[EVENT_TYPE_OFFSET]);
}
(*arg_buf)+= data_len;
(*arg_buf_len)-= data_len;
......@@ -8478,8 +8480,7 @@ Log_event* wsrep_read_log_event(
#if defined(HAVE_REPLICATION)
int
Incident_log_event::do_apply_event(rpl_group_info *rgi)
int Incident_log_event::do_apply_event(rpl_group_info *rgi)
{
Relay_log_info const *rli= rgi->rli;
DBUG_ENTER("Incident_log_event::do_apply_event");
......@@ -8532,7 +8533,7 @@ void Ignorable_log_event::pack_info(Protocol *protocol)
#if defined(HAVE_REPLICATION)
Heartbeat_log_event::Heartbeat_log_event(const char* buf, ulong event_len,
Heartbeat_log_event::Heartbeat_log_event(const uchar *buf, uint event_len,
const Format_description_log_event* description_event)
:Log_event(buf, description_event)
{
......@@ -8562,9 +8563,9 @@ Heartbeat_log_event::Heartbeat_log_event(const char* buf, ulong event_len,
1 Don't write event
*/
bool event_that_should_be_ignored(const char *buf)
bool event_that_should_be_ignored(const uchar *buf)
{
uint event_type= (uchar)buf[EVENT_TYPE_OFFSET];
uint event_type= buf[EVENT_TYPE_OFFSET];
if (event_type == GTID_LOG_EVENT ||
event_type == ANONYMOUS_GTID_LOG_EVENT ||
event_type == PREVIOUS_GTIDS_LOG_EVENT ||
......
......@@ -139,8 +139,8 @@ typedef struct st_rows_event_tracker
my_off_t first_seen;
my_off_t last_seen;
bool stmt_end_seen;
void update(const char* file_name, my_off_t pos,
const char* buf,
void update(const char *file_name, my_off_t pos,
const uchar *buf,
const Format_description_log_event *fdle);
void reset();
bool check_and_report(const char* file_name, my_off_t pos);
......
......@@ -288,8 +288,15 @@ table_def::~table_def()
@return TRUE if test fails
FALSE as success
@notes
event_buf will have same values on return. However during the process of
caluclating the checksum, it's temporary changed. Because of this the
event_buf argument is not a pointer to const.
*/
bool event_checksum_test(uchar *event_buf, ulong event_len, enum enum_binlog_checksum_alg alg)
bool event_checksum_test(uchar *event_buf, ulong event_len,
enum enum_binlog_checksum_alg alg)
{
bool res= FALSE;
uint16 flags= 0; // to store in FD's buffer flags orig value
......
......@@ -52,10 +52,10 @@ int Repl_semi_sync_slave::init_object()
return result;
}
int Repl_semi_sync_slave::slave_read_sync_header(const char *header,
int Repl_semi_sync_slave::slave_read_sync_header(const uchar *header,
unsigned long total_len,
int *semi_flags,
const char **payload,
const uchar **payload,
unsigned long *payload_len)
{
int read_res = 0;
......@@ -64,7 +64,7 @@ int Repl_semi_sync_slave::slave_read_sync_header(const char *header,
if (rpl_semi_sync_slave_status)
{
if (DBUG_EVALUATE_IF("semislave_corrupt_log", 0, 1)
&& (unsigned char)(header[0]) == k_packet_magic_num)
&& header[0] == k_packet_magic_num)
{
semi_sync_need_reply = (header[1] & k_packet_flag_sync);
*payload_len = total_len - 2;
......
......@@ -78,9 +78,9 @@ class Repl_semi_sync_slave
* Return:
* 0: success; non-zero: error
*/
int slave_read_sync_header(const char *header, unsigned long total_len,
int slave_read_sync_header(const uchar *header, unsigned long total_len,
int *semi_flags,
const char **payload, unsigned long *payload_len);
const uchar **payload, unsigned long *payload_len);
/* A slave replies to the master indicating its replication process. It
* indicates that the slave has received all events before the specified
......
This diff is collapsed.
......@@ -207,7 +207,7 @@ void mysql_client_binlog_statement(THD* thd)
int err;
Relay_log_info *rli;
rpl_group_info *rgi;
char *buf= NULL;
uchar *buf= NULL;
size_t coded_len= 0, decoded_len= 0;
rli= thd->rli_fake;
......@@ -243,7 +243,7 @@ void mysql_client_binlog_statement(THD* thd)
}
decoded_len= my_base64_needed_decoded_length((int)coded_len);
if (!(buf= (char *) my_malloc(key_memory_binlog_statement_buffer,
if (!(buf= (uchar *) my_malloc(key_memory_binlog_statement_buffer,
decoded_len, MYF(MY_WME))))
{
my_error(ER_OUTOFMEMORY, MYF(ME_FATAL), 1);
......@@ -299,7 +299,7 @@ void mysql_client_binlog_statement(THD* thd)
Now we start to read events of the buffer, until there are no
more.
*/
for (char *bufptr= buf ; bytes_decoded > 0 ; )
for (uchar *bufptr= buf ; bytes_decoded > 0 ; )
{
/*
Checking that the first event in the buffer is not truncated.
......
......@@ -1519,9 +1519,10 @@ gtid_state_from_pos(const char *name, uint32 offset,
goto end;
}
current_checksum_alg= get_checksum_alg(packet.ptr(), packet.length());
current_checksum_alg= get_checksum_alg((uchar*) packet.ptr(),
packet.length());
found_format_description_event= true;
if (unlikely(!(tmp= new Format_description_log_event(packet.ptr(),
if (unlikely(!(tmp= new Format_description_log_event((uchar*) packet.ptr(),
packet.length(),
fdev))))
{
......@@ -1539,7 +1540,7 @@ gtid_state_from_pos(const char *name, uint32 offset,
{
sele_len -= BINLOG_CHECKSUM_LEN;
}
Start_encryption_log_event sele(packet.ptr(), sele_len, fdev);
Start_encryption_log_event sele((uchar*) packet.ptr(), sele_len, fdev);
if (fdev->start_decryption(&sele))
{
errormsg= "Could not start decryption of binlog.";
......@@ -1596,7 +1597,7 @@ gtid_state_from_pos(const char *name, uint32 offset,
{
rpl_gtid gtid;
uchar flags2;
if (unlikely(Gtid_log_event::peek(packet.ptr(), packet.length(),
if (unlikely(Gtid_log_event::peek((uchar*) packet.ptr(), packet.length(),
current_checksum_alg, &gtid.domain_id,
&gtid.server_id, &gtid.seq_no, &flags2,
fdev)))
......@@ -1682,9 +1683,9 @@ is_until_reached(binlog_send_info *info, ulong *ev_offset,
if (event_type != XID_EVENT && event_type != XA_PREPARE_LOG_EVENT &&
(event_type != QUERY_EVENT || /* QUERY_COMPRESSED_EVENT would never be commmit or rollback */
!Query_log_event::peek_is_commit_rollback
(info->packet->ptr()+*ev_offset,
info->packet->length()-*ev_offset,
info->current_checksum_alg)))
((uchar*) info->packet->ptr() + *ev_offset,
info->packet->length() - *ev_offset,
info->current_checksum_alg)))
return false;
break;
}
......@@ -1762,7 +1763,7 @@ send_event_to_slave(binlog_send_info *info, Log_event_type event_type,
rpl_gtid event_gtid;
if (ev_offset > len ||
Gtid_log_event::peek(packet->ptr()+ev_offset, len - ev_offset,
Gtid_log_event::peek((uchar*) packet->ptr()+ev_offset, len - ev_offset,
current_checksum_alg,
&event_gtid.domain_id, &event_gtid.server_id,
&event_gtid.seq_no, &flags2, info->fdev))
......@@ -1916,7 +1917,8 @@ send_event_to_slave(binlog_send_info *info, Log_event_type event_type,
case GTID_SKIP_TRANSACTION:
if (event_type == XID_EVENT || event_type == XA_PREPARE_LOG_EVENT ||
(event_type == QUERY_EVENT && /* QUERY_COMPRESSED_EVENT would never be commmit or rollback */
Query_log_event::peek_is_commit_rollback(packet->ptr() + ev_offset,
Query_log_event::peek_is_commit_rollback((uchar*) packet->ptr() +
ev_offset,
len - ev_offset,
current_checksum_alg)))
info->gtid_skip_group= GTID_SKIP_NOT;
......@@ -2320,7 +2322,8 @@ static int send_format_descriptor_event(binlog_send_info *info, IO_CACHE *log,
DBUG_RETURN(1);
}
info->current_checksum_alg= get_checksum_alg(packet->ptr() + ev_offset,
info->current_checksum_alg= get_checksum_alg((uchar*) packet->ptr() +
ev_offset,
packet->length() - ev_offset);
DBUG_ASSERT(info->current_checksum_alg == BINLOG_CHECKSUM_ALG_OFF ||
......@@ -2345,7 +2348,7 @@ static int send_format_descriptor_event(binlog_send_info *info, IO_CACHE *log,
ev_len-= BINLOG_CHECKSUM_LEN;
Format_description_log_event *tmp;
if (!(tmp= new Format_description_log_event(packet->ptr() + ev_offset,
if (!(tmp= new Format_description_log_event((uchar*) packet->ptr() + ev_offset,
ev_len, info->fdev)))
{
info->error= ER_MASTER_FATAL_ERROR_READING_BINLOG;
......@@ -2437,7 +2440,8 @@ static int send_format_descriptor_event(binlog_send_info *info, IO_CACHE *log,
if (event_type == START_ENCRYPTION_EVENT)
{
Start_encryption_log_event *sele= (Start_encryption_log_event *)
Log_event::read_log_event(packet->ptr() + ev_offset, packet->length()
Log_event::read_log_event((uchar*) packet->ptr() + ev_offset,
packet->length()
- ev_offset, &info->errmsg, info->fdev,
BINLOG_CHECKSUM_ALG_OFF);
if (!sele)
......
......@@ -39,7 +39,7 @@ static Log_event* wsrep_read_log_event(
char *head= (*arg_buf);
uint data_len= uint4korr(head + EVENT_LEN_OFFSET);
char *buf= (*arg_buf);
uchar *buf= (uchar*) (*arg_buf);
const char *error= 0;
Log_event *res= 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment