diff --git a/mysql-test/include/have_32bit.inc b/mysql-test/include/have_32bit.inc
index 66684fb5325..cab45f03fdf 100644
--- a/mysql-test/include/have_32bit.inc
+++ b/mysql-test/include/have_32bit.inc
@@ -3,10 +3,10 @@
 
 --disable_query_log
 --disable_warnings
-let $save = `SELECT @@global.sort_buffer_size`;
-SET @@global.sort_buffer_size = 4294967296;
-let $mach32 = `SELECT @@global.sort_buffer_size <= 4294967295`;
-eval SET @@global.sort_buffer_size = $save;
+let $save = `SELECT @@pseudo_thread_id`;
+SET @@pseudo_thread_id = 4294967296;
+let $mach32 = `SELECT @@pseudo_thread_id <= 4294967295`;
+eval SET @@pseudo_thread_id = $save;
 --enable_warnings
 --enable_query_log
 if (!$mach32)
diff --git a/mysql-test/include/have_64bit.inc b/mysql-test/include/have_64bit.inc
index cbba5e1d338..39a1d6db34d 100644
--- a/mysql-test/include/have_64bit.inc
+++ b/mysql-test/include/have_64bit.inc
@@ -2,10 +2,10 @@
 # see also have_32bit.inc
 
 --disable_query_log
