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
f3145644
Commit
f3145644
authored
Feb 16, 2005
by
guilhem@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes after 4.1->5.0 merge.
parent
0987d81a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
38 deletions
+38
-38
mysql-test/r/rpl_multi_query.result
mysql-test/r/rpl_multi_query.result
+2
-2
mysql-test/t/rpl_multi_query.test
mysql-test/t/rpl_multi_query.test
+1
-1
sql/sql_base.cc
sql/sql_base.cc
+35
-35
No files found.
mysql-test/r/rpl_multi_query.result
View file @
f3145644
...
...
@@ -19,8 +19,8 @@ n
3
4
5
show binlog events from
79
;
Log_name Pos Event_type Server_id
Orig
_log_pos Info
show binlog events from
95
;
Log_name Pos Event_type Server_id
End
_log_pos Info
master-bin.000001 # Query 1 # drop database if exists mysqltest
master-bin.000001 # Query 1 # create database mysqltest
master-bin.000001 # Query 1 # use `test`; create table mysqltest.t1 ( n int)
...
...
mysql-test/t/rpl_multi_query.test
View file @
f3145644
...
...
@@ -24,6 +24,6 @@ sync_slave_with_master;
select
*
from
mysqltest
.
t1
;
connection
master
;
--
replace_column
2
# 5 #
show
binlog
events
from
79
;
show
binlog
events
from
95
;
drop
database
mysqltest
;
sync_slave_with_master
;
sql/sql_base.cc
View file @
f3145644
...
...
@@ -496,48 +496,51 @@ void close_temporary(TABLE *table,bool delete_table)
void
close_temporary_tables
(
THD
*
thd
)
{
TABLE
*
table
,
*
next
;
char
*
query
,
*
name_in_query
,
*
end
;
uint
greatest_key_length
=
0
;
char
*
query
,
*
end
;
uint
query_buf_size
;
bool
found_user_tables
=
0
;
if
(
!
thd
->
temporary_tables
)
return
;
/*
We write a DROP TEMPORARY TABLE for each temp table left, so that our
replication slave can clean them up. Not one multi-table DROP TABLE binlog
event: this would cause problems if slave uses --replicate-*-table.
*/
LINT_INIT
(
end
);
query_buf_size
=
50
;
// Enough for DROP ... TABLE IF EXISTS
/* We'll re-use always same buffer so make it big enough for longest name */
for
(
table
=
thd
->
temporary_tables
;
table
;
table
=
table
->
next
)
greatest_key_length
=
max
(
greatest_key_length
,
table
->
s
->
key_length
);
/*
We are going to add 4 ` around the db/table names, so 1 does not look
enough; indeed it is enough, because table->key_length is greater (by 8,
because of server_id and thread_id) than db||table.
*/
query_buf_size
+=
table
->
s
->
key_length
+
1
;
if
((
query
=
alloc_root
(
thd
->
mem_root
,
greatest_key_length
+
50
)))
if
((
query
=
alloc_root
(
thd
->
mem_root
,
query_buf_size
)))
// Better add "if exists", in case a RESET MASTER has been done
name_in_query
=
strmov
(
query
,
"DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `
"
);
end
=
strmov
(
query
,
"DROP /*!40005 TEMPORARY */ TABLE IF EXISTS
"
);
for
(
table
=
thd
->
temporary_tables
;
table
;
table
=
next
)
{
/*
In we are OOM for 'query' this is not fatal. We skip temporary tables
not created directly by the user.
*/
if
(
query
&&
mysql_bin_log
.
is_open
()
&&
(
table
->
s
->
table_name
[
0
]
!=
'#'
))
if
(
query
)
// we might be out of memory, but this is not fatal
{
/*
Here we assume table_cache_key always starts
with \0 terminated db name
*/
end
=
strxmov
(
name_in_query
,
table
->
s
->
db
,
"`.`"
,
table
->
s
->
table_name
,
"`"
,
NullS
);
Query_log_event
qinfo
(
thd
,
query
,
(
ulong
)(
end
-
query
),
0
,
FALSE
);
// skip temporary tables not created directly by the user
if
(
table
->
s
->
table_name
[
0
]
!=
'#'
)
found_user_tables
=
1
;
end
=
strxmov
(
end
,
"`"
,
table
->
s
->
db
,
"`.`"
,
table
->
s
->
table_name
,
"`,"
,
NullS
);
}
next
=
table
->
next
;
close_temporary
(
table
);
}
if
(
query
&&
found_user_tables
&&
mysql_bin_log
.
is_open
())
{
/* The -1 is to remove last ',' */
thd
->
clear_error
();
Query_log_event
qinfo
(
thd
,
query
,
(
ulong
)(
end
-
query
)
-
1
,
0
,
FALSE
);
/*
Imagine the thread had created a temp table, then was doing a SELECT, and
the SELECT was killed. Then it's not clever to mark the statement above as
"killed", because it's not really a statement updating data, and there
are 99.99% chances it will succeed on slave. And, if thread is
killed now, it's not clever either.
are 99.99% chances it will succeed on slave.
If a real update (one updating a persistent table) was killed on the
master, then this real update will be logged with error_code=killed,
rightfully causing the slave to stop.
...
...
@@ -545,9 +548,6 @@ void close_temporary_tables(THD *thd)
qinfo
.
error_code
=
0
;
mysql_bin_log
.
write
(
&
qinfo
);
}
next
=
table
->
next
;
close_temporary
(
table
);
}
thd
->
temporary_tables
=
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