~mathiaz/ubuntu/lucid/mysql-dfsg-5.1/zap-bug-552053

« back to all changes in this revision

Viewing changes to mysql-test/suite/rpl/t/rpl_loadfile.test

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug
  • Date: 2009-06-25 12:55:45 UTC
  • mfrom: (1.1.2 upstream) (0.1.3 experimental)
  • Revision ID: james.westby@ubuntu.com-20090625125545-m8ogs96zzsri74xe
Tags: 5.1.34-1ubuntu1
* Merge from debian experimental (and 5.0 from main), remaining changes:
  - 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.
  - debian/control:
    + Make libmysqlclient16-dev a transitional package depending on
      libmysqlclient-dev.
    + Make libmysqlclient-dev conflict with libmysqlclient15-dev.
    + Don't build mysql-server, mysql-client, mysql-common and
      libmysqlclient15-dev binary packages since they're still provided
      by mysql-dfsg-5.0.
    + Make mysql-{client,server}-5.1 packages conflict and
      replace mysql-{client,server}-5.0, but not provide
      mysql-{client,server}.
    + Depend on a specific version of mysql-common rather than the src
      version of mysql-dfsg-5.1 since mysql-common is currently part of
      mysql-dfsg-5.0.
    + 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.
    + install mysql-test and sql-bench to /usr/share/mysql/ rather than
      /usr/.
  - 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.0.files: install apparmor profile.
    - debian/mysql-server-5.0.dirs: add etc/apparmor.d/force-complain
    - debian/mysql-server-5.0.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.0.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.
  - Don't package sql-bench and mysql-test file.
* Dropped changes:
  - debian/patches/92_ssl_test_cert.dpatch: certificate expiration in
    test suite (LP: #323755). Included upstream.
* Dropped from 5.0:
  - apparmor profile:
    - debian/control: Recommends apparmor >= 2.1+1075-0ubuntu6. All version
      of apparmor-profile (>hardy) are higher than this version.
    - debian/mysql-server-5.0.preinst: create symlink for force-complain/
      on pre-feisty upgrades, upgrades where apparmor-profiles profile is
      unchanged (ie non-enforcing) and upgrades where the profile
      doesn't exist. Support for pre-hardy upgrades is no longer needed.
* debian/mysql-server-5.1.postinst: fix debian-sys-maint user creation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
# Includes
13
13
-- source include/master-slave.inc
14
 
 
15
 
 
16
 
# Begin clean up test section
17
 
--disable_warnings
18
 
connection master;
19
 
DROP PROCEDURE IF EXISTS test.p1;
20
 
DROP TABLE IF EXISTS test.t1;
21
 
--enable_warnings
22
 
 
23
 
# Section 1 test 
24
 
 
25
 
CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, PRIMARY KEY(a));
26
 
INSERT INTO test.t1  VALUES(1,'test');
27
 
UPDATE test.t1 SET blob_column=LOAD_FILE('../std_data_ln/words2.dat') WHERE a=1;
28
 
delimiter |;
29
 
create procedure test.p1()
30
 
begin
31
 
  INSERT INTO test.t1  VALUES(2,'test');
32
 
  UPDATE test.t1 SET blob_column=LOAD_FILE('../std_data_ln/words2.dat') WHERE a=2;
33
 
end|
34
 
delimiter ;|
35
 
 
36
 
CALL test.p1();
37
 
SELECT * FROM test.t1 ORDER BY blob_column;
38
 
save_master_pos;
39
 
sync_slave_with_master;
40
 
connection slave;
41
 
# Need to allow some time when NDB engine is used for
42
 
# the injector thread to have time to populate binlog
43
 
let $wait_condition= SELECT INSTR(blob_column,'aberration') > 0 FROM test.t1 WHERE a = 2;
44
 
--source include/wait_condition.inc
45
 
SELECT * FROM test.t1 ORDER BY blob_column;
46
 
 
47
 
# Cleanup
48
 
connection master;
49
 
DROP PROCEDURE IF EXISTS test.p1;
50
 
DROP TABLE test.t1;
51
 
