Commit c44c9231 authored by unknown's avatar unknown

MDEV-4345: Fixed system variables tests.

parent 9441e536
...@@ -10,6 +10,5 @@ there should be *no* long test name listed below: ...@@ -10,6 +10,5 @@ there should be *no* long test name listed below:
select distinct variable_name as `there should be *no* variables listed below:` from t2 select distinct variable_name as `there should be *no* variables listed below:` from t2
left join t1 on variable_name=test_name where test_name is null; left join t1 on variable_name=test_name where test_name is null;
there should be *no* variables listed below: there should be *no* variables listed below:
optimizer_selectivity_sampling_limit
drop table t1; drop table t1;
drop table t2; drop table t2;
SET @start_global_value = @@global.optimizer_selectivity_sampling_limit;
SELECT @start_global_value;
@start_global_value
5000
SET @start_session_value = @@session.optimizer_selectivity_sampling_limit;
SELECT @start_session_value;
@start_session_value
5000
'#--------------------FN_DYNVARS_115_01-------------------------#'
SET @@global.optimizer_selectivity_sampling_limit = DEFAULT;
SELECT @@global.optimizer_selectivity_sampling_limit;
@@global.optimizer_selectivity_sampling_limit
5000
SET @@session.optimizer_selectivity_sampling_limit = DEFAULT;
SELECT @@session.optimizer_selectivity_sampling_limit;
@@session.optimizer_selectivity_sampling_limit
5000
'#--------------------FN_DYNVARS_115_02-------------------------#'
SET @@global.optimizer_selectivity_sampling_limit = DEFAULT;
SELECT @@global.optimizer_selectivity_sampling_limit = 5000;
@@global.optimizer_selectivity_sampling_limit = 5000
1
SET @@session.optimizer_selectivity_sampling_limit = DEFAULT;
SELECT @@session.optimizer_selectivity_sampling_limit = 5000;
@@session.optimizer_selectivity_sampling_limit = 5000
1
'#--------------------FN_DYNVARS_115_03-------------------------#'
SELECT @@global.optimizer_selectivity_sampling_limit;
@@global.optimizer_selectivity_sampling_limit
5000
SET @@global.optimizer_selectivity_sampling_limit = 9;
Warnings:
Warning 1292 Truncated incorrect optimizer_selectivity_sampling_l value: '9'
SELECT @@global.optimizer_selectivity_sampling_limit;
@@global.optimizer_selectivity_sampling_limit
10
SET @@global.optimizer_selectivity_sampling_limit = 10;
SELECT @@global.optimizer_selectivity_sampling_limit;
@@global.optimizer_selectivity_sampling_limit
10
SET @@global.optimizer_selectivity_sampling_limit = 11;
SELECT @@global.optimizer_selectivity_sampling_limit;
@@global.optimizer_selectivity_sampling_limit
11
SET @@global.optimizer_selectivity_sampling_limit = 7777;
SELECT @@global.optimizer_selectivity_sampling_limit;
@@global.optimizer_selectivity_sampling_limit
7777
SET @@global.optimizer_selectivity_sampling_limit = 4294967294;
SELECT @@global.optimizer_selectivity_sampling_limit;
@@global.optimizer_selectivity_sampling_limit
4294967294
SET @@global.optimizer_selectivity_sampling_limit = 4294967295;
SELECT @@global.optimizer_selectivity_sampling_limit;
@@global.optimizer_selectivity_sampling_limit
4294967295
SET @@global.optimizer_selectivity_sampling_limit = 4294967296;
Warnings:
Warning 1292 Truncated incorrect optimizer_selectivity_sampling_l value: '4294967296'
SELECT @@global.optimizer_selectivity_sampling_limit;
@@global.optimizer_selectivity_sampling_limit
4294967295
'#--------------------FN_DYNVARS_115_04-------------------------#'
SELECT @@session.optimizer_selectivity_sampling_limit;
@@session.optimizer_selectivity_sampling_limit
5000
SET @@session.optimizer_selectivity_sampling_limit = 9;
Warnings:
Warning 1292 Truncated incorrect optimizer_selectivity_sampling_l value: '9'
SELECT @@session.optimizer_selectivity_sampling_limit;
@@session.optimizer_selectivity_sampling_limit
10
SET @@session.optimizer_selectivity_sampling_limit = 10;
SELECT @@session.optimizer_selectivity_sampling_limit;
@@session.optimizer_selectivity_sampling_limit
10
SET @@session.optimizer_selectivity_sampling_limit = 11;
SELECT @@session.optimizer_selectivity_sampling_limit;
@@session.optimizer_selectivity_sampling_limit
11
SET @@session.optimizer_selectivity_sampling_limit = 7777;
SELECT @@session.optimizer_selectivity_sampling_limit;
@@session.optimizer_selectivity_sampling_limit
7777
SET @@session.optimizer_selectivity_sampling_limit = 4294967294;
SELECT @@session.optimizer_selectivity_sampling_limit;
@@session.optimizer_selectivity_sampling_limit
4294967294
SET @@session.optimizer_selectivity_sampling_limit = 4294967295;
SELECT @@session.optimizer_selectivity_sampling_limit;
@@session.optimizer_selectivity_sampling_limit
4294967295
SET @@session.optimizer_selectivity_sampling_limit = 4294967296;
Warnings:
Warning 1292 Truncated incorrect optimizer_selectivity_sampling_l value: '4294967296'
SELECT @@session.optimizer_selectivity_sampling_limit;
@@session.optimizer_selectivity_sampling_limit
4294967295
'#------------------FN_DYNVARS_115_05-----------------------#'
SET @@global.optimizer_selectivity_sampling_limit = ON;
ERROR 42000: Incorrect argument type to variable 'optimizer_selectivity_sampling_limit'
SET @@global.optimizer_selectivity_sampling_limit = OFF;
ERROR 42000: Incorrect argument type to variable 'optimizer_selectivity_sampling_limit'
SET @@session.optimizer_selectivity_sampling_limit = 65530.34;
ERROR 42000: Incorrect argument type to variable 'optimizer_selectivity_sampling_limit'
SET @@session.optimizer_selectivity_sampling_limit = test;
ERROR 42000: Incorrect argument type to variable 'optimizer_selectivity_sampling_limit'
'#------------------FN_DYNVARS_115_06-----------------------#'
SELECT @@global.optimizer_selectivity_sampling_limit = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='optimizer_selectivity_sampling_limit';
@@global.optimizer_selectivity_sampling_limit = VARIABLE_VALUE
1
'#------------------FN_DYNVARS_115_07-----------------------#'
SELECT @@session.optimizer_selectivity_sampling_limit = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='optimizer_selectivity_sampling_limit';
@@session.optimizer_selectivity_sampling_limit = VARIABLE_VALUE
1
'#---------------------FN_DYNVARS_115_08----------------------#'
SET @@optimizer_selectivity_sampling_limit = 10;
SET @@global.optimizer_selectivity_sampling_limit = 30;
SELECT @@optimizer_selectivity_sampling_limit = @@global.optimizer_selectivity_sampling_limit;
@@optimizer_selectivity_sampling_limit = @@global.optimizer_selectivity_sampling_limit
0
'#---------------------FN_DYNVARS_115_09----------------------#'
SET @@optimizer_selectivity_sampling_limit = 20;
SELECT @@optimizer_selectivity_sampling_limit = @@local.optimizer_selectivity_sampling_limit;
@@optimizer_selectivity_sampling_limit = @@local.optimizer_selectivity_sampling_limit
1
SELECT @@local.optimizer_selectivity_sampling_limit = @@session.optimizer_selectivity_sampling_limit;
@@local.optimizer_selectivity_sampling_limit = @@session.optimizer_selectivity_sampling_limit
1
SET @@global.optimizer_selectivity_sampling_limit = @start_global_value;
SELECT @@global.optimizer_selectivity_sampling_limit;
@@global.optimizer_selectivity_sampling_limit
5000
SET @@session.optimizer_selectivity_sampling_limit = @start_session_value;
SELECT @@session.optimizer_selectivity_sampling_limit;
@@session.optimizer_selectivity_sampling_limit
5000
...@@ -28,6 +28,12 @@ SELECT @@session.optimizer_use_condition_selectivity = 1; ...@@ -28,6 +28,12 @@ SELECT @@session.optimizer_use_condition_selectivity = 1;
SELECT @@global.optimizer_use_condition_selectivity; SELECT @@global.optimizer_use_condition_selectivity;
@@global.optimizer_use_condition_selectivity @@global.optimizer_use_condition_selectivity
1 1
SET @@global.optimizer_use_condition_selectivity = 0;
Warnings:
Warning 1292 Truncated incorrect optimizer_use_condition_selectiv value: '0'
SELECT @@global.optimizer_use_condition_selectivity;
@@global.optimizer_use_condition_selectivity
1
SET @@global.optimizer_use_condition_selectivity = 1; SET @@global.optimizer_use_condition_selectivity = 1;
SELECT @@global.optimizer_use_condition_selectivity; SELECT @@global.optimizer_use_condition_selectivity;
@@global.optimizer_use_condition_selectivity @@global.optimizer_use_condition_selectivity
...@@ -44,10 +50,26 @@ SET @@global.optimizer_use_condition_selectivity = 4; ...@@ -44,10 +50,26 @@ SET @@global.optimizer_use_condition_selectivity = 4;
SELECT @@global.optimizer_use_condition_selectivity; SELECT @@global.optimizer_use_condition_selectivity;
@@global.optimizer_use_condition_selectivity @@global.optimizer_use_condition_selectivity
4 4
SET @@global.optimizer_use_condition_selectivity = 5;
SELECT @@global.optimizer_use_condition_selectivity;
@@global.optimizer_use_condition_selectivity
5
SET @@global.optimizer_use_condition_selectivity = 6;
Warnings:
Warning 1292 Truncated incorrect optimizer_use_condition_selectiv value: '6'
SELECT @@global.optimizer_use_condition_selectivity;
@@global.optimizer_use_condition_selectivity
5
'#--------------------FN_DYNVARS_115_04-------------------------#' '#--------------------FN_DYNVARS_115_04-------------------------#'
SELECT @@session.optimizer_use_condition_selectivity; SELECT @@session.optimizer_use_condition_selectivity;
@@session.optimizer_use_condition_selectivity @@session.optimizer_use_condition_selectivity
1 1
SET @@session.optimizer_use_condition_selectivity = 0;
Warnings:
Warning 1292 Truncated incorrect optimizer_use_condition_selectiv value: '0'
SELECT @@session.optimizer_use_condition_selectivity;
@@session.optimizer_use_condition_selectivity
1
SET @@session.optimizer_use_condition_selectivity = 1; SET @@session.optimizer_use_condition_selectivity = 1;
SELECT @@session.optimizer_use_condition_selectivity; SELECT @@session.optimizer_use_condition_selectivity;
@@session.optimizer_use_condition_selectivity @@session.optimizer_use_condition_selectivity
...@@ -64,6 +86,16 @@ SET @@session.optimizer_use_condition_selectivity = 4; ...@@ -64,6 +86,16 @@ SET @@session.optimizer_use_condition_selectivity = 4;
SELECT @@session.optimizer_use_condition_selectivity; SELECT @@session.optimizer_use_condition_selectivity;
@@session.optimizer_use_condition_selectivity @@session.optimizer_use_condition_selectivity
4 4
SET @@session.optimizer_use_condition_selectivity = 5;
SELECT @@session.optimizer_use_condition_selectivity;
@@session.optimizer_use_condition_selectivity
5
SET @@session.optimizer_use_condition_selectivity = 6;
Warnings:
Warning 1292 Truncated incorrect optimizer_use_condition_selectiv value: '6'
SELECT @@session.optimizer_use_condition_selectivity;
@@session.optimizer_use_condition_selectivity
5
'#------------------FN_DYNVARS_115_05-----------------------#' '#------------------FN_DYNVARS_115_05-----------------------#'
SET @@global.optimizer_use_condition_selectivity = ON; SET @@global.optimizer_use_condition_selectivity = ON;
ERROR 42000: Incorrect argument type to variable 'optimizer_use_condition_selectivity' ERROR 42000: Incorrect argument type to variable 'optimizer_use_condition_selectivity'
......
--source include/load_sysvars.inc
#################################################################
# START OF optimizer_selectivity_sampling_limit TESTS #
#################################################################
#############################################################
# Save initial value #
#############################################################
SET @start_global_value = @@global.optimizer_selectivity_sampling_limit;
SELECT @start_global_value;
SET @start_session_value = @@session.optimizer_selectivity_sampling_limit;
SELECT @start_session_value;
--echo '#--------------------FN_DYNVARS_115_01-------------------------#'
#########################################################################
# Display the DEFAULT value of optimizer_selectivity_sampling_limit #
#########################################################################
SET @@global.optimizer_selectivity_sampling_limit = DEFAULT;
SELECT @@global.optimizer_selectivity_sampling_limit;
SET @@session.optimizer_selectivity_sampling_limit = DEFAULT;
SELECT @@session.optimizer_selectivity_sampling_limit;
--echo '#--------------------FN_DYNVARS_115_02-------------------------#'
#########################################################################
# Check the DEFAULT value of optimizer_selectivity_sampling_limit #
#########################################################################
SET @@global.optimizer_selectivity_sampling_limit = DEFAULT;
SELECT @@global.optimizer_selectivity_sampling_limit = 5000;
SET @@session.optimizer_selectivity_sampling_limit = DEFAULT;
SELECT @@session.optimizer_selectivity_sampling_limit = 5000;
--echo '#--------------------FN_DYNVARS_115_03-------------------------#'
#############################################################################################
# Change the value of optimizer_selectivity_sampling_limit to a valid value for GLOBAL Scope #
#############################################################################################
SELECT @@global.optimizer_selectivity_sampling_limit;
SET @@global.optimizer_selectivity_sampling_limit = 9;
SELECT @@global.optimizer_selectivity_sampling_limit;
SET @@global.optimizer_selectivity_sampling_limit = 10;
SELECT @@global.optimizer_selectivity_sampling_limit;
SET @@global.optimizer_selectivity_sampling_limit = 11;
SELECT @@global.optimizer_selectivity_sampling_limit;
SET @@global.optimizer_selectivity_sampling_limit = 7777;
SELECT @@global.optimizer_selectivity_sampling_limit;
SET @@global.optimizer_selectivity_sampling_limit = 4294967294;
SELECT @@global.optimizer_selectivity_sampling_limit;
SET @@global.optimizer_selectivity_sampling_limit = 4294967295;
SELECT @@global.optimizer_selectivity_sampling_limit;
SET @@global.optimizer_selectivity_sampling_limit = 4294967296;
SELECT @@global.optimizer_selectivity_sampling_limit;
--echo '#--------------------FN_DYNVARS_115_04-------------------------#'
#############################################################################################
# Change the value of optimizer_selectivity_sampling_limit to a valid value for SESSION Scope#
#############################################################################################
SELECT @@session.optimizer_selectivity_sampling_limit;
SET @@session.optimizer_selectivity_sampling_limit = 9;
SELECT @@session.optimizer_selectivity_sampling_limit;
SET @@session.optimizer_selectivity_sampling_limit = 10;
SELECT @@session.optimizer_selectivity_sampling_limit;
SET @@session.optimizer_selectivity_sampling_limit = 11;
SELECT @@session.optimizer_selectivity_sampling_limit;
SET @@session.optimizer_selectivity_sampling_limit = 7777;
SELECT @@session.optimizer_selectivity_sampling_limit;
SET @@session.optimizer_selectivity_sampling_limit = 4294967294;
SELECT @@session.optimizer_selectivity_sampling_limit;
SET @@session.optimizer_selectivity_sampling_limit = 4294967295;
SELECT @@session.optimizer_selectivity_sampling_limit;
SET @@session.optimizer_selectivity_sampling_limit = 4294967296;
SELECT @@session.optimizer_selectivity_sampling_limit;
--echo '#------------------FN_DYNVARS_115_05-----------------------#'
###############################################################################
# Change the value of optimizer_selectivity_sampling_limit to an invalid value #
##############################################################################
--Error ER_WRONG_TYPE_FOR_VAR
SET @@global.optimizer_selectivity_sampling_limit = ON;
--Error ER_WRONG_TYPE_FOR_VAR
SET @@global.optimizer_selectivity_sampling_limit = OFF;
--Error ER_WRONG_TYPE_FOR_VAR
SET @@session.optimizer_selectivity_sampling_limit = 65530.34;
--Error ER_WRONG_TYPE_FOR_VAR
SET @@session.optimizer_selectivity_sampling_limit = test;
--echo '#------------------FN_DYNVARS_115_06-----------------------#'
####################################################################
# Check if the value in GLOBAL Table matches value in variable #
####################################################################
SELECT @@global.optimizer_selectivity_sampling_limit = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='optimizer_selectivity_sampling_limit';
--echo '#------------------FN_DYNVARS_115_07-----------------------#'
####################################################################
# Check if the value in SESSION Table matches value in variable #
####################################################################
SELECT @@session.optimizer_selectivity_sampling_limit = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='optimizer_selectivity_sampling_limit';
--echo '#---------------------FN_DYNVARS_115_08----------------------#'
###############################################################################
# Check if global and session variable are independent of each other #
###############################################################################
SET @@optimizer_selectivity_sampling_limit = 10;
SET @@global.optimizer_selectivity_sampling_limit = 30;
SELECT @@optimizer_selectivity_sampling_limit = @@global.optimizer_selectivity_sampling_limit;
--echo '#---------------------FN_DYNVARS_115_09----------------------#'
###############################################################################
# Check if accessing variable with SESSION,LOCAL and without SCOPE points #
# to same session variable #
###############################################################################
SET @@optimizer_selectivity_sampling_limit = 20;
SELECT @@optimizer_selectivity_sampling_limit = @@local.optimizer_selectivity_sampling_limit;
SELECT @@local.optimizer_selectivity_sampling_limit = @@session.optimizer_selectivity_sampling_limit;
####################################
# Restore initial value #
####################################
SET @@global.optimizer_selectivity_sampling_limit = @start_global_value;
SELECT @@global.optimizer_selectivity_sampling_limit;
SET @@session.optimizer_selectivity_sampling_limit = @start_session_value;
SELECT @@session.optimizer_selectivity_sampling_limit;
########################################################################
# END OF optimizer_selectivity_sampling_limit TESTS #
########################################################################
...@@ -45,6 +45,8 @@ SELECT @@session.optimizer_use_condition_selectivity = 1; ...@@ -45,6 +45,8 @@ SELECT @@session.optimizer_use_condition_selectivity = 1;
# Change the value of optimizer_use_condition_selectivity to a valid value for GLOBAL Scope # # Change the value of optimizer_use_condition_selectivity to a valid value for GLOBAL Scope #
############################################################################################# #############################################################################################
SELECT @@global.optimizer_use_condition_selectivity;
SET @@global.optimizer_use_condition_selectivity = 0;
SELECT @@global.optimizer_use_condition_selectivity; SELECT @@global.optimizer_use_condition_selectivity;
SET @@global.optimizer_use_condition_selectivity = 1; SET @@global.optimizer_use_condition_selectivity = 1;
SELECT @@global.optimizer_use_condition_selectivity; SELECT @@global.optimizer_use_condition_selectivity;
...@@ -54,6 +56,10 @@ SET @@global.optimizer_use_condition_selectivity = 3; ...@@ -54,6 +56,10 @@ SET @@global.optimizer_use_condition_selectivity = 3;
SELECT @@global.optimizer_use_condition_selectivity; SELECT @@global.optimizer_use_condition_selectivity;
SET @@global.optimizer_use_condition_selectivity = 4; SET @@global.optimizer_use_condition_selectivity = 4;
SELECT @@global.optimizer_use_condition_selectivity; SELECT @@global.optimizer_use_condition_selectivity;
SET @@global.optimizer_use_condition_selectivity = 5;
SELECT @@global.optimizer_use_condition_selectivity;
SET @@global.optimizer_use_condition_selectivity = 6;
SELECT @@global.optimizer_use_condition_selectivity;
--echo '#--------------------FN_DYNVARS_115_04-------------------------#' --echo '#--------------------FN_DYNVARS_115_04-------------------------#'
...@@ -61,6 +67,8 @@ SELECT @@global.optimizer_use_condition_selectivity; ...@@ -61,6 +67,8 @@ SELECT @@global.optimizer_use_condition_selectivity;
# Change the value of optimizer_use_condition_selectivity to a valid value for SESSION Scope# # Change the value of optimizer_use_condition_selectivity to a valid value for SESSION Scope#
############################################################################################# #############################################################################################
SELECT @@session.optimizer_use_condition_selectivity;
SET @@session.optimizer_use_condition_selectivity = 0;
SELECT @@session.optimizer_use_condition_selectivity; SELECT @@session.optimizer_use_condition_selectivity;
SET @@session.optimizer_use_condition_selectivity = 1; SET @@session.optimizer_use_condition_selectivity = 1;
SELECT @@session.optimizer_use_condition_selectivity; SELECT @@session.optimizer_use_condition_selectivity;
...@@ -70,6 +78,10 @@ SET @@session.optimizer_use_condition_selectivity = 3; ...@@ -70,6 +78,10 @@ SET @@session.optimizer_use_condition_selectivity = 3;
SELECT @@session.optimizer_use_condition_selectivity; SELECT @@session.optimizer_use_condition_selectivity;
SET @@session.optimizer_use_condition_selectivity = 4; SET @@session.optimizer_use_condition_selectivity = 4;
SELECT @@session.optimizer_use_condition_selectivity; SELECT @@session.optimizer_use_condition_selectivity;
SET @@session.optimizer_use_condition_selectivity = 5;
SELECT @@session.optimizer_use_condition_selectivity;
SET @@session.optimizer_use_condition_selectivity = 6;
SELECT @@session.optimizer_use_condition_selectivity;
--echo '#------------------FN_DYNVARS_115_05-----------------------#' --echo '#------------------FN_DYNVARS_115_05-----------------------#'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment