mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Bug #34707: Row based replication: slave creates table within wrong database
The failure was caused by executing a CREATE-SELECT statement that creates a table in another database than the current one. In row-based logging, the CREATE statement was written to the binary log without the database, hence creating the table in the wrong database, causing the following inserts to fail since the table didn't exist in the given database. Fixed the bug by adding a parameter to store_create_info() that will make the function print the database name before the table name and used that in the calls that write the CREATE statement to the binary log. The database name is only printed if it is different than the currently selected database. The output of SHOW CREATE TABLE has not changed and is still printed without the database name.
This commit is contained in:
@ -996,6 +996,21 @@ enum enum_thread_type
|
||||
SYSTEM_THREAD_EVENT_WORKER= 32
|
||||
};
|
||||
|
||||
inline char const *
|
||||
show_system_thread(enum_thread_type thread)
|
||||
{
|
||||
#define RETURN_NAME_AS_STRING(NAME) case (NAME): return #NAME
|
||||
switch (thread) {
|
||||
RETURN_NAME_AS_STRING(NON_SYSTEM_THREAD);
|
||||
RETURN_NAME_AS_STRING(SYSTEM_THREAD_DELAYED_INSERT);
|
||||
RETURN_NAME_AS_STRING(SYSTEM_THREAD_SLAVE_IO);
|
||||
RETURN_NAME_AS_STRING(SYSTEM_THREAD_SLAVE_SQL);
|
||||
RETURN_NAME_AS_STRING(SYSTEM_THREAD_NDBCLUSTER_BINLOG);
|
||||
RETURN_NAME_AS_STRING(SYSTEM_THREAD_EVENT_SCHEDULER);
|
||||
RETURN_NAME_AS_STRING(SYSTEM_THREAD_EVENT_WORKER);
|
||||
}
|
||||
#undef RETURN_NAME_AS_STRING
|
||||
}
|
||||
|
||||
/**
|
||||
This class represents the interface for internal error handlers.
|
||||
@ -2084,6 +2099,10 @@ public:
|
||||
|
||||
Don't reset binlog format for NDB binlog injector thread.
|
||||
*/
|
||||
DBUG_PRINT("debug",
|
||||
("temporary_tables: %d, in_sub_stmt: %d, system_thread: %s",
|
||||
(int) temporary_tables, in_sub_stmt,
|
||||
show_system_thread(system_thread)));
|
||||
if ((temporary_tables == NULL) && (in_sub_stmt == 0) &&
|
||||
(system_thread != SYSTEM_THREAD_NDBCLUSTER_BINLOG))
|
||||
{
|
||||
|
Reference in New Issue
Block a user