Commit 56d485e2 authored by unknown's avatar unknown

Merge 10.0-base -> 10.0

parents 2d335474 59830e1a
...@@ -14,8 +14,8 @@ if ($rpl_inited) ...@@ -14,8 +14,8 @@ if ($rpl_inited)
--exec echo "wait" > $_expect_file_name --exec echo "wait" > $_expect_file_name
# Send shutdown to the connected server and give # Send shutdown to the connected server and give
# it 10 seconds to die before zapping it # it 60 seconds to die before zapping it
shutdown_server 10; shutdown_server 60;
# Write file to make mysql-test-run.pl start up the server again # Write file to make mysql-test-run.pl start up the server again
--exec echo "restart" > $_expect_file_name --exec echo "restart" > $_expect_file_name
......
...@@ -44,8 +44,7 @@ connection con1; ...@@ -44,8 +44,7 @@ connection con1;
--error 2006,2013 --error 2006,2013
reap; reap;
--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart-binlog_mdev342.test restart-binlog_mdev342.test
EOF EOF
......
...@@ -117,8 +117,7 @@ connection con4; ...@@ -117,8 +117,7 @@ connection con4;
--error 2006,2013 --error 2006,2013
reap; reap;
--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart-group_commit_binlog_pos.test restart-group_commit_binlog_pos.test
EOF EOF
...@@ -212,8 +211,7 @@ SET SESSION debug_dbug="+d,crash_commit_after_log"; ...@@ -212,8 +211,7 @@ SET SESSION debug_dbug="+d,crash_commit_after_log";
--error 2006,2013 --error 2006,2013
INSERT INTO t1 VALUES (14, NULL); INSERT INTO t1 VALUES (14, NULL);
--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart-group_commit_binlog_pos.test restart-group_commit_binlog_pos.test
EOF EOF
...@@ -257,8 +255,7 @@ SET SESSION debug_dbug="+d,crash_before_write_checkpoint_event"; ...@@ -257,8 +255,7 @@ SET SESSION debug_dbug="+d,crash_before_write_checkpoint_event";
--error 2006,2013 --error 2006,2013
INSERT INTO t1 VALUES (24, REPEAT("x", 4100)); INSERT INTO t1 VALUES (24, REPEAT("x", 4100));
--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart-group_commit_binlog_pos.test restart-group_commit_binlog_pos.test
EOF EOF
......
...@@ -24,7 +24,7 @@ alter table t1 add constraint c1 foreign key (f1) references t1(f1); ...@@ -24,7 +24,7 @@ alter table t1 add constraint c1 foreign key (f1) references t1(f1);
perl; perl;
$file = $ENV{error_log}; $file = $ENV{error_log};
open (FILE, '<', $file) or die "can't open(< $file): $!\n"; 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 EOF
drop table t1; drop table t1;
...@@ -53,8 +53,7 @@ SET SESSION debug_dbug="+d,crash_dispatch_command_before"; ...@@ -53,8 +53,7 @@ SET SESSION debug_dbug="+d,crash_dispatch_command_before";
SELECT 1; SELECT 1;
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc
--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart-rpl_gtid_crash.test restart-rpl_gtid_crash.test
EOF EOF
...@@ -113,8 +112,7 @@ SET SESSION debug_dbug="+d,crash_dispatch_command_before"; ...@@ -113,8 +112,7 @@ SET SESSION debug_dbug="+d,crash_dispatch_command_before";
SELECT 1; SELECT 1;
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc
--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart restart
EOF EOF
...@@ -148,8 +146,7 @@ INSERT INTO t1 VALUES (4); ...@@ -148,8 +146,7 @@ INSERT INTO t1 VALUES (4);
--connection server_2 --connection server_2
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc
--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect --append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
restart: --skip-slave-start=0 restart: --skip-slave-start=0
EOF EOF
...@@ -173,8 +170,7 @@ INSERT INTO t1 VALUES (5); ...@@ -173,8 +170,7 @@ INSERT INTO t1 VALUES (5);
--connection server_2 --connection server_2
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc
--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect --append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
restart: --skip-slave-start=0 restart: --skip-slave-start=0
EOF EOF
...@@ -198,8 +194,7 @@ INSERT INTO t1 VALUES (6); ...@@ -198,8 +194,7 @@ INSERT INTO t1 VALUES (6);
--connection server_2 --connection server_2
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc
--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect --append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
restart: --skip-slave-start=0 restart: --skip-slave-start=0
EOF EOF
...@@ -223,8 +218,7 @@ INSERT INTO t1 VALUES (7); ...@@ -223,8 +218,7 @@ INSERT INTO t1 VALUES (7);
--connection server_2 --connection server_2
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc
--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect --append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
restart: --skip-slave-start=0 restart: --skip-slave-start=0
EOF EOF
...@@ -248,8 +242,7 @@ INSERT INTO t1 VALUES (8); ...@@ -248,8 +242,7 @@ INSERT INTO t1 VALUES (8);
--connection server_2 --connection server_2
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc
--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect --append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
restart: --skip-slave-start=0 restart: --skip-slave-start=0
EOF EOF
......
...@@ -41,8 +41,7 @@ INSERT INTO t1 VALUES (3); ...@@ -41,8 +41,7 @@ INSERT INTO t1 VALUES (3);
--source include/show_binary_logs.inc --source include/show_binary_logs.inc
# Let the slave mysqld server start again. # Let the slave mysqld server start again.
--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect --append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
restart: --skip-slave-start=0 restart: --skip-slave-start=0
EOF EOF
...@@ -72,8 +71,7 @@ EOF ...@@ -72,8 +71,7 @@ EOF
--shutdown_server 30 --shutdown_server 30
--source include/wait_until_disconnected.inc --source include/wait_until_disconnected.inc
--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart restart
EOF EOF
......
...@@ -210,8 +210,7 @@ EOF ...@@ -210,8 +210,7 @@ EOF
--shutdown_server 30 --shutdown_server 30
--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart-rpl_mdev382.test restart-rpl_mdev382.test
EOF EOF
......
...@@ -53,8 +53,7 @@ EOF ...@@ -53,8 +53,7 @@ EOF
--replace_result $datadir <DATADIR> --replace_result $datadir <DATADIR>
--copy_file $datadir/test/t1.ibd $datadir/test/t1.ibd.save --copy_file $datadir/test/t1.ibd $datadir/test/t1.ibd.save
--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart restart
EOF EOF
......
...@@ -4236,8 +4236,19 @@ Query_log_event::do_shall_skip(Relay_log_info *rli) ...@@ -4236,8 +4236,19 @@ Query_log_event::do_shall_skip(Relay_log_info *rli)
bool bool
Query_log_event::peek_is_commit_rollback(const char *event_start, 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) if (event_len < LOG_EVENT_HEADER_LEN + QUERY_HEADER_LEN || event_len < 9)
return false; return false;
return !memcmp(event_start + (event_len-7), "\0COMMIT", 7) || 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, ...@@ -6050,10 +6061,23 @@ Gtid_log_event::Gtid_log_event(THD *thd_arg, uint64 seq_no_arg,
*/ */
bool bool
Gtid_log_event::peek(const char *event_start, size_t event_len, Gtid_log_event::peek(const char *event_start, size_t event_len,
uint8 checksum_alg,
uint32 *domain_id, uint32 *server_id, uint64 *seq_no, uint32 *domain_id, uint32 *server_id, uint64 *seq_no,
uchar *flags2) uchar *flags2)
{ {
const char *p; 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) if (event_len < LOG_EVENT_HEADER_LEN + GTID_HEADER_LEN)
return true; return true;
*server_id= uint4korr(event_start + SERVER_ID_OFFSET); *server_id= uint4korr(event_start + SERVER_ID_OFFSET);
...@@ -6100,7 +6124,7 @@ Gtid_log_event::make_compatible_event(String *packet, bool *need_dummy_event, ...@@ -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]; flags2= (*packet)[ev_offset + LOG_EVENT_HEADER_LEN + 12];
if (flags2 & FL_STANDALONE) if (flags2 & FL_STANDALONE)
{ {
if (need_dummy_event) if (*need_dummy_event)
return Query_log_event::dummy_event(packet, ev_offset, checksum_alg); return Query_log_event::dummy_event(packet, ev_offset, checksum_alg);
else else
return 0; return 0;
......
...@@ -1946,7 +1946,7 @@ public: /* !!! Public in this patch to allow old usage */ ...@@ -1946,7 +1946,7 @@ public: /* !!! Public in this patch to allow old usage */
const char *query_arg, const char *query_arg,
uint32 q_len_arg); uint32 q_len_arg);
static bool peek_is_commit_rollback(const char *event_start, static bool peek_is_commit_rollback(const char *event_start,
size_t event_len); size_t event_len, uint8 checksum_alg);
#endif /* HAVE_REPLICATION */ #endif /* HAVE_REPLICATION */
/* /*
If true, the event always be applied by slave SQL thread or be printed by If true, the event always be applied by slave SQL thread or be printed by
...@@ -3084,6 +3084,7 @@ public: ...@@ -3084,6 +3084,7 @@ public:
static int make_compatible_event(String *packet, bool *need_dummy_event, static int make_compatible_event(String *packet, bool *need_dummy_event,
ulong ev_offset, uint8 checksum_alg); ulong ev_offset, uint8 checksum_alg);
static bool peek(const char *event_start, size_t event_len, static bool peek(const char *event_start, size_t event_len,
uint8 checksum_alg,
uint32 *domain_id, uint32 *server_id, uint64 *seq_no, uint32 *domain_id, uint32 *server_id, uint64 *seq_no,
uchar *flags2); uchar *flags2);
#endif #endif
......
...@@ -1595,8 +1595,21 @@ static void close_connections(void) ...@@ -1595,8 +1595,21 @@ static void close_connections(void)
Events::deinit(); Events::deinit();
end_slave(); 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); my_sleep(20000);
/* /*
......
...@@ -1160,7 +1160,8 @@ gtid_state_from_pos(const char *name, uint32 offset, ...@@ -1160,7 +1160,8 @@ gtid_state_from_pos(const char *name, uint32 offset,
{ {
rpl_gtid gtid; rpl_gtid gtid;
uchar flags2; 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)) &gtid.server_id, &gtid.seq_no, &flags2))
{ {
errormsg= "Corrupt gtid_log_event found while scanning binlog to find " 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, ...@@ -1253,6 +1254,7 @@ send_event_to_slave(THD *thd, NET *net, String* const packet, ushort flags,
if (ev_offset > len || if (ev_offset > len ||
Gtid_log_event::peek(packet->ptr()+ev_offset, len - ev_offset, Gtid_log_event::peek(packet->ptr()+ev_offset, len - ev_offset,
current_checksum_alg,
&domain_id, &server_id, &seq_no, &flags2)) &domain_id, &server_id, &seq_no, &flags2))
return "Failed to read Gtid_log_event: corrupt binlog"; return "Failed to read Gtid_log_event: corrupt binlog";
gtid= gtid_state->find(domain_id); gtid= gtid_state->find(domain_id);
...@@ -1287,7 +1289,8 @@ send_event_to_slave(THD *thd, NET *net, String* const packet, ushort flags, ...@@ -1287,7 +1289,8 @@ send_event_to_slave(THD *thd, NET *net, String* const packet, ushort flags,
if (event_type == XID_EVENT || if (event_type == XID_EVENT ||
(event_type == QUERY_EVENT && (event_type == QUERY_EVENT &&
Query_log_event::peek_is_commit_rollback(packet->ptr() + ev_offset, 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; *gtid_skip_group= GTID_SKIP_NOT;
return NULL; return NULL;
case GTID_SKIP_NOT: case GTID_SKIP_NOT:
...@@ -1727,13 +1730,15 @@ impossible position"; ...@@ -1727,13 +1730,15 @@ impossible position";
while (!net->error && net->vio != 0 && !thd->killed) while (!net->error && net->vio != 0 && !thd->killed)
{ {
Log_event_type event_type= UNKNOWN_EVENT; Log_event_type event_type= UNKNOWN_EVENT;
killed_state killed;
/* reset the transmit packet for the event read from binary log /* reset the transmit packet for the event read from binary log
file */ file */
if (reset_transmit_packet(thd, flags, &ev_offset, &errmsg)) if (reset_transmit_packet(thd, flags, &ev_offset, &errmsg))
goto err; 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))) current_checksum_alg)))
{ {
#ifndef DBUG_OFF #ifndef DBUG_OFF
...@@ -1818,6 +1823,8 @@ impossible position"; ...@@ -1818,6 +1823,8 @@ impossible position";
if (reset_transmit_packet(thd, flags, &ev_offset, &errmsg)) if (reset_transmit_packet(thd, flags, &ev_offset, &errmsg))
goto err; goto err;
} }
if (killed)
goto end;
/* /*
TODO: now that we are logging the offset, check to make sure 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