summaryrefslogtreecommitdiff
path: root/mysql-test/suite/sys_vars/t/innodb_adaptive_max_sleep_delay_basic.test
blob: a2508b073ebbf3f55a1f6d5676d6f51d75a60a8b (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
################## mysql-test/t/innodb_adaptive_max_sleep_delay.test ##########
#                                                                             #
# Variable Name: innodb_adaptive_max_sleep_delay                              #
# Scope: Global                                                               #
# Access Type: Dynamic                                                        #
# Data Type: numeric                                                          #
#                                                                             #
# Note: This variable is only defined if innodb_have_atomic_builtins=ON       #
#                                                                             #
# Creation Date: 2011-08-17                                                   #
# Author : Sunny Bains                                                        #
#                                                                             #
#                                                                             #
# Description: Dynamic config global variable innodb_adaptive_max_sleep_delay #
#              * Value check                                                  #
#              * Scope check                                                  #
#                                                                             #
###############################################################################

--source include/have_innodb.inc

# Check if builtins are enabled
if (`SELECT LOWER(VARIABLE_VALUE)='off' FROM INFORMATION_SCHEMA.GLOBAL_STATUS
    WHERE LOWER(variable_name) = 'innodb_have_atomic_builtins'`) {
	--skip Test requires InnoDB atomic builtins
}

# Display default value
SELECT @@GLOBAL.innodb_adaptive_max_sleep_delay;
--echo 150000 Expected

# Check if value can be set
SET @@GLOBAL.innodb_adaptive_max_sleep_delay=100;

# Check for out of bounds
SET @@GLOBAL.innodb_adaptive_max_sleep_delay=1000001;
SELECT @@GLOBAL.innodb_adaptive_max_sleep_delay;
--echo 1000000 Expected

SET @@GLOBAL.innodb_adaptive_max_sleep_delay=-1;
SELECT @@GLOBAL.innodb_adaptive_max_sleep_delay;
--echo 0 Expected

SELECT COUNT(@@GLOBAL.innodb_adaptive_max_sleep_delay);
--echo 1 Expected

# Check if the value in GLOBAL table matches value in variable
SELECT VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_adaptive_max_sleep_delay';
--echo 100 Expected

# Check if accessing variable with and without GLOBAL point to same
# variable
SELECT @@innodb_adaptive_max_sleep_delay = @@GLOBAL.innodb_adaptive_max_sleep_delay;
--echo 1000000 Expected

# Check if innodb_adaptive_max_sleep_delay can be accessed with and
# without @@ sign.
SELECT COUNT(@@innodb_adaptive_max_sleep_delay);
--echo 1 Expected

--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT COUNT(@@local.innodb_adaptive_max_sleep_delay);
--echo Expected error 'Variable is a GLOBAL variable'

--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT COUNT(@@SESSION.innodb_adaptive_max_sleep_delay);
--echo Expected error 'Variable is a GLOBAL variable'

--Error ER_BAD_FIELD_ERROR
SELECT innodb_adaptive_max_sleep_delay = @@SESSION.innodb_adaptive_max_sleep_delay;

# Reset the default
SET @@GLOBAL.innodb_adaptive_max_sleep_delay=150000;