mirror of
https://github.com/MariaDB/server.git
synced 2025-07-18 23:03:28 +03:00
MDEV-25595 DROP part of failed CREATE OR REPLACE is not written into binary log
Do log_drop_table() in case of failed mysql_prepare_create_table().
This commit is contained in:
@ -408,4 +408,22 @@ SHOW SESSION VARIABLES LIKE "unique_checks";
|
|||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
disconnect fresh;
|
disconnect fresh;
|
||||||
|
connection default;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-25595 DROP part of failed CREATE OR REPLACE is not written into binary log
|
||||||
|
--echo #
|
||||||
|
reset master;
|
||||||
|
--error ER_DUP_FIELDNAME
|
||||||
|
create table t as select 1 as b, 2 as b;
|
||||||
|
create table t (old_table_field int);
|
||||||
|
--error ER_DUP_FIELDNAME
|
||||||
|
create or replace table t as select 1 as b, 2 as b;
|
||||||
|
--error ER_DUP_FIELDNAME
|
||||||
|
create or replace temporary table t as select 1 as b, 2 as b;
|
||||||
|
create table t (new_table_field int);
|
||||||
|
|
||||||
|
--source include/show_binlog_events.inc
|
||||||
|
|
||||||
|
# cleanup
|
||||||
|
drop table t;
|
||||||
|
@ -1073,3 +1073,26 @@ Variable_name Value
|
|||||||
unique_checks OFF
|
unique_checks OFF
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
disconnect fresh;
|
disconnect fresh;
|
||||||
|
connection default;
|
||||||
|
#
|
||||||
|
# MDEV-25595 DROP part of failed CREATE OR REPLACE is not written into binary log
|
||||||
|
#
|
||||||
|
reset master;
|
||||||
|
create table t as select 1 as b, 2 as b;
|
||||||
|
ERROR 42S21: Duplicate column name 'b'
|
||||||
|
create table t (old_table_field int);
|
||||||
|
create or replace table t as select 1 as b, 2 as b;
|
||||||
|
ERROR 42S21: Duplicate column name 'b'
|
||||||
|
create or replace temporary table t as select 1 as b, 2 as b;
|
||||||
|
ERROR 42S21: Duplicate column name 'b'
|
||||||
|
create table t (new_table_field int);
|
||||||
|
include/show_binlog_events.inc
|
||||||
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
|
master-bin.000001 # Gtid # # GTID #-#-#
|
||||||
|
master-bin.000001 # Query # # use `test`; create table t (old_table_field int)
|
||||||
|
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
|
||||||
|
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `test`.`t`/* Generated to handle failed CREATE OR REPLACE */
|
||||||
|
master-bin.000001 # Query # # ROLLBACK
|
||||||
|
master-bin.000001 # Gtid # # GTID #-#-#
|
||||||
|
master-bin.000001 # Query # # use `test`; create table t (new_table_field int)
|
||||||
|
drop table t;
|
||||||
|
@ -673,3 +673,27 @@ Variable_name Value
|
|||||||
unique_checks OFF
|
unique_checks OFF
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
disconnect fresh;
|
disconnect fresh;
|
||||||
|
connection default;
|
||||||
|
#
|
||||||
|
# MDEV-25595 DROP part of failed CREATE OR REPLACE is not written into binary log
|
||||||
|
#
|
||||||
|
reset master;
|
||||||
|
create table t as select 1 as b, 2 as b;
|
||||||
|
ERROR 42S21: Duplicate column name 'b'
|
||||||
|
create table t (old_table_field int);
|
||||||
|
create or replace table t as select 1 as b, 2 as b;
|
||||||
|
ERROR 42S21: Duplicate column name 'b'
|
||||||
|
create or replace temporary table t as select 1 as b, 2 as b;
|
||||||
|
ERROR 42S21: Duplicate column name 'b'
|
||||||
|
create table t (new_table_field int);
|
||||||
|
include/show_binlog_events.inc
|
||||||
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
|
master-bin.000001 # Gtid # # GTID #-#-#
|
||||||
|
master-bin.000001 # Query # # use `test`; create table t (old_table_field int)
|
||||||
|
master-bin.000001 # Gtid # # GTID #-#-#
|
||||||
|
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `test`.`t`/* Generated to handle failed CREATE OR REPLACE */
|
||||||
|
master-bin.000001 # Gtid # # GTID #-#-#
|
||||||
|
master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`t`/* Generated to handle failed CREATE OR REPLACE */
|
||||||
|
master-bin.000001 # Gtid # # GTID #-#-#
|
||||||
|
master-bin.000001 # Query # # use `test`; create table t (new_table_field int)
|
||||||
|
drop table t;
|
||||||
|
@ -100,6 +100,9 @@ include/show_binlog_events.inc
|
|||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 # Gtid # # GTID #-#-#
|
master-bin.000001 # Gtid # # GTID #-#-#
|
||||||
master-bin.000001 # Query # # use `test`; create table t1 (a int)
|
master-bin.000001 # Query # # use `test`; create table t1 (a int)
|
||||||
|
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
|
||||||
|
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `test`.`t1`/* Generated to handle failed CREATE OR REPLACE */
|
||||||
|
master-bin.000001 # Query # # ROLLBACK
|
||||||
drop table if exists t1,t2;
|
drop table if exists t1,t2;
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1051 Unknown table 'test.t1'
|
Note 1051 Unknown table 'test.t1'
|
||||||
|
@ -128,6 +128,9 @@ include/show_binlog_events.inc
|
|||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 # Gtid # # GTID #-#-#
|
master-bin.000001 # Gtid # # GTID #-#-#
|
||||||
master-bin.000001 # Query # # use `test`; create table t1 (a int)
|
master-bin.000001 # Query # # use `test`; create table t1 (a int)
|
||||||
|
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
|
||||||
|
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `test`.`t1`/* Generated to handle failed CREATE OR REPLACE */
|
||||||
|
master-bin.000001 # Query # # ROLLBACK
|
||||||
drop table if exists t1,t2;
|
drop table if exists t1,t2;
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1051 Unknown table 'test.t1'
|
Note 1051 Unknown table 'test.t1'
|
||||||
|
@ -103,6 +103,8 @@ include/show_binlog_events.inc
|
|||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 # Gtid # # GTID #-#-#
|
master-bin.000001 # Gtid # # GTID #-#-#
|
||||||
master-bin.000001 # Query # # use `test`; create table t1 (a int)
|
master-bin.000001 # Query # # use `test`; create table t1 (a int)
|
||||||
|
master-bin.000001 # Gtid # # GTID #-#-#
|
||||||
|
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `test`.`t1`/* Generated to handle failed CREATE OR REPLACE */
|
||||||
drop table if exists t1,t2;
|
drop table if exists t1,t2;
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1051 Unknown table 'test.t1'
|
Note 1051 Unknown table 'test.t1'
|
||||||
|
@ -4386,8 +4386,18 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
|
|||||||
create_table,
|
create_table,
|
||||||
alter_info, &values,
|
alter_info, &values,
|
||||||
&extra_lock, hook_ptr)))
|
&extra_lock, hook_ptr)))
|
||||||
|
{
|
||||||
|
if (create_info->or_replace())
|
||||||
|
{
|
||||||
|
/* Original table was deleted. We have to log it */
|
||||||
|
log_drop_table(thd, create_table->db, create_table->db_length,
|
||||||
|
create_table->table_name, create_table->table_name_length,
|
||||||
|
thd->lex->tmp_table());
|
||||||
|
}
|
||||||
|
|
||||||
/* abort() deletes table */
|
/* abort() deletes table */
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
|
}
|
||||||
|
|
||||||
if (create_info->tmp_table())
|
if (create_info->tmp_table())
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user