-let $save = `SELECT @@session.sort_buffer_size`;
-SET @@session.sort_buffer_size = 4294967296;
-let $mach64 = `SELECT @@session.sort_buffer_size > 4294967295`;
-eval SET @@session.sort_buffer_size = $save;
+let $save = `SELECT @@pseudo_thread_id`;
+SET @@pseudo_thread_id = 4294967296;
+let $mach64 = `SELECT @@pseudo_thread_id > 4294967295`;
+eval SET @@pseudo_thread_id = $save;
 --enable_query_log
 if (!$mach64)
 {
diff --git a/mysql-test/suite/sys_vars/r/aria_repair_threads_basic.result b/mysql-test/suite/sys_vars/r/aria_repair_threads_basic.result
index 947dc182fc0..b070191e212 100644
--- a/mysql-test/suite/sys_vars/r/aria_repair_threads_basic.result
+++ b/mysql-test/suite/sys_vars/r/aria_repair_threads_basic.result
@@ -38,9 +38,6 @@ select @@global.aria_repair_threads;
 @@global.aria_repair_threads
 1
 set session aria_repair_threads=cast(-1 as unsigned int);
-Warnings:
-Note	1105	Cast to unsigned converted negative integer to it's positive complement
-Note	1105	Cast to unsigned converted negative integer to it's positive complement
 select @@session.aria_repair_threads;
 @@session.aria_repair_threads
 18446744073709551615
diff --git a/mysql-test/suite/sys_vars/r/aria_sort_buffer_size_basic.result b/mysql-test/suite/sys_vars/r/aria_sort_buffer_size_basic.result
index 4d4fba9a543..cf067c7e7b6 100644
--- a/mysql-test/suite/sys_vars/r/aria_sort_buffer_size_basic.result
+++ b/mysql-test/suite/sys_vars/r/aria_sort_buffer_size_basic.result
@@ -38,9 +38,6 @@ select @@global.aria_sort_buffer_size;
 @@global.aria_sort_buffer_size
 4
 set session aria_sort_buffer_size=cast(-1 as unsigned int);
-Warnings:
-Note	1105	Cast to unsigned converted negative integer to it's positive complement
-Note	1105	Cast to unsigned converted negative integer to it's positive complement
 select @@session.aria_sort_buffer_size;
 @@session.aria_sort_buffer_size
 18446744073709551615
diff --git a/mysql-test/suite/sys_vars/r/binlog_cache_size_basic_32.result b/mysql-test/suite/sys_vars/r/binlog_cache_size_basic_32.result
index d378765d96f..915a2383435 100644
--- a/mysql-test/suite/sys_vars/r/binlog_cache_size_basic_32.result
+++ b/mysql-test/suite/sys_vars/r/binlog_cache_size_basic_32.result
@@ -59,7 +59,7 @@ Warnings:
 Warning	1292	Truncated incorrect binlog_cache_size value: '42949672950'
 SELECT @@global.binlog_cache_size;
 @@global.binlog_cache_size
-4294963200
+42949668864
 'Bug: Errors are not coming on assigning invalid values to variable'
 SET @@global.binlog_cache_size = ON;
 ERROR 42000: Incorrect argument type to variable 'binlog_cache_size'
@@ -97,7 +97,7 @@ SELECT @@binlog_cache_size = @@global.binlog_cache_size;
 SET binlog_cache_size = 1;
 ERROR HY000: Variable 'binlog_cache_size' is a GLOBAL variable and should be set with SET GLOBAL
 SET global.binlog_cache_size = 1;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'binlog_cache_size = 1' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'binlog_cache_size = 1' at line 1
 SELECT global.binlog_cache_size;
 ERROR 42S02: Unknown table 'global' in field list
 SELECT binlog_cache_size = @@session.binlog_cache_size;
diff --git a/mysql-test/suite/sys_vars/r/binlog_stmt_cache_size_basic_32.result b/mysql-test/suite/sys_vars/r/binlog_stmt_cache_size_basic_32.result
index 604f671d5a4..8f1e519dab4 100644
--- a/mysql-test/suite/sys_vars/r/binlog_stmt_cache_size_basic_32.result
+++ b/mysql-test/suite/sys_vars/r/binlog_stmt_cache_size_basic_32.result
@@ -59,7 +59,7 @@ Warnings:
 Warning	1292	Truncated incorrect binlog_stmt_cache_size value: '42949672950'
 SELECT @@global.binlog_stmt_cache_size;
 @@global.binlog_stmt_cache_size
-4294963200
+42949668864
 'Bug: Errors are not coming on assigning invalid values to variable'
 SET @@global.binlog_stmt_cache_size = ON;
 ERROR 42000: Incorrect argument type to variable 'binlog_stmt_cache_size'
@@ -97,7 +97,7 @@ SELECT @@binlog_stmt_cache_size = @@global.binlog_stmt_cache_size;
 SET binlog_stmt_cache_size = 1;
 ERROR HY000: Variable 'binlog_stmt_cache_size' is a GLOBAL variable and should be set with SET GLOBAL
 SET global.binlog_stmt_cache_size = 1;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'binlog_stmt_cache_size = 1' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'binlog_stmt_cache_size = 1' at line 1
 SELECT global.binlog_stmt_cache_size;
 ERROR 42S02: Unknown table 'global' in field list
 SELECT binlog_stmt_cache_size = @@session.binlog_stmt_cache_size;
diff --git a/mysql-test/suite/sys_vars/r/bulk_insert_buffer_size_basic_32.result b/mysql-test/suite/sys_vars/r/bulk_insert_buffer_size_basic_32.result
index 497fe531fec..b332d01f900 100644
--- a/mysql-test/suite/sys_vars/r/bulk_insert_buffer_size_basic_32.result
+++ b/mysql-test/suite/sys_vars/r/bulk_insert_buffer_size_basic_32.result
@@ -62,11 +62,9 @@ SELECT @@session.bulk_insert_buffer_size;
 429496
 '#------------------FN_DYNVARS_007_05-----------------------#'
 SET @@global.bulk_insert_buffer_size = 42949672950;
-Warnings:
-Warning	1292	Truncated incorrect bulk_insert_buffer_size value: '42949672950'
 SELECT @@global.bulk_insert_buffer_size;
 @@global.bulk_insert_buffer_size
-4294967295
+42949672950
 SET @@global.bulk_insert_buffer_size = -1024;
 Warnings:
 Warning	1292	Truncated incorrect bulk_insert_buffer_size value: '-1024'
@@ -80,11 +78,9 @@ ERROR 42000: Incorrect argument type to variable 'bulk_insert_buffer_size'
 SET @@global.bulk_insert_buffer_size = 429496.10;
 ERROR 42000: Incorrect argument type to variable 'bulk_insert_buffer_size'
 SET @@session.bulk_insert_buffer_size = 42949672950;
-Warnings:
-Warning	1292	Truncated incorrect bulk_insert_buffer_size value: '42949672950'
 SELECT @@session.bulk_insert_buffer_size;
 @@session.bulk_insert_buffer_size
-4294967295
+42949672950
 SET @@session.bulk_insert_buffer_size = -2;
 Warnings:
 Warning	1292	Truncated incorrect bulk_insert_buffer_size value: '-2'
@@ -138,11 +134,11 @@ SELECT @@bulk_insert_buffer_size;
 @@bulk_insert_buffer_size
 1
 SET local.bulk_insert_buffer_size = 1;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'bulk_insert_buffer_size = 1' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'bulk_insert_buffer_size = 1' at line 1
 SELECT local.bulk_insert_buffer_size;
 ERROR 42S02: Unknown table 'local' in field list
 SET session.bulk_insert_buffer_size = 1;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'bulk_insert_buffer_size = 1' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'bulk_insert_buffer_size = 1' at line 1
 SELECT session.bulk_insert_buffer_size;
 ERROR 42S02: Unknown table 'session' in field list
 SELECT bulk_insert_buffer_size = @@session.bulk_insert_buffer_size;
diff --git a/mysql-test/suite/sys_vars/r/debug_crc_break_basic.result b/mysql-test/suite/sys_vars/r/debug_crc_break_basic.result
index 13f5a901f6d..70f338ad305 100644
--- a/mysql-test/suite/sys_vars/r/debug_crc_break_basic.result
+++ b/mysql-test/suite/sys_vars/r/debug_crc_break_basic.result
@@ -33,8 +33,6 @@ select @@global.debug_crc_break;
 @@global.debug_crc_break
 0
 set global debug_crc_break=cast(-1 as unsigned int);
-Warnings:
-Note	1105	Cast to unsigned converted negative integer to it's positive complement
 select @@global.debug_crc_break;
 @@global.debug_crc_break
 18446744073709551615
diff --git a/mysql-test/suite/sys_vars/r/delayed_insert_limit_basic_32.result b/mysql-test/suite/sys_vars/r/delayed_insert_limit_basic_32.result
index 3da10bc8416..6acc2398bbd 100644
--- a/mysql-test/suite/sys_vars/r/delayed_insert_limit_basic_32.result
+++ b/mysql-test/suite/sys_vars/r/delayed_insert_limit_basic_32.result
@@ -96,11 +96,11 @@ SELECT @@delayed_insert_limit;
 @@delayed_insert_limit
 1
 SET local.delayed_insert_limit = 1;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'delayed_insert_limit = 1' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'delayed_insert_limit = 1' at line 1
 SELECT local.delayed_insert_limit;
 ERROR 42S02: Unknown table 'local' in field list
 SET global.delayed_insert_limit = 1;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'delayed_insert_limit = 1' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'delayed_insert_limit = 1' at line 1
 SELECT global.delayed_insert_limit;
 ERROR 42S02: Unknown table 'global' in field list
 SELECT delayed_insert_limit = @@session.delayed_insert_limit;
diff --git a/mysql-test/suite/sys_vars/r/delayed_queue_size_basic_32.result b/mysql-test/suite/sys_vars/r/delayed_queue_size_basic_32.result
index f4448b08b1f..04aad26f0e8 100644
--- a/mysql-test/suite/sys_vars/r/delayed_queue_size_basic_32.result
+++ b/mysql-test/suite/sys_vars/r/delayed_queue_size_basic_32.result
@@ -94,11 +94,11 @@ SELECT @@delayed_queue_size;
 @@delayed_queue_size
 1
 SET local.delayed_queue_size = 1;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'delayed_queue_size = 1' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'delayed_queue_size = 1' at line 1
 SELECT local.delayed_queue_size;
 ERROR 42S02: Unknown table 'local' in field list
 SET global.delayed_queue_size = 1;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'delayed_queue_size = 1' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'delayed_queue_size = 1' at line 1
 SELECT global.delayed_queue_size;
 ERROR 42S02: Unknown table 'global' in field list
 SELECT delayed_queue_size = @@session.delayed_queue_size;
diff --git a/mysql-test/suite/sys_vars/r/join_buffer_size_basic_32.result b/mysql-test/suite/sys_vars/r/join_buffer_size_basic_32.result
index af3dd553862..fda265910f9 100644
--- a/mysql-test/suite/sys_vars/r/join_buffer_size_basic_32.result
+++ b/mysql-test/suite/sys_vars/r/join_buffer_size_basic_32.result
@@ -73,17 +73,17 @@ Warnings:
 Warning	1292	Truncated incorrect join_buffer_size value: '42949672951'
 SELECT @@global.join_buffer_size;
 @@global.join_buffer_size
-4294967168
+42949672832
 SET @@global.join_buffer_size = 65530.34;
 ERROR 42000: Incorrect argument type to variable 'join_buffer_size'
 SELECT @@global.join_buffer_size;
 @@global.join_buffer_size
-4294967168
+42949672832
 SET @@global.join_buffer_size = test;
 ERROR 42000: Incorrect argument type to variable 'join_buffer_size'
 SELECT @@global.join_buffer_size;
 @@global.join_buffer_size
-4294967168
+42949672832
 SET @@session.join_buffer_size = 0;
 Warnings:
 Warning	1292	Truncated incorrect join_buffer_size value: '0'
@@ -107,17 +107,17 @@ Warnings:
 Warning	1292	Truncated incorrect join_buffer_size value: '42949672951'
 SELECT @@session.join_buffer_size;
 @@session.join_buffer_size
-4294967168
+42949672832
 SET @@session.join_buffer_size = 65530.34;
 ERROR 42000: Incorrect argument type to variable 'join_buffer_size'
 SELECT @@session.join_buffer_size;
 @@session.join_buffer_size
-4294967168
+42949672832
 SET @@session.join_buffer_size = test;
 ERROR 42000: Incorrect argument type to variable 'join_buffer_size'
 SELECT @@session.join_buffer_size;
 @@session.join_buffer_size
-4294967168
+42949672832
 '#------------------FN_DYNVARS_053_06-----------------------#'
 SELECT @@global.join_buffer_size = VARIABLE_VALUE 
 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
diff --git a/mysql-test/suite/sys_vars/r/key_cache_age_threshold_basic_32.result b/mysql-test/suite/sys_vars/r/key_cache_age_threshold_basic_32.result
index 9df9f56bd1f..f2a59e419e4 100644
--- a/mysql-test/suite/sys_vars/r/key_cache_age_threshold_basic_32.result
+++ b/mysql-test/suite/sys_vars/r/key_cache_age_threshold_basic_32.result
@@ -116,11 +116,11 @@ SELECT @@key_cache_age_threshold;
 @@key_cache_age_threshold
 100
 SET local.key_cache_age_threshold = 10;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key_cache_age_threshold = 10' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'key_cache_age_threshold = 10' at line 1
 SELECT local.key_cache_age_threshold;
 ERROR 42S02: Unknown table 'local' in field list
 SET global.key_cache_age_threshold = 10;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key_cache_age_threshold = 10' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'key_cache_age_threshold = 10' at line 1
 SELECT global.key_cache_age_threshold;
 ERROR 42S02: Unknown table 'global' in field list
 SELECT key_cache_age_threshold = @@session.key_cache_age_threshold;
diff --git a/mysql-test/suite/sys_vars/r/max_connect_errors_basic_32.result b/mysql-test/suite/sys_vars/r/max_connect_errors_basic_32.result
index 19f6f12a50b..be1a58394b8 100644
--- a/mysql-test/suite/sys_vars/r/max_connect_errors_basic_32.result
+++ b/mysql-test/suite/sys_vars/r/max_connect_errors_basic_32.result
@@ -119,11 +119,11 @@ SELECT @@max_connect_errors;
 @@max_connect_errors
 5000
 SET local.max_connect_errors = 7000;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'max_connect_errors = 7000' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'max_connect_errors = 7000' at line 1
 SELECT local.max_connect_errors;
 ERROR 42S02: Unknown table 'local' in field list
 SET global.max_connect_errors = 8000;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'max_connect_errors = 8000' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'max_connect_errors = 8000' at line 1
 SELECT global.max_connect_errors;
 ERROR 42S02: Unknown table 'global' in field list
 SELECT max_connect_errors = @@session.max_connect_errors;
diff --git a/mysql-test/suite/sys_vars/r/multi_range_count_basic_32.result b/mysql-test/suite/sys_vars/r/multi_range_count_basic_32.result
index 33222f781f2..e7cda15215c 100644
--- a/mysql-test/suite/sys_vars/r/multi_range_count_basic_32.result
+++ b/mysql-test/suite/sys_vars/r/multi_range_count_basic_32.result
@@ -8,87 +8,123 @@ SELECT @start_session_value;
 256
 '#--------------------FN_DYNVARS_090_01-------------------------#'
 SET @@global.multi_range_count = 100;
+Warnings:
+Warning	1287	The syntax '@@multi_range_count' is deprecated and will be removed in MariaDB 5.7. Please use '@@mrr_buffer_size' instead
 SET @@global.multi_range_count = DEFAULT;
+Warnings:
+Warning	1287	The syntax '@@multi_range_count' is deprecated and will be removed in MariaDB 5.7. Please use '@@mrr_buffer_size' instead
 SELECT @@global.multi_range_count;
 @@global.multi_range_count
 256
 SET @@session.multi_range_count = 200;
+Warnings:
+Warning	1287	The syntax '@@multi_range_count' is deprecated and will be removed in MariaDB 5.7. Please use '@@mrr_buffer_size' instead
 SET @@session.multi_range_count = DEFAULT;
+Warnings:
+Warning	1287	The syntax '@@multi_range_count' is deprecated and will be removed in MariaDB 5.7. Please use '@@mrr_buffer_size' instead
 SELECT @@session.multi_range_count;
 @@session.multi_range_count
 256
 '#--------------------FN_DYNVARS_090_02-------------------------#'
 SET @@global.multi_range_count = DEFAULT;
+Warnings:
+Warning	1287	The syntax '@@multi_range_count' is deprecated and will be removed in MariaDB 5.7. Please use '@@mrr_buffer_size' instead
 SELECT @@global.multi_range_count = 256;
 @@global.multi_range_count = 256
 1
 SET @@session.multi_range_count = DEFAULT;
+Warnings:
+Warning	1287	The syntax '@@multi_range_count' is deprecated and will be removed in MariaDB 5.7. Please use '@@mrr_buffer_size' instead
 SELECT @@session.multi_range_count = 256;
 @@session.multi_range_count = 256
 1
 '#--------------------FN_DYNVARS_090_03-------------------------#'
 SET @@global.multi_range_count = 1;
+Warnings:
+Warning	1287	The syntax '@@multi_range_count' is deprecated and will be removed in MariaDB 5.7. Please use '@@mrr_buffer_size' instead
 SELECT @@global.multi_range_count;
 @@global.multi_range_count
 1
 SET @@global.multi_range_count = 60020;
+Warnings:
+Warning	1287	The syntax '@@multi_range_count' is deprecated and will be removed in MariaDB 5.7. Please use '@@mrr_buffer_size' instead
 SELECT @@global.multi_range_count;
 @@global.multi_range_count
 60020
 SET @@global.multi_range_count = 65535;
+Warnings:
+Warning	1287	The syntax '@@multi_range_count' is deprecated and will be removed in MariaDB 5.7. Please use '@@mrr_buffer_size' instead
 SELECT @@global.multi_range_count;
 @@global.multi_range_count
 65535
 SET @@global.multi_range_count = 4294967295;
+Warnings:
+Warning	1287	The syntax '@@multi_range_count' is deprecated and will be removed in MariaDB 5.7. Please use '@@mrr_buffer_size' instead
 SELECT @@global.multi_range_count;
 @@global.multi_range_count
 4294967295
 SET @@global.multi_range_count = 4294967294;
+Warnings:
+Warning	1287	The syntax '@@multi_range_count' is deprecated and will be removed in MariaDB 5.7. Please use '@@mrr_buffer_size' instead
 SELECT @@global.multi_range_count;
 @@global.multi_range_count
 4294967294
 '#--------------------FN_DYNVARS_090_04-------------------------#'
 SET @@session.multi_range_count = 1;
+Warnings:
+Warning	1287	The syntax '@@multi_range_count' is deprecated and will be removed in MariaDB 5.7. Please use '@@mrr_buffer_size' instead
 SELECT @@session.multi_range_count;
 @@session.multi_range_count
 1
 SET @@session.multi_range_count = 50050;
+Warnings:
+Warning	1287	The syntax '@@multi_range_count' is deprecated and will be removed in MariaDB 5.7. Please use '@@mrr_buffer_size' instead
 SELECT @@session.multi_range_count;
 @@session.multi_range_count
 50050
 SET @@session.multi_range_count = 65535;
+Warnings:
+Warning	1287	The syntax '@@multi_range_count' is deprecated and will be removed in MariaDB 5.7. Please use '@@mrr_buffer_size' instead
 SELECT @@session.multi_range_count;
 @@session.multi_range_count
 65535
 SET @@session.multi_range_count = 4294967295;
+Warnings:
+Warning	1287	The syntax '@@multi_range_count' is deprecated and will be removed in MariaDB 5.7. Please use '@@mrr_buffer_size' instead
 SELECT @@session.multi_range_count;
 @@session.multi_range_count
 4294967295
 SET @@session.multi_range_count = 4294967294;
+Warnings:
+Warning	1287	The syntax '@@multi_range_count' is deprecated and will be removed in MariaDB 5.7. Please use '@@mrr_buffer_size' instead
 SELECT @@session.multi_range_count;
 @@session.multi_range_count
 4294967294
 '#------------------FN_DYNVARS_090_05-----------------------#'
 SET @@global.multi_range_count = 0;
 Warnings:
+Warning	1287	The syntax '@@multi_range_count' is deprecated and will be removed in MariaDB 5.7. Please use '@@mrr_buffer_size' instead
 Warning	1292	Truncated incorrect multi_range_count value: '0'
 SELECT @@global.multi_range_count;
 @@global.multi_range_count
 1
 SET @@global.multi_range_count = 4294967296;
 Warnings:
+Warning	1287	The syntax '@@multi_range_count' is deprecated and will be removed in MariaDB 5.7. Please use '@@mrr_buffer_size' instead
 Warning	1292	Truncated incorrect multi_range_count value: '4294967296'
 SELECT @@global.multi_range_count;
 @@global.multi_range_count
 4294967295
 SET @@global.multi_range_count = -1024;
 Warnings:
+Warning	1287	The syntax '@@multi_range_count' is deprecated and will be removed in MariaDB 5.7. Please use '@@mrr_buffer_size' instead
 Warning	1292	Truncated incorrect multi_range_count value: '-1024'
 SELECT @@global.multi_range_count;
 @@global.multi_range_count
 1
 SET @@global.multi_range_count = 429496729500;
 Warnings:
+Warning	1287	The syntax '@@multi_range_count' is deprecated and will be removed in MariaDB 5.7. Please use '@@mrr_buffer_size' instead
 Warning	1292	Truncated incorrect multi_range_count value: '429496729500'
 SELECT @@global.multi_range_count;
 @@global.multi_range_count
@@ -105,26 +141,30 @@ SELECT @@global.multi_range_count;
 4294967295
 SET @@session.multi_range_count = 0;
 Warnings:
+Warning	1287	The syntax '@@multi_range_count' is deprecated and will be removed in MariaDB 5.7. Please use '@@mrr_buffer_size' instead
 Warning	1292	Truncated incorrect multi_range_count value: '0'
 SELECT @@session.multi_range_count;
 @@session.multi_range_count
 1
 SET @@session.multi_range_count = 4294967296;
 Warnings:
+Warning	1287	The syntax '@@multi_range_count' is deprecated and will be removed in MariaDB 5.7. Please use '@@mrr_buffer_size' instead
 Warning	1292	Truncated incorrect multi_range_count value: '4294967296'
 SELECT @@session.multi_range_count;
 @@session.multi_range_count
 4294967295
 SET @@session.multi_range_count = -1;
 Warnings:
+Warning	1287	The syntax '@@multi_range_count' is deprecated and will be removed in MariaDB 5.7. Please use '@@mrr_buffer_size' instead
 Warning	1292	Truncated incorrect multi_range_count value: '-1'
 SELECT @@session.multi_range_count;
 @@session.multi_range_count
 1
 SET @@session.multi_range_count = 65530.34.;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '.' at line 1
 SET @@session.multi_range_count = 4294967295021;
 Warnings:
+Warning	1287	The syntax '@@multi_range_count' is deprecated and will be removed in MariaDB 5.7. Please use '@@mrr_buffer_size' instead
 Warning	1292	Truncated incorrect multi_range_count value: '4294967295021'
 SELECT @@session.multi_range_count;
 @@session.multi_range_count
@@ -149,22 +189,29 @@ WHERE VARIABLE_NAME='multi_range_count';
 1
 '#------------------FN_DYNVARS_090_08-----------------------#'
 SET @@global.multi_range_count = TRUE;
+Warnings:
+Warning	1287	The syntax '@@multi_range_count' is deprecated and will be removed in MariaDB 5.7. Please use '@@mrr_buffer_size' instead
 SELECT @@global.multi_range_count;
 @@global.multi_range_count
 1
 SET @@global.multi_range_count = FALSE;
 Warnings:
+Warning	1287	The syntax '@@multi_range_count' is deprecated and will be removed in MariaDB 5.7. Please use '@@mrr_buffer_size' instead
 Warning	1292	Truncated incorrect multi_range_count value: '0'
 SELECT @@global.multi_range_count;
 @@global.multi_range_count
 1
 '#---------------------FN_DYNVARS_090_09----------------------#'
 SET @@global.multi_range_count = 10;
+Warnings:
+Warning	1287	The syntax '@@multi_range_count' is deprecated and will be removed in MariaDB 5.7. Please use '@@mrr_buffer_size' instead
 SELECT @@multi_range_count = @@global.multi_range_count;
 @@multi_range_count = @@global.multi_range_count
 0
 '#---------------------FN_DYNVARS_090_10----------------------#'
 SET @@multi_range_count = 100;
+Warnings:
+Warning	1287	The syntax '@@multi_range_count' is deprecated and will be removed in MariaDB 5.7. Please use '@@mrr_buffer_size' instead
 SELECT @@multi_range_count = @@local.multi_range_count;
 @@multi_range_count = @@local.multi_range_count
 1
@@ -173,6 +220,8 @@ SELECT @@local.multi_range_count = @@session.multi_range_count;
 1
 '#---------------------FN_DYNVARS_090_11----------------------#'
 SET multi_range_count = 1;
+Warnings:
+Warning	1287	The syntax '@@multi_range_count' is deprecated and will be removed in MariaDB 5.7. Please use '@@mrr_buffer_size' instead
 SELECT @@multi_range_count;
 @@multi_range_count
 1
@@ -183,10 +232,14 @@ ERROR 42S02: Unknown table 'session' in field list
 SELECT multi_range_count = @@session.multi_range_count;
 ERROR 42S22: Unknown column 'multi_range_count' in 'field list'
 SET @@global.multi_range_count = @start_global_value;
+Warnings:
+Warning	1287	The syntax '@@multi_range_count' is deprecated and will be removed in MariaDB 5.7. Please use '@@mrr_buffer_size' instead
 SELECT @@global.multi_range_count;
 @@global.multi_range_count
 256
 SET @@session.multi_range_count = @start_session_value;
+Warnings:
+Warning	1287	The syntax '@@multi_range_count' is deprecated and will be removed in MariaDB 5.7. Please use '@@mrr_buffer_size' instead
 SELECT @@session.multi_range_count;
 @@session.multi_range_count
 256
diff --git a/mysql-test/suite/sys_vars/r/query_alloc_block_size_basic_32.result b/mysql-test/suite/sys_vars/r/query_alloc_block_size_basic_32.result
index 6189a55e86e..eb6851baa93 100644
--- a/mysql-test/suite/sys_vars/r/query_alloc_block_size_basic_32.result
+++ b/mysql-test/suite/sys_vars/r/query_alloc_block_size_basic_32.result
@@ -41,18 +41,6 @@ Warning	1292	Truncated incorrect query_alloc_block_size value: '1025'
 SELECT @@global.query_alloc_block_size;
 @@global.query_alloc_block_size
 1024
-SET @@global.query_alloc_block_size = 4294967295;
-Warnings:
-Warning	1292	Truncated incorrect query_alloc_block_size value: '4294967295'
-SELECT @@global.query_alloc_block_size;
-@@global.query_alloc_block_size
-4294966272
-SET @@global.query_alloc_block_size = 4294967294;
-Warnings:
-Warning	1292	Truncated incorrect query_alloc_block_size value: '4294967294'
-SELECT @@global.query_alloc_block_size;
-@@global.query_alloc_block_size
-4294966272
 SET @@global.query_alloc_block_size = 65536;
 SELECT @@global.query_alloc_block_size;
 @@global.query_alloc_block_size
@@ -68,18 +56,6 @@ Warning	1292	Truncated incorrect query_alloc_block_size value: '1025'
 SELECT @@session.query_alloc_block_size;
 @@session.query_alloc_block_size
 1024
-SET @@session.query_alloc_block_size = 4294967295;
-Warnings:
-Warning	1292	Truncated incorrect query_alloc_block_size value: '4294967295'
-SELECT @@session.query_alloc_block_size;
-@@session.query_alloc_block_size
-4294966272
-SET @@session.query_alloc_block_size = 4294967294;
-Warnings:
-Warning	1292	Truncated incorrect query_alloc_block_size value: '4294967294'
-SELECT @@session.query_alloc_block_size;
-@@session.query_alloc_block_size
-4294966272
 SET @@session.query_alloc_block_size = 655536;
 Warnings:
 Warning	1292	Truncated incorrect query_alloc_block_size value: '655536'
@@ -105,22 +81,16 @@ Warning	1292	Truncated incorrect query_alloc_block_size value: '1023'
 SELECT @@global.query_alloc_block_size;
 @@global.query_alloc_block_size
 1024
-SET @@global.query_alloc_block_size = 4294967296;
-Warnings:
-Warning	1292	Truncated incorrect query_alloc_block_size value: '4294967296'
-SELECT @@global.query_alloc_block_size;
-@@global.query_alloc_block_size
-4294966272
 SET @@global.query_alloc_block_size = 65530.34;
 ERROR 42000: Incorrect argument type to variable 'query_alloc_block_size'
 SELECT @@global.query_alloc_block_size;
 @@global.query_alloc_block_size
-4294966272
+1024
 SET @@global.query_alloc_block_size = test;
 ERROR 42000: Incorrect argument type to variable 'query_alloc_block_size'
 SELECT @@global.query_alloc_block_size;
 @@global.query_alloc_block_size
-4294966272
+1024
 SET @@session.query_alloc_block_size = 64;
 Warnings:
 Warning	1292	Truncated incorrect query_alloc_block_size value: '64'
diff --git a/mysql-test/suite/sys_vars/r/query_cache_limit_basic_32.result b/mysql-test/suite/sys_vars/r/query_cache_limit_basic_32.result
index 074075dd2f7..892bc306bcb 100644
--- a/mysql-test/suite/sys_vars/r/query_cache_limit_basic_32.result
+++ b/mysql-test/suite/sys_vars/r/query_cache_limit_basic_32.result
@@ -114,11 +114,11 @@ SELECT @@query_cache_limit;
 @@query_cache_limit
 1
 SET local.query_cache_limit = 1;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'query_cache_limit = 1' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'query_cache_limit = 1' at line 1
 SELECT local.query_cache_limit;
 ERROR 42S02: Unknown table 'local' in field list
 SET global.query_cache_limit = 1;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'query_cache_limit = 1' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'query_cache_limit = 1' at line 1
 SELECT global.query_cache_limit;
 ERROR 42S02: Unknown table 'global' in field list
 SELECT query_cache_limit = @@session.query_cache_limit;
diff --git a/mysql-test/suite/sys_vars/r/query_cache_min_res_unit_basic_32.result b/mysql-test/suite/sys_vars/r/query_cache_min_res_unit_basic_32.result
index c408a39fdc0..3d2c02c48fc 100644
--- a/mysql-test/suite/sys_vars/r/query_cache_min_res_unit_basic_32.result
+++ b/mysql-test/suite/sys_vars/r/query_cache_min_res_unit_basic_32.result
@@ -120,11 +120,11 @@ SELECT @@query_cache_min_res_unit;
 @@query_cache_min_res_unit
 512
 SET local.query_cache_min_res_unit = 1;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'query_cache_min_res_unit = 1' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'query_cache_min_res_unit = 1' at line 1
 SELECT local.query_cache_min_res_unit;
 ERROR 42S02: Unknown table 'local' in field list
 SET global.query_cache_min_res_unit = 1;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'query_cache_min_res_unit = 1' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'query_cache_min_res_unit = 1' at line 1
 SELECT global.query_cache_min_res_unit;
 ERROR 42S02: Unknown table 'global' in field list
 SELECT query_cache_min_res_unit = @@session.query_cache_min_res_unit;
diff --git a/mysql-test/suite/sys_vars/r/query_cache_size_basic_32.result b/mysql-test/suite/sys_vars/r/query_cache_size_basic_32.result
index 5ceb02182b3..319948deefa 100644
--- a/mysql-test/suite/sys_vars/r/query_cache_size_basic_32.result
+++ b/mysql-test/suite/sys_vars/r/query_cache_size_basic_32.result
@@ -1,6 +1,8 @@
 SET @start_value = @@global.query_cache_size;
 '#--------------------FN_DYNVARS_133_01------------------------#'
 SET @@global.query_cache_size = 99;
+Warnings:
+Warning	1292	Truncated incorrect query_cache_size value: '99'
 SET @@global.query_cache_size = DEFAULT;
 SELECT @@global.query_cache_size;
 @@global.query_cache_size
@@ -16,10 +18,14 @@ SELECT @@global.query_cache_size;
 @@global.query_cache_size
 0
 SET @@global.query_cache_size = 1;
+Warnings:
+Warning	1292	Truncated incorrect query_cache_size value: '1'
 SELECT @@global.query_cache_size;
 @@global.query_cache_size
 0
 SET @@global.query_cache_size = 512;
+Warnings:
+Warning	1292	Truncated incorrect query_cache_size value: '512'
 SELECT @@global.query_cache_size;
 @@global.query_cache_size
 0
@@ -29,13 +35,13 @@ Warning	1282	Query cache failed to set size 1024; new query cache size is 0
 SELECT @@global.query_cache_size;
 @@global.query_cache_size
 0
-: 'Bug#34880: Warnings are coming on assinging valid values to variable
-'Bug# 34877: Invalid Values are coming in variable on assigning valid values';
 SET @@global.query_cache_size = 1048576;
 SELECT @@global.query_cache_size;
 @@global.query_cache_size
 1048576
 SET @@global.query_cache_size = 1048575;
+Warnings:
+Warning	1292	Truncated incorrect query_cache_size value: '1048575'
 SELECT @@global.query_cache_size;
 @@global.query_cache_size
 1047552
@@ -46,14 +52,9 @@ Warning	1292	Truncated incorrect query_cache_size value: '-1'
 SELECT @@global.query_cache_size;
 @@global.query_cache_size
 0
-SET @@global.query_cache_size = 4294967296;
-Warnings:
-Warning	1292	Truncated incorrect query_cache_size value: '4294967296'
-Warning	1282	Query cache failed to set size 4294966272; new query cache size is 0
-SELECT @@global.query_cache_size;
-@@global.query_cache_size
-0
 SET @@global.query_cache_size = 511;
+Warnings:
+Warning	1292	Truncated incorrect query_cache_size value: '511'
 SELECT @@global.query_cache_size;
 @@global.query_cache_size
 0
@@ -68,14 +69,6 @@ Warning	1292	Truncated incorrect query_cache_size value: '-1024'
 SELECT @@global.query_cache_size;
 @@global.query_cache_size
 0
-SET @@global.query_cache_size = 42949672950;
-Warnings:
-Warning	1292	Truncated incorrect query_cache_size value: '42949672950'
-Warning	1282	Query cache failed to set size 4294966272; new query cache size is 0
-SELECT @@global.query_cache_size;
-@@global.query_cache_size
-0
-'Bug # 34837: Errors are not coming on assigning invalid values to variable';
 SET @@global.query_cache_size = ON;
 ERROR 42000: Incorrect argument type to variable 'query_cache_size'
 SELECT @@global.query_cache_size;
@@ -105,6 +98,8 @@ WHERE VARIABLE_NAME='query_cache_size';
 1
 '#---------------------FN_DYNVARS_133_07----------------------#'
 SET @@global.query_cache_size = TRUE;
+Warnings:
+Warning	1292	Truncated incorrect query_cache_size value: '1'
 SELECT @@global.query_cache_size;
 @@global.query_cache_size
 0
@@ -114,6 +109,8 @@ SELECT @@global.query_cache_size;
 0
 '#---------------------FN_DYNVARS_133_08----------------------#'
 SET @@global.query_cache_size = 1;
+Warnings:
+Warning	1292	Truncated incorrect query_cache_size value: '1'
 SELECT @@query_cache_size = @@global.query_cache_size;
 @@query_cache_size = @@global.query_cache_size
 1
@@ -124,11 +121,11 @@ SELECT @@query_cache_size;
 @@query_cache_size
 0
 SET local.query_cache_size = 1;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'query_cache_size = 1' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'query_cache_size = 1' at line 1
 SELECT local.query_cache_size;
 ERROR 42S02: Unknown table 'local' in field list
 SET global.query_cache_size = 1;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'query_cache_size = 1' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'query_cache_size = 1' at line 1
 SELECT global.query_cache_size;
 ERROR 42S02: Unknown table 'global' in field list
 SELECT query_cache_size = @@session.query_cache_size;
diff --git a/mysql-test/suite/sys_vars/r/rpl_recovery_rank_basic_32.result b/mysql-test/suite/sys_vars/r/rpl_recovery_rank_basic_32.result
index f5b771c47cc..b3572eda3c7 100644
--- a/mysql-test/suite/sys_vars/r/rpl_recovery_rank_basic_32.result
+++ b/mysql-test/suite/sys_vars/r/rpl_recovery_rank_basic_32.result
@@ -5,42 +5,42 @@ SELECT @start_global_value;
 '#--------------------FN_DYNVARS_142_01-------------------------#'
 SET @@global.rpl_recovery_rank = 500000;
 Warnings:
-Warning	1287	The syntax '@@rpl_recovery_rank' is deprecated and will be removed in MySQL 7.0.
+Warning	1287	The syntax '@@rpl_recovery_rank' is deprecated and will be removed in MariaDB 7.0.
 SET @@global.rpl_recovery_rank = DEFAULT;
 Warnings:
-Warning	1287	The syntax '@@rpl_recovery_rank' is deprecated and will be removed in MySQL 7.0.
+Warning	1287	The syntax '@@rpl_recovery_rank' is deprecated and will be removed in MariaDB 7.0.
 SELECT @@global.rpl_recovery_rank;
 @@global.rpl_recovery_rank
 0
 '#--------------------FN_DYNVARS_142_02-------------------------#'
 SET @@global.rpl_recovery_rank = 0;
 Warnings:
-Warning	1287	The syntax '@@rpl_recovery_rank' is deprecated and will be removed in MySQL 7.0.
+Warning	1287	The syntax '@@rpl_recovery_rank' is deprecated and will be removed in MariaDB 7.0.
 SELECT @@global.rpl_recovery_rank;
 @@global.rpl_recovery_rank
 0
 SET @@global.rpl_recovery_rank = 1024;
 Warnings:
-Warning	1287	The syntax '@@rpl_recovery_rank' is deprecated and will be removed in MySQL 7.0.
+Warning	1287	The syntax '@@rpl_recovery_rank' is deprecated and will be removed in MariaDB 7.0.
 SELECT @@global.rpl_recovery_rank;
 @@global.rpl_recovery_rank
 1024
 SET @@global.rpl_recovery_rank = 123456789;
 Warnings:
-Warning	1287	The syntax '@@rpl_recovery_rank' is deprecated and will be removed in MySQL 7.0.
+Warning	1287	The syntax '@@rpl_recovery_rank' is deprecated and will be removed in MariaDB 7.0.
 SELECT @@global.rpl_recovery_rank;
 @@global.rpl_recovery_rank
 123456789
 SET @@global.rpl_recovery_rank = 2147483648*2;
 Warnings:
-Warning	1287	The syntax '@@rpl_recovery_rank' is deprecated and will be removed in MySQL 7.0.
+Warning	1287	The syntax '@@rpl_recovery_rank' is deprecated and will be removed in MariaDB 7.0.
 Warning	1292	Truncated incorrect rpl_recovery_rank value: '4294967296'
 SELECT @@global.rpl_recovery_rank;
 @@global.rpl_recovery_rank
 4294967295
 SET @@global.rpl_recovery_rank = 2147483648*1024;
 Warnings:
-Warning	1287	The syntax '@@rpl_recovery_rank' is deprecated and will be removed in MySQL 7.0.
+Warning	1287	The syntax '@@rpl_recovery_rank' is deprecated and will be removed in MariaDB 7.0.
 Warning	1292	Truncated incorrect rpl_recovery_rank value: '2199023255552'
 SELECT @@global.rpl_recovery_rank;
 @@global.rpl_recovery_rank
@@ -50,7 +50,7 @@ SELECT @@global.rpl_recovery_rank;
 4294967295
 SET @@global.rpl_recovery_rank = 2147483648*2147483648;
 Warnings:
-Warning	1287	The syntax '@@rpl_recovery_rank' is deprecated and will be removed in MySQL 7.0.
+Warning	1287	The syntax '@@rpl_recovery_rank' is deprecated and will be removed in MariaDB 7.0.
 Warning	1292	Truncated incorrect rpl_recovery_rank value: '4611686018427387904'
 SELECT @@global.rpl_recovery_rank;
 @@global.rpl_recovery_rank
@@ -65,21 +65,21 @@ ERROR HY000: Variable 'rpl_recovery_rank' is a GLOBAL variable and should be set
 '#------------------FN_DYNVARS_142_04-----------------------#'
 SET @@global.rpl_recovery_rank = -1;
 Warnings:
-Warning	1287	The syntax '@@rpl_recovery_rank' is deprecated and will be removed in MySQL 7.0.
+Warning	1287	The syntax '@@rpl_recovery_rank' is deprecated and will be removed in MariaDB 7.0.
 Warning	1292	Truncated incorrect rpl_recovery_rank value: '-1'
 SELECT @@global.rpl_recovery_rank;
 @@global.rpl_recovery_rank
 0
 SET @@global.rpl_recovery_rank = -2147483648;
 Warnings:
-Warning	1287	The syntax '@@rpl_recovery_rank' is deprecated and will be removed in MySQL 7.0.
+Warning	1287	The syntax '@@rpl_recovery_rank' is deprecated and will be removed in MariaDB 7.0.
 Warning	1292	Truncated incorrect rpl_recovery_rank value: '-2147483648'
 SELECT @@global.rpl_recovery_rank;
 @@global.rpl_recovery_rank
 0
 SET @@global.rpl_recovery_rank = -2147483649;
 Warnings:
-Warning	1287	The syntax '@@rpl_recovery_rank' is deprecated and will be removed in MySQL 7.0.
+Warning	1287	The syntax '@@rpl_recovery_rank' is deprecated and will be removed in MariaDB 7.0.
 Warning	1292	Truncated incorrect rpl_recovery_rank value: '-2147483649'
 SELECT @@global.rpl_recovery_rank;
 @@global.rpl_recovery_rank
@@ -93,7 +93,7 @@ ERROR 42000: Incorrect argument type to variable 'rpl_recovery_rank'
 '#------------------FN_DYNVARS_142_05-----------------------#'
 SET @@global.rpl_recovery_rank = 3000;
 Warnings:
-Warning	1287	The syntax '@@rpl_recovery_rank' is deprecated and will be removed in MySQL 7.0.
+Warning	1287	The syntax '@@rpl_recovery_rank' is deprecated and will be removed in MariaDB 7.0.
 SELECT @@global.rpl_recovery_rank = VARIABLE_VALUE 
 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
 WHERE VARIABLE_NAME='rpl_recovery_rank';
@@ -108,20 +108,20 @@ count(VARIABLE_VALUE)
 '#------------------FN_DYNVARS_142_07-----------------------#'
 SET @@global.rpl_recovery_rank = TRUE;
 Warnings:
-Warning	1287	The syntax '@@rpl_recovery_rank' is deprecated and will be removed in MySQL 7.0.
+Warning	1287	The syntax '@@rpl_recovery_rank' is deprecated and will be removed in MariaDB 7.0.
 SELECT @@global.rpl_recovery_rank;
 @@global.rpl_recovery_rank
 1
 SET @@global.rpl_recovery_rank = FALSE;
 Warnings:
-Warning	1287	The syntax '@@rpl_recovery_rank' is deprecated and will be removed in MySQL 7.0.
+Warning	1287	The syntax '@@rpl_recovery_rank' is deprecated and will be removed in MariaDB 7.0.
 SELECT @@global.rpl_recovery_rank;
 @@global.rpl_recovery_rank
 0
 '#---------------------FN_DYNVARS_001_08----------------------#'
 SET @@global.rpl_recovery_rank = 512;
 Warnings:
-Warning	1287	The syntax '@@rpl_recovery_rank' is deprecated and will be removed in MySQL 7.0.
+Warning	1287	The syntax '@@rpl_recovery_rank' is deprecated and will be removed in MariaDB 7.0.
 SELECT @@rpl_recovery_rank = @@global.rpl_recovery_rank;
 @@rpl_recovery_rank = @@global.rpl_recovery_rank
 1
@@ -135,10 +135,10 @@ SELECT @@rpl_recovery_rank;
 512
 SET global rpl_recovery_rank = 64;
 Warnings:
-Warning	1287	The syntax '@@rpl_recovery_rank' is deprecated and will be removed in MySQL 7.0.
+Warning	1287	The syntax '@@rpl_recovery_rank' is deprecated and will be removed in MariaDB 7.0.
 SET @@global.rpl_recovery_rank = @start_global_value;
 Warnings:
-Warning	1287	The syntax '@@rpl_recovery_rank' is deprecated and will be removed in MySQL 7.0.
+Warning	1287	The syntax '@@rpl_recovery_rank' is deprecated and will be removed in MariaDB 7.0.
 SELECT @@global.rpl_recovery_rank;
 @@global.rpl_recovery_rank
 0
diff --git a/mysql-test/suite/sys_vars/r/sort_buffer_size_basic_32.result b/mysql-test/suite/sys_vars/r/sort_buffer_size_basic_32.result
index cddfa9f52c9..b492a343a9b 100644
--- a/mysql-test/suite/sys_vars/r/sort_buffer_size_basic_32.result
+++ b/mysql-test/suite/sys_vars/r/sort_buffer_size_basic_32.result
@@ -62,21 +62,21 @@ SELECT @@global.sort_buffer_size;
 SET @@global.sort_buffer_size = -1024;
 SELECT @@global.sort_buffer_size;
 @@global.sort_buffer_size
-32768
+1024
 SET @@global.sort_buffer_size = 4294967296;
 SELECT @@global.sort_buffer_size;
 @@global.sort_buffer_size
-4294967295
+4294967296
 SET @@global.sort_buffer_size = 65530.34;
 ERROR 42000: Incorrect argument type to variable 'sort_buffer_size'
 SELECT @@global.sort_buffer_size;
 @@global.sort_buffer_size
-4294967295
+4294967296
 SET @@global.sort_buffer_size = test;
 ERROR 42000: Incorrect argument type to variable 'sort_buffer_size'
 SELECT @@global.sort_buffer_size;
 @@global.sort_buffer_size
-4294967295
+4294967296
 SET @@session.sort_buffer_size = 32775;
 SELECT @@session.sort_buffer_size;
 @@session.sort_buffer_size
@@ -84,13 +84,13 @@ SELECT @@session.sort_buffer_size;
 SET @@session.sort_buffer_size = -2;
 SELECT @@session.sort_buffer_size;
 @@session.sort_buffer_size
-32768
+1024
 SET @@session.sort_buffer_size = 65530.34;
 ERROR 42000: Incorrect argument type to variable 'sort_buffer_size'
 SET @@session.sort_buffer_size = 4294967296;
 SELECT @@session.sort_buffer_size;
 @@session.sort_buffer_size
-4294967295
+4294967296
 SET @@session.sort_buffer_size = test;
 ERROR 42000: Incorrect argument type to variable 'sort_buffer_size'
 '#------------------FN_DYNVARS_151_06-----------------------#'
@@ -107,11 +107,11 @@ INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sort_buffer_size';
 SET @@global.sort_buffer_size = TRUE;
 SELECT @@global.sort_buffer_size;
 @@global.sort_buffer_size
-32768
+1024
 SET @@global.sort_buffer_size = FALSE;
 SELECT @@global.sort_buffer_size;
 @@global.sort_buffer_size
-32768
+1024
 '#---------------------FN_DYNVARS_151_09----------------------#'
 SET @@global.sort_buffer_size = 9000;
 SELECT @@sort_buffer_size = @@global.sort_buffer_size;
@@ -129,7 +129,7 @@ SELECT @@local.sort_buffer_size = @@session.sort_buffer_size;
 SET sort_buffer_size = 9100;
 SELECT @@sort_buffer_size;
 @@sort_buffer_size
-32768
+9100
 SELECT local.sort_buffer_size;
 ERROR 42S02: Unknown table 'local' in field list
 SELECT session.sort_buffer_size;
diff --git a/mysql-test/suite/sys_vars/r/transaction_prealloc_size_basic_32.result b/mysql-test/suite/sys_vars/r/transaction_prealloc_size_basic_32.result
index 4912653a8e5..cbd25426408 100644
--- a/mysql-test/suite/sys_vars/r/transaction_prealloc_size_basic_32.result
+++ b/mysql-test/suite/sys_vars/r/transaction_prealloc_size_basic_32.result
@@ -6,7 +6,6 @@ SET @start_session_value = @@session.transaction_prealloc_size;
 SELECT @start_session_value;
 @start_session_value
 4096
-'Bug# 34876: This variable has invalid default value as compared to documentation';
 '#--------------------FN_DYNVARS_005_01-------------------------#'
 SET @@global.transaction_prealloc_size = 100;
 Warnings:
@@ -37,23 +36,19 @@ SELECT @@global.transaction_prealloc_size;
 @@global.transaction_prealloc_size
 1024
 SET @@global.transaction_prealloc_size = 60020;
+Warnings:
+Warning	1292	Truncated incorrect transaction_prealloc_size value: '60020'
 SELECT @@global.transaction_prealloc_size;
 @@global.transaction_prealloc_size
 59392
-SET @@global.transaction_prealloc_size = 4294966272;
-SELECT @@global.transaction_prealloc_size;
-@@global.transaction_prealloc_size
-4294966272
 '#--------------------FN_DYNVARS_005_04-------------------------#'
 SET @@session.transaction_prealloc_size = 1024;
 SELECT @@session.transaction_prealloc_size;
 @@session.transaction_prealloc_size
 1024
-SET @@session.transaction_prealloc_size =4294966272;
-SELECT @@session.transaction_prealloc_size;
-@@session.transaction_prealloc_size
-4294966272
 SET @@session.transaction_prealloc_size = 65535;
+Warnings:
+Warning	1292	Truncated incorrect transaction_prealloc_size value: '65535'
 SELECT @@session.transaction_prealloc_size;
 @@session.transaction_prealloc_size
 64512
@@ -70,7 +65,6 @@ Warning	1292	Truncated incorrect transaction_prealloc_size value: '-1024'
 SELECT @@global.transaction_prealloc_size;
 @@global.transaction_prealloc_size
 1024
-'Bug # 34837: Errors are not coming on assigning invalid values to variable';
 SET @@global.transaction_prealloc_size = ON;
 ERROR 42000: Incorrect argument type to variable 'transaction_prealloc_size'
 SET @@global.transaction_prealloc_size = OFF;
@@ -115,12 +109,6 @@ SELECT @@session.transaction_prealloc_size;
 1024
 SET @@session.transaction_prealloc_size = "Test";
 ERROR 42000: Incorrect argument type to variable 'transaction_prealloc_size'
-SET @@session.transaction_prealloc_size = 123456789031;
-Warnings:
-Warning	1292	Truncated incorrect transaction_prealloc_size value: '123456789031'
-SELECT @@session.transaction_prealloc_size;
-@@session.transaction_prealloc_size
-4294966272
 '#------------------FN_DYNVARS_005_06-----------------------#'
 SELECT @@global.transaction_prealloc_size = VARIABLE_VALUE 
 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
@@ -140,7 +128,7 @@ Warnings:
 Warning	1292	Truncated incorrect transaction_prealloc_size value: '10'
 SELECT @@transaction_prealloc_size = @@global.transaction_prealloc_size;
 @@transaction_prealloc_size = @@global.transaction_prealloc_size
-0
+1
 '#---------------------FN_DYNVARS_001_10----------------------#'
 SET @@transaction_prealloc_size = 100;
 Warnings:
@@ -153,6 +141,8 @@ SELECT @@local.transaction_prealloc_size = @@session.transaction_prealloc_size;
 1
 '#---------------------FN_DYNVARS_001_11----------------------#'
 SET transaction_prealloc_size = 1027;
+Warnings:
+Warning	1292	Truncated incorrect transaction_prealloc_size value: '1027'
 SELECT @@transaction_prealloc_size;
 @@transaction_prealloc_size
 1024
diff --git a/mysql-test/suite/sys_vars/t/aria_pagecache_age_threshold_basic.test b/mysql-test/suite/sys_vars/t/aria_pagecache_age_threshold_basic.test
index 2d8dcc4eff5..3fc9c94fc84 100644
--- a/mysql-test/suite/sys_vars/t/aria_pagecache_age_threshold_basic.test
+++ b/mysql-test/suite/sys_vars/t/aria_pagecache_age_threshold_basic.test
@@ -42,6 +42,7 @@ select @@global.aria_pagecache_age_threshold;
 set global aria_pagecache_age_threshold=@@global.aria_pagecache_age_threshold + 100;
 select @@global.aria_pagecache_age_threshold;
 set global aria_pagecache_age_threshold=cast(-1 as unsigned int);
+--replace_result 4294967200 18446744073709551600
 select @@global.aria_pagecache_age_threshold;
 
 SET @@global.aria_pagecache_age_threshold = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/aria_repair_threads_basic.test b/mysql-test/suite/sys_vars/t/aria_repair_threads_basic.test
index 476bd0b4cb2..8d075f3150c 100644
--- a/mysql-test/suite/sys_vars/t/aria_repair_threads_basic.test
+++ b/mysql-test/suite/sys_vars/t/aria_repair_threads_basic.test
@@ -36,7 +36,10 @@ set global aria_repair_threads="foo";
 #
 set global aria_repair_threads=0;
 select @@global.aria_repair_threads;
+--disable_warnings
 set session aria_repair_threads=cast(-1 as unsigned int);
+--enable_warnings
+--replace_result 4294967295 18446744073709551615
 select @@session.aria_repair_threads;
 
 SET @@global.aria_repair_threads = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/aria_sort_buffer_size_basic.test b/mysql-test/suite/sys_vars/t/aria_sort_buffer_size_basic.test
index 699f6ae8e20..818d66328f8 100644
--- a/mysql-test/suite/sys_vars/t/aria_sort_buffer_size_basic.test
+++ b/mysql-test/suite/sys_vars/t/aria_sort_buffer_size_basic.test
@@ -36,7 +36,10 @@ set global aria_sort_buffer_size="foo";
 #
 set global aria_sort_buffer_size=0;
 select @@global.aria_sort_buffer_size;
+--disable_warnings
 set session aria_sort_buffer_size=cast(-1 as unsigned int);
+--enable_warnings
+--replace_result 4294967295 18446744073709551615
 select @@session.aria_sort_buffer_size;
 
 SET @@global.aria_sort_buffer_size = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/debug_crc_break_basic.test b/mysql-test/suite/sys_vars/t/debug_crc_break_basic.test
index 6e37a47c5b8..435a6c33341 100644
--- a/mysql-test/suite/sys_vars/t/debug_crc_break_basic.test
+++ b/mysql-test/suite/sys_vars/t/debug_crc_break_basic.test
@@ -37,7 +37,10 @@ set global debug_crc_break="foo";
 #
 set global debug_crc_break=0;
 select @@global.debug_crc_break;
+--disable_warnings
 set global debug_crc_break=cast(-1 as unsigned int);
+--enable_warnings
+--replace_result 4294967295 18446744073709551615
 select @@global.debug_crc_break;
 
 SET @@global.debug_crc_break = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/max_heap_table_size_basic.test b/mysql-test/suite/sys_vars/t/max_heap_table_size_basic.test
index 4b9c7cf3b8e..5e4bcd9490d 100644
--- a/mysql-test/suite/sys_vars/t/max_heap_table_size_basic.test
+++ b/mysql-test/suite/sys_vars/t/max_heap_table_size_basic.test
@@ -111,28 +111,38 @@ SET @@global.max_heap_table_size = 1024;
 SELECT @@global.max_heap_table_size;
 SET @@global.max_heap_table_size = 16383;
 SELECT @@global.max_heap_table_size;
+--disable_warnings
 SET @@global.max_heap_table_size = 4294967296;
+--enable_warnings
+--replace_result 4294966272 4294967296
 SELECT @@global.max_heap_table_size;
 --Error ER_WRONG_TYPE_FOR_VAR
 SET @@global.max_heap_table_size = 65530.34;
+--replace_result 4294966272 4294967296
 SELECT @@global.max_heap_table_size;
 --Error ER_WRONG_TYPE_FOR_VAR
 SET @@global.max_heap_table_size = test;
+--replace_result 4294966272 4294967296
 SELECT @@global.max_heap_table_size;
 
 SET @@session.max_heap_table_size = -1;
 SELECT @@session.max_heap_table_size;
 SET @@session.max_heap_table_size = 16383;
 SELECT @@session.max_heap_table_size;
+--disable_warnings
 SET @@session.max_heap_table_size = 4294967296;
+--enable_warnings
+--replace_result 4294966272 4294967296
 SELECT @@session.max_heap_table_size;
 --Error ER_WRONG_TYPE_FOR_VAR
 SET @@session.max_heap_table_size = 65530.34;
 SET @@session.max_heap_table_size = 10737418241;
+--replace_result 4294966272 10737418240
 SELECT @@session.max_heap_table_size;
 
 --Error ER_WRONG_TYPE_FOR_VAR
 SET @@session.max_heap_table_size = test;
+--replace_result 4294966272 10737418240
 SELECT @@session.max_heap_table_size;
 
 
diff --git a/mysql-test/suite/sys_vars/t/rowid_merge_buff_size_basic.test b/mysql-test/suite/sys_vars/t/rowid_merge_buff_size_basic.test
index 1c88bdd7180..65aa9de65be 100644
--- a/mysql-test/suite/sys_vars/t/rowid_merge_buff_size_basic.test
+++ b/mysql-test/suite/sys_vars/t/rowid_merge_buff_size_basic.test
@@ -36,6 +36,7 @@ set global rowid_merge_buff_size="foo";
 set global rowid_merge_buff_size=0;
 select @@global.rowid_merge_buff_size;
 set session rowid_merge_buff_size=cast(-1 as unsigned int);
+--replace_result 2147483647 9223372036854775807
 select @@session.rowid_merge_buff_size;
 
 SET @@global.rowid_merge_buff_size = @start_global_value;
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index c070f0ecf7c..176ef95eac1 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -1146,6 +1146,11 @@ static Sys_var_ulonglong Sys_max_heap_table_size(
        VALID_RANGE(16384, (ulonglong)~(intptr)0), DEFAULT(16*1024*1024),
        BLOCK_SIZE(1024));
 
+/*
+  "pseudo_thread_id" variable used in the test suite to detect 32/64bit
+  systems.  If you change it to something else then ulong then fix the tests
+  in mysql-test/include/have_32bit.inc and have_64bit.inc.
+*/
 static Sys_var_ulong Sys_pseudo_thread_id(
        "pseudo_thread_id",
        "This variable is for internal server use",