Commit 56d485e2 authored by unknown's avatar unknown

Merge 10.0-base -> 10.0

parents 2d335474 59830e1a
......@@ -14,8 +14,8 @@ if ($rpl_inited)
--exec echo "wait" > $_expect_file_name
# Send shutdown to the connected server and give
# it 10 seconds to die before zapping it
shutdown_server 10;
# it 60 seconds to die before zapping it
shutdown_server 60;
# Write file to make mysql-test-run.pl start up the server again
--exec echo "restart" > $_expect_file_name
......
......@@ -44,8 +44,7 @@ connection con1;
--error 2006,2013
reap;
--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart-binlog_mdev342.test
EOF
......
......@@ -117,8 +117,7 @@ connection con4;
--error 2006,2013
reap;
--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart-group_commit_binlog_pos.test
EOF
......@@ -212,8 +211,7 @@ SET SESSION debug_dbug="+d,crash_commit_after_log";
--error 2006,2013
INSERT INTO t1 VALUES (14, NULL);
--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart-group_commit_binlog_pos.test
EOF
......@@ -257,8 +255,7 @@ SET SESSION debug_dbug="+d,crash_before_write_checkpoint_event";
--error 2006,2013
INSERT INTO t1 VALUES (24, REPEAT("x", 4100));
--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart-group_commit_binlog_pos.test
EOF
......
......@@ -24,7 +24,7 @@ alter table t1 add constraint c1 foreign key (f1) references t1(f1);
perl;
$file = $ENV{error_log};
open (FILE, '<', $file) or die "can't open(< $file): $!\n";
print ((grep { /^InnoDB:/ and not /aio/i } <FILE>)[-2..-1]);
print ((grep { /^InnoDB:/ and not /aio/i and not /io_setup\(\) attempt [0-9]+ failed/ } <FILE>)[-2..-1]);
EOF
drop table t1;
......@@ -53,8 +53,7 @@ SET SESSION debug_dbug="+d,crash_dispatch_command_before";
SELECT 1;
--source include/wait_until_disconnected.inc
--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart-rpl_gtid_crash.test
EOF
......@@ -113,8 +112,7 @@ SET SESSION debug_dbug="+d,crash_dispatch_command_before";
SELECT 1;
--source include/wait_until_disconnected.inc
--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart
EOF
......@@ -148,8 +146,7 @@ INSERT INTO t1 VALUES (4);
--connection server_2
--source include/wait_until_disconnected.inc
--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
restart: --skip-slave-start=0
EOF
......@@ -173,8 +170,7 @@ INSERT INTO t1 VALUES (5);
--connection server_2
--source include/wait_until_disconnected.inc
--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
restart: --skip-slave-start=0
EOF
......@@ -198,8 +194,7 @@ INSERT INTO t1 VALUES (6);
--connection server_2
--source include/wait_until_disconnected.inc
--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
restart: --skip-slave-start=0
EOF
......@@ -223,8 +218,7 @@ INSERT INTO t1 VALUES (7);
--connection server_2
--source include/wait_until_disconnected.inc
--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
restart: --skip-slave-start=0
EOF
......@@ -248,8 +242,7 @@ INSERT INTO t1 VALUES (8);
--connection server_2
--source include/wait_until_disconnected.inc
--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
restart: --skip-slave-start=0
EOF
......
......@@ -41,8 +41,7 @@ INSERT INTO t1 VALUES (3);
--source include/show_binary_logs.inc
# Let the slave mysqld server start again.
--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
restart: --skip-slave-start=0
EOF
......@@ -72,8 +71,7 @@ EOF
--shutdown_server 30
--source include/wait_until_disconnected.inc
--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart
EOF
......
......@@ -210,8 +210,7 @@ EOF
--shutdown_server 30
--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart-rpl_mdev382.test
EOF
......
......@@ -53,8 +53,7 @@ EOF
--replace_result $datadir <DATADIR>
--copy_file $datadir/test/t1.ibd $datadir/test/t1.ibd.save
--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart
EOF
......
......@@ -4236,8 +4236,19 @@ Query_log_event::do_shall_skip(Relay_log_info *rli)
bool
Query_log_event::peek_is_commit_rollback(const char *event_start,
size_t event_len)
size_t event_len, uint8 checksum_alg)
{
if (checksum_alg == BINLOG_CHECKSUM_ALG_CRC32)
{
if (event_len > BINLOG_CHECKSUM_LEN)
event_len-= BINLOG_CHECKSUM_LEN;
else
event_len= 0;
}
else
DBUG_ASSERT(checksum_alg == BINLOG_CHECKSUM_ALG_UNDEF ||
checksum_alg == BINLOG_CHECKSUM_ALG_OFF);
if (event_len < LOG_EVENT_HEADER_LEN + QUERY_HEADER_LEN || event_len < 9)
return false;
return !memcmp(event_start + (event_len-7), "\0COMMIT", 7) ||
......@@ -6050,10 +6061,23 @@ Gtid_log_event::Gtid_log_event(THD *thd_arg, uint64 seq_no_arg,
*/
bool
Gtid_log_event::peek(const char *event_start, size_t event_len,
uint8 checksum_alg,
uint32 *domain_id, uint32 *server_id, uint64 *seq_no,
uchar *flags2)
{
const char *p;
if (checksum_alg == BINLOG_CHECKSUM_ALG_CRC32)
{
if (event_len > BINLOG_CHECKSUM_LEN)
event_len-= BINLOG_CHECKSUM_LEN;
else
event_len= 0;
}
else
DBUG_ASSERT(checksum_alg == BINLOG_CHECKSUM_ALG_UNDEF ||
checksum_alg == BINLOG_CHECKSUM_ALG_OFF);
if (event_len < LOG_EVENT_HEADER_LEN + GTID_HEADER_LEN)
return true;
*server_id= uint4korr(event_start + SERVER_ID_OFFSET);
......@@ -6100,7 +6124,7 @@ Gtid_log_event::make_compatible_event(String *packet, bool *need_dummy_event,
flags2= (*packet)[ev_offset + LOG_EVENT_HEADER_LEN + 12];
if (flags2 & FL_STANDALONE)
{
if (need_dummy_event)
if (*need_dummy_event)
return Query_log_event::dummy_event(packet, ev_offset, checksum_alg);
else
return 0;
......
......@@ -1946,7 +1946,7 @@ public: /* !!! Public in this patch to allow old usage */
const char *query_arg,
uint32 q_len_arg);
static bool peek_is_commit_rollback(const char *event_start,
size_t event_len);
size_t event_len, uint8 checksum_alg);
#endif /* HAVE_REPLICATION */
/*
If true, the event always be applied by slave SQL thread or be printed by
......@@ -3084,6 +3084,7 @@ public:
static int make_compatible_event(String *packet, bool *need_dummy_event,
ulong ev_offset, uint8 checksum_alg);
static bool peek(const char *event_start, size_t event_len,
uint8 checksum_alg,
uint32 *domain_id, uint32 *server_id, uint64 *seq_no,
uchar *flags2);
#endif
......
......@@ -1595,8 +1595,21 @@ static void close_connections(void)
Events::deinit();
end_slave();
/* Give threads time to die. */
for (int i= 0; *(volatile int32*) &thread_count && i < 100; i++)
/*
Give threads time to die.
In 5.5, this was waiting 100 rounds @ 20 milliseconds/round, so as little
as 2 seconds, depending on thread scheduling.
From 10.0, we increase this to 1000 rounds / 20 seconds. The rationale is
that on a server with heavy I/O load, it is quite possible for eg. an
fsync() of the binlog or whatever to cause something like LOCK_log to be
held for more than 2 seconds. We do not want to force kill threads in
such cases, if it can be avoided. Note that normally, the wait will be
much smaller than even 2 seconds, this is only a safety fallback against
stuck threads so server shutdown is not held up forever.
*/
for (int i= 0; *(volatile int32*) &thread_count && i < 1000; i++)
my_sleep(20000);
/*
......
......@@ -1160,7 +1160,8 @@ gtid_state_from_pos(const char *name, uint32 offset,
{
rpl_gtid gtid;
uchar flags2;
if (Gtid_log_event::peek(packet.ptr(), packet.length(), &gtid.domain_id,
if (Gtid_log_event::peek(packet.ptr(), packet.length(),
current_checksum_alg, &gtid.domain_id,
&gtid.server_id, &gtid.seq_no, &flags2))
{
errormsg= "Corrupt gtid_log_event found while scanning binlog to find "
......@@ -1253,6 +1254,7 @@ send_event_to_slave(THD *thd, NET *net, String* const packet, ushort flags,
if (ev_offset > len ||
Gtid_log_event::peek(packet->ptr()+ev_offset, len - ev_offset,
current_checksum_alg,
&domain_id, &server_id, &seq_no, &flags2))
return "Failed to read Gtid_log_event: corrupt binlog";
gtid= gtid_state->find(domain_id);
......@@ -1287,7 +1289,8 @@ send_event_to_slave(THD *thd, NET *net, String* const packet, ushort flags,
if (event_type == XID_EVENT ||
(event_type == QUERY_EVENT &&
Query_log_event::peek_is_commit_rollback(packet->ptr() + ev_offset,
len - ev_offset)))
len - ev_offset,
current_checksum_alg)))
*gtid_skip_group= GTID_SKIP_NOT;
return NULL;
case GTID_SKIP_NOT:
......@@ -1727,13 +1730,15 @@ impossible position";
while (!net->error && net->vio != 0 && !thd->killed)
{
Log_event_type event_type= UNKNOWN_EVENT;
killed_state killed;
/* reset the transmit packet for the event read from binary log
file */
if (reset_transmit_packet(thd, flags, &ev_offset, &errmsg))
goto err;
while (!(error = Log_event::read_log_event(&log, packet, log_lock,
while (!(killed= thd->killed) &&
!(error = Log_event::read_log_event(&log, packet, log_lock,
current_checksum_alg)))
{
#ifndef DBUG_OFF
......@@ -1818,6 +1823,8 @@ impossible position";
if (reset_transmit_packet(thd, flags, &ev_offset, &errmsg))
goto err;
}
if (killed)
goto end;
/*
TODO: now that we are logging the offset, check to make sure
......
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