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

« back to all changes in this revision

Viewing changes to mysql-test/t/mysqlbinlog_row_big.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
# mysqlbinlog_big.test
 
2
#
 
3
# Show that mysqlbinlog can handle big rows.
 
4
#
 
5
 
 
6
#
 
7
# The *huge* output of mysqlbinlog will be redirected to
 
8
# $MYSQLTEST_VARDIR/$mysqlbinlog_output
 
9
#
 
10
--let $mysqlbinlog_output= tmp/mysqlbinlog_big_1.out
 
11
 
 
12
#--source include/have_myisam.inc
 
13
--let $engine_type= MyISAM
 
14
 
 
15
#
 
16
# This test case is insensitive to the binlog format
 
17
# because we don't display the output of mysqlbinlog.
 
18
#
 
19
#--source include/have_binlog_format_row.inc
 
20
 
 
21
--source include/have_log_bin.inc
 
22
 
 
23
# This is a big test.
 
24
--source include/big_test.inc
 
25
 
 
26
--echo #
 
27
--echo # Preparatory cleanup.
 
28
--echo #
 
29
--disable_warnings
 
30
DROP TABLE IF EXISTS t1;
 
31
--enable_warnings
 
32
 
 
33
--echo #
 
34
--echo # We need a fixed timestamp to avoid varying results.
 
35
--echo #
 
36
SET timestamp=1000000000;
 
37
 
 
38
--echo #
 
39
--echo # We need big packets.
 
40
--echo #
 
41
--echo # Capture initial value to reset at the end of the test
 
42
# use let $<var> = query_get_value as FLUSH statements
 
43
# in the test will set @<var> values to NULL
 
44
let $orig_max_allowed_packet = 
 
45
query_get_value(SELECT @@global.max_allowed_packet, @@global.max_allowed_packet, 1);
 
46
 
 
47
--echo # Now adjust max_allowed_packet
 
48
SET @@global.max_allowed_packet= 1024*1024*1024;
 
49
 
 
50
--echo max_allowed_packet is a global variable.
 
51
--echo In order for the preceding change in max_allowed_packets' value
 
52
--echo to be seen and used, we must start a new connection.
 
53
--echo The change does not take effect with the current one.
 
54
--echo For simplicity, we just disconnect / reconnect connection default here.
 
55
--echo Disconnecting default connection...
 
56
disconnect default;
 
57
--echo Reconnecting default connection...
 
58
connect (default, localhost,root,,);
 
59
--echo default connection established, continuing with the test
 
60
 
 
61
--echo #
 
62
--echo # Delete all existing binary logs.
 
63
--echo #
 
64
RESET MASTER;
 
65
 
 
66
--echo #
 
67
--echo # Create a test table.
 
68
--echo #
 
69
eval CREATE TABLE t1 (
 
70
  c1 LONGTEXT
 
71
  ) ENGINE=$engine_type DEFAULT CHARSET latin1;
 
72
 
 
73
--echo #
 
74
--echo # Show how many rows are affected by each statement.
 
75
--echo #
 
76
--enable_info
 
77
 
 
78
--echo #
 
79
--echo # Insert some big rows.
 
80
--echo #
 
81
 
 
82
--echo 256MB
 
83
INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 16777216));
 
84
 
 
85
--echo 32MB
 
86
INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 2097152));
 
87
 
 
88
--echo 4MB
 
89
INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 262144));
 
90
 
 
91
--echo 512KB
 
92
INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 32768));
 
93
 
 
94
--echo #
 
95
--echo # Show what we have in the table.
 
96
--echo # Do not display the column value itself, just its length.
 
97
--echo #
 
98
--sorted_result
 
99
query_vertical SELECT LENGTH(c1) FROM t1;
 
100
 
 
101
--echo #
 
102
--echo # Grow the rows by updating.
 
103
--echo #
 
104
UPDATE t1 SET c1 = CONCAT(c1, c1);
 
105
 
 
106
--echo #
 
107
--echo # Show what we have in the table.
 
108
--echo # Do not display the column value itself, just its length.
 
109
--echo #
 
110
--sorted_result
 
111
query_vertical SELECT LENGTH(c1) FROM t1;
 
112
 
 
113
--echo #
 
114
--echo # Delete the rows.
 
115
--echo #
 
116
DELETE FROM t1 WHERE c1 >= 'ManyMegaByteBlck';
 
117
 
 
118
--echo #
 
119
--echo # Hide how many rows are affected by each statement.
 
120
--echo #
 
121
--disable_info
 
122
 
 
123
--echo #
 
124
--echo # Flush all log buffers to the log file.
 
125
--echo #
 
126
FLUSH LOGS;
 
127
 
 
128
--echo #
 
129
--echo # Call mysqlbinlog to display the log file contents.
 
130
--echo # NOTE: The output of mysqlbinlog is redirected to
 
131
--echo #       \$MYSQLTEST_VARDIR/$mysqlbinlog_output
 
132
--echo #       If you want to examine it, disable remove_file
 
133
--echo #       at the bottom of the test script.
 
134
--echo #
 
135
let $MYSQLD_DATADIR= `select @@datadir`;
 
136
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
 
137
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/
 
138
--exec $MYSQL_BINLOG -v -v $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/$mysqlbinlog_output
 
139
 
 
140
--echo #
 
141
--echo # Cleanup.
 
142
--echo #
 
143
--echo # reset variable value to pass testcase checks
 
144
eval SET @@global.max_allowed_packet = $orig_max_allowed_packet;
 
145
DROP TABLE t1;
 
146
 
 
147
--echo remove_file \$MYSQLTEST_VARDIR/$mysqlbinlog_output
 
148
#
 
149
# NOTE: If you want to see the *huge* mysqlbinlog output, disable next line:
 
150
#
 
151
--remove_file $MYSQLTEST_VARDIR/$mysqlbinlog_output
 
152