summaryrefslogtreecommitdiff
path: root/mysql-test/suite/percona/percona_log_warnings_suppress.test
blob: 82221013f0b3873218b521d86b1cd5e38ff1e829 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
-- source include/have_log_bin.inc
-- source include/have_binlog_format_statement.inc

SET @old_log_warnings = @@log_warnings;
SET @old_log_warnings_suppress = @@log_warnings_suppress;

--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1 (a VARCHAR(36), b VARCHAR(20));
SET GLOBAL log_warnings_suppress='';
SET GLOBAL LOG_WARNINGS=0;
SHOW GLOBAL VARIABLES LIKE 'log_warnings_suppress';
INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
SET GLOBAL LOG_WARNINGS=1;
INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
SET GLOBAL log_warnings_suppress='1592';
SET GLOBAL LOG_WARNINGS=0;
INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
SET GLOBAL LOG_WARNINGS=1;
INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
DROP TABLE t1;

SET GLOBAL log_warnings = @old_log_warnings;
SET GLOBAL log_warnings_suppress = @old_log_warnings_suppress;

let $log_error_= `SELECT @@GLOBAL.log_error`;
if(!`select LENGTH('$log_error_')`)
{
  # MySQL Server on windows is started with --console and thus
  # does not know the location of its .err log, use default location
  let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.1.err;
}
# Assign env variable LOG_ERROR
let LOG_ERROR=$log_error_;

--echo # Count the number of times the "Unsafe" message was printed
--echo # to the error log.

perl;
  use strict;
  my $log_error= $ENV{'LOG_ERROR'} or die "LOG_ERROR not set";
  open(FILE, "$log_error") or die("Unable to open $log_error: $!\n");
  my $count = () = grep(/suppress_1592/g,<FILE>);
  print "Occurrences: $count\n";
  close(FILE);
EOF