~clint-fewbar/ubuntu/maverick/mysql-5.1/innodb-default-table-type

« back to all changes in this revision

Viewing changes to mysql-test/include/check_concurrent_insert.inc

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2010-06-21 15:31:05 UTC
  • mfrom: (1.2.1 upstream) (2.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20100621153105-lv81twvjdgzvzrre
Tags: 5.1.48-1ubuntu1
* Merge from debian unstable, remaining changes:
  + debian/control:
     * Update maintainer according to spec.
     * Move section from "misc" to "database".
     * Added libmysqlclient16-dev an empty transitional package. 
     * Added mysql-client-core-5.1 package.
     * Suggest mailx for mysql-server-5.1
     * Add mysql-testsuite package so you can run the testsuite seperately.
  + debian/additions/my.cnf:
    * Remove language options. Error message files are located in a different directory in Mysql
      5.0. Setting the language option to use /usr/share/mysql/english breaks Mysql 5.0. Both 5.0
      and 5.1 use a different value that works. (LP: #316974)
  + 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/fore-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
  * Convert the package from sysvinit to upstart:
    + debian/mysql-server-5.1.mysql.upstart: Add upstart script.
    + debian/mysql-server-5.1.mysql.init: Dropped, unused now with upstart.
    + debian/additions/mysqld_safe_syslog.cnf: Dropped, unused now with upstart.
    + debian/additons/my.cnf: Remove pid declaration and setup error logging to /var/log/mysql since
      we're not piping anything around logger anymore.
    + debian/rules, debian/mysql-server-5.1.logcheck.ignore.{paranoid,worstation},
      debian/mysql-server-5.1.logcheck.ignore.server: : Remove references to mysqld_safe
    + debian/patches/38_scripts_mysqld_safe.sh_signals.dpatch: Dropped
  * Added -fno-strict-aliasing to CFLAGS to get around mysql testsuite build failures.
  * Add Apport hook (LP: #354188):
    + debian/mysql-server-5.1.py: apport package hook
    + debian/rules: Make it installable
  * debian/mysql-server-5.1.mysql-server.logrotate: Check to see if mysql is running before
    running logrotate. (LP: #513135)
  * Make the testsuite installable. (LP: #530752)
    + debian/mysql-server-5.1.files, debian/rules: install apport package hook
  * debian/mysql-server-5.1.preinst: Set mysql user's home directory
    to /nonexistent to protect against having the /var/lib/mysql
    user-writeable. If an attacker can trick mysqld into creating
    dot files in the home directory, he could do .rhost-like attacks
    on the system. (LP: #293258)
  * debian/control: mysql-client-5.1 should depend on mysql-core-client-5.1.
    (LP: #590952) 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# SUMMARY
 
3
#   Check if statement reading table '$table' allows concurrent
 
4
#   inserts in it.
 
5
#
 
6
# PARAMETERS 
 
7
#   $table         Table in which concurrent inserts should be allowed.
 
8
#   $con_aux1      Name of the first auxiliary connection to be used by this
 
9
#                  script.
 
10
#   $con_aux2      Name of the second auxiliary connection to be used by this
 
11
#                  script.
 
12
#   $statement     Statement to be checked.
 
13
#   $restore_table Table which might be modified by statement to be checked
 
14
#                  and thus needs backing up before its execution and
 
15
#                  restoring after it (can be empty).
 
16
#
 
17
# EXAMPLE
 
18
#    lock_sync.test
 
19
#
 
20
--disable_result_log
 
21
--disable_query_log
 
22
 
 
23
# Reset DEBUG_SYNC facility for safety.
 
24
set debug_sync= "RESET";
 
25
 
 
26
if (`SELECT '$restore_table' <> ''`)
 
27
{
 
28
--eval create temporary table t_backup select * from $restore_table;
 
29
}
 
30
 
 
31
connection $con_aux1;
 
32
set debug_sync='after_lock_tables_takes_lock SIGNAL parked WAIT_FOR go';
 
33
--send_eval $statement;
 
34
 
 
35
connection $con_aux2;
 
36
set debug_sync='now WAIT_FOR parked';
 
37
--send_eval insert into $table (i) values (0);
 
38
 
 
39
--enable_result_log
 
40
--enable_query_log
 
41
connection default;
 
42
# Wait until concurrent insert is successfully executed while
 
43
# statement being checked has its tables locked.
 
44
# We use wait_condition.inc instead of simply reaping 
 
45
# concurrent insert here in order to avoid deadlocks if test
 
46
# fails and to time out gracefully instead.
 
47
let $wait_condition=
 
48
  select count(*) = 0 from information_schema.processlist
 
49
  where info = "insert into $table (i) values (0)";
 
50
--source include/wait_condition.inc
 
51
 
 
52
--disable_result_log
 
53
--disable_query_log
 
54
 
 
55
if ($success)
 
56
{
 
57
# Apparently concurrent insert was successfully executed.
 
58
# To be safe against wait_condition.inc succeeding due to
 
59
# races let us first reap concurrent insert to ensure that
 
60
# it has really been successfully executed.
 
61
connection $con_aux2;
 
62
--reap
 
63
connection default;
 
64
set debug_sync= 'now SIGNAL go';
 
65
connection $con_aux1;
 
66
--reap
 
67
connection default;
 
68
--echo Success: '$statement' allows concurrent inserts into '$table'.
 
69
}
 
70
if (!$success)
 
71
{
 
72
# Waiting has timed out. Apparently concurrent insert was blocked.
 
73
# So to be able to continue we need to end our statement first.
 
74
set debug_sync= 'now SIGNAL go';
 
75
connection $con_aux1;
 
76
--reap
 
77
connection $con_aux2;
 
78
--reap
 
79
connection default;
 
80
--echo Error: '$statement' doesn't allow concurrent inserts into '$table'!
 
81
}
 
82
 
 
83
--eval delete from $table where i = 0;
 
84
 
 
85
if (`SELECT '$restore_table' <> ''`)
 
86
{
 
87
--eval truncate table $restore_table;
 
88
--eval insert into $restore_table select * from t_backup;
 
89
drop temporary table t_backup;
 
90
}
 
91
 
 
92
# Clean-up. Reset DEBUG_SYNC facility after use.
 
93
set debug_sync= "RESET";
 
94
 
 
95
--enable_result_log
 
96
--enable_query_log