~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to mysql-test/extra/binlog_tests/drop_temp_table.test

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
--disable_warnings
 
3
DROP DATABASE IF EXISTS `drop-temp+table-test`;
 
4
--enable_warnings
 
5
 
 
6
connect (con1,localhost,root,,);
 
7
connect (con2,localhost,root,,);
 
8
connection con1;
 
9
RESET MASTER;
 
10
CREATE DATABASE `drop-temp+table-test`;
 
11
USE `drop-temp+table-test`;
 
12
CREATE TEMPORARY TABLE shortn1 (a INT);
 
13
CREATE TEMPORARY TABLE `table:name` (a INT);
 
14
CREATE TEMPORARY TABLE shortn2 (a INT);
 
15
 
 
16
##############################################################################
 
17
# BUG#46572 DROP TEMPORARY table IF EXISTS does not have a consistent behavior
 
18
# in ROW mode 
 
19
 
20
# In RBR, 'DROP TEMPORARY TABLE ...' statement should never be binlogged no
 
21
# matter if the tables exist or not. In contrast, both in SBR and MBR, the
 
22
# statement should be always binlogged no matter if the tables exist or not.
 
23
##############################################################################
 
24
CREATE TEMPORARY TABLE tmp(c1 int);
 
25
CREATE TEMPORARY TABLE tmp1(c1 int);
 
26
CREATE TEMPORARY TABLE tmp2(c1 int);
 
27
CREATE TEMPORARY TABLE tmp3(c1 int);
 
28
CREATE TABLE t(c1 int);
 
29
 
 
30
DROP TEMPORARY TABLE IF EXISTS tmp;
 
31
 
 
32
--disable_warnings
 
33
# Before fixing BUG#46572, 'DROP TEMPORARY TABLE IF EXISTS...' statement was
 
34
# binlogged when the table did not exist in RBR.
 
35
DROP TEMPORARY TABLE IF EXISTS tmp;
 
36
 
 
37
# In RBR, 'DROP TEMPORARY TABLE ...' statement is never binlogged no matter if
 
38
# the tables exist or not.
 
39
DROP TEMPORARY TABLE IF EXISTS tmp, tmp1;
 
40
DROP TEMPORARY TABLE tmp3;
 
41
 
 
42
#In RBR, tmp2 will NOT be binlogged, because it is a temporary table.
 
43
DROP TABLE IF EXISTS tmp2, t;
 
44
 
 
45
#In RBR, tmp2 will be binlogged, because it does not exist and master do not know
 
46
# whether it is a temporary table or not.
 
47
DROP TABLE IF EXISTS tmp2, t;
 
48
--enable_warnings
 
49
 
 
50
SELECT GET_LOCK("a",10);
 
51
 
 
52
#
 
53
# BUG48216 Replication fails on all slaves after upgrade to 5.0.86 on master
 
54
#
 
55
# When the session is closed, any temporary tables of the session are dropped
 
56
# and are binlogged. But it will be binlogged with a wrong database name when
 
57
# the length of the database name('drop-temp-table-test') is greater than the
 
58
# current database name('test').
 
59
#
 
60
USE test;
 
61
disconnect con1;
 
62
 
 
63
connection con2;
 
64
# We want to SHOW BINLOG EVENTS, to know what was logged. But there is no
 
65
# guarantee that logging of the terminated con1 has been done yet.
 
66
# To be sure that logging has been done, we use a user lock.
 
67
SELECT GET_LOCK("a",10);
 
68
let $VERSION=`SELECT VERSION()`;
 
69
source include/show_binlog_events.inc;
 
70
DROP DATABASE `drop-temp+table-test`;
 
71
 
 
72
# End of 4.1 tests