mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
After-merge fixes for 5.5 merge.
Fix typo causing too low timeout value for wait_for_slave_param.inc. Fix binlog checksums following 5.5 merge. Make sure the rpl suite can run with --mysqld=--binlog-checksum=CRC32 Fix a number of problems in the code when checksums are enabled.
This commit is contained in:
@ -79,7 +79,7 @@ if ($_slave_check_configured == 'No such row')
|
||||
|
||||
# mysqltest doesn't provide any better way to multiply by 10
|
||||
--let $_wait_for_slave_param_zero= 0
|
||||
--let $_slave_timeout_counter= $_slave_timeout$zero
|
||||
--let $_slave_timeout_counter= $_slave_timeout$_wait_for_slave_param_zero
|
||||
--let $_slave_continue= 1
|
||||
while ($_slave_continue)
|
||||
{
|
||||
|
@ -98,10 +98,9 @@ count(*)
|
||||
1
|
||||
### check that the incident event is written to the current log
|
||||
SET GLOBAL debug="-d,error_unique_log_filename";
|
||||
FLUSH LOGS;
|
||||
SHOW BINLOG EVENTS IN 'BINLOG_FILE' FROM <binlog_start> LIMIT 1;
|
||||
show binlog events from <binlog_start> limit 4,1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
BINLOG_FILE # Incident # # #1 (LOST_EVENTS)
|
||||
master-bin.000001 # Incident # # #1 (LOST_EVENTS)
|
||||
DELETE FROM t4;
|
||||
RESET MASTER;
|
||||
###################### TEST #8
|
||||
|
@ -5,7 +5,6 @@ CREATE TABLE t1(c1 INT);
|
||||
FLUSH LOGS;
|
||||
call mtr.add_suppression('Got fatal error 1236 from master when reading data from binary log: .*could not find next log');
|
||||
include/wait_for_slave_io_error.inc [errno=1236]
|
||||
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'could not find next log; the last event was read from 'master-bin.000002' at 375, the last byte read was read from 'master-bin.000002' at 375.''
|
||||
CREATE TABLE t2(c1 INT);
|
||||
FLUSH LOGS;
|
||||
CREATE TABLE t3(c1 INT);
|
||||
|
@ -37,7 +37,6 @@ DROP TABLE t1;
|
||||
CREATE TABLE t1 (f1 int PRIMARY KEY, f2 LONGTEXT, f3 LONGTEXT) ENGINE=MyISAM;
|
||||
INSERT INTO t1(f1, f2, f3) VALUES(1, REPEAT('a', @@global.max_allowed_packet), REPEAT('b', @@global.max_allowed_packet));
|
||||
include/wait_for_slave_io_error.inc [errno=1236]
|
||||
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master; the last event was read from 'master-bin.000001' at 601, the last byte read was read from 'master-bin.000001' at 620.''
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
RESET MASTER;
|
||||
|
@ -186,16 +186,8 @@ SELECT count(*) FROM t4;
|
||||
|
||||
-- echo ### check that the incident event is written to the current log
|
||||
SET GLOBAL debug="-d,error_unique_log_filename";
|
||||
-- let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1)
|
||||
-- let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
|
||||
|
||||
# 53 is the size of the incident event, so we start from 22 bytes before the
|
||||
# current position
|
||||
-- let $binlog_start = `SELECT $binlog_start - 53`
|
||||
FLUSH LOGS;
|
||||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR $binlog_start <binlog_start> $binlog_file BINLOG_FILE
|
||||
-- replace_column 2 # 4 # 5 #
|
||||
-- eval SHOW BINLOG EVENTS IN '$binlog_file' FROM $binlog_start LIMIT 1
|
||||
-- let $binlog_limit= 4,1
|
||||
-- source include/show_binlog_events.inc
|
||||
|
||||
# clean up and move to next test
|
||||
DELETE FROM t4;
|
||||
|
@ -60,7 +60,7 @@ call mtr.add_suppression('Got fatal error 1236 from master when reading data fro
|
||||
connection slave;
|
||||
# 1236 = ER_MASTER_FATAL_ERROR_READING_BINLOG
|
||||
--let $slave_io_errno= 1236
|
||||
--let $show_slave_io_error= 1
|
||||
--let $show_slave_io_error= 0
|
||||
--source include/wait_for_slave_io_error.inc
|
||||
|
||||
connection master;
|
||||
|
@ -125,7 +125,12 @@ connection slave;
|
||||
# The slave I/O thread must stop after receiving
|
||||
# 1236=ER_MASTER_FATAL_ERROR_READING_BINLOG error message from master.
|
||||
--let $slave_io_errno= 1236
|
||||
--let $show_slave_io_error= 1
|
||||
#
|
||||
# Win and Unix path is printed differently: BUG#13055685. So
|
||||
# show_slave_io_error is made 0 until the bug fixes provide necessary
|
||||
# facilities
|
||||
#
|
||||
--let $show_slave_io_error= 0
|
||||
--source include/wait_for_slave_io_error.inc
|
||||
|
||||
# Remove the bad binlog and clear error status on slave.
|
||||
|
30
sql/log.cc
30
sql/log.cc
@ -4821,7 +4821,7 @@ int THD::binlog_write_table_map(TABLE *table, bool is_transactional,
|
||||
cache_mngr->get_binlog_cache_log(use_trans_cache(this, is_transactional));
|
||||
if (with_annotate && *with_annotate)
|
||||
{
|
||||
Annotate_rows_log_event anno(current_thd, is_transactional);
|
||||
Annotate_rows_log_event anno(current_thd, is_transactional, false);
|
||||
/* Annotate event should be written not more than once */
|
||||
*with_annotate= 0;
|
||||
if ((error= anno.write(file)))
|
||||
@ -4993,6 +4993,8 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
|
||||
DBUG_ENTER("MYSQL_BIN_LOG::write(Log_event *)");
|
||||
binlog_cache_data *cache_data= 0;
|
||||
bool is_trans_cache= FALSE;
|
||||
bool using_trans= event_info->use_trans_cache();
|
||||
bool direct= event_info->use_direct_logging();
|
||||
|
||||
if (thd->binlog_evt_union.do_union)
|
||||
{
|
||||
@ -5001,8 +5003,7 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
|
||||
We will log the function call to the binary log on function exit
|
||||
*/
|
||||
thd->binlog_evt_union.unioned_events= TRUE;
|
||||
thd->binlog_evt_union.unioned_events_trans |=
|
||||
event_info->use_trans_cache();
|
||||
thd->binlog_evt_union.unioned_events_trans |= using_trans;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
@ -5013,8 +5014,7 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
|
||||
*/
|
||||
bool const end_stmt=
|
||||
thd->locked_tables_mode && thd->lex->requires_prelocking();
|
||||
if (thd->binlog_flush_pending_rows_event(end_stmt,
|
||||
event_info->use_trans_cache()))
|
||||
if (thd->binlog_flush_pending_rows_event(end_stmt, using_trans))
|
||||
DBUG_RETURN(error);
|
||||
|
||||
/*
|
||||
@ -5041,7 +5041,7 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
|
||||
|
||||
IO_CACHE *file= NULL;
|
||||
|
||||
if (event_info->use_direct_logging())
|
||||
if (direct)
|
||||
{
|
||||
file= &log_file;
|
||||
my_org_b_tell= my_b_tell(file);
|
||||
@ -5055,7 +5055,7 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
|
||||
binlog_cache_mngr *const cache_mngr=
|
||||
(binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton);
|
||||
|
||||
is_trans_cache= use_trans_cache(thd, event_info->use_trans_cache());
|
||||
is_trans_cache= use_trans_cache(thd, using_trans);
|
||||
file= cache_mngr->get_binlog_cache_log(is_trans_cache);
|
||||
cache_data= cache_mngr->get_binlog_cache_data(is_trans_cache);
|
||||
|
||||
@ -5078,7 +5078,7 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
|
||||
if (with_annotate && *with_annotate)
|
||||
{
|
||||
DBUG_ASSERT(event_info->get_type_code() == TABLE_MAP_EVENT);
|
||||
Annotate_rows_log_event anno(thd, event_info->cache_type);
|
||||
Annotate_rows_log_event anno(thd, using_trans, direct);
|
||||
/* Annotate event should be written not more than once */
|
||||
*with_annotate= 0;
|
||||
if (anno.write(file))
|
||||
@ -5093,7 +5093,8 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
|
||||
if (thd->stmt_depends_on_first_successful_insert_id_in_prev_stmt)
|
||||
{
|
||||
Intvar_log_event e(thd,(uchar) LAST_INSERT_ID_EVENT,
|
||||
thd->first_successful_insert_id_in_prev_stmt_for_binlog);
|
||||
thd->first_successful_insert_id_in_prev_stmt_for_binlog,
|
||||
using_trans, direct);
|
||||
if (e.write(file))
|
||||
goto err;
|
||||
}
|
||||
@ -5104,13 +5105,14 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
|
||||
nb_elements()));
|
||||
Intvar_log_event e(thd, (uchar) INSERT_ID_EVENT,
|
||||
thd->auto_inc_intervals_in_cur_stmt_for_binlog.
|
||||
minimum());
|
||||
minimum(), using_trans, direct);
|
||||
if (e.write(file))
|
||||
goto err;
|
||||
}
|
||||
if (thd->rand_used)
|
||||
{
|
||||
Rand_log_event e(thd,thd->rand_saved_seed1,thd->rand_saved_seed2);
|
||||
Rand_log_event e(thd,thd->rand_saved_seed1,thd->rand_saved_seed2,
|
||||
using_trans, direct);
|
||||
if (e.write(file))
|
||||
goto err;
|
||||
}
|
||||
@ -5132,7 +5134,9 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
|
||||
user_var_event->length,
|
||||
user_var_event->type,
|
||||
user_var_event->charset_number,
|
||||
flags);
|
||||
flags,
|
||||
using_trans,
|
||||
direct);
|
||||
if (e.write(file))
|
||||
goto err;
|
||||
}
|
||||
@ -5149,7 +5153,7 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
|
||||
|
||||
error= 0;
|
||||
err:
|
||||
if (event_info->use_direct_logging())
|
||||
if (direct)
|
||||
{
|
||||
my_off_t offset= my_b_tell(file);
|
||||
|
||||
|
@ -8575,14 +8575,16 @@ void Rows_log_event::print_helper(FILE *file,
|
||||
|
||||
#ifndef MYSQL_CLIENT
|
||||
Annotate_rows_log_event::Annotate_rows_log_event(THD *thd,
|
||||
uint16 cache_type_arg)
|
||||
: Log_event(thd, 0, true),
|
||||
bool using_trans,
|
||||
bool direct)
|
||||
: Log_event(thd, 0, using_trans),
|
||||
m_save_thd_query_txt(0),
|
||||
m_save_thd_query_len(0)
|
||||
{
|
||||
m_query_txt= thd->query();
|
||||
m_query_len= thd->query_length();
|
||||
cache_type= cache_type_arg;
|
||||
if (direct)
|
||||
cache_type= Log_event::EVENT_NO_CACHE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -2462,9 +2462,13 @@ public:
|
||||
uchar type;
|
||||
|
||||
#ifdef MYSQL_SERVER
|
||||
Intvar_log_event(THD* thd_arg,uchar type_arg, ulonglong val_arg)
|
||||
:Log_event(thd_arg,0,0),val(val_arg),type(type_arg)
|
||||
{}
|
||||
Intvar_log_event(THD* thd_arg,uchar type_arg, ulonglong val_arg,
|
||||
bool using_trans, bool direct)
|
||||
:Log_event(thd_arg,0,using_trans),val(val_arg),type(type_arg)
|
||||
{
|
||||
if (direct)
|
||||
cache_type= Log_event::EVENT_NO_CACHE;
|
||||
}
|
||||
#ifdef HAVE_REPLICATION
|
||||
void pack_info(Protocol* protocol);
|
||||
#endif /* HAVE_REPLICATION */
|
||||
@ -2538,9 +2542,13 @@ class Rand_log_event: public Log_event
|
||||
ulonglong seed2;
|
||||
|
||||
#ifdef MYSQL_SERVER
|
||||
Rand_log_event(THD* thd_arg, ulonglong seed1_arg, ulonglong seed2_arg)
|
||||
:Log_event(thd_arg,0,0),seed1(seed1_arg),seed2(seed2_arg)
|
||||
{}
|
||||
Rand_log_event(THD* thd_arg, ulonglong seed1_arg, ulonglong seed2_arg,
|
||||
bool using_trans, bool direct)
|
||||
:Log_event(thd_arg,0,using_trans),seed1(seed1_arg),seed2(seed2_arg)
|
||||
{
|
||||
if (direct)
|
||||
cache_type= Log_event::EVENT_NO_CACHE;
|
||||
}
|
||||
#ifdef HAVE_REPLICATION
|
||||
void pack_info(Protocol* protocol);
|
||||
#endif /* HAVE_REPLICATION */
|
||||
@ -2641,11 +2649,17 @@ public:
|
||||
#ifdef MYSQL_SERVER
|
||||
User_var_log_event(THD* thd_arg, char *name_arg, uint name_len_arg,
|
||||
char *val_arg, ulong val_len_arg, Item_result type_arg,
|
||||
uint charset_number_arg, uchar flags_arg)
|
||||
:Log_event(), name(name_arg), name_len(name_len_arg), val(val_arg),
|
||||
uint charset_number_arg, uchar flags_arg,
|
||||
bool using_trans, bool direct)
|
||||
:Log_event(thd_arg, 0, using_trans),
|
||||
name(name_arg), name_len(name_len_arg), val(val_arg),
|
||||
val_len(val_len_arg), type(type_arg), charset_number(charset_number_arg),
|
||||
flags(flags_arg)
|
||||
{ is_null= !val; }
|
||||
{
|
||||
is_null= !val;
|
||||
if (direct)
|
||||
cache_type= Log_event::EVENT_NO_CACHE;
|
||||
}
|
||||
void pack_info(Protocol* protocol);
|
||||
#else
|
||||
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
|
||||
@ -3158,7 +3172,7 @@ class Annotate_rows_log_event: public Log_event
|
||||
{
|
||||
public:
|
||||
#ifndef MYSQL_CLIENT
|
||||
Annotate_rows_log_event(THD*, uint16 cache_type_arg);
|
||||
Annotate_rows_log_event(THD*, bool using_trans, bool direct);
|
||||
#endif
|
||||
Annotate_rows_log_event(const char *buf, uint event_len,
|
||||
const Format_description_log_event*);
|
||||
|
@ -4274,7 +4274,11 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
|
||||
HB (heartbeat) cannot come before RL (Relay)
|
||||
*/
|
||||
char llbuf[22];
|
||||
Heartbeat_log_event hb(buf, event_len, mi->rli.relay_log.description_event_for_queue);
|
||||
Heartbeat_log_event hb(buf,
|
||||
mi->rli.relay_log.relay_log_checksum_alg
|
||||
!= BINLOG_CHECKSUM_ALG_OFF ?
|
||||
event_len - BINLOG_CHECKSUM_LEN : event_len,
|
||||
mi->rli.relay_log.description_event_for_queue);
|
||||
if (!hb.is_valid())
|
||||
{
|
||||
error= ER_SLAVE_HEARTBEAT_FAILURE;
|
||||
|
@ -506,10 +506,13 @@ static ulonglong get_heartbeat_period(THD * thd)
|
||||
the dump thread.
|
||||
*/
|
||||
static int send_heartbeat_event(NET* net, String* packet,
|
||||
const struct event_coordinates *coord)
|
||||
const struct event_coordinates *coord,
|
||||
uint8 checksum_alg_arg)
|
||||
{
|
||||
DBUG_ENTER("send_heartbeat_event");
|
||||
char header[LOG_EVENT_HEADER_LEN];
|
||||
my_bool do_checksum= checksum_alg_arg != BINLOG_CHECKSUM_ALG_OFF &&
|
||||
checksum_alg_arg != BINLOG_CHECKSUM_ALG_UNDEF;
|
||||
/*
|
||||
'when' (the timestamp) is set to 0 so that slave could distinguish between
|
||||
real and fake Rotate events (if necessary)
|
||||
@ -521,7 +524,8 @@ static int send_heartbeat_event(NET* net, String* packet,
|
||||
char* p= coord->file_name + dirname_length(coord->file_name);
|
||||
|
||||
uint ident_len = strlen(p);
|
||||
ulong event_len = ident_len + LOG_EVENT_HEADER_LEN;
|
||||
ulong event_len = ident_len + LOG_EVENT_HEADER_LEN +
|
||||
(do_checksum ? BINLOG_CHECKSUM_LEN : 0);
|
||||
int4store(header + SERVER_ID_OFFSET, server_id);
|
||||
int4store(header + EVENT_LEN_OFFSET, event_len);
|
||||
int2store(header + FLAGS_OFFSET, 0);
|
||||
@ -531,6 +535,16 @@ static int send_heartbeat_event(NET* net, String* packet,
|
||||
packet->append(header, sizeof(header));
|
||||
packet->append(p, ident_len); // log_file_name
|
||||
|
||||
if (do_checksum)
|
||||
{
|
||||
char b[BINLOG_CHECKSUM_LEN];
|
||||
ha_checksum crc= my_checksum(0L, NULL, 0);
|
||||
crc= my_checksum(crc, (uchar*) header, sizeof(header));
|
||||
crc= my_checksum(crc, (uchar*) p, ident_len);
|
||||
int4store(b, crc);
|
||||
packet->append(b, sizeof(b));
|
||||
}
|
||||
|
||||
if (my_net_write(net, (uchar*) packet->ptr(), packet->length()) ||
|
||||
net_flush(net))
|
||||
{
|
||||
@ -1046,7 +1060,7 @@ impossible position";
|
||||
thd->exit_cond(old_msg);
|
||||
goto err;
|
||||
}
|
||||
if (send_heartbeat_event(net, packet, coord))
|
||||
if (send_heartbeat_event(net, packet, coord, current_checksum_alg))
|
||||
{
|
||||
errmsg = "Failed on my_net_write()";
|
||||
my_errno= ER_UNKNOWN_ERROR;
|
||||
|
Reference in New Issue
Block a user