Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
2d62bacf
Commit
2d62bacf
authored
Aug 27, 2008
by
Mats Kindahl
Browse files
Options
Browse Files
Download
Plain Diff
Merge b38773-5.1-rpl-merge into 5.1-rpl-merge
parents
099a80d0
02034091
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
88 additions
and
7 deletions
+88
-7
mysql-test/extra/binlog_tests/database.test
mysql-test/extra/binlog_tests/database.test
+15
-0
mysql-test/suite/binlog/r/binlog_database.result
mysql-test/suite/binlog/r/binlog_database.result
+53
-0
sql/sql_db.cc
sql/sql_db.cc
+20
-7
No files found.
mysql-test/extra/binlog_tests/database.test
View file @
2d62bacf
...
@@ -13,3 +13,18 @@ create trigger tr1 before insert on t1 for each row insert into t2 values (2*new
...
@@ -13,3 +13,18 @@ create trigger tr1 before insert on t1 for each row insert into t2 values (2*new
create
procedure
sp1
(
a
int
)
insert
into
t1
values
(
a
);
create
procedure
sp1
(
a
int
)
insert
into
t1
values
(
a
);
drop
database
testing_1
;
drop
database
testing_1
;
source
include
/
show_binlog_events
.
inc
;
source
include
/
show_binlog_events
.
inc
;
# BUG#38773: DROP DATABASE cause switch to stmt-mode when there are
# temporary tables open
use
test
;
reset
master
;
create
temporary
table
tt1
(
a
int
);
create
table
t1
(
a
int
);
insert
into
t1
values
(
1
);
disable_warnings
;
drop
database
if
exists
mysqltest1
;
enable_warnings
;
insert
into
t1
values
(
1
);
drop
table
tt1
,
t1
;
source
include
/
show_binlog_events
.
inc
;
mysql-test/suite/binlog/r/binlog_database.result
View file @
2d62bacf
...
@@ -17,6 +17,22 @@ master-bin.000001 # Query # # use `testing_1`; CREATE DEFINER=`root`@`localhost`
...
@@ -17,6 +17,22 @@ master-bin.000001 # Query # # use `testing_1`; CREATE DEFINER=`root`@`localhost`
master-bin.000001 # Query # # use `testing_1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `sp1`(a int)
master-bin.000001 # Query # # use `testing_1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `sp1`(a int)
insert into t1 values(a)
insert into t1 values(a)
master-bin.000001 # Query # # drop database testing_1
master-bin.000001 # Query # # drop database testing_1
use test;
reset master;
create temporary table tt1 (a int);
create table t1 (a int);
insert into t1 values (1);
drop database if exists mysqltest1;
insert into t1 values (1);
drop table tt1, t1;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; create temporary table tt1 (a int)
master-bin.000001 # Query # # use `test`; create table t1 (a int)
master-bin.000001 # Query # # use `test`; insert into t1 values (1)
master-bin.000001 # Query # # drop database if exists mysqltest1
master-bin.000001 # Query # # use `test`; insert into t1 values (1)
master-bin.000001 # Query # # use `test`; drop table tt1, t1
set binlog_format=mixed;
set binlog_format=mixed;
reset master;
reset master;
create database testing_1;
create database testing_1;
...
@@ -36,6 +52,22 @@ master-bin.000001 # Query # # use `testing_1`; CREATE DEFINER=`root`@`localhost`
...
@@ -36,6 +52,22 @@ master-bin.000001 # Query # # use `testing_1`; CREATE DEFINER=`root`@`localhost`
master-bin.000001 # Query # # use `testing_1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `sp1`(a int)
master-bin.000001 # Query # # use `testing_1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `sp1`(a int)
insert into t1 values(a)
insert into t1 values(a)
master-bin.000001 # Query # # drop database testing_1
master-bin.000001 # Query # # drop database testing_1
use test;
reset master;
create temporary table tt1 (a int);
create table t1 (a int);
insert into t1 values (1);
drop database if exists mysqltest1;
insert into t1 values (1);
drop table tt1, t1;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; create temporary table tt1 (a int)
master-bin.000001 # Query # # use `test`; create table t1 (a int)
master-bin.000001 # Query # # use `test`; insert into t1 values (1)
master-bin.000001 # Query # # drop database if exists mysqltest1
master-bin.000001 # Query # # use `test`; insert into t1 values (1)
master-bin.000001 # Query # # use `test`; drop table tt1, t1
set binlog_format=row;
set binlog_format=row;
reset master;
reset master;
create database testing_1;
create database testing_1;
...
@@ -55,6 +87,27 @@ master-bin.000001 # Query # # use `testing_1`; CREATE DEFINER=`root`@`localhost`
...
@@ -55,6 +87,27 @@ master-bin.000001 # Query # # use `testing_1`; CREATE DEFINER=`root`@`localhost`
master-bin.000001 # Query # # use `testing_1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `sp1`(a int)
master-bin.000001 # Query # # use `testing_1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `sp1`(a int)
insert into t1 values(a)
insert into t1 values(a)
master-bin.000001 # Query # # drop database testing_1
master-bin.000001 # Query # # drop database testing_1
use test;
reset master;
create temporary table tt1 (a int);
create table t1 (a int);
insert into t1 values (1);
drop database if exists mysqltest1;
insert into t1 values (1);
drop table tt1, t1;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; create table t1 (a int)
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # drop database if exists mysqltest1
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
show databases;
show databases;
Database
Database
information_schema
information_schema
...
...
sql/sql_db.cc
View file @
2d62bacf
...
@@ -883,13 +883,6 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
...
@@ -883,13 +883,6 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
VOID
(
pthread_mutex_lock
(
&
LOCK_mysql_create_db
));
VOID
(
pthread_mutex_lock
(
&
LOCK_mysql_create_db
));
/*
This statement will be replicated as a statement, even when using
row-based replication. The flag will be reset at the end of the
statement.
*/
thd
->
clear_current_stmt_binlog_row_based
();
length
=
build_table_filename
(
path
,
sizeof
(
path
),
db
,
""
,
""
,
0
);
length
=
build_table_filename
(
path
,
sizeof
(
path
),
db
,
""
,
""
,
0
);
strmov
(
path
+
length
,
MY_DB_OPT_FILE
);
// Append db option file name
strmov
(
path
+
length
,
MY_DB_OPT_FILE
);
// Append db option file name
del_dbopt
(
path
);
// Remove dboption hash entry
del_dbopt
(
path
);
// Remove dboption hash entry
...
@@ -916,16 +909,36 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
...
@@ -916,16 +909,36 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
error
=
-
1
;
error
=
-
1
;
/*
We temporarily disable the binary log while dropping the objects
in the database. Since the DROP DATABASE statement is always
replicated as a statement, execution of it will drop all objects
in the database on the slave as well, so there is no need to
replicate the removal of the individual objects in the database
as well.
This is more of a safety precaution, since normally no objects
should be dropped while the database is being cleaned, but in
the event that a change in the code to remove other objects is
made, these drops should still not be logged.
Notice that the binary log have to be enabled over the call to
ha_drop_database(), since NDB otherwise detects the binary log
as disabled and will not log the drop database statement on any
other connected server.
*/
if
((
deleted
=
mysql_rm_known_files
(
thd
,
dirp
,
db
,
path
,
0
,
if
((
deleted
=
mysql_rm_known_files
(
thd
,
dirp
,
db
,
path
,
0
,
&
dropped_tables
))
>=
0
)
&
dropped_tables
))
>=
0
)
{
{
ha_drop_database
(
path
);
ha_drop_database
(
path
);
tmp_disable_binlog
(
thd
);
query_cache_invalidate1
(
db
);
query_cache_invalidate1
(
db
);
(
void
)
sp_drop_db_routines
(
thd
,
db
);
/* @todo Do not ignore errors */
(
void
)
sp_drop_db_routines
(
thd
,
db
);
/* @todo Do not ignore errors */
#ifdef HAVE_EVENT_SCHEDULER
#ifdef HAVE_EVENT_SCHEDULER
Events
::
drop_schema_events
(
thd
,
db
);
Events
::
drop_schema_events
(
thd
,
db
);
#endif
#endif
error
=
0
;
error
=
0
;
reenable_binlog
(
thd
);
}
}
}
}
if
(
!
silent
&&
deleted
>=
0
)
if
(
!
silent
&&
deleted
>=
0
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment