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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
888a354b
Commit
888a354b
authored
Mar 08, 2010
by
Luis Soares
Browse files
Options
Browse Files
Download
Plain Diff
Automerge BUG 51226 bzr bundle from bug report --> myqsl-5.1-bugteam.
parents
0e2cc47c
24f7afe7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
80 additions
and
0 deletions
+80
-0
mysql-test/suite/binlog/r/binlog_tmp_table.result
mysql-test/suite/binlog/r/binlog_tmp_table.result
+11
-0
mysql-test/suite/binlog/t/binlog_tmp_table.test
mysql-test/suite/binlog/t/binlog_tmp_table.test
+66
-0
sql/sql_base.cc
sql/sql_base.cc
+3
-0
No files found.
mysql-test/suite/binlog/r/binlog_tmp_table.result
View file @
888a354b
...
...
@@ -29,3 +29,14 @@ a
6
8
drop table foo;
RESET MASTER;
create database b51226;
use b51226;
create temporary table t1(i int);
use b51226;
create temporary table t1(i int);
create temporary table t1(i int);
ERROR 42S01: Table 't1' already exists
insert into t1 values(1);
DROP DATABASE b51226;
FLUSH LOGS;
mysql-test/suite/binlog/t/binlog_tmp_table.test
View file @
888a354b
...
...
@@ -82,3 +82,69 @@ select * from foo;
# clean up
drop
table
foo
;
#################################################################
# BUG#51226
#################################################################
RESET
MASTER
;
--
let
$dbname
=
b51226
connect
(
con1
,
localhost
,
root
,,
test
,
$MASTER_MYPORT
,
$MASTER_MYSOCK
);
connect
(
con2
,
localhost
,
root
,,
test
,
$MASTER_MYPORT
,
$MASTER_MYSOCK
);
#
# action: on con1 create the database and the tmp table
#
--
connection
con1
--
eval
create
database
$dbname
--
eval
use
$dbname
create
temporary
table
t1
(
i
int
);
#
# action: on con1 create the tmp table
#
--
connection
con2
--
eval
use
$dbname
create
temporary
table
t1
(
i
int
);
# action: at this point, the last event binlogged contains the
# pseudo_thread_id from con2. So now we switch to con1, issue
# a statement that fails and close the connection (which logs
# implicitely a DROP TEMPORARY TABLE).
#
# Before the patch this would not log con1's pseudo_thread_id
# because the failing statement would reset THD context
# (unsetting the thread_specific_used flag, and consequently,
# causing the DROP event to be logged without pseudo_thread_id
# in its header).
--
connection
con1
--
error
1050
create
temporary
table
t1
(
i
int
);
--
disconnect
con1
--
connection
default
--
let
$wait_binlog_event
=
DROP
--
source
include
/
wait_for_binlog_event
.
inc
# action: insert in the t1. This would cause the the test to fail,
# because when replaying the binlog the previous implicit drop
# temp table would have been executed under the wrong
# pseudo_thread_id, dropping the tmp table on con2.
--
connection
con2
insert
into
t1
values
(
1
);
--
disconnect
con2
--
connection
default
--
let
$wait_binlog_event
=
DROP
--
source
include
/
wait_for_binlog_event
.
inc
--
eval
DROP
DATABASE
$dbname
FLUSH
LOGS
;
# assertion: assert that when replaying the binary log will succeed,
# instead of failing with "Table 'XXX.YYY' doesn't exist"
--
let
$MYSQLD_DATADIR
=
`select @@datadir`
--
exec
$MYSQL_BINLOG
$MYSQLD_DATADIR
/
master
-
bin
.
000001
|
$MYSQL
sql/sql_base.cc
View file @
888a354b
...
...
@@ -1515,6 +1515,7 @@ void close_temporary_tables(THD *thd)
{
if
(
is_user_table
(
table
))
{
bool
save_thread_specific_used
=
thd
->
thread_specific_used
;
my_thread_id
save_pseudo_thread_id
=
thd
->
variables
.
pseudo_thread_id
;
/* Set pseudo_thread_id to be that of the processed table */
thd
->
variables
.
pseudo_thread_id
=
tmpkeyval
(
thd
,
table
);
...
...
@@ -1544,6 +1545,7 @@ void close_temporary_tables(THD *thd)
thd
->
clear_error
();
CHARSET_INFO
*
cs_save
=
thd
->
variables
.
character_set_client
;
thd
->
variables
.
character_set_client
=
system_charset_info
;
thd
->
thread_specific_used
=
TRUE
;
Query_log_event
qinfo
(
thd
,
s_query
.
ptr
(),
s_query
.
length
()
-
1
/* to remove trailing ',' */
,
0
,
FALSE
,
0
);
...
...
@@ -1556,6 +1558,7 @@ void close_temporary_tables(THD *thd)
"Failed to write the DROP statement for temporary tables to binary log"
);
}
thd
->
variables
.
pseudo_thread_id
=
save_pseudo_thread_id
;
thd
->
thread_specific_used
=
save_thread_specific_used
;
}
else
{
...
...
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