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

« back to all changes in this revision

Viewing changes to mysql-test/r/query_cache_debug.result

  • 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:
71
71
SET GLOBAL concurrent_insert= DEFAULT;
72
72
SET GLOBAL query_cache_size= DEFAULT;
73
73
SET GLOBAL query_cache_type= DEFAULT;
 
74
#
 
75
# Bug43758 Query cache can lock up threads in 'freeing items' state
 
76
#
 
77
FLUSH STATUS;
 
78
SET GLOBAL query_cache_type=DEMAND;
 
79
SET GLOBAL query_cache_size= 1024*768;
 
80
DROP TABLE IF EXISTS t1,t2,t3,t4,t5;
 
81
CREATE TABLE t1 (a VARCHAR(100));
 
82
CREATE TABLE t2 (a VARCHAR(100));
 
83
CREATE TABLE t3 (a VARCHAR(100));
 
84
CREATE TABLE t4 (a VARCHAR(100));
 
85
CREATE TABLE t5 (a VARCHAR(100));
 
86
INSERT INTO t1 VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
 
87
INSERT INTO t2 VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
 
88
INSERT INTO t3 VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
 
89
INSERT INTO t4 VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
 
90
INSERT INTO t5 VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
 
91
=================================== Connection thd1
 
92
**
 
93
** Load Query Cache with a result set and one table.
 
94
**
 
95
SELECT SQL_CACHE * FROM t1;
 
96
a
 
97
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
98
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
 
99
*************************************************************************
 
100
** We want to accomplish the following state:
 
101
**  - Query cache status: TABLE_FLUSH_IN_PROGRESS
 
102
**  - THD1: invalidate_table_internal (iterating query blocks)
 
103
**  - THD2: query_cache_insert (cond_wait)
 
104
**  - THD3: query_cache_insert (cond_wait)
 
105
**  - No thread should be holding the structure_guard_mutex.
 
106
**
 
107
** First step is to place a DELETE-statement on the debug hook just
 
108
** before the mutex lock in invalidate_table_internal.
 
109
** This will allow new result sets to be written into the QC.
 
110
** 
 
111
SET SESSION debug='+d,wait_in_query_cache_invalidate1';
 
112
SET SESSION debug='+d,wait_in_query_cache_invalidate2';
 
113
DELETE FROM t1 WHERE a like '%a%';;
 
114
=================================== Connection default
 
115
** Assert that the expect process status is obtained.
 
116
**
 
117
=================================== Connection thd2
 
118
** On THD2: Insert a result into the cache. This attempt will be blocked
 
119
** because of a debug hook placed just before the mutex lock after which
 
120
** the first part of the result set is written.
 
121
SET SESSION debug='+d,wait_in_query_cache_insert';
 
122
SELECT SQL_CACHE * FROM t2 UNION SELECT * FROM t3;
 
123
=================================== Connection thd3
 
124
** On THD3: Insert another result into the cache and block on the same
 
125
** debug hook.
 
126
SET SESSION debug='+d,wait_in_query_cache_insert';
 
127
SELECT SQL_CACHE * FROM t4 UNION SELECT * FROM t5;;
 
128
=================================== Connection default
 
129
** Assert that the two SELECT-stmt threads to reach the hook.
 
130
**
 
131
**
 
132
** Signal the DELETE thread, THD1, to continue. It will enter the mutex
 
133
** lock and set query cache status to TABLE_FLUSH_IN_PROGRESS and then
 
134
** unlock the mutex before stopping on the next debug hook.
 
135
SELECT SQL_NO_CACHE id FROM information_schema.processlist WHERE state='wait_in_query_cache_invalidate1' LIMIT 1 INTO @flush_thread_id;
 
136
KILL QUERY @flush_thread_id;
 
137
** Assert that we reach the next debug hook.
 
138
**
 
139
** Signal the remaining debug hooks blocking THD2 and THD3.
 
140
** The threads will grab the guard mutex enter the wait condition and
 
141
** and finally release the mutex. The threads will continue to wait
 
142
** until a broadcast signal reaches them causing both threads to 
 
143
** come alive and check the condition.
 
144
SELECT SQL_NO_CACHE id FROM information_schema.processlist WHERE state='wait_in_query_cache_insert' ORDER BY id ASC LIMIT 1 INTO @thread_id;
 
145
KILL QUERY @thread_id;
 
146
SELECT SQL_NO_CACHE id FROM information_schema.processlist WHERE state='wait_in_query_cache_insert' ORDER BY id DESC LIMIT 1 INTO @thread_id;
 
147
KILL QUERY @thread_id;
 
148
**
 
149
** Finally signal the DELETE statement on THD1 one last time.
 
150
** The stmt will complete the query cache invalidation and return 
 
151
** cache status to NO_FLUSH_IN_PROGRESS. On the status change
 
152
** One signal will be sent to the thread group waiting for executing
 
153
** invalidations and a broadcast signal will be sent to the thread 
 
154
** group holding result set writers.
 
155
SELECT SQL_NO_CACHE id FROM information_schema.processlist WHERE state='wait_in_query_cache_invalidate2' LIMIT 1 INTO @flush_thread_id;
 
156
KILL QUERY @flush_thread_id;
 
157
**
 
158
*************************************************************************
 
159
** No tables should be locked
 
160
=================================== Connection thd2
 
161
a
 
162
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
163
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
 
164
DELETE FROM t1;
 
165
DELETE FROM t2;
 
166
DELETE FROM t3;
 
167
=================================== Connection thd3
 
168
a
 
169
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
170
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
 
171
DELETE FROM t4;
 
172
DELETE FROM t5;
 
173
=================================== Connection thd1
 
174
** Done.
 
175
SET GLOBAL query_cache_size= 0;
 
176
# Restore defaults
 
177
RESET QUERY CACHE;
 
178
FLUSH STATUS;
 
179
DROP TABLE t1,t2,t3,t4,t5;
 
180
SET GLOBAL query_cache_size= DEFAULT;
 
181
SET GLOBAL query_cache_type= DEFAULT;