142 lines
5.8 KiB
Plaintext
142 lines
5.8 KiB
Plaintext
call mtr.add_suppression("Event 'MYSQL_AUDIT_GENERAL_ERROR' cannot be aborted.");
|
|
#
|
|
# Bug #22142209: MY_MESSAGE FAILS TO ABORT MYSQL_AUDIT_SERVER_STARTUP_CLASS EVENT
|
|
#
|
|
# Shutdown the server
|
|
# Load the plugin at startup and abort on STARTUP with default message
|
|
# Search for default abort message
|
|
Pattern "\[ERROR\] \[[^]]*\] \[[^]]*\] Aborted by Audit API \(\'MYSQL_AUDIT_SERVER_STARTUP_STARTUP\'.1\)\." not found
|
|
# Load the plugin at startup and abort on STARTUP event with custom message
|
|
# Search for custom abort message
|
|
Pattern "\[ERROR\] \[[^]]*\] \[[^]]*\] Abort message custom" not found
|
|
# Startup the server
|
|
#
|
|
# Bug #22136709: INFINITE RECURSION BY CALLING MY_MESSAGE FROM
|
|
# MYSQL_AUDIT_GENERAL_CLASS HANDLER
|
|
INSTALL PLUGIN null_audit SONAME 'adt_null.so';
|
|
SET @@GLOBAL.null_audit_event_order_check= "MYSQL_AUDIT_GENERAL_ERROR;;ABORT_RET";
|
|
SET @@GLOBAL.null_audit_abort_message= "Abort message.";
|
|
# Try to enter error state recursively 2 times.
|
|
SET @@GLOBAL.null_audit_event_order_check_consume_ignore_count= 2;
|
|
connect(localhost,wrong_root,,test,MASTER_PORT,MASTER_SOCKET);
|
|
ERROR 28000: Access denied for user 'wrong_root'@'localhost' (using password: NO)
|
|
SELECT @@null_audit_event_order_check_consume_ignore_count;
|
|
@@null_audit_event_order_check_consume_ignore_count
|
|
0
|
|
# Try to enter error state infinitely. my_message calls cause stack overrun.
|
|
SET @@GLOBAL.null_audit_event_order_check_consume_ignore_count= 10000;
|
|
connect(localhost,wrong_root,,test,MASTER_PORT,MASTER_SOCKET);
|
|
SELECT @@null_audit_event_order_check_consume_ignore_count;
|
|
@@null_audit_event_order_check_consume_ignore_count
|
|
0
|
|
SET @@GLOBAL.null_audit_event_order_check= NULL;
|
|
SET @@GLOBAL.null_audit_abort_message= NULL;
|
|
SET @@GLOBAL.null_audit_event_order_check_consume_ignore_count= 0;
|
|
End of 5.7 tests
|
|
#
|
|
# Bug#24961932 - create function at bootstrap attempts to evaluate
|
|
# non-resolved expressions
|
|
#
|
|
# Initial value of the status variable "Audit_null_global_variable_get".
|
|
SELECT variable_value FROM performance_schema.global_status
|
|
WHERE variable_name = 'Audit_null_global_variable_get'
|
|
INTO @initial_global_var_get_count;
|
|
CREATE PROCEDURE check_global_var_count()
|
|
BEGIN
|
|
SELECT variable_value FROM performance_schema.global_status
|
|
WHERE variable_name = 'Audit_null_global_variable_get'
|
|
INTO @cur_global_var_get_count;
|
|
SELECT @cur_global_var_get_count - @initial_global_var_get_count AS
|
|
global_var_count;
|
|
END
|
|
$
|
|
# Procedure p1 using global system variables.
|
|
CREATE PROCEDURE p1()
|
|
BEGIN
|
|
SET @a=@@global.max_execution_time;
|
|
CREATE TABLE t1 AS SELECT @@global.max_execution_time;
|
|
DROP TABLE t1;
|
|
SELECT @@global.optimizer_trace, @@session.max_execution_time;
|
|
END
|
|
$
|
|
# Without fix, non-resolved expression is evaluated to audit the global
|
|
# system variable get event while creating the stored routines.
|
|
# The audit for the system variable get event should be done while
|
|
# executing the stored routine but not while creating it. With the fix,
|
|
# global system variable get event is audited while executing the stored
|
|
# routine. At this time, expression is resolved. Hence status variable
|
|
# "Audit_null_global_variable_get" remains unchanged while creating the
|
|
# stored routine.
|
|
CALL check_global_var_count();
|
|
global_var_count
|
|
0
|
|
# The same issue exits with the prepared statement too. With the fix,
|
|
# system variable get event is not audited while preparing the statement.
|
|
# Instead it is done while executing the statement. Hence status variable
|
|
# "Audit_null_global_variable_get" remains same here too.
|
|
PREPARE stmt FROM 'SELECT @@global.max_execution_time,@@global.optimizer_trace';
|
|
CALL check_global_var_count();
|
|
global_var_count
|
|
0
|
|
# With the fix, system variable get event is audited on each execution of
|
|
# the routine. Hence status variable "Audit_null_global_variable_get" is
|
|
# incremented by value three by p1() here.
|
|
CALL p1();
|
|
@@global.optimizer_trace @@session.max_execution_time
|
|
enabled=off,one_line=off 0
|
|
CALL check_global_var_count();
|
|
global_var_count
|
|
14
|
|
# With the fix, system variable get event is audited on each execution of
|
|
# the routine. Hence status variable "Audit_null_global_variable_get" is
|
|
# incremented by value three by p1() here.
|
|
CALL p1();
|
|
@@global.optimizer_trace @@session.max_execution_time
|
|
enabled=off,one_line=off 0
|
|
CALL check_global_var_count();
|
|
global_var_count
|
|
17
|
|
# System variable get event is audited for global variables only. Hence
|
|
# status variable "Audit_null_global_variable_get" remain same here.
|
|
SELECT @@session.max_execution_time, @@session.optimizer_trace;
|
|
@@session.max_execution_time @@session.optimizer_trace
|
|
0 enabled=off,one_line=off
|
|
CALL check_global_var_count();
|
|
global_var_count
|
|
17
|
|
# With the fix, system variable get event is audited on each execution of
|
|
# the prepared statement. Hence status "Audit_null_global_variable_get"
|
|
# variable is incremented by value two here.
|
|
EXECUTE stmt;
|
|
@@global.max_execution_time @@global.optimizer_trace
|
|
0 enabled=off,one_line=off
|
|
CALL check_global_var_count();
|
|
global_var_count
|
|
19
|
|
# With the fix, system variable get event is audited on each execution of
|
|
# the prepared statement. Hence status "Audit_null_global_variable_get"
|
|
# variable is incremented by value two here.
|
|
EXECUTE stmt;
|
|
@@global.max_execution_time @@global.optimizer_trace
|
|
0 enabled=off,one_line=off
|
|
CALL check_global_var_count();
|
|
global_var_count
|
|
21
|
|
# Verify if system variable get event is audited in the simple select.
|
|
# Status variable "Audit_null_global_variable_get" is incremented by
|
|
# value two here.
|
|
SELECT @@global.max_execution_time, @@global.optimizer_trace;
|
|
@@global.max_execution_time @@global.optimizer_trace
|
|
0 enabled=off,one_line=off
|
|
CALL check_global_var_count();
|
|
global_var_count
|
|
23
|
|
DROP PROCEDURE p1;
|
|
DROP PROCEDURE check_global_var_count;
|
|
DROP PREPARE stmt;
|
|
End of 8.0 tests
|
|
# cleanup
|
|
UNINSTALL PLUGIN null_audit;
|
|
Warnings:
|
|
Warning 1620 Plugin is busy and will be uninstalled on shutdown
|