~ubuntu-branches/ubuntu/lucid/mysql-dfsg-5.1/lucid

« back to all changes in this revision

Viewing changes to mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_db_filter.test

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug, Mathias Gug
  • Date: 2009-08-05 11:40:21 UTC
  • mfrom: (1.1.3 upstream) (0.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20090805114021-59bj0bgfm2ufllbk
Tags: 5.1.37-1ubuntu1
[ Mathias Gug ]
* Merge from debian unstable and 5.0, remaining changes:
  - debian/control:
    + Properly upgrade libmysqlclient16-dev packages to
    libmysqlclient-dev:
      * Make libmysqlclient16-dev a transitional package depending on
        libmysqlclient-dev.
      * Make libmysqlclient-dev replace libmysqlclient16-dev.
    + Don't provide a libmysqlclient15-dev package as long as there are
      packages still build-depending on libmysqlclient15-dev and
      mysql-dsfg-5.0 is in the archive.
    + Lower mailx from a Recommends to a Suggests to avoid pulling in
      a full MTA on all installs of mysql-server. (LP: #259477)
  - debian/rules:
    + added -fno-strict-aliasing to CFLAGS to get around mysql testsuite
      build failures.
  - debian/additions/debian-start.inc.sh: support ANSI mode (LP: #310211)
  - Add AppArmor profile:
    - debian/apparmor-profile: apparmor profile.
    - debian/rules, debian/mysql-server-5.1.files: install apparmor profile.
    - debian/mysql-server-5.1.dirs: add etc/apparmor.d/force-complain
    - debian/mysql-server-5.1.postrm: remove symlink in force-complain/ on
      purge.
    - debian/mysql-server-5.1.README.Debian: add apparmor documentation.
    - debian/additions/my.cnf: Add warning about apparmor. (LP: #201799)
    - debian/mysql-server-5.1.postinst: reload apparmor profiles.
  - debian/additions/my.cnf: remove language option. Error message files are
    located in a different directory in MySQL 5.0. Setting the language
    option to use /usr/share/mysql/english breaks 5.0. Both 5.0 and 5.1
    use a default value that works. (LP: #316974)
  - debian/mysql-server-5.1.mysql.init:
    + Clearly indicate that we do not support running multiple instances
      of mysqld by duplicating the init script.
      (closes: #314785, #324834, #435165, #444216)
    + Properly parameterize all existing references to the mysql config
      file (/etc/mysql/my.cnf).
  - debian/mysql-server-5.1.postinst: Clear out the second password
    when setting up mysql. (LP: #344816)
  - mysql-server-core-5.1 package for files needed by Akonadi:
    + debian/control: create mysql-server-core-5.1 package.
    + debian/mysql-server-core-5.1.files, debian/mysql-server-5.1.files:
      move core mysqld files to mysql-server-core-5.1 package.
* debian/libmysqlclient16.symbols.amd64: remove amd64 symbols as it has
  not been correctly generated in Debian.
* Add Apport hook: (LP: #354188)
  - debian/mysql-server-5.1.py: apport package hook.
  - debian/mysql-server-5.1.files, debian/rules: install apport package
    hook.
* debian/additions/my.cnf: 
  - drop old_password option.
  - fix commented logging options to use general_log and general_log_file.
* Dropped - accepted in Debian:
  - debian/mysql-server-5.1.config:
    + ask for MySQL root password at priority high instead of medium so
      that the password prompt is seen on a default install. (LP: #319843)
    + don't ask for root password when upgrading from a 5.0 install.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# BUG#42941: --database parameter to mysqlbinlog fails with RBR
 
2
#
 
3
# WHAT
 
4
# ====
 
5
#
 
6
#  This test aims at checking whether a rows log event is printed or
 
7
#  not when --database parameter is used to filter events from one
 
8
#  given database.
 
9
#
 
10
# HOW
 
11
# ===
 
12
#
 
13
#  The test is implemented as follows: 
 
14
#
 
15
#    i) Some operations are done in two different databases:
 
16
#       'test' and 'b42941';
 
17
#   ii) mysqlbinlog is used to dump the contents of the binlog file
 
18
#       filtering only events from 'b42941'. The result of the dump is
 
19
#       stored in a temporary file. (This is done with and without
 
20
#       --verbose/hexdump flag);
 
21
#  iii) The contents of the dump are loaded into a session variable;
 
22
#   iv) The variable contents are searched for 'test' and 'b42941';
 
23
#    v) Should 'test' be found, an ERROR is reported. Should 'b42941' be
 
24
#       absent, an ERROR is reported.
 
25
 
 
26
-- source include/have_log_bin.inc
 
27
-- source include/have_binlog_format_row.inc
 
28
-- source include/have_innodb.inc
 
29
 
 
30
RESET MASTER;
 
31
-- let $MYSQLD_DATADIR= `select @@datadir`
 
32
 
 
33
CREATE TABLE t1 (id int);
 
34
CREATE TABLE t2 (id int);
 
35
CREATE TABLE t3 (txt TEXT);
 
36
CREATE TABLE t4 (a int) ENGINE= InnoDB;
 
37
INSERT INTO t1 VALUES (1);
 
38
INSERT INTO t1 VALUES (2);
 
39
INSERT INTO t2 VALUES (1);
 
40
INSERT INTO t2 VALUES (2);
 
41
INSERT INTO t1 VALUES (3);
 
42
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
43
-- eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/std_data/words.dat' INTO TABLE t3
 
44
INSERT INTO t1 VALUES (4);
 
45
 
 
46
CREATE DATABASE b42941;
 
47
use b42941;
 
48
CREATE TABLE t1 (id int);
 
49
CREATE TABLE t2 (id int);
 
50
CREATE TABLE t3 (txt TEXT);
 
51
CREATE TABLE t4 (a int) ENGINE= InnoDB;
 
52
INSERT INTO t1 VALUES (1);
 
53
INSERT INTO t1 VALUES (2);
 
54
INSERT INTO t2 VALUES (1);
 
55
INSERT INTO t2 VALUES (2);
 
56
INSERT INTO t1 VALUES (3);
 
57
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
58
-- eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/std_data/words.dat' INTO TABLE t3
 
59
INSERT INTO t1 VALUES (4);
 
60
 
 
61
INSERT INTO test.t1 VALUES (5);
 
62
 
 
63
FLUSH LOGS;
 
64
 
 
65
UPDATE test.t1 t11, b42941.t1 t12 SET t11.id=10, t12.id=100;
 
66
 
 
67
BEGIN;
 
68
INSERT INTO test.t4 VALUES (1);
 
69
INSERT INTO b42941.t4 VALUES (1);
 
70
UPDATE test.t4 tn4, b42941.t4 tt4 SET tn4.a= 10, tt4.a= 100;
 
71
COMMIT;
 
72
 
 
73
FLUSH LOGS;
 
74
 
 
75
-- let $log_file1= $MYSQLD_DATADIR/master-bin.000001
 
76
-- let $log_file2= $MYSQLD_DATADIR/master-bin.000002
 
77
-- let $outfile= $MYSQLTEST_VARDIR/tmp/b42941-mysqlbinlog
 
78
-- let $cmd= $MYSQL_BINLOG
 
79
 
 
80
let $i= 3;
 
81
while($i)
 
82
{
 
83
  -- let $flags=--database=b42941
 
84
 
 
85
  # construct CLI for mysqlbinlog
 
86
  if(`SELECT $i=3`)
 
87
  {
 
88
    -- let $flags= $flags --verbose --hexdump
 
89
  }
 
90
 
 
91
  if(`SELECT $i=2`)
 
92
  {
 
93
    -- let $flags= $flags --verbose
 
94
  }
 
95
 
 
96
#  if(`SELECT $i=1`)
 
97
#  {
 
98
    # do nothing $flags is already set as it should be
 
99
#  }
 
100
 
 
101
  # execute mysqlbinlog on the two available master binlog files
 
102
  -- exec $cmd $flags $log_file1 > $outfile.1
 
103
  -- exec $cmd $flags $log_file2 > $outfile.2
 
104
 
 
105
  # load outputs into a variable
 
106
  -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
107
  -- eval SET @b42941_output.1= LOAD_FILE('$outfile.1')
 
108
 
 
109
  -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
110
  -- eval SET @b42941_output.2= LOAD_FILE('$outfile.2')
 
111
 
 
112
  # remove unecessary files
 
113
  -- remove_file $outfile.1
 
114
  -- remove_file $outfile.2
 
115
 
 
116
  # assertion: events for database test are filtered
 
117
  if (`SELECT INSTR(@b42941_output.1, 'test')`)
 
118
  {
 
119
    -- echo **** ERROR **** Database name 'test' FOUND in mysqlbinlog output ($flags $outfile.1).
 
120
  }
 
121
 
 
122
  if (`SELECT INSTR(@b42941_output.2, 'test')`)
 
123
  {
 
124
    -- echo **** ERROR **** Database name 'test' FOUND in mysqlbinlog output ($flags $outfile.2).
 
125
  }
 
126
 
 
127
  # assertion: events for database b42941 are not filtered
 
128
  if (!`SELECT INSTR(@b42941_output.1, 'b42941')`)
 
129
  {
 
130
    -- echo **** ERROR **** Database name 'b42941' NOT FOUND in mysqlbinlog output ($flags $outfile.1).
 
131
  }
 
132
 
 
133
  if (!`SELECT INSTR(@b42941_output.2, 'b42941')`)
 
134
  {
 
135
    -- echo **** ERROR **** Database name 'b42941' NOT FOUND in mysqlbinlog output ($flags $outfile.2).
 
136
  }
 
137
 
 
138
  dec $i;
 
139
}
 
140
 
 
141
DROP DATABASE b42941;
 
142
use test;
 
143
DROP TABLE t1, t2, t3, t4;