sync_slave_with_master;
52
 
 
53
 
# End of 5.0 test case
 
14
-- source include/have_binlog_format_mixed_or_row.inc
 
15
 
 
16
-- source extra/rpl_tests/rpl_loadfile.test
 
17
 
 
18
#  BUG#39701: Mixed binlog format does not switch to row mode on LOAD_FILE
 
19
#
 
20
#  DESCRIPTION
 
21
#
 
22
#    Problem: when using load_file string function and mixed binlogging format
 
23
#             there was no switch to row based binlogging format. This leads
 
24
#             to scenarios on which the slave replicates the statement and it
 
25
#             will try to load the file from local file system, which in most
 
26
#             likely it will not exist.
 
27
#
 
28
#    Solution:
 
29
#             Marking this function as unsafe for statement format, makes the
 
30
#             statement using it to be logged in row based format. As such, data 
 
31
#             replicated from the master, becomes the content of the loaded file.
 
32
#             Consequently, the slave receives the necessary data to complete
 
33
#             the load_file instruction correctly.
 
34
#
 
35
#  IMPLEMENTATION
 
36
#
 
37
#    The test is implemented as follows:
 
38
#
 
39
#      On Master,
 
40
#       i) write to file the desired content.
 
41
#      ii) create table and stored procedure with load_file
 
42
#     iii) stop slave
 
43
#     iii) execute load_file 
 
44
#      iv) remove file
 
45
#
 
46
#      On Slave,
 
47
#       v) start slave
 
48
#      vi) sync it with master so that it gets the updates from binlog (which 
 
49
#          should have bin logged in row format). 
 
50
#
 
51
#          If the the binlog format does not change to row, then the assertion
 
52
#          done in the following step fails. This happens because tables differ 
 
53
#          since the file does not exist anymore, meaning that when slave 
 
54
#          attempts to execute LOAD_FILE statement it inserts NULL on table 
 
55
#          instead of the same contents that the master loaded when it executed 
 
56
#          the procedure (which was executed when file existed).
 
57
#
 
58
#     vii) assert that the contents of master and slave 
 
59
#          table are the same
 
60
 
 
61
connection master;
 
62
source include/reset_master_and_slave.inc;
 
63
 
 
64
connection master;
 
65
let $file= $MYSQLTEST_VARDIR/tmp/bug_39701.data;
 
66
 
 
67
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
68
--eval SELECT repeat('x',20) INTO OUTFILE '$file'
 
69
 
 
70
disable_warnings;
 
71
DROP TABLE IF EXISTS t1;
 
72
enable_warnings;
 
73
 
 
74
CREATE TABLE t1 (t text);
 
75
DELIMITER |;
 
76
CREATE PROCEDURE p(file varchar(4096)) 
 
77
  BEGIN
 
78
    INSERT INTO t1 VALUES (LOAD_FILE(file));
 
79
  END|
 
80
DELIMITER ;|
 
81
 
 
82
# stop slave before issuing the load_file on master
 
83
connection slave;
 
84
source include/stop_slave.inc;
 
85
 
 
86
connection master;
 
87
 
 
88
# test: check that logging falls back to rbr.
 
89
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
90
--eval CALL p('$file')
 
91
 
 
92
# test: remove the file from the filesystem and assert that slave still 
 
93
#       gets the loaded file
 
94
remove_file $file;
 
95
 
 
96
# now that the file is removed it is safe (regarding what we want to test) 
 
97
# to start slave
 
98
connection slave;
 
99
source include/start_slave.inc;
 
100
 
 
101
connection master;
 
102
sync_slave_with_master;
 
103
 
 
104
# assertion: assert that the slave got the updates even
 
105
#            if the file was removed before the slave started,
 
106
#            meaning that contents were indeed transfered
 
107
#            through binlog (in row format)
 
108
let $diff_table_1=master:test.t1;
 
109
let $diff_table_2=slave:test.t1;
 
110
source include/diff_tables.inc;
 
111
 
 
112
# CLEAN UP
 
113
DROP TABLE t1;
 
114
DROP PROCEDURE p;
 
115
sync_slave_with_master;