| 1 |
|
| 2 |
call mtr.add_suppression(".*test_sql_errors.*"); |
| 3 |
call mtr.add_suppression(".*Killing thread.*"); |
| 4 |
|
| 5 |
--echo # Creating tables |
| 6 |
CREATE TABLE t_int (c1 TINYINT, |
| 7 |
c2 SMALLINT, |
| 8 |
c3 MEDIUMINT, |
| 9 |
c4 INT, |
| 10 |
c5 INTEGER, |
| 11 |
c6 SMALLINT UNSIGNED, |
| 12 |
c7 MEDIUMINT UNSIGNED, |
| 13 |
c8 INT UNSIGNED, |
| 14 |
c9 INTEGER); |
| 15 |
|
| 16 |
CREATE TABLE t_bigint (c1 BIGINT, |
| 17 |
c2 BIGINT UNSIGNED); |
| 18 |
|
| 19 |
CREATE TABLE t_real (c1 REAL UNSIGNED, |
| 20 |
c2 DOUBLE UNSIGNED, |
| 21 |
c3 FLOAT UNSIGNED, |
| 22 |
c4 DECIMAL UNSIGNED, |
| 23 |
c5 NUMERIC UNSIGNED, |
| 24 |
c6 DOUBLE, |
| 25 |
c7 FLOAT, |
| 26 |
c8 DECIMAL, |
| 27 |
c9 NUMERIC); |
| 28 |
|
| 29 |
CREATE TABLE t_date (c1 DATE, |
| 30 |
c2 TIME, |
| 31 |
c3 TIMESTAMP, |
| 32 |
c4 DATETIME, |
| 33 |
c5 YEAR); |
| 34 |
|
| 35 |
CREATE TABLE t_char (c1 CHAR(32), |
| 36 |
c2 VARCHAR(128) BINARY, |
| 37 |
c3 VARCHAR(128), |
| 38 |
c4 BINARY(128), |
| 39 |
c5 VARBINARY(2048)); |
| 40 |
|
| 41 |
CREATE TABLE t_lob (c1 TINYBLOB, |
| 42 |
c2 BLOB, |
| 43 |
c3 MEDIUMBLOB, |
| 44 |
c4 LONGBLOB, |
| 45 |
c5 TINYTEXT, |
| 46 |
c6 TEXT, |
| 47 |
c7 MEDIUMTEXT, |
| 48 |
c8 LONGTEXT, |
| 49 |
c9 TINYTEXT BINARY, |
| 50 |
c10 TEXT BINARY, |
| 51 |
c11 MEDIUMTEXT BINARY, |
| 52 |
c12 LONGTEXT BINARY); |
| 53 |
|
| 54 |
CREATE TABLE t_spec (c1 BIT(16), |
| 55 |
c2 ENUM('v1','v2','v3'), |
| 56 |
c3 SET('v1','v2','v3')); |
| 57 |
|
| 58 |
SET @orig_log_error_verbosity= @@GLOBAL.log_error_verbosity; |
| 59 |
SET GLOBAL log_error_verbosity=3; |
| 60 |
|
| 61 |
--echo # Inserting values into the tables |
| 62 |
INSERT INTO t_int VALUES (91,92,93,94,95,96,97,98,99),(81,82,83,84,85,86,87,88,89); |
| 63 |
|
| 64 |
INSERT INTO t_bigint VALUES (91,92),(81,82); |
| 65 |
|
| 66 |
INSERT INTO t_real VALUES (8.51,8.52,8.53,8.54,8.55,8.56,8.57,8.58,8.59); |
| 67 |
|
| 68 |
INSERT INTO t_real VALUES (9.51,9.52,9.53,9.54,9.55,9.56,9.57,9.58,9.59); |
| 69 |
|
| 70 |
INSERT INTO t_date VALUES ('2015-07-06','20:15','2015-12-31 14:59:48','2014-11-30 13:58:47','2015'); |
| 71 |
|
| 72 |
INSERT INTO t_date VALUES ('2015-07-07','20:17','2013-12-31 17:59:47','2012-10-31 15:57:47','2010'); |
| 73 |
|
| 74 |
INSERT INTO t_char VALUES ('char-text','varchar-binary-text\nnext line','varchar-text','binary-text\nnext line','varbinary-text\nline 1\nline 2'); |
| 75 |
|
| 76 |
INSERT INTO t_char VALUES ('2char-text','2varchar-binary-text\nnext line','2varchar-text','2binary-text\nnext line','2varbinary-text\nline 1\nline 2'); |
| 77 |
|
| 78 |
INSERT INTO t_lob VALUES ('tinyblob-text readable','blob-text readable','mediumblob-text readable', |
| 79 |
'longblob-text readable','tinytext','text','mediumtext','longtext', |
| 80 |
'tinytext-binary\nnext line','text-binary\nnext line', |
| 81 |
'mediumtext-binary\nnext line','longtext-binary \nnext line'); |
| 82 |
|
| 83 |
INSERT INTO t_lob VALUES ('2tinyblob-text readable','2blob-text readable','2mediumblob-text readable', |
| 84 |
'2longblob-text readable','2tinytext','2text','2mediumtext','2longtext', |
| 85 |
'2tinytext-binary\nnext line','2text-binary\nnext line', |
| 86 |
'2mediumtext-binary\nnext line','2longtext-binary \nnext line'); |
| 87 |
|
| 88 |
INSERT INTO t_spec VALUES ( b'111', 'v1', 'v1'); |
| 89 |
|
| 90 |
|
| 91 |
--let GREP_FILE=$MYSQLTEST_VARDIR/log/mysqld.1.err |
| 92 |
|
| 93 |
--echo ########################################## |
| 94 |
--echo # Run plugin |
| 95 |
--echo ########################################## |
| 96 |
--replace_result $TEST_SQL_ERRORS TEST_SQL_ERRORS |
| 97 |
eval INSTALL PLUGIN test_sql_errors SONAME '$TEST_SQL_ERRORS'; |
| 98 |
|
| 99 |
--disable_ps_protocol |
| 100 |
--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> |
| 101 |
/*first*/SELECT * FROM information_schema.processlist ORDER BY id; |
| 102 |
--enable_ps_protocol |
| 103 |
|
| 104 |
--echo ########################################## |
| 105 |
--echo # Stop plugin |
| 106 |
--echo ########################################## |
| 107 |
UNINSTALL PLUGIN test_sql_errors; |
| 108 |
|
| 109 |
--disable_ps_protocol |
| 110 |
--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> |
| 111 |
/*first*/SELECT * FROM information_schema.processlist ORDER BY id; |
| 112 |
--enable_ps_protocol |
| 113 |
|
| 114 |
--echo ########################################## |
| 115 |
--echo # Cleanup |
| 116 |
--echo ########################################## |
| 117 |
|
| 118 |
--echo # Dropping the created tables |
| 119 |
DROP TABLE IF EXISTS t_int; |
| 120 |
DROP TABLE IF EXISTS t_bigint; |
| 121 |
DROP TABLE IF EXISTS t_real; |
| 122 |
DROP TABLE IF EXISTS t_date; |
| 123 |
DROP TABLE IF EXISTS t_char; |
| 124 |
DROP TABLE IF EXISTS t_lob; |
| 125 |
DROP TABLE IF EXISTS t_spec; |
| 126 |
|
| 127 |
--echo ########################################## |
| 128 |
--echo # Plugin log |
| 129 |
--echo ########################################## |
| 130 |
let $MYSQLD_DATADIR= `select @@datadir`; |
| 131 |
cat_file $MYSQLD_DATADIR/test_sql_errors.log; |
| 132 |
remove_file $MYSQLD_DATADIR/test_sql_errors.log; |
| 133 |
--echo ########################################## |
| 134 |
--echo # Server log |
| 135 |
--echo ########################################## |
| 136 |
--perl |
| 137 |
my $file= $ENV{'GREP_FILE'}; |
| 138 |
my $pattern= ".*test_sql_errors.*"; |
| 139 |
open(FILE, "$file") or die("Unable to open $file: $!\n"); |
| 140 |
my $count = 0; |
| 141 |
while (<FILE>) { |
| 142 |
if ($_ =~ m/$pattern/) { |
| 143 |
# print "$_\n"; |
| 144 |
$count++; |
| 145 |
break; |
| 146 |
} |
| 147 |
} |
| 148 |
# print "Count: $count\n"; |
| 149 |
if ($count >= 9){ |
| 150 |
print "test passed.\n"; |
| 151 |
} else { |
| 152 |
print "test failed.\n"; |
| 153 |
} |
| 154 |
close(FILE); |
| 155 |
EOF |
| 156 |
# The below force start is giving warnings in the server logs hence disabling warnings specifically |
| 157 |
--disable_warnings |
| 158 |
--source include/force_restart.inc |
| 159 |
--enable_warnings |
| 160 |
|
| 161 |
SET GLOBAL log_error_verbosity= @orig_log_error_verbosity; |