1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

Bug#56118 STOP SLAVE does not wait till trx with CREATE TMP TABLE ends,

replication aborts

When recieving a 'SLAVE STOP' command, slave SQL thread will roll back the
transaction and stop immidiately if there is only transactional table updated,
even through 'CREATE|DROP TEMPOARY TABLE' statement are in it. But These
statements can never be rolled back. Because the temporary tables to the user
session mapping remain until 'RESET SLAVE', Therefore it will abort SQL thread
with an error that the table already exists or doesn't exist, when it restarts
and executes the whole transaction again.

After this patch, SQL thread always waits till the transaction ends and then stops,
if 'CREATE|DROP TEMPOARY TABLE' statement are in it.

mysql-test/extra/rpl_tests/rpl_stop_slave.test:
  Auxiliary file which is used to test this bug.
mysql-test/suite/rpl/t/rpl_stop_slave.test:
  Test case for this bug.
sql/slave.cc:
  Checking if OPTION_KEEP_LOG is set. If it is set, SQL thread should wait
  until the transaction ends.
sql/sql_parse.cc:
  Add a debug point for testing this bug.
This commit is contained in:
unknown
2010-10-16 20:03:44 +08:00
parent 54c308d37d
commit 211552ccee
5 changed files with 268 additions and 1 deletions

View File

@@ -27,6 +27,7 @@
#include "sp_cache.h"
#include "events.h"
#include "sql_trigger.h"
#include "debug_sync.h"
/**
@defgroup Runtime_Environment Runtime Environment
@@ -3258,6 +3259,15 @@ end_with_restore_list:
thd->first_successful_insert_id_in_cur_stmt=
thd->first_successful_insert_id_in_prev_stmt;
DBUG_EXECUTE_IF("after_mysql_insert",
{
const char act[]=
"now "
"wait_for signal.continue";
DBUG_ASSERT(opt_debug_sync_timeout > 0);
DBUG_ASSERT(!debug_sync_set_action(current_thd,
STRING_WITH_LEN(act)));
};);
break;
}
case SQLCOM_REPLACE_SELECT: