summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/sys_vars/t
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:00:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:00:34 +0000
commit3f619478f796eddbba6e39502fe941b285dd97b1 (patch)
treee2c7b5777f728320e5b5542b6213fd3591ba51e2 /mysql-test/suite/sys_vars/t
parentInitial commit. (diff)
downloadmariadb-upstream.tar.xz
mariadb-upstream.zip
Adding upstream version 1:10.11.6.upstream/1%10.11.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/suite/sys_vars/t')
-rw-r--r--mysql-test/suite/sys_vars/t/all_vars-master.opt6
-rw-r--r--mysql-test/suite/sys_vars/t/all_vars.test82
-rw-r--r--mysql-test/suite/sys_vars/t/allow_suspicious_udfs.test14
-rw-r--r--mysql-test/suite/sys_vars/t/alter_algorithm_basic.test58
-rw-r--r--mysql-test/suite/sys_vars/t/aria_block_size_basic.test22
-rw-r--r--mysql-test/suite/sys_vars/t/aria_checkpoint_interval_basic.test43
-rw-r--r--mysql-test/suite/sys_vars/t/aria_checkpoint_log_activity_basic.test43
-rw-r--r--mysql-test/suite/sys_vars/t/aria_encrypt_tables_basic.test41
-rw-r--r--mysql-test/suite/sys_vars/t/aria_force_start_after_recovery_failures_basic.test22
-rw-r--r--mysql-test/suite/sys_vars/t/aria_group_commit_basic.test47
-rw-r--r--mysql-test/suite/sys_vars/t/aria_group_commit_interval_basic.test43
-rw-r--r--mysql-test/suite/sys_vars/t/aria_log_dir_path_basic.test35
-rw-r--r--mysql-test/suite/sys_vars/t/aria_log_file_size_basic.test47
-rw-r--r--mysql-test/suite/sys_vars/t/aria_log_purge_type_basic.test47
-rw-r--r--mysql-test/suite/sys_vars/t/aria_max_sort_file_size_basic.test47
-rw-r--r--mysql-test/suite/sys_vars/t/aria_page_checksum_basic.test39
-rw-r--r--mysql-test/suite/sys_vars/t/aria_pagecache_age_threshold_basic.test48
-rw-r--r--mysql-test/suite/sys_vars/t/aria_pagecache_buffer_size_basic.test26
-rw-r--r--mysql-test/suite/sys_vars/t/aria_pagecache_division_limit_basic.test43
-rw-r--r--mysql-test/suite/sys_vars/t/aria_pagecache_file_hash_size_basic.test22
-rw-r--r--mysql-test/suite/sys_vars/t/aria_recover_options_basic.test54
-rw-r--r--mysql-test/suite/sys_vars/t/aria_repair_threads_basic.test46
-rw-r--r--mysql-test/suite/sys_vars/t/aria_sort_buffer_size_basic.test46
-rw-r--r--mysql-test/suite/sys_vars/t/aria_stats_method_basic.test46
-rw-r--r--mysql-test/suite/sys_vars/t/aria_sync_log_dir_basic.test47
-rw-r--r--mysql-test/suite/sys_vars/t/aria_used_for_temp_tables_basic.test23
-rw-r--r--mysql-test/suite/sys_vars/t/auto_increment_increment_basic.test207
-rw-r--r--mysql-test/suite/sys_vars/t/auto_increment_increment_func.test191
-rw-r--r--mysql-test/suite/sys_vars/t/auto_increment_offset_basic.test213
-rw-r--r--mysql-test/suite/sys_vars/t/auto_increment_offset_func.test190
-rw-r--r--mysql-test/suite/sys_vars/t/autocommit_basic.test187
-rw-r--r--mysql-test/suite/sys_vars/t/autocommit_func.test159
-rw-r--r--mysql-test/suite/sys_vars/t/autocommit_func2-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/autocommit_func2.test1
-rw-r--r--mysql-test/suite/sys_vars/t/autocommit_func3-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/autocommit_func3.test1
-rw-r--r--mysql-test/suite/sys_vars/t/autocommit_func4-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/autocommit_func4.test1
-rw-r--r--mysql-test/suite/sys_vars/t/autocommit_func5-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/autocommit_func5.test1
-rw-r--r--mysql-test/suite/sys_vars/t/automatic_sp_privileges_basic.test174
-rw-r--r--mysql-test/suite/sys_vars/t/automatic_sp_privileges_func.test142
-rw-r--r--mysql-test/suite/sys_vars/t/back_log_basic.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/back_log_basic.test4
-rw-r--r--mysql-test/suite/sys_vars/t/basedir_basic.test100
-rw-r--r--mysql-test/suite/sys_vars/t/big_tables_basic.test171
-rw-r--r--mysql-test/suite/sys_vars/t/bind_address_basic.test95
-rw-r--r--mysql-test/suite/sys_vars/t/binlog_alter_two_phase.test52
-rw-r--r--mysql-test/suite/sys_vars/t/binlog_annotate_row_events_basic.test39
-rw-r--r--mysql-test/suite/sys_vars/t/binlog_annotate_row_events_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/binlog_cache_size_basic.test152
-rw-r--r--mysql-test/suite/sys_vars/t/binlog_cache_size_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/binlog_checksum_basic.test25
-rw-r--r--mysql-test/suite/sys_vars/t/binlog_commit_wait_count_basic.test14
-rw-r--r--mysql-test/suite/sys_vars/t/binlog_commit_wait_count_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/binlog_commit_wait_usec_basic.test14
-rw-r--r--mysql-test/suite/sys_vars/t/binlog_commit_wait_usec_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/binlog_direct_non_transactional_updates_basic.test97
-rw-r--r--mysql-test/suite/sys_vars/t/binlog_direct_non_transactional_updates_grant.test56
-rw-r--r--mysql-test/suite/sys_vars/t/binlog_expire_logs_seconds_basic.test137
-rw-r--r--mysql-test/suite/sys_vars/t/binlog_expire_logs_seconds_grant.test10
-rw-r--r--mysql-test/suite/sys_vars/t/binlog_file_cache_size_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/binlog_format_basic.test105
-rw-r--r--mysql-test/suite/sys_vars/t/binlog_format_grant.test49
-rw-r--r--mysql-test/suite/sys_vars/t/binlog_optimize_thread_scheduling_basic.test21
-rw-r--r--mysql-test/suite/sys_vars/t/binlog_row_image_basic.test129
-rw-r--r--mysql-test/suite/sys_vars/t/binlog_row_image_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/binlog_row_metadata_basic.test121
-rw-r--r--mysql-test/suite/sys_vars/t/binlog_row_metadata_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/binlog_stmt_cache_size_basic.test153
-rw-r--r--mysql-test/suite/sys_vars/t/binlog_stmt_cache_size_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/bulk_insert_buffer_size_basic.test204
-rw-r--r--mysql-test/suite/sys_vars/t/character_set_client_basic.test370
-rw-r--r--mysql-test/suite/sys_vars/t/character_set_client_func.test79
-rw-r--r--mysql-test/suite/sys_vars/t/character_set_connection_basic.test299
-rw-r--r--mysql-test/suite/sys_vars/t/character_set_connection_func.test101
-rw-r--r--mysql-test/suite/sys_vars/t/character_set_database_basic.test283
-rw-r--r--mysql-test/suite/sys_vars/t/character_set_database_func.test127
-rw-r--r--mysql-test/suite/sys_vars/t/character_set_filesystem_basic.test259
-rw-r--r--mysql-test/suite/sys_vars/t/character_set_filesystem_func-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/character_set_results_basic.test295
-rw-r--r--mysql-test/suite/sys_vars/t/character_set_results_func.test97
-rw-r--r--mysql-test/suite/sys_vars/t/character_set_server_basic.test289
-rw-r--r--mysql-test/suite/sys_vars/t/character_set_server_func.test102
-rw-r--r--mysql-test/suite/sys_vars/t/character_set_system_basic.test100
-rw-r--r--mysql-test/suite/sys_vars/t/character_sets_dir_basic.test25
-rw-r--r--mysql-test/suite/sys_vars/t/collation_connection_basic.test261
-rw-r--r--mysql-test/suite/sys_vars/t/collation_connection_func.test92
-rw-r--r--mysql-test/suite/sys_vars/t/collation_database_basic.test265
-rw-r--r--mysql-test/suite/sys_vars/t/collation_database_func.test130
-rw-r--r--mysql-test/suite/sys_vars/t/collation_server_basic.test261
-rw-r--r--mysql-test/suite/sys_vars/t/collation_server_func.test112
-rw-r--r--mysql-test/suite/sys_vars/t/completion_type_basic.test181
-rw-r--r--mysql-test/suite/sys_vars/t/completion_type_func.test171
-rw-r--r--mysql-test/suite/sys_vars/t/concurrent_insert_basic.test182
-rw-r--r--mysql-test/suite/sys_vars/t/concurrent_insert_func.test159
-rw-r--r--mysql-test/suite/sys_vars/t/connect_timeout_basic.test150
-rw-r--r--mysql-test/suite/sys_vars/t/connect_timeout_grant.test56
-rw-r--r--mysql-test/suite/sys_vars/t/datadir_basic.test100
-rw-r--r--mysql-test/suite/sys_vars/t/date_format_basic.test18
-rw-r--r--mysql-test/suite/sys_vars/t/datetime_format_basic.test18
-rw-r--r--mysql-test/suite/sys_vars/t/deadlock_search_depth_long_basic.test42
-rw-r--r--mysql-test/suite/sys_vars/t/deadlock_search_depth_short_basic.test42
-rw-r--r--mysql-test/suite/sys_vars/t/deadlock_timeout_long_basic.test42
-rw-r--r--mysql-test/suite/sys_vars/t/deadlock_timeout_short_basic.test42
-rw-r--r--mysql-test/suite/sys_vars/t/debug_basic.test22
-rw-r--r--mysql-test/suite/sys_vars/t/debug_binlog_fsync_sleep_basic.test44
-rw-r--r--mysql-test/suite/sys_vars/t/debug_dbug_basic.test22
-rw-r--r--mysql-test/suite/sys_vars/t/debug_dbug_func.test127
-rw-r--r--mysql-test/suite/sys_vars/t/debug_dbug_func_notembedded.test34
-rw-r--r--mysql-test/suite/sys_vars/t/debug_mutex_deadlock_detector_basic.test23
-rw-r--r--mysql-test/suite/sys_vars/t/debug_no_thread_alarm_basic.test21
-rw-r--r--mysql-test/suite/sys_vars/t/debug_sync_basic.test21
-rw-r--r--mysql-test/suite/sys_vars/t/default_master_connection_basic.test124
-rw-r--r--mysql-test/suite/sys_vars/t/default_regex_flags_basic.test41
-rw-r--r--mysql-test/suite/sys_vars/t/default_storage_engine_basic.test181
-rw-r--r--mysql-test/suite/sys_vars/t/default_tmp_storage_engine_basic.test193
-rw-r--r--mysql-test/suite/sys_vars/t/default_tmp_storage_engine_rocksdb.test86
-rw-r--r--mysql-test/suite/sys_vars/t/default_week_format_basic.test194
-rw-r--r--mysql-test/suite/sys_vars/t/default_week_format_func.test66
-rw-r--r--mysql-test/suite/sys_vars/t/delay_key_write_basic.test168
-rw-r--r--mysql-test/suite/sys_vars/t/delay_key_write_func-master.opt2
-rw-r--r--mysql-test/suite/sys_vars/t/delay_key_write_func.test113
-rw-r--r--mysql-test/suite/sys_vars/t/delayed_insert_limit_basic.test162
-rw-r--r--mysql-test/suite/sys_vars/t/delayed_insert_limit_func.test217
-rw-r--r--mysql-test/suite/sys_vars/t/delayed_insert_timeout_basic.test165
-rw-r--r--mysql-test/suite/sys_vars/t/delayed_queue_size_basic.test158
-rw-r--r--mysql-test/suite/sys_vars/t/disconnect_on_expired_password_grant.test56
-rw-r--r--mysql-test/suite/sys_vars/t/div_precision_increment_basic.test204
-rw-r--r--mysql-test/suite/sys_vars/t/div_precision_increment_func.test121
-rw-r--r--mysql-test/suite/sys_vars/t/encrypt_tmp_disk_tables_basic.test41
-rw-r--r--mysql-test/suite/sys_vars/t/enforce_storage_engine_basic.test40
-rw-r--r--mysql-test/suite/sys_vars/t/error_count_basic.test97
-rw-r--r--mysql-test/suite/sys_vars/t/event_scheduler_basic.test169
-rw-r--r--mysql-test/suite/sys_vars/t/expensive_subquery_limit_basic.test38
-rw-r--r--mysql-test/suite/sys_vars/t/expire_logs_days_basic.test170
-rw-r--r--mysql-test/suite/sys_vars/t/expire_logs_days_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/explicit_defaults_for_timestamp_off.test3
-rw-r--r--mysql-test/suite/sys_vars/t/explicit_defaults_for_timestamp_on.test3
-rw-r--r--mysql-test/suite/sys_vars/t/external_user_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/extra_max_connections_basic.test42
-rw-r--r--mysql-test/suite/sys_vars/t/extra_max_connections_grant.test56
-rw-r--r--mysql-test/suite/sys_vars/t/extra_port_basic.test21
-rw-r--r--mysql-test/suite/sys_vars/t/flush_basic.test168
-rw-r--r--mysql-test/suite/sys_vars/t/flush_time_basic.test50
-rw-r--r--mysql-test/suite/sys_vars/t/foreign_key_checks_basic.test165
-rw-r--r--mysql-test/suite/sys_vars/t/foreign_key_checks_func.test131
-rw-r--r--mysql-test/suite/sys_vars/t/ft_boolean_syntax_basic.test159
-rw-r--r--mysql-test/suite/sys_vars/t/ft_boolean_syntax_func.test114
-rw-r--r--mysql-test/suite/sys_vars/t/ft_max_word_len_basic.test19
-rw-r--r--mysql-test/suite/sys_vars/t/ft_min_word_len_basic.test19
-rw-r--r--mysql-test/suite/sys_vars/t/ft_query_expansion_limit_basic.test19
-rw-r--r--mysql-test/suite/sys_vars/t/ft_stopword_file_basic.test19
-rw-r--r--mysql-test/suite/sys_vars/t/general_log_basic.test165
-rw-r--r--mysql-test/suite/sys_vars/t/general_log_file_basic-master.opt2
-rw-r--r--mysql-test/suite/sys_vars/t/general_log_file_basic.test90
-rw-r--r--mysql-test/suite/sys_vars/t/general_log_file_func-master.opt3
-rw-r--r--mysql-test/suite/sys_vars/t/general_log_file_func.test56
-rw-r--r--mysql-test/suite/sys_vars/t/general_log_func.test102
-rw-r--r--mysql-test/suite/sys_vars/t/group_concat_max_len_basic.test205
-rw-r--r--mysql-test/suite/sys_vars/t/group_concat_max_len_func.test170
-rw-r--r--mysql-test/suite/sys_vars/t/gtid_binlog_pos_basic.test15
-rw-r--r--mysql-test/suite/sys_vars/t/gtid_binlog_state_basic.test17
-rw-r--r--mysql-test/suite/sys_vars/t/gtid_binlog_state_grant.test67
-rw-r--r--mysql-test/suite/sys_vars/t/gtid_cleanup_batch_size_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/gtid_current_pos_basic.test15
-rw-r--r--mysql-test/suite/sys_vars/t/gtid_domain_id_basic.test17
-rw-r--r--mysql-test/suite/sys_vars/t/gtid_domain_id_grant.test16
-rw-r--r--mysql-test/suite/sys_vars/t/gtid_ignore_duplicates_basic.test14
-rw-r--r--mysql-test/suite/sys_vars/t/gtid_ignore_duplicates_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/gtid_pos_auto_engines_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/gtid_seq_no_basic.test15
-rw-r--r--mysql-test/suite/sys_vars/t/gtid_seq_no_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/gtid_slave_pos_basic.test46
-rw-r--r--mysql-test/suite/sys_vars/t/gtid_slave_pos_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/gtid_strict_mode_basic.test21
-rw-r--r--mysql-test/suite/sys_vars/t/gtid_strict_mode_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/have_compress_basic.test100
-rw-r--r--mysql-test/suite/sys_vars/t/have_crypt_basic.test100
-rw-r--r--mysql-test/suite/sys_vars/t/have_dynamic_loading_basic.test100
-rw-r--r--mysql-test/suite/sys_vars/t/have_geometry_basic.test100
-rw-r--r--mysql-test/suite/sys_vars/t/have_openssl_basic.test100
-rw-r--r--mysql-test/suite/sys_vars/t/have_profiling_basic.test23
-rw-r--r--mysql-test/suite/sys_vars/t/have_query_cache_basic.test100
-rw-r--r--mysql-test/suite/sys_vars/t/have_rtree_keys_basic.test100
-rw-r--r--mysql-test/suite/sys_vars/t/have_ssl_basic.test100
-rw-r--r--mysql-test/suite/sys_vars/t/have_symlink_basic.test100
-rw-r--r--mysql-test/suite/sys_vars/t/histogram_size_basic.test138
-rw-r--r--mysql-test/suite/sys_vars/t/histogram_type_basic.test92
-rw-r--r--mysql-test/suite/sys_vars/t/host_cache_size_auto-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/host_cache_size_auto.test1
-rw-r--r--mysql-test/suite/sys_vars/t/host_cache_size_basic-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/host_cache_size_basic.test41
-rw-r--r--mysql-test/suite/sys_vars/t/hostname_basic.test100
-rw-r--r--mysql-test/suite/sys_vars/t/identity_basic.test184
-rw-r--r--mysql-test/suite/sys_vars/t/identity_func-master.opt2
-rw-r--r--mysql-test/suite/sys_vars/t/identity_func.test140
-rw-r--r--mysql-test/suite/sys_vars/t/ignore_builtin_innodb_basic.test19
-rw-r--r--mysql-test/suite/sys_vars/t/ignore_db_dirs_basic-master.opt11
-rw-r--r--mysql-test/suite/sys_vars/t/ignore_db_dirs_basic.test40
-rw-r--r--mysql-test/suite/sys_vars/t/in_transaction_basic.test21
-rw-r--r--mysql-test/suite/sys_vars/t/init_connect_basic.test156
-rw-r--r--mysql-test/suite/sys_vars/t/init_connect_grant.test56
-rw-r--r--mysql-test/suite/sys_vars/t/init_file_basic.test19
-rw-r--r--mysql-test/suite/sys_vars/t/init_slave_basic.test153
-rw-r--r--mysql-test/suite/sys_vars/t/init_slave_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_adaptive_flushing_basic.test70
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_adaptive_flushing_lwm_basic.test142
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_adaptive_hash_index_basic.test69
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_adaptive_hash_index_parts_basic.test75
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_autoextend_increment_basic.test152
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_basic.test93
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_func-master.opt2
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_func.test59
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_buf_dump_status_frequency_basic.test39
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_buf_flush_list_now_basic.test32
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_buffer_pool_chunk_size_basic.test75
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_abort_loads.opt5
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_abort_loads.test150
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_at_shutdown_basic.test45
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_now_basic.test48
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_pct_basic.test71
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_pct_function.opt5
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_pct_function.test107
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_buffer_pool_evict_basic.test19
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_buffer_pool_load_abort_basic.test15
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_buffer_pool_load_at_startup_basic.test15
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_buffer_pool_load_now_basic.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_buffer_pool_load_now_basic.test49
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic.test114
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_change_buffer_max_size_basic.test71
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_change_buffering_basic.test65
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_change_buffering_debug_basic.test59
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_checksum_algorithm_basic.test32
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_cmp_per_index_enabled_basic.test70
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_compression_algorithm_basic-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_compression_algorithm_basic.test46
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_compression_failure_threshold_pct_basic.test155
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_compression_level_basic.test72
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_compression_pad_pct_max_basic.test148
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_data_file_path_basic.test106
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_data_home_dir_basic.test106
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_deadlock_detect_basic.test53
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_default_row_format_basic.test41
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_defragment_basic.test20
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_defragment_fill_factor_basic.test27
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_defragment_fill_factor_n_recs_basic.test31
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_defragment_frequency_basic.test37
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_defragment_n_pages_basic.test22
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_defragment_stats_accuracy_basic.test24
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_disable_sort_file_cache_basic.test70
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_doublewrite_basic.test106
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_encrypt_log_basic.test50
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_encrypt_tables_basic.test44
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_encryption_rotate_key_age_basic.test41
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_encryption_rotation_iops_basic.test41
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_encryption_threads_basic.test41
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_fast_shutdown_basic.test203
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_fatal_semaphore_wait_threshold-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_fatal_semaphore_wait_threshold.test69
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_fatal_semaphore_wait_threshold_basic.test21
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_fil_make_page_dirty_debug_basic.test36
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_file_io_threads_basic.test145
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_file_per_table_basic-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_file_per_table_basic.test116
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_fill_factor_basic.test41
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_flush_log_at_timeout_basic.test164
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_flush_log_at_trx_commit_basic.test168
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_flush_method_basic.test106
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_flush_method_func.test28
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_flush_neighbors_basic.test85
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_flush_sync_basic.test72
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_flushing_avg_loops_basic.test153
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_force_primary_key_basic.test57
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_force_recovery_basic.test106
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_ft_aux_table_basic.test43
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_ft_cache_size_basic.test29
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_ft_enable_diag_print_basic.test82
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_ft_enable_stopword_basic.test97
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_ft_max_token_size_basic.test28
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_ft_min_token_size_basic.test28
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_ft_num_word_optimize_basic.test58
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_ft_result_cache_limit.test9
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_ft_result_cache_limit_basic.test39
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_ft_server_stopword_table_basic.test45
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_ft_sort_pll_degree_basic.test28
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_ft_total_cache_size_basic.test28
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_ft_user_stopword_table_basic.test41
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_immediate_scrub_data_uncompressed_basic.test41
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_instant_alter_column_allowed_basic.test34
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_io_capacity_basic.test62
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_io_capacity_max_basic.test85
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_limit_optimistic_insert_debug_basic.test56
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_lock_wait_timeout_basic.test171
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_log_buffer_size_basic.test106
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_log_checkpoint_now_basic.test81
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_log_file_size_basic.test105
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_log_group_home_dir_basic.test106
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_lru_scan_depth_basic.test66
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_basic.test195
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_func.test175
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_lwm_basic.test175
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_max_purge_lag_basic.test179
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_max_purge_lag_delay_basic.test45
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_max_undo_log_size_basic.test103
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_merge_threshold_set_all_debug_basic.test30
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_numa_interleave_basic-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_numa_interleave_basic.test15
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_old_blocks_pct_basic.test83
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_old_blocks_time_basic.test58
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_online_alter_log_max_size_basic.test57
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_open_files_basic.test106
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_optimize_fulltext_only_basic.test82
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_page_size_basic.test16
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_print_all_deadlocks_basic.test93
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_purge_batch_size_basic.test155
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_purge_rseg_truncate_frequency_basic.test161
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_purge_threads_basic.test63
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_random_read_ahead_basic.test82
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_read_ahead_threshold_basic.test79
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_read_io_threads_basic.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_read_io_threads_basic.test36
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_read_only_basic.test22
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_rollback_on_timeout_basic.test106
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_saved_page_number_debug_basic.test37
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_sort_buffer_size_basic.test28
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_spin_wait_delay_basic.test92
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_stats_auto_recalc_basic.test31
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_stats_include_delete_marked_basic.test53
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_stats_method_basic.test80
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_stats_modified_counter_basic.test47
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_stats_on_metadata_basic.test82
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_stats_persistent_basic.test32
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_stats_persistent_sample_pages_basic.test87
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_stats_traditional_basic.test65
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_stats_transient_sample_pages_basic.test71
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_status_output_basic.test83
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_status_output_locks_basic.test83
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_strict_mode_basic.test97
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_sync_spin_loops_basic.test180
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_table_locks_basic.test238
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_table_locks_func.test95
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_temp_data_file_path_basic.test106
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_tmpdir_basic.test43
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_trx_purge_view_update_only_debug_basic.test60
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_trx_rseg_n_slots_debug_basic.test59
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_undo_directory_basic.test89
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_undo_log_truncate_basic.test113
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_undo_tablespaces_basic.test78
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_use_atomic_writes_basic.test22
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_use_native_aio_basic.test106
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_write_io_threads_basic.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_write_io_threads_basic.test36
-rw-r--r--mysql-test/suite/sys_vars/t/insert_id_basic.test186
-rw-r--r--mysql-test/suite/sys_vars/t/insert_id_func.test125
-rw-r--r--mysql-test/suite/sys_vars/t/interactive_timeout_basic.test206
-rw-r--r--mysql-test/suite/sys_vars/t/interactive_timeout_func.test82
-rw-r--r--mysql-test/suite/sys_vars/t/join_buffer_size_basic.test187
-rw-r--r--mysql-test/suite/sys_vars/t/join_buffer_space_limit_basic.test45
-rw-r--r--mysql-test/suite/sys_vars/t/join_cache_level_basic.test43
-rw-r--r--mysql-test/suite/sys_vars/t/keep_files_on_create_basic.test219
-rw-r--r--mysql-test/suite/sys_vars/t/key_buffer_size_basic.test147
-rw-r--r--mysql-test/suite/sys_vars/t/key_buffer_size_func.test114
-rw-r--r--mysql-test/suite/sys_vars/t/key_cache_age_threshold_basic.test169
-rw-r--r--mysql-test/suite/sys_vars/t/key_cache_block_size_basic.test174
-rw-r--r--mysql-test/suite/sys_vars/t/key_cache_division_limit_basic.test175
-rw-r--r--mysql-test/suite/sys_vars/t/key_cache_file_hash_size_basic.test164
-rw-r--r--mysql-test/suite/sys_vars/t/key_cache_segments_basic.test42
-rw-r--r--mysql-test/suite/sys_vars/t/large_files_support_basic.test19
-rw-r--r--mysql-test/suite/sys_vars/t/large_page_size_basic.test23
-rw-r--r--mysql-test/suite/sys_vars/t/large_pages_basic.test19
-rw-r--r--mysql-test/suite/sys_vars/t/last_gtid_basic.test11
-rw-r--r--mysql-test/suite/sys_vars/t/last_insert_id_basic.test38
-rw-r--r--mysql-test/suite/sys_vars/t/last_insert_id_func-master.opt2
-rw-r--r--mysql-test/suite/sys_vars/t/last_insert_id_func.test138
-rw-r--r--mysql-test/suite/sys_vars/t/lc_messages_basic.test42
-rw-r--r--mysql-test/suite/sys_vars/t/lc_messages_dir_basic.test23
-rw-r--r--mysql-test/suite/sys_vars/t/lc_time_names_basic.test719
-rw-r--r--mysql-test/suite/sys_vars/t/lc_time_names_func.test81
-rw-r--r--mysql-test/suite/sys_vars/t/license_basic.test100
-rw-r--r--mysql-test/suite/sys_vars/t/local_infile_basic.test171
-rw-r--r--mysql-test/suite/sys_vars/t/local_infile_func.test88
-rw-r--r--mysql-test/suite/sys_vars/t/lock_wait_timeout_basic.test213
-rw-r--r--mysql-test/suite/sys_vars/t/locked_in_memory_basic.test20
-rw-r--r--mysql-test/suite/sys_vars/t/log_bin_basename_basic.test13
-rw-r--r--mysql-test/suite/sys_vars/t/log_bin_basic.test19
-rw-r--r--mysql-test/suite/sys_vars/t/log_bin_compress_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/log_bin_compress_min_len_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/log_bin_index_basic.test13
-rw-r--r--mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_basic.test164
-rw-r--r--mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_func.test148
-rw-r--r--mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/log_disabled_statements_basic.test51
-rw-r--r--mysql-test/suite/sys_vars/t/log_disabled_statements_func-master.opt2
-rw-r--r--mysql-test/suite/sys_vars/t/log_disabled_statements_func.test67
-rw-r--r--mysql-test/suite/sys_vars/t/log_error_func.test23
-rw-r--r--mysql-test/suite/sys_vars/t/log_error_func2.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/log_error_func2.test20
-rw-r--r--mysql-test/suite/sys_vars/t/log_error_func3.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/log_error_func3.test5
-rw-r--r--mysql-test/suite/sys_vars/t/log_output_basic.test217
-rw-r--r--mysql-test/suite/sys_vars/t/log_output_func.test123
-rw-r--r--mysql-test/suite/sys_vars/t/log_queries_not_using_indexes_basic.test135
-rw-r--r--mysql-test/suite/sys_vars/t/log_slave_updates_basic.test19
-rw-r--r--mysql-test/suite/sys_vars/t/log_slow_admin_statements_func.test90
-rw-r--r--mysql-test/suite/sys_vars/t/log_slow_disabled_statements_func.test94
-rw-r--r--mysql-test/suite/sys_vars/t/log_slow_verbosity_basic.test73
-rw-r--r--mysql-test/suite/sys_vars/t/log_tc_size_basic.test5
-rw-r--r--mysql-test/suite/sys_vars/t/log_warnings_basic.test209
-rw-r--r--mysql-test/suite/sys_vars/t/long_query_time_basic.test187
-rw-r--r--mysql-test/suite/sys_vars/t/low_priority_updates_basic.test218
-rw-r--r--mysql-test/suite/sys_vars/t/lower_case_file_system_basic.test31
-rw-r--r--mysql-test/suite/sys_vars/t/lower_case_table_names_basic.test32
-rw-r--r--mysql-test/suite/sys_vars/t/master_verify_checksum_basic.test19
-rw-r--r--mysql-test/suite/sys_vars/t/master_verify_checksum_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/max_allowed_packet_basic.test224
-rw-r--r--mysql-test/suite/sys_vars/t/max_allowed_packet_func.test83
-rw-r--r--mysql-test/suite/sys_vars/t/max_binlog_cache_size_basic.test187
-rw-r--r--mysql-test/suite/sys_vars/t/max_binlog_cache_size_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/max_binlog_size_basic.test175
-rw-r--r--mysql-test/suite/sys_vars/t/max_binlog_size_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/max_binlog_stmt_cache_size_basic.test188
-rw-r--r--mysql-test/suite/sys_vars/t/max_binlog_stmt_cache_size_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/max_connect_errors_basic.test170
-rw-r--r--mysql-test/suite/sys_vars/t/max_connect_errors_grant.test56
-rw-r--r--mysql-test/suite/sys_vars/t/max_connections_basic.test173
-rw-r--r--mysql-test/suite/sys_vars/t/max_connections_grant.test56
-rw-r--r--mysql-test/suite/sys_vars/t/max_delayed_threads_basic.test223
-rw-r--r--mysql-test/suite/sys_vars/t/max_digest_length_basic.test46
-rw-r--r--mysql-test/suite/sys_vars/t/max_error_count_basic.test213
-rw-r--r--mysql-test/suite/sys_vars/t/max_heap_table_size_basic.test210
-rw-r--r--mysql-test/suite/sys_vars/t/max_join_size_basic.test54
-rw-r--r--mysql-test/suite/sys_vars/t/max_join_size_func.test120
-rw-r--r--mysql-test/suite/sys_vars/t/max_length_for_sort_data_basic.test224
-rw-r--r--mysql-test/suite/sys_vars/t/max_password_errors_grant.test56
-rw-r--r--mysql-test/suite/sys_vars/t/max_prepared_stmt_count_basic.test179
-rw-r--r--mysql-test/suite/sys_vars/t/max_prepared_stmt_count_func.test152
-rw-r--r--mysql-test/suite/sys_vars/t/max_relay_log_size_basic.test172
-rw-r--r--mysql-test/suite/sys_vars/t/max_seeks_for_key_basic.test212
-rw-r--r--mysql-test/suite/sys_vars/t/max_seeks_for_key_func.test101
-rw-r--r--mysql-test/suite/sys_vars/t/max_sort_length_func.test209
-rw-r--r--mysql-test/suite/sys_vars/t/max_sp_recursion_depth_basic.test225
-rw-r--r--mysql-test/suite/sys_vars/t/max_sp_recursion_depth_func.test176
-rw-r--r--mysql-test/suite/sys_vars/t/max_statement_time_basic.test217
-rw-r--r--mysql-test/suite/sys_vars/t/max_tmp_tables_basic.test227
-rw-r--r--mysql-test/suite/sys_vars/t/max_user_connections-2.test11
-rw-r--r--mysql-test/suite/sys_vars/t/max_user_connections_basic-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/max_user_connections_basic.test167
-rw-r--r--mysql-test/suite/sys_vars/t/max_user_connections_func-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/max_user_connections_func.test89
-rw-r--r--mysql-test/suite/sys_vars/t/max_write_lock_count_basic.test158
-rw-r--r--mysql-test/suite/sys_vars/t/maximum_basic-master.opt5
-rw-r--r--mysql-test/suite/sys_vars/t/maximum_basic.test39
-rw-r--r--mysql-test/suite/sys_vars/t/metadata_locks_cache_size_basic-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/metadata_locks_cache_size_basic.test25
-rw-r--r--mysql-test/suite/sys_vars/t/metadata_locks_hash_instances_basic.test60
-rw-r--r--mysql-test/suite/sys_vars/t/min_examined_row_limit_basic.test218
-rw-r--r--mysql-test/suite/sys_vars/t/mrr_buffer_size_basic.test42
-rw-r--r--mysql-test/suite/sys_vars/t/myisam_block_size_basic.test21
-rw-r--r--mysql-test/suite/sys_vars/t/myisam_data_pointer_size_basic.test179
-rw-r--r--mysql-test/suite/sys_vars/t/myisam_data_pointer_size_func-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/myisam_data_pointer_size_func.test106
-rw-r--r--mysql-test/suite/sys_vars/t/myisam_max_sort_file_size_basic.test182
-rw-r--r--mysql-test/suite/sys_vars/t/myisam_mmap_size_basic.test23
-rw-r--r--mysql-test/suite/sys_vars/t/myisam_recover_options_basic.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/myisam_recover_options_basic.test18
-rw-r--r--mysql-test/suite/sys_vars/t/myisam_repair_threads_basic.test248
-rw-r--r--mysql-test/suite/sys_vars/t/myisam_sort_buffer_size_basic.test225
-rw-r--r--mysql-test/suite/sys_vars/t/myisam_stats_method_basic.test199
-rw-r--r--mysql-test/suite/sys_vars/t/myisam_stats_method_func.test111
-rw-r--r--mysql-test/suite/sys_vars/t/myisam_use_mmap_basic.test104
-rw-r--r--mysql-test/suite/sys_vars/t/mysql56_temporal_format_basic.test163
-rw-r--r--mysql-test/suite/sys_vars/t/mysql56_temporal_format_func.test66
-rw-r--r--mysql-test/suite/sys_vars/t/named_pipe_basic.test19
-rw-r--r--mysql-test/suite/sys_vars/t/net_buffer_length_basic.test203
-rw-r--r--mysql-test/suite/sys_vars/t/net_read_timeout_basic.test206
-rw-r--r--mysql-test/suite/sys_vars/t/net_retry_count_basic.test215
-rw-r--r--mysql-test/suite/sys_vars/t/net_write_timeout_basic.test202
-rw-r--r--mysql-test/suite/sys_vars/t/old_alter_table_basic.test68
-rw-r--r--mysql-test/suite/sys_vars/t/old_basic.test15
-rw-r--r--mysql-test/suite/sys_vars/t/old_mode_basic.test352
-rw-r--r--mysql-test/suite/sys_vars/t/old_passwords_basic.test217
-rw-r--r--mysql-test/suite/sys_vars/t/old_passwords_func.test109
-rw-r--r--mysql-test/suite/sys_vars/t/open_files_limit_basic.test24
-rw-r--r--mysql-test/suite/sys_vars/t/optimizer_prune_level_basic.test233
-rw-r--r--mysql-test/suite/sys_vars/t/optimizer_search_depth_basic.test209
-rw-r--r--mysql-test/suite/sys_vars/t/optimizer_selectivity_sampling_limit_basic.test154
-rw-r--r--mysql-test/suite/sys_vars/t/optimizer_switch_basic.test52
-rw-r--r--mysql-test/suite/sys_vars/t/optimizer_use_condition_selectivity_basic.test122
-rw-r--r--mysql-test/suite/sys_vars/t/oqgraph_allow_create_integer_latch_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/performance_schema_basic-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/performance_schema_basic.test32
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_accounts_size_basic-master.opt2
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_accounts_size_basic.test32
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_digests_size-master_basic.opt2
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_digests_size_basic.test47
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_events_stages_history_long_size_basic-master.opt2
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_events_stages_history_long_size_basic.test32
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_events_stages_history_size_basic-master.opt2
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_events_stages_history_size_basic.test32
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_events_statements_history_long_size_basic-master.opt2
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_events_statements_history_long_size_basic.test32
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_events_statements_history_size_basic-master.opt2
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_events_statements_history_size_basic.test32
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_events_waits_history_long_size_basic-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_events_waits_history_long_size_basic.test32
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_events_waits_history_size_basic-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_events_waits_history_size_basic.test32
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_hosts_size_basic-master.opt2
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_hosts_size_basic.test32
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_max_cond_classes_basic-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_max_cond_classes_basic.test32
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_max_cond_instances_basic-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_max_cond_instances_basic.test32
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_max_digest_length-master_basic.opt2
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_max_digest_length_basic.test47
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_max_file_classes_basic-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_max_file_classes_basic.test32
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_max_file_handles_basic-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_max_file_handles_basic.test32
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_max_file_instances_basic-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_max_file_instances_basic.test32
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_max_mutex_classes_basic-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_max_mutex_classes_basic.test32
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_max_mutex_instances_basic-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_max_mutex_instances_basic.test32
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_max_rwlock_classes_basic-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_max_rwlock_classes_basic.test32
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_max_rwlock_instances_basic-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_max_rwlock_instances_basic.test32
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_max_socket_classes_basic-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_max_socket_classes_basic.test32
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_max_socket_instances_basic-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_max_socket_instances_basic.test32
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_max_stage_classes_basic-master.opt2
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_max_stage_classes_basic.test32
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_max_statement_classes_basic-master.opt2
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_max_statement_classes_basic.test32
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_max_table_handles_basic-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_max_table_handles_basic.test32
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_max_table_instances_basic-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_max_table_instances_basic.test32
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_max_thread_classes_basic-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_max_thread_classes_basic.test32
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_max_thread_instances_basic-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_max_thread_instances_basic.test32
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_session_connect_attrs_size_basic-master.opt2
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_session_connect_attrs_size_basic.test47
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_setup_actors_size_basic-master.opt2
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_setup_actors_size_basic.test32
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_setup_objects_size_basic-master.opt2
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_setup_objects_size_basic.test32
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_users_size_basic-master.opt2
-rw-r--r--mysql-test/suite/sys_vars/t/pfs_users_size_basic.test32
-rw-r--r--mysql-test/suite/sys_vars/t/pid_file_basic.test23
-rw-r--r--mysql-test/suite/sys_vars/t/plugin_dir_basic-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/plugin_dir_basic.test29
-rw-r--r--mysql-test/suite/sys_vars/t/plugin_maturity_basic.test21
-rw-r--r--mysql-test/suite/sys_vars/t/port_basic.test23
-rw-r--r--mysql-test/suite/sys_vars/t/preload_buffer_size_basic.test216
-rw-r--r--mysql-test/suite/sys_vars/t/preudo_thread_id_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/profiling_basic.test52
-rw-r--r--mysql-test/suite/sys_vars/t/profiling_history_size_basic.test52
-rw-r--r--mysql-test/suite/sys_vars/t/progress_report_time_basic.test42
-rw-r--r--mysql-test/suite/sys_vars/t/protocol_version_basic.test18
-rw-r--r--mysql-test/suite/sys_vars/t/proxy_protocol_networks_grant.test56
-rw-r--r--mysql-test/suite/sys_vars/t/proxy_user_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/pseudo_slave_mode_basic.test168
-rw-r--r--mysql-test/suite/sys_vars/t/pseudo_thread_id_basic.test45
-rw-r--r--mysql-test/suite/sys_vars/t/query_alloc_block_size_basic.test210
-rw-r--r--mysql-test/suite/sys_vars/t/query_cache_limit_basic.test173
-rw-r--r--mysql-test/suite/sys_vars/t/query_cache_limit_func.test182
-rw-r--r--mysql-test/suite/sys_vars/t/query_cache_min_res_unit_basic.test180
-rw-r--r--mysql-test/suite/sys_vars/t/query_cache_size_basic.test161
-rw-r--r--mysql-test/suite/sys_vars/t/query_cache_strip_comments_basic.test39
-rw-r--r--mysql-test/suite/sys_vars/t/query_cache_type_basic.test196
-rw-r--r--mysql-test/suite/sys_vars/t/query_cache_type_func.test308
-rw-r--r--mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_basic.test223
-rw-r--r--mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_func.test263
-rw-r--r--mysql-test/suite/sys_vars/t/query_prealloc_size_basic.test240
-rw-r--r--mysql-test/suite/sys_vars/t/query_prealloc_size_func.test91
-rw-r--r--mysql-test/suite/sys_vars/t/rand_seed1_basic.test37
-rw-r--r--mysql-test/suite/sys_vars/t/rand_seed2_basic.test38
-rw-r--r--mysql-test/suite/sys_vars/t/range_alloc_block_size_basic.test205
-rw-r--r--mysql-test/suite/sys_vars/t/read_binlog_speed_limit_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/read_buffer_size_basic.test206
-rw-r--r--mysql-test/suite/sys_vars/t/read_only_basic.test168
-rw-r--r--mysql-test/suite/sys_vars/t/read_only_func.test147
-rw-r--r--mysql-test/suite/sys_vars/t/read_only_grant.test45
-rw-r--r--mysql-test/suite/sys_vars/t/read_rnd_buffer_size_basic.test185
-rw-r--r--mysql-test/suite/sys_vars/t/relay_log_basename_basic.test16
-rw-r--r--mysql-test/suite/sys_vars/t/relay_log_basic.test27
-rw-r--r--mysql-test/suite/sys_vars/t/relay_log_index_basic.test33
-rw-r--r--mysql-test/suite/sys_vars/t/relay_log_info_file_basic.test19
-rw-r--r--mysql-test/suite/sys_vars/t/relay_log_purge_basic.test162
-rw-r--r--mysql-test/suite/sys_vars/t/relay_log_purge_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/relay_log_recovery_basic.test49
-rw-r--r--mysql-test/suite/sys_vars/t/relay_log_recovery_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/relay_log_space_limit_basic.test19
-rw-r--r--mysql-test/suite/sys_vars/t/replicate_annotate_row_events_basic.test23
-rw-r--r--mysql-test/suite/sys_vars/t/replicate_do_db_basic.test45
-rw-r--r--mysql-test/suite/sys_vars/t/replicate_do_db_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/replicate_do_table_basic.test51
-rw-r--r--mysql-test/suite/sys_vars/t/replicate_do_table_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/replicate_events_marked_for_skip_basic.test31
-rw-r--r--mysql-test/suite/sys_vars/t/replicate_events_marked_for_skip_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/replicate_ignore_db_basic.test42
-rw-r--r--mysql-test/suite/sys_vars/t/replicate_ignore_db_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/replicate_ignore_table_basic.test58
-rw-r--r--mysql-test/suite/sys_vars/t/replicate_ignore_table_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/replicate_rewrite_db.opt3
-rw-r--r--mysql-test/suite/sys_vars/t/replicate_rewrite_db.test84
-rw-r--r--mysql-test/suite/sys_vars/t/replicate_wild_do_table_basic.test51
-rw-r--r--mysql-test/suite/sys_vars/t/replicate_wild_do_table_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/replicate_wild_ignore_table_basic.test51
-rw-r--r--mysql-test/suite/sys_vars/t/replicate_wild_ignore_table_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/report_host_basic.test19
-rw-r--r--mysql-test/suite/sys_vars/t/report_password_basic.test19
-rw-r--r--mysql-test/suite/sys_vars/t/report_port_basic.test25
-rw-r--r--mysql-test/suite/sys_vars/t/report_user_basic.test19
-rw-r--r--mysql-test/suite/sys_vars/t/rowid_merge_buff_size_basic.test43
-rw-r--r--mysql-test/suite/sys_vars/t/rpl_init_slave_func.test111
-rw-r--r--mysql-test/suite/sys_vars/t/rpl_max_binlog_size_func-master.opt3
-rw-r--r--mysql-test/suite/sys_vars/t/rpl_max_binlog_size_func.test42
-rw-r--r--mysql-test/suite/sys_vars/t/rpl_semi_sync_master_enabled_basic.test88
-rw-r--r--mysql-test/suite/sys_vars/t/rpl_semi_sync_master_enabled_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/rpl_semi_sync_master_timeout_basic.test49
-rw-r--r--mysql-test/suite/sys_vars/t/rpl_semi_sync_master_timeout_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/rpl_semi_sync_master_trace_level_basic.test57
-rw-r--r--mysql-test/suite/sys_vars/t/rpl_semi_sync_master_trace_level_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/rpl_semi_sync_master_wait_no_slave_basic.test60
-rw-r--r--mysql-test/suite/sys_vars/t/rpl_semi_sync_master_wait_no_slave_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/rpl_semi_sync_master_wait_point_basic.test39
-rw-r--r--mysql-test/suite/sys_vars/t/rpl_semi_sync_master_wait_point_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/rpl_semi_sync_slave_delay_master_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/rpl_semi_sync_slave_enabled_basic.test60
-rw-r--r--mysql-test/suite/sys_vars/t/rpl_semi_sync_slave_enabled_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/rpl_semi_sync_slave_kill_conn_timeout_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/rpl_semi_sync_slave_trace_level_basic.test57
-rw-r--r--mysql-test/suite/sys_vars/t/rpl_semi_sync_slave_trace_level_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/secure_auth_basic.test170
-rw-r--r--mysql-test/suite/sys_vars/t/secure_auth_func-master.opt2
-rw-r--r--mysql-test/suite/sys_vars/t/secure_auth_func.test121
-rw-r--r--mysql-test/suite/sys_vars/t/secure_auth_grant.test56
-rw-r--r--mysql-test/suite/sys_vars/t/secure_file_priv-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/secure_file_priv.test50
-rw-r--r--mysql-test/suite/sys_vars/t/secure_file_priv2-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/secure_file_priv2.test23
-rw-r--r--mysql-test/suite/sys_vars/t/secure_file_priv_basic.test25
-rw-r--r--mysql-test/suite/sys_vars/t/secure_timestamp_no-slave.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/secure_timestamp_no.test4
-rw-r--r--mysql-test/suite/sys_vars/t/secure_timestamp_rpl-slave.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/secure_timestamp_rpl.test4
-rw-r--r--mysql-test/suite/sys_vars/t/secure_timestamp_super-slave.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/secure_timestamp_super.test4
-rw-r--r--mysql-test/suite/sys_vars/t/secure_timestamp_yes-slave.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/secure_timestamp_yes.test4
-rw-r--r--mysql-test/suite/sys_vars/t/server_id_basic.test187
-rw-r--r--mysql-test/suite/sys_vars/t/server_id_grant.test16
-rw-r--r--mysql-test/suite/sys_vars/t/session_track_system_variables_basic.test128
-rw-r--r--mysql-test/suite/sys_vars/t/show_vs_valstr.test12
-rw-r--r--mysql-test/suite/sys_vars/t/skip_external_locking_basic.test18
-rw-r--r--mysql-test/suite/sys_vars/t/skip_name_resolve_basic-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/skip_name_resolve_basic.test15
-rw-r--r--mysql-test/suite/sys_vars/t/skip_networking_basic.test18
-rw-r--r--mysql-test/suite/sys_vars/t/skip_parallel_replication_basic.test14
-rw-r--r--mysql-test/suite/sys_vars/t/skip_replication_basic.test30
-rw-r--r--mysql-test/suite/sys_vars/t/skip_show_database_basic.test18
-rw-r--r--mysql-test/suite/sys_vars/t/slave_allow_batching_basic.test165
-rw-r--r--mysql-test/suite/sys_vars/t/slave_compressed_protocol_basic.test167
-rw-r--r--mysql-test/suite/sys_vars/t/slave_compressed_protocol_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/slave_ddl_exec_mode_basic.test67
-rw-r--r--mysql-test/suite/sys_vars/t/slave_ddl_exec_mode_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/slave_domain_parallel_threads_basic.test14
-rw-r--r--mysql-test/suite/sys_vars/t/slave_domain_parallel_threads_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/slave_exec_mode_basic.test42
-rw-r--r--mysql-test/suite/sys_vars/t/slave_exec_mode_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/slave_load_tmpdir_basic.test24
-rw-r--r--mysql-test/suite/sys_vars/t/slave_max_allowed_packet_basic.test173
-rw-r--r--mysql-test/suite/sys_vars/t/slave_max_allowed_packet_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/slave_net_timeout_basic.test184
-rw-r--r--mysql-test/suite/sys_vars/t/slave_net_timeout_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/slave_parallel_max_queued_basic.test14
-rw-r--r--mysql-test/suite/sys_vars/t/slave_parallel_max_queued_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/slave_parallel_mode_basic-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/slave_parallel_mode_basic.test34
-rw-r--r--mysql-test/suite/sys_vars/t/slave_parallel_mode_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/slave_parallel_threads_basic.cnf5
-rw-r--r--mysql-test/suite/sys_vars/t/slave_parallel_threads_basic.test21
-rw-r--r--mysql-test/suite/sys_vars/t/slave_parallel_threads_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/slave_parallel_workers_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/slave_run_triggers_for_rbr_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/slave_skip_errors_basic.test19
-rw-r--r--mysql-test/suite/sys_vars/t/slave_sql_verify_checksum_basic.test18
-rw-r--r--mysql-test/suite/sys_vars/t/slave_sql_verify_checksum_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/slave_transaction_retries_basic.test187
-rw-r--r--mysql-test/suite/sys_vars/t/slave_transaction_retry_errors-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/slave_transaction_retry_errors.test19
-rw-r--r--mysql-test/suite/sys_vars/t/slave_transaction_retry_interval_basic.test190
-rw-r--r--mysql-test/suite/sys_vars/t/slave_transaction_retry_interval_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/slave_type_conversions_basic.test24
-rw-r--r--mysql-test/suite/sys_vars/t/slave_type_conversions_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/slow_launch_time_func-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/slow_launch_time_func.test97
-rw-r--r--mysql-test/suite/sys_vars/t/slow_launch_time_grant.test56
-rw-r--r--mysql-test/suite/sys_vars/t/slow_query_log_file_func-master.opt2
-rw-r--r--mysql-test/suite/sys_vars/t/slow_query_log_file_func.test40
-rw-r--r--mysql-test/suite/sys_vars/t/slow_query_log_func.test155
-rw-r--r--mysql-test/suite/sys_vars/t/socket_basic.test23
-rw-r--r--mysql-test/suite/sys_vars/t/sort_buffer_size_basic.test224
-rw-r--r--mysql-test/suite/sys_vars/t/sql_auto_is_null_basic.test62
-rw-r--r--mysql-test/suite/sys_vars/t/sql_big_selects_basic.test168
-rw-r--r--mysql-test/suite/sys_vars/t/sql_big_selects_func.test125
-rw-r--r--mysql-test/suite/sys_vars/t/sql_buffer_result_basic.test173
-rw-r--r--mysql-test/suite/sys_vars/t/sql_buffer_result_func.test136
-rw-r--r--mysql-test/suite/sys_vars/t/sql_log_bin_basic.test172
-rw-r--r--mysql-test/suite/sys_vars/t/sql_log_bin_grant.test51
-rw-r--r--mysql-test/suite/sys_vars/t/sql_log_off_basic.test170
-rw-r--r--mysql-test/suite/sys_vars/t/sql_log_off_func-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/sql_log_off_func.test107
-rw-r--r--mysql-test/suite/sys_vars/t/sql_low_priority_updates_func.test224
-rw-r--r--mysql-test/suite/sys_vars/t/sql_mode_basic.test388
-rw-r--r--mysql-test/suite/sys_vars/t/sql_mode_func.test192
-rw-r--r--mysql-test/suite/sys_vars/t/sql_notes_basic.test171
-rw-r--r--mysql-test/suite/sys_vars/t/sql_notes_func.test125
-rw-r--r--mysql-test/suite/sys_vars/t/sql_quote_show_create_basic.test171
-rw-r--r--mysql-test/suite/sys_vars/t/sql_quote_show_create_func.test106
-rw-r--r--mysql-test/suite/sys_vars/t/sql_safe_updates_basic.test170
-rw-r--r--mysql-test/suite/sys_vars/t/sql_safe_updates_func.test194
-rw-r--r--mysql-test/suite/sys_vars/t/sql_select_limit_basic.test42
-rw-r--r--mysql-test/suite/sys_vars/t/sql_select_limit_func.test209
-rw-r--r--mysql-test/suite/sys_vars/t/sql_slave_skip_counter_basic.test104
-rw-r--r--mysql-test/suite/sys_vars/t/sql_warnings_basic.test174
-rw-r--r--mysql-test/suite/sys_vars/t/sql_warnings_func.test112
-rw-r--r--mysql-test/suite/sys_vars/t/ssl_ca_basic.test102
-rw-r--r--mysql-test/suite/sys_vars/t/ssl_capath_basic.test100
-rw-r--r--mysql-test/suite/sys_vars/t/ssl_cert_basic.test102
-rw-r--r--mysql-test/suite/sys_vars/t/ssl_cipher_basic.test100
-rw-r--r--mysql-test/suite/sys_vars/t/ssl_crl_basic.test3
-rw-r--r--mysql-test/suite/sys_vars/t/ssl_crlpath_basic.test3
-rw-r--r--mysql-test/suite/sys_vars/t/ssl_key_basic.test102
-rw-r--r--mysql-test/suite/sys_vars/t/storage_engine_basic-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/storage_engine_basic.test182
-rw-r--r--mysql-test/suite/sys_vars/t/stored_program_cache_basic.test59
-rw-r--r--mysql-test/suite/sys_vars/t/stored_program_cache_func.test45
-rw-r--r--mysql-test/suite/sys_vars/t/sync_binlog_basic.test127
-rw-r--r--mysql-test/suite/sys_vars/t/sync_binlog_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/sync_frm_basic.test163
-rw-r--r--mysql-test/suite/sys_vars/t/sync_master_info_basic.test43
-rw-r--r--mysql-test/suite/sys_vars/t/sync_master_info_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/sync_relay_log_basic.test44
-rw-r--r--mysql-test/suite/sys_vars/t/sync_relay_log_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/sync_relay_log_info_basic.test44
-rw-r--r--mysql-test/suite/sys_vars/t/sync_relay_log_info_grant.test9
-rw-r--r--mysql-test/suite/sys_vars/t/system_time_zone_basic.test100
-rw-r--r--mysql-test/suite/sys_vars/t/sysvars_aria.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/sysvars_aria.test12
-rw-r--r--mysql-test/suite/sys_vars/t/sysvars_debug.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/sysvars_debug.test8
-rw-r--r--mysql-test/suite/sys_vars/t/sysvars_innodb.opt2
-rw-r--r--mysql-test/suite/sys_vars/t/sysvars_innodb.test16
-rw-r--r--mysql-test/suite/sys_vars/t/sysvars_server_embedded.test2
-rw-r--r--mysql-test/suite/sys_vars/t/sysvars_server_notembedded.test2
-rw-r--r--mysql-test/suite/sys_vars/t/sysvars_star.cnf5
-rw-r--r--mysql-test/suite/sys_vars/t/sysvars_star.opt2
-rw-r--r--mysql-test/suite/sys_vars/t/sysvars_star.test43
-rw-r--r--mysql-test/suite/sys_vars/t/sysvars_wsrep.test13
-rw-r--r--mysql-test/suite/sys_vars/t/table_definition_cache_basic.test143
-rw-r--r--mysql-test/suite/sys_vars/t/table_open_cache_basic.test157
-rw-r--r--mysql-test/suite/sys_vars/t/tcp_keepalive_time.test11
-rw-r--r--mysql-test/suite/sys_vars/t/tcp_nodelay.test7
-rw-r--r--mysql-test/suite/sys_vars/t/thread_cache_size_basic-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/thread_cache_size_basic.test49
-rw-r--r--mysql-test/suite/sys_vars/t/thread_cache_size_func-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/thread_cache_size_func.test109
-rw-r--r--mysql-test/suite/sys_vars/t/thread_handling_basic.test107
-rw-r--r--mysql-test/suite/sys_vars/t/thread_pool_idle_timeout_basic.test44
-rw-r--r--mysql-test/suite/sys_vars/t/thread_pool_idle_timeout_grant.test58
-rw-r--r--mysql-test/suite/sys_vars/t/thread_pool_max_threads_basic.test43
-rw-r--r--mysql-test/suite/sys_vars/t/thread_pool_max_threads_grant.test58
-rw-r--r--mysql-test/suite/sys_vars/t/thread_pool_min_threads_basic.test44
-rw-r--r--mysql-test/suite/sys_vars/t/thread_pool_oversubscribe_basic.test44
-rw-r--r--mysql-test/suite/sys_vars/t/thread_pool_oversubscribe_grant.test58
-rw-r--r--mysql-test/suite/sys_vars/t/thread_pool_size_basic.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/thread_pool_size_basic.test47
-rw-r--r--mysql-test/suite/sys_vars/t/thread_pool_size_high.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/thread_pool_size_high.test15
-rw-r--r--mysql-test/suite/sys_vars/t/thread_pool_stall_limit_basic.test43
-rw-r--r--mysql-test/suite/sys_vars/t/thread_pool_stall_limit_grant.test58
-rw-r--r--mysql-test/suite/sys_vars/t/thread_stack_basic.test25
-rw-r--r--mysql-test/suite/sys_vars/t/time_format_basic.test18
-rw-r--r--mysql-test/suite/sys_vars/t/time_zone_basic.test325
-rw-r--r--mysql-test/suite/sys_vars/t/time_zone_func.test180
-rw-r--r--mysql-test/suite/sys_vars/t/timestamp_basic.test153
-rw-r--r--mysql-test/suite/sys_vars/t/timestamp_func.test44
-rw-r--r--mysql-test/suite/sys_vars/t/timestamp_sysdate_is_now_func-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/timestamp_sysdate_is_now_func.test41
-rw-r--r--mysql-test/suite/sys_vars/t/tmp_disk_table_size_basic.test223
-rw-r--r--mysql-test/suite/sys_vars/t/tmp_disk_table_size_func.test29
-rw-r--r--mysql-test/suite/sys_vars/t/tmpdir_basic.test100
-rw-r--r--mysql-test/suite/sys_vars/t/transaction_alloc_block_size_basic.test228
-rw-r--r--mysql-test/suite/sys_vars/t/transaction_prealloc_size_basic.test214
-rw-r--r--mysql-test/suite/sys_vars/t/transaction_prealloc_size_bug27322.test66
-rw-r--r--mysql-test/suite/sys_vars/t/tx_isolation_basic.test212
-rw-r--r--mysql-test/suite/sys_vars/t/tx_isolation_func-master.opt3
-rw-r--r--mysql-test/suite/sys_vars/t/tx_isolation_func.test369
-rw-r--r--mysql-test/suite/sys_vars/t/tx_read_only_basic.test199
-rw-r--r--mysql-test/suite/sys_vars/t/unique_checks_basic.test160
-rw-r--r--mysql-test/suite/sys_vars/t/updatable_views_with_limit_basic.test275
-rw-r--r--mysql-test/suite/sys_vars/t/updatable_views_with_limit_func.test136
-rw-r--r--mysql-test/suite/sys_vars/t/use_stat_tables_basic.test100
-rw-r--r--mysql-test/suite/sys_vars/t/userstat_basic.test39
-rw-r--r--mysql-test/suite/sys_vars/t/version.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/version.test7
-rw-r--r--mysql-test/suite/sys_vars/t/version_basic.test100
-rw-r--r--mysql-test/suite/sys_vars/t/version_comment_basic.test100
-rw-r--r--mysql-test/suite/sys_vars/t/version_compile_machine_basic.test100
-rw-r--r--mysql-test/suite/sys_vars/t/version_compile_os_basic.test100
-rw-r--r--mysql-test/suite/sys_vars/t/version_malloc_library_basic.test90
-rw-r--r--mysql-test/suite/sys_vars/t/version_ssl_library_basic.test2
-rw-r--r--mysql-test/suite/sys_vars/t/wait_timeout_basic.test230
-rw-r--r--mysql-test/suite/sys_vars/t/wait_timeout_func.test91
-rw-r--r--mysql-test/suite/sys_vars/t/warning_count_basic.test97
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_auto_increment_control_basic.test42
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_causal_reads_basic.test45
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_certify_nonpk_basic.test42
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_cluster_address_basic.test47
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_cluster_name_basic.test40
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_convert_lock_to_trx_basic.test42
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_data_home_dir_basic.test28
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_dbug_option_basic.test42
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_debug_basic.test44
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_desync_basic.test57
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_dirty_reads_basic.test48
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_drupal_282555_workaround_basic.test42
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_forced_binlog_format_basic.test46
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_gtid_domain_id_basic.test43
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_gtid_mode_basic.test33
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_load_data_splitting_basic.test42
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_log_conflicts_basic.test42
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_max_ws_rows_basic.test45
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_max_ws_size_basic.test44
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_mysql_replication_bundle_basic.test45
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_node_address_basic.test45
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_node_incoming_address_basic.test47
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_node_name_basic.test54
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_on_without_provider.test10
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_osu_method_basic.test49
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_recover_basic.test26
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_restart_slave_basic.test36
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_retry_autocommit_basic.test52
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_slave_fk_checks_basic.test42
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_slave_uk_checks_basic.test42
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_sst_auth_basic.test45
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_sst_donor_basic.test46
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_sst_donor_rejects_queries_basic.test42
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_sst_method_basic.test52
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_sst_receive_address_basic.test49
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_sync_wait_basic.test47
860 files changed, 63322 insertions, 0 deletions
diff --git a/mysql-test/suite/sys_vars/t/all_vars-master.opt b/mysql-test/suite/sys_vars/t/all_vars-master.opt
new file mode 100644
index 00000000..b97ca7bb
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/all_vars-master.opt
@@ -0,0 +1,6 @@
+--loose-innodb
+--loose-archive
+--loose-blackhole
+--loose-federated
+--loose-oqgraph
+--loose-sphinx
diff --git a/mysql-test/suite/sys_vars/t/all_vars.test b/mysql-test/suite/sys_vars/t/all_vars.test
new file mode 100644
index 00000000..41c89a4b
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/all_vars.test
@@ -0,0 +1,82 @@
+--source include/not_embedded.inc
+
+#
+# load everything we want to include in the testing
+#
+--disable_query_log
+--disable_result_log
+--disable_abort_on_error
+eval INSTALL PLUGIN archive SONAME "$HA_ARCHIVE_SO";
+eval INSTALL PLUGIN blackhole SONAME "$HA_BLACKHOLE_SO";
+eval INSTALL PLUGIN federated SONAME "$HA_FEDERATEDX_SO";
+eval INSTALL PLUGIN oqgraph SONAME "$HA_OQGRAPH_SO";
+eval INSTALL PLUGIN sphinx SONAME "$HA_SPHINX_SO";
+eval INSTALL PLUGIN innodb SONAME "$HA_INNODB_SO";
+--enable_abort_on_error
+--enable_result_log
+--enable_query_log
+
+#
+# This test verifies that *all* system variables are tested
+# by the sys_vars suite. For every system variable
+# there must be a <variable_name>_basic.test file.
+#
+
+#
+# we can diff in perl or in sql, as it's my_SQL_test suite, do it in sql
+#
+
+perl;
+ use File::Basename;
+ my $dirname=dirname($ENV{MYSQLTEST_FILE});
+ my @all_tests=<$dirname/*_basic{,_32,_64}.test>;
+ #*/
+ open(F, '>', "$ENV{MYSQLTEST_VARDIR}/tmp/sys_vars.all_vars.txt") or die;
+ binmode F;
+ print F join "\n", sort map { s/_basic(_32|_64)?\.test$//; basename $_ } @all_tests;
+EOF
+
+create table t1 (test_name text);
+create table t2 (variable_name text);
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval load data infile "$MYSQLTEST_VARDIR/tmp/sys_vars.all_vars.txt" into table t1;
+
+insert into t2 select variable_name from information_schema.global_variables;
+insert into t2 select variable_name from information_schema.session_variables;
+
+# Performance schema variables are too long for files named
+# 'mysql-test/suite/sys_vars/t/' ...
+# ... 'performance_schema_events_waits_history_long_size_basic-master.opt'
+# to fit in the tar source distribution (limit in old tar)
+# Renaming the tests to aliases below.
+
+update t2 set variable_name= replace(variable_name, "PERFORMANCE_SCHEMA_", "PFS_");
+
+--sorted_result
+--lowercase_result
+select distinct variable_name as `There should be *no* long test name listed below:` from t2
+ where length(variable_name) > 50;
+
+--sorted_result
+--lowercase_result
+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;
+
+drop table t1;
+drop table t2;
+
+--disable_query_log
+--disable_result_log
+--disable_abort_on_error
+UNINSTALL PLUGIN archive;
+UNINSTALL PLUGIN blackhole;
+UNINSTALL PLUGIN federated;
+UNINSTALL PLUGIN oqgraph;
+UNINSTALL PLUGIN sphinx;
+UNINSTALL PLUGIN innodb;
+UNINSTALL PLUGIN rpl_semi_sync_master;
+UNINSTALL PLUGIN rpl_semi_sync_slave;
+--enable_abort_on_error
+--enable_result_log
+--enable_query_log
+
diff --git a/mysql-test/suite/sys_vars/t/allow_suspicious_udfs.test b/mysql-test/suite/sys_vars/t/allow_suspicious_udfs.test
new file mode 100644
index 00000000..9179cfbe
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/allow_suspicious_udfs.test
@@ -0,0 +1,14 @@
+--echo #
+--echo # MDEV-24815 Show "--allow-suspicious-udfs" state in SYSTEM VARIABLES
+--echo #
+
+SELECT @@allow_suspicious_udfs AS EXPECT_0;
+
+# Restart the server the server with "--allow-suspicious-udfs" option
+--let $restart_parameters = "--allow-suspicious-udfs"
+--source include/restart_mysqld.inc
+SELECT @@allow_suspicious_udfs AS EXPECT_1;
+
+# Disable "--allow-suspicious-udfs" to restore the original state
+--let $restart_parameters = "--skip-allow-suspicious-udfs"
+--source include/restart_mysqld.inc
diff --git a/mysql-test/suite/sys_vars/t/alter_algorithm_basic.test b/mysql-test/suite/sys_vars/t/alter_algorithm_basic.test
new file mode 100644
index 00000000..69a5320a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/alter_algorithm_basic.test
@@ -0,0 +1,58 @@
+SET @start_global_value = @@global.alter_algorithm;
+
+--error ER_WRONG_TYPE_FOR_VAR
+SET GLOBAL alter_algorithm=1.1;
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL alter_algorithm=-1;
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL alter_algorithm=weird;
+SET GLOBAL alter_algorithm=4;
+SELECT @@global.alter_algorithm;
+SET GLOBAL alter_algorithm=3;
+SELECT @@global.alter_algorithm;
+SET GLOBAL alter_algorithm=0;
+SELECT @@global.alter_algorithm;
+SET GLOBAL alter_algorithm=1;
+SELECT @@global.alter_algorithm;
+SET GLOBAL alter_algorithm=2;
+SELECT @@global.alter_algorithm;
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL alter_algorithm=5;
+SELECT @@global.alter_algorithm;
+
+SET GLOBAL alter_algorithm=NOCOPY;
+
+--error ER_WRONG_TYPE_FOR_VAR
+SET alter_algorithm=1.1;
+--error ER_WRONG_VALUE_FOR_VAR
+SET alter_algorithm=-1;
+--error ER_WRONG_VALUE_FOR_VAR
+SET alter_algorithm=weird;
+SET alter_algorithm=4;
+SELECT @@alter_algorithm;
+SET alter_algorithm=3;
+SELECT @@alter_algorithm;
+SET alter_algorithm=0;
+SELECT @@alter_algorithm;
+SET alter_algorithm=1;
+SELECT @@alter_algorithm;
+SET alter_algorithm=2;
+SELECT @@alter_algorithm;
+--error ER_WRONG_VALUE_FOR_VAR
+SET alter_algorithm=5;
+SELECT @@alter_algorithm;
+
+SET SESSION alter_algorithm=INSTANT;
+SHOW SESSION VARIABLES LIKE 'alter_algorithm';
+SET SESSION alter_algorithm=DEFAULT;
+SHOW SESSION VARIABLES LIKE 'alter_algorithm';
+SET SESSION alter_algorithm='DEFAULT';
+SHOW SESSION VARIABLES LIKE 'alter_algorithm';
+SET SESSION alter_algorithm=DEFAULT;
+SHOW SESSION VARIABLES LIKE 'alter_algorithm';
+SET GLOBAL alter_algorithm=DEFAULT;
+SHOW SESSION VARIABLES LIKE 'alter_algorithm';
+SET SESSION alter_algorithm=DEFAULT;
+SHOW SESSION VARIABLES LIKE 'alter_algorithm';
+
+SET GLOBAL alter_algorithm = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/aria_block_size_basic.test b/mysql-test/suite/sys_vars/t/aria_block_size_basic.test
new file mode 100644
index 00000000..ceac27fc
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/aria_block_size_basic.test
@@ -0,0 +1,22 @@
+# ulong readonly
+
+--source include/have_maria.inc
+#
+# show the global and session values;
+#
+select @@global.aria_block_size;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.aria_block_size;
+show global variables like 'aria_block_size';
+show session variables like 'aria_block_size';
+select * from information_schema.global_variables where variable_name='aria_block_size';
+select * from information_schema.session_variables where variable_name='aria_block_size';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global aria_block_size=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session aria_block_size=1;
+
diff --git a/mysql-test/suite/sys_vars/t/aria_checkpoint_interval_basic.test b/mysql-test/suite/sys_vars/t/aria_checkpoint_interval_basic.test
new file mode 100644
index 00000000..6829ca99
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/aria_checkpoint_interval_basic.test
@@ -0,0 +1,43 @@
+# ulong global
+--source include/have_maria.inc
+
+SET @start_global_value = @@global.aria_checkpoint_interval;
+
+#
+# exists as global only
+#
+select @@global.aria_checkpoint_interval;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.aria_checkpoint_interval;
+show global variables like 'aria_checkpoint_interval';
+show session variables like 'aria_checkpoint_interval';
+select * from information_schema.global_variables where variable_name='aria_checkpoint_interval';
+select * from information_schema.session_variables where variable_name='aria_checkpoint_interval';
+
+#
+# show that it's writable
+#
+set global aria_checkpoint_interval=1;
+select @@global.aria_checkpoint_interval;
+--error ER_GLOBAL_VARIABLE
+set session aria_checkpoint_interval=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_checkpoint_interval=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_checkpoint_interval=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_checkpoint_interval="foo";
+
+#
+# min/max values
+#
+set global aria_checkpoint_interval=0;
+select @@global.aria_checkpoint_interval;
+set global aria_checkpoint_interval=cast(-1 as unsigned int);
+select @@global.aria_checkpoint_interval;
+
+SET @@global.aria_checkpoint_interval = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/aria_checkpoint_log_activity_basic.test b/mysql-test/suite/sys_vars/t/aria_checkpoint_log_activity_basic.test
new file mode 100644
index 00000000..9fa5e5e2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/aria_checkpoint_log_activity_basic.test
@@ -0,0 +1,43 @@
+# ulong global
+--source include/have_maria.inc
+
+SET @start_global_value = @@global.aria_checkpoint_log_activity;
+
+#
+# exists as global only
+#
+select @@global.aria_checkpoint_log_activity;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.aria_checkpoint_log_activity;
+show global variables like 'aria_checkpoint_log_activity';
+show session variables like 'aria_checkpoint_log_activity';
+select * from information_schema.global_variables where variable_name='aria_checkpoint_log_activity';
+select * from information_schema.session_variables where variable_name='aria_checkpoint_log_activity';
+
+#
+# show that it's writable
+#
+set global aria_checkpoint_log_activity=1;
+select @@global.aria_checkpoint_log_activity;
+--error ER_GLOBAL_VARIABLE
+set session aria_checkpoint_log_activity=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_checkpoint_log_activity=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_checkpoint_log_activity=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_checkpoint_log_activity="foo";
+
+#
+# min/max values
+#
+set global aria_checkpoint_log_activity=0;
+select @@global.aria_checkpoint_log_activity;
+set global aria_checkpoint_log_activity=cast(-1 as unsigned int);
+select @@global.aria_checkpoint_log_activity;
+
+SET @@global.aria_checkpoint_log_activity = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/aria_encrypt_tables_basic.test b/mysql-test/suite/sys_vars/t/aria_encrypt_tables_basic.test
new file mode 100644
index 00000000..2db0708e
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/aria_encrypt_tables_basic.test
@@ -0,0 +1,41 @@
+# bool global
+--source include/have_maria.inc
+
+SET @start_global_value = @@global.aria_encrypt_tables;
+
+#
+# exists as global only
+#
+select @@global.aria_encrypt_tables;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.aria_encrypt_tables;
+show global variables like 'aria_encrypt_tables';
+show session variables like 'aria_encrypt_tables';
+select * from information_schema.global_variables
+where variable_name='aria_encrypt_tables';
+select * from information_schema.session_variables
+where variable_name='aria_encrypt_tables';
+
+#
+# show that it's writable
+#
+set global aria_encrypt_tables=ON;
+select @@global.aria_encrypt_tables;
+set global aria_encrypt_tables=OFF;
+select @@global.aria_encrypt_tables;
+set global aria_encrypt_tables=1;
+select @@global.aria_encrypt_tables;
+--error ER_GLOBAL_VARIABLE
+set session aria_encrypt_tables=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_encrypt_tables=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_encrypt_tables=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global aria_encrypt_tables="foo";
+
+SET @@global.aria_encrypt_tables = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/aria_force_start_after_recovery_failures_basic.test b/mysql-test/suite/sys_vars/t/aria_force_start_after_recovery_failures_basic.test
new file mode 100644
index 00000000..c99a303b
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/aria_force_start_after_recovery_failures_basic.test
@@ -0,0 +1,22 @@
+# ulong readonly
+
+--source include/have_maria.inc
+#
+# show the global and session values;
+#
+select @@global.aria_force_start_after_recovery_failures;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.aria_force_start_after_recovery_failures;
+show global variables like 'aria_force_start_after_recovery_failures';
+show session variables like 'aria_force_start_after_recovery_failures';
+select * from information_schema.global_variables where variable_name='aria_force_start_after_recovery_failures';
+select * from information_schema.session_variables where variable_name='aria_force_start_after_recovery_failures';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global aria_force_start_after_recovery_failures=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session aria_force_start_after_recovery_failures=1;
+
diff --git a/mysql-test/suite/sys_vars/t/aria_group_commit_basic.test b/mysql-test/suite/sys_vars/t/aria_group_commit_basic.test
new file mode 100644
index 00000000..11d7d598
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/aria_group_commit_basic.test
@@ -0,0 +1,47 @@
+# enum global
+--source include/have_maria.inc
+
+SET @start_global_value = @@global.aria_group_commit;
+
+#
+# exists as global only
+#
+select @@global.aria_group_commit;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.aria_group_commit;
+show global variables like 'aria_group_commit';
+show session variables like 'aria_group_commit';
+select * from information_schema.global_variables where variable_name='aria_group_commit';
+select * from information_schema.session_variables where variable_name='aria_group_commit';
+
+#
+# show that it's writable
+#
+set global aria_group_commit=1;
+select @@global.aria_group_commit;
+--error ER_GLOBAL_VARIABLE
+set session aria_group_commit=1;
+
+#
+# all valid values
+#
+set global aria_group_commit=none;
+select @@global.aria_group_commit;
+set global aria_group_commit=hard;
+select @@global.aria_group_commit;
+set global aria_group_commit=soft;
+select @@global.aria_group_commit;
+
+#
+# incorrect types/values
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_group_commit=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_group_commit=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global aria_group_commit="foo";
+--error ER_WRONG_VALUE_FOR_VAR
+set global aria_group_commit=3;
+
+SET @@global.aria_group_commit = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/aria_group_commit_interval_basic.test b/mysql-test/suite/sys_vars/t/aria_group_commit_interval_basic.test
new file mode 100644
index 00000000..5b606ee1
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/aria_group_commit_interval_basic.test
@@ -0,0 +1,43 @@
+# ulong global
+--source include/have_maria.inc
+
+SET @start_global_value = @@global.aria_group_commit_interval;
+
+#
+# exists as global only
+#
+select @@global.aria_group_commit_interval;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.aria_group_commit_interval;
+show global variables like 'aria_group_commit_interval';
+show session variables like 'aria_group_commit_interval';
+select * from information_schema.global_variables where variable_name='aria_group_commit_interval';
+select * from information_schema.session_variables where variable_name='aria_group_commit_interval';
+
+#
+# show that it's writable
+#
+set global aria_group_commit_interval=1;
+select @@global.aria_group_commit_interval;
+--error ER_GLOBAL_VARIABLE
+set session aria_group_commit_interval=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_group_commit_interval=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_group_commit_interval=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_group_commit_interval="foo";
+
+#
+# min/max values
+#
+set global aria_group_commit_interval=0;
+select @@global.aria_group_commit_interval;
+set global aria_group_commit_interval=cast(-1 as unsigned int);
+select @@global.aria_group_commit_interval;
+
+SET @@global.aria_group_commit_interval = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/aria_log_dir_path_basic.test b/mysql-test/suite/sys_vars/t/aria_log_dir_path_basic.test
new file mode 100644
index 00000000..f09705e6
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/aria_log_dir_path_basic.test
@@ -0,0 +1,35 @@
+--source include/have_maria.inc
+
+SELECT COUNT(@@GLOBAL.aria_log_dir_path);
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.aria_log_dir_path=1;
+
+SELECT COUNT(@@GLOBAL.aria_log_dir_path);
+
+
+SELECT @@GLOBAL.aria_log_dir_path = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='aria_log_dir_path';
+
+SELECT COUNT(@@GLOBAL.aria_log_dir_path);
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='aria_log_dir_path';
+
+
+SELECT @@aria_log_dir_path = @@GLOBAL.aria_log_dir_path;
+
+
+SELECT COUNT(@@aria_log_dir_path);
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.aria_log_dir_path);
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.aria_log_dir_path);
+
+SELECT COUNT(@@GLOBAL.aria_log_dir_path);
+
+--Error ER_BAD_FIELD_ERROR
+SELECT aria_log_dir_path = @@SESSION.aria_log_dir_path;
diff --git a/mysql-test/suite/sys_vars/t/aria_log_file_size_basic.test b/mysql-test/suite/sys_vars/t/aria_log_file_size_basic.test
new file mode 100644
index 00000000..c403e7d3
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/aria_log_file_size_basic.test
@@ -0,0 +1,47 @@
+# ulong global
+--source include/have_maria.inc
+
+SET @start_global_value = @@global.aria_log_file_size;
+
+#
+# exists as global only
+#
+select @@global.aria_log_file_size;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.aria_log_file_size;
+show global variables like 'aria_log_file_size';
+show session variables like 'aria_log_file_size';
+select * from information_schema.global_variables where variable_name='aria_log_file_size';
+select * from information_schema.session_variables where variable_name='aria_log_file_size';
+
+#
+# show that it's writable
+#
+set global aria_log_file_size=1024*1024*10;
+select @@global.aria_log_file_size;
+--error ER_GLOBAL_VARIABLE
+set session aria_log_file_size=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_log_file_size=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_log_file_size=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_log_file_size="foo";
+
+#
+# min/max values, block size
+#
+set global aria_log_file_size=1;
+select @@global.aria_log_file_size;
+set global aria_log_file_size=@@global.aria_log_file_size + 8192 - 1;
+select @@global.aria_log_file_size;
+set global aria_log_file_size=@@global.aria_log_file_size + 8192;
+select @@global.aria_log_file_size;
+set global aria_log_file_size=cast(-1 as unsigned int);
+select @@global.aria_log_file_size;
+
+SET @@global.aria_log_file_size = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/aria_log_purge_type_basic.test b/mysql-test/suite/sys_vars/t/aria_log_purge_type_basic.test
new file mode 100644
index 00000000..6424b7db
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/aria_log_purge_type_basic.test
@@ -0,0 +1,47 @@
+# enum global
+--source include/have_maria.inc
+
+SET @start_global_value = @@global.aria_log_purge_type;
+
+#
+# exists as global only
+#
+select @@global.aria_log_purge_type;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.aria_log_purge_type;
+show global variables like 'aria_log_purge_type';
+show session variables like 'aria_log_purge_type';
+select * from information_schema.global_variables where variable_name='aria_log_purge_type';
+select * from information_schema.session_variables where variable_name='aria_log_purge_type';
+
+#
+# show that it's writable
+#
+set global aria_log_purge_type=1;
+select @@global.aria_log_purge_type;
+--error ER_GLOBAL_VARIABLE
+set session aria_log_purge_type=1;
+
+#
+# all valid values
+#
+set global aria_log_purge_type=immediate;
+select @@global.aria_log_purge_type;
+set global aria_log_purge_type=external;
+select @@global.aria_log_purge_type;
+set global aria_log_purge_type=at_flush;
+select @@global.aria_log_purge_type;
+
+#
+# incorrect types/values
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_log_purge_type=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_log_purge_type=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global aria_log_purge_type="foo";
+--error ER_WRONG_VALUE_FOR_VAR
+set global aria_log_purge_type=3;
+
+SET @@global.aria_log_purge_type = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/aria_max_sort_file_size_basic.test b/mysql-test/suite/sys_vars/t/aria_max_sort_file_size_basic.test
new file mode 100644
index 00000000..b2385d2f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/aria_max_sort_file_size_basic.test
@@ -0,0 +1,47 @@
+# ulong global
+--source include/have_maria.inc
+
+SET @start_global_value = @@global.aria_max_sort_file_size;
+
+#
+# exists as global only
+#
+select @@global.aria_max_sort_file_size;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.aria_max_sort_file_size;
+show global variables like 'aria_max_sort_file_size';
+show session variables like 'aria_max_sort_file_size';
+select * from information_schema.global_variables where variable_name='aria_max_sort_file_size';
+select * from information_schema.session_variables where variable_name='aria_max_sort_file_size';
+
+#
+# show that it's writable
+#
+set global aria_max_sort_file_size=1024*1024*10;
+select @@global.aria_max_sort_file_size;
+--error ER_GLOBAL_VARIABLE
+set session aria_max_sort_file_size=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_max_sort_file_size=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_max_sort_file_size=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_max_sort_file_size="foo";
+
+#
+# min/max values, block size
+#
+set global aria_max_sort_file_size=1;
+select @@global.aria_max_sort_file_size;
+set global aria_max_sort_file_size=@@global.aria_max_sort_file_size + 1024*1024 - 1;
+select @@global.aria_max_sort_file_size;
+set global aria_max_sort_file_size=@@global.aria_max_sort_file_size + 1024*1024;
+select @@global.aria_max_sort_file_size;
+set global aria_max_sort_file_size=cast(-1 as unsigned int);
+select @@global.aria_max_sort_file_size;
+
+SET @@global.aria_max_sort_file_size = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/aria_page_checksum_basic.test b/mysql-test/suite/sys_vars/t/aria_page_checksum_basic.test
new file mode 100644
index 00000000..5340699a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/aria_page_checksum_basic.test
@@ -0,0 +1,39 @@
+# bool global
+--source include/have_maria.inc
+
+SET @start_global_value = @@global.aria_page_checksum;
+
+#
+# exists as global only
+#
+select @@global.aria_page_checksum;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.aria_page_checksum;
+show global variables like 'aria_page_checksum';
+show session variables like 'aria_page_checksum';
+select * from information_schema.global_variables where variable_name='aria_page_checksum';
+select * from information_schema.session_variables where variable_name='aria_page_checksum';
+
+#
+# show that it's writable
+#
+set global aria_page_checksum=ON;
+select @@global.aria_page_checksum;
+set global aria_page_checksum=OFF;
+select @@global.aria_page_checksum;
+set global aria_page_checksum=1;
+select @@global.aria_page_checksum;
+--error ER_GLOBAL_VARIABLE
+set session aria_page_checksum=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_page_checksum=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_page_checksum=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global aria_page_checksum="foo";
+
+SET @@global.aria_page_checksum = @start_global_value;
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
new file mode 100644
index 00000000..3fc9c94f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/aria_pagecache_age_threshold_basic.test
@@ -0,0 +1,48 @@
+# ulong global
+--source include/have_maria.inc
+
+SET @start_global_value = @@global.aria_pagecache_age_threshold;
+
+#
+# exists as global only
+#
+select @@global.aria_pagecache_age_threshold;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.aria_pagecache_age_threshold;
+show global variables like 'aria_pagecache_age_threshold';
+show session variables like 'aria_pagecache_age_threshold';
+select * from information_schema.global_variables where variable_name='aria_pagecache_age_threshold';
+select * from information_schema.session_variables where variable_name='aria_pagecache_age_threshold';
+
+#
+# show that it's writable
+#
+set global aria_pagecache_age_threshold=200;
+select @@global.aria_pagecache_age_threshold;
+--error ER_GLOBAL_VARIABLE
+set session aria_pagecache_age_threshold=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_pagecache_age_threshold=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_pagecache_age_threshold=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_pagecache_age_threshold="foo";
+
+#
+# min/max values, block size
+#
+set global aria_pagecache_age_threshold=1;
+select @@global.aria_pagecache_age_threshold;
+set global aria_pagecache_age_threshold=@@global.aria_pagecache_age_threshold + 100 - 1;
+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_pagecache_buffer_size_basic.test b/mysql-test/suite/sys_vars/t/aria_pagecache_buffer_size_basic.test
new file mode 100644
index 00000000..c0d640d5
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/aria_pagecache_buffer_size_basic.test
@@ -0,0 +1,26 @@
+# ulong readonly
+
+--source include/have_maria.inc
+#
+# show the global and session values;
+#
+select @@global.aria_pagecache_buffer_size > 0;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.aria_pagecache_buffer_size;
+--replace_column 2 #
+show global variables like 'aria_pagecache_buffer_size';
+--replace_column 2 #
+show session variables like 'aria_pagecache_buffer_size';
+--replace_column 2 #
+select * from information_schema.global_variables where variable_name='aria_pagecache_buffer_size';
+--replace_column 2 #
+select * from information_schema.session_variables where variable_name='aria_pagecache_buffer_size';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global aria_pagecache_buffer_size=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session aria_pagecache_buffer_size=1;
+
diff --git a/mysql-test/suite/sys_vars/t/aria_pagecache_division_limit_basic.test b/mysql-test/suite/sys_vars/t/aria_pagecache_division_limit_basic.test
new file mode 100644
index 00000000..096b9869
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/aria_pagecache_division_limit_basic.test
@@ -0,0 +1,43 @@
+# ulong global
+--source include/have_maria.inc
+
+SET @start_global_value = @@global.aria_pagecache_division_limit;
+
+#
+# exists as global only
+#
+select @@global.aria_pagecache_division_limit;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.aria_pagecache_division_limit;
+show global variables like 'aria_pagecache_division_limit';
+show session variables like 'aria_pagecache_division_limit';
+select * from information_schema.global_variables where variable_name='aria_pagecache_division_limit';
+select * from information_schema.session_variables where variable_name='aria_pagecache_division_limit';
+
+#
+# show that it's writable
+#
+set global aria_pagecache_division_limit=20;
+select @@global.aria_pagecache_division_limit;
+--error ER_GLOBAL_VARIABLE
+set session aria_pagecache_division_limit=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_pagecache_division_limit=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_pagecache_division_limit=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_pagecache_division_limit="foo";
+
+#
+# min/max values, block size
+#
+set global aria_pagecache_division_limit=0;
+select @@global.aria_pagecache_division_limit;
+set global aria_pagecache_division_limit=cast(-1 as unsigned int);
+select @@global.aria_pagecache_division_limit;
+
+SET @@global.aria_pagecache_division_limit = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/aria_pagecache_file_hash_size_basic.test b/mysql-test/suite/sys_vars/t/aria_pagecache_file_hash_size_basic.test
new file mode 100644
index 00000000..8bedb498
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/aria_pagecache_file_hash_size_basic.test
@@ -0,0 +1,22 @@
+# ulong readonly
+
+--source include/have_maria.inc
+#
+# show the global and session values;
+#
+select @@global.aria_pagecache_file_hash_size;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.aria_pagecache_file_hash_size;
+show global variables like 'aria_pagecache_file_hash_size';
+show session variables like 'aria_pagecache_file_hash_size';
+select * from information_schema.global_variables where variable_name='aria_pagecache_file_hash_size';
+select * from information_schema.session_variables where variable_name='aria_pagecache_file_hash_size';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global aria_pagecache_file_hash_size=200;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session aria_pagecache_file_hash_size=200;
+
diff --git a/mysql-test/suite/sys_vars/t/aria_recover_options_basic.test b/mysql-test/suite/sys_vars/t/aria_recover_options_basic.test
new file mode 100644
index 00000000..c4060045
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/aria_recover_options_basic.test
@@ -0,0 +1,54 @@
+# set global
+--source include/have_maria.inc
+
+SET @start_global_value = @@global.aria_recover_options;
+set @@global.aria_recover_options=default;
+
+#
+# exists as global only
+#
+select @@global.aria_recover_options;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.aria_recover_options;
+show global variables like 'aria_recover_options';
+show session variables like 'aria_recover_options';
+select * from information_schema.global_variables where variable_name='aria_recover_options';
+select * from information_schema.session_variables where variable_name='aria_recover_options';
+
+#
+# show that it's writable
+#
+set global aria_recover_options=1;
+select @@global.aria_recover_options;
+--error ER_GLOBAL_VARIABLE
+set session aria_recover_options=1;
+
+#
+# valid values
+#
+set global aria_recover_options=normal;
+select @@global.aria_recover_options;
+set global aria_recover_options=backup;
+select @@global.aria_recover_options;
+set global aria_recover_options='force';
+select @@global.aria_recover_options;
+set global aria_recover_options=off;
+select @@global.aria_recover_options;
+set global aria_recover_options='quick,force';
+select @@global.aria_recover_options;
+set global aria_recover_options=16;
+select @@global.aria_recover_options;
+
+#
+# incorrect types/values
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_recover_options=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_recover_options=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global aria_recover_options="foo";
+--error ER_WRONG_VALUE_FOR_VAR
+set global aria_recover_options=32;
+
+SET @@global.aria_recover_options = @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
new file mode 100644
index 00000000..8d075f31
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/aria_repair_threads_basic.test
@@ -0,0 +1,46 @@
+# ulong session
+--source include/have_maria.inc
+
+SET @start_global_value = @@global.aria_repair_threads;
+
+#
+# exists as global only
+#
+select @@global.aria_repair_threads;
+select @@session.aria_repair_threads;
+show global variables like 'aria_repair_threads';
+show session variables like 'aria_repair_threads';
+select * from information_schema.global_variables where variable_name='aria_repair_threads';
+select * from information_schema.session_variables where variable_name='aria_repair_threads';
+
+#
+# show that it's writable
+#
+set global aria_repair_threads=10;
+select @@global.aria_repair_threads;
+set session aria_repair_threads=10;
+select @@session.aria_repair_threads;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_repair_threads=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set session aria_repair_threads=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_repair_threads="foo";
+
+#
+# min/max values, block size
+#
+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
new file mode 100644
index 00000000..bf410686
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/aria_sort_buffer_size_basic.test
@@ -0,0 +1,46 @@
+# ulong session
+--source include/have_maria.inc
+--source include/word_size.inc
+
+SET @start_global_value = @@global.aria_sort_buffer_size;
+
+#
+# exists as global only
+#
+select @@global.aria_sort_buffer_size;
+select @@session.aria_sort_buffer_size;
+show global variables like 'aria_sort_buffer_size';
+show session variables like 'aria_sort_buffer_size';
+select * from information_schema.global_variables where variable_name='aria_sort_buffer_size';
+select * from information_schema.session_variables where variable_name='aria_sort_buffer_size';
+
+#
+# show that it's writable
+#
+set global aria_sort_buffer_size=10;
+select @@global.aria_sort_buffer_size;
+set session aria_sort_buffer_size=10;
+select @@session.aria_sort_buffer_size;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_sort_buffer_size=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set session aria_sort_buffer_size=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_sort_buffer_size="foo";
+
+#
+# min/max values, block size
+#
+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 268435455 1152921504606846975
+select @@session.aria_sort_buffer_size;
+
+SET @@global.aria_sort_buffer_size = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/aria_stats_method_basic.test b/mysql-test/suite/sys_vars/t/aria_stats_method_basic.test
new file mode 100644
index 00000000..6db27923
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/aria_stats_method_basic.test
@@ -0,0 +1,46 @@
+# enum session
+--source include/have_maria.inc
+
+SET @start_global_value = @@global.aria_stats_method;
+
+#
+# exists as global only
+#
+select @@global.aria_stats_method;
+select @@session.aria_stats_method;
+show global variables like 'aria_stats_method';
+show session variables like 'aria_stats_method';
+select * from information_schema.global_variables where variable_name='aria_stats_method';
+select * from information_schema.session_variables where variable_name='aria_stats_method';
+
+#
+# show that it's writable
+#
+set global aria_stats_method=1;
+select @@global.aria_stats_method;
+set session aria_stats_method=1;
+select @@session.aria_stats_method;
+
+#
+# all valid values
+#
+set session aria_stats_method=nulls_unequal;
+select @@session.aria_stats_method;
+set session aria_stats_method=nulls_equal;
+select @@session.aria_stats_method;
+set session aria_stats_method=nulls_ignored;
+select @@session.aria_stats_method;
+
+#
+# incorrect types/values
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set session aria_stats_method=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set session aria_stats_method=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set session aria_stats_method="foo";
+--error ER_WRONG_VALUE_FOR_VAR
+set session aria_stats_method=3;
+
+SET @@global.aria_stats_method = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/aria_sync_log_dir_basic.test b/mysql-test/suite/sys_vars/t/aria_sync_log_dir_basic.test
new file mode 100644
index 00000000..7809e0d8
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/aria_sync_log_dir_basic.test
@@ -0,0 +1,47 @@
+# enum global
+--source include/have_maria.inc
+
+SET @start_global_value = @@global.aria_sync_log_dir;
+
+#
+# exists as global only
+#
+select @@global.aria_sync_log_dir;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.aria_sync_log_dir;
+show global variables like 'aria_sync_log_dir';
+show session variables like 'aria_sync_log_dir';
+select * from information_schema.global_variables where variable_name='aria_sync_log_dir';
+select * from information_schema.session_variables where variable_name='aria_sync_log_dir';
+
+#
+# show that it's writable
+#
+set global aria_sync_log_dir=1;
+select @@global.aria_sync_log_dir;
+--error ER_GLOBAL_VARIABLE
+set session aria_sync_log_dir=1;
+
+#
+# all valid values
+#
+set global aria_sync_log_dir=never;
+select @@global.aria_sync_log_dir;
+set global aria_sync_log_dir=newfile;
+select @@global.aria_sync_log_dir;
+set global aria_sync_log_dir=always;
+select @@global.aria_sync_log_dir;
+
+#
+# incorrect types/values
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_sync_log_dir=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global aria_sync_log_dir=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global aria_sync_log_dir="foo";
+--error ER_WRONG_VALUE_FOR_VAR
+set global aria_sync_log_dir=3;
+
+SET @@global.aria_sync_log_dir = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/aria_used_for_temp_tables_basic.test b/mysql-test/suite/sys_vars/t/aria_used_for_temp_tables_basic.test
new file mode 100644
index 00000000..07f0c431
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/aria_used_for_temp_tables_basic.test
@@ -0,0 +1,23 @@
+# bool readonly
+
+--source include/have_aria_used_for_temp_tables.inc
+--source include/have_maria.inc
+#
+# show the global and session values;
+#
+select @@global.aria_used_for_temp_tables;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.aria_used_for_temp_tables;
+show global variables like 'aria_used_for_temp_tables';
+show session variables like 'aria_used_for_temp_tables';
+select * from information_schema.global_variables where variable_name='aria_used_for_temp_tables';
+select * from information_schema.session_variables where variable_name='aria_used_for_temp_tables';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global aria_used_for_temp_tables=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session aria_used_for_temp_tables=1;
+
diff --git a/mysql-test/suite/sys_vars/t/auto_increment_increment_basic.test b/mysql-test/suite/sys_vars/t/auto_increment_increment_basic.test
new file mode 100644
index 00000000..d76880b1
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/auto_increment_increment_basic.test
@@ -0,0 +1,207 @@
+############## mysql-test\t\auto_increment_increment_basic.test ################
+# #
+# Variable Name: auto_increment_increment #
+# Scope: GLOBAL & SESSION #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 1 #
+# Range: 1 - 65536 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable "auto_increment_increment"#
+# that checks behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_auto-increment-increment #
+# #
+################################################################################
+
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF auto_increment_increment TESTS #
+########################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.auto_increment_increment;
+SELECT @start_global_value;
+SET @start_session_value = @@session.auto_increment_increment;
+SELECT @start_session_value;
+
+
+--echo '#--------------------FN_DYNVARS_001_01-------------------------#'
+########################################################################
+# Display the DEFAULT value of auto_increment_increment #
+########################################################################
+
+SET @@global.auto_increment_increment = 100;
+SET @@global.auto_increment_increment = DEFAULT;
+SELECT @@global.auto_increment_increment;
+
+SET @@session.auto_increment_increment = 200;
+SET @@session.auto_increment_increment = DEFAULT;
+SELECT @@session.auto_increment_increment;
+
+
+--echo '#--------------------FN_DYNVARS_001_02-------------------------#'
+########################################################################
+# Check the DEFAULT value of auto_increment_increment #
+########################################################################
+
+SET @@global.auto_increment_increment = DEFAULT;
+SELECT @@global.auto_increment_increment = 1;
+
+SET @@session.auto_increment_increment = DEFAULT;
+SELECT @@session.auto_increment_increment = 1;
+
+
+--echo '#--------------------FN_DYNVARS_001_03-------------------------#'
+##################################################################
+# Change the value of variable to a valid value for GLOBAL Scope #
+##################################################################
+
+SET @@global.auto_increment_increment = 1;
+SELECT @@global.auto_increment_increment;
+SET @@global.auto_increment_increment = 60020;
+SELECT @@global.auto_increment_increment;
+SET @@global.auto_increment_increment = 65535;
+SELECT @@global.auto_increment_increment;
+
+
+--echo '#--------------------FN_DYNVARS_001_04-------------------------#'
+###################################################################
+# Change the value of variable to a valid value for SESSION Scope #
+###################################################################
+
+SET @@session.auto_increment_increment = 1;
+SELECT @@session.auto_increment_increment;
+SET @@session.auto_increment_increment = 50050;
+SELECT @@session.auto_increment_increment;
+SET @@session.auto_increment_increment = 65535;
+SELECT @@session.auto_increment_increment;
+
+
+--echo '#------------------FN_DYNVARS_001_05-----------------------#'
+####################################################################
+# Change the value of auto_increment_increment to an invalid value #
+####################################################################
+
+SET @@global.auto_increment_increment = 0;
+SELECT @@global.auto_increment_increment;
+SET @@global.auto_increment_increment = -1024;
+SELECT @@global.auto_increment_increment;
+SET @@global.auto_increment_increment = 65536;
+SELECT @@global.auto_increment_increment;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.auto_increment_increment = 65530.34;
+SELECT @@global.auto_increment_increment;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.auto_increment_increment = test;
+SELECT @@global.auto_increment_increment;
+
+SET @@session.auto_increment_increment = 0;
+SELECT @@session.auto_increment_increment;
+SET @@session.auto_increment_increment = -2;
+SELECT @@session.auto_increment_increment;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.auto_increment_increment = 65530.34;
+SET @@session.auto_increment_increment = 65550;
+SELECT @@session.auto_increment_increment;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.auto_increment_increment = test;
+SELECT @@session.auto_increment_increment;
+
+
+--echo '#------------------FN_DYNVARS_001_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+SELECT @@global.auto_increment_increment = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='auto_increment_increment';
+
+
+--echo '#------------------FN_DYNVARS_001_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.auto_increment_increment = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='auto_increment_increment';
+
+
+--echo '#------------------FN_DYNVARS_001_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.auto_increment_increment = TRUE;
+SELECT @@global.auto_increment_increment;
+SET @@global.auto_increment_increment = FALSE;
+SELECT @@global.auto_increment_increment;
+
+
+--echo '#---------------------FN_DYNVARS_001_09----------------------#'
+###############################################################################
+# Check if global and session variables are independant of each other #
+###############################################################################
+
+SET @@global.auto_increment_increment = 10;
+SET @@session.auto_increment_increment = 11;
+SELECT @@auto_increment_increment = @@global.auto_increment_increment;
+
+
+--echo '#---------------------FN_DYNVARS_001_10----------------------#'
+##############################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points #
+# to same session variable #
+##############################################################################
+
+SET @@auto_increment_increment = 100;
+SELECT @@auto_increment_increment = @@local.auto_increment_increment;
+SELECT @@local.auto_increment_increment = @@session.auto_increment_increment;
+
+
+--echo '#---------------------FN_DYNVARS_001_11----------------------#'
+###############################################################################
+# Check if auto_increment_increment can be accessed with and without @@ sign #
+###############################################################################
+
+SET auto_increment_increment = 1;
+SELECT @@auto_increment_increment;
+--Error ER_UNKNOWN_TABLE
+SELECT local.auto_increment_increment;
+--Error ER_UNKNOWN_TABLE
+SELECT session.auto_increment_increment;
+--Error ER_BAD_FIELD_ERROR
+SELECT auto_increment_increment = @@session.auto_increment_increment;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.auto_increment_increment = @start_global_value;
+SELECT @@global.auto_increment_increment;
+SET @@session.auto_increment_increment = @start_session_value;
+SELECT @@session.auto_increment_increment;
+
+
+#############################################################
+# END OF auto_increment_increment TESTS #
+#############################################################
+
diff --git a/mysql-test/suite/sys_vars/t/auto_increment_increment_func.test b/mysql-test/suite/sys_vars/t/auto_increment_increment_func.test
new file mode 100644
index 00000000..e0e2bd0e
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/auto_increment_increment_func.test
@@ -0,0 +1,191 @@
+############## mysql-test\t\auto_increment_increment_func.test ################
+# #
+# Variable Name: auto_increment_increment #
+# Scope: GLOBAL & SESSION #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 1 #
+# Range: 1 - 65536 #
+# #
+# #
+# Creation Date: 2008-03-07 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable "auto_increment_increment"#
+# that checks functionality of this variable #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_auto-increment-increment #
+# #
+################################################################################
+
+# save vars
+SET @global_auto_increment_increment = @@global.auto_increment_increment;
+SET @session_auto_increment_increment = @@session.auto_increment_increment;
+SET @global_auto_increment_offset = @@global.auto_increment_offset;
+SET @session_auto_increment_offset = @@session.auto_increment_offset;
+
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#########################
+# Creating new table #
+#########################
+CREATE TABLE t1
+(
+id INT NOT NULL auto_increment,
+PRIMARY KEY (id),
+name VARCHAR(30)
+);
+
+--echo '#--------------------FN_DYNVARS_001_01-------------------------#'
+##########################################################
+# Setting initial value of auto_increment_increment #
+##########################################################
+
+--echo ## Setting initial value of auto_increment_increment to 5 ##
+SET @@auto_increment_increment = 5;
+
+
+--echo '#--------------------FN_DYNVARS_001_02-------------------------#'
+###########################################################################
+# Inserting first value in table to check auto_increment_increment initial
+# behavior
+###########################################################################
+
+--echo ## Inserting first record in table to check behavior of the variable ##
+INSERT into t1(name) values('Record_1');
+SELECT * from t1;
+
+--echo ## Changing value of variable to 10 ##
+SET @@global.auto_increment_increment = 10;
+
+--echo ## Inserting record and verifying value of column id ##
+INSERT into t1(name) values('Record_2');
+SELECT * from t1;
+
+
+--echo ## Test behavior of variable after assigning some larger value to it ##
+SELECT @@auto_increment_increment;
+SET @@auto_increment_increment = 100;
+INSERT into t1(name) values('Record_5');
+SELECT * from t1;
+
+
+--echo '#--------------------FN_DYNVARS_001_03-------------------------#'
+##########################################################
+# Test behavior of variable on new connection # 01 #
+##########################################################
+
+CONNECT (test_con1,localhost,root,,);
+CONNECTION test_con1;
+
+--echo ## Value of session & global vairable here should be 10 ##
+SELECT @@global.auto_increment_increment = 10;
+SELECT @@session.auto_increment_increment = 10;
+
+--echo ## Setting global value of variable and inserting data in table ##
+SET @@global.auto_increment_increment = 20;
+SELECT @@global.auto_increment_increment;
+INSERT into t1(name) values('Record_6');
+SELECT * from t1;
+
+--echo ## Setting session value of variable and inserting data in table ##
+SET @@session.auto_increment_increment = 2;
+SELECT @@session.auto_increment_increment;
+INSERT into t1(name) values('Record_8');
+INSERT into t1(name) values('Record_9');
+SELECT * from t1;
+
+
+--echo '#--------------------FN_DYNVARS_001_04-------------------------#'
+##########################################################
+# Test behavior of variable on new connection # 02 #
+##########################################################
+
+CONNECT (test_con2,localhost,root,,);
+connection test_con2;
+
+--echo ## Verifying initial values of variable in global & session scope ##
+--echo ## global & session initial value should be 20 ##
+SELECT @@global.auto_increment_increment = 20;
+SELECT @@session.auto_increment_increment = 20;
+
+--echo ## Setting value of session variable to 5 and verifying its behavior ##
+SET @@session.auto_increment_increment = 5;
+INSERT into t1(name) values('Record_10');
+SELECT * from t1;
+
+SET @@session.auto_increment_increment = 1;
+SELECT @@auto_increment_increment;
+SELECT @@global.auto_increment_increment;
+
+
+--echo '#--------------------FN_DYNVARS_001_05-------------------------#'
+#####################################################################
+# Verify variable's value of connection # 01 after processing on
+# connection # 02
+#####################################################################
+
+connection test_con1;
+
+--echo ## Verifying values of global & session value of variable ##
+--echo ## global value should be 20 ##
+SELECT @@global.auto_increment_increment = 20;
+
+--echo ## session value should be 2 ##
+SELECT @@session.auto_increment_increment = 2;
+
+INSERT into t1(name) values('Record_11');
+INSERT into t1(name) values('Record_12');
+SELECT * from t1;
+
+
+--echo '#--------------------FN_DYNVARS_001_06-------------------------#'
+###############################################################################
+# Altering table field to different datatypes and checking their behavior #
+###############################################################################
+
+--echo ## Changing column's datatype to SmallInt and verifying variable's behavior ##
+ALTER table t1 MODIFY id SMALLINT NOT NULL auto_increment;
+INSERT into t1(name) values('Record_13');
+INSERT into t1(name) values('Record_14');
+SELECT * from t1;
+
+--echo ## Changing column's datatype to BigInt and verifying variable's behavior ##
+ALTER table t1 MODIFY id BIGINT NOT NULL auto_increment;
+INSERT into t1(name) values('Record_15');
+INSERT into t1(name) values('Record_16');
+SELECT * from t1;
+
+--echo '#--------------------FN_DYNVARS_001_07-------------------------#'
+###############################################################################
+# Check behavior of variable after assigning invalid value #
+###############################################################################
+
+--echo ## Verifying behavior of variable with negative value ##
+SET @@auto_increment_increment = -10;
+INSERT into t1(name) values('Record_17');
+INSERT into t1(name) values('Record_18');
+SELECT * from t1;
+
+############################################################
+# Disconnecting all connection & dropping table #
+############################################################
+
+DISCONNECT test_con2;
+
+--echo ## Dropping table t1 ##
+DROP table if exists t1;
+
+DISCONNECT test_con1;
+
+connection default;
+
+# restore vars
+SET @@global.auto_increment_increment = @global_auto_increment_increment;
+SET @@session.auto_increment_increment = @session_auto_increment_increment;
+SET @@global.auto_increment_offset = @global_auto_increment_offset;
+SET @@session.auto_increment_offset = @session_auto_increment_offset;
diff --git a/mysql-test/suite/sys_vars/t/auto_increment_offset_basic.test b/mysql-test/suite/sys_vars/t/auto_increment_offset_basic.test
new file mode 100644
index 00000000..76261645
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/auto_increment_offset_basic.test
@@ -0,0 +1,213 @@
+############## mysql-test\t\auto_increment_offset_basic.test ###################
+# #
+# Variable Name: auto_increment_offset #
+# Scope: GLOBAL & SESSION #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 1 #
+# Range: 1 - 65536 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable "auto_increment_offset" #
+# that checks behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_auto-increment-offset #
+# #
+################################################################################
+
+--source include/load_sysvars.inc
+
+#####################################################################
+# START OF auto_increment_offset TESTS #
+#####################################################################
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.auto_increment_offset;
+SELECT @start_global_value;
+SET @start_session_value = @@session.auto_increment_offset;
+SELECT @start_session_value;
+
+
+--echo '#--------------------FN_DYNVARS_002_01-------------------------#'
+#####################################################################
+# Display the DEFAULT value of auto_increment_offset #
+#####################################################################
+
+SET @@global.auto_increment_offset = 100;
+SET @@global.auto_increment_offset = DEFAULT;
+SELECT @@global.auto_increment_offset;
+
+SET @@session.auto_increment_offset = 200;
+SET @@session.auto_increment_offset = DEFAULT;
+SELECT @@session.auto_increment_offset;
+
+
+--echo '#--------------------FN_DYNVARS_002_02-------------------------#'
+#####################################################################
+# Check the DEFAULT value of auto_increment_offset #
+#####################################################################
+
+SET @@global.auto_increment_offset = @start_global_value;
+SELECT @@global.auto_increment_offset = 1;
+SET @@session.auto_increment_offset = @start_session_value;
+SELECT @@session.auto_increment_offset = 1;
+
+
+--echo '#--------------------FN_DYNVARS_002_03-------------------------#'
+###############################################################################
+# Change the value of auto_increment_offset to a valid value for GLOBAL Scope #
+###############################################################################
+
+SET @@global.auto_increment_offset = 1;
+SELECT @@global.auto_increment_offset;
+SET @@global.auto_increment_offset = 60020;
+SELECT @@global.auto_increment_offset;
+SET @@global.auto_increment_offset = 65535;
+SELECT @@global.auto_increment_offset;
+
+
+--echo '#--------------------FN_DYNVARS_002_04-------------------------#'
+###############################################################################
+# Change the value of auto_increment_offset to a valid value for SESSION Scope#
+###############################################################################
+
+SET @@session.auto_increment_offset = 1;
+SELECT @@session.auto_increment_offset;
+SET @@session.auto_increment_offset = 50050;
+SELECT @@session.auto_increment_offset;
+SET @@session.auto_increment_offset = 65535;
+SELECT @@session.auto_increment_offset;
+
+
+--echo '#------------------FN_DYNVARS_002_05-----------------------#'
+#################################################################
+# Change the value of auto_increment_offset to an invalid value #
+#################################################################
+# for global scope
+SET @@global.auto_increment_offset = 0;
+SELECT @@global.auto_increment_offset;
+SET @@global.auto_increment_offset = -1024;
+SELECT @@global.auto_increment_offset;
+SET @@global.auto_increment_offset = 65536;
+SELECT @@global.auto_increment_offset;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.auto_increment_offset = ON;
+SELECT @@global.auto_increment_offset;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.auto_increment_offset = OFF;
+SELECT @@global.auto_increment_offset;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.auto_increment_offset = test;
+SELECT @@global.auto_increment_offset;
+# for session scope
+SET @@session.auto_increment_offset = 0;
+SELECT @@session.auto_increment_offset;
+SET @@session.auto_increment_offset = -2;
+SELECT @@session.auto_increment_offset;
+SET @@session.auto_increment_offset = 65550;
+SELECT @@session.auto_increment_offset;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.auto_increment_offset = ON;
+SELECT @@session.auto_increment_offset;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.auto_increment_offset = OFF;
+SELECT @@session.auto_increment_offset;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.auto_increment_offset = test;
+SELECT @@session.auto_increment_offset;
+
+
+
+--echo '#------------------FN_DYNVARS_002_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+SELECT @@global.auto_increment_offset = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='auto_increment_offset';
+
+
+--echo '#------------------FN_DYNVARS_002_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.auto_increment_offset = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='auto_increment_offset';
+
+
+--echo '#------------------FN_DYNVARS_002_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.auto_increment_offset = TRUE;
+SELECT @@global.auto_increment_offset;
+SET @@global.auto_increment_offset = FALSE;
+SELECT @@global.auto_increment_offset;
+
+
+--echo '#---------------------FN_DYNVARS_001_09----------------------#'
+###############################################################################
+# Check if global and session variables are independant of each other #
+###############################################################################
+
+SET @@global.auto_increment_offset = 10;
+SET @@session.auto_increment_offset = 11;
+SELECT @@auto_increment_offset = @@global.auto_increment_offset;
+
+
+--echo '#---------------------FN_DYNVARS_001_10----------------------#'
+##############################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points #
+# to same session variable #
+##############################################################################
+
+SET @@auto_increment_offset = 100;
+SELECT @@auto_increment_offset = @@local.auto_increment_offset;
+SELECT @@local.auto_increment_offset = @@session.auto_increment_offset;
+
+
+--echo '#---------------------FN_DYNVARS_001_11----------------------#'
+###############################################################################
+# Check if auto_increment_offset can be accessed with and without @@ sign #
+###############################################################################
+
+SET auto_increment_offset = 1;
+SELECT @@auto_increment_offset;
+--Error ER_UNKNOWN_TABLE
+SELECT local.auto_increment_offset;
+--Error ER_UNKNOWN_TABLE
+SELECT session.auto_increment_offset;
+--Error ER_BAD_FIELD_ERROR
+SELECT auto_increment_offset = @@session.auto_increment_offset;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.auto_increment_offset = @start_global_value;
+SELECT @@global.auto_increment_offset;
+SET @@session.auto_increment_offset = @start_session_value;
+SELECT @@session.auto_increment_offset;
+
+
+###################################################
+# END OF auto_increment_offset TESTS #
+###################################################
+
diff --git a/mysql-test/suite/sys_vars/t/auto_increment_offset_func.test b/mysql-test/suite/sys_vars/t/auto_increment_offset_func.test
new file mode 100644
index 00000000..8d7120c8
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/auto_increment_offset_func.test
@@ -0,0 +1,190 @@
+############## mysql-test\t\auto_increment_offset_func.test ####################
+# #
+# Variable Name: auto_increment_offset #
+# Scope: GLOBAL & SESSION #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 1 #
+# Range: 1 - 65536 #
+# #
+# #
+# Creation Date: 2008-03-07 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable "auto_increment_offset" #
+# that checks functionality of this variable #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_auto-increment-offset #
+# #
+################################################################################
+
+# save vars
+SET @global_auto_increment_increment = @@global.auto_increment_increment;
+SET @session_auto_increment_increment = @@session.auto_increment_increment;
+SET @global_auto_increment_offset = @@global.auto_increment_offset;
+SET @session_auto_increment_offset = @@session.auto_increment_offset;
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#########################
+# Creating new table #
+#########################
+
+--echo ## Creating New Table ##
+CREATE TABLE t1
+(
+id INT NOT NULL auto_increment,
+PRIMARY KEY (id),
+name VARCHAR(30)
+);
+
+--echo '#--------------------FN_DYNVARS_002_01-------------------------#'
+#######################################################
+# Setting initial value of auto_increment_offset #
+#######################################################
+
+--echo ## Setting initial value of variable to 5 ##
+SET @@auto_increment_increment = 10;
+SET @@auto_increment_offset = 5;
+
+
+--echo '#--------------------FN_DYNVARS_002_02-------------------------#'
+###########################################################################
+# Inserting first value in table to check auto_increment_offset initial
+# behavior
+###########################################################################
+
+--echo ## Inserting records in table and verifying variable's behavior ##
+INSERT into t1(name) values('Record_1');
+SELECT * from t1;
+INSERT into t1(name) values('Record_2');
+SELECT * from t1;
+
+--echo ## Test behavior of variable after updating value of variable ##
+SET @@auto_increment_offset = 24;
+SELECT @@auto_increment_offset;
+INSERT into t1(name) values('Record_3');
+SELECT * from t1;
+INSERT into t1(name) values('Record_4');
+SELECT * from t1;
+
+
+--echo '#--------------------FN_DYNVARS_002_03-------------------------#'
+##########################################################
+# Test behavior of variable on new connection # 01 #
+##########################################################
+
+--echo ## Changing value of global scope before opening new connection ##
+
+SET @@global.auto_increment_increment = 15;
+SET @@global.auto_increment_offset = 36;
+
+CONNECT (test_con1,localhost,root,,);
+CONNECTION test_con1;
+
+--echo ## Value of session & global vairable here should be 10 ##
+SELECT @@global.auto_increment_offset = 36;
+SELECT @@session.auto_increment_offset = 36;
+
+--echo ## Verify global value effect of variable by inserting new rows in table ##
+INSERT into t1(name) values('Record_5');
+INSERT into t1(name) values('Record_6');
+SELECT * from t1;
+
+--echo ## Setting session value of variable and inserting data in table ##
+SET @@session.auto_increment_offset = 54;
+INSERT into t1(name) values('Record_7');
+INSERT into t1(name) values('Record_8');
+SELECT * from t1;
+
+
+--echo '#--------------------FN_DYNVARS_002_04-------------------------#'
+######################################################################
+# Test behavior of variable on assigning value to variable that is
+# less than last index id
+######################################################################
+
+--echo ## Setting value of variable less than last insert id ##
+SET @@session.auto_increment_offset = 5;
+INSERT into t1(name) values('Record_9');
+INSERT into t1(name) values('Record_10');
+INSERT into t1(name) values('Record_11');
+INSERT into t1(name) values('Record_12');
+SELECT * from t1;
+
+
+
+--echo '#--------------------FN_DYNVARS_002_05-------------------------#'
+#####################################################################
+# Verify variable's behavior on assigning value greater than
+# auto_increment_increment value
+#####################################################################
+
+--echo ## Assigning value to variable greater than auto_increment_incrent value ##
+SET @@auto_increment_offset = 140;
+SET @@auto_increment_increment = 10;
+
+INSERT into t1(name) values('Record_13');
+INSERT into t1(name) values('Record_14');
+SELECT * from t1;
+
+--echo '#--------------------FN_DYNVARS_002_06-------------------------#'
+###############################################################################
+# Altering table field to different datatypes and checking their behavior #
+###############################################################################
+
+--echo ## Changing datatype of column id with primary key to SmallInt ##
+ALTER table t1 modify id SMALLINT NOT NULL auto_increment;
+INSERT into t1(name) values('Record_15');
+INSERT into t1(name) values('Record_16');
+SELECT * from t1;
+
+--echo ## Changing datatype of column id with primary key to BigInt ##
+ALTER table t1 modify id BIGINT NOT NULL auto_increment;
+INSERT into t1(name) values('Record_17');
+INSERT into t1(name) values('Record_18');
+SELECT * from t1;
+
+--echo '#--------------------FN_DYNVARS_002_07-------------------------#'
+###############################################################################
+# Check behavior of variable after assigning invalid values to variable #
+###############################################################################
+
+--echo ## Assigning -ve value to variable ##
+SET @@auto_increment_offset = -10;
+SELECT @@auto_increment_offset = -10;
+INSERT into t1(name) values('Record_17');
+INSERT into t1(name) values('Record_18');
+SELECT * from t1;
+
+--echo ## Assigning value that is out of range of variable ##
+SET @@auto_increment_offset = 65536;
+SELECT @@auto_increment_offset;
+INSERT into t1(name) values('Record_17');
+INSERT into t1(name) values('Record_18');
+INSERT into t1(name) values('Record_19');
+INSERT into t1(name) values('Record_20');
+SELECT * from t1;
+
+--echo ## No effect of auto_increment_offset since value of this variable is greater ##
+--echo ## than auto_increment_increment ##
+
+############################################################
+# Disconnecting all connection & dropping table #
+############################################################
+
+--echo ## Dropping table ##
+DROP table if exists t1;
+
+DISCONNECT test_con1;
+
+connection default;
+
+# restore vars
+SET @@global.auto_increment_increment = @global_auto_increment_increment;
+SET @@session.auto_increment_increment = @session_auto_increment_increment;
+SET @@global.auto_increment_offset = @global_auto_increment_offset;
+SET @@session.auto_increment_offset = @session_auto_increment_offset;
diff --git a/mysql-test/suite/sys_vars/t/autocommit_basic.test b/mysql-test/suite/sys_vars/t/autocommit_basic.test
new file mode 100644
index 00000000..fa6654ae
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/autocommit_basic.test
@@ -0,0 +1,187 @@
+############## mysql-test\t\auto_commit_basic.test #############################
+# #
+# Variable Name: autocommit #
+# Scope: SESSION #
+# Access Type: Dynamic #
+# Data Type: Boolean #
+# Default Value: NA #
+# Range: NA #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable "autocommit" #
+# that checks behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: (Not Mentioned on website) #
+# #
+################################################################################
+
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF autocommit TESTS #
+########################################################################
+
+
+########################################################################
+# Saving initial value of autocommit in a temporary variable #
+########################################################################
+
+SET @start_value = @@global.autocommit;
+SELECT @start_value;
+
+
+--echo '#--------------------FN_DYNVARS_003_01------------------------#'
+########################################################################
+# Display the DEFAULT value of autocommit #
+########################################################################
+
+SET @@autocommit = 0;
+SET @@autocommit = DEFAULT;
+SELECT @@autocommit;
+
+--echo '#---------------------FN_DYNVARS_003_02-------------------------#'
+###############################################
+# Check default value of variable #
+###############################################
+
+SET @@autocommit = @start_value;
+SELECT @@autocommit = 1;
+
+
+--echo '#--------------------FN_DYNVARS_003_03------------------------#'
+########################################################################
+# Change the value of autocommit to a valid value #
+########################################################################
+SET @@autocommit = 0;
+SELECT @@autocommit;
+SET @@autocommit = 1;
+SELECT @@autocommit;
+
+
+--echo '#--------------------FN_DYNVARS_003_04-------------------------#'
+###########################################################################
+# Change the value of autocommit to invalid value #
+###########################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@autocommit = 2;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@autocommit = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@autocommit = TRUEF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@autocommit = TRUE_F;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@autocommit = FALSE0;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@autocommit = OON;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@autocommit = ONN;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@autocommit = OOFF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@autocommit = 0FF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@autocommit = ' ';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@autocommit = " ";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@autocommit = '';
+
+
+--echo '#-------------------FN_DYNVARS_003_05----------------------------#'
+###########################################################################
+# Test if accessing global autocommit gives error #
+###########################################################################
+
+SET @@global.autocommit = 0;
+SELECT @@global.autocommit;
+SET @@global.autocommit = 1;
+
+
+--echo '#----------------------FN_DYNVARS_003_06------------------------#'
+#########################################################################
+# Check if the value in SESSION Table matches value in variable #
+#########################################################################
+
+SELECT IF(@@session.autocommit, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='autocommit';
+
+--echo '#----------------------FN_DYNVARS_003_07------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#########################################################################
+
+SET @@autocommit = 1;
+SELECT IF(@@autocommit, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='autocommit';
+
+--echo '#---------------------FN_DYNVARS_003_08-------------------------#'
+###################################################################
+# Check if ON and OFF values can be used on variable #
+###################################################################
+
+SET @@autocommit = OFF;
+SELECT @@autocommit;
+SET @@autocommit = ON;
+SELECT @@autocommit;
+
+--echo '#---------------------FN_DYNVARS_003_09----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@autocommit = TRUE;
+SELECT @@autocommit;
+SET @@autocommit = FALSE;
+SELECT @@autocommit;
+
+
+--echo '#---------------------FN_DYNVARS_003_10----------------------#'
+##############################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points #
+# to same session variable #
+##############################################################################
+
+SET @@autocommit = 0;
+SELECT @@autocommit = @@local.autocommit;
+SELECT @@local.autocommit = @@session.autocommit;
+SET @@autocommit = 1;
+SELECT @@autocommit = @@local.autocommit;
+SELECT @@session.autocommit = @@autocommit;
+
+
+--echo '#---------------------FN_DYNVARS_003_11----------------------#'
+#####################################################################
+# Check if autocommit can be accessed with and without @@ sign #
+#####################################################################
+
+SET autocommit = 1;
+SELECT @@autocommit;
+--Error ER_UNKNOWN_TABLE
+SELECT local.autocommit;
+--Error ER_UNKNOWN_TABLE
+SELECT session.autocommit;
+--Error ER_BAD_FIELD_ERROR
+SELECT autocommit = @@session.autocommit;
+
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.autocommit = @start_value;
+SELECT @@global.autocommit;
+
+########################################################################
+# END OF autocommit TESTS #
+########################################################################
diff --git a/mysql-test/suite/sys_vars/t/autocommit_func.test b/mysql-test/suite/sys_vars/t/autocommit_func.test
new file mode 100644
index 00000000..2d5c66fb
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/autocommit_func.test
@@ -0,0 +1,159 @@
+############## mysql-test\t\auto_commit_func.test #############################
+# #
+# Variable Name: autocommit #
+# Scope: SESSION #
+# Access Type: Dynamic #
+# Data Type: Boolean #
+# Default Value: NA #
+# Range: NA #
+# #
+# #
+# Creation Date: 2008-03-07 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable "autocommit" #
+# that checks functionality of this variable #
+# #
+# Reference: (Not Mentioned on website) #
+# #
+################################################################################
+
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#########################
+# Creating new table #
+#########################
+
+--echo ## Creating new table ##
+CREATE TABLE t1
+(
+id INT NOT NULL auto_increment,
+PRIMARY KEY (id),
+name varchar(30)
+) ENGINE = INNODB;
+
+--echo '#--------------------FN_DYNVARS_003_01-------------------------#'
+#####################################################
+# Setting initial value of auto_commit to zero #
+#####################################################
+
+--echo ## Setting variable's value to 0 i.e false ##
+SET @@autocommit = 0;
+
+
+--echo '#--------------------FN_DYNVARS_003_02-------------------------#'
+######################################################################
+# Creating 2 different connections & testing behavior of autocommit
+# after updating record in 1st connection
+######################################################################
+
+CONNECT (test_con1,localhost,root,,);
+CONNECTION test_con1;
+
+--echo ## Checking value of variable after opening new connection ##
+
+SELECT @@autocommit;
+
+--echo ## Setting value of variable to zero and inserting some rows ##
+SET @@autocommit = 0;
+
+INSERT into t1(name) values('Record_1');
+INSERT into t1(name) values('Record_2');
+SELECT * from t1;
+
+--echo ## Creating another connection and verifying records in table ##
+
+CONNECT (test_con2,localhost,root,,);
+CONNECTION test_con2;
+SELECT * from t1;
+
+
+--echo '#--------------------FN_DYNVARS_003_03-------------------------#'
+######################################################################
+# Creating 2 different connections & testing behavior of autocommit
+# after updating record in 1st connection and using COMMIT in first
+# connection
+######################################################################
+
+--echo ## Verifying behavior of variable by commiting rows in test_con1 ##
+CONNECTION test_con1;
+SELECT * from t1;
+COMMIT;
+
+
+--echo ## Now verifying records in table from connection # 02 ##
+CONNECTION test_con2;
+SELECT * from t1;
+
+--echo '#--------------------FN_DYNVARS_003_04-------------------------#'
+######################################################################
+# Creating 2 different connections & testing behavior of autocommit
+# after updating record in 1st connection and using ROLLBACK in
+# first connection
+######################################################################
+
+CONNECTION test_con1;
+SELECT * from t1;
+
+--echo ## Updating value of first row ##
+UPDATE t1 set name = 'Record_12' where name = 'Record_1';
+SELECT * from t1;
+
+--echo ## Connecting to connecting # 02 and verifying effect of update query ##
+CONNECTION test_con2;
+SELECT * from t1;
+
+--echo ## Now connecting with connection # 01 and using ROLLBACK after it ##
+CONNECTION test_con1;
+ROLLBACK;
+SELECT * from t1;
+
+
+
+--echo '#--------------------FN_DYNVARS_003_05-------------------------#'
+######################################################################
+# Creating 2 different connections & testing behavior of autocommit
+# after updating records in 1st connection and setting AUTOCOMMIT
+# to 1 in second connection
+######################################################################
+
+
+CONNECTION test_con1;
+INSERT into t1(name) values('Record_3');
+
+
+--echo ## Now verifying records in table from connection # 02 and changing value ##
+--echo ## of autocommit to true ##
+CONNECTION test_con2;
+SELECT * from t1;
+SET @@autocommit = 1;
+INSERT into t1(name) values('Record_4');
+INSERT into t1(name) values('Record_5');
+SELECT * from t1;
+
+--echo ## Connecting with connection # 01 and inserting few records ##
+CONNECTION test_con1;
+SELECT * from t1;
+INSERT into t1(name) values('Record_6');
+SELECT * from t1;
+
+--echo ## Now verifying the effect of these new records in second connection ##
+CONNECTION test_con2;
+SELECT * from t1;
+
+--echo ## Commit changes
+CONNECTION test_con1;
+COMMIT;
+
+--echo ## Dropping table t1 ##
+DROP table t1;
+
+DISCONNECT test_con1;
+DISCONNECT test_con2;
+
+
+
diff --git a/mysql-test/suite/sys_vars/t/autocommit_func2-master.opt b/mysql-test/suite/sys_vars/t/autocommit_func2-master.opt
new file mode 100644
index 00000000..85e5d17d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/autocommit_func2-master.opt
@@ -0,0 +1 @@
+--autocommit=1
diff --git a/mysql-test/suite/sys_vars/t/autocommit_func2.test b/mysql-test/suite/sys_vars/t/autocommit_func2.test
new file mode 100644
index 00000000..9bb4c26d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/autocommit_func2.test
@@ -0,0 +1 @@
+--source suite/sys_vars/inc/autocommit_func2.inc
diff --git a/mysql-test/suite/sys_vars/t/autocommit_func3-master.opt b/mysql-test/suite/sys_vars/t/autocommit_func3-master.opt
new file mode 100644
index 00000000..e0fa81e6
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/autocommit_func3-master.opt
@@ -0,0 +1 @@
+--autocommit=0
diff --git a/mysql-test/suite/sys_vars/t/autocommit_func3.test b/mysql-test/suite/sys_vars/t/autocommit_func3.test
new file mode 100644
index 00000000..9bb4c26d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/autocommit_func3.test
@@ -0,0 +1 @@
+--source suite/sys_vars/inc/autocommit_func2.inc
diff --git a/mysql-test/suite/sys_vars/t/autocommit_func4-master.opt b/mysql-test/suite/sys_vars/t/autocommit_func4-master.opt
new file mode 100644
index 00000000..78899027
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/autocommit_func4-master.opt
@@ -0,0 +1 @@
+--autocommit=on
diff --git a/mysql-test/suite/sys_vars/t/autocommit_func4.test b/mysql-test/suite/sys_vars/t/autocommit_func4.test
new file mode 100644
index 00000000..9bb4c26d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/autocommit_func4.test
@@ -0,0 +1 @@
+--source suite/sys_vars/inc/autocommit_func2.inc
diff --git a/mysql-test/suite/sys_vars/t/autocommit_func5-master.opt b/mysql-test/suite/sys_vars/t/autocommit_func5-master.opt
new file mode 100644
index 00000000..409cb3ec
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/autocommit_func5-master.opt
@@ -0,0 +1 @@
+--autocommit=off
diff --git a/mysql-test/suite/sys_vars/t/autocommit_func5.test b/mysql-test/suite/sys_vars/t/autocommit_func5.test
new file mode 100644
index 00000000..9bb4c26d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/autocommit_func5.test
@@ -0,0 +1 @@
+--source suite/sys_vars/inc/autocommit_func2.inc
diff --git a/mysql-test/suite/sys_vars/t/automatic_sp_privileges_basic.test b/mysql-test/suite/sys_vars/t/automatic_sp_privileges_basic.test
new file mode 100644
index 00000000..6f7ceed0
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/automatic_sp_privileges_basic.test
@@ -0,0 +1,174 @@
+############## mysql-test\t\automatic_sp_privileges_basic.test #################
+# #
+# Variable Name: automatic_sp_privileges #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: Boolean #
+# Default Value: TRUE #
+# Range: NA #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable "automatic_sp_privileges" #
+# that checks behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_automatic_sp_privileges #
+# #
+################################################################################
+
+--source include/load_sysvars.inc
+
+#######################################################################
+# START OF automatic_sp_privileges TESTS #
+#######################################################################
+
+
+###############################################################################
+# Saving initial value of automatic_sp_privileges in a temporary variable #
+###############################################################################
+
+SET @start_value = @@global.automatic_sp_privileges;
+SELECT @start_value;
+
+--echo '#--------------------FN_DYNVARS_004_01------------------------#'
+###############################################################################
+# Display the DEFAULT value of automatic_sp_privileges #
+###############################################################################
+
+SET @@global.automatic_sp_privileges = 0;
+SET @@global.automatic_sp_privileges = DEFAULT;
+SELECT @@global.automatic_sp_privileges;
+
+
+--echo '#---------------------FN_DYNVARS_004_02-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@global.automatic_sp_privileges = @start_value;
+SELECT @@global.automatic_sp_privileges = TRUE;
+
+
+--echo '#--------------------FN_DYNVARS_004_03------------------------#'
+###############################################################################
+# Change the value of automatic_sp_privileges to a valid value #
+###############################################################################
+
+SET @@global.automatic_sp_privileges = 0;
+SELECT @@global.automatic_sp_privileges;
+SET @@global.automatic_sp_privileges = 1;
+SELECT @@global.automatic_sp_privileges;
+
+--echo '#--------------------FN_DYNVARS_004_04-------------------------#'
+###############################################################################
+# Change the value of automatic_sp_privileges to invalid value #
+###############################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.automatic_sp_privileges = 2;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.automatic_sp_privileges = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.automatic_sp_privileges = TRUEF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.automatic_sp_privileges = TRUE_F;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.automatic_sp_privileges = FALSE0;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.automatic_sp_privileges = OON;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.automatic_sp_privileges = ONN;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.automatic_sp_privileges = OOFF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.automatic_sp_privileges = 0FF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.automatic_sp_privileges = ' ';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.automatic_sp_privileges = " ";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.automatic_sp_privileges = '';
+
+
+--echo '#-------------------FN_DYNVARS_004_05----------------------------#'
+###########################################################################
+# Test if accessing session automatic_sp_privileges gives error #
+###########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.automatic_sp_privileges = 1;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.automatic_sp_privileges;
+
+
+--echo '#----------------------FN_DYNVARS_004_06------------------------#'
+##############################################################################
+# Check if the value in GLOBAL Tables matches values in variable #
+##############################################################################
+
+SELECT IF(@@global.automatic_sp_privileges, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='automatic_sp_privileges';
+
+--echo '#---------------------FN_DYNVARS_004_07----------------------#'
+###################################################################
+# Check if ON and OFF values can be used on variable #
+###################################################################
+
+SET @@global.automatic_sp_privileges = OFF;
+SELECT @@global.automatic_sp_privileges;
+SET @@global.automatic_sp_privileges = ON;
+SELECT @@global.automatic_sp_privileges;
+
+--echo '#---------------------FN_DYNVARS_004_08----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.automatic_sp_privileges = TRUE;
+SELECT @@global.automatic_sp_privileges;
+SET @@global.automatic_sp_privileges = FALSE;
+SELECT @@global.automatic_sp_privileges;
+
+--echo '#---------------------FN_DYNVARS_004_09----------------------#'
+##############################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points #
+# to same session variable #
+##############################################################################
+
+SET @@global.automatic_sp_privileges = 1;
+SELECT @@automatic_sp_privileges = @@global.automatic_sp_privileges;
+
+--echo '#---------------------FN_DYNVARS_004_10----------------------#'
+###############################################################################
+# Check if automatic_sp_privileges can be accessed with and without @@ sign #
+###############################################################################
+--Error ER_GLOBAL_VARIABLE
+SET automatic_sp_privileges = 1;
+--Error ER_UNKNOWN_TABLE
+SELECT local.automatic_sp_privileges;
+--Error ER_UNKNOWN_TABLE
+SELECT global.automatic_sp_privileges;
+--Error ER_BAD_FIELD_ERROR
+SELECT automatic_sp_privileges = @@session.automatic_sp_privileges;
+
+
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.automatic_sp_privileges = @start_value;
+SELECT @@global.automatic_sp_privileges;
+
+
+#############################################################
+# END OF automatic_sp_privileges TESTS #
+#############################################################
diff --git a/mysql-test/suite/sys_vars/t/automatic_sp_privileges_func.test b/mysql-test/suite/sys_vars/t/automatic_sp_privileges_func.test
new file mode 100644
index 00000000..25fda7d6
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/automatic_sp_privileges_func.test
@@ -0,0 +1,142 @@
+############# mysql-test\t\automatic_sp_privileges_func.test ############################
+# #
+# Variable Name: automatic_sp_privileges #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: BOOLEAN #
+# Default Value: 1 TRUE #
+# Values: 1 TRUE, 0 FALSE #
+# #
+# #
+# Creation Date: 2008-03-04 #
+# Author: Sharique Abdullah #
+# #
+# Description: Test Cases of Dynamic System Variable "automatic_sp_privileges" #
+# that checks behavior of this variable in the following ways #
+# * Functionality based on different values #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_automatic_sp_privileges #
+# #
+#########################################################################################
+
+#
+# Setup
+#
+
+--source include/not_embedded.inc
+
+--echo ** Setup **
+SET @global_automatic_sp_privileges = @@GLOBAL.automatic_sp_privileges;
+
+CREATE TABLE t1 (a varchar(200));
+
+INSERT INTO t1 VALUES('Procedure Executed.');
+
+#
+# Creating test user
+#
+
+CREATE USER 'userTest'@'localhost';
+GRANT CREATE ROUTINE, SELECT ON test.* to 'userTest'@'localhost';
+CREATE USER 'userTest1'@'localhost';
+GRANT CREATE ROUTINE, SELECT ON test.* to 'userTest1'@'localhost';
+
+#
+# Value TRUE
+#
+connection default;
+SET GLOBAL automatic_sp_privileges = TRUE;
+
+connect (conUser,localhost,userTest,,);
+connection conUser;
+
+delimiter |;
+
+CREATE PROCEDURE testProc ()
+BEGIN
+SELECT * FROM t1;
+END;|
+
+delimiter ;|
+
+CALL testProc();
+--echo Expecting SELECT executed
+
+#
+# Value FALSE
+#
+connection default;
+SET GLOBAL automatic_sp_privileges = FALSE;
+
+connect (conUser1,localhost,userTest1,,);
+connection conUser1;
+
+delimiter |;
+
+CREATE PROCEDURE testProc1 ()
+BEGIN
+SELECT * FROM t1;
+END;|
+
+delimiter ;|
+
+--echo
+--echo Expected error access denied
+--error ER_PROCACCESS_DENIED_ERROR
+CALL testProc1();
+
+--echo
+--echo Expected error access denied
+--error ER_PROCACCESS_DENIED_ERROR
+ALTER PROCEDURE testProc1 COMMENT 'My Comment';
+
+--echo
+--echo Expected error access denied
+--error ER_PROCACCESS_DENIED_ERROR
+DROP PROCEDURE testProc1;
+
+connection default;
+
+GRANT EXECUTE, ALTER ROUTINE ON PROCEDURE testProc1 TO 'userTest1'@'localhost';
+
+connection conUser1;
+
+CALL testProc1();
+--echo Expecting seelect executed
+
+ALTER PROCEDURE testProc1 COMMENT 'My Comment';
+
+--echo
+#
+# Cleanup
+#
+--echo ** Cleanup **
+connection default;
+
+disconnect conUser;
+disconnect conUser1;
+
+SET GLOBAL automatic_sp_privileges = @global_automatic_sp_privileges;
+
+# Disabled due to differences in results: Bug#35384
+#SHOW GRANTS FOR 'userTest'@'localhost';
+
+# on Linux (5.1.24) successful, on Windows (5.1.23) error
+--error 0,ER_NONEXISTING_PROC_GRANT
+REVOKE EXECUTE, ALTER ROUTINE ON PROCEDURE testProc FROM 'userTest'@'localhost';
+
+--error 0,ER_NONEXISTING_PROC_GRANT
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'userTest'@'localhost';
+
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'userTest1'@'localhost';
+
+--disable_warnings
+DROP PROCEDURE testProc;
+--enable_warnings
+DROP PROCEDURE testProc1;
+
+DROP USER 'userTest'@'localhost';
+DROP USER 'userTest1'@'localhost';
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/sys_vars/t/back_log_basic.opt b/mysql-test/suite/sys_vars/t/back_log_basic.opt
new file mode 100644
index 00000000..fefc0d53
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/back_log_basic.opt
@@ -0,0 +1 @@
+--back-log=1000 --max-connections=300
diff --git a/mysql-test/suite/sys_vars/t/back_log_basic.test b/mysql-test/suite/sys_vars/t/back_log_basic.test
new file mode 100644
index 00000000..94a86416
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/back_log_basic.test
@@ -0,0 +1,4 @@
+#
+# show the global and session values;
+#
+select @@global.back_log;
diff --git a/mysql-test/suite/sys_vars/t/basedir_basic.test b/mysql-test/suite/sys_vars/t/basedir_basic.test
new file mode 100644
index 00000000..480e46ca
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/basedir_basic.test
@@ -0,0 +1,100 @@
+
+
+################## mysql-test\t\basedir_basic.test ############################
+# #
+# Variable Name: basedir #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: filename #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable basedir #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--echo '#---------------------BS_STVARS_001_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.basedir);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_001_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.basedir=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.basedir);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_001_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+SELECT @@GLOBAL.basedir = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='basedir';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.basedir);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='basedir';
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_001_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@basedir = @@GLOBAL.basedir;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_001_05----------------------#'
+################################################################################
+# Check if basedir can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@basedir);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.basedir);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.basedir);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.basedir);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT basedir = @@SESSION.basedir;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/big_tables_basic.test b/mysql-test/suite/sys_vars/t/big_tables_basic.test
new file mode 100644
index 00000000..d004feac
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/big_tables_basic.test
@@ -0,0 +1,171 @@
+##################### mysql-test\t\big_tables_basic.test #######################
+# #
+# Variable Name: big_tables #
+# Scope: SESSION #
+# Access Type: Dynamic #
+# Data Type: Boolean #
+# Default Value: NA #
+# Range: NA #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable "big_tables" #
+# that checks behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity . #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-options.html#option_mysqld_big-tables #
+# #
+################################################################################
+
+--source include/load_sysvars.inc
+
+##########################################################
+# START OF big_tables TESTS #
+##########################################################
+
+
+##################################################################
+# Saving initial value of big_tables in a temporary variable #
+##################################################################
+
+SET @start_value = @@big_tables;
+SELECT @start_value;
+
+--echo '#--------------------FN_DYNVARS_005_01------------------------#'
+#############################################################
+# Display the DEFAULT value of big_tables #
+#############################################################
+
+SET @@big_tables = 1;
+SET @@big_tables = DEFAULT;
+SELECT @@big_tables;
+
+
+--echo '#--------------------FN_DYNVARS_005_02------------------------#'
+#############################################################
+# Change the value of big_tables to a valid value #
+#############################################################
+
+SET @@big_tables = 0;
+SELECT @@big_tables;
+SET @@big_tables = 1;
+SELECT @@big_tables;
+
+
+--echo '#--------------------FN_DYNVARS_005_03-------------------------#'
+###########################################################################
+# Change the value of big_tables to invalid value #
+###########################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@big_tables = 2;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@big_tables = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@big_tables = TRUEF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@big_tables = TRUE_F;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@big_tables = FALSE0;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@big_tables = OON;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@big_tables = ONN;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@big_tables = OOFF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@big_tables = 0FF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@big_tables = ' ';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@big_tables = " ";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@big_tables = '';
+
+
+
+--echo '#-------------------FN_DYNVARS_005_04----------------------------#'
+###########################################################################
+# Test if accessing global big_tables gives error #
+###########################################################################
+
+SET @@global.big_tables = 1-@@global.big_tables;
+SELECT @@global.big_tables;
+SET @@global.big_tables = 1-@@global.big_tables;
+
+--echo '#----------------------FN_DYNVARS_005_05------------------------#'
+##############################################################################
+# Check if the value in SESSION Tables matches values in variable #
+##############################################################################
+
+SELECT IF(@@big_tables, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='big_tables';
+
+
+--echo '#---------------------FN_DYNVARS_005_06----------------------#'
+###################################################################
+# Check if ON and OFF values can be used on variable #
+###################################################################
+
+SET @@big_tables = OFF;
+SELECT @@big_tables;
+SET @@big_tables = ON;
+SELECT @@big_tables;
+
+--echo '#---------------------FN_DYNVARS_005_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@big_tables = TRUE;
+SELECT @@big_tables;
+SET @@big_tables = FALSE;
+SELECT @@big_tables;
+
+
+--echo '#---------------------FN_DYNVARS_005_08----------------------#'
+##############################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points #
+# to same session variable #
+##############################################################################
+
+SET @@big_tables = 0;
+SELECT @@big_tables = @@session.big_tables;
+SET @@big_tables = 1;
+SELECT @@big_tables = @@local.big_tables and @@local.big_tables = @@session.big_tables;
+
+--echo '#---------------------FN_DYNVARS_005_09----------------------#'
+##########################################################################
+# Check if big_tables can be accessed with and without @@ sign #
+##########################################################################
+
+SET big_tables = 1;
+SELECT @@big_tables;
+--Error ER_UNKNOWN_TABLE
+SELECT local.big_tables;
+--Error ER_UNKNOWN_TABLE
+SELECT session.big_tables;
+--Error ER_BAD_FIELD_ERROR
+select big_tables;
+
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@big_tables = @start_value;
+SELECT @@big_tables;
+
+
+#######################################################
+# END OF big_tables TESTS #
+#######################################################
+
+
diff --git a/mysql-test/suite/sys_vars/t/bind_address_basic.test b/mysql-test/suite/sys_vars/t/bind_address_basic.test
new file mode 100644
index 00000000..f7c567b3
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/bind_address_basic.test
@@ -0,0 +1,95 @@
+
+
+################## mysql-test\t\bind_address_basic.test ############################
+# #
+# Variable Name: bind_address #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: filename #
+###############################################################################
+
+--source include/not_embedded.inc
+
+--echo '#---------------------BS_STVARS_001_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.bind_address);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_001_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.bind_address=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.bind_address);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_001_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+--disable_warnings
+SELECT VARIABLE_VALUE = ''
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='bind_address';
+--enable_warnings
+--echo 0 Expected
+
+SELECT COUNT(@@GLOBAL.bind_address);
+--echo 1 Expected
+
+--disable_warnings
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='bind_address';
+--enable_warnings
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_001_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@bind_address is NULL AND @@GLOBAL.bind_address is NULL;
+--echo 0 Expected
+
+SELECT @@bind_address is NOT NULL AND @@GLOBAL.bind_address is NOT NULL;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_001_05----------------------#'
+################################################################################
+# Check if bind_address can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@bind_address);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.bind_address);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.bind_address);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.bind_address);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT bind_address = @@SESSION.bind_address;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/binlog_alter_two_phase.test b/mysql-test/suite/sys_vars/t/binlog_alter_two_phase.test
new file mode 100644
index 00000000..bc3adf12
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/binlog_alter_two_phase.test
@@ -0,0 +1,52 @@
+#
+# binlog_alter_two_phase system variable
+# Session as well as global
+# Allowed values NO_SPLIT, SPLIT, BINLOG_ONLY (0,1,2)
+
+--source include/not_embedded.inc
+
+--let $binlog_alter_two_phase= `select @@binlog_alter_two_phase`
+set binlog_alter_two_phase = OFF;
+select @@binlog_alter_two_phase;
+
+set binlog_alter_two_phase = ON;
+select @@binlog_alter_two_phase;
+
+--echo # wrong value
+--error ER_WRONG_VALUE_FOR_VAR
+set binlog_alter_two_phase=BINLOG_OY;
+select @@binlog_alter_two_phase;
+
+--echo #true and false
+set binlog_alter_two_phase=false;
+select @@binlog_alter_two_phase;
+
+set binlog_alter_two_phase=true;
+select @@binlog_alter_two_phase;
+
+set binlog_alter_two_phase=0;
+select @@binlog_alter_two_phase;
+
+set binlog_alter_two_phase=1;
+select @@binlog_alter_two_phase;
+
+--echo ##wrong value
+--error ER_WRONG_VALUE_FOR_VAR
+set binlog_alter_two_phase=2;
+select @@binlog_alter_two_phase;
+
+
+--echo #Global value
+set global binlog_alter_two_phase = OFF;
+connect (con1,localhost,root,,);
+select @@binlog_alter_two_phase;
+disconnect con1;
+
+connection default;
+set global binlog_alter_two_phase = ON;
+connect (con1,localhost,root,,);
+select @@binlog_alter_two_phase;
+disconnect con1;
+
+connection default;
+--eval set global binlog_alter_two_phase=$binlog_alter_two_phase
diff --git a/mysql-test/suite/sys_vars/t/binlog_annotate_row_events_basic.test b/mysql-test/suite/sys_vars/t/binlog_annotate_row_events_basic.test
new file mode 100644
index 00000000..9dd3545e
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/binlog_annotate_row_events_basic.test
@@ -0,0 +1,39 @@
+# bool session
+
+SET @start_global_value = @@global.binlog_annotate_row_events;
+
+select @@global.binlog_annotate_row_events;
+select @@session.binlog_annotate_row_events;
+show global variables like 'binlog_annotate_row_events';
+show session variables like 'binlog_annotate_row_events';
+select * from information_schema.global_variables where variable_name='binlog_annotate_row_events';
+select * from information_schema.session_variables where variable_name='binlog_annotate_row_events';
+
+#
+# show that it's writable
+#
+set global binlog_annotate_row_events=ON;
+select @@global.binlog_annotate_row_events;
+set global binlog_annotate_row_events=OFF;
+select @@global.binlog_annotate_row_events;
+set global binlog_annotate_row_events=1;
+select @@global.binlog_annotate_row_events;
+
+set session binlog_annotate_row_events=ON;
+select @@session.binlog_annotate_row_events;
+set session binlog_annotate_row_events=OFF;
+select @@session.binlog_annotate_row_events;
+set session binlog_annotate_row_events=1;
+select @@session.binlog_annotate_row_events;
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global binlog_annotate_row_events=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set session binlog_annotate_row_events=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set session binlog_annotate_row_events="foo";
+
+SET @@global.binlog_annotate_row_events = @start_global_value;
+
diff --git a/mysql-test/suite/sys_vars/t/binlog_annotate_row_events_grant.test b/mysql-test/suite/sys_vars/t/binlog_annotate_row_events_grant.test
new file mode 100644
index 00000000..d289267a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/binlog_annotate_row_events_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21971 Bind BINLOG ADMIN to binlog_annotate_row_events and binlog_row_image global and session variables
+--echo #
+
+--let var = binlog_annotate_row_events
+--let grant = BINLOG ADMIN
+--let value = 1
+
+--source suite/sys_vars/inc/sysvar_global_and_session_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/binlog_cache_size_basic.test b/mysql-test/suite/sys_vars/t/binlog_cache_size_basic.test
new file mode 100644
index 00000000..45018914
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/binlog_cache_size_basic.test
@@ -0,0 +1,152 @@
+################ mysql-test\t\binlog_cache_size_basic.test ####################
+ #
+# Variable Name: binlog_cache_size #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 32768 #
+# Range: 4096 - 4294967295 #
+# #
+# #
+# Creation Date: 2008-04-28 #
+# Author: Salman Rawala/Horst Hunger #
+# #
+# Description: Test Cases of Dynamic System Variable "binlog_cache_size" #
+# that checks behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity . #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_binlog_cache_size #
+# #
+###############################################################################
+
+#################################################################
+# START OF binlog_cache_size TESTS #
+#################################################################
+
+#########################################################################
+# Saving initial value of binlog_cache_size in a temporary variable #
+#########################################################################
+
+SET @start_value = @@global.binlog_cache_size;
+set @@global.binlog_cache_size= default;
+SELECT @@global.binlog_cache_size;
+
+--echo '#--------------------FN_DYNVARS_006_01------------------------#'
+#########################################################################
+# Display the DEFAULT value of binlog_cache_size #
+#########################################################################
+
+SET @@global.binlog_cache_size = 100;
+SET @@global.binlog_cache_size = DEFAULT;
+SELECT @@global.binlog_cache_size;
+
+
+--echo '#---------------------FN_DYNVARS_006_02-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@global.binlog_cache_size = default;
+SELECT @@global.binlog_cache_size = 32768;
+
+
+--echo '#--------------------FN_DYNVARS_006_03------------------------#'
+#########################################################################
+# Change the value of binlog_cache_size to a valid value #
+#########################################################################
+
+SET @@global.binlog_cache_size = 4096;
+SELECT @@global.binlog_cache_size;
+SET @@global.binlog_cache_size = 4294967295;
+SELECT @@global.binlog_cache_size;
+SET @@global.binlog_cache_size = 10000;
+SELECT @@global.binlog_cache_size;
+SET @@global.binlog_cache_size = 21221204;
+SELECT @@global.binlog_cache_size;
+echo 'Bug: Invalid values are coming in variable on assigning valid values';
+
+
+--echo '#--------------------FN_DYNVARS_006_04-------------------------#'
+############################################################################
+# Change the value of binlog_cache_size to invalid value #
+############################################################################
+
+SET @@global.binlog_cache_size = 1024;
+SELECT @@global.binlog_cache_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.binlog_cache_size = 10000.01;
+SET @@global.binlog_cache_size = -1024;
+SELECT @@global.binlog_cache_size;
+SET @@global.binlog_cache_size = 42949672950;
+--replace_result 4294963200 max_binlog_cache_size 42949668864 max_binlog_cache_size
+SELECT @@global.binlog_cache_size;
+echo 'Bug: Errors are not coming on assigning invalid values to variable';
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.binlog_cache_size = ON;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.binlog_cache_size = 'test';
+
+
+--echo '#-------------------FN_DYNVARS_006_05----------------------------#'
+############################################################################
+# Test if accessing session binlog_cache_size gives error #
+############################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.binlog_cache_size = 0;
+
+
+--echo '#----------------------FN_DYNVARS_006_06------------------------#'
+##############################################################################
+# Check if the value in GLOBAL Tables matches values in variable #
+##############################################################################
+
+SELECT @@global.binlog_cache_size = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='binlog_cache_size';
+
+--echo '#---------------------FN_DYNVARS_006_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.binlog_cache_size = TRUE;
+SELECT @@global.binlog_cache_size;
+SET @@global.binlog_cache_size = FALSE;
+SELECT @@global.binlog_cache_size;
+echo 'Bug: Errors are not coming on assigning TRUE/FALSE to variable';
+
+--echo '#---------------------FN_DYNVARS_006_08----------------------#'
+###############################################################################
+# Check if accessing variable without SCOPE points to same global variable #
+###############################################################################
+
+SET @@global.binlog_cache_size = 1;
+SELECT @@binlog_cache_size = @@global.binlog_cache_size;
+
+--echo '#---------------------FN_DYNVARS_006_09----------------------#'
+###########################################################################
+# Check if binlog_cache_size can be accessed with and without @@ sign #
+###########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET binlog_cache_size = 1;
+--Error ER_UNKNOWN_TABLE
+SELECT global.binlog_cache_size;
+--Error ER_BAD_FIELD_ERROR
+SELECT binlog_cache_size = @@session.binlog_cache_size;
+
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.binlog_cache_size = @start_value;
+
+###########################################################
+# END OF binlog_cache_size TESTS #
+###########################################################
diff --git a/mysql-test/suite/sys_vars/t/binlog_cache_size_grant.test b/mysql-test/suite/sys_vars/t/binlog_cache_size_grant.test
new file mode 100644
index 00000000..bad55766
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/binlog_cache_size_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21963 Bind BINLOG ADMIN to a number of global system variables
+--echo #
+
+--let var = binlog_cache_size
+--let grant = BINLOG ADMIN
+--let value = 65536
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/binlog_checksum_basic.test b/mysql-test/suite/sys_vars/t/binlog_checksum_basic.test
new file mode 100644
index 00000000..1c8a8339
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/binlog_checksum_basic.test
@@ -0,0 +1,25 @@
+--source include/not_embedded.inc
+
+# suite/rpl/t/rpl_checksum.test contains similar testing of
+# all checksum related system variables.
+
+set @save_binlog_checksum= @@global.binlog_checksum;
+set @@global.binlog_checksum = default;
+
+select @@global.binlog_checksum as 'must be CRC32 by default';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.binlog_checksum as 'no session var';
+
+
+# testing lack of side-effects in non-effective update of binlog_checksum:
+set @@global.binlog_checksum = CRC32;
+set @@global.binlog_checksum = CRC32;
+
+set @@global.master_verify_checksum = 0;
+set @@global.master_verify_checksum = default;
+
+--error ER_WRONG_VALUE_FOR_VAR
+set @@global.binlog_checksum = ADLER32;
+
+# cleanup
+set @@global.binlog_checksum = @save_binlog_checksum;
diff --git a/mysql-test/suite/sys_vars/t/binlog_commit_wait_count_basic.test b/mysql-test/suite/sys_vars/t/binlog_commit_wait_count_basic.test
new file mode 100644
index 00000000..ebce0da7
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/binlog_commit_wait_count_basic.test
@@ -0,0 +1,14 @@
+--source include/not_embedded.inc
+
+SET @save_binlog_commit_wait_count= @@GLOBAL.binlog_commit_wait_count;
+
+SELECT @@GLOBAL.binlog_commit_wait_count as 'must be zero because of default';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@SESSION.binlog_commit_wait_count as 'no session var';
+
+SET GLOBAL binlog_commit_wait_count= 0;
+SET GLOBAL binlog_commit_wait_count= DEFAULT;
+SET GLOBAL binlog_commit_wait_count= 10;
+SELECT @@GLOBAL.binlog_commit_wait_count;
+
+SET GLOBAL binlog_commit_wait_count = @save_binlog_commit_wait_count;
diff --git a/mysql-test/suite/sys_vars/t/binlog_commit_wait_count_grant.test b/mysql-test/suite/sys_vars/t/binlog_commit_wait_count_grant.test
new file mode 100644
index 00000000..5095747d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/binlog_commit_wait_count_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21963 Bind BINLOG ADMIN to a number of global system variables
+--echo #
+
+--let var = binlog_commit_wait_count
+--let grant = BINLOG ADMIN
+--let value = 65536
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/binlog_commit_wait_usec_basic.test b/mysql-test/suite/sys_vars/t/binlog_commit_wait_usec_basic.test
new file mode 100644
index 00000000..ad9b6c99
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/binlog_commit_wait_usec_basic.test
@@ -0,0 +1,14 @@
+--source include/not_embedded.inc
+
+SET @save_binlog_commit_wait_usec= @@GLOBAL.binlog_commit_wait_usec;
+
+SELECT @@GLOBAL.binlog_commit_wait_usec as 'check default';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@SESSION.binlog_commit_wait_usec as 'no session var';
+
+SET GLOBAL binlog_commit_wait_usec= 0;
+SET GLOBAL binlog_commit_wait_usec= DEFAULT;
+SET GLOBAL binlog_commit_wait_usec= 10000;
+SELECT @@GLOBAL.binlog_commit_wait_usec;
+
+SET GLOBAL binlog_commit_wait_usec = @save_binlog_commit_wait_usec;
diff --git a/mysql-test/suite/sys_vars/t/binlog_commit_wait_usec_grant.test b/mysql-test/suite/sys_vars/t/binlog_commit_wait_usec_grant.test
new file mode 100644
index 00000000..87a8cd20
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/binlog_commit_wait_usec_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21963 Bind BINLOG ADMIN to a number of global system variables
+--echo #
+
+--let var = binlog_commit_wait_usec
+--let grant = BINLOG ADMIN
+--let value = 65536
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/binlog_direct_non_transactional_updates_basic.test b/mysql-test/suite/sys_vars/t/binlog_direct_non_transactional_updates_basic.test
new file mode 100644
index 00000000..9381f022
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/binlog_direct_non_transactional_updates_basic.test
@@ -0,0 +1,97 @@
+######### mysql-test\t\binlog_direct_non_transactional_updates.test ###########
+# #
+# Variable Name: binlog_direct_non_transactional_updates #
+# Scope: Global & Session #
+# Access Type: Static #
+# Data Type: bool #
+# #
+# Description:Test Cases of Dynamic System Variable #
+# binlog_direct_non_transactional_updates #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# #
+###############################################################################
+
+SELECT @@GLOBAL.binlog_direct_non_transactional_updates;
+
+--echo '#---------------------BS_STVARS_002_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SET @start_value= @@global.binlog_direct_non_transactional_updates;
+
+SELECT COUNT(@@GLOBAL.binlog_direct_non_transactional_updates);
+--echo 1 Expected
+
+SELECT COUNT(@@SESSION.binlog_direct_non_transactional_updates);
+--echo 1 Expected
+
+--echo '#---------------------BS_STVARS_002_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+SET @@GLOBAL.binlog_direct_non_transactional_updates=TRUE;
+SELECT @@GLOBAL.binlog_direct_non_transactional_updates;
+
+SET @@SESSION.binlog_direct_non_transactional_updates=TRUE;
+SELECT @@SESSION.binlog_direct_non_transactional_updates;
+
+--echo '#---------------------BS_STVARS_002_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+SELECT
+IF(@@GLOBAL.binlog_direct_non_transactional_updates, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='binlog_direct_non_transactional_updates';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.binlog_direct_non_transactional_updates);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='binlog_direct_non_transactional_updates';
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_002_04----------------------#'
+#################################################################
+# Check if the value in SESSION Table matches value in variable #
+#################################################################
+
+SELECT
+IF(@@SESSION.binlog_direct_non_transactional_updates, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='binlog_direct_non_transactional_updates';
+--echo 1 Expected
+
+SELECT COUNT(@@SESSION.binlog_direct_non_transactional_updates);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='binlog_direct_non_transactional_updates';
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_002_05----------------------#'
+################################################################################
+# Check if binlog_format can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@binlog_direct_non_transactional_updates);
+--echo 1 Expected
+SELECT COUNT(@@local.binlog_direct_non_transactional_updates);
+--echo 1 Expected
+SELECT COUNT(@@SESSION.binlog_direct_non_transactional_updates);
+--echo 1 Expected
+SELECT COUNT(@@GLOBAL.binlog_direct_non_transactional_updates);
+--echo 1 Expected
+
+SET @@global.binlog_direct_non_transactional_updates= @start_value;
diff --git a/mysql-test/suite/sys_vars/t/binlog_direct_non_transactional_updates_grant.test b/mysql-test/suite/sys_vars/t/binlog_direct_non_transactional_updates_grant.test
new file mode 100644
index 00000000..7de1a119
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/binlog_direct_non_transactional_updates_grant.test
@@ -0,0 +1,56 @@
+source include/have_log_bin.inc;
+
+SET @global= @@global.binlog_direct_non_transactional_updates;
+SET @session= @@global.binlog_direct_non_transactional_updates;
+
+
+--echo #
+--echo #
+--echo #
+
+--echo # Test that "SET binlog_direct_non_transactional_updates" is not allowed without BINLOG ADMIN or SUPER
+
+CREATE USER user1@localhost;
+GRANT ALL PRIVILEGES ON *.* TO user1@localhost;
+REVOKE BINLOG ADMIN, SUPER ON *.* FROM user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+SET binlog_direct_non_transactional_updates=0;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+SET GLOBAL binlog_direct_non_transactional_updates=0;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+SET SESSION binlog_direct_non_transactional_updates=0;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET binlog_direct_non_transactional_updates" is allowed with BINLOG ADMIN
+
+CREATE USER user1@localhost;
+GRANT BINLOG ADMIN ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+SET binlog_direct_non_transactional_updates=0;
+SET GLOBAL binlog_direct_non_transactional_updates=0;
+SET SESSION binlog_direct_non_transactional_updates=0;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET binlog_direct_non_transactional_updates" is allowed with SUPER
+
+CREATE USER user1@localhost;
+GRANT SUPER ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+SET binlog_direct_non_transactional_updates=0;
+SET GLOBAL binlog_direct_non_transactional_updates=0;
+SET SESSION binlog_direct_non_transactional_updates=0;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+
+SET GLOBAL binlog_direct_non_transactional_updates=@global;
+SET SESSION binlog_direct_non_transactional_updates=@session;
diff --git a/mysql-test/suite/sys_vars/t/binlog_expire_logs_seconds_basic.test b/mysql-test/suite/sys_vars/t/binlog_expire_logs_seconds_basic.test
new file mode 100644
index 00000000..45704560
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/binlog_expire_logs_seconds_basic.test
@@ -0,0 +1,137 @@
+############## mysql-test\t\binlog_expire_logs_seconds_basic.test ################
+# #
+# Variable Name: binlog_expire_logs_seconds #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value:0 #
+# Range: 0- (2^32 -1) #
+# #
+# #
+# Creation Date: 2017-11-28 #
+# Author: Neha kumari #
+# #
+# Description: Test Cases of Dynamic System Variable #
+# binlog_expire_logs_seconds that checks the behavior of this #
+# variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#
+# #
+##################################################################################
+
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF binlog_expire_logs_seconds TESTS #
+########################################################################
+
+SET @start_value_sec = @@global.binlog_expire_logs_seconds;
+SELECT @start_value_sec;
+########################################################################
+# Display the DEFAULT value of binlog_expire_logs_seconds #
+########################################################################
+
+SET @@global.binlog_expire_logs_seconds = DEFAULT;
+SELECT @@global.binlog_expire_logs_seconds;
+
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@global.binlog_expire_logs_seconds = @start_value_sec;
+SELECT @@global.binlog_expire_logs_seconds = 0;
+
+##################################################################################
+# Change the value of binlog_expire_logs_seconds to a valid value #
+##################################################################################
+
+SET @@global.binlog_expire_logs_seconds = 0;
+SELECT @@global.binlog_expire_logs_seconds;
+SET @@global.binlog_expire_logs_seconds = 99;
+SELECT @@global.binlog_expire_logs_seconds;
+SET @@global.binlog_expire_logs_seconds = 10;
+SELECT @@global.binlog_expire_logs_seconds;
+SET @@global.binlog_expire_logs_seconds = 21;
+SELECT @@global.binlog_expire_logs_seconds;
+
+#####################################################################################
+# Change the value of binlog_expire_logs_seconds to invalid value #
+#####################################################################################
+
+SET @@global.binlog_expire_logs_seconds = -1;
+SELECT @@global.binlog_expire_logs_seconds;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.binlog_expire_logs_seconds = 10000.01;
+SELECT @@global.binlog_expire_logs_seconds;
+SET @@global.binlog_expire_logs_seconds = -1024;
+SELECT @@global.binlog_expire_logs_seconds;
+SET @@global.binlog_expire_logs_seconds = 42949672950;
+SELECT @@global.binlog_expire_logs_seconds;
+SET @@global.binlog_expire_logs_seconds = 8734635;
+SELECT @@global.binlog_expire_logs_seconds;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.binlog_expire_logs_seconds = ON;
+SELECT @@global.binlog_expire_logs_seconds;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.binlog_expire_logs_seconds = 'test';
+SELECT @@global.binlog_expire_logs_seconds;
+
+#####################################################################################
+# Test if accessing session binlog_expire_logs_seconds gives error #
+#####################################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.binlog_expire_logs_seconds = 0;
+SELECT @@binlog_expire_logs_seconds;
+
+##############################################################################
+# Check if the value in GLOBAL & SESSION Tables matches values in variable #
+##############################################################################
+
+--disable_warnings
+SELECT @@global.binlog_expire_logs_seconds = VARIABLE_VALUE
+FROM information_schema.global_variables
+WHERE VARIABLE_NAME='binlog_expire_logs_seconds';
+
+SELECT @@binlog_expire_logs_seconds = VARIABLE_VALUE
+FROM information_schema.session_variables
+WHERE VARIABLE_NAME='binlog_expire_logs_seconds';
+--enable_warnings
+
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.binlog_expire_logs_seconds = TRUE;
+SELECT @@global.binlog_expire_logs_seconds;
+SET @@global.binlog_expire_logs_seconds = FALSE;
+SELECT @@global.binlog_expire_logs_seconds;
+
+
+####################################################################################
+# Check if binlog_expire_logs_seconds can be accessed with and without @@ sign #
+####################################################################################
+SET @@global.binlog_expire_logs_seconds = 1;
+SELECT @@binlog_expire_logs_seconds = @@global.binlog_expire_logs_seconds;
+
+--Error ER_GLOBAL_VARIABLE
+SET binlog_expire_logs_seconds = 1;
+SELECT @@binlog_expire_logs_seconds;
+--Error ER_UNKNOWN_TABLE
+SELECT local.binlog_expire_logs_seconds;
+--Error ER_UNKNOWN_TABLE
+SELECT global.binlog_expire_logs_seconds;
+--Error ER_BAD_FIELD_ERROR
+SELECT binlog_expire_logs_seconds = @@session.binlog_expire_logs_seconds;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.binlog_expire_logs_seconds = @start_value_sec;
+SELECT @@global.binlog_expire_logs_seconds;
diff --git a/mysql-test/suite/sys_vars/t/binlog_expire_logs_seconds_grant.test b/mysql-test/suite/sys_vars/t/binlog_expire_logs_seconds_grant.test
new file mode 100644
index 00000000..8b12e0af
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/binlog_expire_logs_seconds_grant.test
@@ -0,0 +1,10 @@
+--echo #
+--echo # MDEV-19371: Implement binlog_expire_logs_seconds for purging of binary logs
+--echo # Test that "SET binlog_expire_logs_seconds" is not allowed without BINLOG ADMIN or SUPER
+--echo #
+
+--let var = binlog_expire_logs_seconds
+--let grant = BINLOG ADMIN
+--let value = 10
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/binlog_file_cache_size_grant.test b/mysql-test/suite/sys_vars/t/binlog_file_cache_size_grant.test
new file mode 100644
index 00000000..b6362d14
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/binlog_file_cache_size_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21963 Bind BINLOG ADMIN to a number of global system variables
+--echo #
+
+--let var = binlog_file_cache_size
+--let grant = BINLOG ADMIN
+--let value = 65536
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/binlog_format_basic.test b/mysql-test/suite/sys_vars/t/binlog_format_basic.test
new file mode 100644
index 00000000..cd2b772f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/binlog_format_basic.test
@@ -0,0 +1,105 @@
+################## mysql-test\t\binlog_format_basic.test ######################
+# #
+# Variable Name: binlog_format #
+# Scope: Global & Session #
+# Access Type: Static #
+# Data Type: enumeration #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable binlog_format #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# #
+###############################################################################
+
+###################################################################
+# BUG#39812: Make statement replication default for 5.1 (to match 5.0)
+# We just verify that the default binlog_format is STATEMENT in 5.1.
+# In 6.0, it should be MIXED.
+###################################################################
+SELECT @@GLOBAL.binlog_format;
+
+--echo '#---------------------BS_STVARS_002_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SET @start_value= @@global.binlog_format;
+
+SELECT COUNT(@@GLOBAL.binlog_format);
+--echo 1 Expected
+
+SELECT COUNT(@@SESSION.binlog_format);
+--echo 1 Expected
+
+--echo '#---------------------BS_STVARS_002_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+SET @@GLOBAL.binlog_format=1;
+SELECT @@GLOBAL.binlog_format;
+
+SET @@SESSION.binlog_format=1;
+SELECT @@SESSION.binlog_format;
+
+--echo '#---------------------BS_STVARS_002_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+SELECT @@GLOBAL.binlog_format = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='binlog_format';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.binlog_format);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='binlog_format';
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_002_04----------------------#'
+#################################################################
+# Check if the value in SESSION Table matches value in variable #
+#################################################################
+
+SELECT @@SESSION.binlog_format = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='binlog_format';
+--echo 1 Expected
+
+SELECT COUNT(@@SESSION.binlog_format);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='binlog_format';
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_002_05----------------------#'
+################################################################################
+# Check if binlog_format can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@binlog_format);
+--echo 1 Expected
+SELECT COUNT(@@local.binlog_format);
+--echo 1 Expected
+SELECT COUNT(@@SESSION.binlog_format);
+--echo 1 Expected
+SELECT COUNT(@@GLOBAL.binlog_format);
+--echo 1 Expected
+
+SET @@global.binlog_format= @start_value;
+
diff --git a/mysql-test/suite/sys_vars/t/binlog_format_grant.test b/mysql-test/suite/sys_vars/t/binlog_format_grant.test
new file mode 100644
index 00000000..6f89c75a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/binlog_format_grant.test
@@ -0,0 +1,49 @@
+source include/have_log_bin.inc;
+
+
+--echo #
+--echo #
+--echo #
+
+--echo # Test that "SET binlog_format" is not allowed without BINLOG ADMIN or SUPER
+
+CREATE USER user1@localhost;
+GRANT ALL PRIVILEGES ON *.* TO user1@localhost;
+REVOKE BINLOG ADMIN, SUPER ON *.* FROM user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+SET binlog_format=mixed;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+SET GLOBAL binlog_format=mixed;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+SET SESSION binlog_format=mixed;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET binlog_format" is allowed with BINLOG ADMIN
+
+CREATE USER user1@localhost;
+GRANT BINLOG ADMIN ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+SET binlog_format=mixed;
+SET GLOBAL binlog_format=mixed;
+SET SESSION binlog_format=mixed;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET binlog_format" is allowed with SUPER
+
+CREATE USER user1@localhost;
+GRANT SUPER ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+SET binlog_format=mixed;
+SET GLOBAL binlog_format=mixed;
+SET SESSION binlog_format=mixed;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
diff --git a/mysql-test/suite/sys_vars/t/binlog_optimize_thread_scheduling_basic.test b/mysql-test/suite/sys_vars/t/binlog_optimize_thread_scheduling_basic.test
new file mode 100644
index 00000000..01726907
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/binlog_optimize_thread_scheduling_basic.test
@@ -0,0 +1,21 @@
+# bool readonly
+
+#
+# show values;
+#
+select @@global.binlog_optimize_thread_scheduling;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.binlog_optimize_thread_scheduling;
+show global variables like 'binlog_optimize_thread_scheduling';
+show session variables like 'binlog_optimize_thread_scheduling';
+select * from information_schema.global_variables where variable_name='binlog_optimize_thread_scheduling';
+select * from information_schema.session_variables where variable_name='binlog_optimize_thread_scheduling';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global binlog_optimize_thread_scheduling=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session binlog_optimize_thread_scheduling=1;
+
diff --git a/mysql-test/suite/sys_vars/t/binlog_row_image_basic.test b/mysql-test/suite/sys_vars/t/binlog_row_image_basic.test
new file mode 100644
index 00000000..6f5095b6
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/binlog_row_image_basic.test
@@ -0,0 +1,129 @@
+################## mysql-test\t\binlog_row_image_basic.test ###################
+# #
+# Variable Name: binlog_row_image #
+# Scope: Global & Session #
+# Access Type: Static #
+# Data Type: enumeration #
+# #
+# #
+# Creation Date: 2010-05-20 #
+# Author : Luis Soares #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable binlog_row_image #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.X/en/server-system-variables.html #
+# #
+###############################################################################
+
+
+SELECT @@GLOBAL.binlog_row_image;
+SELECT @@SESSION.binlog_row_image;
+--echo FULL Expected
+
+--echo '#---------------------BS_STVARS_002_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SET @start_value= @@global.binlog_row_image;
+
+SELECT COUNT(@@GLOBAL.binlog_row_image);
+--echo 1 Expected
+
+SELECT COUNT(@@SESSION.binlog_row_image);
+--echo 1 Expected
+
+--echo '#---------------------BS_STVARS_002_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+SET @@GLOBAL.binlog_row_image=0;
+SELECT @@GLOBAL.binlog_row_image;
+--echo MINIMAL Expected
+
+SET @@SESSION.binlog_row_image=0;
+SELECT @@SESSION.binlog_row_image;
+--echo MINIMAL Expected
+
+SET @@GLOBAL.binlog_row_image=1;
+SELECT @@GLOBAL.binlog_row_image;
+--echo NOBLOB Expected
+
+SET @@SESSION.binlog_row_image=1;
+SELECT @@SESSION.binlog_row_image;
+--echo NOBLOB Expected
+
+SET @@GLOBAL.binlog_row_image=2;
+SELECT @@GLOBAL.binlog_row_image;
+--echo FULL Expected
+
+SET @@SESSION.binlog_row_image=2;
+SELECT @@SESSION.binlog_row_image;
+--echo FULL Expected
+
+--echo '#---------------------BS_STVARS_002_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+--disable_warnings
+SELECT @@GLOBAL.binlog_row_image = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='binlog_row_image';
+--enable_warnings
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.binlog_row_image);
+--echo 1 Expected
+
+--disable_warnings
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='binlog_row_image';
+--enable_warnings
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_002_04----------------------#'
+#################################################################
+# Check if the value in SESSION Table matches value in variable #
+#################################################################
+
+--disable_warnings
+SELECT @@SESSION.binlog_row_image = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='binlog_row_image';
+--enable_warnings
+--echo 1 Expected
+
+SELECT COUNT(@@SESSION.binlog_row_image);
+--echo 1 Expected
+
+--disable_warnings
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='binlog_row_image';
+--enable_warnings
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_002_05----------------------#'
+################################################################################
+# Check if binlog_row_image can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@binlog_row_image);
+--echo 1 Expected
+SELECT COUNT(@@local.binlog_row_image);
+--echo 1 Expected
+SELECT COUNT(@@SESSION.binlog_row_image);
+--echo 1 Expected
+SELECT COUNT(@@GLOBAL.binlog_row_image);
+--echo 1 Expected
+
+SET @@global.binlog_row_image= @start_value;
+
diff --git a/mysql-test/suite/sys_vars/t/binlog_row_image_grant.test b/mysql-test/suite/sys_vars/t/binlog_row_image_grant.test
new file mode 100644
index 00000000..e50b3750
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/binlog_row_image_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21971 Bind BINLOG ADMIN to binlog_annotate_row_events and binlog_row_image global and session variables
+--echo #
+
+--let var = binlog_row_image
+--let grant = BINLOG ADMIN
+--let value = 1
+
+--source suite/sys_vars/inc/sysvar_global_and_session_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/binlog_row_metadata_basic.test b/mysql-test/suite/sys_vars/t/binlog_row_metadata_basic.test
new file mode 100644
index 00000000..d08acd5a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/binlog_row_metadata_basic.test
@@ -0,0 +1,121 @@
+################## mysql-test\t\binlog_row_metadata_basic.test ################
+# #
+# Variable Name: binlog_row_metadata #
+# Scope: Global #
+# Data Type: enumeration #
+# #
+# Creation Date: 2017-01-23 #
+# Author : Libing Song #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable binlog_row_metadata #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/8.X/en/server-system-variables.html #
+# #
+###############################################################################
+
+
+--echo NO_LOG Expected
+SELECT @@GLOBAL.binlog_row_metadata;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@SESSION.binlog_row_metadata;
+
+--echo '#---------------------BS_STVARS_002_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SET @start_value= @@global.binlog_row_metadata;
+
+SELECT COUNT(@@GLOBAL.binlog_row_metadata);
+--echo 1 Expected
+
+--echo '#---------------------BS_STVARS_002_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+SET @@GLOBAL.binlog_row_metadata=0;
+SELECT @@GLOBAL.binlog_row_metadata;
+--echo NO_LOG Expected
+
+SET @@GLOBAL.binlog_row_metadata=1;
+SELECT @@GLOBAL.binlog_row_metadata;
+--echo MINIMAL Expected
+
+SET @@GLOBAL.binlog_row_metadata=2;
+SELECT @@GLOBAL.binlog_row_metadata;
+--echo FULL Expected
+
+SET @@GLOBAL.binlog_row_metadata=NO_LOG;
+SELECT @@GLOBAL.binlog_row_metadata;
+--echo NO_LOG Expected
+
+SET @@GLOBAL.binlog_row_metadata=MINIMAL;
+SELECT @@GLOBAL.binlog_row_metadata;
+--echo MINIMAL Expected
+
+SET @@GLOBAL.binlog_row_metadata=FULL;
+SELECT @@GLOBAL.binlog_row_metadata;
+--echo FULL Expected
+
+SET @@GLOBAL.binlog_row_metadata='NO_LOG';
+SELECT @@GLOBAL.binlog_row_metadata;
+--echo NO_LOG Expected
+
+SET @@GLOBAL.binlog_row_metadata='MINIMAL';
+SELECT @@GLOBAL.binlog_row_metadata;
+--echo MINIMAL Expected
+
+SET @@GLOBAL.binlog_row_metadata='FULL';
+SELECT @@GLOBAL.binlog_row_metadata;
+--echo FULL Expected
+
+--echo '#---------------------BS_STVARS_002_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+SET @@GLOBAL.binlog_row_metadata='MINIMAl';
+SELECT *
+FROM information_schema.global_variables
+WHERE VARIABLE_NAME='binlog_row_metadata';
+
+--echo '#---------------------BS_STVARS_002_04----------------------#'
+#################################################################
+# Check if the value in SESSION Table matches value in variable #
+#################################################################
+
+SELECT *
+FROM information_schema.session_variables
+WHERE VARIABLE_NAME LIKE 'binlog_row_metadata';
+
+--echo '#---------------------BS_STVARS_002_05----------------------#'
+################################################################################
+# Check if binlog_row_metadata can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@binlog_row_metadata);
+--echo 1 Expected
+SELECT COUNT(@@GLOBAL.binlog_row_metadata);
+--echo 1 Expected
+
+--echo '#---------------------BS_STVARS_002_06----------------------#'
+################################################################################
+# Check if binlog_row_metadata can handle invalid values correctly #
+################################################################################
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL binlog_row_metadata = full1;
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL binlog_row_metadata = "full1";
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL binlog_row_metadata = 3;
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL binlog_row_metadata = -1;
+
+SET @@global.binlog_row_metadata= @start_value;
diff --git a/mysql-test/suite/sys_vars/t/binlog_row_metadata_grant.test b/mysql-test/suite/sys_vars/t/binlog_row_metadata_grant.test
new file mode 100644
index 00000000..8dac8218
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/binlog_row_metadata_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21963 Bind BINLOG ADMIN to a number of global system variables
+--echo #
+
+--let var = binlog_row_metadata
+--let grant = BINLOG ADMIN
+--let value = NO_LOG
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/binlog_stmt_cache_size_basic.test b/mysql-test/suite/sys_vars/t/binlog_stmt_cache_size_basic.test
new file mode 100644
index 00000000..d6ae35ca
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/binlog_stmt_cache_size_basic.test
@@ -0,0 +1,153 @@
+################ mysql-test\t\binlog_stmt_cache_size_basic.test ###############
+# #
+# Variable Name: binlog_stmt_cache_size #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 32768 #
+# Range: 4096 - 4294967295 #
+# #
+# #
+# Creation Date: 2010-10-12 #
+# Author: Alfranio Correia #
+# #
+# Description: Test Cases of Dynamic System Variable "binlog_stmt_cache_size" #
+# that checks behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity . #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.5/en/ #
+# server-system-variables.html#option_mysqld_binlog_stmt_cache_size #
+# #
+###############################################################################
+
+#################################################################
+# START OF binlog_stmt_cache_size TESTS #
+#################################################################
+
+#########################################################################
+# Saving initial value of binlog_stmt_cache_size in a temporary variable #
+#########################################################################
+
+SET @start_value = @@global.binlog_stmt_cache_size;
+set @@global.binlog_stmt_cache_size=default;
+SELECT @@global.binlog_stmt_cache_size;
+
+--echo '#--------------------FN_DYNVARS_006_01------------------------#'
+#########################################################################
+# Display the DEFAULT value of binlog_stmt_cache_size #
+#########################################################################
+
+SET @@global.binlog_stmt_cache_size = 100;
+SET @@global.binlog_stmt_cache_size = DEFAULT;
+SELECT @@global.binlog_stmt_cache_size;
+
+
+--echo '#---------------------FN_DYNVARS_006_02-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@global.binlog_stmt_cache_size = default;
+SELECT @@global.binlog_stmt_cache_size = 32768;
+
+
+--echo '#--------------------FN_DYNVARS_006_03------------------------#'
+#########################################################################
+# Change the value of binlog_stmt_cache_size to a valid value #
+#########################################################################
+
+SET @@global.binlog_stmt_cache_size = 4096;
+SELECT @@global.binlog_stmt_cache_size;
+SET @@global.binlog_stmt_cache_size = 4294967295;
+SELECT @@global.binlog_stmt_cache_size;
+SET @@global.binlog_stmt_cache_size = 10000;
+SELECT @@global.binlog_stmt_cache_size;
+SET @@global.binlog_stmt_cache_size = 21221204;
+SELECT @@global.binlog_stmt_cache_size;
+echo 'Bug: Invalid values are coming in variable on assigning valid values';
+
+
+--echo '#--------------------FN_DYNVARS_006_04-------------------------#'
+############################################################################
+# Change the value of binlog_stmt_cache_size to invalid value #
+############################################################################
+
+SET @@global.binlog_stmt_cache_size = 1024;
+SELECT @@global.binlog_stmt_cache_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.binlog_stmt_cache_size = 10000.01;
+SET @@global.binlog_stmt_cache_size = -1024;
+SELECT @@global.binlog_stmt_cache_size;
+SET @@global.binlog_stmt_cache_size = 42949672950;
+--replace_result 4294963200 max_binlog_cache_size 42949668864 max_binlog_cache_size
+SELECT @@global.binlog_stmt_cache_size;
+echo 'Bug: Errors are not coming on assigning invalid values to variable';
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.binlog_stmt_cache_size = ON;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.binlog_stmt_cache_size = 'test';
+
+
+--echo '#-------------------FN_DYNVARS_006_05----------------------------#'
+############################################################################
+# Test if accessing session binlog_stmt_cache_size gives error #
+############################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.binlog_stmt_cache_size = 0;
+
+
+--echo '#----------------------FN_DYNVARS_006_06------------------------#'
+##############################################################################
+# Check if the value in GLOBAL Tables matches values in variable #
+##############################################################################
+
+SELECT @@global.binlog_stmt_cache_size = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='binlog_stmt_cache_size';
+
+--echo '#---------------------FN_DYNVARS_006_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.binlog_stmt_cache_size = TRUE;
+SELECT @@global.binlog_stmt_cache_size;
+SET @@global.binlog_stmt_cache_size = FALSE;
+SELECT @@global.binlog_stmt_cache_size;
+echo 'Bug: Errors are not coming on assigning TRUE/FALSE to variable';
+
+--echo '#---------------------FN_DYNVARS_006_08----------------------#'
+###############################################################################
+# Check if accessing variable without SCOPE points to same global variable #
+###############################################################################
+
+SET @@global.binlog_stmt_cache_size = 1;
+SELECT @@binlog_stmt_cache_size = @@global.binlog_stmt_cache_size;
+
+--echo '#---------------------FN_DYNVARS_006_09----------------------#'
+###########################################################################
+# Check if binlog_stmt_cache_size can be accessed with and without @@ sign#
+###########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET binlog_stmt_cache_size = 1;
+--Error ER_UNKNOWN_TABLE
+SELECT global.binlog_stmt_cache_size;
+--Error ER_BAD_FIELD_ERROR
+SELECT binlog_stmt_cache_size = @@session.binlog_stmt_cache_size;
+
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.binlog_stmt_cache_size = @start_value;
+
+
+###########################################################
+# END OF binlog_stmt_cache_size TESTS #
+###########################################################
diff --git a/mysql-test/suite/sys_vars/t/binlog_stmt_cache_size_grant.test b/mysql-test/suite/sys_vars/t/binlog_stmt_cache_size_grant.test
new file mode 100644
index 00000000..9b9afad1
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/binlog_stmt_cache_size_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21963 Bind BINLOG ADMIN to a number of global system variables
+--echo #
+
+--let var = binlog_stmt_cache_size
+--let grant = BINLOG ADMIN
+--let value = 65536
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/bulk_insert_buffer_size_basic.test b/mysql-test/suite/sys_vars/t/bulk_insert_buffer_size_basic.test
new file mode 100644
index 00000000..125dc2fc
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/bulk_insert_buffer_size_basic.test
@@ -0,0 +1,204 @@
+############## mysql-test\t\bulk_insert_buffer_size_basic.test #################
+# #
+# Variable Name: bulk_insert_buffer_size #
+# Scope: GLOBAL & SESSION #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 8388608 #
+# Range: 0 - 4294967295 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable "bulk_insert_buffer_size" #
+# that checks behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity . #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_bulk_insert_buffer_size #
+# #
+################################################################################
+
+--source include/load_sysvars.inc
+
+#######################################################################
+# START OF bulk_insert_buffer_size TESTS #
+#######################################################################
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.bulk_insert_buffer_size;
+SELECT @start_global_value;
+SET @start_session_value = @@session.bulk_insert_buffer_size;
+SELECT @start_session_value;
+
+--echo '#--------------------FN_DYNVARS_007_01-------------------------#'
+#######################################################################
+# Display the DEFAULT value of bulk_insert_buffer_size #
+#######################################################################
+
+SET @@global.bulk_insert_buffer_size = 100;
+SET @@global.bulk_insert_buffer_size = DEFAULT;
+SELECT @@global.bulk_insert_buffer_size;
+
+SET @@session.bulk_insert_buffer_size = 200;
+SET @@session.bulk_insert_buffer_size = DEFAULT;
+SELECT @@session.bulk_insert_buffer_size;
+
+
+--echo '#--------------------FN_DYNVARS_007_02-------------------------#'
+#######################################################################
+# Check the DEFAULT value of bulk_insert_buffer_size #
+#######################################################################
+
+SET @@global.bulk_insert_buffer_size = @start_global_value;
+SELECT @@global.bulk_insert_buffer_size = 8388608;
+
+SET @@session.bulk_insert_buffer_size = @start_session_value;
+SELECT @@session.bulk_insert_buffer_size = 8388608;
+
+
+--echo '#--------------------FN_DYNVARS_007_03-------------------------#'
+###############################################################################
+#Change the value of bulk_insert_buffer_size to valid values for GLOBAL Scope #
+###############################################################################
+
+SET @@global.bulk_insert_buffer_size = 0;
+SELECT @@global.bulk_insert_buffer_size;
+SET @@global.bulk_insert_buffer_size = 1;
+SELECT @@global.bulk_insert_buffer_size;
+SET @@global.bulk_insert_buffer_size = 4294967295;
+SELECT @@global.bulk_insert_buffer_size;
+SET @@global.bulk_insert_buffer_size = 429496;
+SELECT @@global.bulk_insert_buffer_size;
+
+
+--echo '#--------------------FN_DYNVARS_007_04-------------------------#'
+###############################################################################
+#Change the value of bulk_insert_buffer_size to valid values for SESSION Scope#
+###############################################################################
+
+SET @@session.bulk_insert_buffer_size = 0;
+SELECT @@session.bulk_insert_buffer_size;
+SET @@session.bulk_insert_buffer_size = 1;
+SELECT @@session.bulk_insert_buffer_size;
+SET @@session.bulk_insert_buffer_size = 4294967295;
+SELECT @@session.bulk_insert_buffer_size;
+SET @@session.bulk_insert_buffer_size = 429496;
+SELECT @@session.bulk_insert_buffer_size;
+
+
+--echo '#------------------FN_DYNVARS_007_05-----------------------#'
+###################################################################
+# Change the value of bulk_insert_buffer_size to an invalid value #
+###################################################################
+
+--disable_warnings
+SET @@global.bulk_insert_buffer_size = 42949672950;
+--enable_warnings
+--replace_result 4294967295 max_bulk_insert_buffer_size 42949672950 max_bulk_insert_buffer_size
+SELECT @@global.bulk_insert_buffer_size;
+SET @@global.bulk_insert_buffer_size = -1024;
+SELECT @@global.bulk_insert_buffer_size;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.bulk_insert_buffer_size = test;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.bulk_insert_buffer_size = ON;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.bulk_insert_buffer_size = 429496.10;
+
+--disable_warnings
+SET @@session.bulk_insert_buffer_size = 42949672950;
+--enable_warnings
+--replace_result 4294967295 max_bulk_insert_buffer_size 42949672950 max_bulk_insert_buffer_size
+SELECT @@session.bulk_insert_buffer_size;
+SET @@session.bulk_insert_buffer_size = -2;
+SELECT @@session.bulk_insert_buffer_size;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.bulk_insert_buffer_size = test;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.bulk_insert_buffer_size = 429496.10;
+
+
+--echo '#------------------FN_DYNVARS_007_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+SELECT @@global.bulk_insert_buffer_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='bulk_insert_buffer_size';
+
+--echo '#------------------FN_DYNVARS_007_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.bulk_insert_buffer_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='bulk_insert_buffer_size';
+
+
+--echo '#------------------FN_DYNVARS_007_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.bulk_insert_buffer_size = TRUE;
+SELECT @@global.bulk_insert_buffer_size;
+SET @@global.bulk_insert_buffer_size = FALSE;
+SELECT @@global.bulk_insert_buffer_size;
+
+SET @@session.bulk_insert_buffer_size = TRUE;
+SELECT @@session.bulk_insert_buffer_size;
+SET @@session.bulk_insert_buffer_size = FALSE;
+SELECT @@session.bulk_insert_buffer_size;
+
+
+--echo '#---------------------FN_DYNVARS_007_09----------------------#'
+##############################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points #
+# to same session variable #
+##############################################################################
+
+SET @@bulk_insert_buffer_size = 100;
+SELECT @@bulk_insert_buffer_size = @@local.bulk_insert_buffer_size;
+SELECT @@local.bulk_insert_buffer_size = @@session.bulk_insert_buffer_size;
+
+
+--echo '#---------------------FN_DYNVARS_007_10----------------------#'
+###############################################################################
+# Check if bulk_insert_buffer_size can be accessed with and without @@ sign #
+###############################################################################
+
+SET bulk_insert_buffer_size = 1;
+SELECT @@bulk_insert_buffer_size;
+--Error ER_UNKNOWN_TABLE
+SELECT local.bulk_insert_buffer_size;
+--Error ER_UNKNOWN_TABLE
+SELECT session.bulk_insert_buffer_size;
+--Error ER_BAD_FIELD_ERROR
+SELECT bulk_insert_buffer_size = @@session.bulk_insert_buffer_size;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.bulk_insert_buffer_size = @start_global_value;
+SELECT @@global.bulk_insert_buffer_size;
+SET @@session.bulk_insert_buffer_size = @start_session_value;
+SELECT @@session.bulk_insert_buffer_size;
+
+
+####################################################
+# END OF bulk_insert_buffer_size TESTS #
+####################################################
diff --git a/mysql-test/suite/sys_vars/t/character_set_client_basic.test b/mysql-test/suite/sys_vars/t/character_set_client_basic.test
new file mode 100644
index 00000000..44c0d240
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/character_set_client_basic.test
@@ -0,0 +1,370 @@
+############## mysql-test\t\character_set_client_basic.test ###################
+# #
+# Variable Name: character_set_client #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: string #
+# Default Value: utf8 (session), latin1 (global) #
+# Range: NA #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable character_set_client #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+--source include/have_big5.inc
+--source include/have_ujis.inc
+--source include/have_sjis.inc
+--source include/have_utf8.inc
+--source include/have_ucs2.inc
+--source include/have_utf8mb4.inc
+--source include/have_utf16.inc
+--source include/have_utf32.inc
+--source include/default_charset.inc
+--source include/load_sysvars.inc
+
+###################################################
+## START OF character_set_client TESTS ##
+###################################################
+
+#############################################################
+# Save initial value #
+#############################################################
+SET @global_start_value = @@global.character_set_client;
+SET @@global.character_set_client=@@character_set_client;
+# Save initial session value
+SET @session_start_value = @@character_set_client;
+SELECT @session_start_value;
+# now save using local access
+SET @session_start_value = @@local.character_set_client;
+SELECT @session_start_value;
+# save using default access (session)
+SET @session_start_value = @@session.character_set_client;
+SELECT @session_start_value;
+
+--echo '#--------------------FN_DYNVARS_010_01------------------#'
+###############################################################################
+# Test Variable access and assignment with and withoud @@ #
+###############################################################################
+# select without @@
+--error ER_BAD_FIELD_ERROR
+SELECT character_set_client;
+# assign value without @@
+SET character_set_client=utf8;
+SELECT @@session.character_set_client;
+# assign global variable without @@
+# using another syntax for accessing session variable
+SET session character_set_client=utf8;
+# accessing variable with scope the wrong way
+--Error ER_BAD_FIELD_ERROR
+SELECT session character_set_client;
+# using another syntax for accessing dynamic variable
+SET global character_set_client=utf8;
+--Error ER_BAD_FIELD_ERROR
+SELECT global character_set_client;
+
+--echo '#--------------------FN_DYNVARS_010_02-------------------------#'
+###############################################################################
+# Check the DEFAULT value of character_set_client for session and global #
+###############################################################################
+SET @@character_set_client = latin5;
+SET @@character_set_client = DEFAULT;
+SELECT @@character_set_client = @@global.character_set_client;
+
+SET @@global.character_set_client = latin5;
+SET @@global.character_set_client = DEFAULT;
+SELECT @@global.character_set_client= @global_start_value;
+
+--echo '#--------------------FN_DYNVARS_010_03-------------------------#'
+###############################################################################
+# see if setting global value changes session value and vice versa #
+###############################################################################
+SET @@session.character_set_client = utf8;
+SELECT @@session.character_set_client;
+SET @@global.character_set_client = latin2;
+SELECT @@global.character_set_client;
+SELECT @@session.character_set_client AS res_is_utf8;
+
+SET @@session.character_set_client = latin5;
+SELECT @@session.character_set_client;
+SELECT @@global.character_set_client AS res_is_latin2;
+# composite check
+SELECT @@global.character_set_client=@@session.character_set_client
+AS res_is_false;
+
+--echo '#--------------------FN_DYNVARS_010_04-------------------------#'
+##############################################################################
+# Check if accessing variable with and without session point to session #
+# variable #
+##############################################################################
+SELECT @@character_set_client = @@session.character_set_client AS res;
+SELECT @@character_set_client = @@local.character_set_client AS res;
+
+--echo '#--------------------FN_DYNVARS_010_05-------------------------#'
+###########################################################################
+# Check if combining character set works #
+###########################################################################
+--Error ER_BAD_FIELD_ERROR
+SET @@character_set_client = utf8 + latin2;
+
+--echo '#--------------------FN_DYNVARS_010_06-------------------------#'
+##############################################################################
+# Change the value of character_set_client to a valid value for session #
+##############################################################################
+SET @@character_set_client = big5;
+SELECT @@character_set_client;
+SET @@character_set_client = dec8;
+SELECT @@character_set_client;
+SET @@character_set_client = cp850;
+SELECT @@character_set_client;
+SET @@character_set_client = hp8;
+SELECT @@character_set_client;
+SET @@character_set_client = koi8r;
+SELECT @@character_set_client;
+SET @@character_set_client = latin1;
+SELECT @@character_set_client;
+SET @@character_set_client = latin2;
+SELECT @@character_set_client;
+SET @@character_set_client = swe7;
+SELECT @@character_set_client;
+SET @@character_set_client = ascii;
+SELECT @@character_set_client;
+SET @@character_set_client = ujis;
+SELECT @@character_set_client;
+SET @@character_set_client = sjis;
+SELECT @@character_set_client;
+SET @@character_set_client = hebrew;
+SELECT @@character_set_client;
+SET @@character_set_client = tis620;
+SELECT @@character_set_client;
+SET @@character_set_client = euckr;
+SELECT @@character_set_client;
+SET @@character_set_client = koi8u;
+SELECT @@character_set_client;
+SET @@character_set_client = gb2312;
+SELECT @@character_set_client;
+SET @@character_set_client = greek;
+SELECT @@character_set_client;
+SET @@character_set_client = cp1250;
+SELECT @@character_set_client;
+SET @@character_set_client = gbk;
+SELECT @@character_set_client;
+SET @@character_set_client = latin5;
+SELECT @@character_set_client;
+SET @@character_set_client = armscii8;
+SELECT @@character_set_client;
+SET @@character_set_client = utf8;
+SELECT @@character_set_client;
+SET @@character_set_client = utf8mb4;
+SELECT @@character_set_client;
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@character_set_client = ucs2;
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@character_set_client = utf16;
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@character_set_client = utf32;
+
+SET @@character_set_client = cp866;
+SELECT @@character_set_client;
+SET @@character_set_client = keybcs2;
+SELECT @@character_set_client;
+SET @@character_set_client = macce;
+SELECT @@character_set_client;
+SET @@character_set_client = macroman;
+SELECT @@character_set_client;
+SET @@character_set_client = cp852;
+SELECT @@character_set_client;
+SET @@character_set_client = latin7;
+SELECT @@character_set_client;
+SET @@character_set_client = cp1251;
+SELECT @@character_set_client;
+SET @@character_set_client = cp1256;
+SELECT @@character_set_client;
+SET @@character_set_client = cp1257;
+SELECT @@character_set_client;
+SET @@character_set_client = binary;
+SELECT @@character_set_client;
+SET @@character_set_client = geostd8;
+SELECT @@character_set_client;
+SET @@character_set_client = cp932;
+SELECT @@character_set_client;
+SET @@character_set_client = eucjpms;
+SELECT @@character_set_client;
+
+--echo '#--------------------FN_DYNVARS_010_07-------------------------#'
+###############################################################################
+# Change the value of character_set_client to a valid value for global #
+###############################################################################
+
+let charset_variable = @@global.character_set_client;
+
+--source suite/sys_vars/inc/charset_basic.inc
+
+--echo '#--------------------FN_DYNVARS_010_08-------------------------#'
+################################################################################
+# Change the value of character_set_client to a valid value with uppercase,#
+# lowercase and mixedcase #
+################################################################################
+SET @@character_set_client = UTF8;
+SELECT @@character_set_client;
+SET @@character_set_client = utf8;
+SELECT @@character_set_client;
+SET @@global.character_set_client = uTf8;
+SELECT @@global.character_set_client;
+
+--echo '#--------------------FN_DYNVARS_010_09-------------------------#'
+##############################################################
+# Check if 1,2,3, ... values can be used on variable #
+##############################################################
+SET @@character_set_client = 1;
+SELECT @@character_set_client;
+
+--echo # latin2_czech_cs is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_client = 2;
+
+SET @@character_set_client = 3;
+SELECT @@character_set_client;
+SET @@character_set_client = 36;
+SELECT @@character_set_client;
+
+--echo # cp1250_polish_ci is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_client = 99;
+
+--echo # Collation ID 100 does not exist
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_client = 100;
+
+SET @@global.character_set_client = 1;
+SELECT @@global.character_set_client;
+
+--echo # latin2_czech_cs is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_client = 2;
+
+SET @@global.character_set_client = 3;
+SELECT @@global.character_set_client;
+SET @@global.character_set_client = 36;
+SELECT @@global.character_set_client;
+
+--echo # cp1250_polish_ci is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_client = 99;
+
+--echo # Collation ID 100 does not exist
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_client = 100;
+
+SET @total_charset = (SELECT count(*) FROM INFORMATION_SCHEMA.CHARACTER_SETS);
+SELECT @total_charset;
+
+--echo '#--------------------FN_DYNVARS_010_10-------------------------#'
+###############################################################################
+# Change the value of character_set_client to an invalid value for session #
+###############################################################################
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_client = abc;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_client = 1utf8;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_client = 0;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@character_set_client = 1.1;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_client = -1;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_client = '';
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_client = 'utf';
+SET @@character_set_client = true;
+SELECT @@character_set_client AS res_with_true;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_client = ON;
+
+--echo '#--------------------FN_DYNVARS_010_11-------------------------#'
+###############################################################################
+# Change the value of character_set_client to an invalid value for global #
+###############################################################################
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_client = abc;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_client = 1utf8;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_client = 0;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.character_set_client = 1.1;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_client = -1;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_client = '';
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_client = 'utf';
+
+SET @@global.character_set_client = true;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_client = ON;
+
+--echo '#--------------------FN_DYNVARS_010_12-------------------------#'
+##########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+##########################################################################
+SELECT @@global.character_set_client =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='character_set_client') AS res;
+SET @@global.character_set_client = 1;
+SELECT @@global.character_set_client;
+SELECT @@global.character_set_client =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='character_set_client') AS res;
+
+--echo '#--------------------FN_DYNVARS_010_13-------------------------#'
+###############################################################################
+# Check if the value in SESSION Table matches value in variable #
+###############################################################################
+SELECT @@character_set_client =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+ WHERE VARIABLE_NAME='character_set_client') AS res;
+SELECT @@local.character_set_client =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+ WHERE VARIABLE_NAME='character_set_client') AS res;
+SELECT @@session.character_set_client =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+ WHERE VARIABLE_NAME='character_set_client') AS res;
+
+--echo #
+--echo # MDEV-28769 Assertion `(m_ci->state & 32) || m_with_collate' failed in Lex_exact_charset_opt_extended_collate::Lex_exact_charset_opt_extended_collate on SET NAMES
+--echo #
+
+--error ER_UNKNOWN_CHARACTER_SET
+SET GLOBAL character_set_client=2;
+
+--echo #
+--echo # MDEV-31018 Replica of 10.3, 10.4, <10.5.19 and <10.6.12 to 10.11 will not work when using non-default charset
+--echo #
+
+SET @@pseudo_slave_mode=1;
+SET character_set_client=2/*latin2_czech_cs*/;
+SHOW VARIABLES LIKE 'character_set_client';
+SET @@pseudo_slave_mode=0;
+
+####################################
+# Restore initial value #
+####################################
+SET @@global.character_set_client = @global_start_value;
+SET @@session.character_set_client = @session_start_value;
+
+#############################################################
+# END OF character_set_client TESTS #
+#############################################################
diff --git a/mysql-test/suite/sys_vars/t/character_set_client_func.test b/mysql-test/suite/sys_vars/t/character_set_client_func.test
new file mode 100644
index 00000000..1c2b589e
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/character_set_client_func.test
@@ -0,0 +1,79 @@
+############## mysql-test\t\character_set_client_func.test ###################
+# #
+# Variable Name: character_set_client #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: string #
+# Default Value: utf8 (session), latin1 (global) #
+# Range: NA #
+# #
+# #
+# Creation Date: 2008-03-08 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable character_set_client #
+# that checks the behavior of this variable #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--echo '#--------------------FN_DYNVARS_010_01-------------------------#'
+######################################################################
+# Check if setting character_set_client is changed in new connection #
+######################################################################
+
+# save
+SET @global_character_set_client = @@global.character_set_client;
+SET @session_character_set_client = @@session.character_set_client;
+
+
+SET @@global.character_set_client = utf8;
+connect (con1,localhost,root,,,,);
+connection con1;
+SELECT @@global.character_set_client;
+SELECT @@session.character_set_client;
+disconnect con1;
+
+--echo '#--------------------FN_DYNVARS_010_02-------------------------#'
+#############################################################
+# Begin the functionality Testing of character_set_client #
+#############################################################
+
+connection default;
+
+SHOW VARIABLES like 'character_set_client';
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1(a CHAR(3) character set utf8);
+
+#==============================================================================
+--echo '---verifying character_set_client with a utf8 character----'
+#==============================================================================
+--echo 'For latin1 characterset';
+SET @@session.character_set_client = latin1;
+INSERT INTO t1 values('è');
+SELECT hex(a),CHAR_LENGTH(a) FROM t1;
+DELETE FROM t1;
+
+--echo 'For utf8 characterset';
+SET @@session.character_set_client = utf8;
+INSERT INTO t1 values('è');
+SELECT hex(a),CHAR_LENGTH(a) FROM t1;
+DELETE FROM t1;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+# restore
+SET @@global.character_set_client = @global_character_set_client;
+SET @@session.character_set_client = @session_character_set_client;
+
+############################################################
+# End of functionality Testing for character_set_client #
+############################################################
diff --git a/mysql-test/suite/sys_vars/t/character_set_connection_basic.test b/mysql-test/suite/sys_vars/t/character_set_connection_basic.test
new file mode 100644
index 00000000..46bdfcb5
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/character_set_connection_basic.test
@@ -0,0 +1,299 @@
+############## mysql-test\t\character_set_connection_basic.test ###############
+# #
+# Variable Name: character_set_connection #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: string #
+# Default Value: utf8 (session), latin1 (global) #
+# Range: NA #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable character_set_connection #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+--source include/have_big5.inc
+--source include/have_ujis.inc
+--source include/have_sjis.inc
+--source include/have_utf8.inc
+--source include/have_ucs2.inc
+--source include/have_utf8mb4.inc
+--source include/have_utf16.inc
+--source include/have_utf32.inc
+--source include/default_charset.inc
+--source include/load_sysvars.inc
+###################################################
+## START OF character_set_connection TESTS ##
+###################################################
+
+#############################################################
+# Save initial value #
+#############################################################
+SET @global_start_value = @@global.character_set_connection;
+SET @save_character_set_client=@@global.character_set_client;
+SET @@global.character_set_client=@@character_set_client;
+# Save initial session value
+SET @session_start_value = @@character_set_connection;
+SELECT @session_start_value;
+# now save using local access
+SET @session_start_value = @@local.character_set_connection;
+SELECT @session_start_value;
+# save using default access (session)
+SET @session_start_value = @@session.character_set_connection;
+SELECT @session_start_value;
+
+--echo '#--------------------FN_DYNVARS_011_01------------------#'
+###############################################################################
+# Test Variable access and assignment with and withoud @@ #
+###############################################################################
+# select without @@
+--error ER_BAD_FIELD_ERROR
+SELECT character_set_connection;
+# assign value without @@
+SET character_set_connection=utf8;
+SELECT @@session.character_set_connection;
+# assign global variable without @@
+# using another syntax for accessing session variable
+SET session character_set_connection=utf8;
+# accessing variable with scope the wrong way
+--Error ER_BAD_FIELD_ERROR
+SELECT session character_set_connection;
+# using another syntax for accessing dynamic variable
+SET global character_set_connection=utf8;
+--Error ER_BAD_FIELD_ERROR
+SELECT global character_set_connection;
+
+--echo '#--------------------FN_DYNVARS_011_02-------------------------#'
+###############################################################################
+# Check the DEFAULT value of character_set_connection for session and global #
+###############################################################################
+SET @@character_set_connection = latin5;
+SET @@character_set_connection = DEFAULT;
+SELECT @@character_set_connection = @@global.character_set_connection;
+
+SET @@global.character_set_connection = latin5;
+SET @@global.character_set_connection = DEFAULT;
+SELECT @@global.character_set_connection = @global_start_value;
+
+--echo '#--------------------FN_DYNVARS_011_03-------------------------#'
+###############################################################################
+# see if setting global value changes session value and vice versa #
+###############################################################################
+SET @@session.character_set_connection = utf8;
+SELECT @@session.character_set_connection;
+SET @@global.character_set_connection = latin2;
+SELECT @@global.character_set_connection;
+SELECT @@session.character_set_connection AS res_is_utf8;
+
+SET @@session.character_set_connection = latin5;
+SELECT @@session.character_set_connection;
+SELECT @@global.character_set_connection AS res_is_latin2;
+# composite check
+SELECT @@global.character_set_connection=@@session.character_set_connection
+AS res_is_false;
+
+--echo '#--------------------FN_DYNVARS_011_04-------------------------#'
+#############################################################################
+# Check if accessing variable with and without session point to #
+# session variable #
+#############################################################################
+SELECT @@character_set_connection = @@session.character_set_connection AS res;
+SELECT @@character_set_connection = @@local.character_set_connection AS res;
+
+--echo '#--------------------FN_DYNVARS_011_05-------------------------#'
+###########################################################################
+# Check if combining character set works #
+###########################################################################
+--Error ER_BAD_FIELD_ERROR
+SET @@character_set_connection = utf8 + latin2;
+
+--echo '#--------------------FN_DYNVARS_011_06-------------------------#'
+##############################################################################
+# Change the value of character_set_connection to a valid value #
+# for session #
+##############################################################################
+
+let charset_variable = @@session.character_set_connection;
+--source suite/sys_vars/inc/charset_basic.inc
+
+
+--echo '#--------------------FN_DYNVARS_011_07-------------------------#'
+##############################################################################
+# Change the value of character_set_connection to a valid value for global #
+##############################################################################
+
+let charset_variable = @@global.character_set_connection;
+--source suite/sys_vars/inc/charset_basic.inc
+
+
+--echo '#--------------------FN_DYNVARS_011_08-------------------------#'
+##############################################################################
+# Change the value of character_set_connection to a valid value with #
+# uppercase,lowercase and mixedcase #
+##############################################################################
+SET @@character_set_connection = UTF8;
+SELECT @@character_set_connection;
+SET @@character_set_connection = utf8;
+SELECT @@character_set_connection;
+
+SET @@global.character_set_connection = uTf8;
+SELECT @@global.character_set_connection;
+
+--echo '#--------------------FN_DYNVARS_011_09-------------------------#'
+##############################################################
+# Check if 1,2,3, ... values can be used on variable #
+##############################################################
+SET @@character_set_connection = 1;
+SELECT @@character_set_connection;
+
+--echo # latin2_czech_cs is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_connection = 2;
+
+SET @@character_set_connection = 3;
+SELECT @@character_set_connection;
+SET @@character_set_connection = 36;
+SELECT @@character_set_connection;
+
+--echo # cp1250_polish_ci is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_connection = 99;
+
+--echo # Collation ID 100 does not exist
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_connection = 100;
+
+
+SET @@global.character_set_connection = 1;
+SELECT @@global.character_set_connection;
+
+--echo # latin2_czech_cs is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_connection = 2;
+
+SET @@global.character_set_connection = 3;
+SELECT @@global.character_set_connection;
+SET @@global.character_set_connection = 36;
+SELECT @@global.character_set_connection;
+
+--echo # cp1250_polish_ci is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_connection = 99;
+
+--echo # Collation ID 100 does not exist
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_connection = 100;
+
+SET @total_charset = (SELECT count(*) FROM INFORMATION_SCHEMA.CHARACTER_SETS);
+SELECT @total_charset;
+
+--echo '#--------------------FN_DYNVARS_011_10-------------------------#'
+################################################################################
+# Change the value of character_set_connection to an invalid value for session #
+################################################################################
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_connection = abc;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_connection = 1utf8;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_connection = 0;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@character_set_connection = 1.1;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_connection = -1;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_connection = 'utf8 ';
+SET @@character_set_connection=cp1250;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_connection = 'lätin2';
+SET @@character_set_connection=cp866;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_connection = 'lätin2';
+SET @@character_set_connection = true;
+SELECT @@character_set_connection AS res_with_true;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_connection = ON;
+
+--echo '#--------------------FN_DYNVARS_011_11-------------------------#'
+###############################################################################
+# Change the value of character_set_connection to an invalid value for global #
+###############################################################################
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_connection = abc;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_connection = 1utf8;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_connection = 0;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.character_set_connection = 1.1;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_connection = -1;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_connection = '';
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_connection = 'utf';
+
+SET @@global.character_set_connection = true;
+
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_connection = ON;
+
+--echo '#--------------------FN_DYNVARS_011_12-------------------------#'
+##########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+##########################################################################
+SELECT @@global.character_set_connection =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='character_set_connection') AS res;
+SET @@global.character_set_connection = 1;
+SELECT @@global.character_set_connection;
+SELECT @@global.character_set_connection =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='character_set_connection') AS res;
+
+--echo '#--------------------FN_DYNVARS_011_13-------------------------#'
+############################################################################
+# Check if the value in SESSION Table matches value in variable #
+############################################################################
+SELECT @@character_set_connection =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+ WHERE VARIABLE_NAME='character_set_connection') AS res;
+SELECT @@local.character_set_connection =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+ WHERE VARIABLE_NAME='character_set_connection') AS res;
+SELECT @@session.character_set_connection =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+ WHERE VARIABLE_NAME='character_set_connection') AS res;
+
+--echo #
+--echo # MDEV-31018 Replica of 10.3, 10.4, <10.5.19 and <10.6.12 to 10.11 will not work when using non-default charset
+--echo #
+
+--error ER_UNKNOWN_CHARACTER_SET
+SET character_set_connection=2/*latin2_czech_cs*/;
+SET @@pseudo_slave_mode=1;
+SET character_set_connection=2/*latin2_czech_cs*/;
+SHOW VARIABLES LIKE 'character_set_connection';
+SHOW VARIABLES LIKE 'collation_connection';
+SET @@pseudo_slave_mode=0;
+
+
+####################################
+# Restore initial value #
+####################################
+SET @@global.character_set_connection = @global_start_value;
+SET @@global.character_set_client = @save_character_set_client;
+
+#############################################################
+# END OF character_set_connection TESTS #
+#############################################################
diff --git a/mysql-test/suite/sys_vars/t/character_set_connection_func.test b/mysql-test/suite/sys_vars/t/character_set_connection_func.test
new file mode 100644
index 00000000..73709915
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/character_set_connection_func.test
@@ -0,0 +1,101 @@
+############## mysql-test\t\character_set_connection_func.test ###############
+# #
+# Variable Name: character_set_connection #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: string #
+# Default Value: utf8 (session), latin1 (global) #
+# Range: NA #
+# #
+# #
+# Creation Date: 2008-03-08 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable character_set_connection #
+# that checks the behavior of this variable #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# #
+###############################################################################
+
+--echo '#--------------------FN_DYNVARS_011_01-------------------------#'
+##########################################################################
+# Check if setting character_set_connection is changed in new connection #
+##########################################################################
+
+#save
+SET @global_character_set_connection = @@global.character_set_connection;
+SET @session_character_set_connection = @@session.character_set_connection;
+SET @session_character_set_client = @@session.character_set_client;
+SET @session_character_set_results = @@session.character_set_results;
+
+
+SET @@global.character_set_connection = utf8;
+connect (con1,localhost,root,,,,);
+connection con1;
+SELECT @@global.character_set_connection;
+SELECT @@session.character_set_connection;
+disconnect con1;
+
+--echo '#--------------------FN_DYNVARS_011_02-------------------------#'
+###############################################################
+# Begin the functionality Testing of character_set_connection #
+###############################################################
+
+connection default;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+CREATE TABLE t1(b CHAR(40) CHARACTER SET utf8);
+#==============================================================================
+--echo '--verify that character_set_connection converts character_set_client--'
+#==============================================================================
+
+SET @@session.character_set_client = utf8;
+SET @@session.character_set_results = utf8;
+
+SET @@session.character_set_connection = latin1;
+SELECT 'ÐЂЃЄ' AS utf_text;
+
+SET @@session.character_set_connection = utf8;
+SELECT 'ÐЂЃЄ' AS utf_text;
+#==============================================================================
+--echo '---now inserting utf8 string with different character_set_connection--'
+#==============================================================================
+SET @@session.character_set_connection = ascii;
+INSERT INTO t1 VALUES('ÐЂЃЄ');
+SELECT * FROM t1;
+TRUNCATE TABLE t1;
+
+#==============================================================================
+--echo '--now client & results charset in latin1 & connection charset in ascii-'
+#==============================================================================
+SET @@session.character_set_connection = ascii;
+SET @@session.character_set_client = latin1;
+SET @@session.character_set_results = latin1;
+INSERT INTO t1 VALUES('ÐЂЃЄ');
+SELECT * FROM t1;
+TRUNCATE TABLE t1;
+
+#==============================================================================
+# set names should set character sets [client,connection,results]
+#==============================================================================
+SET NAMES utf8;
+INSERT INTO t1 VALUES('ÐЂЃЄ');
+SELECT * FROM t1;
+TRUNCATE TABLE t1;
+
+
+# Cleanup
+SET @@global.character_set_connection = @global_character_set_connection;
+SET @@session.character_set_connection = @session_character_set_connection;
+SET @@session.character_set_client = @session_character_set_client;
+SET @@session.character_set_results = @session_character_set_results;
+
+DROP TABLE t1;
+
+#############################################################
+# End of functionality Testing for character_set_connection #
+#############################################################
diff --git a/mysql-test/suite/sys_vars/t/character_set_database_basic.test b/mysql-test/suite/sys_vars/t/character_set_database_basic.test
new file mode 100644
index 00000000..95ffa839
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/character_set_database_basic.test
@@ -0,0 +1,283 @@
+############## mysql-test\t\character_set_database_basic.test #################
+# #
+# Variable Name: character_set_database #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: string #
+# Default Value: latin1 (session), latin1 (global) #
+# Range: NA #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable character_set_database #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+--source include/have_big5.inc
+--source include/have_ujis.inc
+--source include/have_sjis.inc
+--source include/have_utf8.inc
+--source include/have_ucs2.inc
+--source include/have_utf8mb4.inc
+--source include/have_utf16.inc
+--source include/have_utf32.inc
+--source include/default_charset.inc
+--source include/load_sysvars.inc
+###################################################
+## START OF character_set_database TESTS ##
+###################################################
+
+#############################################################
+# Save initial value #
+#############################################################
+SET @global_start_value = @@global.character_set_database;
+SET @@global.character_set_database=@@character_set_client;
+SELECT @@global.character_set_database;
+# Save initial session value
+SET @session_start_value = @@character_set_database;
+SELECT @session_start_value;
+# now save using local access
+SET @session_start_value = @@local.character_set_database;
+SELECT @session_start_value;
+# save using default access (session)
+SET @session_start_value = @@session.character_set_database;
+SELECT @session_start_value;
+
+--echo '#--------------------FN_DYNVARS_012_01------------------#'
+##############################################################################
+# Test Variable access and assignment with and withoud @@ #
+##############################################################################
+# select without @@
+--error ER_BAD_FIELD_ERROR
+SELECT character_set_database;
+# assign value without @@
+SET character_set_database=utf8;
+SELECT @@session.character_set_database;
+# assign global variable without @@
+# using another syntax for accessing session variable
+SET session character_set_database=utf8;
+# accessing variable with scope the wrong way
+--Error ER_BAD_FIELD_ERROR
+SELECT session character_set_database;
+# using another syntax for accessing dynamic variable
+SET global character_set_database=utf8;
+--Error ER_BAD_FIELD_ERROR
+SELECT global character_set_database;
+
+--echo '#--------------------FN_DYNVARS_012_02-------------------------#'
+###############################################################################
+# Check the DEFAULT value of character_set_database for session and global #
+###############################################################################
+SET @@character_set_database = latin5;
+SET @@character_set_database = DEFAULT;
+SELECT @@character_set_database AS DEFAULT_VALUE;
+
+SET @@global.character_set_database = latin5;
+SET @@global.character_set_database = DEFAULT;
+SELECT @@global.character_set_database;
+
+--echo '#--------------------FN_DYNVARS_012_03-------------------------#'
+##############################################################################
+# see if setting global value changes session value and vice versa #
+##############################################################################
+SET @@session.character_set_database = utf8;
+SELECT @@session.character_set_database;
+SET @@global.character_set_database = latin2;
+SELECT @@global.character_set_database;
+SELECT @@session.character_set_database AS res_is_utf8;
+
+SET @@session.character_set_database = latin5;
+SELECT @@session.character_set_database;
+SELECT @@global.character_set_database AS res_is_latin2;
+# composite check
+SELECT @@global.character_set_database=@@session.character_set_database
+AS res_is_false;
+
+--echo '#--------------------FN_DYNVARS_012_04-------------------------#'
+##############################################################################
+# Check if accessing variable with and without session point to session #
+# variable #
+##############################################################################
+SELECT @@character_set_database = @@session.character_set_database AS res;
+SELECT @@character_set_database = @@local.character_set_database AS res;
+
+--echo '#--------------------FN_DYNVARS_012_05-------------------------#'
+###########################################################################
+# Check if combining character set works #
+###########################################################################
+--Error ER_BAD_FIELD_ERROR
+SET @@character_set_database = utf8 + latin2;
+
+--echo '#--------------------FN_DYNVARS_012_06-------------------------#'
+#############################################################################
+# Change the value of character_set_database to a valid value for session #
+#############################################################################
+
+let charset_variable = @@session.character_set_database;
+--source suite/sys_vars/inc/charset_basic.inc
+
+
+--echo '#--------------------FN_DYNVARS_012_07-------------------------#'
+##############################################################################
+# Change the value of character_set_database to a valid value for global #
+##############################################################################
+
+let charset_variable = @@global.character_set_database;
+--source suite/sys_vars/inc/charset_basic.inc
+
+
+--echo '#--------------------FN_DYNVARS_012_08-------------------------#'
+##############################################################################
+# Change the value of character_set_database to a valid value with uppercase,#
+# lowercase and mixedcase #
+##############################################################################
+SET @@character_set_database = UTF8;
+SELECT @@character_set_database;
+SET @@character_set_database = utf8;
+SELECT @@character_set_database;
+
+SET @@global.character_set_database = uTf8;
+SELECT @@global.character_set_database;
+
+--echo '#--------------------FN_DYNVARS_012_09-------------------------#'
+##############################################################
+# Check if 1,2,3, ... values can be used on variable #
+##############################################################
+SET @@character_set_database = 1;
+SELECT @@character_set_database;
+
+--echo # latin2_czech_cs is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_database = 2;
+
+SET @@character_set_database = 3;
+SELECT @@character_set_database;
+SET @@character_set_database = 36;
+SELECT @@character_set_database;
+
+--echo # cp1250_polish_ci is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_database = 99;
+
+--echo # Collation ID 100 does not exist
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_database = 100;
+
+
+SET @@global.character_set_database = 1;
+SELECT @@global.character_set_database;
+
+--echo # latin2_czech_cs is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_database = 2;
+
+SET @@global.character_set_database = 3;
+SELECT @@global.character_set_database;
+SET @@global.character_set_database = 36;
+SELECT @@global.character_set_database;
+
+--echo # cp1250_polish_ci is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_database = 99;
+
+--echo # Collation ID 100 does not exist
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_database = 100;
+
+
+SET @total_charset = (SELECT count(*) FROM INFORMATION_SCHEMA.CHARACTER_SETS);
+SELECT @total_charset;
+
+--echo '#--------------------FN_DYNVARS_012_10-------------------------#'
+##############################################################################
+# Change the value of character_set_database to an invalid value for session #
+##############################################################################
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_database = "grek";
+--Error ER_PARSE_ERROR
+SET @@character_set_database = utf 8;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_database = 0;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@character_set_database = 1.1;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_database = -1;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_database = '';
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_database = 'latin 2';
+SET @@character_set_database = true;
+SELECT @@character_set_database AS res_with_true;
+
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_database = ON;
+
+--echo '#--------------------FN_DYNVARS_012_11-------------------------#'
+###############################################################################
+# Change the value of character_set_database to an invalid value for global #
+###############################################################################
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_database = abc;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_database = 1utf8;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_database = 0;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.character_set_database = 1.1;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_database = -1;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_database = '';
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_database = 'utf';
+
+SET @@global.character_set_database = true;
+
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_database = ON;
+
+--echo '#--------------------FN_DYNVARS_012_12-------------------------#'
+############################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+############################################################################
+SELECT @@global.character_set_database =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='character_set_database') AS res;
+SET @@global.character_set_database = 1;
+SELECT @@global.character_set_database;
+SELECT @@global.character_set_database =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='character_set_database') AS res;
+
+--echo '#--------------------FN_DYNVARS_012_13-------------------------#'
+##############################################################################
+# Check if the value in SESSION Table matches value in variable #
+##############################################################################
+SELECT @@character_set_database =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+ WHERE VARIABLE_NAME='character_set_database') AS res;
+SELECT @@local.character_set_database =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+ WHERE VARIABLE_NAME='character_set_database') AS res;
+SELECT @@session.character_set_database =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+ WHERE VARIABLE_NAME='character_set_database') AS res;
+
+####################################
+# Restore initial value #
+####################################
+SET @@global.character_set_database = @global_start_value;
+SET @@session.character_set_database = @session_start_value;
+
+#############################################################
+# END OF character_set_database TESTS #
+#############################################################
diff --git a/mysql-test/suite/sys_vars/t/character_set_database_func.test b/mysql-test/suite/sys_vars/t/character_set_database_func.test
new file mode 100644
index 00000000..d5956ba0
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/character_set_database_func.test
@@ -0,0 +1,127 @@
+############## mysql-test\t\character_set_database_func.test #################
+# #
+# Variable Name: character_set_database #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: string #
+# Default Value: latin1 (session), latin1 (global) #
+# Range: NA #
+# #
+# #
+# Creation Date: 2008-03-08 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable character_set_database #
+# that checks the behavior of this variable #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_utf8.inc
+
+--echo '#--------------------FN_DYNVARS_008_01-------------------------#'
+########################################################################
+# Check if setting character_set_database is changed in new connection #
+########################################################################
+#save
+SET @global_character_set_database = @@global.character_set_database;
+SET @session_character_set_database = @@session.character_set_database;
+SET @session_character_set_server = @@session.character_set_server;
+SET @global_character_set_server = @@global.character_set_server;
+
+SET @@global.character_set_database = utf8;
+connect (con1,localhost,root,,,,);
+connection con1;
+SELECT @@global.character_set_database;
+SELECT @@session.character_set_database;
+disconnect con1;
+
+--echo '#--------------------FN_DYNVARS_008_02-------------------------#'
+#############################################################
+# Begin the functionality Testing of character_set_database #
+#############################################################
+
+connection default;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+#==============================================================================
+--echo '--check if setting session character_set_database effects new databases'
+#==============================================================================
+
+SET @@session.character_set_server = utf8;
+SELECT @@session.character_set_database;
+SET @@session.character_set_database = latin5;
+SELECT @@session.character_set_database;
+
+CREATE DATABASE db1;
+USE db1;
+SHOW CREATE DATABASE db1;
+CREATE TABLE t1(a INT, b VARCHAR(40));
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+DROP DATABASE db1;
+
+#==============================================================================
+--echo '--ascii character set specified--'
+#==============================================================================
+CREATE DATABASE db1 CHARACTER SET ascii;
+USE db1;
+SHOW CREATE DATABASE db1;
+CREATE TABLE t1(a INT, b VARCHAR(40));
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+DROP DATABASE db1;
+
+#==============================================================================
+--echo '------Check if load data uses character_set_database----------'
+#==============================================================================
+
+USE test;
+CREATE TABLE t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=MyISAM CHARACTER SET utf8;
+
+--echo 'Verify with latin';
+SET @@session.character_set_database = latin1;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/std_data/charset_utf8.txt' INTO TABLE t1;
+SELECT count(*) FROM t1 WHERE CHAR_LENGTH(a)>1;
+TRUNCATE TABLE t1;
+
+--echo 'Verify with utf8';
+SET @@session.character_set_database = utf8;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/std_data/charset_utf8.txt' INTO TABLE t1;
+SELECT count(*) FROM t1 WHERE CHAR_LENGTH(a)>1;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+
+#==============================================================================
+SET GLOBAL character_set_server=latin5;
+
+connect (con2, localhost, root,,);
+connection con2;
+
+CREATE DATABASE csdb CHARACTER SET = utf8;
+USE csdb;
+DROP DATABASE csdb;
+SELECT @@character_set_database;
+
+connection default;
+disconnect con2;
+
+
+#restore
+SET @@global.character_set_database = @global_character_set_database;
+SET @@session.character_set_database = @session_character_set_database;
+SET @@session.character_set_server = @session_character_set_server;
+SET @@global.character_set_server = @global_character_set_server;
+############################################################
+# End of functionality Testing for character_set_database #
+############################################################
diff --git a/mysql-test/suite/sys_vars/t/character_set_filesystem_basic.test b/mysql-test/suite/sys_vars/t/character_set_filesystem_basic.test
new file mode 100644
index 00000000..b3ebb383
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/character_set_filesystem_basic.test
@@ -0,0 +1,259 @@
+############## mysql-test\t\character_set_filesystem_basic.test ###############
+# #
+# Variable Name: character_set_filesystem #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: string #
+# Default Value: latin5 #
+# Range: #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable character_set_filesystem #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+--source include/have_big5.inc
+--source include/have_ujis.inc
+--source include/have_sjis.inc
+--source include/have_utf8.inc
+--source include/have_ucs2.inc
+--source include/have_utf8mb4.inc
+--source include/have_utf16.inc
+--source include/have_utf32.inc
+
+--source include/load_sysvars.inc
+
+###################################################
+## START OF character_set_filesystem TESTS ##
+###################################################
+
+#############################################################
+# Save initial value #
+#############################################################
+SET @global_start_value = @@global.character_set_filesystem;
+SELECT @global_start_value;
+# Save initial session value
+SET @session_start_value = @@character_set_filesystem;
+SELECT @session_start_value;
+# now save using local access
+SET @session_start_value = @@local.character_set_filesystem;
+SELECT @session_start_value;
+# save using default access (session)
+SET @session_start_value = @@session.character_set_filesystem;
+SELECT @session_start_value;
+
+--echo '#--------------------FN_DYNVARS_008_01------------------#'
+###############################################################################
+# Test Variable access and assignment with and without @@ #
+###############################################################################
+# select without @@
+--error ER_BAD_FIELD_ERROR
+SELECT character_set_filesystem;
+# assign value without @@
+SET character_set_filesystem=utf8;
+SELECT @@session.character_set_filesystem;
+# using another syntax for accessing session variable
+SET session character_set_filesystem=utf8;
+# accessing variable with scope the wrong way
+--Error ER_BAD_FIELD_ERROR
+SELECT session character_set_filesystem;
+# using another syntax for accessing dynamic variable
+SET global character_set_filesystem=utf8;
+--Error ER_BAD_FIELD_ERROR
+SELECT global character_set_filesystem;
+
+--echo '#--------------------FN_DYNVARS_008_02-------------------------#'
+###############################################################################
+# Check the DEFAULT value of character_set_filesystem for session and global #
+###############################################################################
+SET @@character_set_filesystem = latin5;
+SET @@character_set_filesystem = DEFAULT;
+SELECT @@character_set_filesystem AS DEFAULT_VALUE;
+
+SET @@global.character_set_filesystem = latin5;
+SET @@global.character_set_filesystem = DEFAULT;
+SELECT @@global.character_set_filesystem AS DEFAULT_VALUE;
+
+--echo '#--------------------FN_DYNVARS_008_03-------------------------#'
+############################################################################
+# see if setting global value changes session value and vice versa #
+############################################################################
+SET @@session.character_set_filesystem = utf8;
+SELECT @@session.character_set_filesystem;
+SET @@global.character_set_filesystem = latin2;
+SELECT @@global.character_set_filesystem;
+SELECT @@session.character_set_filesystem AS res_is_utf8;
+
+SET @@session.character_set_filesystem = latin5;
+SELECT @@session.character_set_filesystem;
+SELECT @@global.character_set_filesystem AS res_is_latin2;
+# composite check
+SELECT @@global.character_set_filesystem=
+ @@session.character_set_filesystem AS res_is_false;
+
+--echo '#--------------------FN_DYNVARS_008_04-------------------------#'
+################################################################################
+# Check if accessing variable with & without session point to session variable #
+################################################################################
+SELECT @@character_set_filesystem = @@session.character_set_filesystem AS res;
+SELECT @@character_set_filesystem = @@local.character_set_filesystem AS res;
+
+--echo '#--------------------FN_DYNVARS_008_05-------------------------#'
+###########################################################################
+# Check if combining character set works #
+###########################################################################
+--Error ER_BAD_FIELD_ERROR
+SET @@character_set_filesystem = utf8 + latin2;
+
+--echo '#--------------------FN_DYNVARS_008_06-------------------------#'
+###############################################################################
+# Change the value of character_set_filesystem to a valid value for session #
+###############################################################################
+
+let charset_variable = @@session.character_set_filesystem;
+--source suite/sys_vars/inc/charset_basic.inc
+
+
+--echo '#--------------------FN_DYNVARS_008_07-------------------------#'
+##############################################################################
+# Change the value of character_set_filesystem to a valid value for global #
+##############################################################################
+
+let charset_variable = @@global.character_set_filesystem;
+--source suite/sys_vars/inc/charset_basic.inc
+
+
+--echo '#--------------------FN_DYNVARS_008_08-------------------------#'
+#########################################################################
+# Change the value of character_set_filesystem to a valid value with #
+# uppercase,lowercase and mixedcase #
+#########################################################################
+SET @@character_set_filesystem = UTF8;
+SELECT @@character_set_filesystem;
+SET @@character_set_filesystem = utf8;
+SELECT @@character_set_filesystem;
+SET @@character_set_filesystem = uTf8;
+SELECT @@character_set_filesystem;
+
+--echo '#--------------------FN_DYNVARS_008_09-------------------------#'
+##############################################################
+# Check if 1,2,3, ... values can be used on variable #
+##############################################################
+SET @@character_set_filesystem = 1;
+SELECT @@character_set_filesystem;
+
+--echo # latin2_czech_cs is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_filesystem = 2;
+
+SET @@character_set_filesystem = 3;
+SELECT @@character_set_filesystem;
+SET @@character_set_filesystem = 36;
+SELECT @@character_set_filesystem;
+
+--echo # cp1250_polish_ci is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_filesystem = 99;
+
+--echo # Collation ID 100 does not exist
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_filesystem = 100;
+
+SET @total_charset = (SELECT count(*) FROM INFORMATION_SCHEMA.CHARACTER_SETS);
+SELECT @total_charset;
+
+--echo '#--------------------FN_DYNVARS_008_10-------------------------#'
+################################################################################
+# Change the value of character_set_filesystem to an invalid value for session #
+################################################################################
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_filesystem = abc;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_filesystem = 1utf8;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_filesystem = 0;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@character_set_filesystem = 1.1;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_filesystem = -1;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_filesystem = '';
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_filesystem = 'utf';
+SET @@character_set_filesystem = true;
+SELECT @@character_set_filesystem AS res_with_true;
+
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_filesystem = ON;
+
+--echo '#--------------------FN_DYNVARS_008_11-------------------------#'
+################################################################################
+# Change the value of character_set_filesystem to an invalid value for global #
+################################################################################
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_filesystem = abc;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_filesystem = 1utf8;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_filesystem = 0;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.character_set_filesystem = 1.1;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_filesystem = -1;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_filesystem = '';
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_filesystem = 'utf';
+
+SET @@global.character_set_filesystem = true;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_filesystem = ON;
+
+--echo '#--------------------FN_DYNVARS_008_12-------------------------#'
+##############################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+##############################################################################
+SELECT @@global.character_set_filesystem =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='character_set_filesystem') AS res;
+SET @@global.character_set_filesystem = 1;
+SELECT @@global.character_set_filesystem;
+SELECT @@global.character_set_filesystem =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='character_set_filesystem') AS res;
+
+--echo '#--------------------FN_DYNVARS_008_13-------------------------#'
+#############################################################################
+# Check if the value in SESSION Table matches value in variable #
+#############################################################################
+SELECT @@character_set_filesystem =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+ WHERE VARIABLE_NAME='character_set_filesystem') AS res;
+SELECT @@local.character_set_filesystem =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+ WHERE VARIABLE_NAME='character_set_filesystem') AS res;
+SELECT @@session.character_set_filesystem =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+ WHERE VARIABLE_NAME='character_set_filesystem') AS res;
+
+####################################
+# Restore initial value #
+####################################
+SET @@global.character_set_filesystem = @global_start_value;
+SELECT @@global.character_set_filesystem;
+SET @@session.character_set_filesystem = @session_start_value;
+SELECT @@session.character_set_filesystem;
+
+#############################################################
+# END OF character_set_filesystem TESTS #
+#############################################################
diff --git a/mysql-test/suite/sys_vars/t/character_set_filesystem_func-master.opt b/mysql-test/suite/sys_vars/t/character_set_filesystem_func-master.opt
new file mode 100644
index 00000000..303377e7
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/character_set_filesystem_func-master.opt
@@ -0,0 +1 @@
+--secure-file-priv=$MYSQL_TEST_DIR --loose-innodb
diff --git a/mysql-test/suite/sys_vars/t/character_set_results_basic.test b/mysql-test/suite/sys_vars/t/character_set_results_basic.test
new file mode 100644
index 00000000..41090be6
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/character_set_results_basic.test
@@ -0,0 +1,295 @@
+############## mysql-test\t\character_set_results_basic.test ##################
+# #
+# Variable Name: character_set_results #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: string #
+# Default Value: utf8 (session), latin1 (global) #
+# Range: NA #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable character_set_results #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+--source include/have_big5.inc
+--source include/have_ujis.inc
+--source include/have_sjis.inc
+--source include/have_utf8.inc
+--source include/have_ucs2.inc
+--source include/have_utf8mb4.inc
+--source include/have_utf16.inc
+--source include/have_utf32.inc
+--source include/default_charset.inc
+--source include/load_sysvars.inc
+################################################
+## START OF character_set_results TESTS ##
+################################################
+
+#############################################################
+# Save initial value #
+#############################################################
+SET @global_start_value = @@global.character_set_results;
+SET @@global.character_set_results=@@character_set_client;
+SELECT @@global.character_set_results;
+# Save initial session value
+SET @session_start_value = @@character_set_results;
+SELECT @session_start_value;
+# now save using local access
+SET @session_start_value = @@local.character_set_results;
+SELECT @session_start_value;
+# save using default access (session)
+SET @session_start_value = @@session.character_set_results;
+SELECT @session_start_value;
+
+--echo '#--------------------FN_DYNVARS_013_01------------------#'
+##############################################################################
+# Test Variable access and assignment with and withoud @@ #
+##############################################################################
+# select without @@
+--error ER_BAD_FIELD_ERROR
+SELECT character_set_results;
+# assign value without @@
+SET character_set_results=utf8;
+SELECT @@session.character_set_results;
+# using another syntax for accessing session variable
+SET session character_set_results=utf8;
+# accessing variable with scope the wrong way
+--Error ER_BAD_FIELD_ERROR
+SELECT session character_set_results;
+# using another syntax for accessing dynamic variable
+SET global character_set_results=utf8;
+--Error ER_BAD_FIELD_ERROR
+SELECT global character_set_results;
+
+--echo '#--------------------FN_DYNVARS_013_02-------------------------#'
+###############################################################################
+# Check the DEFAULT value of character_set_results for session and global #
+###############################################################################
+SET @@character_set_results = latin5;
+SET @@character_set_results = DEFAULT;
+SELECT @@character_set_results = @@global.character_set_results;
+
+SET @@global.character_set_results = latin5;
+SET @@global.character_set_results = DEFAULT;
+SELECT @@global.character_set_results= @global_start_value;
+
+--echo '#--------------------FN_DYNVARS_013_03-------------------------#'
+###############################################################################
+# see if setting global value changes session value and vice versa #
+###############################################################################
+SET @@session.character_set_results = utf8;
+SELECT @@session.character_set_results;
+SET @@global.character_set_results = latin2;
+SELECT @@global.character_set_results;
+SELECT @@session.character_set_results AS res_is_utf8;
+
+SET @@session.character_set_results = latin5;
+SELECT @@session.character_set_results;
+SELECT @@global.character_set_results AS res_is_latin2;
+# composite check
+SELECT @@global.character_set_results=@@session.character_set_results
+AS res_is_false;
+
+--echo '#--------------------FN_DYNVARS_013_04-------------------------#'
+###################################################################
+# Check if accessing variable with and without session point to #
+# session variable #
+###################################################################
+SELECT @@character_set_results = @@session.character_set_results AS res;
+SELECT @@character_set_results = @@local.character_set_results AS res;
+
+--echo '#--------------------FN_DYNVARS_013_05-------------------------#'
+###########################################################################
+# Check if combining character set works #
+###########################################################################
+--Error ER_BAD_FIELD_ERROR
+SET @@character_set_results = utf8 + latin2;
+
+--echo '#--------------------FN_DYNVARS_013_06-------------------------#'
+##############################################################################
+# Change the value of character_set_results to a valid value for session #
+##############################################################################
+
+let charset_variable = @@session.character_set_results;
+--source suite/sys_vars/inc/charset_basic.inc
+
+
+--echo '#--------------------FN_DYNVARS_013_07-------------------------#'
+###############################################################################
+# Change the value of character_set_results to a valid value for global #
+###############################################################################
+
+let charset_variable = @@global.character_set_results;
+--source suite/sys_vars/inc/charset_basic.inc
+
+
+--echo '#--------------------FN_DYNVARS_013_08-------------------------#'
+################################################################################
+# Change the value of character_set_results to a valid value with uppercase, #
+# lowercase and mixedcase #
+################################################################################
+SET @@character_set_results = UTF8;
+SELECT @@character_set_results;
+SET @@character_set_results = utf8;
+SELECT @@character_set_results;
+
+SET @@global.character_set_results = uTf8;
+SELECT @@global.character_set_results;
+
+--echo '#--------------------FN_DYNVARS_013_09-------------------------#'
+##############################################################
+# Check if 1,2,3, ... values can be used on variable #
+##############################################################
+SET @@character_set_results = 1;
+SELECT @@character_set_results;
+
+--echo # latin2_czech_cs is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_results = 2;
+
+SET @@character_set_results = 3;
+SELECT @@character_set_results;
+SET @@character_set_results = 36;
+SELECT @@character_set_results;
+
+--echo # cp1250_polish_ci is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_results = 99;
+
+--echo # Collation ID 100 does not exist
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_results = 100;
+
+
+SET @@global.character_set_results = 1;
+SELECT @@global.character_set_results;
+
+--echo # latin2_czech_cs is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_results = 2;
+
+SET @@global.character_set_results = 3;
+SELECT @@global.character_set_results;
+SET @@global.character_set_results = 36;
+SELECT @@global.character_set_results;
+
+--echo # cp1250_polish_ci is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_results = 99;
+
+--echo # Collation ID 100 does not exist
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_results = 100;
+
+SET @total_charset = (SELECT count(*) FROM INFORMATION_SCHEMA.CHARACTER_SETS);
+SELECT @total_charset;
+--echo 'Bug # 34843: character sets are mapped in such a way that 100 and following';
+--echo 'numbers gives error, and before 100 the 36 mapped wraps arround several times.';
+
+--echo '#--------------------FN_DYNVARS_013_10-------------------------#'
+###############################################################################
+# Change the value of character_set_results to an invalid value for session #
+###############################################################################
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_results = abc;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_results = 1utf8;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_results = 0;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@character_set_results = .1;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_results = -1;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_results = "";
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_results = 'utf';
+SET @@character_set_results = true;
+SELECT @@character_set_results AS res_with_true;
+
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_results = ON;
+
+--echo '#--------------------FN_DYNVARS_013_11-------------------------#'
+###############################################################################
+# Change the value of character_set_results to an invalid value for global #
+###############################################################################
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_results = "'latin2'";
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_results = 1utf8;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_results = 0;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.character_set_results = 0.1;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_results = -1;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_results = "";
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_results = 'utf';
+
+SET @@global.character_set_results = true;
+
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_results = ON;
+
+--echo '#--------------------FN_DYNVARS_013_12-------------------------#'
+##############################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+##############################################################################
+SELECT @@global.character_set_results =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='character_set_results') AS res;
+SET @@global.character_set_results = 1;
+SELECT @@global.character_set_results;
+SELECT @@global.character_set_results =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='character_set_results') AS res;
+
+--echo '#--------------------FN_DYNVARS_013_13-------------------------#'
+##############################################################################
+# Check if the value in SESSION Table matches value in variable #
+##############################################################################
+SELECT @@character_set_results =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+ WHERE VARIABLE_NAME='character_set_results') AS res;
+SELECT @@local.character_set_results =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+ WHERE VARIABLE_NAME='character_set_results') AS res;
+SELECT @@session.character_set_results =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+ WHERE VARIABLE_NAME='character_set_results') AS res;
+
+--echo #
+--echo # MDEV-31018 Replica of 10.3, 10.4, <10.5.19 and <10.6.12 to 10.11 will not work when using non-default charset
+--echo #
+
+--error ER_UNKNOWN_CHARACTER_SET
+SET character_set_results=2/*latin2_czech_cs*/;
+SET @@pseudo_slave_mode=1;
+SET character_set_results=2;
+SHOW VARIABLES LIKE 'character_set_results';
+SET @@pseudo_slave_mode=0;
+
+
+####################################
+# Restore initial value #
+####################################
+SET @@global.character_set_results = @global_start_value;
+SET @@session.character_set_results = @session_start_value;
+
+#############################################################
+# END OF character_set_results TESTS #
+#############################################################
diff --git a/mysql-test/suite/sys_vars/t/character_set_results_func.test b/mysql-test/suite/sys_vars/t/character_set_results_func.test
new file mode 100644
index 00000000..6b869789
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/character_set_results_func.test
@@ -0,0 +1,97 @@
+############## mysql-test\t\character_set_results_func.test ##################
+# #
+# Variable Name: character_set_results #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: string #
+# Default Value: utf8 (session), latin1 (global) #
+# Range: NA #
+# #
+# #
+# Creation Date: 2008-03-08 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable character_set_results #
+# that checks the behavior of this variable #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--echo '#--------------------FN_DYNVARS_012_01-------------------------#'
+#######################################################################
+# Check if setting character_set_results is changed in new connection #
+#######################################################################
+
+# save
+SET @global_character_set_results = @@global.character_set_results;
+SET @session_character_set_results = @@session.character_set_results;
+
+
+SET @@global.character_set_results = utf8;
+connect (con1,localhost,root,,,,);
+connection con1;
+SELECT @@global.character_set_results;
+SELECT @@session.character_set_results;
+disconnect con1;
+
+
+--echo '#--------------------FN_DYNVARS_012_02-------------------------#'
+#############################################################
+# Begin the functionality Testing of character_set_results #
+#############################################################
+
+connection default;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1(b CHAR(40) character set utf8);
+SET NAMES utf8;
+
+#==============================================================================
+--echo '----check string literals against different character_set_results---'
+#==============================================================================
+--echo check if results are converted to character_set_results
+SET @@session.character_set_results = greek;
+SELECT 'ÐЂЃЄ' AS utf_text;
+
+--echo check effect of character_set_results when introducers are used
+SET @@session.character_set_results = latin1;
+SELECT _latin1'Müller' AS latin1_text;
+SET @@session.character_set_results = ascii;
+SELECT _latin1'Müller' AS latin1_text;
+
+--echo check when we dont want any conversion
+SET @@session.character_set_results = NULL;
+SELECT 'ÐЂЃЄ' AS utf_text;
+
+#==============================================================================
+--echo '---check results from table against different character_set_results--'
+#==============================================================================
+INSERT INTO t1 VALUES(_utf8'ÐЂЃЄ');
+INSERT INTO t1 VALUES('ФХЦЧШ');
+
+SET @@session.character_set_results = NULL;
+SELECT b, CHAR_LENGTH(b) FROM t1;
+
+SET @@session.character_set_results = utf8;
+SELECT b, CHAR_LENGTH(b) FROM t1;
+
+SET @@session.character_set_results = koi8r;
+SELECT b, CHAR_LENGTH(b) FROM t1;
+
+SET @@session.character_set_results = cp1250;
+SELECT b, CHAR_LENGTH(b) FROM t1;
+
+DROP TABLE t1;
+# restore
+connection default;
+SET @@global.character_set_results = @global_character_set_results;
+SET @@session.character_set_results = @session_character_set_results;
+
+##########################################################
+# End of functionality Testing for character_set_results #
+##########################################################
diff --git a/mysql-test/suite/sys_vars/t/character_set_server_basic.test b/mysql-test/suite/sys_vars/t/character_set_server_basic.test
new file mode 100644
index 00000000..929dbfaf
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/character_set_server_basic.test
@@ -0,0 +1,289 @@
+############## mysql-test\t\character_set_server_basic.test ###################
+# #
+# Variable Name: character_set_server #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: string #
+# Default Value: utf8 (session), latin1 (global) #
+# Range: NA #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable character_set_server #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+--source include/have_big5.inc
+--source include/have_ujis.inc
+--source include/have_sjis.inc
+--source include/have_utf8.inc
+--source include/have_ucs2.inc
+--source include/default_charset.inc
+--source include/load_sysvars.inc
+
+###################################################
+## START OF character_set_server TESTS ##
+###################################################
+
+#############################################################
+# Save initial value #
+#############################################################
+SET @global_start_value = @@global.character_set_server;
+SET @@global.character_set_server=@@character_set_client;
+SELECT @@global.character_set_server;
+# Save initial session value
+SET @session_start_value = @@character_set_server;
+SELECT @session_start_value;
+# now save using local access
+SET @session_start_value = @@local.character_set_server;
+SELECT @session_start_value;
+# save using default access (session)
+SET @session_start_value = @@session.character_set_server;
+SELECT @session_start_value;
+
+--echo '#--------------------FN_DYNVARS_009_01------------------#'
+###############################################################################
+# Test Variable access and assignment with and withoud @@ #
+###############################################################################
+# select without @@
+--error ER_BAD_FIELD_ERROR
+SELECT character_set_server;
+# assign value without @@
+SET character_set_server=utf8;
+SELECT @@session.character_set_server;
+# using another syntax for accessing session variable
+SET session character_set_server=utf8;
+# accessing variable with scope the wrong way
+--Error ER_BAD_FIELD_ERROR
+SELECT session character_set_server;
+# using another syntax for accessing dynamic variable
+SET global character_set_server=utf8;
+--Error ER_BAD_FIELD_ERROR
+SELECT global character_set_server;
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@character_set_server = null;
+
+--echo '#--------------------FN_DYNVARS_009_02-------------------------#'
+###############################################################################
+# Check the DEFAULT value of character_set_server for session and global #
+###############################################################################
+SET @@character_set_server = latin5;
+SET @@character_set_server = DEFAULT;
+SELECT @@character_set_server = @@global.character_set_server;
+
+SET @@global.character_set_server = latin5;
+SET @@global.character_set_server = DEFAULT;
+SELECT @@global.character_set_server = @global_start_value;
+
+--echo '#--------------------FN_DYNVARS_009_03-------------------------#'
+###############################################################################
+# see if setting global value changes session value and vice versa #
+###############################################################################
+SET @@session.character_set_server = utf8;
+SELECT @@session.character_set_server;
+SET @@global.character_set_server = latin2;
+SELECT @@global.character_set_server;
+SELECT @@session.character_set_server AS res_is_utf8;
+
+SET @@session.character_set_server = latin5;
+SELECT @@session.character_set_server;
+SELECT @@global.character_set_server AS res_is_latin2;
+# composite check
+SELECT @@global.character_set_server=@@session.character_set_server
+AS res_is_false;
+
+--echo '#--------------------FN_DYNVARS_009_04-------------------------#'
+###############################################################################
+# Check if accessing variable with and without session point #
+# to session variable #
+###############################################################################
+SELECT @@character_set_server = @@session.character_set_server AS res;
+SELECT @@character_set_server = @@local.character_set_server AS res;
+
+--echo '#--------------------FN_DYNVARS_009_05-------------------------#'
+###########################################################################
+# Check if combining character set works #
+###########################################################################
+--Error ER_BAD_FIELD_ERROR
+SET @@character_set_server = utf8 + latin2;
+
+--echo '#--------------------FN_DYNVARS_009_06-------------------------#'
+###############################################################################
+# Change the value of character_set_server to a valid value for session #
+###############################################################################
+
+let charset_variable = @@session.character_set_server;
+
+--source suite/sys_vars/inc/charset_basic.inc
+
+
+--echo '#--------------------FN_DYNVARS_009_07-------------------------#'
+###############################################################################
+# Change the value of character_set_server to a valid value for global #
+###############################################################################
+
+let charset_variable = @@global.character_set_server;
+--source suite/sys_vars/inc/charset_basic.inc
+
+
+--echo '#--------------------FN_DYNVARS_009_08-------------------------#'
+###############################################################################
+# Change the value of character_set_server to a valid value with uppercase, #
+# lowercase and mixedcase #
+###############################################################################
+SET @@character_set_server = UTF8;
+SELECT @@character_set_server;
+SET @@character_set_server = utf8;
+SELECT @@character_set_server;
+
+SET @@global.character_set_server = uTf8;
+SELECT @@global.character_set_server;
+
+--echo '#--------------------FN_DYNVARS_009_09-------------------------#'
+##############################################################
+# Check if 1,2,3, ... values can be used on variable #
+##############################################################
+SET @@character_set_server = 1;
+SELECT @@character_set_server;
+
+--echo # latin2_czech_cs is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_server = 2;
+
+SET @@character_set_server = 3;
+SELECT @@character_set_server;
+SET @@character_set_server = 36;
+SELECT @@character_set_server;
+
+--echo # cp1250_polish_ci is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_server = 99;
+
+--echo # Collation ID 100 does not exist
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_server = 100;
+
+SET @@global.character_set_server = 1;
+SELECT @@global.character_set_server;
+
+--echo # latin2_czech_cs is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_server = 2;
+
+SET @@global.character_set_server = 36;
+SELECT @@global.character_set_server;
+
+--echo # cp1250_polish_ci is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_server = 99;
+
+--echo # Collation ID 100 does not exist
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_server = 100;
+
+--echo '#--------------------FN_DYNVARS_009_10-------------------------#'
+###############################################################################
+# Change the value of character_set_server to an invalid value for session #
+###############################################################################
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_server = abc;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_server = 1utf8;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_server = 0;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@character_set_server = 1.1;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_server = -1;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_server = '';
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_server = 'utf';
+SET @@character_set_server = true;
+SELECT @@character_set_server AS res_with_true;
+
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_server = ON;
+
+--echo '#--------------------FN_DYNVARS_009_11-------------------------#'
+###############################################################################
+# Change the value of character_set_server to an invalid value for global #
+###############################################################################
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_server = abc;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_server = 1utf8;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_server = 0;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.character_set_server = 1.1;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_server = -1;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_server = '';
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_server = 'utf';
+
+SET @@global.character_set_server = true;
+
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@global.character_set_server = ON;
+
+--echo '#--------------------FN_DYNVARS_009_12-------------------------#'
+###############################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+###############################################################################
+SELECT @@global.character_set_server =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='character_set_server') AS res;
+SET @@global.character_set_server = 1;
+SELECT @@global.character_set_server;
+SELECT @@global.character_set_server =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='character_set_server') AS res;
+
+--echo '#--------------------FN_DYNVARS_009_13-------------------------#'
+###############################################################################
+# Check if the value in SESSION Table matches value in variable #
+###############################################################################
+SELECT @@character_set_server =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+ WHERE VARIABLE_NAME='character_set_server') AS res;
+SELECT @@local.character_set_server =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+ WHERE VARIABLE_NAME='character_set_server') AS res;
+SELECT @@session.character_set_server =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+ WHERE VARIABLE_NAME='character_set_server') AS res;
+
+--echo #
+--echo # MDEV-31018 Replica of 10.3, 10.4, <10.5.19 and <10.6.12 to 10.11 will not work when using non-default charset
+--echo #
+
+--error ER_UNKNOWN_CHARACTER_SET
+SET character_set_server=2/*latin2_czech_cs*/;
+SET @@pseudo_slave_mode=1;
+SET character_set_server=2/*latin2_czech_cs*/;
+SHOW VARIABLES LIKE 'character_set_server';
+SHOW VARIABLES LIKE 'collation_server';
+SET @@pseudo_slave_mode=0;
+
+####################################
+# Restore initial value #
+####################################
+SET @@global.character_set_server = @global_start_value;
+SET @@session.character_set_server = @session_start_value;
+
+#############################################################
+# END OF character_set_server TESTS #
+#############################################################
diff --git a/mysql-test/suite/sys_vars/t/character_set_server_func.test b/mysql-test/suite/sys_vars/t/character_set_server_func.test
new file mode 100644
index 00000000..f96c725e
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/character_set_server_func.test
@@ -0,0 +1,102 @@
+############## mysql-test\t\character_set_server_func.test ###################
+# #
+# Variable Name: character_set_server #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: string #
+# Default Value: utf8 (session), latin1 (global) #
+# Range: NA #
+# #
+# #
+# Creation Date: 2008-03-08 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable character_set_server #
+# that checks the behavior of this variable #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+--echo '#--------------------FN_DYNVARS_009_01-------------------------#'
+######################################################################
+# Check if setting character_set_server is changed in new connection #
+######################################################################
+
+#save
+SET @global_character_set_server = @@global.character_set_server;
+SET @session_character_set_server = @@session.character_set_server;
+
+
+SET @@global.character_set_server = utf8;
+connect (con1,localhost,root,,,,);
+connection con1;
+SELECT @@global.character_set_server;
+SELECT @@session.character_set_server;
+disconnect con1;
+
+--echo '#--------------------FN_DYNVARS_009_02-------------------------#'
+#############################################################
+# Begin the functionality Testing of character_set_server #
+#############################################################
+
+connection default;
+#The server character set and collation are used as default values if the database
+#character set and collation are not specified in CREATE DATABASE statements.
+
+#==============================================================================
+--echo '--global character_set_server should not effects current connection--'
+#==============================================================================
+
+--source include/default_charset.inc
+select @@character_set_database=@@character_set_connection;
+SET @@global.character_set_server = utf8;
+CREATE DATABASE db1;
+USE db1;
+SHOW CREATE DATABASE db1;
+DROP DATABASE db1;
+select @@character_set_database;
+
+#==============================================================================
+--echo '---session character_set_server should effects current connection---'
+#==============================================================================
+SET @@session.character_set_server = utf8;
+CREATE DATABASE db1;
+USE db1;
+SHOW CREATE DATABASE db1;
+DROP DATABASE db1;
+select @@character_set_database;
+
+#==============================================================================
+--echo '----test with new connection----'
+#==============================================================================
+
+connect (con1,localhost,root,,,,);
+connection con1;
+
+SELECT @@session.character_set_server;
+
+--echo '----------character set not specified---------'
+CREATE DATABASE db1;
+USE db1;
+SHOW CREATE DATABASE db1;
+DROP DATABASE db1;
+SELECT @@character_set_database;
+
+--echo '----------ascii character set specified----------'
+CREATE DATABASE db1 character set ascii;
+USE db1;
+SHOW CREATE DATABASE db1;
+DROP DATABASE db1;
+select @@character_set_database;
+
+disconnect con1;
+
+#restore
+connection default;
+SET @@global.character_set_server = @global_character_set_server;
+SET @@session.character_set_server = @session_character_set_server;
+
+############################################################
+# End of functionality Testing for character_set_server #
+############################################################
diff --git a/mysql-test/suite/sys_vars/t/character_set_system_basic.test b/mysql-test/suite/sys_vars/t/character_set_system_basic.test
new file mode 100644
index 00000000..9d59b313
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/character_set_system_basic.test
@@ -0,0 +1,100 @@
+
+
+################## mysql-test\t\character_set_system_basic.test ###############
+# #
+# Variable Name: character_set_system #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: string #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable character_set_system #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--echo '#---------------------BS_STVARS_003_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.character_set_system);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_003_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.character_set_system=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.character_set_system);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_003_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+SELECT @@GLOBAL.character_set_system = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='character_set_system';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.character_set_system);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='character_set_system';
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_003_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@character_set_system = @@GLOBAL.character_set_system;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_003_05----------------------#'
+################################################################################
+# Check if character_set_system can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@character_set_system);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.character_set_system);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.character_set_system);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.character_set_system);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT character_set_system = @@SESSION.character_set_system;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/character_sets_dir_basic.test b/mysql-test/suite/sys_vars/t/character_sets_dir_basic.test
new file mode 100644
index 00000000..0bbfd041
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/character_sets_dir_basic.test
@@ -0,0 +1,25 @@
+--source include/not_windows.inc
+#
+# show the global and session values;
+#
+--replace_result $MYSQL_CHARSETSDIR MYSQL_CHARSETSDIR
+select @@global.character_sets_dir;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.character_sets_dir;
+--replace_result $MYSQL_CHARSETSDIR MYSQL_CHARSETSDIR
+show global variables like 'character_sets_dir';
+--replace_result $MYSQL_CHARSETSDIR MYSQL_CHARSETSDIR
+show session variables like 'character_sets_dir';
+--replace_result $MYSQL_CHARSETSDIR MYSQL_CHARSETSDIR
+select * from information_schema.global_variables where variable_name='character_sets_dir';
+--replace_result $MYSQL_CHARSETSDIR MYSQL_CHARSETSDIR
+select * from information_schema.session_variables where variable_name='character_sets_dir';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global character_sets_dir="foo";
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session character_sets_dir="foo";
+
diff --git a/mysql-test/suite/sys_vars/t/collation_connection_basic.test b/mysql-test/suite/sys_vars/t/collation_connection_basic.test
new file mode 100644
index 00000000..04eae1d8
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/collation_connection_basic.test
@@ -0,0 +1,261 @@
+############## mysql-test\t\collation_connection_basic.test ###################
+# #
+# Variable Name: collation_connection #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: string #
+# Default Value: #
+# Range: #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable collation_connection #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+--source include/have_big5.inc
+--source include/have_ujis.inc
+--source include/have_sjis.inc
+--source include/have_utf8.inc
+--source include/have_ucs2.inc
+--source include/default_charset.inc
+--source include/load_sysvars.inc
+
+###################################################
+## START OF collation_connection TESTS ##
+###################################################
+
+#############################################################
+# Save initial value #
+#############################################################
+SET @global_start_value = @@global.collation_connection;
+SET @@global.collation_connection=@@collation_connection;
+SELECT @@global.collation_connection;
+# Save initial session value
+SET @session_start_value = @@collation_connection;
+SELECT @session_start_value;
+# now save using local access
+SET @session_start_value = @@local.collation_connection;
+SELECT @session_start_value;
+# save using implicit session scope
+SET @session_start_value = @@session.collation_connection;
+SELECT @session_start_value;
+
+--echo '#--------------------FN_DYNVARS_015_01------------------#'
+###############################################################################
+# Test Variable access and assignment with and without @@ #
+###############################################################################
+# select without @@
+--error ER_BAD_FIELD_ERROR
+SELECT collation_connection;
+# assign value without @@
+SET collation_connection=utf8_unicode_ci;
+SELECT @@session.collation_connection;
+# using another syntax for accessing session variable
+SET session collation_connection=utf8_unicode_ci;
+# accessing variable with scope the wrong way
+--Error ER_BAD_FIELD_ERROR
+SELECT session collation_connection;
+# using another syntax for accessing dynamic variable
+SET global collation_connection=utf8_unicode_ci;
+--Error ER_BAD_FIELD_ERROR
+SELECT global collation_connection;
+
+--echo '#--------------------FN_DYNVARS_015_02-------------------------#'
+###############################################################################
+# Check the DEFAULT value of collation_connection for session and global #
+###############################################################################
+SET @@collation_connection = latin1_bin;
+SET @@collation_connection = DEFAULT;
+SELECT @@collation_connection = @@global.collation_connection;
+
+SET @@global.collation_connection = latin1_bin;
+SET @@global.collation_connection = DEFAULT;
+SELECT @@global.collation_connection = @global_start_value;
+
+--echo '#--------------------FN_DYNVARS_015_03-------------------------#'
+##############################################################################
+# see if setting global value changes session value and vice versa #
+##############################################################################
+SET @@session.collation_connection = utf8_polish_ci;
+SELECT @@session.collation_connection;
+SET @@global.collation_connection = latin7_general_ci;
+SELECT @@global.collation_connection;
+SELECT @@session.collation_connection AS res_is_utf8_polish_ci;
+
+SET @@session.collation_connection = latin7_bin;
+SELECT @@session.collation_connection;
+SELECT @@global.collation_connection AS res_is_latin7_general_ci;
+# composite check
+SELECT @@global.collation_connection=@@session.collation_connection
+AS res_is_false;
+
+--echo '#--------------------FN_DYNVARS_015_04-------------------------#'
+###############################################################################
+# Check if accessing variable with and without session point to session #
+# variable #
+###############################################################################
+SELECT @@collation_connection = @@session.collation_connection AS res;
+SELECT @@collation_connection = @@local.collation_connection AS res;
+
+--echo '#--------------------FN_DYNVARS_015_05-------------------------#'
+###########################################################################
+# Check if combining character set works #
+###########################################################################
+--Error ER_BAD_FIELD_ERROR
+SET @@collation_connection = latin7_general_ci + latin7_general_cs;
+
+--echo '#--------------------FN_DYNVARS_015_06-------------------------#'
+###############################################################################
+# Change the value of collation_connection to a valid value for session #
+###############################################################################
+
+let $collation_variable = @@session.collation_connection;
+--source suite/sys_vars/inc/collation_basic.inc
+
+
+--echo '#--------------------FN_DYNVARS_015_07-------------------------#'
+###############################################################################
+# Change the value of collation_connection to a valid value for global #
+###############################################################################
+
+let $collation_variable = @@global.collation_connection;
+--source suite/sys_vars/inc/collation_basic.inc
+
+
+--echo '#--------------------FN_DYNVARS_015_08-------------------------#'
+##############################################################################
+# Change the value of collation_connection to a valid value with uppercase, #
+# lowercase and mixedcase #
+##############################################################################
+SET @@collation_connection = LATIN7_GENERAL_CS;
+SELECT @@collation_connection;
+SET @@collation_connection = latin7_general_cs;
+SELECT @@collation_connection;
+
+SET @@global.collation_connection = Latin7_GeneRal_cS;
+SELECT @@global.collation_connection;
+
+
+--echo '#--------------------FN_DYNVARS_015_09-------------------------#'
+##############################################################
+# Check if 1,2,3, ... values can be used on variable #
+##############################################################
+SET @@collation_connection = 1;
+SELECT @@collation_connection;
+SET @@collation_connection = 2;
+SELECT @@collation_connection;
+SET @@collation_connection = 3;
+SELECT @@collation_connection;
+SET @@collation_connection = 99;
+SELECT @@collation_connection;
+--Error ER_UNKNOWN_COLLATION
+SET @@collation_connection = 100;
+
+SET @@global.collation_connection = 1;
+SELECT @@global.collation_connection;
+SET @@global.collation_connection = 2;
+SELECT @@global.collation_connection;
+SET @@global.collation_connection = 3;
+SELECT @@global.collation_connection;
+SET @@global.collation_connection = 99;
+SELECT @@global.collation_connection;
+--Error ER_UNKNOWN_COLLATION
+SET @@global.collation_connection = 100;
+
+SET @total_collations = (SELECT count(*) FROM INFORMATION_SCHEMA.COLLATIONS);
+SELECT @total_collations > 120;
+
+--echo '#--------------------FN_DYNVARS_015_10-------------------------#'
+###############################################################################
+# Change the value of collation_connection to an invalid value for session #
+###############################################################################
+--Error ER_UNKNOWN_COLLATION
+SET @@collation_connection = latin7_binary;
+--Error ER_UNKNOWN_COLLATION
+SET @@collation_connection = 'eucjpms_japanese_cs';
+--Error ER_UNKNOWN_COLLATION
+SET @@collation_connection = 0;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@collation_connection = 1.01;
+--Error ER_UNKNOWN_COLLATION
+SET @@collation_connection = -1;
+--Error ER_UNKNOWN_COLLATION
+SET @@collation_connection = '';
+--Error ER_UNKNOWN_COLLATION
+SET @@collation_connection = ' eucjpms_bin';
+SET @@collation_connection = true;
+SELECT @@collation_connection AS res_with_true;
+
+--Error ER_UNKNOWN_COLLATION
+SET @@collation_connection = ON;
+
+--echo '#--------------------FN_DYNVARS_015_11-------------------------#'
+###############################################################################
+# Change the value of collation_connection to an invalid value for global #
+###############################################################################
+--Error ER_UNKNOWN_COLLATION
+SET @@global.collation_connection = latin7_binary;
+--Error ER_UNKNOWN_COLLATION
+SET @@global.collation_connection = 'eucjpms_japanese_cs';
+--Error ER_UNKNOWN_COLLATION
+SET @@global.collation_connection = 0;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.collation_connection = 1.1;
+--Error ER_UNKNOWN_COLLATION
+SET @@global.collation_connection = -1;
+--Error ER_UNKNOWN_COLLATION
+SET @@global.collation_connection = "";
+--Error ER_UNKNOWN_COLLATION
+SET @@global.collation_connection = ' eucjpms_bin';
+
+SET @@global.collation_connection = true;
+
+--Error ER_UNKNOWN_COLLATION
+SET @@global.collation_connection = ON;
+
+--echo '#--------------------FN_DYNVARS_015_12-------------------------#'
+##############################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+##############################################################################
+SELECT @@global.collation_connection =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='collation_connection') AS res;
+SET @@global.collation_connection = 1;
+SELECT @@global.collation_connection;
+SELECT @@global.collation_connection =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='collation_connection') AS res;
+
+--echo '#--------------------FN_DYNVARS_015_13-------------------------#'
+###############################################################################
+# Check if the value in SESSION Table matches value in variable #
+###############################################################################
+SELECT @@collation_connection =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+ WHERE VARIABLE_NAME='collation_connection') AS res;
+SELECT @@local.collation_connection =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+ WHERE VARIABLE_NAME='collation_connection') AS res;
+SELECT @@session.collation_connection =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+ WHERE VARIABLE_NAME='collation_connection') AS res;
+
+####################################
+# Restore initial value #
+####################################
+SET @@global.collation_connection = @global_start_value;
+SET @@session.collation_connection = @session_start_value;
+
+#############################################################
+# END OF collation_connection TESTS #
+#############################################################
diff --git a/mysql-test/suite/sys_vars/t/collation_connection_func.test b/mysql-test/suite/sys_vars/t/collation_connection_func.test
new file mode 100644
index 00000000..0cf41895
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/collation_connection_func.test
@@ -0,0 +1,92 @@
+############## mysql-test\t\collation_connection_func.test ###################
+# #
+# Variable Name: collation_connection #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: string #
+# Default Value: #
+# Range: #
+# #
+# #
+# Creation Date: 2008-03-08 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable collation_connection #
+# that checks the behavior of this variable #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--echo '#--------------------FN_DYNVARS_015_01-------------------------#'
+######################################################################
+# Check if setting collation_connection is changed in new connection #
+######################################################################
+SET @global_collation_connection = @@global.collation_connection;
+SET @session_collation_connection = @@session.collation_connection;
+
+SET @@global.collation_connection = latin1_danish_ci;
+connect (con1,localhost,root,,,,);
+connection con1;
+SELECT @@global.collation_connection;
+SELECT @@session.collation_connection;
+disconnect con1;
+
+--echo '#--------------------FN_DYNVARS_015_02-------------------------#'
+###########################################################
+# Begin the functionality Testing of collation_connection #
+###########################################################
+
+connection default;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+#==============================================================================
+--echo '----check if collation_connection update character_set_connection---'
+#==============================================================================
+
+SET @@session.collation_connection = utf8_spanish_ci;
+SELECT @@collation_connection, @@character_set_database;
+
+#==============================================================================
+--echo '---check if collation_connection works for literal string comparision--'
+#==============================================================================
+SET @@session.collation_connection = latin1_swedish_ci;
+SELECT 'mysql'='MySql';
+SELECT _latin2'mysql' COLLATE latin2_general_ci='MySql';
+SELECT _utf8'mysql'=_utf8'MySql' COLLATE utf8_unicode_ci;
+
+SET @@session.collation_connection = latin1_general_cs;
+SELECT 'mysql'='MySql';
+SELECT _latin2'mysql'COLLATE latin2_general_ci='MySql';
+--Error ER_CANT_AGGREGATE_2COLLATIONS
+SELECT _utf8'mysql'COLLATE utf8_danish_ci=_utf8'MySql'COLLATE utf8_unicode_ci;
+
+#==============================================================================
+--echo '---collation_connection does not effect comparision with column---'
+#==============================================================================
+# fill table with some test data
+CREATE TABLE t1(a CHAR(20)CHARACTER SET latin1 COLLATE latin1_german2_ci);
+INSERT INTO t1 VALUES('Müller');
+
+
+SET @@session.collation_connection = latin2_hungarian_ci;
+SELECT * FROM t1 WHERE a='Müller';
+
+SET @@session.collation_connection = latin1_general_cs;
+SELECT * FROM t1 WHERE a='müller';
+
+--echo 'check if string literal collation is used';
+SELECT * FROM t1 WHERE a='müller' COLLATE latin1_general_cs;
+SELECT * FROM t1 WHERE a='müller' COLLATE latin1_german1_ci;
+
+# clean up
+DROP TABLE t1;
+SET @@global.collation_connection = @global_collation_connection;
+SET @@session.collation_connection = @session_collation_connection;
+#########################################################
+# End of functionality Testing for collation_connection #
+#########################################################
diff --git a/mysql-test/suite/sys_vars/t/collation_database_basic.test b/mysql-test/suite/sys_vars/t/collation_database_basic.test
new file mode 100644
index 00000000..314331a7
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/collation_database_basic.test
@@ -0,0 +1,265 @@
+############## mysql-test\t\collation_database_basic.test #####################
+# #
+# Variable Name: collation_database #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: string #
+# Default Value: #
+# Range: #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable collation_database #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_big5.inc
+--source include/have_ujis.inc
+--source include/have_sjis.inc
+--source include/have_utf8.inc
+--source include/have_ucs2.inc
+--source include/default_charset.inc
+--source include/load_sysvars.inc
+
+###################################################
+## START OF collation_database TESTS ##
+###################################################
+
+#############################################################
+# Save initial value #
+#############################################################
+SET @global_start_value = @@global.collation_database;
+SET @@global.collation_database=@@collation_server;
+SELECT @@global.collation_database;
+# Save initial session value
+SET @session_start_value = @@collation_database;
+SELECT @session_start_value;
+# now save using local access
+SET @session_start_value = @@local.collation_database;
+SELECT @session_start_value;
+# save using implicit session scope
+SET @session_start_value = @@session.collation_database;
+SELECT @session_start_value;
+
+--echo '#--------------------FN_DYNVARS_016_01------------------#'
+###############################################################################
+# Test Variable access and assignment with and without @@ #
+###############################################################################
+# select without @@
+--error ER_BAD_FIELD_ERROR
+SELECT collation_database;
+# assign value without @@
+SET collation_database=utf8_unicode_ci;
+SELECT @@session.collation_database;
+# using another syntax for accessing session variable
+SET session collation_database=utf8_unicode_ci;
+# accessing variable with scope the wrong way
+--Error ER_BAD_FIELD_ERROR
+SELECT session collation_database;
+# using another syntax for accessing dynamic variable
+SET global collation_database=utf8_unicode_ci;
+set global collation_database=@@collation_server;
+--Error ER_BAD_FIELD_ERROR
+SELECT global collation_database;
+
+--echo '#--------------------FN_DYNVARS_016_02-------------------------#'
+##############################################################################
+# Check the DEFAULT value of collation_database for session and global #
+##############################################################################
+SET @@collation_database = latin1_bin;
+SET @@collation_database = DEFAULT;
+SELECT DEFAULT_COLLATION_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME=DATABASE();
+SELECT @@collation_database = @@global.collation_database;
+
+SET @@global.collation_database = latin1_bin;
+SET @@global.collation_database = DEFAULT;
+# collation_database is depending on how the 'test' database was created, so
+# we can't trust it's value.
+SELECT length(@@global.collation_database) > 0;
+
+--echo '#--------------------FN_DYNVARS_016_03-------------------------#'
+##############################################################################
+# see if setting global value changes session value and vice versa #
+##############################################################################
+SET @@session.collation_database = utf8_polish_ci;
+SELECT @@session.collation_database;
+SET @@global.collation_database = latin7_general_ci;
+SELECT @@global.collation_database;
+SELECT @@session.collation_database AS res_is_utf8_polish_ci;
+
+SET @@session.collation_database = latin7_bin;
+SELECT @@session.collation_database;
+SELECT @@global.collation_database AS res_is_latin7_general_ci;
+# composite check
+SELECT @@global.collation_database=@@session.collation_database AS res_is_false;
+
+--echo '#--------------------FN_DYNVARS_016_04-------------------------#'
+###############################################################################
+# Check if accessing variable with and without session point to session #
+# variable #
+###############################################################################
+SELECT @@collation_database = @@session.collation_database AS res;
+SELECT @@collation_database = @@local.collation_database AS res;
+
+--echo '#--------------------FN_DYNVARS_016_05-------------------------#'
+###########################################################################
+# Check if combining character set works #
+###########################################################################
+--Error ER_BAD_FIELD_ERROR
+SET @@collation_database = latin7_general_ci + latin7_general_cs;
+
+--echo '#--------------------FN_DYNVARS_016_06-------------------------#'
+###########################################################################
+# Change the value of collation_database to a valid value for session #
+###########################################################################
+
+let $collation_variable = @@session.collation_database;
+--source suite/sys_vars/inc/collation_basic.inc
+
+
+--echo '#--------------------FN_DYNVARS_016_07-------------------------#'
+###############################################################################
+# Change the value of collation_database to a valid value for global #
+###############################################################################
+
+let $collation_variable = @@global.collation_database;
+--source suite/sys_vars/inc/collation_basic.inc
+
+
+--echo '#--------------------FN_DYNVARS_016_08-------------------------#'
+#############################################################################
+# Change the value of collation_database to a valid value with uppercase, #
+# lowercase and mixedcase #
+#############################################################################
+SET @@collation_database = LATIN7_GENERAL_CS;
+SELECT @@collation_database;
+SET @@collation_database = latin7_general_cs;
+SELECT @@collation_database;
+
+SET @@global.collation_database = Latin7_GeneRal_cS;
+SELECT @@global.collation_database;
+
+--echo '#--------------------FN_DYNVARS_016_09-------------------------#'
+##############################################################
+# Check if 1,2,3, ... values can be used on variable #
+##############################################################
+SET @@collation_database = 1;
+SELECT @@collation_database;
+SET @@collation_database = 2;
+SELECT @@collation_database;
+SET @@collation_database = 3;
+SELECT @@collation_database;
+SET @@collation_database = 99;
+SELECT @@collation_database;
+--Error ER_UNKNOWN_COLLATION
+SET @@collation_database = 100;
+
+SET @@global.collation_database = 1;
+SELECT @@global.collation_database;
+SET @@global.collation_database = 2;
+SELECT @@global.collation_database;
+SET @@global.collation_database = 3;
+SELECT @@global.collation_database;
+SET @@global.collation_database = 99;
+SELECT @@global.collation_database;
+--Error ER_UNKNOWN_COLLATION
+SET @@global.collation_database = 100;
+
+SET @total_collations = (SELECT count(*) FROM INFORMATION_SCHEMA.COLLATIONS);
+SELECT @total_collations > 120;
+
+
+--echo '#--------------------FN_DYNVARS_016_10-------------------------#'
+###############################################################################
+# Change the value of collation_database to an invalid value for session #
+###############################################################################
+--Error ER_UNKNOWN_COLLATION
+SET @@collation_database = latin7_binary;
+--Error ER_UNKNOWN_COLLATION
+SET @@collation_database = 'eucjpms_japanese_cs';
+--Error ER_UNKNOWN_COLLATION
+SET @@collation_database = 0;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@collation_database = 1.01;
+--Error ER_UNKNOWN_COLLATION
+SET @@collation_database = -1;
+--Error ER_UNKNOWN_COLLATION
+SET @@collation_database = '';
+--Error ER_UNKNOWN_COLLATION
+SET @@collation_database = ' eucjpms_bin';
+SET @@collation_database = true;
+SELECT @@collation_database AS res_with_true;
+
+--Error ER_UNKNOWN_COLLATION
+SET @@collation_database = ON;
+
+--echo '#--------------------FN_DYNVARS_016_11-------------------------#'
+###############################################################################
+# Change the value of collation_database to an invalid value for global #
+###############################################################################
+--Error ER_UNKNOWN_COLLATION
+SET @@global.collation_database = latin7_binary;
+--Error ER_UNKNOWN_COLLATION
+SET @@global.collation_database = 'eucjpms_japanese_cs';
+--Error ER_UNKNOWN_COLLATION
+SET @@global.collation_database = 0;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.collation_database = 1.1;
+--Error ER_UNKNOWN_COLLATION
+SET @@global.collation_database = -1;
+--Error ER_UNKNOWN_COLLATION
+SET @@global.collation_database = "";
+--Error ER_UNKNOWN_COLLATION
+SET @@global.collation_database = ' eucjpms_bin';
+
+SET @@global.collation_database = true;
+
+--Error ER_UNKNOWN_COLLATION
+SET @@global.collation_database = ON;
+
+--echo '#--------------------FN_DYNVARS_016_12-------------------------#'
+###############################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+###############################################################################
+SELECT @@global.collation_database =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='collation_database') AS res;
+SET @@global.collation_database = 1;
+SELECT @@global.collation_database;
+SELECT @@global.collation_database =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='collation_database') AS res;
+
+--echo '#--------------------FN_DYNVARS_016_13-------------------------#'
+##############################################################################
+# Check if the value in SESSION Table matches value in variable #
+##############################################################################
+SELECT @@collation_database =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+ WHERE VARIABLE_NAME='collation_database') AS res;
+SELECT @@local.collation_database =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+ WHERE VARIABLE_NAME='collation_database') AS res;
+SELECT @@session.collation_database =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+ WHERE VARIABLE_NAME='collation_database') AS res;
+
+####################################
+# Restore initial value #
+####################################
+SET @@global.collation_database = @global_start_value;
+SET @@session.collation_database = @session_start_value;
+
+###########################################################
+# END OF collation_database TESTS #
+###########################################################
diff --git a/mysql-test/suite/sys_vars/t/collation_database_func.test b/mysql-test/suite/sys_vars/t/collation_database_func.test
new file mode 100644
index 00000000..eead9894
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/collation_database_func.test
@@ -0,0 +1,130 @@
+############## mysql-test\t\collation_database_func.test #####################
+# #
+# Variable Name: collation_database #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: string #
+# Default Value: #
+# Range: #
+# #
+# #
+# Creation Date: 2008-03-08 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable collation_database #
+# that checks the behavior of this variable #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+
+--echo '#--------------------FN_DYNVARS_011_01-------------------------#'
+####################################################################
+# Check if setting collation_database is changed in new connection #
+####################################################################
+SET @global_collation_database = @@global.collation_database;
+SET @session_collation_database = @@session.collation_database;
+SET @session_collation_server = @@session.collation_server;
+
+
+SET @@global.collation_database = latin1_danish_ci;
+connect (con1,localhost,root,,,,);
+connection con1;
+SELECT @@global.collation_database;
+SELECT @@session.collation_database;
+disconnect con1;
+
+--echo '#--------------------FN_DYNVARS_011_02-------------------------#'
+#########################################################
+# Begin the functionality Testing of collation_database #
+#########################################################
+
+connection default;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2;
+--enable_warnings
+
+#==============================================================================
+--echo '--check if setting collation_database update character_set_database--'
+#==============================================================================
+
+SET @@session.collation_database = utf8_spanish_ci;
+SELECT @@collation_database, @@character_set_database;
+
+#==============================================================================
+--echo '--check if collation_database effects database/tables charset/collation'
+#==============================================================================
+SET @@session.collation_server = utf8_roman_ci;
+SET @@session.collation_database = latin2_croatian_ci;
+CREATE DATABASE db1;
+USE db1;
+SHOW CREATE DATABASE db1;
+
+CREATE TABLE t1(a CHAR(20));
+SHOW CREATE TABLE t1;
+
+#==============================================================================
+--echo '---check if updating collation_database effects new table/column---'
+#==============================================================================
+SET @@session.collation_database = latin7_general_cs;
+CREATE TABLE t2(a CHAR(10));
+SHOW CREATE TABLE t2;
+
+DROP TABLE t1,t2;
+
+
+#==============================================================================
+--echo '--check value of collation and character set when current db is dropped'
+#==============================================================================
+DROP DATABASE db1;
+SELECT @@collation_database,@@collation_server,@@character_set_database,@@character_set_server;
+USE test;
+SELECT @@collation_database,@@collation_server,@@character_set_database,@@character_set_server;
+
+
+--echo 'fill table with some test data';
+CREATE TABLE t1(a CHAR(20))CHARACTER SET=latin1;
+INSERT INTO t1 VALUES('Muffler'),('Müller'),('MX Systems');
+
+#==============================================================================
+--echo '---check if collation_database effects results sort order---'
+#==============================================================================
+
+SET @@session.collation_database = latin1_swedish_ci;
+SELECT * FROM t1 ORDER BY a;
+
+SET @@session.collation_database = latin1_german1_ci;
+SELECT * FROM t1 ORDER BY a;
+
+--echo 'explicit Collate clause should effects results sort order';
+
+SELECT * FROM t1 ORDER BY a COLLATE latin1_swedish_ci;
+SELECT * FROM t1 ORDER BY a COLLATE latin1_german1_ci;
+
+
+#==============================================================================
+--echo '----check if indexing is effected by collation_database---'
+#==============================================================================
+SET @@session.collation_database = latin1_swedish_ci;
+ALTER TABLE t1 ADD PRIMARY KEY (a);
+REPAIR TABLE t1;
+SELECT * FROM t1 ORDER BY a;
+
+ALTER TABLE t1 DROP PRIMARY KEY;
+SET @@session.collation_database = latin1_german1_ci;
+ALTER TABLE t1 ADD PRIMARY KEY (a);
+REPAIR TABLE t1;
+SELECT * FROM t1 ORDER BY a;
+
+# clean up
+DROP TABLE t1;
+SET @@global.collation_database = @global_collation_database;
+SET @@session.collation_database = @session_collation_database;
+SET @@session.collation_server = @session_collation_server;
+
+#######################################################
+# End of functionality Testing for collation_database #
+#######################################################
diff --git a/mysql-test/suite/sys_vars/t/collation_server_basic.test b/mysql-test/suite/sys_vars/t/collation_server_basic.test
new file mode 100644
index 00000000..f27a9a18
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/collation_server_basic.test
@@ -0,0 +1,261 @@
+############## mysql-test\t\collation_server_basic.test #######################
+# #
+# Variable Name: collation_server #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: string #
+# Default Value: #
+# Range: NA #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable collation_server #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+--source include/have_big5.inc
+--source include/have_ujis.inc
+--source include/have_sjis.inc
+--source include/have_utf8.inc
+--source include/have_ucs2.inc
+--source include/default_charset.inc
+--source include/load_sysvars.inc
+
+###################################################
+## START OF collation_server TESTS ##
+###################################################
+
+#############################################################
+# Save initial value #
+#############################################################
+SET @global_start_value = @@global.collation_server;
+SET @@global.collation_server= @@collation_server;
+# Save initial session value
+SET @session_start_value = @@collation_server;
+SELECT @session_start_value;
+# now save using local access
+SET @session_start_value = @@local.collation_server;
+SELECT @session_start_value;
+# save using implicit session scope
+SET @session_start_value = @@session.collation_server;
+SELECT @session_start_value;
+
+--echo '#--------------------FN_DYNVARS_014_01------------------#'
+###############################################################################
+# Test Variable access and assignment with and without @@ #
+###############################################################################
+# select without @@
+--error ER_BAD_FIELD_ERROR
+SELECT collation_server;
+# assign value without @@
+SET collation_server=utf8_unicode_ci;
+SELECT @@session.collation_server;
+# using another syntax for accessing session variable
+SET session collation_server=utf8_unicode_ci;
+# accessing variable with scope the wrong way
+--Error ER_BAD_FIELD_ERROR
+SELECT session collation_server;
+# using another syntax for accessing dynamic variable
+SET global collation_server=utf8_unicode_ci;
+--Error ER_BAD_FIELD_ERROR
+SELECT global collation_server;
+
+--echo '#--------------------FN_DYNVARS_014_02-------------------------#'
+###############################################################################
+# Check the DEFAULT value of collation_server for session and global #
+###############################################################################
+SET @@collation_server = latin1_bin;
+SET @@collation_server = DEFAULT;
+SELECT @@collation_server= @@global.collation_server;
+
+SET @@global.collation_server = latin1_bin;
+SET @@global.collation_server = DEFAULT;
+SELECT @@global.collation_server = @global_start_value;
+
+--echo '#--------------------FN_DYNVARS_014_03-------------------------#'
+###########################################################################
+# Check if setting global value changes session value and vice versa #
+###########################################################################
+SET @@session.collation_server = utf8_polish_ci;
+SELECT @@session.collation_server;
+SET @@global.collation_server = latin7_general_ci;
+SELECT @@global.collation_server;
+SELECT @@session.collation_server AS res_is_utf8_polish_ci;
+
+SET @@session.collation_server = latin7_bin;
+SELECT @@session.collation_server;
+SELECT @@global.collation_server AS res_is_latin7_general_ci;
+# composite check
+SELECT @@global.collation_server=@@session.collation_server AS res_is_false;
+
+--echo '#--------------------FN_DYNVARS_014_04-------------------------#'
+#############################################################################
+# Check if accessing variable with and without session point to #
+# session variable #
+#############################################################################
+SELECT @@collation_server = @@session.collation_server AS res;
+SELECT @@collation_server = @@local.collation_server AS res;
+
+--echo '#--------------------FN_DYNVARS_014_05-------------------------#'
+###########################################################################
+# Check if combining character set works #
+###########################################################################
+--Error ER_BAD_FIELD_ERROR
+SET @@collation_server = latin7_general_ci + latin7_general_cs;
+
+--echo '#--------------------FN_DYNVARS_014_06-------------------------#'
+##############################################################################
+# Change the value of collation_server to a valid value for session #
+##############################################################################
+
+let $collation_variable = @@session.collation_server;
+--source suite/sys_vars/inc/collation_basic.inc
+
+
+--echo '#--------------------FN_DYNVARS_014_07-------------------------#'
+#############################################################################
+# Change the value of collation_server to a valid value for global #
+#############################################################################
+
+let $collation_variable = @@global.collation_server;
+--source suite/sys_vars/inc/collation_basic.inc
+
+
+--echo '#--------------------FN_DYNVARS_014_08-------------------------#'
+#############################################################################
+# Change the value of collation_server to a valid value with uppercase, #
+# lowercase and mixedcase #
+#############################################################################
+
+SET @@collation_server = LATIN7_GENERAL_CS;
+SELECT @@collation_server;
+SET @@collation_server = latin7_general_cs;
+SELECT @@collation_server;
+
+SET @@global.collation_server = Latin7_GeneRal_cS;
+SELECT @@global.collation_server;
+
+
+--echo '#--------------------FN_DYNVARS_014_09-------------------------#'
+##############################################################
+# Check if 1,2,3, ... values can be used on variable #
+##############################################################
+SET @@collation_server = 1;
+SELECT @@collation_server;
+SET @@collation_server = 2;
+SELECT @@collation_server;
+SET @@collation_server = 3;
+SELECT @@collation_server;
+SET @@collation_server = 99;
+SELECT @@collation_server;
+--Error ER_UNKNOWN_COLLATION
+SET @@collation_server = 100;
+
+
+SET @@global.collation_server = 1;
+SELECT @@global.collation_server;
+SET @@global.collation_server = 2;
+SELECT @@global.collation_server;
+SET @@global.collation_server = 3;
+SELECT @@global.collation_server;
+SET @@global.collation_server = 99;
+SELECT @@global.collation_server;
+--Error ER_UNKNOWN_COLLATION
+SET @@global.collation_server = 100;
+
+
+SET @total_collations = (SELECT count(*) FROM INFORMATION_SCHEMA.COLLATIONS);
+SELECT @total_collations > 120;
+
+--echo '#--------------------FN_DYNVARS_014_10-------------------------#'
+###############################################################################
+# Change the value of collation_server to an invalid value for session #
+###############################################################################
+--Error ER_UNKNOWN_COLLATION
+SET @@collation_server = latin7_binary;
+--Error ER_UNKNOWN_COLLATION
+SET @@collation_server = 'eucjpms_japanese_cs';
+--Error ER_UNKNOWN_COLLATION
+SET @@collation_server = 0;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@collation_server = 1.01;
+--Error ER_UNKNOWN_COLLATION
+SET @@collation_server = -1;
+--Error ER_UNKNOWN_COLLATION
+SET @@collation_server = '';
+--Error ER_UNKNOWN_COLLATION
+SET @@collation_server = ' eucjpms_bin';
+SET @@collation_server = true;
+SELECT @@collation_server AS res_with_true;
+--Error ER_UNKNOWN_COLLATION
+SET @@collation_server = ON;
+
+--echo '#--------------------FN_DYNVARS_014_11-------------------------#'
+###############################################################################
+# Change the value of collation_server to an invalid value for global #
+###############################################################################
+--Error ER_UNKNOWN_COLLATION
+SET @@global.collation_server = latin7_binary;
+--Error ER_UNKNOWN_COLLATION
+SET @@global.collation_server = 'eucjpms_japanese_cs';
+--Error ER_UNKNOWN_COLLATION
+SET @@global.collation_server = 0;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.collation_server = 1.1;
+--Error ER_UNKNOWN_COLLATION
+SET @@global.collation_server = -1;
+--Error ER_UNKNOWN_COLLATION
+SET @@global.collation_server = "";
+--Error ER_UNKNOWN_COLLATION
+SET @@global.collation_server = ' eucjpms_bin';
+
+SET @@global.collation_server = true;
+
+--Error ER_UNKNOWN_COLLATION
+SET @@global.collation_server = ON;
+
+--echo '#--------------------FN_DYNVARS_014_12-------------------------#'
+###############################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+###############################################################################
+SELECT @@global.collation_server =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='collation_server') AS res;
+SET @@global.collation_server = 1;
+SELECT @@global.collation_server;
+SELECT @@global.collation_server =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='collation_server') AS res;
+
+--echo '#--------------------FN_DYNVARS_014_13-------------------------#'
+###############################################################################
+# Check if the value in SESSION Table matches value in variable #
+###############################################################################
+SELECT @@collation_server =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+ WHERE VARIABLE_NAME='collation_server') AS res;
+SELECT @@local.collation_server =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+ WHERE VARIABLE_NAME='collation_server') AS res;
+SELECT @@session.collation_server =
+ (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+ WHERE VARIABLE_NAME='collation_server') AS res;
+
+####################################
+# Restore initial value #
+####################################
+SET @@global.collation_server = @global_start_value;
+SET @@session.collation_server = @session_start_value;
+
+#####################################################
+# END OF collation_server TESTS #
+#####################################################
diff --git a/mysql-test/suite/sys_vars/t/collation_server_func.test b/mysql-test/suite/sys_vars/t/collation_server_func.test
new file mode 100644
index 00000000..71eabcc8
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/collation_server_func.test
@@ -0,0 +1,112 @@
+############## mysql-test\t\collation_server_func.test #######################
+# #
+# Variable Name: collation_server #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: string #
+# Default Value: #
+# Range: NA #
+# #
+# #
+# Creation Date: 2008-03-08 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable collation_server #
+# that checks the behavior of this variable #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--echo '#--------------------FN_DYNVARS_014_01-------------------------#'
+##################################################################
+# Check if setting collation_server is changed in new connection #
+##################################################################
+#save
+SET @global_collation_server = @@global.collation_server;
+SET @session_collation_server = @@session.collation_server;
+
+SET @@global.collation_server = latin1_danish_ci;
+connect (con1,localhost,root,,,,);
+connection con1;
+SELECT @@global.collation_server;
+SELECT @@session.collation_server;
+disconnect con1;
+
+--echo '#--------------------FN_DYNVARS_014_02-------------------------#'
+#######################################################
+# Begin the functionality Testing of collation_server #
+#######################################################
+
+connection default;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2;
+--enable_warnings
+
+#==============================================================================
+--echo '---check if setting collation_server update character_set_server---'
+#==============================================================================
+
+SET @@session.collation_server = utf8_spanish_ci;
+SELECT @@collation_server, @@character_set_server;
+
+#==============================================================================
+--echo '--check if collation_server effects database/table charset/collation--'
+#==============================================================================
+SET @@session.collation_server = latin1_german1_ci;
+CREATE DATABASE db1;
+USE db1;
+SHOW CREATE DATABASE db1;
+CREATE TABLE t1(a CHAR(20));
+SHOW CREATE TABLE t1;
+#==============================================================================
+--echo '---check if updating collation_server effects new table/column---'
+#==============================================================================
+SET @@session.collation_server = latin1_swedish_ci;
+CREATE TABLE t2(a CHAR(10));
+SHOW CREATE TABLE t2;
+
+
+# fill table with some test data
+INSERT INTO t1 VALUES('Muffler'),('Müller'),('MX Systems');
+
+#==============================================================================
+--echo '---check if collation_server effects results sort order---'
+#==============================================================================
+SET @@session.collation_server = latin1_swedish_ci;
+SELECT * FROM t1 ORDER BY a;
+
+SET @@session.collation_server = latin1_german1_ci;
+SELECT * FROM t1 ORDER BY a;
+
+# explicit Collate clause should effects results sort order
+
+SELECT * FROM t1 ORDER BY a COLLATE latin1_swedish_ci;
+SELECT * FROM t1 ORDER BY a COLLATE latin1_german1_ci;
+
+#==============================================================================
+--echo '---check if indexing is effected by collation_server---'
+#==============================================================================
+SET @@session.collation_server = latin1_swedish_ci;
+ALTER TABLE t1 ADD PRIMARY KEY (a);
+REPAIR TABLE t1;
+SELECT * FROM t1 ORDER BY a;
+
+ALTER TABLE t1 DROP PRIMARY KEY;
+SET @@session.collation_server = latin1_german1_ci;
+ALTER TABLE t1 ADD PRIMARY KEY (a);
+REPAIR TABLE t1;
+SELECT * FROM t1 ORDER BY a;
+
+
+# clean up
+DROP TABLE t1,t2;
+DROP DATABASE db1;
+#restore
+SET @@global.collation_server = @global_collation_server;
+SET @@session.collation_server = @session_collation_server;
+#####################################################
+# End of functionality Testing for collation_server #
+#####################################################
diff --git a/mysql-test/suite/sys_vars/t/completion_type_basic.test b/mysql-test/suite/sys_vars/t/completion_type_basic.test
new file mode 100644
index 00000000..7a962fbd
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/completion_type_basic.test
@@ -0,0 +1,181 @@
+############## mysql-test\t\completion_type_basic.test #########################
+# #
+# Variable Name: completion_type #
+# Scope: GLOBAL & SESSION #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 0 #
+# Valid Values: 0,1 & 2 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable "completion_type" #
+# that checks behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity . #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_completion_type #
+# #
+################################################################################
+
+--source include/load_sysvars.inc
+
+###############################################################
+# START OF completion_type TESTS #
+###############################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.completion_type;
+SELECT @start_global_value;
+SET @start_session_value = @@session.completion_type;
+SELECT @start_session_value;
+
+--echo '#--------------------FN_DYNVARS_017_01-------------------------#'
+###############################################################
+# Display the DEFAULT value of completion_type #
+###############################################################
+
+SET @@global.completion_type = 2;
+SET @@global.completion_type = DEFAULT;
+SELECT @@global.completion_type;
+
+SET @@session.completion_type = 1;
+SET @@session.completion_type = DEFAULT;
+SELECT @@session.completion_type;
+
+
+--echo '#--------------------FN_DYNVARS_017_03-------------------------#'
+#########################################################################
+# Change the value of completion_type to a valid value for GLOBAL Scope #
+#########################################################################
+
+SET @@global.completion_type = 0;
+SELECT @@global.completion_type;
+SET @@global.completion_type = 1;
+SELECT @@global.completion_type;
+SET @@global.completion_type = 2;
+SELECT @@global.completion_type;
+
+SET @@global.completion_type = NO_CHAIN;
+SELECT @@global.completion_type;
+SET @@global.completion_type = CHAIN;
+SELECT @@global.completion_type;
+SET @@global.completion_type = 'RELEASE';
+SELECT @@global.completion_type;
+
+--echo '#--------------------FN_DYNVARS_017_04-------------------------#'
+##########################################################################
+# Change the value of completion_type to a valid value for SESSION Scope #
+##########################################################################
+
+SET @@session.completion_type = 0;
+SELECT @@session.completion_type;
+SET @@session.completion_type = 1;
+SELECT @@session.completion_type;
+SET @@session.completion_type = 2;
+SELECT @@session.completion_type;
+
+SET @@session.completion_type = 'NO_CHAIN';
+SELECT @@session.completion_type;
+SET @@session.completion_type = 'CHAIN';
+SELECT @@session.completion_type;
+SET @@session.completion_type = 'RELEASE';
+SELECT @@session.completion_type;
+
+--echo '#------------------FN_DYNVARS_017_05-----------------------#'
+###########################################################
+# Change the value of completion_type to an invalid value #
+###########################################################
+set sql_mode=TRADITIONAL;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.completion_type = 10;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.completion_type = -1024;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.completion_type = 2.4;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.completion_type = OFF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.completion_type = 10;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.completion_type = -2;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.completion_type = 1.2;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.completion_type = ON;
+
+
+--echo '#------------------FN_DYNVARS_017_06-----------------------#'
+###############################################################################
+# Check if the value in GLOBAL & SESSION Tables matches value in variable #
+###############################################################################
+
+SELECT @@global.completion_type = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='completion_type';
+
+SELECT @@session.completion_type = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='completion_type';
+
+
+--echo '#------------------FN_DYNVARS_017_07-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.completion_type = TRUE;
+SELECT @@global.completion_type;
+SET @@global.completion_type = FALSE;
+SELECT @@global.completion_type;
+
+
+--echo '#---------------------FN_DYNVARS_001_08----------------------#'
+##############################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points #
+# to same session variable #
+##############################################################################
+
+SET @@completion_type = 1;
+SELECT @@completion_type = @@local.completion_type;
+SELECT @@local.completion_type = @@session.completion_type;
+
+
+--echo '#---------------------FN_DYNVARS_001_09----------------------#'
+##########################################################################
+# Check if completion_type can be accessed with and without @@ sign #
+##########################################################################
+
+SET completion_type = 1;
+SELECT @@completion_type;
+--Error ER_UNKNOWN_TABLE
+SELECT local.completion_type;
+--Error ER_UNKNOWN_TABLE
+SELECT session.completion_type;
+--Error ER_BAD_FIELD_ERROR
+SELECT completion_type = @@session.completion_type;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.completion_type = @start_global_value;
+SELECT @@global.completion_type;
+SET @@session.completion_type = @start_session_value;
+SELECT @@session.completion_type;
+set sql_mode='';
+
+############################################
+# END OF completion_type TESTS #
+############################################
+
diff --git a/mysql-test/suite/sys_vars/t/completion_type_func.test b/mysql-test/suite/sys_vars/t/completion_type_func.test
new file mode 100644
index 00000000..1de4ae88
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/completion_type_func.test
@@ -0,0 +1,171 @@
+############## mysql-test/suite/sys_vars/t/completion_type_func.test ###########
+# #
+# Variable Name: completion_type #
+# Scope: GLOBAL & SESSION #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 0 #
+# Valid Values: 0,1 & 2 #
+# #
+# #
+# Creation Date: 2008-03-07 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable "completion_type" #
+# that checks functionality of this variable #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_completion_type #
+# #
+################################################################################
+
+--source include/have_innodb.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+##############################
+# Setup: Table + connections #
+##############################
+
+--echo ## Creating new table ##
+CREATE TABLE t1
+(
+id INT NOT NULL,
+PRIMARY KEY (id),
+name VARCHAR(30)
+) ENGINE = INNODB;
+
+connect (test_con1,localhost,root,,);
+connect (test_con2,localhost,root,,);
+
+connection default;
+
+--echo #########################################################
+--echo # Setting initial value of completion_type to zero #
+--echo #########################################################
+
+INSERT INTO t1 VALUES(1,'Record_1');
+SELECT * FROM t1;
+
+--echo ## Setting value of variable to 0 ##
+SET @@session.completion_type = 0;
+
+--echo ## Here commit & rollback should work normally ##
+--echo ## test commit ##
+START TRANSACTION;
+INSERT INTO t1 VALUES(2,'Record_2');
+INSERT INTO t1 VALUES(3,'Record_3');
+SELECT * FROM t1;
+
+connection test_con1;
+--echo ## Don't expect to see id's 2 and 3 in the table w/o COMMIT ##
+SELECT * FROM t1;
+
+connection default;
+COMMIT;
+
+--echo ## test rollback ##
+START TRANSACTION;
+INSERT INTO t1 VALUES(4,'Record_4');
+INSERT INTO t1 VALUES(5,'Record_5');
+SELECT * FROM t1;
+
+connection test_con1;
+--echo ## Don't expect to see id's 4 and 5 here ##
+--echo ## Expect to see 3, Record_3 ##
+SELECT * FROM t1;
+
+connection default;
+
+
+ROLLBACK;
+--echo ## Don't expect to see id's 4 and 5 now ##
+SELECT * FROM t1;
+
+--echo
+--echo #########################################################
+--echo # Setting initial value of completion_type to one #
+--echo #########################################################
+
+connection test_con1;
+SET @@session.completion_type = 1;
+
+START TRANSACTION;
+SELECT * FROM t1;
+INSERT INTO t1 VALUES(6,'Record_6');
+INSERT INTO t1 VALUES(7,'Record_7');
+COMMIT;
+
+--echo ## Expect to immediately have a new transaction ##
+INSERT INTO t1 VALUES(8,'Record_8');
+SELECT * FROM t1;
+
+connection test_con2;
+--echo ## Do not expect to see 8, Record_8 as no COMMIT has occurred ##
+SELECT * FROM t1;
+
+connection test_con1;
+
+--echo ## Testing ROLLBACK behavior
+START TRANSACTION;
+INSERT INTO t1 VALUES(9, 'Record_9');
+INSERT INTO t1 VALUES(10, 'Record_10');
+--echo ## Expect to see id's 8, 9, 10 here ##
+--echo ## 8, Record_8 COMMITted with the start of this transaction ##
+SELECT * FROM t1;
+ROLLBACK;
+--echo ## id's 9 and 10 are gone now due to ROLLBACK ##
+SELECT * FROM t1;
+
+--echo ## Expect a new transaction ##
+INSERT INTO t1 VALUES(9, 'Record_9');
+
+connection test_con2;
+--echo ## Don't expect to see 9, Record_9 due to no COMMIT yet ##
+SELECT * FROM t1;
+
+connection test_con1;
+ROLLBACK;
+--echo ## Don't expect to see 9, Record_9
+SELECT * FROM t1;
+
+--echo #########################################################
+--echo # Setting initial value of completion_type to 2 #
+--echo #########################################################
+
+SET @@session.completion_type = 2;
+
+--echo ## Here commit should work as COMMIT RELEASE ##
+START TRANSACTION;
+SELECT * FROM t1;
+INSERT INTO t1 VALUES(9,'Record_9');
+INSERT INTO t1 VALUES(10,'Record_10');
+COMMIT;
+
+--echo ## Inserting rows should give error here because connection should ##
+--echo ## disconnect after using COMMIT ##
+--Error 2006,2013,ER_QUERY_INTERRUPTED,ER_CONNECTION_KILLED,5014,2026
+INSERT INTO t1 VALUES(4,'Record_4');
+
+connection test_con2;
+SET @@session.completion_type = 2;
+
+--echo ## Inserting rows and using Rollback which should Rollback & release ##
+START TRANSACTION;
+SELECT * FROM t1;
+INSERT INTO t1 VALUES(11,'Record_11');
+INSERT INTO t1 VALUES(12,'Record_12');
+ROLLBACK;
+
+--echo ## Expect a failure due to COMMIT/ROLLBACK AND RELEASE behavior ##
+--Error 2006,2013,ER_QUERY_INTERRUPTED,ER_CONNECTION_KILLED,5014,2026
+INSERT INTO t1 VALUES(4,'Record_4');
+
+connection default;
+disconnect test_con1;
+disconnect test_con2;
+
+DROP TABLE t1;
+
diff --git a/mysql-test/suite/sys_vars/t/concurrent_insert_basic.test b/mysql-test/suite/sys_vars/t/concurrent_insert_basic.test
new file mode 100644
index 00000000..6f089150
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/concurrent_insert_basic.test
@@ -0,0 +1,182 @@
+############## mysql-test\t\concurrent_insert_basic.test #######################
+# #
+# Variable Name: concurrent_insert #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: Boolean & Numeric #
+# Default Value: 1 #
+# Valid Values: 0,1 & 2 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable "concurrent_insert" #
+# that checks behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity . #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_concurrent_insert #
+# #
+################################################################################
+
+--source include/load_sysvars.inc
+
+#################################################################
+# START OF concurrent_insert TESTS #
+#################################################################
+
+
+#########################################################################
+# Saving initial value of concurrent_insert in a temporary variable #
+#########################################################################
+
+SET @start_value = @@global.concurrent_insert;
+SELECT @start_value;
+
+--echo '#--------------------FN_DYNVARS_018_01------------------------#'
+#########################################################################
+# Display the DEFAULT value of concurrent_insert #
+#########################################################################
+
+SET @@global.concurrent_insert = 0;
+SET @@global.concurrent_insert = DEFAULT;
+SELECT @@global.concurrent_insert;
+
+--echo '#---------------------FN_DYNVARS_018_02-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@global.concurrent_insert = DEFAULT;
+SELECT @@global.concurrent_insert = 1;
+
+
+--echo '#--------------------FN_DYNVARS_018_03------------------------#'
+#########################################################################
+# Change the value of concurrent_insert to a valid value #
+#########################################################################
+
+SET @@global.concurrent_insert = 0;
+SELECT @@global.concurrent_insert;
+SET @@global.concurrent_insert = 1;
+SELECT @@global.concurrent_insert;
+SET @@global.concurrent_insert = 2;
+SELECT @@global.concurrent_insert;
+
+SET @@global.concurrent_insert = NEVER;
+SELECT @@global.concurrent_insert;
+SET @@global.concurrent_insert = AUTO;
+SELECT @@global.concurrent_insert;
+SET @@global.concurrent_insert = ALWAYS;
+SELECT @@global.concurrent_insert;
+
+--echo '#--------------------FN_DYNVARS_018_04-------------------------#'
+###########################################################################
+# Change the value of concurrent_insert to invalid value #
+###########################################################################
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.concurrent_insert = -1;
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.concurrent_insert = 100;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.concurrent_insert = TRUEF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.concurrent_insert = TRUE_F;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.concurrent_insert = FALSE0;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.concurrent_insert = OON;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.concurrent_insert = ONN;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.concurrent_insert = OOFF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.concurrent_insert = 0FF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.concurrent_insert = ' ';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.concurrent_insert = " ";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.concurrent_insert = '';
+
+
+--echo '#-------------------FN_DYNVARS_018_05----------------------------#'
+#####################################################################
+# Test if accessing session concurrent_insert gives error #
+#####################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.concurrent_insert = 1;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.concurrent_insert = 1;
+
+
+--echo '#----------------------FN_DYNVARS_018_06------------------------#'
+####################################################################
+# Check if the value in GLOBAL Tables matches values in variable #
+####################################################################
+
+SELECT @@global.concurrent_insert = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='concurrent_insert';
+
+
+--echo '#---------------------FN_DYNVARS_018_07----------------------#'
+###################################################################
+# Check if ON and OFF values can be used on variable #
+###################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.concurrent_insert = OFF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.concurrent_insert = ON;
+
+
+--echo '#---------------------FN_DYNVARS_018_08----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.concurrent_insert = TRUE;
+SELECT @@global.concurrent_insert;
+SET @@global.concurrent_insert = FALSE;
+SELECT @@global.concurrent_insert;
+
+--echo '#---------------------FN_DYNVARS_018_09----------------------#'
+###############################################################################
+# Check if accessing variable without SCOPE points to same global variable #
+###############################################################################
+
+SET @@global.concurrent_insert = 1;
+SELECT @@concurrent_insert = @@global.concurrent_insert;
+
+
+--echo '#---------------------FN_DYNVARS_018_10----------------------#'
+###############################################################################
+# Check if concurrent_insert can be accessed with and without @@ sign #
+###############################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET concurrent_insert = 1;
+SELECT @@concurrent_insert;
+--Error ER_UNKNOWN_TABLE
+SELECT global.concurrent_insert;
+--Error ER_BAD_FIELD_ERROR
+SELECT concurrent_insert = @@session.concurrent_insert;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.concurrent_insert = @start_value;
+SELECT @@global.concurrent_insert;
+
+#######################################################
+# END OF concurrent_insert TESTS #
+#######################################################
+
diff --git a/mysql-test/suite/sys_vars/t/concurrent_insert_func.test b/mysql-test/suite/sys_vars/t/concurrent_insert_func.test
new file mode 100644
index 00000000..2f91cc99
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/concurrent_insert_func.test
@@ -0,0 +1,159 @@
+############## mysql-test\t\concurrent_insert_basic.test #######################
+# #
+# Variable Name: concurrent_insert #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: Boolean & Numeric #
+# Default Value: 1 #
+# Valid Values: 0,1 & 2 #
+# #
+# #
+# Creation Date: 2008-03-07 #
+# Author: Salman Rawala #
+# #
+# Modified: HHunger 2009-02-23 Inserted a wait condition right after the #
+# "INSERT ..record_6" to wait for the end of #
+# the insert. #
+# mleich This test needs some inporovements #
+# #
+# Description: Test Cases of Dynamic System Variable "concurrent_insert" #
+# that checks functionality of this variable #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# #
+################################################################################
+
+--source include/not_embedded.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+#########################
+# Creating new table #
+#########################
+
+--echo ## Creating new table ##
+CREATE TABLE t1
+(
+name VARCHAR(30)
+);
+
+--echo '#--------------------FN_DYNVARS_018_01-------------------------#'
+####################################################################
+# Setting initial value of concurrent_insert to 1
+# concurrent_insert = 1 means Enables concurrent insert
+# for MyISAM tables that don't have holes
+####################################################################
+
+SET @start_value= @@global.concurrent_insert;
+
+--echo ## Setting initial value of variable to 1 ##
+SET @@global.concurrent_insert = 1;
+INSERT INTO t1(name) VALUES('Record_1');
+INSERT INTO t1(name) VALUES('Record_2');
+INSERT INTO t1(name) VALUES('Record_3');
+
+--echo ## locking table ##
+LOCK TABLE t1 READ LOCAL;
+
+--echo ## Creating new connection to insert some rows in table ##
+connect (test_con1,localhost,root,,);
+connection test_con1;
+
+--echo ## New records should come at the end of all rows ##
+INSERT INTO t1(name) VALUES('Record_4');
+SELECT * FROM t1;
+
+--echo ## unlocking tables ##
+connection default;
+UNLOCK TABLES;
+
+--echo ## deleting record to create hole in table ##
+DELETE FROM t1 WHERE name ='Record_2';
+
+
+--echo '#--------------------FN_DYNVARS_018_02-------------------------#'
+####################################################################
+# Setting initial value of concurrent_insert to 1
+# concurrent_insert = 1 and trying to insert some values
+# in MyISAM tables that have holes
+####################################################################
+# lock table and connect with connection1
+LOCK TABLE t1 READ LOCAL;
+connection test_con1;
+
+# setting value of concurrent_insert to 1
+SET @@global.concurrent_insert=1;
+
+--echo ## send INSERT which should be blocked until unlock of the table ##
+send
+INSERT INTO t1(name) VALUES('Record_7');
+
+connection default;
+# wait until INSERT will be locked (low performance)
+let $wait_condition= SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
+ WHERE state= "Waiting for table level lock" AND
+ info LIKE "INSERT INTO t1%";
+--source include/wait_condition.inc
+
+--echo ## show processlist info and state ##
+SELECT state,info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE state= "Waiting for table level lock" AND info LIKE "INSERT INTO t1%";
+--echo ## table contents befor UNLOCK ##
+SELECT * FROM t1;
+UNLOCK TABLES;
+--echo ## table contens after UNLOCK ##
+SELECT * FROM t1;
+INSERT INTO t1(name) VALUES('Record_6');
+let $wait_condition= SELECT COUNT(*) = 5 FROM t1;
+--source include/wait_condition.inc
+
+connection test_con1;
+# to complete the send above^
+reap;
+SELECT * FROM t1;
+connection default;
+
+--echo '#--------------------FN_DYNVARS_018_03-------------------------#'
+################################################################################
+# Setting value of concurrent_insert to 2 to verify values after inserting
+# it into table with holes
+# concurrent_insert = 2 means Enables concurrent insert
+# for MyISAM tables that have holes but inserts values at the end of all rows
+################################################################################
+
+--echo ## lock table and connect with connection1 ##
+LOCK TABLE t1 READ LOCAL;
+connection test_con1;
+--echo ## setting value of concurrent_insert to 2 ##
+SET @@global.concurrent_insert=2;
+
+--echo ## Inserting record in table, record should go at the end of the table ##
+INSERT INTO t1(name) VALUES('Record_5');
+SELECT * FROM t1;
+SELECT @@concurrent_insert;
+
+connection default;
+
+--echo ## Unlocking table ##
+UNLOCK TABLES;
+
+SELECT * FROM t1;
+
+--echo ## Inserting new row, this should go in the hole ##
+INSERT INTO t1(name) VALUES('Record_6');
+SELECT * FROM t1;
+
+--echo ## connection test_con1 ##
+
+DELETE FROM t1 WHERE name ='Record_3';
+SELECT * FROM t1;
+
+--echo ## Dropping table ##
+DROP TABLE t1;
+
+disconnect test_con1;
+
+SET @@global.concurrent_insert= @start_value;
diff --git a/mysql-test/suite/sys_vars/t/connect_timeout_basic.test b/mysql-test/suite/sys_vars/t/connect_timeout_basic.test
new file mode 100644
index 00000000..b20006e5
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/connect_timeout_basic.test
@@ -0,0 +1,150 @@
+################# mysql-test\t\connect_timeout_basic.test ######################
+# #
+# Variable Name: connect_timeout #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 5 #
+# Range: 2 - 31536000 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable "connect_timeout" #
+# that checks behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity . #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_connect_timeout #
+# #
+################################################################################
+
+--source include/load_sysvars.inc
+
+###############################################################
+# START OF connect_timeout TESTS #
+###############################################################
+
+#######################################################################
+# Saving initial value of connect_timeout in a temporary variable #
+#######################################################################
+
+SET @start_value = @@global.connect_timeout;
+SELECT @start_value;
+
+--echo '#--------------------FN_DYNVARS_019_01------------------------#'
+#######################################################################
+# Display the DEFAULT value of connect_timeout #
+#######################################################################
+
+SET @@global.connect_timeout = 100;
+SET @@global.connect_timeout = DEFAULT;
+SELECT @@global.connect_timeout;
+
+
+--echo '#---------------------FN_DYNVARS_019_02-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@global.connect_timeout = @start_value;
+SELECT @@global.connect_timeout = 5;
+
+
+--echo '#--------------------FN_DYNVARS_019_03------------------------#'
+#######################################################################
+# Change the value of connect_timeout to a valid value #
+#######################################################################
+
+SET @@global.connect_timeout = 2;
+SELECT @@global.connect_timeout;
+SET @@global.connect_timeout = 10000;
+SELECT @@global.connect_timeout;
+SET @@global.connect_timeout = 21221204;
+SELECT @@global.connect_timeout;
+
+
+--echo '#--------------------FN_DYNVARS_019_04-------------------------#'
+##########################################################################
+# Change the value of connect_timeout to invalid value #
+##########################################################################
+
+SET @@global.connect_timeout = 1;
+SELECT @@global.connect_timeout;
+SET @@global.connect_timeout = -1024;
+SELECT @@global.connect_timeout;
+SET @@global.connect_timeout = 42949672950;
+SELECT @@global.connect_timeout;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.connect_timeout = 21221204.10;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.connect_timeout = ON;
+
+
+--echo '#-------------------FN_DYNVARS_019_05----------------------------#'
+##########################################################################
+# Test if accessing session connect_timeout gives error #
+##########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.connect_timeout = 0;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.connect_timeout;
+
+
+--echo '#----------------------FN_DYNVARS_019_06------------------------#'
+####################################################################
+# Check if the value in GLOBAL Tables matches values in variable #
+####################################################################
+
+SELECT @@global.connect_timeout = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='connect_timeout';
+
+--echo '#---------------------FN_DYNVARS_019_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.connect_timeout = TRUE;
+SELECT @@global.connect_timeout;
+SET @@global.connect_timeout = FALSE;
+SELECT @@global.connect_timeout;
+
+
+--echo '#---------------------FN_DYNVARS_019_08----------------------#'
+###############################################################################
+# Check if accessing variable without SCOPE points to same global variable #
+###############################################################################
+
+SET @@global.connect_timeout = 5;
+SELECT @@connect_timeout = @@global.connect_timeout;
+
+--echo '#---------------------FN_DYNVARS_019_09----------------------#'
+#########################################################################
+# Check if connect_timeout can be accessed with and without @@ sign #
+#########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET connect_timeout = 1;
+--Error ER_UNKNOWN_TABLE
+SELECT global.connect_timeout;
+--Error ER_BAD_FIELD_ERROR
+SELECT connect_timeout = @@session.connect_timeout;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.connect_timeout = @start_value;
+SELECT @@global.connect_timeout;
+
+
+#########################################################
+# END OF connect_timeout TESTS #
+#########################################################
+
diff --git a/mysql-test/suite/sys_vars/t/connect_timeout_grant.test b/mysql-test/suite/sys_vars/t/connect_timeout_grant.test
new file mode 100644
index 00000000..61a7a3eb
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/connect_timeout_grant.test
@@ -0,0 +1,56 @@
+--source include/not_embedded.inc
+
+SET @global=@@global.connect_timeout;
+
+--echo #
+--echo # MDEV-21961 Bind CONNECTION ADMIN to a number of global system variables
+--echo #
+
+--echo # Test that "SET connect_timeout" is not allowed without CONNECTION ADMIN or SUPER
+
+CREATE USER user1@localhost;
+GRANT ALL PRIVILEGES ON *.* TO user1@localhost;
+REVOKE CONNECTION ADMIN, SUPER ON *.* FROM user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+SET GLOBAL connect_timeout=10;
+--error ER_GLOBAL_VARIABLE
+SET connect_timeout=10;
+--error ER_GLOBAL_VARIABLE
+SET SESSION connect_timeout=10;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET connect_timeout" is allowed with CONNECTION ADMIN
+
+CREATE USER user1@localhost;
+GRANT CONNECTION ADMIN ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+SET GLOBAL connect_timeout=10;
+--error ER_GLOBAL_VARIABLE
+SET connect_timeout=10;
+--error ER_GLOBAL_VARIABLE
+SET SESSION connect_timeout=10;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET connect_timeout" is allowed with SUPER
+
+CREATE USER user1@localhost;
+GRANT SUPER ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+SET GLOBAL connect_timeout=10;
+--error ER_GLOBAL_VARIABLE
+SET connect_timeout=10;
+--error ER_GLOBAL_VARIABLE
+SET SESSION connect_timeout=10;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+SET @@global.connect_timeout=@global;
diff --git a/mysql-test/suite/sys_vars/t/datadir_basic.test b/mysql-test/suite/sys_vars/t/datadir_basic.test
new file mode 100644
index 00000000..7fae68fa
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/datadir_basic.test
@@ -0,0 +1,100 @@
+
+
+################## mysql-test\t\datadir_basic.test ############################
+# #
+# Variable Name: datadir #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: filename #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable datadir #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--echo '#---------------------BS_STVARS_004_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.datadir);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_004_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.datadir=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.datadir);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_004_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+SELECT @@GLOBAL.datadir = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='datadir';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.datadir);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='datadir';
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_004_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@datadir = @@GLOBAL.datadir;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_004_05----------------------#'
+################################################################################
+# Check if datadir can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@datadir);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.datadir);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.datadir);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.datadir);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT datadir = @@SESSION.datadir;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/date_format_basic.test b/mysql-test/suite/sys_vars/t/date_format_basic.test
new file mode 100644
index 00000000..a69295b4
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/date_format_basic.test
@@ -0,0 +1,18 @@
+#
+# show the global and session values;
+#
+select @@global.date_format;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.date_format;
+show global variables like 'date_format';
+show session variables like 'date_format';
+select * from information_schema.global_variables where variable_name='date_format';
+select * from information_schema.session_variables where variable_name='date_format';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global date_format="foo";
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session date_format="foo";
diff --git a/mysql-test/suite/sys_vars/t/datetime_format_basic.test b/mysql-test/suite/sys_vars/t/datetime_format_basic.test
new file mode 100644
index 00000000..553d3126
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/datetime_format_basic.test
@@ -0,0 +1,18 @@
+#
+# show the global and session values;
+#
+select @@global.datetime_format;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.datetime_format;
+show global variables like 'datetime_format';
+show session variables like 'datetime_format';
+select * from information_schema.global_variables where variable_name='datetime_format';
+select * from information_schema.session_variables where variable_name='datetime_format';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global datetime_format="foo";
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session datetime_format="foo";
diff --git a/mysql-test/suite/sys_vars/t/deadlock_search_depth_long_basic.test b/mysql-test/suite/sys_vars/t/deadlock_search_depth_long_basic.test
new file mode 100644
index 00000000..1862015b
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/deadlock_search_depth_long_basic.test
@@ -0,0 +1,42 @@
+# ulong session
+
+SET @start_global_value = @@global.deadlock_search_depth_long;
+
+#
+# exists as global only
+#
+select @@global.deadlock_search_depth_long;
+select @@session.deadlock_search_depth_long;
+show global variables like 'deadlock_search_depth_long';
+show session variables like 'deadlock_search_depth_long';
+select * from information_schema.global_variables where variable_name='deadlock_search_depth_long';
+select * from information_schema.session_variables where variable_name='deadlock_search_depth_long';
+
+#
+# show that it's writable
+#
+set global deadlock_search_depth_long=10;
+select @@global.deadlock_search_depth_long;
+set session deadlock_search_depth_long=10;
+select @@session.deadlock_search_depth_long;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global deadlock_search_depth_long=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set session deadlock_search_depth_long=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global deadlock_search_depth_long="foo";
+
+#
+# min/max values, block size
+#
+set global deadlock_search_depth_long=0;
+select @@global.deadlock_search_depth_long;
+set session deadlock_search_depth_long=cast(-1 as unsigned int);
+select @@session.deadlock_search_depth_long;
+
+SET @@global.deadlock_search_depth_long = @start_global_value;
+
diff --git a/mysql-test/suite/sys_vars/t/deadlock_search_depth_short_basic.test b/mysql-test/suite/sys_vars/t/deadlock_search_depth_short_basic.test
new file mode 100644
index 00000000..3df6fb92
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/deadlock_search_depth_short_basic.test
@@ -0,0 +1,42 @@
+# ulong session
+
+SET @start_global_value = @@global.deadlock_search_depth_short;
+
+#
+# exists as global only
+#
+select @@global.deadlock_search_depth_short;
+select @@session.deadlock_search_depth_short;
+show global variables like 'deadlock_search_depth_short';
+show session variables like 'deadlock_search_depth_short';
+select * from information_schema.global_variables where variable_name='deadlock_search_depth_short';
+select * from information_schema.session_variables where variable_name='deadlock_search_depth_short';
+
+#
+# show that it's writable
+#
+set global deadlock_search_depth_short=10;
+select @@global.deadlock_search_depth_short;
+set session deadlock_search_depth_short=10;
+select @@session.deadlock_search_depth_short;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global deadlock_search_depth_short=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set session deadlock_search_depth_short=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global deadlock_search_depth_short="foo";
+
+#
+# min/max values, block size
+#
+set global deadlock_search_depth_short=0;
+select @@global.deadlock_search_depth_short;
+set session deadlock_search_depth_short=cast(-1 as unsigned int);
+select @@session.deadlock_search_depth_short;
+
+SET @@global.deadlock_search_depth_short = @start_global_value;
+
diff --git a/mysql-test/suite/sys_vars/t/deadlock_timeout_long_basic.test b/mysql-test/suite/sys_vars/t/deadlock_timeout_long_basic.test
new file mode 100644
index 00000000..4ebc3cc0
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/deadlock_timeout_long_basic.test
@@ -0,0 +1,42 @@
+# ulong session
+
+SET @start_global_value = @@global.deadlock_timeout_long;
+
+#
+# exists as global only
+#
+select @@global.deadlock_timeout_long;
+select @@session.deadlock_timeout_long;
+show global variables like 'deadlock_timeout_long';
+show session variables like 'deadlock_timeout_long';
+select * from information_schema.global_variables where variable_name='deadlock_timeout_long';
+select * from information_schema.session_variables where variable_name='deadlock_timeout_long';
+
+#
+# show that it's writable
+#
+set global deadlock_timeout_long=10;
+select @@global.deadlock_timeout_long;
+set session deadlock_timeout_long=10;
+select @@session.deadlock_timeout_long;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global deadlock_timeout_long=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set session deadlock_timeout_long=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global deadlock_timeout_long="foo";
+
+#
+# min/max values, block size
+#
+set global deadlock_timeout_long=0;
+select @@global.deadlock_timeout_long;
+set session deadlock_timeout_long=cast(-1 as unsigned int);
+select @@session.deadlock_timeout_long;
+
+SET @@global.deadlock_timeout_long = @start_global_value;
+
diff --git a/mysql-test/suite/sys_vars/t/deadlock_timeout_short_basic.test b/mysql-test/suite/sys_vars/t/deadlock_timeout_short_basic.test
new file mode 100644
index 00000000..86beeaea
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/deadlock_timeout_short_basic.test
@@ -0,0 +1,42 @@
+# ulong session
+
+SET @start_global_value = @@global.deadlock_timeout_short;
+
+#
+# exists as global only
+#
+select @@global.deadlock_timeout_short;
+select @@session.deadlock_timeout_short;
+show global variables like 'deadlock_timeout_short';
+show session variables like 'deadlock_timeout_short';
+select * from information_schema.global_variables where variable_name='deadlock_timeout_short';
+select * from information_schema.session_variables where variable_name='deadlock_timeout_short';
+
+#
+# show that it's writable
+#
+set global deadlock_timeout_short=10;
+select @@global.deadlock_timeout_short;
+set session deadlock_timeout_short=10;
+select @@session.deadlock_timeout_short;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global deadlock_timeout_short=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set session deadlock_timeout_short=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global deadlock_timeout_short="foo";
+
+#
+# min/max values, block size
+#
+set global deadlock_timeout_short=0;
+select @@global.deadlock_timeout_short;
+set session deadlock_timeout_short=cast(-1 as unsigned int);
+select @@session.deadlock_timeout_short;
+
+SET @@global.deadlock_timeout_short = @start_global_value;
+
diff --git a/mysql-test/suite/sys_vars/t/debug_basic.test b/mysql-test/suite/sys_vars/t/debug_basic.test
new file mode 100644
index 00000000..b54626c3
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/debug_basic.test
@@ -0,0 +1,22 @@
+--source include/have_debug.inc
+#
+# exists both as global and session
+#
+set session debug="L";
+
+select @@global.debug="1"; # just to show that global.debug exists
+select @@session.debug; # here we know the value and can display it
+--replace_column 2 #
+show global variables like 'debug';
+show session variables like 'debug';
+--replace_column 2 #
+select * from information_schema.global_variables where variable_name="debug";
+select * from information_schema.session_variables where variable_name="debug";
+
+--error ER_WRONG_TYPE_FOR_VAR
+set @@global.debug=1;
+--error ER_WRONG_TYPE_FOR_VAR
+set @@global.debug=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set @@global.debug=1e1;
+
diff --git a/mysql-test/suite/sys_vars/t/debug_binlog_fsync_sleep_basic.test b/mysql-test/suite/sys_vars/t/debug_binlog_fsync_sleep_basic.test
new file mode 100644
index 00000000..20958d03
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/debug_binlog_fsync_sleep_basic.test
@@ -0,0 +1,44 @@
+# ulong global
+
+--source include/have_debug.inc
+
+SET @start_global_value = @@global.debug_binlog_fsync_sleep;
+
+#
+# exists as global only
+#
+select @@global.debug_binlog_fsync_sleep;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.debug_binlog_fsync_sleep;
+show global variables like 'debug_binlog_fsync_sleep';
+show session variables like 'debug_binlog_fsync_sleep';
+select * from information_schema.global_variables where variable_name='debug_binlog_fsync_sleep';
+select * from information_schema.session_variables where variable_name='debug_binlog_fsync_sleep';
+
+#
+# show that it's writable
+#
+set global debug_binlog_fsync_sleep=20;
+select @@global.debug_binlog_fsync_sleep;
+--error ER_GLOBAL_VARIABLE
+set session debug_binlog_fsync_sleep=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global debug_binlog_fsync_sleep=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global debug_binlog_fsync_sleep=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global debug_binlog_fsync_sleep="foo";
+
+#
+# min/max values, block size
+#
+set global debug_binlog_fsync_sleep=0;
+select @@global.debug_binlog_fsync_sleep;
+set global debug_binlog_fsync_sleep=cast(-1 as unsigned int);
+select @@global.debug_binlog_fsync_sleep;
+
+SET @@global.debug_binlog_fsync_sleep = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/debug_dbug_basic.test b/mysql-test/suite/sys_vars/t/debug_dbug_basic.test
new file mode 100644
index 00000000..44471bf1
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/debug_dbug_basic.test
@@ -0,0 +1,22 @@
+--source include/have_debug.inc
+#
+# exists both as global and session
+#
+set session debug_dbug="L";
+
+select @@global.debug_dbug="1"; # just to show that global.debug exists
+select @@session.debug; # here we know the value and can display it
+--replace_column 2 #
+show global variables like 'debug';
+show session variables like 'debug';
+--replace_column 2 #
+select * from information_schema.global_variables where variable_name="debug";
+select * from information_schema.session_variables where variable_name="debug";
+
+--error ER_WRONG_TYPE_FOR_VAR
+set @@global.debug_dbug=1;
+--error ER_WRONG_TYPE_FOR_VAR
+set @@global.debug_dbug=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set @@global.debug_dbug=1e1;
+
diff --git a/mysql-test/suite/sys_vars/t/debug_dbug_func.test b/mysql-test/suite/sys_vars/t/debug_dbug_func.test
new file mode 100644
index 00000000..a7263613
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/debug_dbug_func.test
@@ -0,0 +1,127 @@
+--source include/have_debug.inc
+
+SET @old_debug = @@GLOBAL.debug_dbug;
+
+#
+# Bug#34678 @@debug_dbug variable's incremental mode
+#
+
+SET debug_dbug= 'T';
+select @@debug_dbug;
+SET debug_dbug= '+P';
+select @@debug_dbug;
+SET debug_dbug= '-P';
+select @@debug_dbug;
+
+#
+# Bug#38054: "SET SESSION debug" modifies @@global.debug_dbug variable
+#
+
+SELECT @@session.debug_dbug, @@global.debug_dbug;
+
+SET SESSION debug_dbug= '';
+
+SELECT @@session.debug_dbug, @@global.debug_dbug;
+
+--echo #
+--echo # Bug #52629: memory leak from sys_var_thd_dbug in
+--echo # binlog.binlog_write_error
+--echo #
+
+SET GLOBAL debug_dbug='d,injecting_fault_writing';
+SELECT @@global.debug_dbug;
+SET GLOBAL debug_dbug='';
+SELECT @@global.debug_dbug;
+
+SET GLOBAL debug_dbug=@old_debug;
+
+--echo #
+--echo # Bug #56709: Memory leaks at running the 5.1 test suite
+--echo #
+
+SET @old_local_debug = @@debug_dbug;
+
+SET @@debug_dbug='d,foo';
+SELECT @@debug_dbug;
+SET @@debug_dbug='';
+SELECT @@debug_dbug;
+
+SET @@debug_dbug= @old_local_debug;
+
+--echo End of 5.1 tests
+
+
+--echo #
+--echo # Bug#46165 server crash in dbug
+--echo #
+
+SET @old_globaldebug = @@global.debug_dbug;
+SET @old_sessiondebug= @@session.debug_dbug;
+
+--echo # Test 1 - Bug test case, single connection
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval SET GLOBAL debug_dbug= '+O,$MYSQL_TMP_DIR/bug46165.1.trace';
+SET SESSION debug_dbug= '-d:-t:-i';
+
+SET GLOBAL debug_dbug= '';
+SET SESSION debug_dbug= '';
+
+--echo # Test 2 - Bug test case, two connections
+connection default;
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval SET GLOBAL debug_dbug= '+O,$MYSQL_TMP_DIR/bug46165.2.trace';
+SET SESSION debug_dbug= '-d:-t:-i';
+
+connect (con1, localhost, root);
+SET GLOBAL debug_dbug= '';
+
+connection default;
+SET SESSION debug_dbug= '';
+connection con1;
+disconnect con1;
+--source include/wait_until_disconnected.inc
+connection default;
+SET GLOBAL debug_dbug= '';
+
+--echo # Test 3 - Active session trace file on disconnect
+connect (con1, localhost, root);
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval SET GLOBAL debug_dbug= '+O,$MYSQL_TMP_DIR/bug46165.3.trace';
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+SELECT @@global.debug_dbug, @@session.debug_dbug;
+SET SESSION debug_dbug= '+T';
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+SELECT @@global.debug_dbug, @@session.debug_dbug;
+SET GLOBAL debug_dbug= '';
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+SELECT @@global.debug_dbug, @@session.debug_dbug;
+disconnect con1;
+--source include/wait_until_disconnected.inc
+
+--echo # Test 4 - Active session trace file on two connections
+connection default;
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval SET GLOBAL debug_dbug= '+O,$MYSQL_TMP_DIR/bug46165.4.trace';
+SET SESSION debug_dbug= '-d:-t:-i';
+
+connect (con1, localhost, root);
+SET SESSION debug_dbug= '-d:-t:-i';
+SET GLOBAL debug_dbug= '';
+SET SESSION debug_dbug= '';
+
+connection default;
+SET SESSION debug_dbug= '';
+connection con1;
+disconnect con1;
+--source include/wait_until_disconnected.inc
+connection default;
+
+--echo # Test 5 - Different trace files
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval SET SESSION debug_dbug= '+O,$MYSQL_TMP_DIR/bug46165.5.trace';
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval SET SESSION debug_dbug= '+O,$MYSQL_TMP_DIR/bug46165.6.trace';
+SET SESSION debug_dbug= '-O';
+
+SET GLOBAL debug_dbug= @old_globaldebug;
+SET SESSION debug_dbug= @old_sessiondebug;
diff --git a/mysql-test/suite/sys_vars/t/debug_dbug_func_notembedded.test b/mysql-test/suite/sys_vars/t/debug_dbug_func_notembedded.test
new file mode 100644
index 00000000..cb379746
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/debug_dbug_func_notembedded.test
@@ -0,0 +1,34 @@
+#
+# Checks that assigning variable 'debug' in one session has no influence on
+# other session. (BUG#45632 of bugs.mysql.com)
+#
+# (this will not work with embedded server because mysqltest_embedded uses the
+# same thread for all connections)
+#
+--source include/have_debug.inc
+--source include/not_embedded.inc
+
+connect(con1,localhost,root,,test,,);
+connect(con2,localhost,root,,test,,);
+
+# makes output independant of current debug status
+connection con1;
+set session debug_dbug="t";
+show session variables like 'debug';
+connection con2;
+set session debug_dbug="t";
+show session variables like 'debug';
+
+# checks influence one session debug variable on another
+connection con1;
+set session debug_dbug="d:t";
+show session variables like 'debug';
+connection con2;
+show session variables like 'debug';
+
+disconnect con1;
+disconnect con2;
+
+connection default;
+
+
diff --git a/mysql-test/suite/sys_vars/t/debug_mutex_deadlock_detector_basic.test b/mysql-test/suite/sys_vars/t/debug_mutex_deadlock_detector_basic.test
new file mode 100644
index 00000000..12b29a30
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/debug_mutex_deadlock_detector_basic.test
@@ -0,0 +1,23 @@
+--source include/have_mutex_deadlock_detector.inc
+
+# bool readonly
+
+#
+# show the global and session values;
+#
+select @@global.debug_mutex_deadlock_detector;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.debug_mutex_deadlock_detector;
+show global variables like 'debug_mutex_deadlock_detector';
+show session variables like 'debug_mutex_deadlock_detector';
+select * from information_schema.global_variables where variable_name='debug_mutex_deadlock_detector';
+select * from information_schema.session_variables where variable_name='debug_mutex_deadlock_detector';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global debug_mutex_deadlock_detector=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session debug_mutex_deadlock_detector=1;
+
diff --git a/mysql-test/suite/sys_vars/t/debug_no_thread_alarm_basic.test b/mysql-test/suite/sys_vars/t/debug_no_thread_alarm_basic.test
new file mode 100644
index 00000000..39823ba2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/debug_no_thread_alarm_basic.test
@@ -0,0 +1,21 @@
+# bool readonly
+
+#
+# show values;
+#
+select @@global.debug_no_thread_alarm;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.debug_no_thread_alarm;
+show global variables like 'debug_no_thread_alarm';
+show session variables like 'debug_no_thread_alarm';
+select * from information_schema.global_variables where variable_name='debug_no_thread_alarm';
+select * from information_schema.session_variables where variable_name='debug_no_thread_alarm';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global debug_no_thread_alarm=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session debug_no_thread_alarm=1;
+
diff --git a/mysql-test/suite/sys_vars/t/debug_sync_basic.test b/mysql-test/suite/sys_vars/t/debug_sync_basic.test
new file mode 100644
index 00000000..c2c4df95
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/debug_sync_basic.test
@@ -0,0 +1,21 @@
+--source include/have_debug_sync.inc
+#
+# exists as session only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@global.debug_sync;
+select @@session.debug_sync;
+
+show global variables like "debug_sync";
+show session variables like "debug_sync";
+
+select * from information_schema.global_variables where variable_name="debug_sync";
+select * from information_schema.session_variables where variable_name="debug_sync";
+
+--error ER_WRONG_TYPE_FOR_VAR
+set @@session.debug_sync=1;
+--error ER_WRONG_TYPE_FOR_VAR
+set @@session.debug_sync=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set @@session.debug_sync=1e1;
+
diff --git a/mysql-test/suite/sys_vars/t/default_master_connection_basic.test b/mysql-test/suite/sys_vars/t/default_master_connection_basic.test
new file mode 100644
index 00000000..ae91bc46
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/default_master_connection_basic.test
@@ -0,0 +1,124 @@
+############## mysql-test\t\default_master_connection_basic.test ###############
+#
+# Implemented in the scope of MDEV-253
+# The variable is SESSION-only
+#
+
+--source include/not_embedded.inc
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_session_value = @@session.default_master_connection;
+SELECT @start_session_value;
+
+###################################################################
+# Display the DEFAULT value of default_master_connection #
+###################################################################
+
+SET @@session.default_master_connection = 'bar';
+SET @@session.default_master_connection = DEFAULT;
+SELECT @@session.default_master_connection;
+
+###################################################################
+# Check the DEFAULT value of default_master_connection #
+###################################################################
+
+SET @@session.default_master_connection = @start_session_value;
+SELECT @@session.default_master_connection = '';
+
+#################################################
+# Check that the GLOBAL scope is not applicable #
+#################################################
+
+--error ER_LOCAL_VARIABLE
+SET @@global.default_master_connection = 'master1';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@global.default_master_connection;
+
+####################################################################################
+# Change the value of default_master_connection to a valid value for SESSION Scope #
+####################################################################################
+
+SET @@session.default_master_connection = 'master1';
+SELECT @@session.default_master_connection;
+SET @@session.default_master_connection = '';
+SELECT @@session.default_master_connection;
+SET @@session.default_master_connection = '1234-5678';
+SELECT @@session.default_master_connection;
+SET @@session.default_master_connection = '@!*/"';
+SELECT @@session.default_master_connection;
+SET @@session.default_master_connection = REPEAT('a',191);
+SELECT @@session.default_master_connection;
+SET @@session.default_master_connection = master2;
+SELECT @@session.default_master_connection;
+
+
+#####################################################################
+# Change the value of default_master_connection to an invalid value #
+#####################################################################
+
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@session.default_master_connection = 1;
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@session.default_master_connection = 65530.30;
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@session.default_master_connection = FALSE;
+SELECT @@session.default_master_connection;
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@session.default_master_connection = REPEAT('a',192);
+SELECT @@session.default_master_connection;
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@session.default_master_connection = NULL;
+SELECT @@session.default_master_connection;
+
+###############################################################################
+# Check if the value in GLOBAL & SESSION Tables matches value in variable #
+###############################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@global.default_master_connection = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='default_master_connection';
+
+SELECT @@session.default_master_connection = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='default_master_connection';
+
+
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@default_master_connection = 'foo';
+SELECT @@default_master_connection = @@local.default_master_connection;
+SELECT @@local.default_master_connection = @@session.default_master_connection;
+
+
+###################################################################################
+# Check if default_master_connection can be accessed with and without @@ sign #
+###################################################################################
+
+SET default_master_connection = 'foo';
+SELECT @@default_master_connection;
+--Error ER_UNKNOWN_TABLE
+SELECT local.default_master_connection;
+--Error ER_UNKNOWN_TABLE
+SELECT session.default_master_connection;
+--Error ER_BAD_FIELD_ERROR
+SELECT default_master_connection = @@session.default_master_connection;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@session.default_master_connection = @start_session_value;
+SELECT @@session.default_master_connection;
+
+
+#############################################################
+# END OF default_master_connection TESTS #
+#############################################################
+
diff --git a/mysql-test/suite/sys_vars/t/default_regex_flags_basic.test b/mysql-test/suite/sys_vars/t/default_regex_flags_basic.test
new file mode 100644
index 00000000..ca72c5ce
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/default_regex_flags_basic.test
@@ -0,0 +1,41 @@
+
+SET default_regex_flags='';
+SELECT @@default_regex_flags;
+SET default_regex_flags=DEFAULT;
+SELECT @@default_regex_flags;
+--error ER_WRONG_VALUE_FOR_VAR
+SET default_regex_flags=NULL;
+SELECT @@default_regex_flags;
+--error ER_WRONG_VALUE_FOR_VAR
+SET default_regex_flags='UNKNOWN';
+--error ER_WRONG_VALUE_FOR_VAR
+SET default_regex_flags=325;
+--error ER_WRONG_TYPE_FOR_VAR
+SET default_regex_flags=123.0;
+--error ER_WRONG_TYPE_FOR_VAR
+SET default_regex_flags=123e0;
+SET default_regex_flags='DOTALL';
+SELECT @@default_regex_flags;
+--error ER_WRONG_VALUE_FOR_VAR
+SET default_regex_flags=NULL;
+SELECT @@default_regex_flags;
+
+SET @@default_regex_flags=63;
+SELECT @@default_regex_flags;
+SET @@default_regex_flags='DOTALL';
+SELECT @@default_regex_flags;
+SET @@default_regex_flags='DOTALL,DUPNAMES,EXTENDED,EXTRA,MULTILINE,UNGREEDY';
+SELECT @@default_regex_flags;
+SET @@default_regex_flags=DEFAULT;
+
+SET @@global.default_regex_flags='MULTILINE';
+SELECT @@session.default_regex_flags;
+connect (con1,localhost,root,,);
+connection con1;
+SELECT @@session.default_regex_flags;
+connection default;
+disconnect con1;
+SELECT @@session.default_regex_flags;
+SET @@global.default_regex_flags=DEFAULT;
+
+SET default_regex_flags=DEFAULT;
diff --git a/mysql-test/suite/sys_vars/t/default_storage_engine_basic.test b/mysql-test/suite/sys_vars/t/default_storage_engine_basic.test
new file mode 100644
index 00000000..3e805688
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/default_storage_engine_basic.test
@@ -0,0 +1,181 @@
+############## mysql-test\t\storage_engine_basic.test ##################
+# #
+# #
+# Creation Date: 2008-02-14 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable #
+# default_storage_engine that check behavior of this #
+# variable with valid values, invalid values, accessing #
+# variable with scope that is allowed and with scope that #
+# is now allowed. #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_storage_engine #
+# #
+########################################################################
+
+--source include/not_embedded.inc
+--source include/have_innodb.inc
+--source include/load_sysvars.inc
+
+######################################################################
+# START OF default_storage_engine TESTS #
+######################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.default_storage_engine;
+SET @start_session_value = @@session.default_storage_engine;
+
+
+--echo '#--------------------FN_DYNVARS_005_01-------------------------#'
+######################################################################
+# Display the DEFAULT value of default_storage_engine #
+######################################################################
+
+SET @@global.default_storage_engine = INNODB;
+SET @@global.default_storage_engine = DEFAULT;
+--replace_result MyISAM InnoDB
+SELECT @@global.default_storage_engine;
+
+SET @@session.default_storage_engine = INNODB;
+SET @@session.default_storage_engine = DEFAULT;
+--replace_result MyISAM InnoDB
+SELECT @@session.default_storage_engine;
+
+
+--echo '#--------------------FN_DYNVARS_005_02-------------------------#'
+########################################################################
+# Change the value of default_storage_engine to a valid value for GLOBAL Scope #
+########################################################################
+
+SET @@global.default_storage_engine = MYISAM;
+SELECT @@global.default_storage_engine;
+SET @@global.default_storage_engine = MERGE;
+SELECT @@global.default_storage_engine;
+SET @@global.default_storage_engine = MEMORY;
+SELECT @@global.default_storage_engine;
+SET @@global.default_storage_engine = INNODB;
+SELECT @@global.default_storage_engine;
+
+
+--echo '#--------------------FN_DYNVARS_005_03-------------------------#'
+#########################################################################
+# Change the value of default_storage_engine to a valid value for SESSION Scope #
+#########################################################################
+
+SET @@session.default_storage_engine = MYISAM;
+SELECT @@session.default_storage_engine;
+SET @@session.default_storage_engine = MERGE;
+SELECT @@session.default_storage_engine;
+SET @@session.default_storage_engine = MEMORY;
+SELECT @@session.default_storage_engine;
+SET @@session.default_storage_engine = INNODB;
+SELECT @@session.default_storage_engine;
+
+
+--echo '#------------------FN_DYNVARS_005_04-----------------------#'
+##################################################################
+# Change the value of default_storage_engine to an invalid value #
+##################################################################
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.default_storage_engine = 8199;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.default_storage_engine = NULL;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.default_storage_engine = -1024;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.default_storage_engine = 65530.34;
+
+--Error ER_UNKNOWN_STORAGE_ENGINE
+SET @@global.default_storage_engine = FILE;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.default_storage_engine = 8199;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.default_storage_engine = 65530.34;
+
+--Error ER_UNKNOWN_STORAGE_ENGINE
+SET @@session.default_storage_engine = RECORD;
+
+
+--echo '#------------------FN_DYNVARS_005_05-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT @@global.default_storage_engine =
+ VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='default_storage_engine';
+
+--echo '#------------------FN_DYNVARS_005_06-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.default_storage_engine =
+ VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+ WHERE VARIABLE_NAME='default_storage_engine';
+
+
+--echo '#------------------FN_DYNVARS_005_07-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.default_storage_engine = TRUE;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.default_storage_engine = FALSE;
+
+
+--echo '#---------------------FN_DYNVARS_001_8----------------------#'
+###############################################################
+# Check if accessing variable with SESSION,LOCAL and without #
+# SCOPE points to same session variable #
+###############################################################
+
+SET @@default_storage_engine = MYISAM;
+SELECT @@default_storage_engine = @@local.default_storage_engine;
+SELECT @@local.default_storage_engine = @@session.default_storage_engine;
+
+
+--echo '#---------------------FN_DYNVARS_001_9----------------------#'
+#########################################################################
+# Check if default_storage_engine can be accessed with and without @@ sign #
+#########################################################################
+
+SET default_storage_engine = MEMORY;
+SELECT @@default_storage_engine;
+--Error ER_UNKNOWN_TABLE
+SELECT local.default_storage_engine;
+--Error ER_UNKNOWN_TABLE
+SELECT session.default_storage_engine;
+--Error ER_BAD_FIELD_ERROR
+SELECT default_storage_engine = @@session.default_storage_engine;
+
+# check the old obsolete name
+SET @@default_storage_engine = @start_global_value;
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.default_storage_engine = @start_global_value;
+SET @@session.default_storage_engine = @start_session_value;
+
+#############################################################
+# END OF default_storage_engine TESTS #
+#############################################################
+
diff --git a/mysql-test/suite/sys_vars/t/default_tmp_storage_engine_basic.test b/mysql-test/suite/sys_vars/t/default_tmp_storage_engine_basic.test
new file mode 100644
index 00000000..26512cc3
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/default_tmp_storage_engine_basic.test
@@ -0,0 +1,193 @@
+######################################################################
+# START OF default_tmp_storage_engine TESTS #
+######################################################################
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.default_tmp_storage_engine;
+SELECT @start_global_value;
+SET @start_session_value = @@session.default_tmp_storage_engine;
+SELECT @start_session_value;
+
+--echo '#--------------------FN_DYNVARS_005_01-------------------------#'
+######################################################################
+# Display the DEFAULT value of default_tmp_storage_engine #
+######################################################################
+
+SET @@global.default_tmp_storage_engine = MEMORY;
+SET @@global.default_tmp_storage_engine = DEFAULT;
+SELECT @@global.default_tmp_storage_engine;
+
+SET @@session.default_tmp_storage_engine = MEMORY;
+SET @@session.default_tmp_storage_engine = DEFAULT;
+SELECT @@session.default_tmp_storage_engine;
+
+
+--echo '#--------------------FN_DYNVARS_005_02-------------------------#'
+########################################################################
+# Change the value of default_tmp_storage_engine to a valid value for GLOBAL Scope #
+########################################################################
+
+SET @@global.default_tmp_storage_engine = MYISAM;
+SELECT @@global.default_tmp_storage_engine;
+SET @@global.default_tmp_storage_engine = MERGE;
+SELECT @@global.default_tmp_storage_engine;
+SET @@global.default_tmp_storage_engine = MEMORY;
+SELECT @@global.default_tmp_storage_engine;
+
+--echo '#--------------------FN_DYNVARS_005_03-------------------------#'
+#########################################################################
+# Change the value of default_tmp_storage_engine to a valid value for SESSION Scope #
+#########################################################################
+
+SET @@session.default_tmp_storage_engine = MYISAM;
+SELECT @@session.default_tmp_storage_engine;
+SET @@session.default_tmp_storage_engine = MERGE;
+SELECT @@session.default_tmp_storage_engine;
+SET @@session.default_tmp_storage_engine = MEMORY;
+SELECT @@session.default_tmp_storage_engine;
+
+--echo '#------------------FN_DYNVARS_005_04-----------------------#'
+##################################################################
+# Change the value of default_tmp_storage_engine to an invalid value #
+##################################################################
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.default_tmp_storage_engine = 8199;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.default_tmp_storage_engine = -1024;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.default_tmp_storage_engine = 65530.34;
+
+--Error ER_UNKNOWN_STORAGE_ENGINE
+SET @@global.default_tmp_storage_engine = FILE;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.default_tmp_storage_engine = 8199;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.default_tmp_storage_engine = 65530.34;
+
+--Error ER_UNKNOWN_STORAGE_ENGINE
+SET @@session.default_tmp_storage_engine = RECORD;
+
+
+--echo '#------------------FN_DYNVARS_005_05-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT @@global.default_tmp_storage_engine =
+ VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='default_tmp_storage_engine';
+
+--echo '#------------------FN_DYNVARS_005_06-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.default_tmp_storage_engine =
+ VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+ WHERE VARIABLE_NAME='default_tmp_storage_engine';
+
+
+--echo '#------------------FN_DYNVARS_005_07-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.default_tmp_storage_engine = TRUE;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.default_tmp_storage_engine = FALSE;
+
+
+--echo '#---------------------FN_DYNVARS_001_8----------------------#'
+###############################################################
+# Check if accessing variable with SESSION,LOCAL and without #
+# SCOPE points to same session variable #
+###############################################################
+
+SET @@default_tmp_storage_engine = MYISAM;
+SELECT @@default_tmp_storage_engine = @@local.default_tmp_storage_engine;
+SELECT @@local.default_tmp_storage_engine = @@session.default_tmp_storage_engine;
+
+
+--echo '#---------------------FN_DYNVARS_001_9----------------------#'
+#########################################################################
+# Check if default_tmp_storage_engine can be accessed with and without @@ sign #
+#########################################################################
+
+SET default_tmp_storage_engine = MEMORY;
+SELECT @@default_tmp_storage_engine;
+--Error ER_UNKNOWN_TABLE
+SELECT local.default_tmp_storage_engine;
+--Error ER_UNKNOWN_TABLE
+SELECT session.default_tmp_storage_engine;
+--Error ER_BAD_FIELD_ERROR
+SELECT default_tmp_storage_engine = @@session.default_tmp_storage_engine;
+
+# check the old obsolete name
+SET @@default_tmp_storage_engine = @start_global_value;
+
+SET default_tmp_storage_engine = MyISAM;
+SET default_storage_engine = MyISAM;
+CREATE TABLE t1 (a INT);
+CREATE TEMPORARY TABLE t2 (b INT);
+SHOW CREATE TABLE t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t1, t2;
+
+SET default_storage_engine = MEMORY;
+CREATE TABLE t1 (a INT);
+CREATE TEMPORARY TABLE t2 (b INT);
+SHOW CREATE TABLE t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t1, t2;
+
+# test default_tmp_storage_engine = NULL
+SET @@global.default_tmp_storage_engine = NULL;
+SET @@session.default_tmp_storage_engine = NULL;
+
+SET default_storage_engine = MEMORY;
+CREATE TABLE t1 (a INT);
+CREATE TEMPORARY TABLE t2 (b INT);
+SHOW CREATE TABLE t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t1, t2;
+
+SET default_storage_engine = MYISAM;
+CREATE TABLE t1 (a INT);
+CREATE TEMPORARY TABLE t2 (b INT);
+SHOW CREATE TABLE t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t1, t2;
+
+SET default_tmp_storage_engine = DEFAULT;
+SET default_storage_engine = DEFAULT;
+CREATE TABLE t1 (a INT);
+CREATE TEMPORARY TABLE t2 (b INT);
+SHOW CREATE TABLE t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t1, t2;
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.default_tmp_storage_engine = @start_global_value;
+SELECT @@global.default_tmp_storage_engine;
+SET @@session.default_tmp_storage_engine = @start_session_value;
+SELECT @@session.default_tmp_storage_engine;
+
+
+#############################################################
+# END OF default_tmp_storage_engine TESTS #
+#############################################################
+
diff --git a/mysql-test/suite/sys_vars/t/default_tmp_storage_engine_rocksdb.test b/mysql-test/suite/sys_vars/t/default_tmp_storage_engine_rocksdb.test
new file mode 100644
index 00000000..3454e5d6
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/default_tmp_storage_engine_rocksdb.test
@@ -0,0 +1,86 @@
+--echo #
+--echo # MDEV-12914: Engine for temporary tables which are implicitly
+--echo # created as RocksDB is substitued siliently with MyIsam
+
+--source include/have_rocksdb.inc
+--source include/not_embedded.inc
+--source include/have_innodb.inc
+
+--error ER_UNKNOWN_STORAGE_ENGINE
+SET default_tmp_storage_engine = engine_doesnt_exist;
+--error ER_ILLEGAL_HA_CREATE_OPTION
+SET default_tmp_storage_engine = rocksdb;
+--error ER_ILLEGAL_HA_CREATE_OPTION
+SET default_tmp_storage_engine = CONCAT('rocks','db');
+
+CREATE TABLE t1 (i int) ENGINE = RocksDB;
+SHOW CREATE TABLE t1;
+
+--error ER_ILLEGAL_HA_CREATE_OPTION
+CREATE TEMPORARY TABLE t2 LIKE t1;
+
+DROP TABLE t1;
+
+SET default_storage_engine = DEFAULT;
+SET default_tmp_storage_engine = DEFAULT;
+
+CREATE TABLE t1 (t int);
+SHOW CREATE TABLE t1;
+CREATE TEMPORARY TABLE t2 LIKE t1;
+SHOW CREATE TABLE t2;
+
+DROP TABLE t1, t2;
+
+SET default_storage_engine = rocksdb;
+# setting default or null for tmp SE should use default SE
+SET default_tmp_storage_engine = default;
+
+CREATE TABLE t1 (t int);
+SHOW CREATE TABLE t1;
+
+--error ER_ILLEGAL_HA_CREATE_OPTION
+CREATE TEMPORARY TABLE t2 LIKE t1;
+
+--error ER_ILLEGAL_HA_CREATE_OPTION
+CREATE TEMPORARY TABLE t2 (t int);
+
+SET default_tmp_storage_engine = aria;
+CREATE TEMPORARY TABLE t2 (t int);
+DROP TABLE t2;
+
+--error ER_ILLEGAL_HA_CREATE_OPTION
+CREATE TEMPORARY TABLE t2 LIKE t1;
+
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-26242: Assertion `i >= 0' failed on setting
+--echo # default_tmp_storage_engine to 'DEFAULT' in 10.7
+--echo #
+
+
+SHOW VARIABLES like '%storage_engine';
+SELECT @@GLOBAL.default_tmp_storage_engine, @@GLOBAL.default_storage_engine, @@GLOBAL.storage_engine, @@SESSION.default_tmp_storage_engine, @@SESSION.default_storage_engine, @@SESSION.storage_engine;
+--error ER_UNKNOWN_SYSTEM_VARIABLE
+SELECT @@GLOBAL.table_type;
+
+SET default_storage_engine=DEFAULT;
+SET default_tmp_storage_engine=innodb;
+SELECT @@GLOBAL.default_tmp_storage_engine, @@GLOBAL.default_storage_engine, @@GLOBAL.storage_engine, @@SESSION.default_tmp_storage_engine, @@SESSION.default_storage_engine, @@SESSION.storage_engine;
+
+CREATE TABLE t (t int);
+CREATE TEMPORARY TABLE t1 (t int);
+SHOW CREATE TABLE t;
+SHOW CREATE TABLE t1;
+DROP TABLE t1, t;
+
+SET GLOBAL default_tmp_storage_engine='default';
+SELECT @@GLOBAL.default_tmp_storage_engine, @@GLOBAL.default_storage_engine, @@GLOBAL.storage_engine, @@SESSION.default_tmp_storage_engine, @@SESSION.default_storage_engine, @@SESSION.storage_engine;
+
+CREATE TABLE t (t int);
+CREATE TEMPORARY TABLE t1 (t int);
+SHOW CREATE TABLE t;
+SHOW CREATE TABLE t1;
+DROP TABLE t1, t;
+
+SET GLOBAL default_tmp_storage_engine=NULL; \ No newline at end of file
diff --git a/mysql-test/suite/sys_vars/t/default_week_format_basic.test b/mysql-test/suite/sys_vars/t/default_week_format_basic.test
new file mode 100644
index 00000000..592379ba
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/default_week_format_basic.test
@@ -0,0 +1,194 @@
+############## mysql-test\t\default_week_format_basic.test #####################
+# #
+# Variable Name: default_week_format #
+# Scope: GLOBAL & SESSION #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 0 #
+# Range: 0 - 7 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable "default_week_format" #
+# that checks behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity . #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_auto-increment-increment #
+# #
+################################################################################
+
+--source include/load_sysvars.inc
+
+###################################################################
+# START OF default_week_format TESTS #
+###################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.default_week_format;
+SELECT @start_global_value;
+SET @start_session_value = @@session.default_week_format;
+SELECT @start_session_value;
+
+--echo '#--------------------FN_DYNVARS_022_01-------------------------#'
+###################################################################
+# Display the DEFAULT value of default_week_format #
+###################################################################
+
+SET @@global.default_week_format = 100;
+SET @@global.default_week_format = DEFAULT;
+SELECT @@global.default_week_format;
+
+SET @@session.default_week_format = 200;
+SET @@session.default_week_format = DEFAULT;
+SELECT @@session.default_week_format;
+
+--echo '#--------------------FN_DYNVARS_022_02-------------------------#'
+###################################################################
+# Check the DEFAULT value of default_week_format #
+###################################################################
+
+SET @@global.default_week_format = @start_global_value;
+SELECT @@global.default_week_format = 0;
+
+SET @@session.default_week_format = @start_global_value;
+SELECT @@session.default_week_format = 0;
+
+--echo '#--------------------FN_DYNVARS_022_03-------------------------#'
+#############################################################################
+# Change the value of default_week_format to a valid value for GLOBAL Scope #
+#############################################################################
+
+SET @@global.default_week_format = 1;
+SELECT @@global.default_week_format;
+SET @@global.default_week_format = 0;
+SELECT @@global.default_week_format;
+SET @@global.default_week_format = 7;
+SELECT @@global.default_week_format;
+
+
+--echo '#--------------------FN_DYNVARS_022_04-------------------------#'
+##############################################################################
+# Change the value of default_week_format to a valid value for SESSION Scope #
+##############################################################################
+
+SET @@session.default_week_format = 1;
+SELECT @@session.default_week_format;
+SET @@session.default_week_format = 0;
+SELECT @@session.default_week_format;
+SET @@session.default_week_format = 7;
+SELECT @@session.default_week_format;
+
+
+--echo '#------------------FN_DYNVARS_022_05-----------------------#'
+###############################################################
+# Change the value of default_week_format to an invalid value #
+###############################################################
+
+SET @@global.default_week_format = 8;
+SELECT @@global.default_week_format;
+SET @@global.default_week_format = -1024;
+SELECT @@global.default_week_format;
+SET @@global.default_week_format = 65536;
+SELECT @@global.default_week_format;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.default_week_format = 65530.30;
+SELECT @@global.default_week_format;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.default_week_format = OFF;
+SELECT @@global.default_week_format;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.default_week_format = ON;
+SELECT @@session.default_week_format;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.default_week_format = 65530.30;
+SELECT @@session.default_week_format;
+SET @@session.default_week_format = 10;
+SELECT @@session.default_week_format;
+SET @@session.default_week_format = -2;
+SELECT @@session.default_week_format;
+SET @@session.default_week_format = 65550;
+SELECT @@session.default_week_format;
+
+--echo '#------------------FN_DYNVARS_022_06-----------------------#'
+###############################################################################
+# Check if the value in GLOBAL & SESSION Tables matches value in variable #
+###############################################################################
+
+SELECT @@global.default_week_format = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='default_week_format';
+
+SELECT @@session.default_week_format = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='default_week_format';
+
+
+--echo '#------------------FN_DYNVARS_022_07-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.default_week_format = TRUE;
+SELECT @@global.default_week_format;
+SET @@global.default_week_format = FALSE;
+SELECT @@global.default_week_format;
+
+
+--echo '#---------------------FN_DYNVARS_001_08----------------------#'
+####################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+####################################################################################
+
+SET @@global.default_week_format = 0;
+SELECT @@default_week_format = @@global.default_week_format;
+
+
+--echo '#---------------------FN_DYNVARS_001_09----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@default_week_format = 1;
+SELECT @@default_week_format = @@local.default_week_format;
+SELECT @@local.default_week_format = @@session.default_week_format;
+
+
+--echo '#---------------------FN_DYNVARS_001_10----------------------#'
+###################################################################################
+# Check if default_week_format can be accessed with and without @@ sign #
+###################################################################################
+
+SET default_week_format = 1;
+SELECT @@default_week_format;
+--Error ER_UNKNOWN_TABLE
+SELECT local.default_week_format;
+--Error ER_UNKNOWN_TABLE
+SELECT session.default_week_format;
+--Error ER_BAD_FIELD_ERROR
+SELECT default_week_format = @@session.default_week_format;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.default_week_format = @start_global_value;
+SELECT @@global.default_week_format;
+SET @@session.default_week_format = @start_session_value;
+SELECT @@session.default_week_format;
+
+
+#############################################################
+# END OF default_week_format TESTS #
+#############################################################
+
diff --git a/mysql-test/suite/sys_vars/t/default_week_format_func.test b/mysql-test/suite/sys_vars/t/default_week_format_func.test
new file mode 100644
index 00000000..c80c49b3
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/default_week_format_func.test
@@ -0,0 +1,66 @@
+############## mysql-test\t\default_week_format_func.test #####################
+# #
+# Variable Name: default_week_format #
+# Scope: GLOBAL & SESSION #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 0 #
+# Range: 0 - 7 #
+# #
+# #
+# Creation Date: 2008-03-07 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable "default_week_format" #
+# that checks functionality of this variable #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_default_week_format #
+# #
+################################################################################
+
+--echo '#--------------------FN_DYNVARS_022_01-------------------------#'
+####################################################################
+# Verifying different values of default_week_format
+####################################################################
+
+--echo ## Setting variable's value to 0 ##
+SET @@session.default_week_format = 0;
+SELECT @@session.default_week_format;
+SELECT WEEK('2008-01-20');
+
+--echo ## Setting variable's value to 1 ##
+SET @@session.default_week_format = 1;
+SELECT @@session.default_week_format;
+SELECT WEEK('2008-01-20');
+
+--echo ## Setting variable's value to 2 ##
+SET @@session.default_week_format = 2;
+SELECT @@session.default_week_format;
+SELECT WEEK('2008-01-20');
+
+--echo ## Setting variable's value to 3 ##
+SET @@session.default_week_format = 3;
+SELECT @@session.default_week_format;
+SELECT WEEK('2008-01-20');
+
+--echo ## Setting variable's value to 4 ##
+SET @@session.default_week_format = 4;
+SELECT @@session.default_week_format;
+SELECT WEEK('2008-01-20');
+
+--echo ## Setting variable's value to 5 ##
+SET @@session.default_week_format = 5;
+SELECT @@session.default_week_format;
+SELECT WEEK('2008-01-20');
+
+--echo ## Setting variable's value to 6 ##
+SET @@session.default_week_format = 6;
+SELECT @@session.default_week_format;
+SELECT WEEK('2008-01-20');
+
+--echo ## Setting variable's value to 7 ##
+SET @@session.default_week_format = 7;
+SELECT @@session.default_week_format;
+SELECT WEEK('2008-01-20');
+
diff --git a/mysql-test/suite/sys_vars/t/delay_key_write_basic.test b/mysql-test/suite/sys_vars/t/delay_key_write_basic.test
new file mode 100644
index 00000000..25176879
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/delay_key_write_basic.test
@@ -0,0 +1,168 @@
+##################### mysql-test\t\delay_key_write_basic.test #################
+# #
+# Variable Name: delay_key_write #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: enumeration #
+# Default Value: ON #
+# Valid Values: ON, OFF & ALL #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable delay_key_write #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF delay_key_write TESTS #
+########################################################################
+
+
+########################################################################
+# Saving initial value of delay_key_write in a temporary variable #
+########################################################################
+
+SET @start_value = @@global.delay_key_write;
+SELECT @start_value;
+
+
+--echo '#--------------------FN_DYNVARS_023_01------------------------#'
+########################################################################
+# Display the DEFAULT value of delay_key_write #
+########################################################################
+
+SET @@global.delay_key_write = OFF;
+SET @@global.delay_key_write = DEFAULT;
+SELECT @@global.delay_key_write;
+
+
+--echo '#---------------------FN_DYNVARS_023_02-------------------------#'
+###############################################
+# Check if NULL is accepeted #
+###############################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.delay_key_write = NULL;
+
+
+--echo '#--------------------FN_DYNVARS_023_03------------------------#'
+########################################################################
+# Change the value of delay_key_write to a valid value #
+########################################################################
+
+SET @@global.delay_key_write = ON;
+SELECT @@global.delay_key_write;
+
+SET @@global.delay_key_write = OFF;
+SELECT @@global.delay_key_write;
+
+SET @@global.delay_key_write = ALL;
+SELECT @@global.delay_key_write;
+
+
+--echo '#--------------------FN_DYNVARS_023_04-------------------------#'
+###########################################################################
+# Change the value of delay_key_write to invalid value #
+###########################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.delay_key_write = 3;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.delay_key_write = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.delay_key_write = TRU;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.delay_key_write = ERROR;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.delay_key_write = FALSE0;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.delay_key_write = ONN;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.delay_key_write = OF;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.delay_key_write = ' ';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.delay_key_write = "";
+
+
+--echo '#-------------------FN_DYNVARS_023_05----------------------------#'
+###########################################################################
+# Test if accessing session delay_key_write gives error #
+###########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@delay_key_write = 0;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.delay_key_write;
+
+
+--echo '#----------------------FN_DYNVARS_023_06------------------------#'
+########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+########################################################################
+
+SELECT @@delay_key_write = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='delay_key_write';
+
+
+--echo '#---------------------FN_DYNVARS_023_07-------------------------#'
+###################################################################
+# Check if numbers can be used on variable #
+###################################################################
+
+SET @@global.delay_key_write = 0;
+SELECT @@global.delay_key_write;
+
+SET @@global.delay_key_write = 1;
+SELECT @@global.delay_key_write;
+
+SET @@global.delay_key_write = 2;
+SELECT @@global.delay_key_write;
+
+
+
+--echo '#---------------------FN_DYNVARS_023_08----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.delay_key_write = TRUE;
+SELECT @@global.delay_key_write;
+SET @@global.delay_key_write = FALSE;
+SELECT @@global.delay_key_write;
+
+--echo '#---------------------FN_DYNVARS_023_09----------------------#'
+#####################################################################
+# Check if delay_key_write can be accessed with and without @@ sign #
+#####################################################################
+--Error ER_GLOBAL_VARIABLE
+SET delay_key_write = ON;
+SELECT @@delay_key_write;
+
+SET GLOBAL delay_key_write = OFF;
+SELECT @@global.delay_key_write;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.delay_key_write = @start_value;
+SELECT @@global.delay_key_write;
+
+########################################################################
+# END OF delay_key_write TESTS #
+########################################################################
diff --git a/mysql-test/suite/sys_vars/t/delay_key_write_func-master.opt b/mysql-test/suite/sys_vars/t/delay_key_write_func-master.opt
new file mode 100644
index 00000000..06d4d5aa
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/delay_key_write_func-master.opt
@@ -0,0 +1,2 @@
+--myisam-recover-options=BACKUP,FORCE
+
diff --git a/mysql-test/suite/sys_vars/t/delay_key_write_func.test b/mysql-test/suite/sys_vars/t/delay_key_write_func.test
new file mode 100644
index 00000000..e823e519
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/delay_key_write_func.test
@@ -0,0 +1,113 @@
+##################### mysql-test\t\delay_key_write_func.test #################
+# #
+# Variable Name: delay_key_write #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: enumeration #
+# Default Value: ON #
+# Valid Values: ON, OFF & ALL #
+# #
+# #
+# Creation Date: 2008-03-08 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable delay_key_write #
+# that checks the behavior of this variable #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# #
+###############################################################################
+
+--echo '#--------------------FN_DYNVARS_023_01-------------------------#'
+SET @start_value= @@global.delay_key_write;
+
+--echo '#--------------------FN_DYNVARS_023_02-------------------------#'
+######################################################
+# Begin the functionality Testing of delay_key_write #
+######################################################
+
+# create procedure to add rows
+DELIMITER //;
+CREATE PROCEDURE sp_addRecords (IN var1 INT,IN var2 INT)
+BEGIN
+ WHILE (var1 < var2) DO
+ INSERT INTO t1 VALUES(var1,REPEAT('MYSQL',10),100000.0/var1);
+ SET var1=var1+1;
+ END WHILE;
+END//
+DELIMITER ;//
+
+#==============================================================================
+--echo '---check when delay_key_write is OFF---'
+#==============================================================================
+
+SET @@global.delay_key_write = OFF;
+
+# create a table with delay_key_write enabled
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b VARCHAR(512),
+c DOUBLE
+) DELAY_KEY_WRITE = 1;
+
+FLUSH STATUS;
+
+CALL sp_addRecords(1,10);
+
+SHOW STATUS LIKE 'Key_reads';
+SHOW STATUS LIKE 'Key_writes';
+SHOW STATUS LIKE 'Key_write_requests';
+SELECT COUNT(*) FROM t1;
+DROP TABLE t1;
+
+#==============================================================================
+--echo '----check when delay_key_write is ON---'
+#==============================================================================
+
+SET @@global.delay_key_write = ON;
+
+# create a table with delay_key_write enabled
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b VARCHAR(512),
+c DOUBLE
+) DELAY_KEY_WRITE = 1;
+
+FLUSH STATUS;
+CALL sp_addRecords(1,10);
+
+SHOW STATUS LIKE 'Key_reads';
+SHOW STATUS LIKE 'Key_writes';
+SHOW STATUS LIKE 'Key_write_requests';
+SELECT COUNT(*) FROM t1;
+DROP TABLE t1;
+
+#==============================================================================
+--echo '----check when delay_key_write is ALL---'
+#==============================================================================
+SET @@global.delay_key_write = ALL;
+
+# create a table with delay_key_write disabled
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b VARCHAR(512),
+c DOUBLE
+) DELAY_KEY_WRITE = 0;
+
+FLUSH STATUS;
+CALL sp_addRecords(1,10);
+
+SHOW STATUS LIKE 'Key_reads';
+SHOW STATUS LIKE 'Key_writes';
+SHOW STATUS LIKE 'Key_write_requests';
+SELECT COUNT(*) FROM t1;
+
+DROP PROCEDURE sp_addRecords;
+DROP TABLE t1;
+
+SET @@global.delay_key_write= @start_value;
+
+####################################################
+# End of functionality testing for delay_key_write #
+####################################################
diff --git a/mysql-test/suite/sys_vars/t/delayed_insert_limit_basic.test b/mysql-test/suite/sys_vars/t/delayed_insert_limit_basic.test
new file mode 100644
index 00000000..3eb345dc
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/delayed_insert_limit_basic.test
@@ -0,0 +1,162 @@
+############### mysql-test\t\delayed_insert_limit_basic.test ###################
+# #
+# Variable Name: delayed_insert_limit #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 100 #
+# Range: 1 - 4294967295 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable "delayed_insert_limit" #
+# that checks behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_delayed_insert_limit #
+# #
+################################################################################
+
+--source include/load_sysvars.inc
+
+#################################################################
+# START OF delayed_insert_limit TESTS #
+#################################################################
+
+#########################################################################
+# Saving initial value of delayed_insert_limit in a temporary variable #
+#########################################################################
+
+SET @start_value = @@global.delayed_insert_limit;
+SELECT @start_value;
+
+--echo '#--------------------FN_DYNVARS_024_01------------------------#'
+#########################################################################
+# Display the DEFAULT value of delayed_insert_limit #
+#########################################################################
+
+SET @@global.delayed_insert_limit = 100;
+SET @@global.delayed_insert_limit = DEFAULT;
+SELECT @@global.delayed_insert_limit;
+
+
+--echo '#---------------------FN_DYNVARS_024_02-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@global.delayed_insert_limit = @start_value;
+SELECT @@global.delayed_insert_limit = 100;
+
+
+--echo '#--------------------FN_DYNVARS_024_03------------------------#'
+#########################################################################
+# Change the value of delayed_insert_limit to a valid value #
+#########################################################################
+
+SET @@global.delayed_insert_limit = 10000;
+SELECT @@global.delayed_insert_limit;
+SET @@global.delayed_insert_limit = 4294967295;
+SELECT @@global.delayed_insert_limit;
+SET @@global.delayed_insert_limit = 1;
+SELECT @@global.delayed_insert_limit;
+
+
+--echo '#--------------------FN_DYNVARS_024_04-------------------------#'
+############################################################################
+# Change the value of delayed_insert_limit to invalid value #
+############################################################################
+
+SET @@global.delayed_insert_limit = 0;
+SELECT @@global.delayed_insert_limit;
+SET @@global.delayed_insert_limit = -1024;
+SELECT @@global.delayed_insert_limit;
+SET @@global.delayed_insert_limit = 42949672950;
+SELECT @@global.delayed_insert_limit;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.delayed_insert_limit = 429496729.5;
+SELECT @@global.delayed_insert_limit;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.delayed_insert_limit = ON;
+SELECT @@global.delayed_insert_limit;
+
+
+
+--echo '#-------------------FN_DYNVARS_024_05----------------------------#'
+############################################################################
+# Test if accessing session delayed_insert_limit gives error #
+############################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.delayed_insert_limit = 0;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@Session.delayed_insert_limit;
+
+
+--echo '#----------------------FN_DYNVARS_024_06------------------------#'
+##############################################################################
+# Check if the value in GLOBAL & SESSION Tables matches values in variable #
+##############################################################################
+
+SELECT @@global.delayed_insert_limit =
+ VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='delayed_insert_limit';
+
+SELECT @@delayed_insert_limit =
+ VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+ WHERE VARIABLE_NAME='delayed_insert_limit';
+
+
+--echo '#---------------------FN_DYNVARS_024_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.delayed_insert_limit = TRUE;
+SELECT @@global.delayed_insert_limit;
+SET @@global.delayed_insert_limit = FALSE;
+SELECT @@global.delayed_insert_limit;
+
+--echo '#---------------------FN_DYNVARS_024_08----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@global.delayed_insert_limit = 1;
+SELECT @@delayed_insert_limit = @@global.delayed_insert_limit;
+
+
+--echo '#---------------------FN_DYNVARS_024_09----------------------#'
+##############################################################################
+# Check if delayed_insert_limit can be accessed with and without @@ sign #
+##############################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET delayed_insert_limit = 1;
+SELECT @@delayed_insert_limit;
+--Error ER_UNKNOWN_TABLE
+SELECT local.delayed_insert_limit;
+--Error ER_UNKNOWN_TABLE
+SELECT global.delayed_insert_limit;
+--Error ER_BAD_FIELD_ERROR
+SELECT delayed_insert_limit = @@session.delayed_insert_limit;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.delayed_insert_limit = @start_value;
+SELECT @@global.delayed_insert_limit;
+
+
+###########################################################
+# END OF delayed_insert_limit TESTS #
+###########################################################
+
diff --git a/mysql-test/suite/sys_vars/t/delayed_insert_limit_func.test b/mysql-test/suite/sys_vars/t/delayed_insert_limit_func.test
new file mode 100644
index 00000000..6a95dda3
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/delayed_insert_limit_func.test
@@ -0,0 +1,217 @@
+################################################################################
+# #
+# Variable Name: delayed_insert_limit #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 100 #
+# Range: 1 - 4294967295 #
+# #
+# #
+# Creation Date: 2008-02-25 #
+# Author: Sharique Abdullah #
+# Modified: HHunger 2009-02-26 Replaced 2 sleeps by wait conditions #
+# Modified: mleich 2009-03-18 Partially reimplemented #
+# #
+# Description: Test Cases of Dynamic System Variable "delayed_insert_limit" #
+# that checks behavior of this variable in the following ways #
+# * Functionality based on different values #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# #
+################################################################################
+
+--echo ** Setup **
+--echo
+#
+# Setup
+#
+
+--source include/not_embedded.inc
+
+connect (con0,localhost,root,,);
+let $con0_id=`SELECT CONNECTION_ID()`;
+connect (con1,localhost,root,,);
+let $con1_id=`SELECT CONNECTION_ID()`;
+
+connection default;
+
+SET @global_delayed_insert_limit = @@GLOBAL.delayed_insert_limit;
+
+#
+# Create Table
+#
+
+CREATE TABLE t1 (a VARCHAR(100),b VARCHAR(100),c VARCHAR(100));
+CREATE VIEW v1 as select * from t1;
+
+--echo '#--------------------FN_DYNVARS_25_01-------------------------#'
+
+# delayed_insert_limit is smaller than the number of inserted rows
+
+SET GLOBAL delayed_insert_limit = 14;
+
+INSERT INTO t1 VALUES('1','1','1');
+INSERT INTO t1 VALUES('2','1','1');
+INSERT INTO t1 VALUES('3','1','1');
+INSERT INTO t1 VALUES('4','1','1');
+INSERT INTO t1 VALUES('5','1','1');
+INSERT INTO t1 VALUES('6','1','1');
+
+LOCK TABLE v1 READ;
+
+connection con1;
+
+INSERT DELAYED INTO t1 VALUES('7','1','1');
+INSERT DELAYED INTO t1 VALUES('8','1','1');
+INSERT DELAYED INTO t1 VALUES('9','1','1');
+INSERT DELAYED INTO t1 VALUES('10','1','1');
+INSERT DELAYED INTO t1 VALUES('11','1','1');
+INSERT DELAYED INTO t1 VALUES('12','1','1');
+INSERT DELAYED INTO t1 VALUES('13','1','1');
+INSERT DELAYED INTO t1 VALUES('14','1','1');
+INSERT DELAYED INTO t1 VALUES('15','1','1');
+INSERT DELAYED INTO t1 VALUES('16','1','1');
+INSERT DELAYED INTO t1 VALUES('17','1','1');
+INSERT DELAYED INTO t1 VALUES('18','1','1');
+INSERT DELAYED INTO t1 VALUES('19','1','1');
+INSERT DELAYED INTO t1 VALUES('20','1','1');
+INSERT DELAYED INTO t1 VALUES('21','1','1');
+INSERT DELAYED INTO t1 VALUES('22','1','1');
+INSERT DELAYED INTO t1 VALUES('23','1','1');
+INSERT DELAYED INTO t1 VALUES('24','1','1');
+INSERT DELAYED INTO t1 VALUES('25','1','1');
+INSERT DELAYED INTO t1 VALUES('26','1','1');
+INSERT DELAYED INTO t1 VALUES('27','1','1');
+INSERT DELAYED INTO t1 VALUES('28','1','1');
+INSERT DELAYED INTO t1 VALUES('29','1','1');
+INSERT DELAYED INTO t1 VALUES('30','1','1');
+INSERT DELAYED INTO t1 VALUES('31','1','1');
+INSERT DELAYED INTO t1 VALUES('32','1','1');
+INSERT DELAYED INTO t1 VALUES('33','1','1');
+INSERT DELAYED INTO t1 VALUES('34','1','1');
+INSERT DELAYED INTO t1 VALUES('35','1','1');
+INSERT DELAYED INTO t1 VALUES('36','1','1');
+INSERT DELAYED INTO t1 VALUES('37','1','1');
+INSERT DELAYED INTO t1 VALUES('38','1','1');
+INSERT DELAYED INTO t1 VALUES('39','1','1');
+INSERT DELAYED INTO t1 VALUES('40','1','1');
+INSERT DELAYED INTO t1 VALUES('41','1','1');
+INSERT DELAYED INTO t1 VALUES('42','1','1');
+INSERT DELAYED INTO t1 VALUES('43','1','1');
+
+connection con0;
+let $wait_condition=
+ SELECT COUNT(*) = 1 FROM information_schema.processlist
+ WHERE state = 'Waiting for table level lock' AND user='delayed';
+--source include/wait_condition.inc
+let $my_select= SELECT COUNT(*) FROM t1;
+send;
+eval $my_select;
+
+connection default;
+--echo ** Wait till con0 is blocked **
+let $wait_condition=
+ SELECT COUNT(*) = 1 FROM information_schema.processlist
+ WHERE state = 'Waiting for table level lock' AND info = '$my_select';
+--source include/wait_condition.inc
+UNLOCK TABLES;
+
+connection con0;
+--echo Asynchronous "reap" result
+--echo The next result suffers from
+--echo '# Bug#35386 insert delayed inserts 1 + limit rows instead of just limit rows'
+reap;
+
+connection default;
+let $wait_condition= SELECT count(*) = 43 FROM t1;
+--source include/wait_condition.inc
+--echo Checking if the delayed insert continued afterwards
+SELECT COUNT(*) FROM t1;
+
+DROP TABLE t1;
+DROP VIEW v1;
+
+
+--echo '#--------------------FN_DYNVARS_25_02-------------------------#'
+
+# delayed_insert_limit is bigger than the number of inserted rows
+
+CREATE TABLE t1 (a VARCHAR(100));
+CREATE VIEW v1 AS SELECT * FROM t1;
+
+SET GLOBAL delayed_insert_limit = 20;
+
+INSERT INTO t1 VALUES('1');
+INSERT INTO t1 VALUES('2');
+INSERT INTO t1 VALUES('3');
+INSERT INTO t1 VALUES('4');
+INSERT INTO t1 VALUES('5');
+INSERT INTO t1 VALUES('6');
+
+LOCK TABLE v1 READ;
+
+connection con1;
+
+INSERT DELAYED INTO t1 VALUES('7');
+INSERT DELAYED INTO t1 VALUES('8');
+INSERT DELAYED INTO t1 VALUES('9');
+INSERT DELAYED INTO t1 VALUES('10');
+INSERT DELAYED INTO t1 VALUES('11');
+INSERT DELAYED INTO t1 VALUES('12');
+INSERT DELAYED INTO t1 VALUES('13');
+INSERT DELAYED INTO t1 VALUES('14');
+INSERT DELAYED INTO t1 VALUES('15');
+INSERT DELAYED INTO t1 VALUES('16');
+INSERT DELAYED INTO t1 VALUES('17');
+INSERT DELAYED INTO t1 VALUES('18');
+INSERT DELAYED INTO t1 VALUES('19');
+INSERT DELAYED INTO t1 VALUES('20');
+INSERT DELAYED INTO t1 VALUES('21');
+INSERT DELAYED INTO t1 VALUES('22');
+
+connection con0;
+let $wait_condition=
+ SELECT COUNT(*) = 1 FROM information_schema.processlist
+ WHERE state = 'Waiting for table level lock' AND user='delayed';
+--source include/wait_condition.inc
+--echo Asynchronous execute
+# Due to performance and server behaveiour the test observes values between 6 and 22.
+# In any case the value must not be outside of that range.
+let $my_select= SELECT COUNT(*) FROM t1;
+send;
+eval $my_select;
+
+connection default;
+--echo ** Wait till con0 is blocked **
+let $wait_condition=
+ SELECT COUNT(*) = 1 FROM information_schema.processlist
+ WHERE state = 'Waiting for table level lock' AND info = '$my_select';
+--source include/wait_condition.inc
+UNLOCK TABLES;
+
+connection con0;
+--echo Asynchronous "reap" result
+reap;
+
+connection default;
+--echo Checking if the delayed insert gives the same result afterwards
+eval $my_select;
+
+
+#
+# Cleanup
+#
+
+connection default;
+DROP TABLE t1;
+DROP VIEW v1;
+SET @@GLOBAL.delayed_insert_limit = @global_delayed_insert_limit;
+
+disconnect con0;
+disconnect con1;
+let $wait_condition=
+ SELECT COUNT(*) = 0 FROM information_schema.processlist
+ WHERE id IN ($con0_id,$con1_id);
+--source include/wait_condition.inc
diff --git a/mysql-test/suite/sys_vars/t/delayed_insert_timeout_basic.test b/mysql-test/suite/sys_vars/t/delayed_insert_timeout_basic.test
new file mode 100644
index 00000000..79521924
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/delayed_insert_timeout_basic.test
@@ -0,0 +1,165 @@
+################# mysql-test\t\delayed_insert_timeout_basic.test ###############
+# #
+# Variable Name: delayed_insert_timeout #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 300 #
+# Range: 1 - 4294967286 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable "delayed_insert_timeout" #
+# that checks behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity . #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_delayed_insert_timeout #
+# #
+################################################################################
+
+--source include/load_sysvars.inc
+
+#################################################################
+# START OF delayed_insert_timeout TESTS #
+#################################################################
+
+##############################################################################
+# Saving initial value of delayed_insert_timeout in a temporary variable #
+##############################################################################
+
+SET @start_value = @@global.delayed_insert_timeout;
+SELECT @start_value;
+
+--echo '#--------------------FN_DYNVARS_025_01------------------------#'
+##############################################################################
+# Display the DEFAULT value of delayed_insert_timeout #
+##############################################################################
+
+SET @@global.delayed_insert_timeout = 100;
+SET @@global.delayed_insert_timeout = DEFAULT;
+SELECT @@global.delayed_insert_timeout;
+
+
+--echo '#---------------------FN_DYNVARS_025_02-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@global.delayed_insert_timeout = @start_value;
+SELECT @@global.delayed_insert_timeout = 300;
+
+
+--echo '#--------------------FN_DYNVARS_025_03------------------------#'
+##############################################################################
+# Change the value of delayed_insert_timeout to a valid value #
+##############################################################################
+
+SET @@global.delayed_insert_timeout = 10000;
+SELECT @@global.delayed_insert_timeout;
+SET @@global.delayed_insert_timeout = 429;
+SELECT @@global.delayed_insert_timeout;
+SET @@global.delayed_insert_timeout = 1;
+SELECT @@global.delayed_insert_timeout;
+
+
+--echo '#--------------------FN_DYNVARS_025_04-------------------------#'
+#################################################################################
+# Change the value of delayed_insert_timeout to invalid value #
+#################################################################################
+
+SET @@global.delayed_insert_timeout = 0;
+SELECT @@global.delayed_insert_timeout;
+SET @@global.delayed_insert_timeout = -1024;
+SELECT @@global.delayed_insert_timeout;
+SET @@global.delayed_insert_timeout = 42949672950;
+SELECT @@global.delayed_insert_timeout;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.delayed_insert_timeout = 429496729.5;
+SELECT @@global.delayed_insert_timeout;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.delayed_insert_timeout = ON;
+SELECT @@global.delayed_insert_timeout;
+
+
+--echo '#-------------------FN_DYNVARS_025_05----------------------------#'
+#################################################################################
+# Test if accessing session delayed_insert_timeout gives error #
+#################################################################################
+
+--Error 1229
+SET @@session.delayed_insert_timeout = 0;
+--Error 1193
+SELECT @@session.dalayed_insert_timeout;
+
+--echo '#----------------------FN_DYNVARS_025_06------------------------#'
+##############################################################################
+# Check if the value in GLOBAL & SESSION Tables matches values in variable #
+##############################################################################
+
+SELECT @@global.delayed_insert_timeout = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='delayed_insert_timeout';
+
+SELECT @@delayed_insert_timeout = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='delayed_insert_timeout';
+
+
+--echo '#---------------------FN_DYNVARS_025_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.delayed_insert_timeout = TRUE;
+SELECT @@global.delayed_insert_timeout;
+SET @@global.delayed_insert_timeout = FALSE;
+SELECT @@global.delayed_insert_timeout;
+
+
+--echo '#---------------------FN_DYNVARS_025_08----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@global.delayed_insert_timeout = 1;
+SELECT @@delayed_insert_timeout = @@global.delayed_insert_timeout;
+
+
+--echo '#---------------------FN_DYNVARS_025_09----------------------#'
+################################################################################
+# Check if delayed_insert_timeout can be accessed with and without @@ sign #
+################################################################################
+
+--Error 1229
+SET delayed_insert_timeout = 1;
+SELECT @@delayed_insert_timeout;
+--Error 1109
+SELECT local.delayed_insert_timeout;
+--Error 1109
+SELECT global.delayed_insert_timeout;
+--Error 1054
+SELECT delayed_insert_timeout = @@session.delayed_insert_timeout;
+# Restore initial value
+SET @@global.delayed_insert_timeout = @start_value;
+SELECT @@global.delayed_insert_timeout;
+
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.delayed_insert_timeout = @start_value;
+SELECT @@global.delayed_insert_timeout;
+
+
+################################################################
+# END OF delayed_insert_timeout TESTS #
+################################################################
+
diff --git a/mysql-test/suite/sys_vars/t/delayed_queue_size_basic.test b/mysql-test/suite/sys_vars/t/delayed_queue_size_basic.test
new file mode 100644
index 00000000..a0aae63c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/delayed_queue_size_basic.test
@@ -0,0 +1,158 @@
+################# mysql-test\t\delayed_queue_size_basic.test ###################
+# #
+# Variable Name: delayed_queue_size #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 1000 #
+# Range: 1 - 4294967295 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable "delayed_queue_size" #
+# that checks behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity . #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_delayed_queue_size #
+# #
+################################################################################
+
+--source include/load_sysvars.inc
+
+#################################################################
+# START OF delayed_queue_size TESTS #
+#################################################################
+
+#########################################################################
+# Saving initial value of delayed_queue_size in a temporary variable #
+#########################################################################
+
+SET @start_value = @@global.delayed_queue_size;
+SELECT @start_value;
+
+--echo '#--------------------FN_DYNVARS_026_01------------------------#'
+#########################################################################
+# Display the DEFAULT value of delayed_queue_size #
+#########################################################################
+
+SET @@global.delayed_queue_size = 100;
+SET @@global.delayed_queue_size = DEFAULT;
+SELECT @@global.delayed_queue_size;
+
+--echo '#---------------------FN_DYNVARS_026_02-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@global.delayed_queue_size = @start_value;
+SELECT @@global.delayed_queue_size = 1000;
+
+--echo '#--------------------FN_DYNVARS_026_03------------------------#'
+#########################################################################
+# Change the value of delayed_queue_size to a valid value #
+#########################################################################
+
+SET @@global.delayed_queue_size = 10000;
+SELECT @@global.delayed_queue_size;
+SET @@global.delayed_queue_size = 4294967295;
+SELECT @@global.delayed_queue_size;
+SET @@global.delayed_queue_size = 1;
+SELECT @@global.delayed_queue_size;
+
+
+--echo '#--------------------FN_DYNVARS_026_04-------------------------#'
+############################################################################
+# Change the value of delayed_queue_size to invalid value #
+############################################################################
+
+SET @@global.delayed_queue_size = 0;
+SELECT @@global.delayed_queue_size;
+SET @@global.delayed_queue_size = -1024;
+SELECT @@global.delayed_queue_size;
+SET @@global.delayed_queue_size = 42949672950;
+SELECT @@global.delayed_queue_size;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.delayed_queue_size = 429496729.5;
+SELECT @@global.delayed_queue_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.delayed_queue_size = ON;
+SELECT @@delayed_queue_size;
+
+--echo '#-------------------FN_DYNVARS_026_05----------------------------#'
+############################################################################
+# Test if accessing session delayed_queue_size gives error #
+############################################################################
+
+--Error 1229
+SET @@session.delayed_queue_size = 0;
+--Error 1238
+SELECT @@session.delayed_queue_size;
+
+--echo '#----------------------FN_DYNVARS_026_06------------------------#'
+##############################################################################
+# Check if the value in GLOBAL & SESSION Tables matches values in variable #
+##############################################################################
+
+SELECT @@global.delayed_queue_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='delayed_queue_size';
+
+SELECT @@delayed_queue_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='delayed_queue_size';
+
+
+--echo '#---------------------FN_DYNVARS_026_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.delayed_queue_size = TRUE;
+SELECT @@global.delayed_queue_size;
+SET @@global.delayed_queue_size = FALSE;
+SELECT @@global.delayed_queue_size;
+
+--echo '#---------------------FN_DYNVARS_026_08----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@global.delayed_queue_size = 1;
+SELECT @@delayed_queue_size = @@global.delayed_queue_size;
+
+
+--echo '#---------------------FN_DYNVARS_026_09----------------------#'
+###########################################################################
+# Check if delayed_queue_size can be accessed with and without @@ sign #
+###########################################################################
+
+--Error 1229
+SET delayed_queue_size = 1;
+SELECT @@delayed_queue_size;
+--Error ER_UNKNOWN_TABLE
+SELECT local.delayed_queue_size;
+--Error ER_UNKNOWN_TABLE
+SELECT global.delayed_queue_size;
+--Error ER_BAD_FIELD_ERROR
+SELECT delayed_queue_size = @@session.delayed_queue_size;
+
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.delayed_queue_size = @start_value;
+SELECT @@global.delayed_queue_size;
+
+
+###########################################################
+# END OF delayed_queue_size TESTS #
+###########################################################
+
diff --git a/mysql-test/suite/sys_vars/t/disconnect_on_expired_password_grant.test b/mysql-test/suite/sys_vars/t/disconnect_on_expired_password_grant.test
new file mode 100644
index 00000000..0d317d29
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/disconnect_on_expired_password_grant.test
@@ -0,0 +1,56 @@
+--source include/not_embedded.inc
+
+SET @global=@@global.disconnect_on_expired_password;
+
+--echo #
+--echo # MDEV-21961 Bind CONNECTION ADMIN to a number of global system variables
+--echo #
+
+--echo # Test that "SET disconnect_on_expired_password" is not allowed without CONNECTION ADMIN or SUPER
+
+CREATE USER user1@localhost;
+GRANT ALL PRIVILEGES ON *.* TO user1@localhost;
+REVOKE CONNECTION ADMIN, SUPER ON *.* FROM user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+SET GLOBAL disconnect_on_expired_password=1;
+--error ER_GLOBAL_VARIABLE
+SET disconnect_on_expired_password=1;
+--error ER_GLOBAL_VARIABLE
+SET SESSION disconnect_on_expired_password=1;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET disconnect_on_expired_password" is allowed with CONNECTION ADMIN
+
+CREATE USER user1@localhost;
+GRANT CONNECTION ADMIN ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+SET GLOBAL disconnect_on_expired_password=1;
+--error ER_GLOBAL_VARIABLE
+SET disconnect_on_expired_password=1;
+--error ER_GLOBAL_VARIABLE
+SET SESSION disconnect_on_expired_password=1;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET disconnect_on_expired_password" is allowed with SUPER
+
+CREATE USER user1@localhost;
+GRANT SUPER ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+SET GLOBAL disconnect_on_expired_password=1;
+--error ER_GLOBAL_VARIABLE
+SET disconnect_on_expired_password=1;
+--error ER_GLOBAL_VARIABLE
+SET SESSION disconnect_on_expired_password=1;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+SET @@global.disconnect_on_expired_password=@global;
diff --git a/mysql-test/suite/sys_vars/t/div_precision_increment_basic.test b/mysql-test/suite/sys_vars/t/div_precision_increment_basic.test
new file mode 100644
index 00000000..6399288c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/div_precision_increment_basic.test
@@ -0,0 +1,204 @@
+############## mysql-test\t\div_precision_increment_basic.test #################
+# #
+# Variable Name: div_precision_increment #
+# Scope: GLOBAL & SESSION #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 4 #
+# Range: 0 - 30 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable "div_precision_increment" #
+# that checks behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity . #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_div_precision_increment #
+# #
+################################################################################
+
+--source include/load_sysvars.inc
+
+#######################################################################
+# START OF div_precision_increment TESTS #
+#######################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.div_precision_increment;
+SELECT @start_global_value;
+SET @start_session_value = @@session.div_precision_increment;
+SELECT @start_session_value;
+
+--echo '#--------------------FN_DYNVARS_027_01-------------------------#'
+#######################################################################
+# Display the DEFAULT value of div_precision_increment #
+#######################################################################
+
+SET @@global.div_precision_increment = 100;
+SET @@global.div_precision_increment = DEFAULT;
+SELECT @@global.div_precision_increment;
+
+SET @@session.div_precision_increment = 200;
+SET @@session.div_precision_increment = DEFAULT;
+SELECT @@session.div_precision_increment;
+
+--echo '#--------------------FN_DYNVARS_027_02-------------------------#'
+#######################################################################
+# Check the DEFAULT value of div_precision_increment #
+#######################################################################
+
+SET @@global.div_precision_increment = @start_global_value;
+SELECT @@global.div_precision_increment = 4;
+
+SET @@session.div_precision_increment = @start_session_value;
+SELECT @@session.div_precision_increment = 4;
+
+--echo '#--------------------FN_DYNVARS_027_03-------------------------#'
+#################################################################################
+# Change the value of div_precision_increment to a valid value for GLOBAL Scope #
+#################################################################################
+
+SET @@global.div_precision_increment = 1;
+SELECT @@global.div_precision_increment;
+SET @@global.div_precision_increment = 0;
+SELECT @@global.div_precision_increment;
+SET @@global.div_precision_increment = 10;
+SELECT @@global.div_precision_increment;
+SET @@global.div_precision_increment = 30;
+SELECT @@global.div_precision_increment;
+
+
+--echo '#--------------------FN_DYNVARS_027_04-------------------------#'
+##################################################################################
+# Change the value of div_precision_increment to a valid value for SESSION Scope #
+##################################################################################
+
+SET @@session.div_precision_increment = 1;
+SELECT @@session.div_precision_increment;
+SET @@session.div_precision_increment = 0;
+SELECT @@session.div_precision_increment;
+SET @@session.div_precision_increment = 7;
+SELECT @@session.div_precision_increment;
+SET @@session.div_precision_increment = 30;
+SELECT @@session.div_precision_increment;
+
+
+--echo '#------------------FN_DYNVARS_027_05-----------------------#'
+###################################################################
+# Change the value of div_precision_increment to an invalid value #
+###################################################################
+
+SET @@global.div_precision_increment = 39;
+SELECT @@global.div_precision_increment;
+SET @@global.div_precision_increment = 50;
+SELECT @@global.div_precision_increment;
+SET @@global.div_precision_increment = -1024;
+SELECT @@global.div_precision_increment;
+SET @@global.div_precision_increment = 65536;
+SELECT @@global.div_precision_increment;
+SET @@session.div_precision_increment = 50;
+SELECT @@session.div_precision_increment;
+SET @@session.div_precision_increment = 37;
+SELECT @@session.div_precision_increment;
+SET @@session.div_precision_increment = -2;
+SELECT @@session.div_precision_increment;
+SET @@session.div_precision_increment = 65550;
+SELECT @@session.div_precision_increment;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.div_precision_increment = 65530.30;
+SELECT @@global.div_precision_increment;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.div_precision_increment = OFF;
+SELECT @@global.div_precision_increment;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.div_precision_increment = ON;
+SELECT @@session.div_precision_increment;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.div_precision_increment = 65530.30;
+SELECT @@session.div_precision_increment;
+
+
+--echo '#------------------FN_DYNVARS_027_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+SELECT @@global.div_precision_increment = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='div_precision_increment';
+
+--echo '#------------------FN_DYNVARS_027_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.div_precision_increment = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='div_precision_increment';
+
+
+# FN_DYNVARS_027_07 - Check if TRUE and FALSE values can be used on variable
+SET @@global.div_precision_increment = TRUE;
+SELECT @@global.div_precision_increment;
+SET @@global.div_precision_increment = FALSE;
+SELECT @@global.div_precision_increment;
+
+
+--echo '#---------------------FN_DYNVARS_027_08----------------------#'
+####################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+####################################################################################
+
+SET @@global.div_precision_increment = 0;
+SELECT @@div_precision_increment = @@global.div_precision_increment;
+
+
+--echo '#---------------------FN_DYNVARS_027_09----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@div_precision_increment = 1;
+SELECT @@div_precision_increment = @@local.div_precision_increment;
+SELECT @@local.div_precision_increment = @@session.div_precision_increment;
+
+
+--echo '#---------------------FN_DYNVARS_027_10----------------------#'
+##################################################################################
+# Check if div_precision_increment can be accessed with and without @@ sign #
+##################################################################################
+
+SET div_precision_increment = 1;
+SELECT @@div_precision_increment;
+--Error ER_UNKNOWN_TABLE
+SELECT local.div_precision_increment;
+--Error ER_UNKNOWN_TABLE
+SELECT session.div_precision_increment;
+--Error ER_BAD_FIELD_ERROR
+SELECT div_precision_increment = @@session.div_precision_increment;
+
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.div_precision_increment = @start_global_value;
+SELECT @@global.div_precision_increment;
+SET @@session.div_precision_increment = @start_session_value;
+SELECT @@session.div_precision_increment;
+
+
+#######################################################
+# END OF div_precision_increment TESTS #
+#######################################################
+
diff --git a/mysql-test/suite/sys_vars/t/div_precision_increment_func.test b/mysql-test/suite/sys_vars/t/div_precision_increment_func.test
new file mode 100644
index 00000000..afce8bf7
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/div_precision_increment_func.test
@@ -0,0 +1,121 @@
+############## mysql-test\t\div_precision_increment_func.test #################
+# #
+# Variable Name: div_precision_increment #
+# Scope: GLOBAL & SESSION #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 4 #
+# Range: 0 - 30 #
+# #
+# #
+# Creation Date: 2008-03-07 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable "div_precision_increment" #
+# that checks functionality of this variable #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_div_precision_increment #
+# #
+################################################################################
+
+let $save_div_precision_increment = `SELECT @@global.div_precision_increment`;
+
+#SET @save_div_precision_increment = @@global.div_precision_increment;
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#########################
+# Creating new table #
+#########################
+
+--echo ## Creating new table ##
+CREATE TABLE t1
+(
+id INT NOT NULL auto_increment,
+PRIMARY KEY (id),
+name VARCHAR(30),
+salary INT
+);
+
+--echo '#--------------------FN_DYNVARS_027_01-------------------------#'
+####################################################################
+# Setting initial value of div_precision_increment to 1
+# to check whether it is working with columns or not.
+####################################################################
+
+--echo ## Setting initial session value of variable to 3 ##
+SET @@session.div_precision_increment = 3;
+
+--echo ## Inserting some rows in table ##
+INSERT into t1(name, salary) values('Record_1', 100011);
+INSERT into t1(name, salary) values('Record_2', 501);
+INSERT into t1(name, salary) values('Record_3', 210);
+
+SELECT name, salary, ((salary * 2.5)/1000) AS INCOME from t1;
+
+--echo ## Verifying variable's behavior with direct division ##
+SELECT 1/7;
+
+--echo '#--------------------FN_DYNVARS_027_02-------------------------#'
+####################################################################
+# Verifying div_precision_increment behavior by inserting rows
+# to check whether it is working with columns or not.
+####################################################################
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#########################
+# Creating new table #
+#########################
+
+--echo ## Creating new table ##
+CREATE TABLE t1
+(
+id INT NOT NULL auto_increment,
+PRIMARY KEY (id),
+name VARCHAR(30),
+salary INT,
+income_tax FLOAT
+);
+
+connect (test_con1, localhost, root,,);
+connection test_con1;
+
+--echo ## Setting global & session scope value of variable ##
+SET @@global.div_precision_increment = 2;
+SET @@session.div_precision_increment = 1;
+SELECT @@global.div_precision_increment;
+SELECT @@session.div_precision_increment;
+
+--echo ## Inserting some data and verifying behavior of variable ##
+INSERT into t1(name, salary, income_tax) values('Record_1', 100011, 100011*2.5/1000);
+INSERT into t1(name, salary, income_tax) values('Record_2', 501, 501*2.5/1000);
+INSERT into t1(name, salary, income_tax) values('Record_3', 210, 210*2.5/1000);
+SELECT * from t1;
+
+connect (test_con2, localhost, root,,);
+connection test_con2;
+
+--echo ## Verifying session & global value of variable ##
+SELECT @@global.div_precision_increment = 2;
+SELECT @@session.div_precision_increment = 2;
+
+--echo ## Verifying behavior of variable by inserting some rows in table ##
+INSERT into t1(name, salary, income_tax) values('Record_4', 100011, 100011*2.5/1000);
+INSERT into t1(name, salary, income_tax) values('Record_5', 501, 501*2.5/1000);
+INSERT into t1(name, salary, income_tax) values('Record_6', 210, 210*2.5/1000);
+SELECT * from t1;
+
+--echo ## Dropping table t1 ##
+drop table t1;
+
+disconnect test_con1;
+disconnect test_con2;
+
+connection default;
+eval SET @@global.div_precision_increment = $save_div_precision_increment;
diff --git a/mysql-test/suite/sys_vars/t/encrypt_tmp_disk_tables_basic.test b/mysql-test/suite/sys_vars/t/encrypt_tmp_disk_tables_basic.test
new file mode 100644
index 00000000..ee01e6d8
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/encrypt_tmp_disk_tables_basic.test
@@ -0,0 +1,41 @@
+# bool global
+--source include/have_maria.inc
+
+SET @start_global_value = @@global.encrypt_tmp_disk_tables;
+
+#
+# exists as global only
+#
+select @@global.encrypt_tmp_disk_tables;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.encrypt_tmp_disk_tables;
+show global variables like 'encrypt_tmp_disk_tables';
+show session variables like 'encrypt_tmp_disk_tables';
+select * from information_schema.global_variables
+where variable_name='encrypt_tmp_disk_tables';
+select * from information_schema.session_variables
+where variable_name='encrypt_tmp_disk_tables';
+
+#
+# show that it's writable
+#
+set global encrypt_tmp_disk_tables=ON;
+select @@global.encrypt_tmp_disk_tables;
+set global encrypt_tmp_disk_tables=OFF;
+select @@global.encrypt_tmp_disk_tables;
+set global encrypt_tmp_disk_tables=1;
+select @@global.encrypt_tmp_disk_tables;
+--error ER_GLOBAL_VARIABLE
+set session encrypt_tmp_disk_tables=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global encrypt_tmp_disk_tables=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global encrypt_tmp_disk_tables=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global encrypt_tmp_disk_tables="foo";
+
+SET @@global.encrypt_tmp_disk_tables = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/enforce_storage_engine_basic.test b/mysql-test/suite/sys_vars/t/enforce_storage_engine_basic.test
new file mode 100644
index 00000000..62627a1e
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/enforce_storage_engine_basic.test
@@ -0,0 +1,40 @@
+--source include/not_embedded.inc
+--source include/have_innodb.inc
+--source include/load_sysvars.inc
+
+SET @start_session_value = @@session.enforce_storage_engine;
+
+SET @@session.enforce_storage_engine = INNODB;
+SET @@session.enforce_storage_engine = DEFAULT;
+
+SELECT @@session.enforce_storage_engine;
+
+SET @@session.enforce_storage_engine = MYISAM;
+SELECT @@session.enforce_storage_engine;
+SET @@session.enforce_storage_engine = MERGE;
+SELECT @@session.enforce_storage_engine;
+SET @@session.enforce_storage_engine = MEMORY;
+SELECT @@session.enforce_storage_engine;
+SET @@session.enforce_storage_engine = INNODB;
+SELECT @@session.enforce_storage_engine;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.enforce_storage_engine = 8199;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.enforce_storage_engine = 65530.34;
+
+--Error ER_UNKNOWN_STORAGE_ENGINE
+SET @@session.enforce_storage_engine = RECORD;
+
+SELECT @@session.enforce_storage_engine =
+ VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+ WHERE VARIABLE_NAME='enforce_storage_engine';
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.enforce_storage_engine = TRUE;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.enforce_storage_engine = FALSE;
+
+SET @@session.enforce_storage_engine = @start_session_value;
diff --git a/mysql-test/suite/sys_vars/t/error_count_basic.test b/mysql-test/suite/sys_vars/t/error_count_basic.test
new file mode 100644
index 00000000..14001874
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/error_count_basic.test
@@ -0,0 +1,97 @@
+
+
+################## mysql-test\t\error_count_basic.test ########################
+# #
+# Variable Name: error_count #
+# Scope: Session #
+# Access Type: Static #
+# Data Type: numeric #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable error_count #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--echo '#---------------------BS_STVARS_005_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+
+SELECT COUNT(@@SESSION.error_count);
+--echo 1 Expected
+
+--echo '#---------------------BS_STVARS_005_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@SESSION.error_count=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@SESSION.error_count);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_005_03----------------------#'
+#################################################################
+# Check if the value in SESSION Table matches value in variable #
+#################################################################
+
+SELECT @@SESSION.error_count = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='error_count';
+--echo 1 Expected
+
+SELECT COUNT(@@SESSION.error_count);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='error_count';
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_005_04----------------------#'
+################################################################################
+# Check if accessing variable with and without SESSION point to same variable #
+################################################################################
+SELECT @@error_count = @@SESSION.error_count;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_005_05----------------------#'
+################################################################################
+# Check if error_count can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@error_count);
+--echo 1 Expected
+SELECT COUNT(@@local.error_count);
+--echo 1 Expected
+SELECT COUNT(@@SESSION.error_count);
+--echo 1 Expected
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@GLOBAL.error_count);
+--echo Expected error 'Variable is a SESSION variable'
+
+--error ER_BAD_FIELD_ERROR
+SELECT COUNT(error_count = @@GLOBAL.error_count);
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/event_scheduler_basic.test b/mysql-test/suite/sys_vars/t/event_scheduler_basic.test
new file mode 100644
index 00000000..acd7d4bd
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/event_scheduler_basic.test
@@ -0,0 +1,169 @@
+#################### mysql-test\t\event_scheduler_basic.test ###################
+# #
+# Variable Name: event_scheduler #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: Enumeration #
+# Default Value: OFF #
+# Valid Values: ON, OFF, DISABLED #
+# #
+# #
+# Creation Date: 2008-03-14 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable "event_scheduler" #
+# that checks behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-options.html#option_mysqld_event-scheduler #
+# #
+################################################################################
+--source include/not_embedded.inc
+--source include/load_sysvars.inc
+
+###############################################################
+# START OF event_scheduler TESTS #
+###############################################################
+
+
+#######################################################################
+# Saving initial value of event_scheduler in a temporary variable #
+#######################################################################
+
+SET @start_value = @@global.event_scheduler;
+SELECT @start_value;
+
+
+--echo '#---------------------FN_DYNVARS_004_01-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@global.event_scheduler = DEFAULT;
+SELECT @@global.event_scheduler;
+
+--echo '#--------------------FN_DYNVARS_004_02------------------------#'
+#######################################################################
+# Change the value of event_scheduler to a valid value #
+#######################################################################
+
+SET @@global.event_scheduler = ON;
+SELECT @@global.event_scheduler;
+SET @@global.event_scheduler = OFF;
+SELECT @@global.event_scheduler;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.event_scheduler = DISABLED;
+SELECT @@global.event_scheduler;
+
+
+--echo '#--------------------FN_DYNVARS_004_03-------------------------#'
+#######################################################################
+# Change the value of event_scheduler to invalid value #
+#######################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.event_scheduler = 2;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.event_scheduler = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.event_scheduler = TRUEF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.event_scheduler = TRUE_F;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.event_scheduler = FALSE0;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.event_scheduler = OON;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.event_scheduler = ONN;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.event_scheduler = OOFF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.event_scheduler = 0FF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.event_scheduler = ' ';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.event_scheduler = " ";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.event_scheduler = '';
+
+
+--echo '#-------------------FN_DYNVARS_004_04----------------------------#'
+###################################################################
+# Test if accessing session event_scheduler gives error #
+###################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.event_scheduler = OFF;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.event_scheduler;
+
+
+--echo '#----------------------FN_DYNVARS_004_05------------------------#'
+##############################################################################
+# Check if the value in GLOBAL Tables matches values in variable #
+##############################################################################
+
+SELECT @@global.event_scheduler = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='event_scheduler';
+
+
+--echo '#---------------------FN_DYNVARS_004_06----------------------#'
+###################################################################
+# Check if 0 and 1 values can be used on variable #
+###################################################################
+
+SET @@global.event_scheduler = 0;
+SELECT @@global.event_scheduler;
+SET @@global.event_scheduler = 1;
+SELECT @@global.event_scheduler;
+
+--echo '#---------------------FN_DYNVARS_004_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.event_scheduler = TRUE;
+SELECT @@global.event_scheduler;
+SET @@global.event_scheduler = FALSE;
+SELECT @@global.event_scheduler;
+
+--echo '#---------------------FN_DYNVARS_004_08----------------------#'
+##############################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points #
+# to same session variable #
+##############################################################################
+
+SET @@global.event_scheduler = ON;
+SELECT @@event_scheduler = @@global.event_scheduler;
+
+--echo '#---------------------FN_DYNVARS_004_09----------------------#'
+#######################################################################
+# Check if event_scheduler can be accessed with and without @@ sign #
+#######################################################################
+--Error ER_GLOBAL_VARIABLE
+SET event_scheduler = ON;
+--Error ER_UNKNOWN_TABLE
+SELECT local.event_scheduler;
+--Error ER_UNKNOWN_TABLE
+SELECT global.event_scheduler;
+--Error ER_BAD_FIELD_ERROR
+SELECT event_scheduler = @@session.event_scheduler;
+
+
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.event_scheduler = @start_value;
+SELECT @@global.event_scheduler;
+
+
+#####################################################
+# END OF event_scheduler TESTS #
+#####################################################
diff --git a/mysql-test/suite/sys_vars/t/expensive_subquery_limit_basic.test b/mysql-test/suite/sys_vars/t/expensive_subquery_limit_basic.test
new file mode 100644
index 00000000..c86433e9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/expensive_subquery_limit_basic.test
@@ -0,0 +1,38 @@
+SET @start_global_value = @@global.expensive_subquery_limit;
+SELECT @start_global_value;
+
+#
+# exists as global and session
+#
+select @@global.expensive_subquery_limit;
+select @@session.expensive_subquery_limit;
+show global variables like 'expensive_subquery_limit';
+show session variables like 'expensive_subquery_limit';
+select * from information_schema.global_variables where variable_name='expensive_subquery_limit';
+select * from information_schema.session_variables where variable_name='expensive_subquery_limit';
+
+#
+# show that it's writable
+#
+set global expensive_subquery_limit=10;
+set session expensive_subquery_limit=20;
+select @@global.expensive_subquery_limit;
+select @@session.expensive_subquery_limit;
+show global variables like 'expensive_subquery_limit';
+show session variables like 'expensive_subquery_limit';
+select * from information_schema.global_variables where variable_name='expensive_subquery_limit';
+select * from information_schema.session_variables where variable_name='expensive_subquery_limit';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global expensive_subquery_limit=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global expensive_subquery_limit=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global expensive_subquery_limit="foo";
+
+SET @@global.expensive_subquery_limit = @start_global_value;
+SELECT @@global.expensive_subquery_limit;
+
diff --git a/mysql-test/suite/sys_vars/t/expire_logs_days_basic.test b/mysql-test/suite/sys_vars/t/expire_logs_days_basic.test
new file mode 100644
index 00000000..3ea0f55a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/expire_logs_days_basic.test
@@ -0,0 +1,170 @@
+############## mysql-test\t\expire_logs_days_basic.test ###############
+# #
+# Variable Name: expire_logs_days #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: double #
+# Default Value:0 #
+# Range: 0-99 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable expire_logs_days #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+
+########################################################################
+# START OF expire_logs_days TESTS #
+########################################################################
+
+
+########################################################################
+# Saving initial value of expire_logs_days in a temporary variable #
+########################################################################
+
+SET @start_value = @@global.expire_logs_days;
+
+
+--echo '#--------------------FN_DYNVARS_029_01------------------------#'
+########################################################################
+# Display the DEFAULT value of expire_logs_days #
+########################################################################
+
+SET @@global.expire_logs_days = 99;
+SET @@global.expire_logs_days = DEFAULT;
+SELECT @@global.expire_logs_days = 0;
+
+
+--echo '#---------------------FN_DYNVARS_029_02-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@global.expire_logs_days = @start_value;
+SELECT @@global.expire_logs_days = @start_value;
+
+
+--echo '#--------------------FN_DYNVARS_029_03------------------------#'
+########################################################################
+# Change the value of expire_logs_days to a valid value #
+########################################################################
+
+SET @@global.expire_logs_days = 0;
+SELECT @@global.expire_logs_days;
+SET @@global.expire_logs_days = 99;
+SELECT @@global.expire_logs_days;
+SET @@global.expire_logs_days = 10;
+SELECT @@global.expire_logs_days;
+SET @@global.expire_logs_days = 21;
+SELECT @@global.expire_logs_days;
+
+
+--echo '#--------------------FN_DYNVARS_029_04-------------------------#'
+###########################################################################
+# Change the value of expire_logs_days to invalid value #
+###########################################################################
+
+SET @@global.expire_logs_days = -1;
+SELECT @@global.expire_logs_days;
+SET @@global.expire_logs_days = 100;
+SELECT @@global.expire_logs_days;
+SET @@global.expire_logs_days = 1024;
+SELECT @@global.expire_logs_days;
+SET @@global.expire_logs_days = 10000.01;
+SELECT @@global.expire_logs_days;
+SET @@global.expire_logs_days = -1024;
+SELECT @@global.expire_logs_days;
+SET @@global.expire_logs_days = 42949672950;
+SELECT @@global.expire_logs_days;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.expire_logs_days = ON;
+SELECT @@global.expire_logs_days;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.expire_logs_days = 'test';
+SELECT @@global.expire_logs_days;
+
+
+--echo '#-------------------FN_DYNVARS_029_05----------------------------#'
+###########################################################################
+# Test if accessing session expire_logs_days gives error #
+###########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.expire_logs_days = 0;
+SELECT @@expire_logs_days;
+
+
+--echo '#----------------------FN_DYNVARS_029_06------------------------#'
+##############################################################################
+# Check if the value in GLOBAL & SESSION Tables matches values in variable #
+##############################################################################
+
+SELECT @@global.expire_logs_days = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='expire_logs_days';
+
+SELECT @@expire_logs_days = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='expire_logs_days';
+
+
+
+--echo '#---------------------FN_DYNVARS_029_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.expire_logs_days = TRUE;
+SELECT @@global.expire_logs_days;
+SET @@global.expire_logs_days = FALSE;
+SELECT @@global.expire_logs_days;
+
+
+--echo '#---------------------FN_DYNVARS_029_08----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@global.expire_logs_days = 1;
+SELECT @@expire_logs_days = @@global.expire_logs_days;
+
+
+--echo '#---------------------FN_DYNVARS_029_09----------------------#'
+##########################################################################
+# Check if expire_logs_days can be accessed with and without @@ sign #
+##########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET expire_logs_days = 1;
+SELECT @@expire_logs_days;
+--Error ER_UNKNOWN_TABLE
+SELECT local.expire_logs_days;
+--Error ER_UNKNOWN_TABLE
+SELECT global.expire_logs_days;
+--Error ER_BAD_FIELD_ERROR
+SELECT expire_logs_days = @@session.expire_logs_days;
+
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.expire_logs_days = @start_value;
+
+########################################################################
+# END OF expire_logs_days TESTS #
+########################################################################
diff --git a/mysql-test/suite/sys_vars/t/expire_logs_days_grant.test b/mysql-test/suite/sys_vars/t/expire_logs_days_grant.test
new file mode 100644
index 00000000..65099b74
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/expire_logs_days_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21963 Bind BINLOG ADMIN to a number of global system variables
+--echo #
+
+--let var = expire_logs_days
+--let grant = BINLOG ADMIN
+--let value = 33
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/explicit_defaults_for_timestamp_off.test b/mysql-test/suite/sys_vars/t/explicit_defaults_for_timestamp_off.test
new file mode 100644
index 00000000..3f881761
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/explicit_defaults_for_timestamp_off.test
@@ -0,0 +1,3 @@
+set @@explicit_defaults_for_timestamp=0;
+
+--source inc/explicit_defaults_for_timestamp.inc
diff --git a/mysql-test/suite/sys_vars/t/explicit_defaults_for_timestamp_on.test b/mysql-test/suite/sys_vars/t/explicit_defaults_for_timestamp_on.test
new file mode 100644
index 00000000..67b93824
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/explicit_defaults_for_timestamp_on.test
@@ -0,0 +1,3 @@
+set @@explicit_defaults_for_timestamp=1;
+
+--source inc/explicit_defaults_for_timestamp.inc
diff --git a/mysql-test/suite/sys_vars/t/external_user_basic.test b/mysql-test/suite/sys_vars/t/external_user_basic.test
new file mode 100644
index 00000000..3ba4c2d6
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/external_user_basic.test
@@ -0,0 +1 @@
+SELECT @@SESSION.EXTERNAL_USER FROM DUAL;
diff --git a/mysql-test/suite/sys_vars/t/extra_max_connections_basic.test b/mysql-test/suite/sys_vars/t/extra_max_connections_basic.test
new file mode 100644
index 00000000..214e64eb
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/extra_max_connections_basic.test
@@ -0,0 +1,42 @@
+# ulong global
+
+SET @start_global_value = @@global.extra_max_connections;
+
+#
+# exists as global only
+#
+select @@global.extra_max_connections;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.extra_max_connections;
+show global variables like 'extra_max_connections';
+show session variables like 'extra_max_connections';
+select * from information_schema.global_variables where variable_name='extra_max_connections';
+select * from information_schema.session_variables where variable_name='extra_max_connections';
+
+#
+# show that it's writable
+#
+set global extra_max_connections=1;
+select @@global.extra_max_connections;
+--error ER_GLOBAL_VARIABLE
+set session extra_max_connections=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global extra_max_connections=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global extra_max_connections=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global extra_max_connections="foo";
+
+#
+# min/max values
+#
+set global extra_max_connections=0;
+select @@global.extra_max_connections;
+set global extra_max_connections=cast(-1 as unsigned int);
+select @@global.extra_max_connections;
+
+SET @@global.extra_max_connections = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/extra_max_connections_grant.test b/mysql-test/suite/sys_vars/t/extra_max_connections_grant.test
new file mode 100644
index 00000000..058364ec
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/extra_max_connections_grant.test
@@ -0,0 +1,56 @@
+--source include/not_embedded.inc
+
+SET @global=@@global.extra_max_connections;
+
+--echo #
+--echo # MDEV-21961 Bind CONNECTION ADMIN to a number of global system variables
+--echo #
+
+--echo # Test that "SET extra_max_connections" is not allowed without CONNECTION ADMIN or SUPER
+
+CREATE USER user1@localhost;
+GRANT ALL PRIVILEGES ON *.* TO user1@localhost;
+REVOKE CONNECTION ADMIN, SUPER ON *.* FROM user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+SET GLOBAL extra_max_connections=10;
+--error ER_GLOBAL_VARIABLE
+SET extra_max_connections=10;
+--error ER_GLOBAL_VARIABLE
+SET SESSION extra_max_connections=10;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET extra_max_connections" is allowed with CONNECTION ADMIN
+
+CREATE USER user1@localhost;
+GRANT CONNECTION ADMIN ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+SET GLOBAL extra_max_connections=10;
+--error ER_GLOBAL_VARIABLE
+SET extra_max_connections=10;
+--error ER_GLOBAL_VARIABLE
+SET SESSION extra_max_connections=10;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET extra_max_connections" is allowed with SUPER
+
+CREATE USER user1@localhost;
+GRANT SUPER ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+SET GLOBAL extra_max_connections=10;
+--error ER_GLOBAL_VARIABLE
+SET extra_max_connections=10;
+--error ER_GLOBAL_VARIABLE
+SET SESSION extra_max_connections=10;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+SET @@global.extra_max_connections=@global;
diff --git a/mysql-test/suite/sys_vars/t/extra_port_basic.test b/mysql-test/suite/sys_vars/t/extra_port_basic.test
new file mode 100644
index 00000000..af5500e7
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/extra_port_basic.test
@@ -0,0 +1,21 @@
+# ulong readonly
+
+#
+# show the global and session values;
+#
+select @@global.extra_port;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.extra_port;
+show global variables like 'extra_port';
+show session variables like 'extra_port';
+select * from information_schema.global_variables where variable_name='extra_port';
+select * from information_schema.session_variables where variable_name='extra_port';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global extra_port=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session extra_port=1;
+
diff --git a/mysql-test/suite/sys_vars/t/flush_basic.test b/mysql-test/suite/sys_vars/t/flush_basic.test
new file mode 100644
index 00000000..842d0caa
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/flush_basic.test
@@ -0,0 +1,168 @@
+############## mysql-test\t\flush_basic.test ##################################
+# #
+# Variable Name: flush #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: boolean #
+# Default Value: OFF #
+# Range: #
+# #
+# #
+# Creation Date: 2008-02-09 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable flush #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-options.html#option_mysqld_flush #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+########################################################################
+# START OF flush TESTS #
+########################################################################
+
+
+#############################################################
+# Saving initial value of flush in a temporary variable #
+#############################################################
+
+SET @start_value = @@global.flush;
+SELECT @start_value;
+
+
+--echo '#--------------------FN_DYNVARS_030_01------------------------#'
+#############################################################
+# Display the DEFAULT value of flush #
+#############################################################
+
+SET @@global.flush = ON;
+SET @@global.flush = DEFAULT;
+SELECT @@global.flush;
+
+
+--echo '#---------------------FN_DYNVARS_030_02-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@global.flush = @start_value;
+SELECT @@global.flush;
+
+
+--echo '#--------------------FN_DYNVARS_030_03------------------------#'
+#############################################################
+# Change the value of flush to a valid value #
+#############################################################
+
+SET @@global.flush = ON;
+SELECT @@global.flush;
+SET @@global.flush = OFF;
+SELECT @@global.flush;
+SET @@global.flush = 0;
+SELECT @@global.flush;
+SET @@global.flush = 1;
+SELECT @@global.flush;
+
+
+--echo '#--------------------FN_DYNVARS_030_04-------------------------#'
+###########################################################################
+# Change the value of flush to invalid value #
+###########################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.flush = 2;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.flush = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.flush = TRUEF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.flush = TRUE_F;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.flush = FALSE0;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.flush = OON;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.flush = ONN;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.flush = OOFF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.flush = 0FF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.flush = ' ';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.flush = " ";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.flush = '';
+
+
+--echo '#-------------------FN_DYNVARS_030_05----------------------------#'
+###########################################################################
+# Test if accessing session flush gives error #
+###########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.flush = 1;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.flush;
+
+
+--echo '#----------------------FN_DYNVARS_030_06------------------------#'
+####################################################################
+# Check if the value in GLOBAL Tables matches values in variable #
+####################################################################
+
+SELECT IF(@@global.flush, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='flush';
+
+
+--echo '#---------------------FN_DYNVARS_030_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.flush = TRUE;
+SELECT @@global.flush;
+SET @@global.flush = FALSE;
+SELECT @@global.flush;
+
+
+--echo '#---------------------FN_DYNVARS_030_08----------------------#'
+###############################################################################
+# Check if accessing variable without SCOPE points to same global variable #
+###############################################################################
+
+SET @@global.flush = 1;
+SELECT @@flush = @@global.flush;
+
+--echo '#---------------------FN_DYNVARS_030_09----------------------#'
+##########################################################################
+# Check if flush can be accessed with and without @@ sign #
+##########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET flush = 1;
+--Error ER_UNKNOWN_TABLE
+SELECT global.flush;
+--Error ER_BAD_FIELD_ERROR
+SELECT flush = @@session.flush;
+
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.flush = @start_value;
+SELECT @@global.flush;
+
+
+#############################################################
+# END OF flush TESTS #
+#############################################################
diff --git a/mysql-test/suite/sys_vars/t/flush_time_basic.test b/mysql-test/suite/sys_vars/t/flush_time_basic.test
new file mode 100644
index 00000000..9604769d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/flush_time_basic.test
@@ -0,0 +1,50 @@
+
+#
+# note, the default is 1800 on windows, 0 everywhere else
+#
+
+SET @start_global_value = @@global.flush_time;
+
+#
+# exists as global only
+#
+--replace_result 1800 0
+select @@global.flush_time;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.flush_time;
+--replace_result 1800 0
+show global variables like 'flush_time';
+--replace_result 1800 0
+show session variables like 'flush_time';
+--replace_result 1800 0
+select * from information_schema.global_variables where variable_name='flush_time';
+--replace_result 1800 0
+select * from information_schema.session_variables where variable_name='flush_time';
+
+#
+# show that it's writable
+#
+set global flush_time=1;
+select @@global.flush_time;
+--error ER_GLOBAL_VARIABLE
+set session flush_time=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global flush_time=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global flush_time=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global flush_time="foo";
+
+#
+# min/max values
+#
+set global flush_time=0;
+select @@global.flush_time;
+set global flush_time=cast(-1 as unsigned int);
+select @@global.flush_time;
+
+SET @@global.flush_time = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/foreign_key_checks_basic.test b/mysql-test/suite/sys_vars/t/foreign_key_checks_basic.test
new file mode 100644
index 00000000..8a327ab6
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/foreign_key_checks_basic.test
@@ -0,0 +1,165 @@
+############## mysql-test\t\foreign_key_checks_basic.test #####################
+# #
+# Variable Name: foreign_key_checks #
+# Scope: SESSION #
+# Access Type: Dynamic #
+# Data Type: boolean #
+# Default Value: NA #
+# Range: NA #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable foreign_key_checks #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF foreign_key_checks TESTS #
+########################################################################
+
+
+################################################################################
+# Saving initial value of foreign_key_checks in a temporary variable #
+################################################################################
+
+SET @session_start_value = @@session.foreign_key_checks;
+SELECT @session_start_value;
+
+--echo '#--------------------FN_DYNVARS_032_01------------------------#'
+########################################################################
+# Display the DEFAULT value of foreign_key_checks #
+########################################################################
+
+SET @@session.foreign_key_checks = 1;
+SET @@session.foreign_key_checks = DEFAULT;
+SELECT @@session.foreign_key_checks;
+
+
+--echo '#---------------------FN_DYNVARS_032_02-------------------------#'
+#############################################################################
+# Check if foreign_key_checks can be accessed with and without @@ sign #
+#############################################################################
+
+SET foreign_key_checks = 1;
+SELECT @@foreign_key_checks;
+
+--Error ER_UNKNOWN_TABLE
+SELECT session.foreign_key_checks;
+
+--Error ER_UNKNOWN_TABLE
+SELECT local.foreign_key_checks;
+
+SET session foreign_key_checks = 0;
+SELECT @@session.foreign_key_checks;
+
+
+--echo '#--------------------FN_DYNVARS_032_03------------------------#'
+########################################################################
+# change the value of foreign_key_checks to a valid value #
+########################################################################
+
+SET @@session.foreign_key_checks = 0;
+SELECT @@session.foreign_key_checks;
+SET @@session.foreign_key_checks = 1;
+SELECT @@session.foreign_key_checks;
+
+
+--echo '#--------------------FN_DYNVARS_032_04-------------------------#'
+###########################################################################
+# Change the value of foreign_key_checks to invalid value #
+###########################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.foreign_key_checks = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.foreign_key_checks = 2;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.foreign_key_checks = "T";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.foreign_key_checks = "Y";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.foreign_key_checks = TRÜE;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.foreign_key_checks = ÕN;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.foreign_key_checks = OF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.foreign_key_checks = ÓFF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.foreign_key_checks = '¹';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.foreign_key_checks = NO;
+
+
+--echo '#-------------------FN_DYNVARS_032_05----------------------------#'
+###########################################################################
+# Test if accessing global foreign_key_checks gives error #
+###########################################################################
+
+SET @@global.foreign_key_checks = 0;
+SELECT @@global.foreign_key_checks;
+SET @@global.foreign_key_checks = 1;
+
+--echo '#----------------------FN_DYNVARS_032_06------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table contains variable value #
+#########################################################################
+
+SELECT count(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='foreign_key_checks';
+
+--echo '#----------------------FN_DYNVARS_032_07------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#########################################################################
+
+SELECT IF(@@session.foreign_key_checks, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='foreign_key_checks';
+SELECT @@session.foreign_key_checks;
+SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='foreign_key_checks';
+
+
+--echo '#---------------------FN_DYNVARS_032_08-------------------------#'
+###################################################################
+# Check if ON and OFF values can be used on variable #
+###################################################################
+
+SET @@session.foreign_key_checks = OFF;
+SELECT @@session.foreign_key_checks;
+SET @@session.foreign_key_checks = ON;
+SELECT @@session.foreign_key_checks;
+
+--echo '#---------------------FN_DYNVARS_032_09----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@session.foreign_key_checks = TRUE;
+SELECT @@session.foreign_key_checks;
+SET @@session.foreign_key_checks = FALSE;
+SELECT @@session.foreign_key_checks;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@session.foreign_key_checks = @session_start_value;
+SELECT @@session.foreign_key_checks;
+
+###############################################################
+# END OF foreign_key_checks TESTS #
+###############################################################
diff --git a/mysql-test/suite/sys_vars/t/foreign_key_checks_func.test b/mysql-test/suite/sys_vars/t/foreign_key_checks_func.test
new file mode 100644
index 00000000..7fe0eb84
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/foreign_key_checks_func.test
@@ -0,0 +1,131 @@
+############## mysql-test\t\foreign_key_checks_func.test #####################
+# #
+# Variable Name: foreign_key_checks #
+# Scope: SESSION #
+# Access Type: Dynamic #
+# Data Type: boolean #
+# Default Value: NA #
+# Range: NA #
+# #
+# #
+# Creation Date: 2008-03-08 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable foreign_key_checks #
+# that checks the behavior of this variable #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+
+--echo '#--------------------FN_DYNVARS_032_01-------------------------#'
+####################################################################
+# Check if setting foreign_key_checks is changed in new connection #
+####################################################################
+
+SET @@session.foreign_key_checks = 0;
+# con1 will be default connection from now on
+connect (con1,localhost,root,,,,);
+connection con1;
+SELECT @@session.foreign_key_checks;
+SET @@session.foreign_key_checks = 1;
+connect (con2,localhost,root,,,,);
+connection con2;
+SELECT @@session.foreign_key_checks;
+disconnect con2;
+
+--echo '#--------------------FN_DYNVARS_032_02-------------------------#'
+#################################################################
+# Begin the functionality Testing of foreign_key_checks #
+#################################################################
+
+connection con1;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2;
+--enable_warnings
+
+CREATE TABLE t1(a INT PRIMARY KEY)ENGINE = INNODB;
+CREATE TABLE t2(a INT PRIMARY KEY,b INT)ENGINE = INNODB;
+
+ALTER TABLE t2
+ADD CONSTRAINT fk FOREIGN KEY (b) REFERENCES t1 (a);
+
+#===========================================================
+--echo '---Check when foreign_key_checks is enabled---'
+#===========================================================
+
+
+SET @@session.foreign_key_checks = 1;
+
+INSERT INTO t1 values (1),(2),(3);
+
+INSERT INTO t2 values (10,1);
+--Error ER_NO_REFERENCED_ROW_2
+INSERT INTO t2 values (20,22);
+
+#===========================================================
+--echo '---Check when foreign_key_checks is disabled---'
+#===========================================================
+
+--Error ER_TRUNCATE_ILLEGAL_FK
+TRUNCATE t1;
+
+SET @@session.foreign_key_checks = 0;
+
+TRUNCATE t1;
+TRUNCATE t2;
+
+INSERT INTO t1 values (1),(2),(3);
+
+INSERT INTO t2 values (10,1);
+INSERT INTO t2 values (20,4);
+
+--echo 'try enabling foreign_key_checks again';
+SET @@session.foreign_key_checks = 1;
+
+UPDATE t2 SET b=4 where a=20;
+
+#==============================================================================
+--echo 'Check when foreign_key_checks is enabled and FK constraint is re-created'
+#==============================================================================
+
+SET @@session.foreign_key_checks = 0;
+TRUNCATE t2;
+TRUNCATE t1;
+
+INSERT INTO t1 values (1),(2),(3);
+INSERT INTO t2 values (10,1),(20,4);
+
+ALTER TABLE t2 DROP FOREIGN KEY fk;
+
+SET @@session.foreign_key_checks = 1;
+
+# Test disabled as error description is different. The resulting description has
+# difference in code #sql-xxx_2 where xxx is different for each run.
+#--Error ER_NO_REFERENCED_ROW_2
+#ALTER TABLE t2
+#ADD CONSTRAINT fk FOREIGN KEY (b) REFERENCES t1 (a);
+
+# delete all rows with incorrect reference
+DELETE FROM t2 WHERE b not in (SELECT a from t1);
+
+ALTER TABLE t2
+ADD CONSTRAINT fk FOREIGN KEY (b) REFERENCES t1 (a);
+
+INSERT INTO t2 values (20,2);
+
+SELECT * from t2;
+
+--disable_warnings
+DROP TABLE IF EXISTS t2;
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+##########################################################
+# End of functionality Testing for foreign_key_checks #
+##########################################################
+
diff --git a/mysql-test/suite/sys_vars/t/ft_boolean_syntax_basic.test b/mysql-test/suite/sys_vars/t/ft_boolean_syntax_basic.test
new file mode 100644
index 00000000..1d925a5e
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/ft_boolean_syntax_basic.test
@@ -0,0 +1,159 @@
+############## mysql-test\t\ft_boolean_syntax_basic.test ######################
+# #
+# Variable Name: ft_boolean_syntax #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: string #
+# Default Value: +-><()~*:""& #
+# Range: NA #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable ft_boolean_syntax #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+###################################################
+## START OF ft_boolean_syntax TESTS ##
+###################################################
+
+#############################################################
+# Save initial value #
+#############################################################
+# save using implicit session scope
+SET @global_start_value = @@global.ft_boolean_syntax;
+SELECT @global_start_value;
+
+--echo '#--------------------FN_DYNVARS_033_01------------------#'
+###############################################################################
+# Test Variable access and assignment with and without @@ #
+###############################################################################
+# select without @@
+--error ER_BAD_FIELD_ERROR
+SELECT ft_boolean_syntax;
+# access using no scope specified
+SELECT @@ft_boolean_syntax;
+# assign value without @@
+SET @@global.ft_boolean_syntax='+ -><()~*:""&|';
+SELECT @@global.ft_boolean_syntax;
+# using another syntax for accessing session variable
+SET global ft_boolean_syntax='$ -><()`*:""&|';
+# accessing variable with scope the wrong way
+--Error ER_BAD_FIELD_ERROR
+SELECT global ft_boolean_syntax;
+
+--echo '#--------------------FN_DYNVARS_033_02-------------------------#'
+#######################################################################
+# Check the DEFAULT value of ft_boolean_syntax for global #
+#######################################################################
+SET @@global.ft_boolean_syntax = '# -><()!*:""&|';
+SET @@global.ft_boolean_syntax = DEFAULT;
+SELECT @@global.ft_boolean_syntax;
+
+--echo '#--------------------FN_DYNVARS_033_03-------------------------#'
+######################################################################
+# see if it is accessible using session scope #
+######################################################################
+--Error ER_GLOBAL_VARIABLE
+SET @@session.ft_boolean_syntax = '# -><()!*:""&|';
+--Error ER_GLOBAL_VARIABLE
+SET @@ft_boolean_syntax = '# -><()!*:""&|';
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.ft_boolean_syntax;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@local.ft_boolean_syntax;
+
+--echo '#--------------------FN_DYNVARS_033_04-------------------------#'
+##############################################################################
+# Change the value of ft_boolean_syntax to a valid value #
+##############################################################################
+
+SET @@global.ft_boolean_syntax='+ -><()~*:""&|';
+SELECT @@global.ft_boolean_syntax;
+
+SET @@global.ft_boolean_syntax=' +-><()~*:""&|';
+SELECT @@global.ft_boolean_syntax;
+
+SET @@global.ft_boolean_syntax=' -+()<>~*:``&|';
+SELECT @@global.ft_boolean_syntax;
+
+SET @@global.ft_boolean_syntax='+ -><()~*:""@!';
+SELECT @@global.ft_boolean_syntax;
+
+SET @@global.ft_boolean_syntax=" +-><()~*:''&|";
+SELECT @@global.ft_boolean_syntax;
+
+SET @@global.ft_boolean_syntax=' ~/!@#$%^&*()-';
+SELECT @@global.ft_boolean_syntax;
+
+--echo '#--------------------FN_DYNVARS_033_05-------------------------#'
+###############################################################################
+# Change the value of ft_boolean_syntax to an invalid value for global #
+###############################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.ft_boolean_syntax = '+-> <()~*:""&|';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.ft_boolean_syntax = '0';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.ft_boolean_syntax = '1 -><()~*:11&|';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.ft_boolean_syntax = '# -><()~*:11&1';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.ft_boolean_syntax = '1234567890ABCD';
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.ft_boolean_syntax = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.ft_boolean_syntax = '+-> <((~*:".&|';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.ft_boolean_syntax = ' ';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.ft_boolean_syntax = ON;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.ft_boolean_syntax = true;
+--Error ER_PARSE_ERROR
+SET @@global.ft_boolean_syntax = + -><()~*:""&|;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.ft_boolean_syntax = ENABLE;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.ft_boolean_syntax = 'IGNORE';
+
+--echo '#--------------------FN_DYNVARS_033_06-------------------------#'
+#############################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#############################################################################
+SELECT @@global.ft_boolean_syntax = (SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='ft_boolean_syntax') AS res;
+
+
+--echo '#--------------------FN_DYNVARS_033_07-------------------------#'
+#############################################################################
+# Assigning value from a temporary variable #
+#############################################################################
+# Content of initial variable
+SELECT @global_start_value;
+SET @@global.ft_boolean_syntax = @global_start_value;
+
+####################################
+# Restore Default value #
+####################################
+#restoring to default as we cant assign the initial value
+SET @@global.ft_boolean_syntax = DEFAULT;
+SELECT @@global.ft_boolean_syntax;
+
+##########################################################
+# END OF ft_boolean_syntax TESTS #
+##########################################################
diff --git a/mysql-test/suite/sys_vars/t/ft_boolean_syntax_func.test b/mysql-test/suite/sys_vars/t/ft_boolean_syntax_func.test
new file mode 100644
index 00000000..7ac270b3
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/ft_boolean_syntax_func.test
@@ -0,0 +1,114 @@
+############## mysql-test\t\ft_boolean_syntax_func.test ######################
+# #
+# Variable Name: ft_boolean_syntax #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: string #
+# Default Value: + -><()~*:""& #
+# Range: NA #
+# #
+# #
+# Creation Date: 2008-03-08 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable ft_boolean_syntax #
+# that checks the behavior of this variable #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+--echo '#--------------------FN_DYNVARS_033_01-------------------------#'
+###################################################################
+# Check if setting ft_boolean_syntax is changed in new connection #
+###################################################################
+
+SET @@global.ft_boolean_syntax = ' -+()<>~*:``&|';
+# con1 will be default connection from now on
+connect (con1,localhost,root,,,,);
+connection con1;
+SELECT @@global.ft_boolean_syntax;
+SET @@global.ft_boolean_syntax = '+ -><()~*:""&|';
+connect (con2,localhost,root,,,,);
+connection con2;
+SELECT @@global.ft_boolean_syntax;
+disconnect con2;
+disconnect con1;
+
+--echo '#--------------------FN_DYNVARS_033_02-------------------------#'
+#########################################################
+# Begin the functionality Testing of ft_boolean_syntax #
+#########################################################
+
+connection default;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE articles (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ title VARCHAR(200),
+ body TEXT,
+ FULLTEXT (title,body)
+);
+
+INSERT INTO articles (title,body) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...'),
+('How To',''),
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show .... Run command line ...'),
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('100 Tips for Myisam','1. Myisam is faster than innodb 2. Tricks and Tips for Myisam...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...'),
+('Database Security','Configuring MySQL for ...');
+
+SET @@global.ft_boolean_syntax = DEFAULT;
+
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('+mySQL -yourSQL' IN BOOLEAN MODE);
+
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('+MySQL +YourSQL' IN BOOLEAN MODE);
+
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('MySQL' IN BOOLEAN MODE);
+
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('mysql tutorial dbms' IN BOOLEAN MODE);
+
+SELECT id,title,body, (MATCH (title,body)
+AGAINST ('+security configuring' IN BOOLEAN MODE)) AS relevance
+FROM articles WHERE MATCH (title,body)
+AGAINST ('+security configuring' IN BOOLEAN MODE);
+
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('"faster than"' IN BOOLEAN MODE);
+
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('+tutorial ~line' IN BOOLEAN MODE);
+
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('10*' IN BOOLEAN MODE);
+
+SELECT id,title,body, (MATCH (title,body)
+AGAINST ('+MySQL +(>show <dbms)' IN BOOLEAN MODE)) AS relevance
+FROM articles WHERE MATCH (title,body)
+AGAINST ('+MySQL +(>show <dbms)' IN BOOLEAN MODE)
+ORDER BY relevance DESC;
+
+#==============================================================================
+--echo '---try setting different operators. Default '+ -><()~*:""&|'--'
+#==============================================================================
+SET @@global.ft_boolean_syntax='~ /!@#$%^&*()-';
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('~mySQL /yourSQL' IN BOOLEAN MODE);
+
+#restore default
+SET @@global.ft_boolean_syntax=DEFAULT;
+
+#########################################################
+# End of functionality Testing for ft_boolean_syntax #
+#########################################################
+DROP TABLE articles;
diff --git a/mysql-test/suite/sys_vars/t/ft_max_word_len_basic.test b/mysql-test/suite/sys_vars/t/ft_max_word_len_basic.test
new file mode 100644
index 00000000..525a5bc2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/ft_max_word_len_basic.test
@@ -0,0 +1,19 @@
+#
+# only global
+#
+select @@global.ft_max_word_len;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.ft_max_word_len;
+show global variables like 'ft_max_word_len';
+show session variables like 'ft_max_word_len';
+select * from information_schema.global_variables where variable_name='ft_max_word_len';
+select * from information_schema.session_variables where variable_name='ft_max_word_len';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global ft_max_word_len=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session ft_max_word_len=1;
+
diff --git a/mysql-test/suite/sys_vars/t/ft_min_word_len_basic.test b/mysql-test/suite/sys_vars/t/ft_min_word_len_basic.test
new file mode 100644
index 00000000..7819e9c0
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/ft_min_word_len_basic.test
@@ -0,0 +1,19 @@
+#
+# only global
+#
+select @@global.ft_min_word_len;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.ft_min_word_len;
+show global variables like 'ft_min_word_len';
+show session variables like 'ft_min_word_len';
+select * from information_schema.global_variables where variable_name='ft_min_word_len';
+select * from information_schema.session_variables where variable_name='ft_min_word_len';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global ft_min_word_len=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session ft_min_word_len=1;
+
diff --git a/mysql-test/suite/sys_vars/t/ft_query_expansion_limit_basic.test b/mysql-test/suite/sys_vars/t/ft_query_expansion_limit_basic.test
new file mode 100644
index 00000000..988ee71e
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/ft_query_expansion_limit_basic.test
@@ -0,0 +1,19 @@
+#
+# only global
+#
+select @@global.ft_query_expansion_limit;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.ft_query_expansion_limit;
+show global variables like 'ft_query_expansion_limit';
+show session variables like 'ft_query_expansion_limit';
+select * from information_schema.global_variables where variable_name='ft_query_expansion_limit';
+select * from information_schema.session_variables where variable_name='ft_query_expansion_limit';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global ft_query_expansion_limit=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session ft_query_expansion_limit=1;
+
diff --git a/mysql-test/suite/sys_vars/t/ft_stopword_file_basic.test b/mysql-test/suite/sys_vars/t/ft_stopword_file_basic.test
new file mode 100644
index 00000000..3d527ff8
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/ft_stopword_file_basic.test
@@ -0,0 +1,19 @@
+#
+# only global
+#
+select @@global.ft_stopword_file;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.ft_stopword_file;
+show global variables like 'ft_stopword_file';
+show session variables like 'ft_stopword_file';
+select * from information_schema.global_variables where variable_name='ft_stopword_file';
+select * from information_schema.session_variables where variable_name='ft_stopword_file';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global ft_stopword_file=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session ft_stopword_file=1;
+
diff --git a/mysql-test/suite/sys_vars/t/general_log_basic.test b/mysql-test/suite/sys_vars/t/general_log_basic.test
new file mode 100644
index 00000000..b41185e2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/general_log_basic.test
@@ -0,0 +1,165 @@
+######################## mysql-test\t\general_log_basic.test ###################
+# #
+# Variable Name: general_log #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: BOOLEAN #
+# Default Value: OFF #
+# Valid Values: ON, OFF #
+# #
+# #
+# Creation Date: 2008-03-14 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable "general_log" #
+# that checks behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-options.html#option_mysqld_event-scheduler #
+# #
+################################################################################
+
+
+###########################################################
+# START OF general_log TESTS #
+###########################################################
+
+
+###################################################################
+# Saving initial value of general_log in a temporary variable #
+###################################################################
+
+SET @start_value = @@global.general_log;
+SELECT @start_value;
+
+
+--echo '#---------------------FN_DYNVARS_004_01-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@global.general_log = DEFAULT;
+SELECT @@global.general_log = 0;
+
+
+--echo '#--------------------FN_DYNVARS_004_02------------------------#'
+#######################################################################
+# Change the value of general_log to a valid value #
+#######################################################################
+
+SET @@global.general_log = ON;
+SELECT @@global.general_log;
+SET @@global.general_log = OFF;
+SELECT @@global.general_log;
+
+--echo '#--------------------FN_DYNVARS_004_03-------------------------#'
+#######################################################################
+# Change the value of general_log to invalid value #
+#######################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.general_log = 2;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.general_log = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.general_log = TRUEF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.general_log = TRUE_F;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.general_log = FALSE0;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.general_log = OON;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.general_log = ONN;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.general_log = OOFF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.general_log = 0FF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.general_log = ' ';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.general_log = " ";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.general_log = '';
+
+
+--echo '#-------------------FN_DYNVARS_004_04----------------------------#'
+###################################################################
+# Test if accessing session general_log gives error #
+###################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.general_log = OFF;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.general_log;
+
+
+--echo '#----------------------FN_DYNVARS_004_05------------------------#'
+##############################################################################
+# Check if the value in GLOBAL Tables matches values in variable #
+##############################################################################
+
+SELECT IF(@@global.general_log, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='general_log';
+
+
+--echo '#---------------------FN_DYNVARS_004_06----------------------#'
+###################################################################
+# Check if 0 and 1 values can be used on variable #
+###################################################################
+
+SET @@global.general_log = 0;
+SELECT @@global.general_log;
+SET @@global.general_log = 1;
+SELECT @@global.general_log;
+
+--echo '#---------------------FN_DYNVARS_004_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.general_log = TRUE;
+SELECT @@global.general_log;
+SET @@global.general_log = FALSE;
+SELECT @@global.general_log;
+
+--echo '#---------------------FN_DYNVARS_004_08----------------------#'
+##############################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points #
+# to same session variable #
+##############################################################################
+
+SET @@global.general_log = ON;
+SELECT @@general_log = @@global.general_log;
+
+--echo '#---------------------FN_DYNVARS_004_09----------------------#'
+#######################################################################
+# Check if general_log can be accessed with and without @@ sign #
+#######################################################################
+--Error ER_GLOBAL_VARIABLE
+SET general_log = ON;
+--Error ER_UNKNOWN_TABLE
+SELECT local.general_log;
+--Error ER_UNKNOWN_TABLE
+SELECT global.general_log;
+--Error ER_BAD_FIELD_ERROR
+SELECT general_log = @@session.general_log;
+
+
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.general_log = @start_value;
+SELECT @@global.general_log;
+
+
+#####################################################
+# END OF general_log TESTS #
+#####################################################
diff --git a/mysql-test/suite/sys_vars/t/general_log_file_basic-master.opt b/mysql-test/suite/sys_vars/t/general_log_file_basic-master.opt
new file mode 100644
index 00000000..c9f62c1a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/general_log_file_basic-master.opt
@@ -0,0 +1,2 @@
+--general-log
+--general-log-file=test.log
diff --git a/mysql-test/suite/sys_vars/t/general_log_file_basic.test b/mysql-test/suite/sys_vars/t/general_log_file_basic.test
new file mode 100644
index 00000000..afbfa1a6
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/general_log_file_basic.test
@@ -0,0 +1,90 @@
+################### mysql-test\t\general_log_file_basic.test ###################
+# #
+# Variable Name: general_log_file #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: Filename #
+# Default Value: host_name.log #
+# Valid Values: #
+# #
+# #
+# Creation Date: 2008-03-16 #
+# Author: Salman Rawala #
+# Modified: HHunger 2008-09-11 Set system variable back to the start value #
+# #
+# Description: Test Cases of Dynamic System Variable "general_log_file" #
+# that checks behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# #
+################################################################################
+
+--source include/load_sysvars.inc
+
+###########################################################
+# START OF general_log_file TESTS #
+###########################################################
+
+
+########################################################################
+# Saving initial value of general_log_file in a temporary variable #
+########################################################################
+
+SET @start_value = @@global.general_log_file;
+SELECT length(@start_value) > 0;
+
+
+--echo '#---------------------FN_DYNVARS_004_01-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@global.general_log_file = DEFAULT;
+SELECT length(@@global.general_log_file) > 0;
+
+
+--echo '#--------------------FN_DYNVARS_004_02------------------------#'
+#######################################################################
+# Change the value of general_log_file to a invalid value #
+#######################################################################
+
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@global.general_log_file = mytest.log;
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@global.general_log_file = 12;
+
+#
+# MDEV-10465
+#
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.general_log_file = 'my.cnf';
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.general_log_file = '/tmp/my.cnf';
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.general_log_file = '.my.cnf';
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.general_log_file = 'my.cnf\0foo';
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.general_log_file = 'my.ini';
+
+
+--echo '#----------------------FN_DYNVARS_004_03------------------------#'
+##############################################################################
+# Check if the value in GLOBAL Tables matches values in variable #
+##############################################################################
+
+SELECT @@global.general_log_file = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='general_log_file';
+
+SET @@global.general_log_file= @start_value;
+
+#####################################################
+# END OF general_log_file TESTS #
+#####################################################
+
diff --git a/mysql-test/suite/sys_vars/t/general_log_file_func-master.opt b/mysql-test/suite/sys_vars/t/general_log_file_func-master.opt
new file mode 100644
index 00000000..487f1742
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/general_log_file_func-master.opt
@@ -0,0 +1,3 @@
+--general-log
+--general-log-file=mysql-test.log
+
diff --git a/mysql-test/suite/sys_vars/t/general_log_file_func.test b/mysql-test/suite/sys_vars/t/general_log_file_func.test
new file mode 100644
index 00000000..1a73a4a5
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/general_log_file_func.test
@@ -0,0 +1,56 @@
+############## mysql-test\t\general_log_file_func.test #########################
+# #
+# Variable Name: general_log_file #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: Boolean #
+# Default Value: filename #
+# Valid Values: #
+# #
+# #
+# Creation Date: 2008-03-17 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable "general_log_file" #
+# that checks functionality of this variable #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_general_log_file #
+# #
+################################################################################
+
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+#########################
+# Creating new table #
+#########################
+
+--echo ## Creating new table ##
+CREATE TABLE t1
+(
+id INT NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id),
+name VARCHAR(30)
+);
+
+--echo '#--------------------FN_DYNVARS_018_01-------------------------#'
+####################################################################
+# Verifying general log as we have initialized in opt file #
+####################################################################
+SELECT @@general_log_file;
+
+INSERT INTO t1(name) VALUES('Record_1');
+INSERT INTO t1(name) VALUES('Record_2');
+INSERT INTO t1(name) VALUES('Record_3');
+INSERT INTO t1(name) VALUES('Record_4');
+
+--echo ## Verifying general log file ##
+let $MYSQLD_DATADIR= `select @@datadir`;
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--file_exists $MYSQLD_DATADIR/mysql-test.log
+
+--echo ## Dropping table ##
+DROP TABLE t1;
diff --git a/mysql-test/suite/sys_vars/t/general_log_func.test b/mysql-test/suite/sys_vars/t/general_log_func.test
new file mode 100644
index 00000000..55ed944c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/general_log_func.test
@@ -0,0 +1,102 @@
+################# mysql-test\t\general_log_func.test ###########################
+# #
+# Variable Name: general_log #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: Boolean #
+# Default Value: OFF #
+# Valid Values: ON, OFF #
+# #
+# #
+# Creation Date: 2008-03-17 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable "general_log" #
+# that checks functionality of this variable #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_general_log #
+# #
+################################################################################
+
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#########################
+# Creating new table #
+#########################
+
+--echo ## Creating new table ##
+CREATE TABLE t1
+(
+id INT NOT NULL auto_increment,
+PRIMARY KEY (id),
+name VARCHAR(30)
+);
+
+--echo '#--------------------FN_DYNVARS_018_01-------------------------#'
+####################################################################
+# Setting initial value of general_log to OFF and verifying
+# its behavior
+####################################################################
+
+--echo ## Setting initial value of variable to OFF ##
+SET @@global.general_log = OFF;
+SELECT @@general_log;
+
+let $MYSQLD_LOGFILE= `select @@global.general_log_file`;
+
+#
+# truncate the existing log - it could be larger than max_allowed_packet
+# and that would cause load_file() below to fail
+#
+--remove_file $MYSQLD_LOGFILE
+flush logs;
+SET @@global.general_log = ON;
+flush logs;
+SET @@global.general_log = OFF;
+
+--copy_file $MYSQLD_LOGFILE $MYSQLD_LOGFILE.copy
+
+--echo ## Inserting some Records & Verifying output in log ##
+INSERT into t1(name) values('Record_1');
+INSERT into t1(name) values('Record_2');
+
+--echo ## There should be no difference, case should pass ##
+--diff_files $MYSQLD_LOGFILE $MYSQLD_LOGFILE.copy
+--remove_file $MYSQLD_LOGFILE.copy
+
+--echo '#--------------------FN_DYNVARS_018_01-------------------------#'
+####################################################################
+# Setting initial value of general_log to ON and verifying
+# its behavior
+####################################################################
+
+--echo ## Setting initial value of variable to OFF ##
+SET @@global.general_log = ON;
+SELECT @@general_log;
+
+--copy_file $MYSQLD_LOGFILE $MYSQLD_LOGFILE.copy
+--chmod 0777 $MYSQLD_LOGFILE.copy
+
+--echo ## Inserting some Records & Verifying output in log ##
+INSERT into t1(name) values('Record_3');
+INSERT into t1(name) values('Record_4');
+
+--copy_file $MYSQLD_LOGFILE $MYSQLD_LOGFILE.orig
+--chmod 0777 $MYSQLD_LOGFILE.orig
+
+--echo ## old log is a proper prefix of the new log ##
+--replace_result $MYSQLD_LOGFILE MYSQLD_LOGFILE
+eval SET @orig_file= load_file('$MYSQLD_LOGFILE.orig');
+--replace_result $MYSQLD_LOGFILE MYSQLD_LOGFILE
+eval SET @copy_file= load_file('$MYSQLD_LOGFILE.copy');
+SELECT @orig_file > @copy_file, left(@orig_file, length(@copy_file)) = @copy_file;
+--remove_file $MYSQLD_LOGFILE.copy
+--remove_file $MYSQLD_LOGFILE.orig
+
+--echo ## Dropping tables ##
+DROP TABLE t1;
+
diff --git a/mysql-test/suite/sys_vars/t/group_concat_max_len_basic.test b/mysql-test/suite/sys_vars/t/group_concat_max_len_basic.test
new file mode 100644
index 00000000..5a78b4b0
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/group_concat_max_len_basic.test
@@ -0,0 +1,205 @@
+############## mysql-test\t\group_concat_max_len_basic.test ###############
+# #
+# Variable Name: group_concat_max_len #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 1024 #
+# Minimum value: 4 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable group_concat_max_len #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF group_concat_max_len TESTS #
+########################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.group_concat_max_len;
+SELECT @start_global_value;
+SET @start_session_value = @@session.group_concat_max_len;
+SELECT @start_session_value;
+
+
+--echo '#--------------------FN_DYNVARS_034_01-------------------------#'
+########################################################################
+# Display the DEFAULT value of group_concat_max_len #
+########################################################################
+
+SET @@global.group_concat_max_len = 100;
+SET @@global.group_concat_max_len = DEFAULT;
+SELECT @@global.group_concat_max_len;
+
+SET @@session.group_concat_max_len = 200;
+SET @@session.group_concat_max_len = DEFAULT;
+SELECT @@session.group_concat_max_len;
+
+
+--echo '#--------------------FN_DYNVARS_034_02-------------------------#'
+########################################################################
+# Check the DEFAULT value of group_concat_max_len #
+########################################################################
+
+SET @@global.group_concat_max_len = DEFAULT;
+SELECT @@global.group_concat_max_len = 1;
+
+SET @@session.group_concat_max_len = DEFAULT;
+SELECT @@session.group_concat_max_len = 1;
+
+
+--echo '#--------------------FN_DYNVARS_034_03-------------------------#'
+##################################################################################
+# Change the value of group_concat_max_len to a valid value for GLOBAL Scope #
+##################################################################################
+
+SET @@global.group_concat_max_len = 1;
+SELECT @@global.group_concat_max_len;
+SET @@global.group_concat_max_len = 60020;
+SELECT @@global.group_concat_max_len;
+SET @@global.group_concat_max_len = 65535;
+SELECT @@global.group_concat_max_len;
+
+
+--echo '#--------------------FN_DYNVARS_034_04-------------------------#'
+###################################################################################
+# Change the value of group_concat_max_len to a valid value for SESSION Scope #
+###################################################################################
+
+SET @@session.group_concat_max_len = 1;
+SELECT @@session.group_concat_max_len;
+SET @@session.group_concat_max_len = 50050;
+SELECT @@session.group_concat_max_len;
+SET @@session.group_concat_max_len = 65535;
+SELECT @@session.group_concat_max_len;
+
+
+--echo '#------------------FN_DYNVARS_034_05-----------------------#'
+####################################################################
+# Change the value of group_concat_max_len to an invalid value #
+####################################################################
+
+SET @@global.group_concat_max_len = 0;
+SELECT @@global.group_concat_max_len;
+SET @@global.group_concat_max_len = -1024;
+SELECT @@global.group_concat_max_len;
+SET @@global.group_concat_max_len = 65536;
+SELECT @@global.group_concat_max_len;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.group_concat_max_len = 65530.34;
+SELECT @@global.group_concat_max_len;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.group_concat_max_len = test;
+SELECT @@global.group_concat_max_len;
+
+SET @@session.group_concat_max_len = 0;
+SELECT @@session.group_concat_max_len;
+SET @@session.group_concat_max_len = -2;
+SELECT @@session.group_concat_max_len;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.group_concat_max_len = 65530.34;
+SET @@session.group_concat_max_len = 65550;
+SELECT @@session.group_concat_max_len;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.group_concat_max_len = test;
+SELECT @@session.group_concat_max_len;
+
+
+--echo '#------------------FN_DYNVARS_034_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT @@global.group_concat_max_len = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='group_concat_max_len';
+
+--echo '#------------------FN_DYNVARS_034_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.group_concat_max_len = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='group_concat_max_len';
+
+
+--echo '#------------------FN_DYNVARS_034_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.group_concat_max_len = TRUE;
+SELECT @@global.group_concat_max_len;
+SET @@global.group_concat_max_len = FALSE;
+SELECT @@global.group_concat_max_len;
+
+
+--echo '#---------------------FN_DYNVARS_001_09----------------------#'
+####################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+####################################################################################
+
+SET @@global.group_concat_max_len = 10;
+SELECT @@group_concat_max_len = @@global.group_concat_max_len;
+
+
+--echo '#---------------------FN_DYNVARS_001_10----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@group_concat_max_len = 100;
+SELECT @@group_concat_max_len = @@local.group_concat_max_len;
+SELECT @@local.group_concat_max_len = @@session.group_concat_max_len;
+
+
+--echo '#---------------------FN_DYNVARS_001_11----------------------#'
+###################################################################################
+# Check if group_concat_max_len can be accessed with and without @@ sign #
+###################################################################################
+
+SET group_concat_max_len = 1;
+SELECT @@group_concat_max_len;
+--Error ER_UNKNOWN_TABLE
+SELECT local.group_concat_max_len;
+--Error ER_UNKNOWN_TABLE
+SELECT session.group_concat_max_len;
+--Error ER_BAD_FIELD_ERROR
+SELECT group_concat_max_len = @@session.group_concat_max_len;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.group_concat_max_len = @start_global_value;
+SELECT @@global.group_concat_max_len;
+SET @@session.group_concat_max_len = @start_session_value;
+SELECT @@session.group_concat_max_len;
+
+
+#############################################################
+# END OF group_concat_max_len TESTS #
+#############################################################
+
diff --git a/mysql-test/suite/sys_vars/t/group_concat_max_len_func.test b/mysql-test/suite/sys_vars/t/group_concat_max_len_func.test
new file mode 100644
index 00000000..4957afc0
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/group_concat_max_len_func.test
@@ -0,0 +1,170 @@
+############## mysql-test\t\group_concat_max_len_func.test ####################
+# #
+# Variable Name: group_concat_max_len #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 1024 #
+# Minimum value: 4 #
+# #
+# #
+# Creation Date: 2008-03-07 #
+# Author: Salman Rawala #
+# #
+# Last modification: #
+# 2008-11-14 mleich Fix Bug#40644 main.group_concat_max_len_func random #
+# failures #
+# + minor improvements #
+# #
+# Description: Test Cases of Dynamic System Variable group_concat_max_len #
+# that checks the functionality of this variable #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# #
+###############################################################################
+
+SET @save = @@global.group_concat_max_len;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+#########################
+# Creating new table #
+#########################
+
+--echo ## Creating new table t1 ##
+CREATE TABLE t1
+(
+id INT NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id),
+rollno INT NOT NULL,
+name VARCHAR(30)
+);
+
+--echo '#--------------------FN_DYNVARS_034_01-------------------------#'
+########################################################################
+# Setting initial value of group_concat_max_len, inserting some rows
+# & creating 2 new connections
+########################################################################
+
+--echo ## Setting initial value of variable to 4 ##
+SET @@global.group_concat_max_len = 4;
+
+--echo ## Inserting some rows in table ##
+INSERT INTO t1(rollno, name) VALUES(1, 'Record_1');
+INSERT INTO t1(rollno, name) VALUES(2, 'Record_2');
+INSERT INTO t1(rollno, name) VALUES(1, 'Record_3');
+INSERT INTO t1(rollno, name) VALUES(3, 'Record_4');
+INSERT INTO t1(rollno, name) VALUES(1, 'Record_5');
+INSERT INTO t1(rollno, name) VALUES(3, 'Record_6');
+INSERT INTO t1(rollno, name) VALUES(4, 'Record_7');
+INSERT INTO t1(rollno, name) VALUES(4, 'Record_8');
+# The following "auxiliary" select ensures that all records are on disk
+# = result sets got by parallel sessions cannot suffer from effects
+# caused by the MyISAM feature "concurrent_inserts".
+SELECT * FROM t1 ORDER BY id;
+
+connect (test_con1,localhost,root,,);
+connect (test_con2,localhost,root,,);
+
+
+--echo '#--------------------FN_DYNVARS_034_02-------------------------#'
+###############################################################################
+# Verifying initial behavior of variable by concatinating values greater than 4
+###############################################################################
+
+connection test_con1;
+
+--echo ## Accessing data and using group_concat on column whose value is greater than 4 ##
+--disable_ps2_protocol
+SELECT id, rollno, GROUP_CONCAT(name) FROM t1 GROUP BY rollno;
+--enable_ps2_protocol
+
+--echo ## Changing session value of variable and verifying its behavior, ##
+--echo ## warning should come here ##
+
+SET @@session.group_concat_max_len = 10;
+--disable_ps2_protocol
+SELECT id, rollno, GROUP_CONCAT(name) FROM t1 GROUP BY rollno;
+--enable_ps2_protocol
+
+--echo '#--------------------FN_DYNVARS_034_03-------------------------#'
+##############################################################################
+# Verifying behavior of variable by increasing session value of variable #
+##############################################################################
+
+connection test_con2;
+
+--echo ## Verifying initial value of variable. It should be 4 ##
+SELECT @@session.group_concat_max_len = 4;
+
+--echo ## Setting session value of variable to 20 and verifying variable is concating ##
+--echo ## column's value to 20 or not ##
+SET @@session.group_concat_max_len = 20;
+
+--echo ## Verifying value of name column, it should not me more than 20 characters ##
+--echo ## Warning should come here ##
+--disable_ps2_protocol
+SELECT id, rollno, GROUP_CONCAT(name) FROM t1 GROUP BY rollno;
+--enable_ps2_protocol
+
+--echo '#--------------------FN_DYNVARS_034_04-------------------------#'
+###############################################################################
+# Verifying behavior of variable by increasing session value of variable #
+# greater than the maximum concat length of name column #
+###############################################################################
+
+--echo ## Setting session value of variable to 26. No warning should appear here ##
+--echo ## because the value after concatination is less than 30 ##
+SET @@session.group_concat_max_len = 26;
+
+--echo ## Verifying value of name column, it should not give warning now ##
+SELECT id, rollno, GROUP_CONCAT(name) FROM t1 GROUP BY rollno;
+
+
+############################################################
+# Disconnecting all connection & dropping table #
+############################################################
+
+--echo ## Dropping table t1 ##
+DROP TABLE t1;
+
+disconnect test_con2;
+disconnect test_con1;
+
+connection default;
+
+CREATE TABLE t1(val VARCHAR(100) PRIMARY KEY) CHARACTER SET utf8mb4 COLLATE utf8mb4_danish_ci;
+INSERT INTO t1 VALUES('bar');
+INSERT INTO t1 VALUES('foo');
+
+SET group_concat_max_len = 1073741823;
+SHOW VARIABLES LIKE 'group_concat_max_len';
+SELECT GROUP_CONCAT(val) AS simple FROM t1;
+SELECT * FROM ( SELECT GROUP_CONCAT(val) AS nested FROM t1) As tmp;
+
+SET group_concat_max_len = 1073741824;
+SHOW VARIABLES LIKE 'group_concat_max_len';
+SELECT GROUP_CONCAT(val) AS simple FROM t1;
+SELECT * FROM ( SELECT GROUP_CONCAT(val) AS nested FROM t1) As tmp;
+
+SET group_concat_max_len = 1073741825;
+SHOW VARIABLES LIKE 'group_concat_max_len';
+SELECT GROUP_CONCAT(val) AS simple FROM t1;
+SELECT * FROM ( SELECT GROUP_CONCAT(val) AS nested FROM t1) As tmp;
+
+SET group_concat_max_len = 1073741826;
+SHOW VARIABLES LIKE 'group_concat_max_len';
+SELECT GROUP_CONCAT(val) AS simple FROM t1;
+SELECT * FROM ( SELECT GROUP_CONCAT(val) AS nested FROM t1) As tmp;
+
+SET group_concat_max_len = 2147483649;
+SHOW VARIABLES LIKE 'group_concat_max_len';
+SELECT GROUP_CONCAT(val) AS simple FROM t1;
+SELECT * FROM ( SELECT GROUP_CONCAT(val) AS nested FROM t1) As tmp;
+
+DROP TABLE t1;
+
+SET @@global.group_concat_max_len = @save;
diff --git a/mysql-test/suite/sys_vars/t/gtid_binlog_pos_basic.test b/mysql-test/suite/sys_vars/t/gtid_binlog_pos_basic.test
new file mode 100644
index 00000000..45213265
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/gtid_binlog_pos_basic.test
@@ -0,0 +1,15 @@
+--source include/not_embedded.inc
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET GLOBAL gtid_binlog_pos= '';
+SELECT variable_name FROM information_schema.global_variables
+ WHERE variable_name='gtid_binlog_pos';
+
+# The value of the variable depends on the binary log, this is tested extensively
+# elsewhere in rpl.rpl_gtid*.test
+--disable_result_log
+SELECT @@gtid_binlog_pos;
+--enable_result_log
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.gtid_binlog_pos;
diff --git a/mysql-test/suite/sys_vars/t/gtid_binlog_state_basic.test b/mysql-test/suite/sys_vars/t/gtid_binlog_state_basic.test
new file mode 100644
index 00000000..f171086e
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/gtid_binlog_state_basic.test
@@ -0,0 +1,17 @@
+--source include/not_embedded.inc
+
+# Most things with gtid_binlog_state requires binlog enabled, and so is
+# tested in rpl suite.
+
+SELECT @@GLOBAL.gtid_slave_pos;
+
+--error ER_GLOBAL_VARIABLE
+SET gtid_binlog_state= '';
+--error ER_GLOBAL_VARIABLE
+SET SESSION gtid_binlog_state= '';
+
+--error ER_NO_DEFAULT
+SET GLOBAL gtid_binlog_state= DEFAULT;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.gtid_binlog_state;
diff --git a/mysql-test/suite/sys_vars/t/gtid_binlog_state_grant.test b/mysql-test/suite/sys_vars/t/gtid_binlog_state_grant.test
new file mode 100644
index 00000000..b1cfa320
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/gtid_binlog_state_grant.test
@@ -0,0 +1,67 @@
+--source include/not_embedded.inc
+
+
+--echo #
+--echo # MDEV-21973 Bind REPLICATION {MASTER|SLAVE} ADMIN to gtid_* GLOBAL-only system variables
+--echo #
+
+#
+# Binlog is not opened in this test.
+# So the test returns "access denied" on the lack of privileges,
+# or "Binlog closed, cannot RESET MASTER" on success.
+#
+
+
+--let var = gtid_binlog_state
+--let grant = REPLICATION MASTER ADMIN
+--let value = '0-1-10'
+
+
+--echo # Test that "SET $var" is not allowed without $grant or SUPER
+
+CREATE USER user1@localhost;
+GRANT ALL PRIVILEGES ON *.* TO user1@localhost;
+--eval REVOKE $grant, SUPER ON *.* FROM user1@localhost
+--connect(user1,localhost,user1,,)
+--connection user1
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+--eval SET GLOBAL $var=$value
+--error ER_GLOBAL_VARIABLE
+--eval SET $var=$value
+--error ER_GLOBAL_VARIABLE
+--eval SET SESSION $var=$value
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET $var" is allowed with $grant
+
+CREATE USER user1@localhost;
+--eval GRANT $grant ON *.* TO user1@localhost
+--connect(user1,localhost,user1,,)
+--connection user1
+--error ER_FLUSH_MASTER_BINLOG_CLOSED
+--eval SET GLOBAL $var=$value
+--error ER_GLOBAL_VARIABLE
+--eval SET $var=$value
+--error ER_GLOBAL_VARIABLE
+--eval SET SESSION $var=$value
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET $var" is allowed with SUPER
+
+CREATE USER user1@localhost;
+GRANT SUPER ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+--error ER_FLUSH_MASTER_BINLOG_CLOSED
+--eval SET GLOBAL $var=$value
+--error ER_GLOBAL_VARIABLE
+--eval SET $var=$value
+--error ER_GLOBAL_VARIABLE
+--eval SET SESSION $var=$value
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
diff --git a/mysql-test/suite/sys_vars/t/gtid_cleanup_batch_size_grant.test b/mysql-test/suite/sys_vars/t/gtid_cleanup_batch_size_grant.test
new file mode 100644
index 00000000..73e68cc2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/gtid_cleanup_batch_size_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21973 Bind REPLICATION {MASTER|SLAVE} ADMIN to gtid_* GLOBAL-only system variables
+--echo #
+
+--let var = gtid_cleanup_batch_size
+--let grant = REPLICATION SLAVE ADMIN
+--let value = 1
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/gtid_current_pos_basic.test b/mysql-test/suite/sys_vars/t/gtid_current_pos_basic.test
new file mode 100644
index 00000000..9aac7ad7
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/gtid_current_pos_basic.test
@@ -0,0 +1,15 @@
+--source include/not_embedded.inc
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET GLOBAL gtid_current_pos= '';
+SELECT variable_name FROM information_schema.global_variables
+ WHERE variable_name='gtid_current_pos';
+
+# The value of the variable depends on the binary log, this is tested extensively
+# elsewhere in rpl.rpl_gtid*.test
+--disable_result_log
+SELECT @@gtid_current_pos;
+--enable_result_log
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.gtid_current_pos;
diff --git a/mysql-test/suite/sys_vars/t/gtid_domain_id_basic.test b/mysql-test/suite/sys_vars/t/gtid_domain_id_basic.test
new file mode 100644
index 00000000..f9c78fe2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/gtid_domain_id_basic.test
@@ -0,0 +1,17 @@
+SET @old_gtid_domain_id= @@global.gtid_domain_id;
+SELECT @@global.gtid_domain_id;
+
+SET GLOBAL gtid_domain_id= 10;
+SET SESSION gtid_domain_id= 20;
+SELECT @@global.gtid_domain_id;
+SELECT @@session.gtid_domain_id;
+
+SET GLOBAL gtid_domain_id= DEFAULT;
+SELECT @@global.gtid_domain_id;
+
+SET GLOBAL gtid_domain_id= -10;
+SELECT @@global.gtid_domain_id;
+SET SESSION gtid_domain_id= -1;
+SELECT @@session.gtid_domain_id;
+
+SET GLOBAL gtid_domain_id= @old_gtid_domain_id;
diff --git a/mysql-test/suite/sys_vars/t/gtid_domain_id_grant.test b/mysql-test/suite/sys_vars/t/gtid_domain_id_grant.test
new file mode 100644
index 00000000..7b92c86e
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/gtid_domain_id_grant.test
@@ -0,0 +1,16 @@
+--echo #
+--echo # MDEV-21975 Add BINLOG REPLAY privilege and bind new privileges to gtid_seq_no, preudo_thread_id, server_id, gtid_domain_id
+--echo #
+
+--let var = gtid_domain_id
+--let grant = REPLICATION MASTER ADMIN
+--let value = 1
+
+--source suite/sys_vars/inc/sysvar_global_grant_alone.inc
+
+
+--let var = gtid_domain_id
+--let grant = BINLOG REPLAY
+--let value = 1
+
+--source suite/sys_vars/inc/sysvar_session_grant_alone.inc
diff --git a/mysql-test/suite/sys_vars/t/gtid_ignore_duplicates_basic.test b/mysql-test/suite/sys_vars/t/gtid_ignore_duplicates_basic.test
new file mode 100644
index 00000000..23b7dc85
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/gtid_ignore_duplicates_basic.test
@@ -0,0 +1,14 @@
+--source include/not_embedded.inc
+
+SET @save_gtid_ignore_duplicates= @@GLOBAL.gtid_ignore_duplicates;
+
+SELECT @@GLOBAL.gtid_ignore_duplicates as 'must be zero because of default';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@SESSION.gtid_ignore_duplicates as 'no session var';
+
+SET GLOBAL gtid_ignore_duplicates= FALSE;
+SET GLOBAL gtid_ignore_duplicates= DEFAULT;
+SET GLOBAL gtid_ignore_duplicates= TRUE;
+SELECT @@GLOBAL.gtid_ignore_duplicates;
+
+SET GLOBAL gtid_ignore_duplicates = @save_gtid_ignore_duplicates;
diff --git a/mysql-test/suite/sys_vars/t/gtid_ignore_duplicates_grant.test b/mysql-test/suite/sys_vars/t/gtid_ignore_duplicates_grant.test
new file mode 100644
index 00000000..69e8cb8d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/gtid_ignore_duplicates_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21973 Bind REPLICATION {MASTER|SLAVE} ADMIN to gtid_* GLOBAL-only system variables
+--echo #
+
+--let var = gtid_ignore_duplicates
+--let grant = REPLICATION SLAVE ADMIN
+--let value = 1
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/gtid_pos_auto_engines_grant.test b/mysql-test/suite/sys_vars/t/gtid_pos_auto_engines_grant.test
new file mode 100644
index 00000000..500f7085
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/gtid_pos_auto_engines_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21973 Bind REPLICATION {MASTER|SLAVE} ADMIN to gtid_* GLOBAL-only system variables
+--echo #
+
+--let var = gtid_pos_auto_engines
+--let grant = REPLICATION SLAVE ADMIN
+--let value = ''
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/gtid_seq_no_basic.test b/mysql-test/suite/sys_vars/t/gtid_seq_no_basic.test
new file mode 100644
index 00000000..e9345533
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/gtid_seq_no_basic.test
@@ -0,0 +1,15 @@
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@global.gtid_seq_no;
+
+--error ER_LOCAL_VARIABLE
+SET GLOBAL gtid_seq_no= 10;
+SET SESSION gtid_seq_no= 20;
+SELECT @@session.gtid_seq_no;
+
+--error ER_LOCAL_VARIABLE
+SET GLOBAL gtid_seq_no= DEFAULT;
+
+SET SESSION gtid_seq_no= DEFAULT;
+
+SET SESSION gtid_seq_no= -1;
+SELECT @@session.gtid_seq_no;
diff --git a/mysql-test/suite/sys_vars/t/gtid_seq_no_grant.test b/mysql-test/suite/sys_vars/t/gtid_seq_no_grant.test
new file mode 100644
index 00000000..ccbe0cf1
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/gtid_seq_no_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21975 Add BINLOG REPLAY privilege and bind new privileges to gtid_seq_no, preudo_thread_id, server_id, gtid_domain_id
+--echo #
+
+--let var = gtid_seq_no
+--let grant = BINLOG REPLAY
+--let value = 1
+
+--source suite/sys_vars/inc/sysvar_session_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/gtid_slave_pos_basic.test b/mysql-test/suite/sys_vars/t/gtid_slave_pos_basic.test
new file mode 100644
index 00000000..d021e335
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/gtid_slave_pos_basic.test
@@ -0,0 +1,46 @@
+--source include/not_embedded.inc
+
+SET @old_gtid_slave_pos= @@gtid_slave_pos;
+
+SET GLOBAL gtid_slave_pos= '';
+SELECT @@gtid_slave_pos;
+SET GLOBAL gtid_slave_pos= '1-2-3';
+SELECT variable_value FROM information_schema.global_variables
+ WHERE variable_name='gtid_slave_pos';
+SET @@global.gtid_slave_pos= '1-2-4';
+SELECT @@gtid_slave_pos;
+
+SET GLOBAL gtid_slave_pos= ' 1-2-3';
+SELECT @@gtid_slave_pos;
+SET GLOBAL gtid_slave_pos= '1-2-3, 2-4-6';
+SELECT @@gtid_slave_pos;
+
+--error ER_INCORRECT_GTID_STATE
+SET GLOBAL gtid_slave_pos= '-1-2-3';
+--error ER_INCORRECT_GTID_STATE
+SET GLOBAL gtid_slave_pos= '1-2 -3';
+--error ER_INCORRECT_GTID_STATE
+SET GLOBAL gtid_slave_pos= '1-2-3 ';
+--error ER_INCORRECT_GTID_STATE
+SET GLOBAL gtid_slave_pos= '1-2-3,2-4';
+
+--error ER_DUPLICATE_GTID_DOMAIN
+SET GLOBAL gtid_slave_pos= '0-1-10,0-2-20';
+--error ER_DUPLICATE_GTID_DOMAIN
+SET GLOBAL gtid_slave_pos= '0-1-10,1-2-20,2-3-30,1-20-200,3-4-1';
+
+--error ER_GLOBAL_VARIABLE
+SET gtid_slave_pos= '';
+--error ER_GLOBAL_VARIABLE
+SET SESSION gtid_slave_pos= '';
+
+SET GLOBAL gtid_slave_pos= '1-2-3,2-4-6';
+SELECT @@gtid_slave_pos;
+
+--error ER_NO_DEFAULT
+SET GLOBAL gtid_slave_pos= DEFAULT;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.gtid_slave_pos;
+
+SET GLOBAL gtid_slave_pos= @old_gtid_slave_pos;
diff --git a/mysql-test/suite/sys_vars/t/gtid_slave_pos_grant.test b/mysql-test/suite/sys_vars/t/gtid_slave_pos_grant.test
new file mode 100644
index 00000000..e5512847
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/gtid_slave_pos_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21973 Bind REPLICATION {MASTER|SLAVE} ADMIN to gtid_* GLOBAL-only system variables
+--echo #
+
+--let var = gtid_slave_pos
+--let grant = REPLICATION SLAVE ADMIN
+--let value = ''
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/gtid_strict_mode_basic.test b/mysql-test/suite/sys_vars/t/gtid_strict_mode_basic.test
new file mode 100644
index 00000000..c6287dcd
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/gtid_strict_mode_basic.test
@@ -0,0 +1,21 @@
+--source include/not_embedded.inc
+#
+# only global
+#
+select @@global.gtid_strict_mode;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.gtid_strict_mode;
+show global variables like 'gtid_strict_mode';
+show session variables like 'gtid_strict_mode';
+select * from information_schema.global_variables where variable_name='gtid_strict_mode';
+select * from information_schema.session_variables where variable_name='gtid_strict_mode';
+
+SET @old= @@GLOBAL.gtid_strict_mode;
+set global gtid_strict_mode=1;
+select @@global.gtid_strict_mode;
+set global gtid_strict_mode=0;
+select @@global.gtid_strict_mode;
+set global gtid_strict_mode=@old;
+
+--error ER_GLOBAL_VARIABLE
+set session gtid_strict_mode=1;
diff --git a/mysql-test/suite/sys_vars/t/gtid_strict_mode_grant.test b/mysql-test/suite/sys_vars/t/gtid_strict_mode_grant.test
new file mode 100644
index 00000000..18c3cc76
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/gtid_strict_mode_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21973 Bind REPLICATION {MASTER|SLAVE} ADMIN to gtid_* GLOBAL-only system variables
+--echo #
+
+--let var = gtid_strict_mode
+--let grant = REPLICATION SLAVE ADMIN
+--let value = 1
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/have_compress_basic.test b/mysql-test/suite/sys_vars/t/have_compress_basic.test
new file mode 100644
index 00000000..f704ae67
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/have_compress_basic.test
@@ -0,0 +1,100 @@
+
+
+################## mysql-test\t\have_compress_basic.test ######################
+# #
+# Variable Name: have_compress #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: boolean #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable have_compress #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--echo '#---------------------BS_STVARS_006_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.have_compress);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_006_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.have_compress=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.have_compress);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_006_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+SELECT @@GLOBAL.have_compress = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='have_compress';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.have_compress);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='have_compress';
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_006_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@have_compress = @@GLOBAL.have_compress;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_006_05----------------------#'
+################################################################################
+# Check if have_compress can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@have_compress);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.have_compress);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.have_compress);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.have_compress);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT have_compress = @@SESSION.have_compress;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/have_crypt_basic.test b/mysql-test/suite/sys_vars/t/have_crypt_basic.test
new file mode 100644
index 00000000..7ca193d8
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/have_crypt_basic.test
@@ -0,0 +1,100 @@
+
+
+################## mysql-test\t\have_crypt_basic.test #########################
+# #
+# Variable Name: have_crypt #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: boolean #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable have_crypt #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--echo '#---------------------BS_STVARS_007_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.have_crypt);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_007_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.have_crypt=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.have_crypt);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_007_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+SELECT @@GLOBAL.have_crypt = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='have_crypt';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.have_crypt);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='have_crypt';
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_007_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@have_crypt = @@GLOBAL.have_crypt;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_007_05----------------------#'
+################################################################################
+# Check if have_crypt can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@have_crypt);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.have_crypt);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.have_crypt);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.have_crypt);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT have_crypt = @@SESSION.have_crypt;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/have_dynamic_loading_basic.test b/mysql-test/suite/sys_vars/t/have_dynamic_loading_basic.test
new file mode 100644
index 00000000..3e136647
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/have_dynamic_loading_basic.test
@@ -0,0 +1,100 @@
+
+
+################## mysql-test\t\have_dynamic_loading_basic.test ###############
+# #
+# Variable Name: have_dynamic_loading #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: boolean #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable have_dynamic_loading #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--echo '#---------------------BS_STVARS_009_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.have_dynamic_loading);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_009_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.have_dynamic_loading=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.have_dynamic_loading);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_009_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+SELECT @@GLOBAL.have_dynamic_loading = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='have_dynamic_loading';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.have_dynamic_loading);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='have_dynamic_loading';
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_009_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@have_dynamic_loading = @@GLOBAL.have_dynamic_loading;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_009_05----------------------#'
+################################################################################
+# Check if have_dynamic_loading can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@have_dynamic_loading);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.have_dynamic_loading);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.have_dynamic_loading);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.have_dynamic_loading);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT have_dynamic_loading = @@SESSION.have_dynamic_loading;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/have_geometry_basic.test b/mysql-test/suite/sys_vars/t/have_geometry_basic.test
new file mode 100644
index 00000000..3ec0690b
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/have_geometry_basic.test
@@ -0,0 +1,100 @@
+
+
+################## mysql-test\t\have_geometry_basic.test ######################
+# #
+# Variable Name: have_geometry #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: boolean #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable have_geometry #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--echo '#---------------------BS_STVARS_010_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.have_geometry);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_010_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.have_geometry=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.have_geometry);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_010_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+SELECT @@GLOBAL.have_geometry = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='have_geometry';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.have_geometry);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='have_geometry';
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_010_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@have_geometry = @@GLOBAL.have_geometry;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_010_05----------------------#'
+################################################################################
+# Check if have_geometry can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@have_geometry);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.have_geometry);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.have_geometry);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.have_geometry);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT have_geometry = @@SESSION.have_geometry;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/have_openssl_basic.test b/mysql-test/suite/sys_vars/t/have_openssl_basic.test
new file mode 100644
index 00000000..037c8f4c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/have_openssl_basic.test
@@ -0,0 +1,100 @@
+
+
+################## mysql-test\t\have_openssl_basic.test #######################
+# #
+# Variable Name: have_openssl #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: boolean #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable have_openssl #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--echo '#---------------------BS_STVARS_013_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.have_openssl);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_013_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.have_openssl=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.have_openssl);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_013_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+SELECT @@GLOBAL.have_openssl = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='have_openssl';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.have_openssl);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='have_openssl';
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_013_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@have_openssl = @@GLOBAL.have_openssl;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_013_05----------------------#'
+################################################################################
+# Check if have_openssl can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@have_openssl);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.have_openssl);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.have_openssl);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.have_openssl);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT have_openssl = @@SESSION.have_openssl;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/have_profiling_basic.test b/mysql-test/suite/sys_vars/t/have_profiling_basic.test
new file mode 100644
index 00000000..da0ca88d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/have_profiling_basic.test
@@ -0,0 +1,23 @@
+#
+# only global
+#
+select @@global.have_profiling="1";
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.have_profiling;
+--replace_column 2 #
+show global variables like 'have_profiling';
+--replace_column 2 #
+show session variables like 'have_profiling';
+--replace_column 2 #
+select * from information_schema.global_variables where variable_name='have_profiling';
+--replace_column 2 #
+select * from information_schema.session_variables where variable_name='have_profiling';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global have_profiling=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session have_profiling=1;
+
diff --git a/mysql-test/suite/sys_vars/t/have_query_cache_basic.test b/mysql-test/suite/sys_vars/t/have_query_cache_basic.test
new file mode 100644
index 00000000..1c32300d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/have_query_cache_basic.test
@@ -0,0 +1,100 @@
+
+
+################## mysql-test\t\have_query_cache_basic.test ###################
+# #
+# Variable Name: have_query_cache #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: boolean #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable have_query_cache #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--echo '#---------------------BS_STVARS_015_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.have_query_cache);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_015_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.have_query_cache=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.have_query_cache);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_015_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+SELECT @@GLOBAL.have_query_cache = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='have_query_cache';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.have_query_cache);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='have_query_cache';
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_015_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@have_query_cache = @@GLOBAL.have_query_cache;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_015_05----------------------#'
+################################################################################
+# Check if have_query_cache can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@have_query_cache);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.have_query_cache);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.have_query_cache);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.have_query_cache);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT have_query_cache = @@SESSION.have_query_cache;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/have_rtree_keys_basic.test b/mysql-test/suite/sys_vars/t/have_rtree_keys_basic.test
new file mode 100644
index 00000000..493c4553
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/have_rtree_keys_basic.test
@@ -0,0 +1,100 @@
+
+
+################## mysql-test\t\have_rtree_keys_basic.test ####################
+# #
+# Variable Name: have_rtree_keys #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: boolean #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable have_rtree_keys #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--echo '#---------------------BS_STVARS_016_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.have_rtree_keys);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_016_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.have_rtree_keys=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.have_rtree_keys);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_016_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+SELECT @@GLOBAL.have_rtree_keys = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='have_rtree_keys';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.have_rtree_keys);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='have_rtree_keys';
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_016_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@have_rtree_keys = @@GLOBAL.have_rtree_keys;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_016_05----------------------#'
+################################################################################
+# Check if have_rtree_keys can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@have_rtree_keys);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.have_rtree_keys);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.have_rtree_keys);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.have_rtree_keys);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT have_rtree_keys = @@SESSION.have_rtree_keys;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/have_ssl_basic.test b/mysql-test/suite/sys_vars/t/have_ssl_basic.test
new file mode 100644
index 00000000..c92219d2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/have_ssl_basic.test
@@ -0,0 +1,100 @@
+
+
+################## mysql-test\t\have_ssl_basic.test ###########################
+# #
+# Variable Name: have_ssl #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: boolean #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable have_ssl #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--echo '#---------------------BS_STVARS_017_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.have_ssl);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_017_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.have_ssl=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.have_ssl);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_017_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+SELECT @@GLOBAL.have_ssl = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='have_ssl';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.have_ssl);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='have_ssl';
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_017_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@have_ssl = @@GLOBAL.have_ssl;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_017_05----------------------#'
+################################################################################
+# Check if have_ssl can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@have_ssl);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.have_ssl);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.have_ssl);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.have_ssl);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT have_ssl = @@SESSION.have_ssl;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/have_symlink_basic.test b/mysql-test/suite/sys_vars/t/have_symlink_basic.test
new file mode 100644
index 00000000..924da7c7
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/have_symlink_basic.test
@@ -0,0 +1,100 @@
+
+
+################## mysql-test\t\have_symlink_basic.test #######################
+# #
+# Variable Name: have_symlink #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: boolean #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable have_symlink #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--echo '#---------------------BS_STVARS_018_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.have_symlink);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_018_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.have_symlink=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.have_symlink);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_018_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+SELECT @@GLOBAL.have_symlink = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='have_symlink';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.have_symlink);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='have_symlink';
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_018_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@have_symlink = @@GLOBAL.have_symlink;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_018_05----------------------#'
+################################################################################
+# Check if have_symlink can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@have_symlink);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.have_symlink);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.have_symlink);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.have_symlink);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT have_symlink = @@SESSION.have_symlink;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/histogram_size_basic.test b/mysql-test/suite/sys_vars/t/histogram_size_basic.test
new file mode 100644
index 00000000..1ddab387
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/histogram_size_basic.test
@@ -0,0 +1,138 @@
+--source include/load_sysvars.inc
+
+##############################################################
+# START OF histogram_size TESTS #
+##############################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.histogram_size;
+SET @start_session_value = @@session.histogram_size;
+SELECT @start_global_value = @start_session_value;
+
+--echo '#--------------------FN_DYNVARS_053_01-------------------------#'
+################################################################
+# Display the DEFAULT value of histogram_size #
+################################################################
+
+SET @@global.histogram_size = DEFAULT;
+SELECT @@global.histogram_size;
+
+SET @@session.histogram_size = DEFAULT;
+SELECT @@session.histogram_size;
+
+--echo '#--------------------FN_DYNVARS_053_03-------------------------#'
+########################################################################
+# Change the value of histogram_size to a valid value for GLOBAL Scope #
+########################################################################
+
+SET @@global.histogram_size = 1;
+SELECT @@global.histogram_size;
+SET @@global.histogram_size = 31;
+SELECT @@global.histogram_size;
+SET @@global.histogram_size = 255;
+SELECT @@global.histogram_size;
+
+--echo '#--------------------FN_DYNVARS_053_04-------------------------#'
+#########################################################################
+# Change the value of histogram_size to a valid value for SESSION Scope #
+#########################################################################
+
+SET @@session.histogram_size = 1;
+SELECT @@session.histogram_size;
+SET @@session.histogram_size = 31;
+SELECT @@session.histogram_size;
+SET @@session.histogram_size = 255;
+SELECT @@session.histogram_size;
+
+--echo '#------------------FN_DYNVARS_053_05-----------------------#'
+##########################################################
+# Change the value of histogram_size to an invalid value #
+###########################################################
+
+SET @@global.histogram_size = -1;
+SELECT @@global.histogram_size;
+SET @@global.histogram_size = 256;
+SELECT @@global.histogram_size;
+SET @@global.histogram_size = 1024;
+SELECT @@global.histogram_size;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.histogram_size = 4.5;
+SELECT @@global.histogram_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.histogram_size = test;
+SELECT @@global.histogram_size;
+
+SET @@session.histogram_size = -1;
+SELECT @@session.histogram_size;
+SET @@session.histogram_size = 256;
+SELECT @@session.histogram_size;
+SET @@session.histogram_size = 1024;
+SELECT @@session.histogram_size;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.histogram_size = 4.5;
+SELECT @@session.histogram_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.histogram_size = test;
+SELECT @@session.histogram_size;
+
+--echo '#------------------FN_DYNVARS_053_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+SELECT @@global.histogram_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='histogram_size';
+
+--echo '#------------------FN_DYNVARS_053_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.histogram_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='histogram_size';
+
+
+--echo '#------------------FN_DYNVARS_053_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.histogram_size = TRUE;
+SET @@global.histogram_size = FALSE;
+
+--echo '#---------------------FN_DYNVARS_001_09----------------------#'
+#################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+#################################################################################
+
+SET @@global.histogram_size = 10;
+SELECT @@histogram_size = @@global.histogram_size;
+
+--echo '#---------------------FN_DYNVARS_001_10----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@histogram_size = 100;
+SELECT @@histogram_size = @@local.histogram_size;
+SELECT @@local.histogram_size = @@session.histogram_size;
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.histogram_size = @start_global_value;
+SET @@session.histogram_size = @start_session_value;
+
+###################################################
+# END OF histogram_size TESTS #
+###################################################
+
diff --git a/mysql-test/suite/sys_vars/t/histogram_type_basic.test b/mysql-test/suite/sys_vars/t/histogram_type_basic.test
new file mode 100644
index 00000000..bf1ef5ef
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/histogram_type_basic.test
@@ -0,0 +1,92 @@
+--source include/load_sysvars.inc
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.histogram_type;
+SELECT @start_global_value;
+SET @start_session_value = @@session.histogram_type;
+SELECT @start_session_value;
+
+##############################################################
+# Display the DEFAULT value of histogram_type #
+##############################################################
+
+SET @@global.histogram_type = 1;
+SET @@global.histogram_type = DEFAULT;
+SELECT @@global.histogram_type;
+
+#################################################################################
+# Change the value of histogram_type to a valid value for GLOBAL Scope #
+#################################################################################
+
+SET @@global.histogram_type = 0;
+SELECT @@global.histogram_type;
+SET @@global.histogram_type = 1;
+SELECT @@global.histogram_type;
+
+SET @@global.histogram_type = SINGLE_PREC_HB;
+SELECT @@global.histogram_type;
+SET @@global.histogram_type = DOUBLE_PREC_HB;
+SELECT @@global.histogram_type;
+
+###################################################################################
+# Change the value of histogram_type to a valid value for SESSION Scope #
+###################################################################################
+
+SET @@session.histogram_type = 0;
+SELECT @@session.histogram_type;
+SET @@session.histogram_type = 1;
+SELECT @@session.histogram_type;
+
+SET @@session.histogram_type = SINGLE_PREC_HB;
+SELECT @@session.histogram_type;
+SET @@session.histogram_type = DOUBLE_PREC_HB;
+SELECT @@session.histogram_type;
+
+####################################################################
+# Change the value of histogram_type to an invalid value #
+####################################################################
+
+set sql_mode=TRADITIONAL;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.histogram_type = 10;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.histogram_type = -1024;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.histogram_type = 2.4;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.histogram_type = OFF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.histogram_type = 10;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.histogram_type = -2;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.histogram_type = 1.2;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.histogram_type = ON;
+
+###############################################################################
+# Check if the value in GLOBAL & SESSION Tables matches value in variable #
+###############################################################################
+
+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='histogram_type';
+
+SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='histogram_type';
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.histogram_type = @start_global_value;
+SELECT @@global.histogram_type;
+SET @@session.histogram_type = @start_session_value;
+SELECT @@session.histogram_type;
+set sql_mode='';
+
+#####################################################
+# END OF histogram_type TESTS #
+##################################################### \ No newline at end of file
diff --git a/mysql-test/suite/sys_vars/t/host_cache_size_auto-master.opt b/mysql-test/suite/sys_vars/t/host_cache_size_auto-master.opt
new file mode 100644
index 00000000..ae09e3f5
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/host_cache_size_auto-master.opt
@@ -0,0 +1 @@
+--max_connections=1000 --open-files-limit=1000 --autoset-host-cache-size
diff --git a/mysql-test/suite/sys_vars/t/host_cache_size_auto.test b/mysql-test/suite/sys_vars/t/host_cache_size_auto.test
new file mode 100644
index 00000000..35846713
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/host_cache_size_auto.test
@@ -0,0 +1 @@
+select @@global.host_cache_size;
diff --git a/mysql-test/suite/sys_vars/t/host_cache_size_basic-master.opt b/mysql-test/suite/sys_vars/t/host_cache_size_basic-master.opt
new file mode 100644
index 00000000..7fb505c5
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/host_cache_size_basic-master.opt
@@ -0,0 +1 @@
+--host-cache-size=123
diff --git a/mysql-test/suite/sys_vars/t/host_cache_size_basic.test b/mysql-test/suite/sys_vars/t/host_cache_size_basic.test
new file mode 100644
index 00000000..38713d2f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/host_cache_size_basic.test
@@ -0,0 +1,41 @@
+--source include/not_embedded.inc
+
+#
+# Only global
+#
+
+select @@global.host_cache_size;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.host_cache_size;
+
+show global variables like 'host_cache_size';
+
+show session variables like 'host_cache_size';
+
+select * from information_schema.global_variables
+ where variable_name='host_cache_size';
+
+select * from information_schema.session_variables
+ where variable_name='host_cache_size';
+
+#
+# Read-Write
+#
+
+set global host_cache_size=1;
+select @@global.host_cache_size;
+
+set global host_cache_size=12;
+select @@global.host_cache_size;
+
+set global host_cache_size=0;
+select @@global.host_cache_size;
+
+--error ER_GLOBAL_VARIABLE
+set session host_cache_size=1;
+
+# Restore default
+set global host_cache_size=123;
+select @@global.host_cache_size;
+
diff --git a/mysql-test/suite/sys_vars/t/hostname_basic.test b/mysql-test/suite/sys_vars/t/hostname_basic.test
new file mode 100644
index 00000000..9f1dff75
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/hostname_basic.test
@@ -0,0 +1,100 @@
+
+
+################## mysql-test\t\hostname_basic.test ###########################
+# #
+# Variable Name: hostname #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: string #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable hostname #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--echo '#---------------------BS_STVARS_019_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.hostname);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_019_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.hostname=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.hostname);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_019_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+SELECT @@GLOBAL.hostname = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='hostname';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.hostname);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='hostname';
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_019_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@hostname = @@GLOBAL.hostname;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_019_05----------------------#'
+################################################################################
+# Check if hostname can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@hostname);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.hostname);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.hostname);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.hostname);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT hostname = @@SESSION.hostname;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/identity_basic.test b/mysql-test/suite/sys_vars/t/identity_basic.test
new file mode 100644
index 00000000..f88d2651
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/identity_basic.test
@@ -0,0 +1,184 @@
+############## mysql-test\t\identity_basic.test ###############
+# #
+# Variable Name: identity #
+# Scope: SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: - #
+# Range: - #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable identity #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+################################################################
+# START OF identity TESTS #
+################################################################
+
+
+################################################################
+# Saving initial value of identity in a temporary variable #
+################################################################
+
+SET @start_value = @@session.identity;
+SELECT @start_value;
+
+
+--echo '#--------------------FN_DYNVARS_035_01------------------------#'
+########################################################################
+# Display the DEFAULT value of identity #
+########################################################################
+
+SET @@session.identity = 99;
+# SET @@session.identity = DEFAULT;
+--echo 'Variable is giving error on assigning Default value';
+SELECT @@session.identity;
+
+
+--echo '#---------------------FN_DYNVARS_035_02-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@session.identity = @start_value;
+SELECT @@session.identity = 0;
+
+
+--echo '#--------------------FN_DYNVARS_035_03------------------------#'
+########################################################################
+# Change the value of identity to a valid value #
+########################################################################
+
+SET @@session.identity = 0;
+SELECT @@session.identity;
+SET @@session.identity = 1099;
+SELECT @@session.identity;
+SET @@session.identity = 1800;
+SELECT @@session.identity;
+SET @@session.identity = 65535;
+SELECT @@session.identity;
+
+
+--echo '#--------------------FN_DYNVARS_035_04-------------------------#'
+###########################################################################
+# Change the value of identity to invalid value #
+###########################################################################
+
+SET @@session.identity = -1;
+SELECT @@session.identity;
+SET @@session.identity = 100000000000;
+SELECT @@session.identity;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.identity = 10000.01;
+SELECT @@session.identity;
+SET @@session.identity = -1024;
+SELECT @@session.identity;
+SET @@session.identity = 42949672950;
+SELECT @@session.identity;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.identity = ON;
+SELECT @@session.identity;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.identity = 'test';
+SELECT @@session.identity;
+
+
+--echo '#-------------------FN_DYNVARS_035_05----------------------------#'
+###########################################################################
+# Test if accessing global identity gives error #
+###########################################################################
+
+--Error ER_LOCAL_VARIABLE
+SET @@global.identity = 0;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@global.identity;
+
+
+--echo '#----------------------FN_DYNVARS_035_06------------------------#'
+##############################################################################
+# Check if the value in GLOBAL & SESSION Tables matches values in variable #
+##############################################################################
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@global.identity = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='identity';
+
+SELECT @@session.identity = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='identity';
+
+
+--echo '#-------------------FN_DYNVARS_035_07----------------------------#'
+######################################################################
+# Test if accessing GLOBAL identity gives error #
+######################################################################
+
+--Error ER_LOCAL_VARIABLE
+SET @@global.identity = 0;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@global.identity;
+
+--echo '#---------------------FN_DYNVARS_035_08----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@session.identity = TRUE;
+SELECT @@session.identity;
+SET @@session.identity = FALSE;
+SELECT @@session.identity;
+
+
+--echo '#---------------------FN_DYNVARS_035_09----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@session.identity = 1;
+SELECT @@identity = @@session.identity;
+SELECT @@session.identity = @@local.identity;
+
+
+--echo '#---------------------FN_DYNVARS_035_10----------------------#'
+##########################################################################
+# Check if identity can be accessed with and without @@ sign #
+##########################################################################
+
+
+SET identity = 1;
+SELECT @@identity;
+--Error ER_UNKNOWN_TABLE
+SELECT local.identity;
+--Error ER_UNKNOWN_TABLE
+SELECT session.identity;
+--Error ER_BAD_FIELD_ERROR
+SELECT identity = @@session.identity;
+
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@session.identity = @start_value;
+SELECT @@session.identity;
+
+
+########################################################################
+# END OF identity TESTS #
+########################################################################
diff --git a/mysql-test/suite/sys_vars/t/identity_func-master.opt b/mysql-test/suite/sys_vars/t/identity_func-master.opt
new file mode 100644
index 00000000..03f5ae2d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/identity_func-master.opt
@@ -0,0 +1,2 @@
+--loose-innodb
+
diff --git a/mysql-test/suite/sys_vars/t/identity_func.test b/mysql-test/suite/sys_vars/t/identity_func.test
new file mode 100644
index 00000000..7398b5d0
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/identity_func.test
@@ -0,0 +1,140 @@
+#################### mysql-test\t\identity_func.test ##########################
+# #
+# Variable Name: identity #
+# Scope: SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: - #
+# Range: - #
+# #
+# #
+# Creation Date: 2008-03-07 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable identity #
+# that checks the functionality of this variable #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists t1;
+drop table if exists t2;
+--enable_warnings
+
+#########################
+# Creating new table #
+#########################
+
+--echo ## Creating new table t1 ##
+CREATE TABLE t1
+(
+id INT NOT NULL auto_increment,
+PRIMARY KEY (id),
+name VARCHAR(30)
+) ENGINE = INNODB;
+
+--echo ## Creating another new table t2 ##
+CREATE TABLE t2
+(
+id INT NOT NULL auto_increment,
+PRIMARY KEY (id),
+name VARCHAR(30)
+) ENGINE = INNODB;
+
+# MDEV-515 takes X-lock on the table for the first insert
+# So concurrent insert won't happen on the table
+INSERT INTO t1 VALUES(100, "MDEV-515");
+INSERT INTO t2 VALUES(100, "MDEV-515");
+
+--echo '#--------------------FN_DYNVARS_035_01-------------------------#'
+###############################################
+# Verifying initial value of identity. #
+###############################################
+
+--echo ## It should be zero ##
+SELECT @@identity = 0;
+
+connect (test_con1, localhost, root,,);
+connection test_con1;
+SET @@autocommit = 0;
+
+--echo ## Inserting rows in table t1 ##
+INSERT into t1(name) values('Record_1');
+INSERT into t1(name) values('Record_2');
+INSERT into t1(name) values('Record_3');
+
+--echo ## Verifying total values in t1 ##
+SELECT @@identity from t1;
+
+
+--echo ## Now inserting some data in table t2 ##
+INSERT into t2(name) values('Record_1');
+
+--echo ## Verifying total values in t2 ##
+SELECT @@identity from t2;
+
+
+--echo '#--------------------FN_DYNVARS_035_02-------------------------#'
+##########################################################
+# Verifying value of identity with new connection #
+##########################################################
+
+connect (test_con2, localhost, root,,);
+connection test_con2;
+SELECT * from t1;
+
+--echo ## Verifying total values in t1 ##
+SELECT @@identity from t1;
+
+--echo ## Verifying total values in t2 ##
+SELECT @@identity from t2;
+
+--echo ## Inserting some more records in table t1 ##
+INSERT into t1(name) values('Record_1_1');
+INSERT into t1(name) values('Record_1_2');
+
+--echo ## Verifying total values in t1 ##
+SELECT @@identity from t1;
+
+--echo ## Inserting row in table t2 ##
+INSERT into t2(name) values('Record_1_3');
+
+--echo ## Verifying total values in t2 ##
+SELECT @@identity from t2;
+
+
+--echo '#--------------------FN_DYNVARS_035_03-------------------------#'
+###################################################################
+# Verifying identity value by using commit in connectio # 01 #
+###################################################################
+
+connection test_con1;
+
+--echo ## Commiting rows added in test_con1 ##
+COMMIT;
+
+--echo ## Verifying records in both tables ##
+SELECT * from t1;
+SELECT * from t2;
+
+--echo ## Verifying total values in t1 after commiting data ##
+SELECT @@identity from t1;
+
+--echo ## Verifying total values in t2 after commiting data ##
+SELECT @@identity from t2;
+
+INSERT into t1(name) values('Record_4');
+
+--echo ## Now verifying value of variable after inserting 1 row in this connection ##
+SELECT @@identity from t1;
+
+--echo ## Dropping tables t1 & t2 ##
+drop table t1, t2;
+
+disconnect test_con1;
+disconnect test_con2;
diff --git a/mysql-test/suite/sys_vars/t/ignore_builtin_innodb_basic.test b/mysql-test/suite/sys_vars/t/ignore_builtin_innodb_basic.test
new file mode 100644
index 00000000..7295c466
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/ignore_builtin_innodb_basic.test
@@ -0,0 +1,19 @@
+#
+# only global
+#
+select @@global.ignore_builtin_innodb;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.ignore_builtin_innodb;
+show global variables like 'ignore_builtin_innodb';
+show session variables like 'ignore_builtin_innodb';
+select * from information_schema.global_variables where variable_name='ignore_builtin_innodb';
+select * from information_schema.session_variables where variable_name='ignore_builtin_innodb';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global ignore_builtin_innodb=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session ignore_builtin_innodb=1;
+
diff --git a/mysql-test/suite/sys_vars/t/ignore_db_dirs_basic-master.opt b/mysql-test/suite/sys_vars/t/ignore_db_dirs_basic-master.opt
new file mode 100644
index 00000000..03b94823
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/ignore_db_dirs_basic-master.opt
@@ -0,0 +1,11 @@
+--ignore-db-dirs=a
+--ignore-db-dirs=b
+--ignore-db-dirs=c
+--ignore-db-dirs=
+--ignore-db-dirs=d
+--ignore-db-dirs x
+--ignore-db-dirs=
+--ignore-db-dirs=e
+--ignore-db-dirs=lost+found
+--ignore-db-dirs=.mysqlgui
+--ignore-db-dirs=ignored_db
diff --git a/mysql-test/suite/sys_vars/t/ignore_db_dirs_basic.test b/mysql-test/suite/sys_vars/t/ignore_db_dirs_basic.test
new file mode 100644
index 00000000..78f6479d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/ignore_db_dirs_basic.test
@@ -0,0 +1,40 @@
+call mtr.add_suppression("table or database name '.otherdir'");
+
+select @@ignore_db_dirs;
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+mkdir $MYSQLD_DATADIR/.mysqlgui;
+mkdir $MYSQLD_DATADIR/.otherdir;
+mkdir $MYSQLD_DATADIR/lost+found;
+mkdir $MYSQLD_DATADIR/ignored_db;
+--echo # Check that SHOW DATABASES ignores all directories from
+--echo # @@ignore_db_dirs and all directories with names starting
+--echo # with '.'
+SHOW DATABASES;
+--error ER_WRONG_DB_NAME
+USE ignored_db;
+--error ER_WRONG_DB_NAME
+SELECT * FROM ignored_db.t1;
+--error ER_WRONG_DB_NAME
+CALL ignored_db.p1();
+SELECT COUNT(*) FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='ignored_db';
+--error ER_WRONG_DB_NAME
+CREATE DATABASE ignored_db;
+CREATE DATABASE `lost+found`;
+USE `lost+found`;
+CREATE TABLE t1(id INT);
+INSERT INTO t1 VALUES (1), (2);
+SELECT * FROM `lost+found`.t1;
+SHOW DATABASES;
+DROP DATABASE `lost+found`;
+rmdir $MYSQLD_DATADIR/.mysqlgui;
+rmdir $MYSQLD_DATADIR/.otherdir;
+rmdir $MYSQLD_DATADIR/lost+found;
+rmdir $MYSQLD_DATADIR/ignored_db;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.ignore_db_dirs = 'aha';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@local.ignore_db_dirs = 'aha';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@ignore_db_dirs = 'aha';
diff --git a/mysql-test/suite/sys_vars/t/in_transaction_basic.test b/mysql-test/suite/sys_vars/t/in_transaction_basic.test
new file mode 100644
index 00000000..906c971d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/in_transaction_basic.test
@@ -0,0 +1,21 @@
+# bool readonly
+
+#
+# show values;
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@global.in_transaction;
+select @@session.in_transaction;
+show global variables like 'in_transaction';
+show session variables like 'in_transaction';
+select * from information_schema.global_variables where variable_name='in_transaction';
+select * from information_schema.session_variables where variable_name='in_transaction';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global in_transaction=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session in_transaction=1;
+
diff --git a/mysql-test/suite/sys_vars/t/init_connect_basic.test b/mysql-test/suite/sys_vars/t/init_connect_basic.test
new file mode 100644
index 00000000..6aba83d3
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/init_connect_basic.test
@@ -0,0 +1,156 @@
+############## mysql-test\t\init_connect_basic.test ###########################
+# #
+# Variable Name: init_connect #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: string #
+# Default Value: #
+# Range: #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable init_connect #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+##############################################
+## START OF init_connect TESTS ##
+##############################################
+
+#############################################################
+# Save initial value #
+#############################################################
+# save using implicit session scope
+SET @global_start_value = @@global.init_connect;
+SELECT @global_start_value AS INIT_VALUE;
+
+--echo '#--------------------FN_DYNVARS_036_01------------------#'
+###############################################################################
+# Test Variable access and assignment with and without @@ #
+###############################################################################
+# select without @@
+--error ER_BAD_FIELD_ERROR
+SELECT init_connect;
+# access using no scope specified
+SELECT @@init_connect;
+# assign value without @@
+SET @@global.init_connect='SET autocomit=0';
+SELECT @@global.init_connect;
+# using another syntax for accessing session variable
+SET global init_connect='SET autocomit=0';
+# accessing variable with scope the wrong way
+--Error ER_BAD_FIELD_ERROR
+SELECT global init_connect;
+--Error ER_PARSE_ERROR
+SELECT @@global init_connect;
+
+
+--echo '#--------------------FN_DYNVARS_036_02-------------------------#'
+##################################################################
+# Check the DEFAULT value of init_connect for global #
+##################################################################
+SET @@global.init_connect = 'SET join_buffer_size=8200';
+SET @@global.init_connect = DEFAULT;
+SELECT @@global.init_connect;
+
+--echo '#--------------------FN_DYNVARS_036_03-------------------------#'
+######################################################################
+# see if it is accessible using session scope #
+######################################################################
+--Error ER_GLOBAL_VARIABLE
+SET @@session.init_connect = '';
+--Error ER_GLOBAL_VARIABLE
+SET @@init_connect = '';
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.init_connect;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@local.init_connect;
+
+--echo '#--------------------FN_DYNVARS_036_04-------------------------#'
+#########################################################################
+# Change the value of init_connect to a valid value #
+#########################################################################
+
+SET @@global.init_connect="";
+SELECT @@global.init_connect;
+
+SET @@global.init_connect='SELECT 1,"abc"';
+SELECT @@global.init_connect;
+
+SET @@global.init_connect='SET @yoursql="mysql"';
+SELECT @@global.init_connect;
+
+SET @@global.init_connect="SET autocomit=0;REVOKE ALL ON INFORMATION_SCHEMA.*";
+SELECT @@global.init_connect;
+
+SET @@global.init_connect='set @a="12\034"';
+SELECT @@global.init_connect;
+SELECT hex(@@global.init_connect);
+SHOW VARIABLES LIKE 'init_connect';
+
+SET @@global.init_connect='SHOW VARIABLES';
+SELECT @@global.init_connect;
+
+SET @@global.init_connect = NULL;
+SELECT @@global.init_connect;
+
+#any string is accepted as valid value as its is not verified until runtime
+SET @@global.init_connect='abc 123 +-*/';
+SELECT @@global.init_connect;
+
+SET @@global.init_connect=this_will_give_syntax_error;
+SELECT @@global.init_connect;
+
+SET @@global.init_connect = init_slave;
+SELECT @@global.init_connect;
+
+--echo '#--------------------FN_DYNVARS_036_05-------------------------#'
+###########################################################################
+# Change the value of init_connect to an invalid value for global #
+###########################################################################
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.init_connect = true;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.init_connect = false;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.init_connect = 1.1;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.init_connect = 0;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.init_connect = 1;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.init_connect = -1;
+
+SET @@global.init_connect = ON;
+SELECT @@global.init_connect;
+
+--echo '#--------------------FN_DYNVARS_036_06-------------------------#'
+##############################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+##############################################################################
+
+SELECT @@global.init_connect = (SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='init_connect') AS res;
+
+####################################
+# Restore initial value #
+####################################
+SET @@global.init_connect = @global_start_value;
+SELECT @@global.init_connect;
+
+#####################################################
+# END OF init_connect TESTS #
+#####################################################
diff --git a/mysql-test/suite/sys_vars/t/init_connect_grant.test b/mysql-test/suite/sys_vars/t/init_connect_grant.test
new file mode 100644
index 00000000..685f0900
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/init_connect_grant.test
@@ -0,0 +1,56 @@
+--source include/not_embedded.inc
+
+SET @global=@@global.init_connect;
+
+--echo #
+--echo # MDEV-21961 Bind CONNECTION ADMIN to a number of global system variables
+--echo #
+
+--echo # Test that "SET init_connect" is not allowed without CONNECTION ADMIN or SUPER
+
+CREATE USER user1@localhost;
+GRANT ALL PRIVILEGES ON *.* TO user1@localhost;
+REVOKE CONNECTION ADMIN, SUPER ON *.* FROM user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+SET GLOBAL init_connect="SET @xxx=1";
+--error ER_GLOBAL_VARIABLE
+SET init_connect="SET @xxx=1";
+--error ER_GLOBAL_VARIABLE
+SET SESSION init_connect="SET @xxx=1";
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET init_connect" is allowed with CONNECTION ADMIN
+
+CREATE USER user1@localhost;
+GRANT CONNECTION ADMIN ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+SET GLOBAL init_connect="SET @xxx=1";
+--error ER_GLOBAL_VARIABLE
+SET init_connect="SET @xxx=1";
+--error ER_GLOBAL_VARIABLE
+SET SESSION init_connect="SET @xxx=1";
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET init_connect" is allowed with SUPER
+
+CREATE USER user1@localhost;
+GRANT SUPER ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+SET GLOBAL init_connect="SET @xxx=1";
+--error ER_GLOBAL_VARIABLE
+SET init_connect="SET @xxx=1";
+--error ER_GLOBAL_VARIABLE
+SET SESSION init_connect="SET @xxx=1";
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+SET @@global.init_connect=@global;
diff --git a/mysql-test/suite/sys_vars/t/init_file_basic.test b/mysql-test/suite/sys_vars/t/init_file_basic.test
new file mode 100644
index 00000000..0b59fcd7
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/init_file_basic.test
@@ -0,0 +1,19 @@
+#
+# only global
+#
+select @@global.init_file;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.init_file;
+show global variables like 'init_file';
+show session variables like 'init_file';
+select * from information_schema.global_variables where variable_name='init_file';
+select * from information_schema.session_variables where variable_name='init_file';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global init_file=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session init_file=1;
+
diff --git a/mysql-test/suite/sys_vars/t/init_slave_basic.test b/mysql-test/suite/sys_vars/t/init_slave_basic.test
new file mode 100644
index 00000000..4dd7fd80
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/init_slave_basic.test
@@ -0,0 +1,153 @@
+###################### mysql-test\t\init_slave_basic.test #####################
+# #
+# Variable Name: init_slave #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: string #
+# Default Value: #
+# Range: #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable init_slave #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+############################################
+## START OF init_slave TESTS ##
+############################################
+
+#############################################################
+# Save initial value #
+#############################################################
+# save using implicit session scope
+SET @global_start_value = @@global.init_slave;
+SELECT @global_start_value AS INIT_VALUE;
+
+--echo '#--------------------FN_DYNVARS_037_01------------------#'
+###############################################################################
+# Test Variable access and assignment with and without @@ #
+###############################################################################
+# select without @@
+--error ER_BAD_FIELD_ERROR
+SELECT init_slave;
+# access using no scope specified
+SELECT @@init_slave;
+# assign value without @@
+SET @@global.init_slave='SET autocomit=0';
+SELECT @@global.init_slave;
+# using another syntax for accessing session variable
+SET global init_slave='SET autocomit=0';
+# accessing variable with scope the wrong way
+--Error ER_BAD_FIELD_ERROR
+SELECT global init_slave;
+--Error ER_PARSE_ERROR
+SELECT @@global init_slave;
+
+
+--echo '#--------------------FN_DYNVARS_037_02-------------------------#'
+################################################################
+# Check the DEFAULT value of init_slave for global #
+################################################################
+SET @@global.init_slave = 'SET join_buffer_size=8200';
+SET @@global.init_slave = DEFAULT;
+SELECT @@global.init_slave;
+
+--echo '#--------------------FN_DYNVARS_037_03-------------------------#'
+######################################################################
+# see if it is accessible using session scope #
+######################################################################
+--Error ER_GLOBAL_VARIABLE
+SET @@session.init_slave = '';
+--Error ER_GLOBAL_VARIABLE
+SET @@init_slave = "";
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.init_slave;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@local.init_slave;
+
+--echo '#--------------------FN_DYNVARS_037_04-------------------------#'
+#######################################################################
+# Change the value of init_slave to a valid value #
+#######################################################################
+
+SET @@global.init_slave="";
+SELECT @@global.init_slave;
+
+SET @@global.init_slave='SELECT 1,"abc"';
+SELECT @@global.init_slave;
+
+SET @@global.init_slave='SET @a="b"';
+SELECT @@global.init_slave;
+
+SET @@global.init_slave="SET autocomit=1;REVOKE ALL ON INFORMATION_SCHEMA.*";
+SELECT @@global.init_slave;
+
+SET @@global.init_slave='SHOW VARIABLES';
+SELECT @@global.init_slave;
+
+SET @@global.init_slave = NULL;
+SELECT @@global.init_slave;
+
+#any string is accepted as valid value as its is not verified/compiled
+# untill runtime
+SET @@global.init_slave='abc 123 +-*/';
+SELECT @@global.init_slave;
+
+SET @@global.init_slave=this_will_give_syntax_error;
+SELECT @@global.init_slave;
+
+SET @@global.init_slave = init_slave;
+SELECT @@global.init_slave;
+
+--echo '#--------------------FN_DYNVARS_037_05-------------------------#'
+#########################################################################
+# Change the value of init_slave to an invalid value for global #
+#########################################################################
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.init_slave = true;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.init_slave = false;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.init_slave = 1.1;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.init_slave = 0;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.init_slave = 1;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.init_slave = -1;
+
+SET @@global.init_slave = ON;
+SELECT @@global.init_slave;
+
+
+--echo '#--------------------FN_DYNVARS_037_06-------------------------#'
+##############################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+##############################################################################
+
+SELECT @@global.init_slave = (SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='init_slave') AS res;
+
+####################################
+# Restore initial value #
+####################################
+SET @@global.init_slave = @global_start_value;
+SELECT @@global.init_slave;
+
+###################################################
+# END OF init_slave TESTS #
+###################################################
diff --git a/mysql-test/suite/sys_vars/t/init_slave_grant.test b/mysql-test/suite/sys_vars/t/init_slave_grant.test
new file mode 100644
index 00000000..b2efbd13
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/init_slave_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21966 Bind REPLICATION SLAVE ADMIN to a number of global system variables
+--echo #
+
+--let var = init_slave
+--let grant = REPLICATION SLAVE ADMIN
+--let value = 'SET @x=1'
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/innodb_adaptive_flushing_basic.test b/mysql-test/suite/sys_vars/t/innodb_adaptive_flushing_basic.test
new file mode 100644
index 00000000..051d863b
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_adaptive_flushing_basic.test
@@ -0,0 +1,70 @@
+
+
+# 2010-01-25 - Added
+#
+
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_adaptive_flushing;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+--echo Valid values are 'ON' and 'OFF'
+select @@global.innodb_adaptive_flushing in (0, 1);
+select @@global.innodb_adaptive_flushing;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_adaptive_flushing;
+show global variables like 'innodb_adaptive_flushing';
+show session variables like 'innodb_adaptive_flushing';
+select * from information_schema.global_variables where variable_name='innodb_adaptive_flushing';
+select * from information_schema.session_variables where variable_name='innodb_adaptive_flushing';
+
+#
+# show that it's writable
+#
+set global innodb_adaptive_flushing='OFF';
+select @@global.innodb_adaptive_flushing;
+select * from information_schema.global_variables where variable_name='innodb_adaptive_flushing';
+select * from information_schema.session_variables where variable_name='innodb_adaptive_flushing';
+set @@global.innodb_adaptive_flushing=1;
+select @@global.innodb_adaptive_flushing;
+select * from information_schema.global_variables where variable_name='innodb_adaptive_flushing';
+select * from information_schema.session_variables where variable_name='innodb_adaptive_flushing';
+set global innodb_adaptive_flushing=0;
+select @@global.innodb_adaptive_flushing;
+select * from information_schema.global_variables where variable_name='innodb_adaptive_flushing';
+select * from information_schema.session_variables where variable_name='innodb_adaptive_flushing';
+set @@global.innodb_adaptive_flushing='ON';
+select @@global.innodb_adaptive_flushing;
+select * from information_schema.global_variables where variable_name='innodb_adaptive_flushing';
+select * from information_schema.session_variables where variable_name='innodb_adaptive_flushing';
+--error ER_GLOBAL_VARIABLE
+set session innodb_adaptive_flushing='OFF';
+--error ER_GLOBAL_VARIABLE
+set @@session.innodb_adaptive_flushing='ON';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_adaptive_flushing=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_adaptive_flushing=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_adaptive_flushing=2;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_adaptive_flushing=-3;
+select @@global.innodb_adaptive_flushing;
+select * from information_schema.global_variables where variable_name='innodb_adaptive_flushing';
+select * from information_schema.session_variables where variable_name='innodb_adaptive_flushing';
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_adaptive_flushing='AUTO';
+
+#
+# Cleanup
+#
+
+SET @@global.innodb_adaptive_flushing = @start_global_value;
+SELECT @@global.innodb_adaptive_flushing;
diff --git a/mysql-test/suite/sys_vars/t/innodb_adaptive_flushing_lwm_basic.test b/mysql-test/suite/sys_vars/t/innodb_adaptive_flushing_lwm_basic.test
new file mode 100644
index 00000000..04f07cdd
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_adaptive_flushing_lwm_basic.test
@@ -0,0 +1,142 @@
+############ mysql-test\t\innodb_adaptive_flushing_lwm_basic.test #############
+# #
+# Variable Name: innodb_adaptive_flushing_lwm #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 10 #
+# Range: 0-70 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+#Description:Test Cases of Dynamic System Variable innodb_adaptive_flushing_lwm #
+# that checks the behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF innodb_adaptive_flushing_lwm TESTS #
+########################################################################
+
+
+###############################################################################
+#Saving initial value of innodb_adaptive_flushing_lwm in a temporary variable #
+###############################################################################
+
+SET @global_start_value = @@global.innodb_adaptive_flushing_lwm;
+SELECT @global_start_value;
+
+--echo '#--------------------FN_DYNVARS_046_01------------------------#'
+########################################################################
+# Display the DEFAULT value of innodb_adaptive_flushing_lwm #
+########################################################################
+
+SET @@global.innodb_adaptive_flushing_lwm = 1;
+SET @@global.innodb_adaptive_flushing_lwm = DEFAULT;
+SELECT @@global.innodb_adaptive_flushing_lwm;
+
+--echo '#---------------------FN_DYNVARS_046_02-------------------------#'
+###################################################################################
+# Check if innodb_adaptive_flushing_lwm can be accessed with and without @@ sign #
+###################################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET innodb_adaptive_flushing_lwm = 1;
+SELECT @@innodb_adaptive_flushing_lwm;
+
+--Error ER_UNKNOWN_TABLE
+SELECT local.innodb_adaptive_flushing_lwm;
+
+SET global innodb_adaptive_flushing_lwm = 1;
+SELECT @@global.innodb_adaptive_flushing_lwm;
+
+--echo '#--------------------FN_DYNVARS_046_03------------------------#'
+###############################################################################
+# change the value of innodb_adaptive_flushing_lwm to a valid value #
+###############################################################################
+
+SET @@global.innodb_adaptive_flushing_lwm = 1;
+SELECT @@global.innodb_adaptive_flushing_lwm;
+
+SET @@global.innodb_adaptive_flushing_lwm = 60;
+SELECT @@global.innodb_adaptive_flushing_lwm;
+SET @@global.innodb_adaptive_flushing_lwm = 70;
+SELECT @@global.innodb_adaptive_flushing_lwm;
+
+--echo '#--------------------FN_DYNVARS_046_04-------------------------#'
+###########################################################################
+# Change the value of innodb_adaptive_flushing_lwm to invalid value #
+###########################################################################
+
+SET @@global.innodb_adaptive_flushing_lwm = -1;
+SELECT @@global.innodb_adaptive_flushing_lwm;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_adaptive_flushing_lwm = "T";
+SELECT @@global.innodb_adaptive_flushing_lwm;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_adaptive_flushing_lwm = "Y";
+SELECT @@global.innodb_adaptive_flushing_lwm;
+
+SET @@global.innodb_adaptive_flushing_lwm = 71;
+SELECT @@global.innodb_adaptive_flushing_lwm;
+
+--echo '#----------------------FN_DYNVARS_046_05------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#########################################################################
+
+SELECT @@global.innodb_adaptive_flushing_lwm =
+ VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='innodb_adaptive_flushing_lwm';
+SELECT @@global.innodb_adaptive_flushing_lwm;
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='innodb_adaptive_flushing_lwm';
+
+--echo '#---------------------FN_DYNVARS_046_06-------------------------#'
+###################################################################
+# Check if ON and OFF values can be used on variable #
+###################################################################
+
+--ERROR ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_adaptive_flushing_lwm = OFF;
+SELECT @@global.innodb_adaptive_flushing_lwm;
+
+--ERROR ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_adaptive_flushing_lwm = ON;
+SELECT @@global.innodb_adaptive_flushing_lwm;
+
+--echo '#---------------------FN_DYNVARS_046_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+
+SET @@global.innodb_adaptive_flushing_lwm = TRUE;
+SELECT @@global.innodb_adaptive_flushing_lwm;
+SET @@global.innodb_adaptive_flushing_lwm = FALSE;
+SELECT @@global.innodb_adaptive_flushing_lwm;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.innodb_adaptive_flushing_lwm = @global_start_value;
+SELECT @@global.innodb_adaptive_flushing_lwm;
+
+###############################################################
+# END OF innodb_adaptive_flushing_lwm TESTS #
+###############################################################
diff --git a/mysql-test/suite/sys_vars/t/innodb_adaptive_hash_index_basic.test b/mysql-test/suite/sys_vars/t/innodb_adaptive_hash_index_basic.test
new file mode 100644
index 00000000..88e23957
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_adaptive_hash_index_basic.test
@@ -0,0 +1,69 @@
+
+
+# 2010-01-25 - Added
+#
+
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_adaptive_hash_index;
+
+#
+# exists as global only
+#
+--echo Valid values are 'ON' and 'OFF'
+select @@global.innodb_adaptive_hash_index in (0, 1);
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_adaptive_hash_index;
+--replace_column 2 #
+show global variables like 'innodb_adaptive_hash_index';
+--replace_column 2 #
+show session variables like 'innodb_adaptive_hash_index';
+select variable_name from information_schema.global_variables where variable_name='innodb_adaptive_hash_index';
+select variable_name from information_schema.session_variables where variable_name='innodb_adaptive_hash_index';
+
+#
+# show that it's writable
+#
+set global innodb_adaptive_hash_index='OFF';
+select @@global.innodb_adaptive_hash_index;
+select * from information_schema.global_variables where variable_name='innodb_adaptive_hash_index';
+select * from information_schema.session_variables where variable_name='innodb_adaptive_hash_index';
+set @@global.innodb_adaptive_hash_index=1;
+select @@global.innodb_adaptive_hash_index;
+select * from information_schema.global_variables where variable_name='innodb_adaptive_hash_index';
+select * from information_schema.session_variables where variable_name='innodb_adaptive_hash_index';
+set global innodb_adaptive_hash_index=0;
+select @@global.innodb_adaptive_hash_index;
+select * from information_schema.global_variables where variable_name='innodb_adaptive_hash_index';
+select * from information_schema.session_variables where variable_name='innodb_adaptive_hash_index';
+set @@global.innodb_adaptive_hash_index='ON';
+select @@global.innodb_adaptive_hash_index;
+select * from information_schema.global_variables where variable_name='innodb_adaptive_hash_index';
+select * from information_schema.session_variables where variable_name='innodb_adaptive_hash_index';
+--error ER_GLOBAL_VARIABLE
+set session innodb_adaptive_hash_index='OFF';
+--error ER_GLOBAL_VARIABLE
+set @@session.innodb_adaptive_hash_index='ON';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_adaptive_hash_index=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_adaptive_hash_index=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_adaptive_hash_index=2;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_adaptive_hash_index=-3;
+select @@global.innodb_adaptive_hash_index;
+select * from information_schema.global_variables where variable_name='innodb_adaptive_hash_index';
+select * from information_schema.session_variables where variable_name='innodb_adaptive_hash_index';
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_adaptive_hash_index='AUTO';
+
+#
+# Cleanup
+#
+
+SET @@global.innodb_adaptive_hash_index = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/innodb_adaptive_hash_index_parts_basic.test b/mysql-test/suite/sys_vars/t/innodb_adaptive_hash_index_parts_basic.test
new file mode 100644
index 00000000..3f4a9283
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_adaptive_hash_index_parts_basic.test
@@ -0,0 +1,75 @@
+--source include/have_innodb.inc
+
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.innodb_adaptive_hash_index_parts);
+--echo 1 Expected
+
+
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.innodb_adaptive_hash_index_parts=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.innodb_adaptive_hash_index_parts);
+--echo 1 Expected
+
+
+
+
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+--disable_warnings
+SELECT @@GLOBAL.innodb_adaptive_hash_index_parts = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_adaptive_hash_index_parts';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.innodb_adaptive_hash_index_parts);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_adaptive_hash_index_parts';
+--echo 1 Expected
+--enable_warnings
+
+
+
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@innodb_adaptive_hash_index_parts = @@GLOBAL.innodb_adaptive_hash_index_parts;
+--echo 1 Expected
+
+
+
+################################################################################
+# Check if innodb_adaptive_hash_index_parts can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@innodb_adaptive_hash_index_parts);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.innodb_adaptive_hash_index_parts);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.innodb_adaptive_hash_index_parts);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.innodb_adaptive_hash_index_parts);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT innodb_adaptive_hash_index_parts = @@SESSION.innodb_adaptive_hash_index_parts;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_autoextend_increment_basic.test b/mysql-test/suite/sys_vars/t/innodb_autoextend_increment_basic.test
new file mode 100644
index 00000000..864dd732
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_autoextend_increment_basic.test
@@ -0,0 +1,152 @@
+################# mysql-test\t\innodb_autoextend_increment _basic.test ###########
+# #
+# Variable Name: innodb_autoextend_increment #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 64 #
+# Range: 0,1 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: #
+# Test Cases of Dynamic System Variable innodb_autoextend_increment that #
+# checks the behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# #
+##################################################################################
+
+--source include/have_innodb.inc
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF innodb_autoextend_increment TESTS #
+########################################################################
+
+
+###############################################################################
+# Saving initial value of innodb_autoextend_increment in a temporary variable #
+###############################################################################
+
+
+SET @global_start_value = @@global.innodb_autoextend_increment ;
+
+--echo '#--------------------FN_DYNVARS_046_01------------------------#'
+########################################################################
+# Display the DEFAULT value of innodb_autoextend_increment #
+########################################################################
+
+SET @@global.innodb_autoextend_increment = 0;
+SET @@global.innodb_autoextend_increment = DEFAULT;
+SELECT @@global.innodb_autoextend_increment ;
+
+--echo '#---------------------FN_DYNVARS_046_02-------------------------#'
+####################################################################################
+# Check if innodb_autoextend_increment can be accessed with and without @@ sign #
+####################################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET innodb_autoextend_increment = 1;
+SELECT @@innodb_autoextend_increment ;
+
+--Error ER_UNKNOWN_TABLE
+SELECT local.innodb_autoextend_increment ;
+
+SET global innodb_autoextend_increment = 0;
+SELECT @@global.innodb_autoextend_increment ;
+
+
+--echo '#--------------------FN_DYNVARS_046_03------------------------#'
+##########################################################################
+# change the value of innodb_autoextend_increment to a valid value #
+##########################################################################
+
+SET @@global.innodb_autoextend_increment = 1;
+SELECT @@global.innodb_autoextend_increment ;
+SET @@global.innodb_autoextend_increment = 1000;
+SELECT @@global.innodb_autoextend_increment ;
+
+
+--echo '#--------------------FN_DYNVARS_046_04-------------------------#'
+###########################################################################
+# Change the value of innodb_autoextend_increment to invalid value #
+###########################################################################
+
+SET @@global.innodb_autoextend_increment = -1;
+SELECT @@global.innodb_autoextend_increment;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_autoextend_increment = "T";
+SELECT @@global.innodb_autoextend_increment;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_autoextend_increment = "Y";
+SELECT @@global.innodb_autoextend_increment;
+
+SET @@global.innodb_autoextend_increment = 1001;
+SELECT @@global.innodb_autoextend_increment;
+
+
+SET @@global.innodb_autoextend_increment = 2000 ;
+SELECT @@global.innodb_autoextend_increment;
+
+--echo '#----------------------FN_DYNVARS_046_05------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#########################################################################
+
+--disable_warnings
+SELECT @@global.innodb_autoextend_increment = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_autoextend_increment ';
+--enable_warnings
+SELECT @@global.innodb_autoextend_increment ;
+--disable_warnings
+SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_autoextend_increment ';
+--enable_warnings
+
+
+--echo '#---------------------FN_DYNVARS_046_06-------------------------#'
+###################################################################
+# Check if ON and OFF values can be used on variable #
+###################################################################
+
+--ERROR ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_autoextend_increment = OFF;
+SELECT @@global.innodb_autoextend_increment ;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_autoextend_increment = ON;
+SELECT @@global.innodb_autoextend_increment ;
+
+
+--echo '#---------------------FN_DYNVARS_046_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.innodb_autoextend_increment = TRUE;
+SELECT @@global.innodb_autoextend_increment ;
+SET @@global.innodb_autoextend_increment = FALSE;
+SELECT @@global.innodb_autoextend_increment ;
+
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.innodb_autoextend_increment = @global_start_value;
+
+###############################################################
+# END OF innodb_autoextend_increment TESTS #
+###############################################################
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_basic.test b/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_basic.test
new file mode 100644
index 00000000..81e63ddf
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_basic.test
@@ -0,0 +1,93 @@
+################# mysql-test\t\innodb_autoinc_lock_mode_basic.test ############
+# #
+# Variable Name: innodb_autoinc_lock_mode #
+# Access Type: Static #
+# Data Type: Numeric #
+# Default Value: 1 #
+# Range: 0,1,2 #
+# #
+# #
+# Creation Date: 2008-02-20 #
+# Author: Sharique Abdullah #
+# #
+#Description:Test Cases of Dynamic System Variable innodb_autoextend_increment#
+# that checks the behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF innodb_autoinc_lock_mode TESTS #
+########################################################################
+
+
+################################################################################
+# Saving initial value of innodb_autoinc_lock_mode in a temporary variable#
+################################################################################
+
+
+SET @global_start_value = @@global.innodb_autoinc_lock_mode;
+SELECT @global_start_value;
+
+
+
+--echo '#--------------------FN_DYNVARS_046_01------------------------#'
+########################################################################
+# Display the DEFAULT value of innodb_autoinc_lock_mode #
+########################################################################
+
+
+--ERROR ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.innodb_autoinc_lock_mode = 0;
+--ERROR ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.innodb_autoinc_lock_mode = DEFAULT;
+SELECT @@global.innodb_autoinc_lock_mode;
+
+--echo '#---------------------FN_DYNVARS_046_02-------------------------#'
+####################################################################################
+# Check if innodb_autoinc_lock_mode can be accessed with and without @@ sign #
+####################################################################################
+
+
+SELECT @@innodb_autoinc_lock_mode;
+
+
+--Error ER_UNKNOWN_TABLE
+SELECT local.innodb_autoinc_lock_mode;
+
+
+
+SELECT @@global.innodb_autoinc_lock_mode;
+
+
+
+--echo '#----------------------FN_DYNVARS_046_03------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#########################################################################
+
+--disable_warnings
+SELECT @@global.innodb_autoinc_lock_mode = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_autoinc_lock_mode';
+--enable_warnings
+SELECT @@global.innodb_autoinc_lock_mode;
+--disable_warnings
+SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_autoinc_lock_mode';
+--enable_warnings
+
+
+###############################################################
+# END OF innodb_autoinc_lock_mode TESTS #
+###############################################################
diff --git a/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_func-master.opt b/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_func-master.opt
new file mode 100644
index 00000000..ab9fcb75
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_func-master.opt
@@ -0,0 +1,2 @@
+--innodb-autoinc-lock-mode=1
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_func.test b/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_func.test
new file mode 100644
index 00000000..89c1c80a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_func.test
@@ -0,0 +1,59 @@
+################# mysql-test\t\innodb_autoinc_lock_mode_func.test ############
+# #
+# Variable Name: innodb_autoinc_lock_mode #
+# Scope: GLOBAL #
+# Access Type: Readonly #
+# Data Type: Numeric #
+# Default Value: 1 #
+# Range: 0,1,2 #
+# #
+# #
+# Creation Date: 2008-03-08 #
+# Author: Rizwan Maredia #
+# #
+# Description: #
+# Test Cases of Dynamic System Variable innodb_autoextend_increment that #
+# checks the behavior of this variable #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# #
+###############################################################################
+
+--echo '#--------------------FN_DYNVARS_039_01-------------------------#'
+################################################################
+# Begin the functionality Testing of innodb_autoinc_lock_mode #
+################################################################
+--source include/have_innodb.inc
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET global innodb_autoinc_lock_mode = 1;
+
+#========================================================
+--echo '--innodb_autoinc_lock_mode is 1 (consecutive)--'
+#========================================================
+
+
+# innodb_autoinc_lock_mode is 1 in opt file
+SELECT @@global.innodb_autoinc_lock_mode;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1(
+a INT AUTO_INCREMENT PRIMARY KEY,
+b CHAR
+) ENGINE=INNODB, AUTO_INCREMENT=100;
+
+INSERT INTO t1 (a,b) VALUES (5,'a'), (NULL,'b'), (1,'c'), (NULL,'d');
+INSERT INTO t1 (a,b) VALUES (NULL,'e');
+--echo 'the new auto incremented value should be 104'
+SELECT * FROM t1;
+
+DROP TABLE t1;
+
+###############################################################
+# End of functionality Testing for innodb_autoinc_lock_mode #
+###############################################################
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_buf_dump_status_frequency_basic.test b/mysql-test/suite/sys_vars/t/innodb_buf_dump_status_frequency_basic.test
new file mode 100644
index 00000000..c505fbbd
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_buf_dump_status_frequency_basic.test
@@ -0,0 +1,39 @@
+--source include/have_innodb.inc
+--source include/load_sysvars.inc
+
+SET @start_innodb_buf_dump_status_frequency = @@global.innodb_buf_dump_status_frequency;
+SELECT @start_innodb_buf_dump_status_frequency;
+
+SELECT COUNT(@@global.innodb_buf_dump_status_frequency);
+
+# test valid value
+SET @@global.innodb_buf_dump_status_frequency = 20;
+SELECT @@global.innodb_buf_dump_status_frequency;
+
+# test valid min
+SET @@global.innodb_buf_dump_status_frequency = 0;
+SELECT @@global.innodb_buf_dump_status_frequency;
+
+# test valid max
+SET @@global.innodb_buf_dump_status_frequency = 100;
+SELECT @@global.innodb_buf_dump_status_frequency;
+
+# test invalid value < min
+SET @@global.innodb_buf_dump_status_frequency = -1;
+SELECT @@global.innodb_buf_dump_status_frequency;
+
+# test invalid value > max
+SET @@global.innodb_buf_dump_status_frequency = 101;
+SELECT @@global.innodb_buf_dump_status_frequency;
+
+# test wrong type
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_buf_dump_status_frequency = 10.5;
+SELECT @@global.innodb_buf_dump_status_frequency;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_buf_dump_status_frequency = "abc";
+SELECT @@global.innodb_buf_dump_status_frequency;
+
+SET @@global.innodb_buf_dump_status_frequency = @start_innodb_buf_dump_status_frequency;
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_buf_flush_list_now_basic.test b/mysql-test/suite/sys_vars/t/innodb_buf_flush_list_now_basic.test
new file mode 100644
index 00000000..8a53b0a5
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_buf_flush_list_now_basic.test
@@ -0,0 +1,32 @@
+--echo #
+--echo # Basic test for innodb_buf_flush_list_now.
+--echo #
+
+--source include/have_innodb.inc
+
+# The config variable is a debug variable for now
+-- source include/have_debug.inc
+
+SELECT @@global.innodb_buf_flush_list_now;
+
+set global innodb_buf_flush_list_now = 1;
+
+SELECT @@global.innodb_buf_flush_list_now;
+
+set global innodb_buf_flush_list_now = 0;
+
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_buf_flush_list_now = dummy;
+
+--error ER_GLOBAL_VARIABLE
+set innodb_buf_flush_list_now = ON;
+
+--echo # Setting to ON is ok.
+set global innodb_buf_flush_list_now = ON;
+
+--echo # Setting to OFF is ok.
+set global innodb_buf_flush_list_now = OFF;
+
+--echo # Must always be 0.
+SELECT @@global.innodb_buf_flush_list_now;
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_chunk_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_chunk_size_basic.test
new file mode 100644
index 00000000..561786ee
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_chunk_size_basic.test
@@ -0,0 +1,75 @@
+--source include/have_innodb.inc
+
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.innodb_buffer_pool_chunk_size);
+--echo 1 Expected
+
+
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.innodb_buffer_pool_chunk_size=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.innodb_buffer_pool_chunk_size);
+--echo 1 Expected
+
+
+
+
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+--disable_warnings
+SELECT @@GLOBAL.innodb_buffer_pool_chunk_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_buffer_pool_chunk_size';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.innodb_buffer_pool_chunk_size);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_buffer_pool_chunk_size';
+--echo 1 Expected
+--enable_warnings
+
+
+
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@innodb_buffer_pool_chunk_size = @@GLOBAL.innodb_buffer_pool_chunk_size;
+--echo 1 Expected
+
+
+
+################################################################################
+# Check if innodb_buffer_pool_chunk_size can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@innodb_buffer_pool_chunk_size);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.innodb_buffer_pool_chunk_size);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.innodb_buffer_pool_chunk_size);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.innodb_buffer_pool_chunk_size);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT innodb_buffer_pool_chunk_size = @@SESSION.innodb_buffer_pool_chunk_size;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_abort_loads.opt b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_abort_loads.opt
new file mode 100644
index 00000000..787f6ce5
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_abort_loads.opt
@@ -0,0 +1,5 @@
+--loose-default-storage-engine=innodb
+--loose-innodb_buffer_pool_load_at_startup=0
+--loose-innodb_buffer_pool_dump_at_shutdown=0
+--loose-innodb-buffer-pool-size=8M
+--loose-innodb-page-size=16k
diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_abort_loads.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_abort_loads.test
new file mode 100644
index 00000000..089f3072
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_abort_loads.test
@@ -0,0 +1,150 @@
+#
+# MDEV-11455 - add status variable innodb_buffer_pool_load_abort
+#
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/no_valgrind_without_big.inc
+
+--echo
+--echo # innodb_buffer_pool_load_incomplete defaults 0
+SELECT variable_name, variable_value
+ FROM information_schema.global_status
+ WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_incomplete';
+
+--echo
+--echo # populate with data
+
+CREATE TABLE t1 (
+c01 blob, c02 blob, c03 blob, c04 blob, c05 blob,
+c06 blob, c07 blob, c08 blob, c09 blob, c10 blob,
+c11 blob, c12 blob, c13 blob, c14 blob, c15 blob,
+c16 blob, c17 blob, c18 blob, c19 blob, c20 blob,
+c21 blob, c22 blob, c23 blob, c24 blob, c25 blob,
+c26 blob, c27 blob, c28 blob, c29 blob, c30 blob,
+c31 blob, c32 blob, c33 blob, c34 blob, c35 blob,
+c36 blob, c37 blob, c38 blob, c39 blob, c40 blob,
+c41 blob, c42 blob, c43 blob, c44 blob, c45 blob,
+c46 blob, c47 blob, c48 blob, c49 blob, c50 blob,
+c51 blob, c52 blob, c53 blob, c54 blob, c55 blob,
+c56 blob, c57 blob, c58 blob, c59 blob, c60 blob,
+c61 blob, c62 blob, c63 blob, c64 blob
+) ROW_FORMAT=dynamic;
+
+SET @a = repeat('a', 16 * 1024);
+INSERT INTO t1 VALUES (@a,@a,@a,@a,@a,
+@a,@a,@a,@a,@a,
+@a,@a,@a,@a,@a,
+@a,@a,@a,@a,@a,
+@a,@a,@a,@a,@a,
+@a,@a,@a,@a,@a,
+@a,@a,@a,@a,@a,
+@a,@a,@a,@a,@a,
+@a,@a,@a,@a,@a,
+@a,@a,@a,@a,@a,
+@a,@a,@a,@a,@a,
+@a,@a,@a,@a,@a,
+@a,@a,@a,@a
+);
+
+SET GLOBAL innodb_buffer_pool_dump_now=1;
+# Wait for for the dump to complete
+let $wait_condition =
+ SELECT SUBSTR(variable_value, 1, 33) = 'Buffer pool(s) dump completed at '
+ FROM information_schema.global_status
+ WHERE LOWER(variable_name) = 'innodb_buffer_pool_dump_status';
+-- source include/wait_condition.inc
+
+--echo
+--echo # Restart server
+--source include/restart_mysqld.inc
+
+--echo
+--echo # Abort after 16 pages
+SET GLOBAL innodb_buffer_pool_load_pages_abort=16,
+ GLOBAL innodb_buffer_pool_load_now=1,
+ GLOBAL innodb_buffer_pool_dump_at_shutdown=1;
+
+let $wait_condition =
+ SELECT SUBSTR(variable_value, 1, 19) = 'Buffer pool(s) load'
+ FROM information_schema.global_status
+ WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status';
+-- source include/wait_condition.inc
+
+SELECT variable_name, SUBSTR(variable_value, 1, 38) as VALUE
+ FROM information_schema.global_status
+ WHERE LOWER(variable_name) IN ('innodb_buffer_pool_load_incomplete','innodb_buffer_pool_load_status')
+ ORDER BY variable_name;
+
+--let $incomplete=`select count(*) as BLOB_PAGES from information_schema.INNODB_BUFFER_PAGE WHERE PAGE_TYPE='BLOB' group by PAGE_TYPE`
+
+# Shouldn't dump at shutdown due to innodb_buffer_pool_load_incomplete
+
+--echo
+--echo # Restart server
+--source include/restart_mysqld.inc
+
+--echo
+--echo # Load buffer pool
+SET GLOBAL innodb_buffer_pool_load_now=1;
+
+# Wait for for the load to complete
+let $wait_condition =
+ SELECT SUBSTR(variable_value, 1, 33) = 'Buffer pool(s) load completed at '
+ FROM information_schema.global_status
+ WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status';
+-- source include/wait_condition.inc
+
+--echo
+--echo # Should be more than previous as we didn't overwrite our save file
+--replace_result $incomplete Previous_loaded
+--eval select count(*) > $incomplete as Loaded_more from information_schema.INNODB_BUFFER_PAGE WHERE PAGE_TYPE='BLOB' group by PAGE_TYPE;
+
+--echo
+--echo # Successful, so innodb_buffer_pool_load_incomplete should be FALSE
+SELECT variable_name, SUBSTR(variable_value, 1, 33) as VALUE
+ FROM information_schema.global_status
+ WHERE LOWER(variable_name) IN ('innodb_buffer_pool_load_incomplete','innodb_buffer_pool_load_status')
+ ORDER BY variable_name;
+
+--echo
+--echo # innodb_buffer_pool_dump_now=1 should reset the innodb_buffer_pool_load_incomplete status
+
+SET GLOBAL innodb_buffer_pool_dump_now=1;
+# Wait for for the dump to complete
+let $wait_condition =
+ SELECT SUBSTR(variable_value, 1, 33) = 'Buffer pool(s) dump completed at '
+ FROM information_schema.global_status
+ WHERE LOWER(variable_name) = 'innodb_buffer_pool_dump_status';
+-- source include/wait_condition.inc
+
+SELECT variable_name, SUBSTR(variable_value, 1, 33) as VALUE
+ FROM information_schema.global_status
+ WHERE LOWER(variable_name) IN ('innodb_buffer_pool_load_incomplete', 'innodb_buffer_pool_dump_status');
+
+--let $fulldump=`select count(*) as BLOB_PAGES from information_schema.INNODB_BUFFER_PAGE WHERE PAGE_TYPE='BLOB' group by PAGE_TYPE`
+
+--echo
+--echo # Restart server
+--source include/restart_mysqld.inc
+
+--echo
+--echo # Load buffer pool
+SET GLOBAL innodb_buffer_pool_load_now=1;
+
+# Wait for for the load to complete
+let $wait_condition =
+ SELECT SUBSTR(variable_value, 1, 33) = 'Buffer pool(s) load completed at '
+ FROM information_schema.global_status
+ WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status';
+-- source include/wait_condition.inc
+
+--echo
+--echo # Should be same amount
+--replace_result $fulldump Previously_dumped
+--eval select abs($fulldump - count(*)) <= 2 as Loaded_about_same_size from information_schema.INNODB_BUFFER_PAGE WHERE PAGE_TYPE='BLOB' group by PAGE_TYPE;
+
+--echo
+--echo # Clean up
+
+--remove_file $MYSQLTEST_VARDIR/mysqld.1/data/ib_buffer_pool
+DROP TABLE t1;
diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_at_shutdown_basic.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_at_shutdown_basic.test
new file mode 100644
index 00000000..072d1cec
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_at_shutdown_basic.test
@@ -0,0 +1,45 @@
+#
+# Basic test for innodb_buffer_pool_dump_at_shutdown
+#
+
+-- source include/have_innodb.inc
+# include/restart_mysqld.inc does not work in embedded mode
+-- source include/not_embedded.inc
+-- source include/no_valgrind_without_big.inc
+
+# Check the default value
+SET @orig = @@global.innodb_buffer_pool_dump_at_shutdown;
+SELECT @orig;
+
+# Confirm that we can change the value
+SET GLOBAL innodb_buffer_pool_dump_at_shutdown = OFF;
+SELECT @@global.innodb_buffer_pool_dump_at_shutdown;
+SET GLOBAL innodb_buffer_pool_dump_at_shutdown = ON;
+SELECT @@global.innodb_buffer_pool_dump_at_shutdown;
+
+# Check the type
+
+-- error ER_WRONG_TYPE_FOR_VAR, ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL innodb_buffer_pool_dump_at_shutdown = 12.34;
+
+-- error ER_WRONG_TYPE_FOR_VAR, ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL innodb_buffer_pool_dump_at_shutdown = "string";
+
+-- error ER_WRONG_TYPE_FOR_VAR, ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL innodb_buffer_pool_dump_at_shutdown = 5;
+
+# Confirm that the dump file is created at shutdown
+
+-- let $file = `SELECT CONCAT(@@datadir, @@global.innodb_buffer_pool_filename)`
+
+-- error 0,1
+-- remove_file $file
+
+-- error 1
+-- file_exists $file
+
+-- source include/restart_mysqld.inc
+
+-- file_exists $file
+
+SET GLOBAL innodb_buffer_pool_dump_at_shutdown = default;
diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_now_basic.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_now_basic.test
new file mode 100644
index 00000000..8c5f8fa7
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_now_basic.test
@@ -0,0 +1,48 @@
+#
+# Basic test for innodb_buffer_pool_dump_now
+#
+
+-- source include/have_innodb.inc
+
+# Check the default value
+SELECT @@global.innodb_buffer_pool_dump_now;
+
+-- let $file = `SELECT CONCAT(@@datadir, @@global.innodb_buffer_pool_filename)`
+-- error 0,1
+-- remove_file $file
+
+SELECT variable_value INTO @old_dump_status FROM information_schema.global_status
+ WHERE LOWER(variable_name) = 'innodb_buffer_pool_dump_status';
+
+# A previous test could have run buffer pool dump already;
+# in this case we want to make sure that the current time is different
+# from the timestamp in the status variable.
+# We should have had a smart wait condition here, like the commented one below,
+# let $wait_condition =
+# SELECT TRIM(SUBSTR('$old_status', -8)) != DATE_FORMAT(CURTIME(), '%k:%i:%s');
+# -- source include/wait_condition.inc
+
+# ... but we can't because of MDEV-9867, so there will be just sleep instead.
+# And it might be not enough to sleep one second, so we'll have to sleep two.
+
+if (`SELECT variable_value LIKE '%completed at%' FROM information_schema.global_status
+ WHERE LOWER(variable_name) = 'innodb_buffer_pool_dump_status'`)
+{
+ -- sleep 2
+}
+
+# Do the dump
+SET GLOBAL innodb_buffer_pool_dump_now = ON;
+# Should always be OFF
+SELECT @@global.innodb_buffer_pool_dump_now;
+
+# Wait for the dump to complete
+let $wait_condition =
+ SELECT variable_value != @old_dump_status
+ AND SUBSTR(variable_value, 1, 33) = 'Buffer pool(s) dump completed at '
+ FROM information_schema.global_status
+ WHERE LOWER(variable_name) = 'innodb_buffer_pool_dump_status';
+-- source include/wait_condition.inc
+
+# Confirm that the dump file has been created
+-- file_exists $file
diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_pct_basic.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_pct_basic.test
new file mode 100644
index 00000000..9b4edafb
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_pct_basic.test
@@ -0,0 +1,71 @@
+############################################
+# Variable Name: innodb_buffer_pool_dump_pct
+# Scope: GLOBAL
+# Access Type: Dynamic
+# Data Type: Integer
+# Default Value: 100
+# Range: 1-100
+############################################
+
+-- source include/have_innodb.inc
+
+# Save the default value
+SET @orig = @@global.innodb_buffer_pool_dump_pct;
+SELECT @orig;
+
+SET GLOBAL innodb_buffer_pool_dump_pct=3;
+
+--echo # Do the dump
+
+--disable_query_log
+--disable_result_log
+--source innodb_buffer_pool_dump_now_basic.test
+--enable_result_log
+--enable_query_log
+
+# Set the valid value
+SET GLOBAL innodb_buffer_pool_dump_pct=20;
+
+# Check the value is 20
+SELECT @@global.innodb_buffer_pool_dump_pct;
+
+# Set the lower Boundary value
+SET GLOBAL innodb_buffer_pool_dump_pct=1;
+
+# Check the value is 1
+SELECT @@global.innodb_buffer_pool_dump_pct;
+
+# Set the upper boundary value
+SET GLOBAL innodb_buffer_pool_dump_pct=100;
+
+# Check the value is 100
+SELECT @@global.innodb_buffer_pool_dump_pct;
+
+# Set the beyond upper boundary value
+SET GLOBAL innodb_buffer_pool_dump_pct=101;
+
+# Check the value is 100
+SELECT @@global.innodb_buffer_pool_dump_pct;
+
+# Set the beyond lower boundary value
+SET GLOBAL innodb_buffer_pool_dump_pct=-1;
+
+# Check the value is 1
+SELECT @@global.innodb_buffer_pool_dump_pct;
+
+# Set the Default value
+SET GLOBAL innodb_buffer_pool_dump_pct=Default;
+
+# Check the default value
+SELECT @@global.innodb_buffer_pool_dump_pct;
+
+# Set with some invalid value
+--error ER_WRONG_TYPE_FOR_VAR
+SET GLOBAL innodb_buffer_pool_dump_pct='foo';
+
+# Set without using Global
+--error ER_GLOBAL_VARIABLE
+SET innodb_buffer_pool_dump_pct=50;
+
+# Restore original value
+SET GLOBAL innodb_buffer_pool_dump_pct=@orig;
diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_pct_function.opt b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_pct_function.opt
new file mode 100644
index 00000000..787f6ce5
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_pct_function.opt
@@ -0,0 +1,5 @@
+--loose-default-storage-engine=innodb
+--loose-innodb_buffer_pool_load_at_startup=0
+--loose-innodb_buffer_pool_dump_at_shutdown=0
+--loose-innodb-buffer-pool-size=8M
+--loose-innodb-page-size=16k
diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_pct_function.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_pct_function.test
new file mode 100644
index 00000000..f682ad23
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_pct_function.test
@@ -0,0 +1,107 @@
+#
+# Functional test for innodb_buffer_pool_dump_pct
+#
+# From MDEV-11454 the amount dumped is the minimum of:
+# * innodb_buffer_pool_dump_pct * Innodb_buffer_pool_pages_total * innodb_page_size
+# * innodb_buffer_pool_pages_data * innodb_page_size
+
+-- source include/have_innodb.inc
+
+--echo # populate with data
+
+CREATE TABLE t1 (
+c01 blob, c02 blob, c03 blob, c04 blob, c05 blob,
+c06 blob, c07 blob, c08 blob, c09 blob, c10 blob,
+c11 blob, c12 blob, c13 blob, c14 blob, c15 blob,
+c16 blob, c17 blob, c18 blob, c19 blob, c20 blob,
+c21 blob, c22 blob, c23 blob, c24 blob, c25 blob,
+c26 blob, c27 blob, c28 blob, c29 blob, c30 blob,
+c31 blob, c32 blob, c33 blob, c34 blob, c35 blob,
+c36 blob, c37 blob, c38 blob, c39 blob, c40 blob,
+c41 blob, c42 blob, c43 blob, c44 blob, c45 blob,
+c46 blob, c47 blob, c48 blob, c49 blob, c50 blob,
+c51 blob, c52 blob, c53 blob, c54 blob, c55 blob,
+c56 blob, c57 blob, c58 blob, c59 blob, c60 blob,
+c61 blob, c62 blob, c63 blob, c64 blob
+) ROW_FORMAT=dynamic;
+
+SET @a = repeat('a', 16 * 1024);
+INSERT INTO t1 VALUES (@a,@a,@a,@a,@a,
+@a,@a,@a,@a,@a,
+@a,@a,@a,@a,@a,
+@a,@a,@a,@a,@a,
+@a,@a,@a,@a,@a,
+@a,@a,@a,@a,@a,
+@a,@a,@a,@a,@a,
+@a,@a,@a,@a,@a,
+@a,@a,@a,@a,@a,
+@a,@a,@a,@a,@a,
+@a,@a,@a,@a,@a,
+@a,@a,@a,@a,@a,
+@a,@a,@a,@a
+);
+
+insert into t1 select * from t1;
+
+--let $blob_pages=`select count(*) from information_schema.INNODB_BUFFER_PAGE WHERE PAGE_TYPE='BLOB' group by PAGE_TYPE`
+
+--let $PCT=25
+--eval SET GLOBAL innodb_buffer_pool_dump_pct=$PCT,GLOBAL innodb_fast_shutdown=0, GLOBAL innodb_buffer_pool_dump_at_shutdown=1
+
+# Dump on shutdown has been set - shutdown now
+
+--echo # Restart server
+--source include/restart_mysqld.inc
+
+SET GLOBAL innodb_buffer_pool_load_now=1;
+
+# Wait fit for the load to complete
+let $wait_condition =
+ SELECT SUBSTR(variable_value, 1, 33) = 'Buffer pool(s) load completed at '
+ FROM information_schema.global_status
+ WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status';
+-- source include/wait_condition.inc
+
+
+--let $loaded_blob_pages=`select count(*) from information_schema.INNODB_BUFFER_PAGE WHERE PAGE_TYPE='BLOB' group by PAGE_TYPE`
+
+--echo # Case 1: Limit from innodb_buffer_pool_dump_pct
+
+eval SELECT $blob_pages as 'Previous pool pages',
+ ROUND($PCT / 100 * @@innodb_buffer_pool_size / @@innodb_page_size) as 'Limit',
+ $loaded_blob_pages as 'Pages saved';
+
+--echo # Case 2: blog_pages is the minimum.
+
+--echo # load buffer pool with entire table.
+--disable_result_log
+select * from t1;
+--enable_result_log
+
+--let $PCT=75
+eval SET GLOBAL innodb_buffer_pool_dump_pct=$PCT, global innodb_buffer_pool_dump_at_shutdown=1;
+
+--let $blob_pages=`select count(*) from information_schema.INNODB_BUFFER_PAGE WHERE PAGE_TYPE='BLOB' group by PAGE_TYPE`
+
+--echo # Restart server
+--source include/restart_mysqld.inc
+
+
+SET GLOBAL innodb_buffer_pool_load_now=1;
+
+# Wait for load
+-- source include/wait_condition.inc
+
+--echo # now loaded
+
+--let $loaded_blob_pages=`select count(*) from information_schema.INNODB_BUFFER_PAGE WHERE PAGE_TYPE='BLOB' group by PAGE_TYPE`
+
+eval SELECT $blob_pages as 'Previous pool pages',
+ ROUND($PCT / 100 * @@innodb_buffer_pool_size / @@innodb_page_size) as 'Limit',
+ $loaded_blob_pages as 'Pages saved';
+
+# Clean up
+#
+#
+--remove_file $MYSQLTEST_VARDIR/mysqld.1/data/ib_buffer_pool
+DROP TABLE t1;
diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_evict_basic.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_evict_basic.test
new file mode 100644
index 00000000..1c371861
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_evict_basic.test
@@ -0,0 +1,19 @@
+-- source include/have_innodb.inc
+# This is a debug variable for now
+-- source include/have_debug.inc
+
+SET @save_innodb_read_only_compressed=@@GLOBAL.innodb_read_only_compressed;
+SELECT @@global.innodb_buffer_pool_evict;
+
+SET GLOBAL innodb_read_only_compressed=ON;
+--error ER_UNSUPPORTED_COMPRESSED_TABLE
+CREATE TABLE t(a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
+SET GLOBAL innodb_read_only_compressed=OFF;
+
+CREATE TABLE t(a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
+SET GLOBAL innodb_buffer_pool_evict = 'uncompressed';
+
+# Should always be empty.
+SELECT @@global.innodb_buffer_pool_evict;
+DROP TABLE t;
+SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_load_abort_basic.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_load_abort_basic.test
new file mode 100644
index 00000000..31a9d2ca
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_load_abort_basic.test
@@ -0,0 +1,15 @@
+#
+# Basic test for innodb_buffer_pool_load_abort
+#
+
+-- source include/have_innodb.inc
+
+# Check the default value
+SET @orig = @@global.innodb_buffer_pool_load_abort;
+SELECT @orig;
+
+# Confirm that the value remains OFF after being set to ON
+
+SET GLOBAL innodb_buffer_pool_load_abort = ON;
+
+SELECT @@global.innodb_buffer_pool_load_abort;
diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_load_at_startup_basic.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_load_at_startup_basic.test
new file mode 100644
index 00000000..efaffa09
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_load_at_startup_basic.test
@@ -0,0 +1,15 @@
+#
+# Basic test for innodb_buffer_pool_load_at_startup
+#
+
+-- source include/have_innodb.inc
+
+# Check the default value
+SET @orig = @@global.innodb_buffer_pool_load_at_startup;
+SELECT @orig;
+
+# Confirm that we can not change the value
+-- error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET GLOBAL innodb_buffer_pool_load_at_startup = OFF;
+-- error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET GLOBAL innodb_buffer_pool_load_at_startup = ON;
diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_load_now_basic.opt b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_load_now_basic.opt
new file mode 100644
index 00000000..e462be3c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_load_now_basic.opt
@@ -0,0 +1 @@
+--innodb-buffer-pool-load-at-startup=off
diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_load_now_basic.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_load_now_basic.test
new file mode 100644
index 00000000..15536d33
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_load_now_basic.test
@@ -0,0 +1,49 @@
+#
+# Basic test for innodb_buffer_pool_load_now
+#
+
+-- source include/have_innodb.inc
+
+# Check the default value
+SELECT @@global.innodb_buffer_pool_load_now;
+
+# Make sure there is a dump file to load
+
+-- let $file = `SELECT CONCAT(@@datadir, @@global.innodb_buffer_pool_filename)`
+-- error 0,1
+-- file_exists $file
+if ($errno)
+{
+ # Dump file does not exist, get it created
+ --disable_query_log
+ --disable_result_log
+ --source innodb_buffer_pool_dump_now_basic.test
+ --enable_result_log
+ --enable_query_log
+}
+
+let $old_load_status=
+ `SELECT variable_value FROM information_schema.global_status
+ WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status'`;
+
+# Load the dump
+SET GLOBAL innodb_buffer_pool_load_now = ON;
+
+# Wait for the load to complete
+let $wait_condition =
+ SELECT variable_value != '$old_load_status' &&
+ SUBSTR(variable_value, 1, 33) = 'Buffer pool(s) load completed at '
+ FROM information_schema.global_status
+ WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status';
+--disable_warnings
+-- source include/wait_condition.inc
+--enable_warnings
+
+# Show the status, interesting if the above timed out
+--disable_warnings
+-- replace_regex /[0-9]{6}[[:space:]]+[0-9]{1,2}:[0-9]{2}:[0-9]{2}/TIMESTAMP_NOW/
+SELECT variable_value
+FROM information_schema.global_status
+WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status';
+--enable_warnings
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic-master.opt b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic-master.opt
new file mode 100644
index 00000000..aa536bf0
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic-master.opt
@@ -0,0 +1 @@
+--innodb-buffer-pool-chunk-size=2M
diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic.test
new file mode 100644
index 00000000..dada2a9a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic.test
@@ -0,0 +1,114 @@
+
+
+################## mysql-test\t\innodb_buffer_pool_size_basic.test ############
+# #
+# Variable Name: innodb_buffer_pool_size #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: numeric #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable innodb_buffer_pool_size #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+
+let $wait_condition =
+ SELECT SUBSTR(variable_value, 1, 30) = 'Completed resizing buffer pool'
+ FROM information_schema.global_status
+ WHERE LOWER(variable_name) = 'innodb_buffer_pool_resize_status';
+
+SET @start_buffer_pool_size = @@GLOBAL.innodb_buffer_pool_size;
+
+--echo '#---------------------BS_STVARS_022_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.innodb_buffer_pool_size);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_022_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+SET @@GLOBAL.innodb_buffer_pool_size=10485760;
+--echo Expected succeeded
+--source include/wait_condition.inc
+
+SELECT COUNT(@@GLOBAL.innodb_buffer_pool_size);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_022_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+--disable_warnings
+SELECT @@GLOBAL.innodb_buffer_pool_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_buffer_pool_size';
+--enable_warnings
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.innodb_buffer_pool_size);
+--echo 1 Expected
+
+--disable_warnings
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_buffer_pool_size';
+--enable_warnings
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_022_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@innodb_buffer_pool_size = @@GLOBAL.innodb_buffer_pool_size;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_022_05----------------------#'
+################################################################################
+# Check if innodb_buffer_pool_size can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@innodb_buffer_pool_size);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.innodb_buffer_pool_size);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.innodb_buffer_pool_size);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.innodb_buffer_pool_size);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT innodb_buffer_pool_size = @@SESSION.innodb_buffer_pool_size;
+
+
+# Restore the original buffer pool size.
+--source include/restart_mysqld.inc
diff --git a/mysql-test/suite/sys_vars/t/innodb_change_buffer_max_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_change_buffer_max_size_basic.test
new file mode 100644
index 00000000..2094ef3d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_change_buffer_max_size_basic.test
@@ -0,0 +1,71 @@
+
+
+# 2011-02-09 - Added
+#
+
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_change_buffer_max_size;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+--echo Valid values are between 0 and 50
+select @@global.innodb_change_buffer_max_size between 0 and 50;
+select @@global.innodb_change_buffer_max_size;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_change_buffer_max_size;
+show global variables like 'innodb_change_buffer_max_size';
+show session variables like 'innodb_change_buffer_max_size';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_change_buffer_max_size';
+select * from information_schema.session_variables where variable_name='innodb_change_buffer_max_size';
+--enable_warnings
+
+#
+# show that it's writable
+#
+set global innodb_change_buffer_max_size=10;
+select @@global.innodb_change_buffer_max_size;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_change_buffer_max_size';
+select * from information_schema.session_variables where variable_name='innodb_change_buffer_max_size';
+--enable_warnings
+--error ER_GLOBAL_VARIABLE
+set session innodb_change_buffer_max_size=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_change_buffer_max_size=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_change_buffer_max_size=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_change_buffer_max_size="foo";
+
+set global innodb_change_buffer_max_size=-7;
+select @@global.innodb_change_buffer_max_size;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_change_buffer_max_size';
+--enable_warnings
+set global innodb_change_buffer_max_size=56;
+select @@global.innodb_change_buffer_max_size;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_change_buffer_max_size';
+--enable_warnings
+
+#
+# min/max/DEFAULT values
+#
+set global innodb_change_buffer_max_size=0;
+select @@global.innodb_change_buffer_max_size;
+set global innodb_change_buffer_max_size=50;
+select @@global.innodb_change_buffer_max_size;
+set global innodb_change_buffer_max_size=DEFAULT;
+select @@global.innodb_change_buffer_max_size;
+
+
+SET @@global.innodb_change_buffer_max_size = @start_global_value;
+SELECT @@global.innodb_change_buffer_max_size;
diff --git a/mysql-test/suite/sys_vars/t/innodb_change_buffering_basic.test b/mysql-test/suite/sys_vars/t/innodb_change_buffering_basic.test
new file mode 100644
index 00000000..19f0890f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_change_buffering_basic.test
@@ -0,0 +1,65 @@
+
+
+# 2010-01-25 - Added
+#
+
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_change_buffering;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+--echo Valid values are 'all', 'deletes', 'changes', 'inserts', 'none', 'purges'
+select @@global.innodb_change_buffering in ('all', 'deletes', 'changes', 'inserts', 'none', 'purges');
+select @@global.innodb_change_buffering;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_change_buffering;
+show global variables like 'innodb_change_buffering';
+show session variables like 'innodb_change_buffering';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_change_buffering';
+select * from information_schema.session_variables where variable_name='innodb_change_buffering';
+--enable_warnings
+
+#
+# show that it's writable
+#
+set global innodb_change_buffering='none';
+select @@global.innodb_change_buffering;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_change_buffering';
+select * from information_schema.session_variables where variable_name='innodb_change_buffering';
+--enable_warnings
+set @@global.innodb_change_buffering='inserts';
+select @@global.innodb_change_buffering;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_change_buffering';
+select * from information_schema.session_variables where variable_name='innodb_change_buffering';
+--enable_warnings
+--error ER_GLOBAL_VARIABLE
+set session innodb_change_buffering='some';
+--error ER_GLOBAL_VARIABLE
+set @@session.innodb_change_buffering='some';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_change_buffering=1.1;
+set global innodb_change_buffering=1;
+SELECT @@global.innodb_change_buffering;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_change_buffering=-2;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_change_buffering=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_change_buffering='some';
+
+#
+# Cleanup
+#
+
+SET @@global.innodb_change_buffering = @start_global_value;
+SELECT @@global.innodb_change_buffering;
diff --git a/mysql-test/suite/sys_vars/t/innodb_change_buffering_debug_basic.test b/mysql-test/suite/sys_vars/t/innodb_change_buffering_debug_basic.test
new file mode 100644
index 00000000..70f8bee1
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_change_buffering_debug_basic.test
@@ -0,0 +1,59 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+
+SET @start_global_value = @@global.innodb_change_buffering_debug;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+select @@global.innodb_change_buffering_debug in (0, 1);
+select @@global.innodb_change_buffering_debug;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_change_buffering_debug;
+show global variables like 'innodb_change_buffering_debug';
+show session variables like 'innodb_change_buffering_debug';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_change_buffering_debug';
+select * from information_schema.session_variables where variable_name='innodb_change_buffering_debug';
+--enable_warnings
+
+#
+# show that it's writable
+#
+set global innodb_change_buffering_debug=1;
+select @@global.innodb_change_buffering_debug;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_change_buffering_debug';
+select * from information_schema.session_variables where variable_name='innodb_change_buffering_debug';
+--enable_warnings
+set @@global.innodb_change_buffering_debug=0;
+select @@global.innodb_change_buffering_debug;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_change_buffering_debug';
+select * from information_schema.session_variables where variable_name='innodb_change_buffering_debug';
+--enable_warnings
+--error ER_GLOBAL_VARIABLE
+set session innodb_change_buffering_debug='some';
+--error ER_GLOBAL_VARIABLE
+set @@session.innodb_change_buffering_debug='some';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_change_buffering_debug=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_change_buffering_debug='foo';
+set global innodb_change_buffering_debug=-2;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_change_buffering_debug=1e1;
+set global innodb_change_buffering_debug=2;
+select @@global.innodb_change_buffering_debug;
+
+#
+# Cleanup
+#
+
+SET @@global.innodb_change_buffering_debug = @start_global_value;
+SELECT @@global.innodb_change_buffering_debug;
diff --git a/mysql-test/suite/sys_vars/t/innodb_checksum_algorithm_basic.test b/mysql-test/suite/sys_vars/t/innodb_checksum_algorithm_basic.test
new file mode 100644
index 00000000..b0a0fcc9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_checksum_algorithm_basic.test
@@ -0,0 +1,32 @@
+--source include/have_innodb.inc
+
+# Check the default value
+SET @orig = @@global.innodb_checksum_algorithm;
+SELECT @orig;
+
+SET GLOBAL innodb_checksum_algorithm = 'crc32';
+SELECT @@global.innodb_checksum_algorithm;
+
+SET GLOBAL innodb_checksum_algorithm = 'strict_crc32';
+SELECT @@global.innodb_checksum_algorithm;
+
+SET GLOBAL innodb_checksum_algorithm = 'full_crc32';
+SELECT @@global.innodb_checksum_algorithm;
+
+SET GLOBAL innodb_checksum_algorithm = 'strict_full_crc32';
+SELECT @@global.innodb_checksum_algorithm;
+
+-- error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL innodb_checksum_algorithm = '';
+SELECT @@global.innodb_checksum_algorithm;
+
+-- error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL innodb_checksum_algorithm = 'foobar';
+SELECT @@global.innodb_checksum_algorithm;
+
+-- error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL innodb_checksum_algorithm = 123;
+SELECT @@global.innodb_checksum_algorithm;
+
+SET GLOBAL innodb_checksum_algorithm = @orig;
+SELECT @@global.innodb_checksum_algorithm;
diff --git a/mysql-test/suite/sys_vars/t/innodb_cmp_per_index_enabled_basic.test b/mysql-test/suite/sys_vars/t/innodb_cmp_per_index_enabled_basic.test
new file mode 100644
index 00000000..dbb10e0b
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_cmp_per_index_enabled_basic.test
@@ -0,0 +1,70 @@
+-- source include/have_innodb.inc
+# CREATE TABLE ... KEY_BLOCK_SIZE=8; does not work with page size = 4k
+-- source include/have_innodb_16k.inc
+
+SET @save_innodb_read_only_compressed=@@GLOBAL.innodb_read_only_compressed;
+SET GLOBAL innodb_read_only_compressed=OFF;
+
+# Check the default value
+SELECT @@global.innodb_cmp_per_index_enabled;
+
+# should be a boolean
+-- error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL innodb_stats_persistent=123;
+
+-- error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL innodb_stats_persistent='foo';
+
+# Check that changing value works and that setting the same value again
+# is as expected
+SET GLOBAL innodb_cmp_per_index_enabled=ON;
+SELECT @@global.innodb_cmp_per_index_enabled;
+
+SET GLOBAL innodb_cmp_per_index_enabled=ON;
+SELECT @@global.innodb_cmp_per_index_enabled;
+
+SET GLOBAL innodb_cmp_per_index_enabled=OFF;
+SELECT @@global.innodb_cmp_per_index_enabled;
+
+SET GLOBAL innodb_cmp_per_index_enabled=OFF;
+SELECT @@global.innodb_cmp_per_index_enabled;
+
+-- vertical_results
+
+# Check that enabling after being disabled resets the stats
+
+SET GLOBAL innodb_cmp_per_index_enabled=ON;
+
+CREATE TABLE t (a INT) ENGINE=INNODB KEY_BLOCK_SIZE=8;
+
+INSERT INTO t VALUES (1);
+
+SELECT * FROM information_schema.innodb_cmp_per_index;
+
+SET GLOBAL innodb_cmp_per_index_enabled=OFF;
+SET GLOBAL innodb_cmp_per_index_enabled=ON;
+
+SELECT * FROM information_schema.innodb_cmp_per_index;
+
+DROP TABLE t;
+
+# Check that enabling after being enabled does not reset the stats
+
+SET GLOBAL innodb_cmp_per_index_enabled=ON;
+
+CREATE TABLE t (a INT) ENGINE=INNODB KEY_BLOCK_SIZE=8;
+
+INSERT INTO t VALUES (1);
+
+SELECT * FROM information_schema.innodb_cmp_per_index;
+
+SET GLOBAL innodb_cmp_per_index_enabled=ON;
+
+SELECT * FROM information_schema.innodb_cmp_per_index;
+
+DROP TABLE t;
+
+#
+
+SET GLOBAL innodb_cmp_per_index_enabled=default;
+SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
diff --git a/mysql-test/suite/sys_vars/t/innodb_compression_algorithm_basic-master.opt b/mysql-test/suite/sys_vars/t/innodb_compression_algorithm_basic-master.opt
new file mode 100644
index 00000000..77db4172
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_compression_algorithm_basic-master.opt
@@ -0,0 +1 @@
+--innodb-compression-algorithm=1 \ No newline at end of file
diff --git a/mysql-test/suite/sys_vars/t/innodb_compression_algorithm_basic.test b/mysql-test/suite/sys_vars/t/innodb_compression_algorithm_basic.test
new file mode 100644
index 00000000..6f09ced7
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_compression_algorithm_basic.test
@@ -0,0 +1,46 @@
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_compression_algorithm;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+select @@global.innodb_compression_algorithm;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_compression_algorithm;
+show global variables like 'innodb_compression_algorithm';
+show session variables like 'innodb_compression_algorithm';
+select * from information_schema.global_variables where variable_name='innodb_compression_algorithm';
+select * from information_schema.session_variables where variable_name='innodb_compression_algorithm';
+
+#
+# show that it's writable
+#
+set global innodb_compression_algorithm=1;
+select @@global.innodb_compression_algorithm;
+select * from information_schema.global_variables where variable_name='innodb_compression_algorithm';
+select * from information_schema.session_variables where variable_name='innodb_compression_algorithm';
+--error ER_GLOBAL_VARIABLE
+set session innodb_compression_algorithm=0;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_compression_algorithm=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_compression_algorithm=1e1;
+--error 1231
+set global innodb_compression_algorithm="foo";
+#
+# min/max values
+#
+set global innodb_compression_algorithm=0;
+select @@global.innodb_compression_algorithm;
+#
+# cleanup
+#
+
+SET @@global.innodb_compression_algorithm = @start_global_value;
+SELECT @@global.innodb_compression_algorithm;
diff --git a/mysql-test/suite/sys_vars/t/innodb_compression_failure_threshold_pct_basic.test b/mysql-test/suite/sys_vars/t/innodb_compression_failure_threshold_pct_basic.test
new file mode 100644
index 00000000..315fe2df
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_compression_failure_threshold_pct_basic.test
@@ -0,0 +1,155 @@
+##### mysql-test\t\innodb_compression_failure_threshold_pct_basic.test ########
+# #
+# Variable Name: innodb_compression_failure_threshold_pct #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 5 #
+# Range: 0-100 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+#Description: Test Cases of Dynamic System Variable #
+# innodb_compression_failure_threshold_pct #
+# that checks the behavior of #
+# this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+--source include/have_innodb.inc
+--source include/load_sysvars.inc
+
+######################################################################
+# START OF innodb_compression_failure_threshold_pct TESTS #
+######################################################################
+
+
+############################################################################################
+# Saving initial value of innodb_compression_failure_threshold_pct in a temporary variable #
+############################################################################################
+
+SET @global_start_value = @@global.innodb_compression_failure_threshold_pct;
+SELECT @global_start_value;
+
+--echo '#--------------------FN_DYNVARS_046_01------------------------#'
+########################################################################
+# Display the DEFAULT value of innodb_compression_failure_threshold_pct#
+########################################################################
+
+SET @@global.innodb_compression_failure_threshold_pct = 0;
+SET @@global.innodb_compression_failure_threshold_pct = DEFAULT;
+SELECT @@global.innodb_compression_failure_threshold_pct;
+
+--echo '#---------------------FN_DYNVARS_046_02-------------------------#'
+##############################################################################################
+# check if innodb_compression_failure_threshold_pct can be accessed with and without @@ sign #
+##############################################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET innodb_compression_failure_threshold_pct = 1;
+SELECT @@innodb_compression_failure_threshold_pct;
+
+--Error ER_UNKNOWN_TABLE
+SELECT local.innodb_compression_failure_threshold_pct;
+
+SET global innodb_compression_failure_threshold_pct = 0;
+SELECT @@global.innodb_compression_failure_threshold_pct;
+
+--echo '#--------------------FN_DYNVARS_046_03------------------------#'
+#################################################################################
+# change the value of innodb_compression_failure_threshold_pct to a valid value #
+#################################################################################
+
+SET @@global.innodb_compression_failure_threshold_pct = 0;
+SELECT @@global.innodb_compression_failure_threshold_pct;
+
+SET @@global.innodb_compression_failure_threshold_pct = 1;
+SELECT @@global.innodb_compression_failure_threshold_pct;
+SET @@global.innodb_compression_failure_threshold_pct = 100;
+SELECT @@global.innodb_compression_failure_threshold_pct;
+
+--echo '#--------------------FN_DYNVARS_046_04-------------------------#'
+################################################################################
+# Cange the value of innodb_compression_failure_threshold_pct to invalid value #
+################################################################################
+
+SET @@global.innodb_compression_failure_threshold_pct = -1;
+SELECT @@global.innodb_compression_failure_threshold_pct;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_compression_failure_threshold_pct = "T";
+SELECT @@global.innodb_compression_failure_threshold_pct;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_compression_failure_threshold_pct = 1.1;
+SELECT @@global.innodb_compression_failure_threshold_pct;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_compression_failure_threshold_pct = "Y";
+SELECT @@global.innodb_compression_failure_threshold_pct;
+
+SET @@global.innodb_compression_failure_threshold_pct = 101;
+SELECT @@global.innodb_compression_failure_threshold_pct;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_compression_failure_threshold_pct = " ";
+SELECT @@global.innodb_compression_failure_threshold_pct;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_compression_failure_threshold_pct = ' ';
+SELECT @@global.innodb_compression_failure_threshold_pct;
+
+--echo '#----------------------FN_DYNVARS_046_05------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#########################################################################
+
+--disable_warnings
+SELECT @@global.innodb_compression_failure_threshold_pct =
+ VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='innodb_compression_failure_threshold_pct';
+--enable_warnings
+SELECT @@global.innodb_compression_failure_threshold_pct;
+--disable_warnings
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='innodb_compression_failure_threshold_pct';
+--enable_warnings
+
+--echo '#---------------------FN_DYNVARS_046_06-------------------------#'
+###################################################################
+# Check if ON and OFF values can be used on variable #
+###################################################################
+
+--ERROR ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_compression_failure_threshold_pct = OFF;
+SELECT @@global.innodb_compression_failure_threshold_pct;
+
+--ERROR ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_compression_failure_threshold_pct = ON;
+SELECT @@global.innodb_compression_failure_threshold_pct;
+
+--echo '#---------------------FN_DYNVARS_046_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.innodb_compression_failure_threshold_pct = TRUE;
+SELECT @@global.innodb_compression_failure_threshold_pct;
+SET @@global.innodb_compression_failure_threshold_pct = FALSE;
+SELECT @@global.innodb_compression_failure_threshold_pct;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.innodb_compression_failure_threshold_pct = @global_start_value;
+SELECT @@global.innodb_compression_failure_threshold_pct;
+
+###############################################################
+# END OF innodb_compression_failure_threshold_pct TESTS #
+###############################################################
diff --git a/mysql-test/suite/sys_vars/t/innodb_compression_level_basic.test b/mysql-test/suite/sys_vars/t/innodb_compression_level_basic.test
new file mode 100644
index 00000000..d19d2971
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_compression_level_basic.test
@@ -0,0 +1,72 @@
+
+
+# 2012-05-29 - Added
+#
+
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_compression_level;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+--echo Valid value 0-9
+select @@global.innodb_compression_level <= 9;
+select @@global.innodb_compression_level;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_compression_level;
+show global variables like 'innodb_compression_level';
+show session variables like 'innodb_compression_level';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_compression_level';
+select * from information_schema.session_variables where variable_name='innodb_compression_level';
+--enable_warnings
+
+#
+# show that it's writable
+#
+set global innodb_compression_level=2;
+select @@global.innodb_compression_level;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_compression_level';
+select * from information_schema.session_variables where variable_name='innodb_compression_level';
+--enable_warnings
+--error ER_GLOBAL_VARIABLE
+set session innodb_compression_level=4;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_compression_level=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_compression_level=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_compression_level="foo";
+
+set global innodb_compression_level=10;
+select @@global.innodb_compression_level;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_compression_level';
+--enable_warnings
+set global innodb_compression_level=-7;
+select @@global.innodb_compression_level;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_compression_level';
+--enable_warnings
+
+#
+# min/max values
+#
+set global innodb_compression_level=0;
+select @@global.innodb_compression_level;
+set global innodb_compression_level=9;
+select @@global.innodb_compression_level;
+
+#
+# cleanup
+#
+
+SET @@global.innodb_compression_level = @start_global_value;
+SELECT @@global.innodb_compression_level;
diff --git a/mysql-test/suite/sys_vars/t/innodb_compression_pad_pct_max_basic.test b/mysql-test/suite/sys_vars/t/innodb_compression_pad_pct_max_basic.test
new file mode 100644
index 00000000..1491f705
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_compression_pad_pct_max_basic.test
@@ -0,0 +1,148 @@
+############# mysql-test\t\innodb_compression_pad_pct_max_basic.test ##########
+# #
+# Variable Name: innodb_compression_pad_pct_max #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 50 #
+# Range: 0-75 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+#Description: Test Cases of Dynamic System Variable #
+# innodb_compression_pad_pct_max #
+# that checks the behavior of #
+# this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+--source include/have_innodb.inc
+--source include/load_sysvars.inc
+
+######################################################################
+# START OF innodb_compression_pad_pct_max TESTS #
+######################################################################
+
+
+############################################################################################
+# Saving initial value of innodb_compression_pad_pct_max in a temporary variable #
+############################################################################################
+
+SET @global_start_value = @@global.innodb_compression_pad_pct_max;
+SELECT @global_start_value;
+
+--echo '#--------------------FN_DYNVARS_046_01------------------------#'
+########################################################################
+# Display the DEFAULT value of innodb_compression_pad_pct_max #
+########################################################################
+
+SET @@global.innodb_compression_pad_pct_max = DEFAULT;
+SELECT @@global.innodb_compression_pad_pct_max;
+
+--echo '#---------------------FN_DYNVARS_046_02-------------------------#'
+##############################################################################################
+# check if innodb_compression_pad_pct_max can be accessed with and without @@ sign #
+##############################################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET innodb_compression_pad_pct_max = 1;
+SELECT @@innodb_compression_pad_pct_max;
+
+--Error ER_UNKNOWN_TABLE
+SELECT local.innodb_compression_pad_pct_max;
+
+SET global innodb_compression_pad_pct_max = 0;
+SELECT @@global.innodb_compression_pad_pct_max;
+
+--echo '#--------------------FN_DYNVARS_046_03------------------------#'
+#################################################################################
+# change the value of innodb_compression_pad_pct_max to a valid value #
+#################################################################################
+
+SET @@global.innodb_compression_pad_pct_max = 0;
+SELECT @@global.innodb_compression_pad_pct_max;
+
+SET @@global.innodb_compression_pad_pct_max = 75;
+SELECT @@global.innodb_compression_pad_pct_max;
+
+--echo '#--------------------FN_DYNVARS_046_04-------------------------#'
+################################################################################
+# Cange the value of innodb_compression_pad_pct_max to invalid value #
+################################################################################
+
+SET @@global.innodb_compression_pad_pct_max = -1;
+SELECT @@global.innodb_compression_pad_pct_max;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_compression_pad_pct_max = "T";
+SELECT @@global.innodb_compression_pad_pct_max;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_compression_pad_pct_max = 1.1;
+SELECT @@global.innodb_compression_pad_pct_max;
+
+SET @@global.innodb_compression_pad_pct_max = 76;
+SELECT @@global.innodb_compression_pad_pct_max;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_compression_pad_pct_max = " ";
+SELECT @@global.innodb_compression_pad_pct_max;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_compression_pad_pct_max = ' ';
+SELECT @@global.innodb_compression_pad_pct_max;
+
+--echo '#----------------------FN_DYNVARS_046_05------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#########################################################################
+
+--disable_warnings
+SELECT @@global.innodb_compression_pad_pct_max =
+ VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='innodb_compression_pad_pct_max';
+--enable_warnings
+SELECT @@global.innodb_compression_pad_pct_max;
+--disable_warnings
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='innodb_compression_pad_pct_max';
+--enable_warnings
+
+--echo '#---------------------FN_DYNVARS_046_06-------------------------#'
+###################################################################
+# Check if ON and OFF values can be used on variable #
+###################################################################
+
+--ERROR ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_compression_pad_pct_max = OFF;
+SELECT @@global.innodb_compression_pad_pct_max;
+
+--ERROR ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_compression_pad_pct_max = ON;
+SELECT @@global.innodb_compression_pad_pct_max;
+
+--echo '#---------------------FN_DYNVARS_046_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.innodb_compression_pad_pct_max = TRUE;
+SELECT @@global.innodb_compression_pad_pct_max;
+SET @@global.innodb_compression_pad_pct_max = FALSE;
+SELECT @@global.innodb_compression_pad_pct_max;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.innodb_compression_pad_pct_max = @global_start_value;
+SELECT @@global.innodb_compression_pad_pct_max;
+
+###############################################################
+# END OF innodb_compression_pad_pct_max TESTS #
+###############################################################
diff --git a/mysql-test/suite/sys_vars/t/innodb_data_file_path_basic.test b/mysql-test/suite/sys_vars/t/innodb_data_file_path_basic.test
new file mode 100644
index 00000000..c9367442
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_data_file_path_basic.test
@@ -0,0 +1,106 @@
+
+
+################## mysql-test\t\innodb_data_file_path_basic.test ##############
+# #
+# Variable Name: innodb_data_file_path #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: filename #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable innodb_data_file_path #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+
+--echo '#---------------------BS_STVARS_024_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.innodb_data_file_path);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_024_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.innodb_data_file_path=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.innodb_data_file_path);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_024_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+--disable_warnings
+SELECT @@GLOBAL.innodb_data_file_path = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_data_file_path';
+--enable_warnings
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.innodb_data_file_path);
+--echo 1 Expected
+
+--disable_warnings
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_data_file_path';
+--enable_warnings
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_024_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@innodb_data_file_path = @@GLOBAL.innodb_data_file_path;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_024_05----------------------#'
+################################################################################
+# Check if innodb_data_file_path can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@innodb_data_file_path);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.innodb_data_file_path);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.innodb_data_file_path);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.innodb_data_file_path);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT innodb_data_file_path = @@SESSION.innodb_data_file_path;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_data_home_dir_basic.test b/mysql-test/suite/sys_vars/t/innodb_data_home_dir_basic.test
new file mode 100644
index 00000000..b6b79999
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_data_home_dir_basic.test
@@ -0,0 +1,106 @@
+
+
+################## mysql-test\t\innodb_data_home_dir_basic.test ###############
+# #
+# Variable Name: innodb_data_home_dir #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: filename #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable innodb_data_home_dir #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+
+--echo '#---------------------BS_STVARS_025_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.innodb_data_home_dir);
+--echo 0 Expected
+
+
+--echo '#---------------------BS_STVARS_025_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.innodb_data_home_dir=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.innodb_data_home_dir);
+--echo 0 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_025_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+--disable_warnings
+SELECT @@GLOBAL.innodb_data_home_dir = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_data_home_dir';
+--enable_warnings
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.innodb_data_home_dir);
+--echo 0 Expected
+
+--disable_warnings
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_data_home_dir';
+--enable_warnings
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_025_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@innodb_data_home_dir = @@GLOBAL.innodb_data_home_dir;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_025_05----------------------#'
+################################################################################
+# Check if innodb_data_home_dir can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@innodb_data_home_dir);
+--echo 0 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.innodb_data_home_dir);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.innodb_data_home_dir);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.innodb_data_home_dir);
+--echo 0 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT innodb_data_home_dir = @@SESSION.innodb_data_home_dir;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_deadlock_detect_basic.test b/mysql-test/suite/sys_vars/t/innodb_deadlock_detect_basic.test
new file mode 100644
index 00000000..8cac1390
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_deadlock_detect_basic.test
@@ -0,0 +1,53 @@
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_deadlock_detect;
+SELECT @start_global_value;
+
+#
+# exists as global
+#
+--echo Valid values are 'ON' and 'OFF'
+select @@global.innodb_deadlock_detect in (0, 1);
+select @@global.innodb_deadlock_detect;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_deadlock_detect in (0, 1);
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_deadlock_detect;
+show global variables like 'innodb_deadlock_detect';
+show session variables like 'innodb_deadlock_detect';
+
+#
+# show that it's writable
+#
+set global innodb_deadlock_detect='OFF';
+--error ER_GLOBAL_VARIABLE
+set session innodb_deadlock_detect='OFF';
+select @@global.innodb_deadlock_detect;
+set @@global.innodb_deadlock_detect=1;
+select @@global.innodb_deadlock_detect;
+set global innodb_deadlock_detect=0;
+select @@global.innodb_deadlock_detect;
+set @@global.innodb_deadlock_detect='ON';
+select @@global.innodb_deadlock_detect;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_deadlock_detect=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_deadlock_detect=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_deadlock_detect=2;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_deadlock_detect='AUTO';
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_deadlock_detect=-3;
+select @@global.innodb_deadlock_detect;
+
+#
+# Cleanup
+#
+
+SET @@global.innodb_deadlock_detect = @start_global_value;
+SELECT @@global.innodb_deadlock_detect;
diff --git a/mysql-test/suite/sys_vars/t/innodb_default_row_format_basic.test b/mysql-test/suite/sys_vars/t/innodb_default_row_format_basic.test
new file mode 100644
index 00000000..f9aabf49
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_default_row_format_basic.test
@@ -0,0 +1,41 @@
+--source include/have_innodb.inc
+
+# Check the default value
+SELECT @@global.innodb_default_row_format;
+
+SET GLOBAL innodb_default_row_format = 'redundant';
+SELECT @@global.innodb_default_row_format;
+
+SET GLOBAL innodb_default_row_format = 'dynamic';
+SELECT @@global.innodb_default_row_format;
+
+SET GLOBAL innodb_default_row_format = 'compact';
+SELECT @@global.innodb_default_row_format;
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL innodb_default_row_format = 'compressed';
+SELECT @@global.innodb_default_row_format;
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL innodb_default_row_format = 'foobar';
+SELECT @@global.innodb_default_row_format;
+
+SET GLOBAL innodb_default_row_format = 0;
+SELECT @@global.innodb_default_row_format;
+
+SET GLOBAL innodb_default_row_format = 1;
+SELECT @@global.innodb_default_row_format;
+
+SET GLOBAL innodb_default_row_format = 2;
+SELECT @@global.innodb_default_row_format;
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL innodb_default_row_format = 3;
+SELECT @@global.innodb_default_row_format;
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL innodb_default_row_format = 123;
+SELECT @@global.innodb_default_row_format;
+
+
+SET GLOBAL innodb_default_row_format = default;
diff --git a/mysql-test/suite/sys_vars/t/innodb_defragment_basic.test b/mysql-test/suite/sys_vars/t/innodb_defragment_basic.test
new file mode 100644
index 00000000..9667f63f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_defragment_basic.test
@@ -0,0 +1,20 @@
+-- source include/have_innodb.inc
+
+# Check the default value
+SET @orig = @@global.innodb_defragment;
+SELECT @orig;
+
+# Turn off
+SET GLOBAL innodb_defragment = OFF;
+SELECT @@global.innodb_defragment;
+
+# Turn on
+SET GLOBAL innodb_defragment = ON;
+SELECT @@global.innodb_defragment;
+
+# Wrong value
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL innodb_defragment = 100;
+SELECT @@global.innodb_defragment;
+
+SET GLOBAL innodb_defragment = @orig;
diff --git a/mysql-test/suite/sys_vars/t/innodb_defragment_fill_factor_basic.test b/mysql-test/suite/sys_vars/t/innodb_defragment_fill_factor_basic.test
new file mode 100644
index 00000000..ae9863e8
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_defragment_fill_factor_basic.test
@@ -0,0 +1,27 @@
+--source include/have_innodb.inc
+
+SET @start_innodb_defragment_fill_factor = @@global.innodb_defragment_fill_factor;
+SELECT @start_innodb_defragment_fill_factor;
+
+SELECT COUNT(@@global.innodb_defragment_fill_factor);
+
+SET @@global.innodb_defragment_fill_factor = 0.77777777777777;
+SELECT @@global.innodb_defragment_fill_factor;
+
+SET @@global.innodb_defragment_fill_factor = 1;
+SELECT @@global.innodb_defragment_fill_factor;
+
+SET @@global.innodb_defragment_fill_factor = 0.7;
+SELECT @@global.innodb_defragment_fill_factor;
+
+SET @@global.innodb_defragment_fill_factor = -1;
+SELECT @@global.innodb_defragment_fill_factor;
+
+SET @@global.innodb_defragment_fill_factor = 2;
+SELECT @@global.innodb_defragment_fill_factor;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_defragment_fill_factor = "abc";
+SELECT @@global.innodb_defragment_fill_factor;
+
+SET @@global.innodb_defragment_fill_factor = @start_innodb_defragment_fill_factor;
diff --git a/mysql-test/suite/sys_vars/t/innodb_defragment_fill_factor_n_recs_basic.test b/mysql-test/suite/sys_vars/t/innodb_defragment_fill_factor_n_recs_basic.test
new file mode 100644
index 00000000..366817c4
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_defragment_fill_factor_n_recs_basic.test
@@ -0,0 +1,31 @@
+--source include/have_innodb.inc
+
+SET @start_innodb_defragment_fill_factor_n_recs = @@global.innodb_defragment_fill_factor_n_recs;
+SELECT @start_innodb_defragment_fill_factor_n_recs;
+
+SELECT COUNT(@@global.innodb_defragment_fill_factor_n_recs);
+
+SET @@global.innodb_defragment_fill_factor_n_recs = 50;
+SELECT @@global.innodb_defragment_fill_factor_n_recs;
+
+SET @@global.innodb_defragment_fill_factor_n_recs = 100;
+SELECT @@global.innodb_defragment_fill_factor_n_recs;
+
+SET @@global.innodb_defragment_fill_factor_n_recs = 1;
+SELECT @@global.innodb_defragment_fill_factor_n_recs;
+
+SET @@global.innodb_defragment_fill_factor_n_recs = -1;
+SELECT @@global.innodb_defragment_fill_factor_n_recs;
+
+SET @@global.innodb_defragment_fill_factor_n_recs = 10000;
+SELECT @@global.innodb_defragment_fill_factor_n_recs;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_defragment_fill_factor_n_recs = 10.5;
+SELECT @@global.innodb_defragment_fill_factor_n_recs;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_defragment_fill_factor_n_recs = "abc";
+SELECT @@global.innodb_defragment_fill_factor_n_recs;
+
+SET @@global.innodb_defragment_fill_factor_n_recs = @start_innodb_defragment_fill_factor_n_recs;
diff --git a/mysql-test/suite/sys_vars/t/innodb_defragment_frequency_basic.test b/mysql-test/suite/sys_vars/t/innodb_defragment_frequency_basic.test
new file mode 100644
index 00000000..3ab45744
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_defragment_frequency_basic.test
@@ -0,0 +1,37 @@
+--source include/have_innodb.inc
+
+SET @start_innodb_defragment_frequency = @@global.innodb_defragment_frequency;
+SELECT @start_innodb_defragment_frequency;
+
+SELECT COUNT(@@global.innodb_defragment_frequency);
+
+# test valid value
+SET @@global.innodb_defragment_frequency = 200;
+SELECT @@global.innodb_defragment_frequency;
+
+# test valid min
+SET @@global.innodb_defragment_frequency = 1;
+SELECT @@global.innodb_defragment_frequency;
+
+# test valid max
+SET @@global.innodb_defragment_frequency = 1000;
+SELECT @@global.innodb_defragment_frequency;
+
+# test invalid value < min
+SET @@global.innodb_defragment_frequency = -1;
+SELECT @@global.innodb_defragment_frequency;
+
+# test invalid value > max
+SET @@global.innodb_defragment_frequency = 10000;
+SELECT @@global.innodb_defragment_frequency;
+
+# test wrong type
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_defragment_frequency = 10.5;
+SELECT @@global.innodb_defragment_frequency;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_defragment_frequency = "abc";
+SELECT @@global.innodb_defragment_frequency;
+
+SET @@global.innodb_defragment_frequency = @start_innodb_defragment_frequency;
diff --git a/mysql-test/suite/sys_vars/t/innodb_defragment_n_pages_basic.test b/mysql-test/suite/sys_vars/t/innodb_defragment_n_pages_basic.test
new file mode 100644
index 00000000..64aa20a6
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_defragment_n_pages_basic.test
@@ -0,0 +1,22 @@
+--source include/have_innodb.inc
+
+SET @start_innodb_defragment_n_pages = @@global.innodb_defragment_n_pages;
+SELECT @start_innodb_defragment_n_pages;
+
+SELECT COUNT(@@global.innodb_defragment_n_pages);
+
+SET @@global.innodb_defragment_n_pages = 1;
+SELECT @@global.innodb_defragment_n_pages;
+
+SET @@global.innodb_defragment_n_pages = 2;
+SELECT @@global.innodb_defragment_n_pages;
+
+SET @@global.innodb_defragment_n_pages = 32;
+SELECT @@global.innodb_defragment_n_pages;
+
+SET @@global.innodb_defragment_n_pages = 64;
+SELECT @@global.innodb_defragment_n_pages;
+
+SET @@global.innodb_defragment_n_pages = @start_innodb_defragment_n_pages;
+
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_defragment_stats_accuracy_basic.test b/mysql-test/suite/sys_vars/t/innodb_defragment_stats_accuracy_basic.test
new file mode 100644
index 00000000..062753f2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_defragment_stats_accuracy_basic.test
@@ -0,0 +1,24 @@
+--source include/have_innodb.inc
+
+SET @start_innodb_defragment_stats_accuracy = @@global.innodb_defragment_stats_accuracy;
+SELECT @start_innodb_defragment_stats_accuracy;
+
+SELECT COUNT(@@global.innodb_defragment_stats_accuracy);
+
+SET @@global.innodb_defragment_stats_accuracy = 1;
+SELECT @@global.innodb_defragment_stats_accuracy;
+
+SET @@global.innodb_defragment_stats_accuracy = 1000;
+SELECT @@global.innodb_defragment_stats_accuracy;
+
+SET @@global.innodb_defragment_stats_accuracy = -1;
+SELECT @@global.innodb_defragment_stats_accuracy;
+
+SET @@global.innodb_defragment_stats_accuracy = 1000000000000;
+SELECT @@global.innodb_defragment_stats_accuracy;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_defragment_stats_accuracy = "abc";
+SELECT @@global.innodb_defragment_stats_accuracy;
+
+SET @@global.innodb_defragment_stats_accuracy = @start_innodb_defragment_stats_accuracy;
diff --git a/mysql-test/suite/sys_vars/t/innodb_disable_sort_file_cache_basic.test b/mysql-test/suite/sys_vars/t/innodb_disable_sort_file_cache_basic.test
new file mode 100644
index 00000000..62b499f0
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_disable_sort_file_cache_basic.test
@@ -0,0 +1,70 @@
+
+
+# 2011-11-15 - Added
+#
+
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_disable_sort_file_cache;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+--echo Valid values are 'ON' and 'OFF'
+select @@global.innodb_disable_sort_file_cache in (0, 1);
+select @@global.innodb_disable_sort_file_cache;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_disable_sort_file_cache;
+show global variables like 'innodb_disable_sort_file_cache';
+show session variables like 'innodb_disable_sort_file_cache';
+select * from information_schema.global_variables where variable_name='innodb_disable_sort_file_cache';
+select * from information_schema.session_variables where variable_name='innodb_disable_sort_file_cache';
+
+#
+# show that it's writable
+#
+set global innodb_disable_sort_file_cache='OFF';
+select @@global.innodb_disable_sort_file_cache;
+select * from information_schema.global_variables where variable_name='innodb_disable_sort_file_cache';
+select * from information_schema.session_variables where variable_name='innodb_disable_sort_file_cache';
+set @@global.innodb_disable_sort_file_cache=1;
+select @@global.innodb_disable_sort_file_cache;
+select * from information_schema.global_variables where variable_name='innodb_disable_sort_file_cache';
+select * from information_schema.session_variables where variable_name='innodb_disable_sort_file_cache';
+set global innodb_disable_sort_file_cache=0;
+select @@global.innodb_disable_sort_file_cache;
+select * from information_schema.global_variables where variable_name='innodb_disable_sort_file_cache';
+select * from information_schema.session_variables where variable_name='innodb_disable_sort_file_cache';
+set @@global.innodb_disable_sort_file_cache='ON';
+select @@global.innodb_disable_sort_file_cache;
+select * from information_schema.global_variables where variable_name='innodb_disable_sort_file_cache';
+select * from information_schema.session_variables where variable_name='innodb_disable_sort_file_cache';
+--error ER_GLOBAL_VARIABLE
+set session innodb_disable_sort_file_cache='OFF';
+--error ER_GLOBAL_VARIABLE
+set @@session.innodb_disable_sort_file_cache='ON';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_disable_sort_file_cache=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_disable_sort_file_cache=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_disable_sort_file_cache=2;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_disable_sort_file_cache=-3;
+select @@global.innodb_disable_sort_file_cache;
+select * from information_schema.global_variables where variable_name='innodb_disable_sort_file_cache';
+select * from information_schema.session_variables where variable_name='innodb_disable_sort_file_cache';
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_disable_sort_file_cache='AUTO';
+
+#
+# Cleanup
+#
+
+SET @@global.innodb_disable_sort_file_cache = @start_global_value;
+SELECT @@global.innodb_disable_sort_file_cache;
diff --git a/mysql-test/suite/sys_vars/t/innodb_doublewrite_basic.test b/mysql-test/suite/sys_vars/t/innodb_doublewrite_basic.test
new file mode 100644
index 00000000..1ae10d0f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_doublewrite_basic.test
@@ -0,0 +1,106 @@
+
+
+################## mysql-test\t\innodb_doublewrite_basic.test #################
+# #
+# Variable Name: innodb_doublewrite #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: boolean #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable innodb_doublewrite #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+
+--echo '#---------------------BS_STVARS_026_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.innodb_doublewrite);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_026_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.innodb_doublewrite=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.innodb_doublewrite);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_026_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+--disable_warnings
+SELECT IF(@@GLOBAL.innodb_doublewrite, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_doublewrite';
+--enable_warnings
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.innodb_doublewrite);
+--echo 1 Expected
+
+--disable_warnings
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_doublewrite';
+--enable_warnings
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_026_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@innodb_doublewrite = @@GLOBAL.innodb_doublewrite;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_026_05----------------------#'
+################################################################################
+# Check if innodb_doublewrite can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@innodb_doublewrite);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.innodb_doublewrite);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.innodb_doublewrite);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.innodb_doublewrite);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT innodb_doublewrite = @@SESSION.innodb_doublewrite;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_encrypt_log_basic.test b/mysql-test/suite/sys_vars/t/innodb_encrypt_log_basic.test
new file mode 100644
index 00000000..775e8a3b
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_encrypt_log_basic.test
@@ -0,0 +1,50 @@
+--source include/have_innodb.inc
+
+# Display default value
+SELECT @@GLOBAL.innodb_encrypt_log;
+--echo 0 Expected
+
+# Check if value can be set
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.innodb_encrypt_log=1;
+--echo Expected error 'Read only variable'
+
+SELECT @@GLOBAL.innodb_encrypt_log;
+--echo 0 Expected
+
+# Check if the value in GLOBAL TABLE matches value in variable
+SELECT IF(@@GLOBAL.innodb_encrypt_log, 'ON', 'OFF') = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_encrypt_log';
+--echo 1 Expected
+
+SELECT @@GLOBAL.innodb_encrypt_log;
+--echo 0 Expected
+
+SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_encrypt_log';
+--echo 0 Expected
+
+# Check if accessing variable with and without GLOBAL point to same variable
+SELECT @@innodb_encrypt_log = @@GLOBAL.innodb_encrypt_log;
+--echo 1 Expected
+
+# Check if innodb_encrypt_log can be accessed with and without @@ sign
+SELECT @@innodb_encrypt_log;
+--echo 0 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.innodb_encrypt_log);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.innodb_encrypt_log);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT @@GLOBAL.innodb_encrypt_log;
+--echo 0 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT innodb_encrypt_log;
+--echo Expected error 'Unknown column in field list'
diff --git a/mysql-test/suite/sys_vars/t/innodb_encrypt_tables_basic.test b/mysql-test/suite/sys_vars/t/innodb_encrypt_tables_basic.test
new file mode 100644
index 00000000..555b67f2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_encrypt_tables_basic.test
@@ -0,0 +1,44 @@
+# bool global
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_encrypt_tables;
+
+#
+# exists as global only
+#
+select @@global.innodb_encrypt_tables;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_encrypt_tables;
+show global variables like 'innodb_encrypt_tables';
+show session variables like 'innodb_encrypt_tables';
+select * from information_schema.global_variables
+where variable_name='innodb_encrypt_tables';
+select * from information_schema.session_variables
+where variable_name='innodb_encrypt_tables';
+
+#
+# show that it's writable
+#
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_encrypt_tables=ON;
+show warnings;
+select @@global.innodb_encrypt_tables;
+set global innodb_encrypt_tables=OFF;
+select @@global.innodb_encrypt_tables;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_encrypt_tables=1;
+select @@global.innodb_encrypt_tables;
+--error ER_GLOBAL_VARIABLE
+set session innodb_encrypt_tables=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_encrypt_tables=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_encrypt_tables=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_encrypt_tables="foo";
+
+SET @@global.innodb_encrypt_tables = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/innodb_encryption_rotate_key_age_basic.test b/mysql-test/suite/sys_vars/t/innodb_encryption_rotate_key_age_basic.test
new file mode 100644
index 00000000..51112886
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_encryption_rotate_key_age_basic.test
@@ -0,0 +1,41 @@
+# bool global
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_encryption_rotate_key_age;
+
+#
+# exists as global only
+#
+select @@global.innodb_encryption_rotate_key_age;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_encryption_rotate_key_age;
+show global variables like 'innodb_encryption_rotate_key_age';
+show session variables like 'innodb_encryption_rotate_key_age';
+select * from information_schema.global_variables
+where variable_name='innodb_encryption_rotate_key_age';
+select * from information_schema.session_variables
+where variable_name='innodb_encryption_rotate_key_age';
+
+#
+# show that it's writable
+#
+set global innodb_encryption_rotate_key_age=1;
+select @@global.innodb_encryption_rotate_key_age;
+set global innodb_encryption_rotate_key_age=2;
+select @@global.innodb_encryption_rotate_key_age;
+set global innodb_encryption_rotate_key_age=1;
+select @@global.innodb_encryption_rotate_key_age;
+--error ER_GLOBAL_VARIABLE
+set session innodb_encryption_rotate_key_age=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_encryption_rotate_key_age=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_encryption_rotate_key_age=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_encryption_rotate_key_age="foo";
+
+SET @@global.innodb_encryption_rotate_key_age = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/innodb_encryption_rotation_iops_basic.test b/mysql-test/suite/sys_vars/t/innodb_encryption_rotation_iops_basic.test
new file mode 100644
index 00000000..cdbada6c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_encryption_rotation_iops_basic.test
@@ -0,0 +1,41 @@
+# bool global
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_encryption_rotation_iops;
+
+#
+# exists as global only
+#
+select @@global.innodb_encryption_rotation_iops;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_encryption_rotation_iops;
+show global variables like 'innodb_encryption_rotation_iops';
+show session variables like 'innodb_encryption_rotation_iops';
+select * from information_schema.global_variables
+where variable_name='innodb_encryption_rotation_iops';
+select * from information_schema.session_variables
+where variable_name='innodb_encryption_rotation_iops';
+
+#
+# show that it's writable
+#
+set global innodb_encryption_rotation_iops=100;
+select @@global.innodb_encryption_rotation_iops;
+set global innodb_encryption_rotation_iops=50;
+select @@global.innodb_encryption_rotation_iops;
+set global innodb_encryption_rotation_iops=100;
+select @@global.innodb_encryption_rotation_iops;
+--error ER_GLOBAL_VARIABLE
+set session innodb_encryption_rotation_iops=50;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_encryption_rotation_iops=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_encryption_rotation_iops=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_encryption_rotation_iops="foo";
+
+SET @@global.innodb_encryption_rotation_iops = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/innodb_encryption_threads_basic.test b/mysql-test/suite/sys_vars/t/innodb_encryption_threads_basic.test
new file mode 100644
index 00000000..c3e163fa
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_encryption_threads_basic.test
@@ -0,0 +1,41 @@
+# bool global
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_encryption_threads;
+
+#
+# exists as global only
+#
+select @@global.innodb_encryption_threads;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_encryption_threads;
+show global variables like 'innodb_encryption_threads';
+show session variables like 'innodb_encryption_threads';
+select * from information_schema.global_variables
+where variable_name='innodb_encryption_threads';
+select * from information_schema.session_variables
+where variable_name='innodb_encryption_threads';
+
+#
+# show that it's writable
+#
+set global innodb_encryption_threads=0;
+select @@global.innodb_encryption_threads;
+set global innodb_encryption_threads=5;
+select @@global.innodb_encryption_threads;
+set global innodb_encryption_threads=1;
+select @@global.innodb_encryption_threads;
+--error ER_GLOBAL_VARIABLE
+set session innodb_encryption_threads=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_encryption_threads=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_encryption_threads=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_encryption_threads="foo";
+
+SET @@global.innodb_encryption_threads = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/innodb_fast_shutdown_basic.test b/mysql-test/suite/sys_vars/t/innodb_fast_shutdown_basic.test
new file mode 100644
index 00000000..21d47588
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_fast_shutdown_basic.test
@@ -0,0 +1,203 @@
+############## mysql-test\t\innodb_fast_shutdown_basic.test ###################
+# #
+# Variable Name: innodb_fast_shutdown #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 1 #
+# Valid Values: 0,1,2,3 #
+# #
+# #
+# Creation Date: 2008-02-20 #
+# Author: Sharique Abdullah #
+# #
+# Description: #
+# Test Cases of Dynamic System Variable innodb_fast_shutdown that checks #
+# the behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF innodb_fast_shutdown TESTS #
+########################################################################
+
+
+##############################################################################
+# Saving initial value of innodb_fast_shutdown in a temporary variable #
+##############################################################################
+
+SET @global_start_value = @@global.innodb_fast_shutdown;
+SELECT @@global.innodb_fast_shutdown;
+
+
+--echo '#--------------------FN_DYNVARS_042_01------------------------#'
+########################################################################
+# Display the DEFAULT value of innodb_fast_shutdown #
+########################################################################
+
+SET @@global.innodb_fast_shutdown = 0;
+SET @@global.innodb_fast_shutdown = DEFAULT;
+SELECT @@global.innodb_fast_shutdown;
+
+
+--echo '#---------------------FN_DYNVARS_042_02-------------------------#'
+#############################################################################
+# Check if innodb_fast_shutdown can be accessed with and without @@ sign #
+#############################################################################
+
+--ERROR ER_GLOBAL_VARIABLE
+SET innodb_fast_shutdown = 1;
+SELECT @@innodb_fast_shutdown;
+
+--Error ER_UNKNOWN_TABLE
+SELECT global.innodb_fast_shutdown;
+
+SET global innodb_fast_shutdown = 1;
+SELECT @@global.innodb_fast_shutdown;
+
+
+--echo '#--------------------FN_DYNVARS_042_03------------------------#'
+##########################################################################
+# Change the value of innodb_fast_shutdown to a valid value #
+##########################################################################
+
+SET @@global.innodb_fast_shutdown = 0;
+SELECT @@global.innodb_fast_shutdown;
+
+SET @@global.innodb_fast_shutdown = 1;
+SELECT @@global.innodb_fast_shutdown;
+## A value of 2 is used to just flush logs and then shutdown cold.
+
+SET @@global.innodb_fast_shutdown = 2;
+SELECT @@global.innodb_fast_shutdown;
+
+SET @@global.innodb_fast_shutdown = 3;
+SELECT @@global.innodb_fast_shutdown;
+
+--echo '#--------------------FN_DYNVARS_042_04-------------------------#'
+###########################################################################
+# Change the value of innodb_fast_shutdown to invalid value #
+###########################################################################
+
+SET @@global.innodb_fast_shutdown = -1;
+SELECT @@global.innodb_fast_shutdown;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_fast_shutdown = TRU;
+SELECT @@global.innodb_fast_shutdown;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_fast_shutdown = TRUE_F;
+SELECT @@global.innodb_fast_shutdown;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_fast_shutdown = FALS;
+SELECT @@global.innodb_fast_shutdown;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_fast_shutdown = OON;
+SELECT @@global.innodb_fast_shutdown;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_fast_shutdown = ONN;
+SELECT @@global.innodb_fast_shutdown;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_fast_shutdown = OOFF;
+SELECT @@global.innodb_fast_shutdown;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_fast_shutdown = 0FF;
+SELECT @@global.innodb_fast_shutdown;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_fast_shutdown = '1';
+SELECT @@global.innodb_fast_shutdown;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_fast_shutdown = "0";
+SELECT @@global.innodb_fast_shutdown;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_fast_shutdown = 1.1;
+SELECT @@global.innodb_fast_shutdown;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_fast_shutdown = ' ';
+SELECT @@global.innodb_fast_shutdown;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_fast_shutdown = " ";
+SELECT @@global.innodb_fast_shutdown;
+
+--echo '#-------------------FN_DYNVARS_042_05----------------------------#'
+###########################################################################
+# Test if accessing session innodb_fast_shutdown gives error #
+###########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.innodb_fast_shutdown = 0;
+
+--Error ER_GLOBAL_VARIABLE
+SET @@innodb_fast_shutdown = 0;
+--Error ER_GLOBAL_VARIABLE
+SET @@local.innodb_fast_shutdown = 0;
+
+
+--echo '#----------------------FN_DYNVARS_042_06------------------------#'
+#########################################################################
+# Check if the value in SESSION Table contains variable value #
+#########################################################################
+
+--disable_warnings
+SELECT count(VARIABLE_VALUE) AS res_is_0
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='innodb_fast_shutdown';
+--enable_warnings
+
+
+--echo '#----------------------FN_DYNVARS_042_07------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#########################################################################
+
+--disable_warnings
+SELECT @@global.innodb_fast_shutdown =
+VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_fast_shutdown';
+--enable_warnings
+
+
+--echo '#---------------------FN_DYNVARS_042_08-------------------------#'
+###################################################################
+# Check if ON and OFF values can be used on variable #
+###################################################################
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_fast_shutdown = OFF;
+SELECT @@global.innodb_fast_shutdown;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_fast_shutdown = ON;
+SELECT @@global.innodb_fast_shutdown;
+
+
+--echo '#---------------------FN_DYNVARS_042_09----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.innodb_fast_shutdown = TRUE;
+SELECT @@global.innodb_fast_shutdown;
+SET @@global.innodb_fast_shutdown = FALSE;
+SELECT @@global.innodb_fast_shutdown;
+
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.innodb_fast_shutdown = @global_start_value;
+SELECT @@global.innodb_fast_shutdown;
+
+########################################################################
+# END OF innodb_fast_shutdown TESTS #
+########################################################################
diff --git a/mysql-test/suite/sys_vars/t/innodb_fatal_semaphore_wait_threshold-master.opt b/mysql-test/suite/sys_vars/t/innodb_fatal_semaphore_wait_threshold-master.opt
new file mode 100644
index 00000000..51d18e63
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_fatal_semaphore_wait_threshold-master.opt
@@ -0,0 +1 @@
+--innodb-fatal-semaphore-wait-threshold=1
diff --git a/mysql-test/suite/sys_vars/t/innodb_fatal_semaphore_wait_threshold.test b/mysql-test/suite/sys_vars/t/innodb_fatal_semaphore_wait_threshold.test
new file mode 100644
index 00000000..cce150ae
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_fatal_semaphore_wait_threshold.test
@@ -0,0 +1,69 @@
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+
+# Can't test this with embedded server
+--source include/not_embedded.inc
+
+# Don't test this with valgrind
+--source include/not_valgrind.inc
+
+# Only test for innodb
+--source include/have_innodb.inc
+
+connect (con1,localhost,root,,);
+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
+
+SET DEBUG_SYNC='create_table SIGNAL stuck WAIT_FOR ever';
+send CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB;
+
+connect (con2,localhost,root,,);
+SET DEBUG_SYNC='now WAIT_FOR stuck';
+FLUSH TABLES;
+
+# The following query will be blocked on the dict_sys.mutex held by con1
+send SELECT * FROM t1;
+
+connection default;
+
+--disable_result_log
+--disable_query_log
+
+# Since this test generates lot of errors in log, suppress checking errors
+call mtr.add_suppression(".*");
+
+# The crash is expected
+exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
+
+--echo # Waiting for mariadbd to crash
+
+# It may take 20 seconds to detect the long semaphore and mysqld to abort.
+# This test will be treated as pass as long as mysqld crash/restart is detected
+# in 80 seconds.
+let $counter= 80;
+let $mysql_errno= 0;
+while (!$mysql_errno)
+{
+ --error 0,ER_SERVER_SHUTDOWN,ER_CONNECTION_KILLED,2002,2006,2013,5014,2026
+ show status;
+
+ dec $counter;
+ if (!$counter)
+ {
+ # This will fail this test.
+ --die Server failed to disappear
+ }
+ --sleep 1
+}
+
+--echo # Crash was detected
+
+enable_reconnect;
+connection default;
+
+--exec echo "restart:--log-error=$error_log" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+# Call script that will poll the server waiting for it to be back online again
+source include/wait_until_connected_again.inc;
+
+# We only have to do drop t1, as t2 as been automatically deleted by ddl recovery
+DROP TABLE t1;
diff --git a/mysql-test/suite/sys_vars/t/innodb_fatal_semaphore_wait_threshold_basic.test b/mysql-test/suite/sys_vars/t/innodb_fatal_semaphore_wait_threshold_basic.test
new file mode 100644
index 00000000..dcb6fff8
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_fatal_semaphore_wait_threshold_basic.test
@@ -0,0 +1,21 @@
+--source include/have_innodb.inc
+# bool readonly
+
+#
+# show values;
+#
+select @@global.innodb_fatal_semaphore_wait_threshold;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_fatal_semaphore_wait_threshold;
+show global variables like 'innodb_fatal_semaphore_wait_threshold';
+show session variables like 'innodb_fatal_semaphore_wait_threshold';
+select * from information_schema.global_variables where variable_name='innodb_fatal_semaphore_wait_threshold';
+select * from information_schema.session_variables where variable_name='innodb_fatal_semaphore_wait_threshold';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global innodb_fatal_semaphore_wait_threshold=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session innodb_fatal_semaphore_wait_threshold=1;
diff --git a/mysql-test/suite/sys_vars/t/innodb_fil_make_page_dirty_debug_basic.test b/mysql-test/suite/sys_vars/t/innodb_fil_make_page_dirty_debug_basic.test
new file mode 100644
index 00000000..396d30c7
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_fil_make_page_dirty_debug_basic.test
@@ -0,0 +1,36 @@
+--echo #
+--echo # Basic test for innodb_fil_make_page_dirty_debug.
+--echo #
+
+--source include/have_innodb.inc
+
+# The config variable is a debug variable
+-- source include/have_debug.inc
+
+SELECT @@global.innodb_fil_make_page_dirty_debug;
+
+set global innodb_fil_make_page_dirty_debug = 0;
+
+SELECT @@global.innodb_fil_make_page_dirty_debug;
+
+set global innodb_fil_make_page_dirty_debug = 0;
+
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_fil_make_page_dirty_debug = dummy;
+
+--error ER_GLOBAL_VARIABLE
+set innodb_fil_make_page_dirty_debug = ON;
+
+--echo # An example usage.
+create table t1 (f1 int primary key) engine = innodb;
+--enable_prepare_warnings
+select space from information_schema.innodb_sys_tables
+where name = 'test/t1' into @space_id;
+--disable_prepare_warnings
+set global innodb_saved_page_number_debug = 0;
+set global innodb_fil_make_page_dirty_debug = @space_id;
+drop table t1;
+
+--echo # Must always be 0.
+SELECT @@global.innodb_fil_make_page_dirty_debug;
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_file_io_threads_basic.test b/mysql-test/suite/sys_vars/t/innodb_file_io_threads_basic.test
new file mode 100644
index 00000000..802d7e83
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_file_io_threads_basic.test
@@ -0,0 +1,145 @@
+
+
+################## mysql-test\t\innodb_file_io_threads_basic.test #############
+# #
+# Variable Name: innodb_file_io_threads #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: numeric #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable innodb_file_io_threads #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+
+--echo '#---------------------BS_STVARS_027_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.innodb_read_io_threads);
+--echo 1 Expected
+SELECT COUNT(@@GLOBAL.innodb_write_io_threads);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_027_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+
+SELECT COUNT(@@GLOBAL.innodb_read_io_threads);
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.innodb_write_io_threads);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_027_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+--disable_warnings
+SELECT @@GLOBAL.innodb_read_io_threads = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_read_io_threads';
+--enable_warnings
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.innodb_read_io_threads);
+--echo 1 Expected
+
+--disable_warnings
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_read_io_threads';
+--enable_warnings
+--echo 1 Expected
+
+--disable_warnings
+SELECT @@GLOBAL.innodb_write_io_threads = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_write_io_threads';
+--enable_warnings
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.innodb_write_io_threads);
+--echo 1 Expected
+
+--disable_warnings
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_write_io_threads';
+--enable_warnings
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_027_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@innodb_read_io_threads = @@GLOBAL.innodb_read_io_threads;
+--echo 1 Expected
+
+SELECT @@innodb_write_io_threads = @@GLOBAL.innodb_write_io_threads;
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_027_05----------------------#'
+################################################################################
+# Check if innodb_read_io_threads can be accessed with and without @@ sign #
+# Check if innodb_write_io_threads can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@innodb_read_io_threads);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.innodb_read_io_threads);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.innodb_read_io_threads);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.innodb_read_io_threads);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT innodb_read_io_threads = @@SESSION.innodb_read_io_threads;
+--echo Expected error 'Readonly variable'
+
+SELECT COUNT(@@innodb_write_io_threads);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.innodb_write_io_threads);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.innodb_write_io_threads);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.innodb_write_io_threads);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT innodb_write_io_threads = @@SESSION.innodb_write_io_threads;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_file_per_table_basic-master.opt b/mysql-test/suite/sys_vars/t/innodb_file_per_table_basic-master.opt
new file mode 100644
index 00000000..9d2c4f80
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_file_per_table_basic-master.opt
@@ -0,0 +1 @@
+--innodb_file_per_table=On
diff --git a/mysql-test/suite/sys_vars/t/innodb_file_per_table_basic.test b/mysql-test/suite/sys_vars/t/innodb_file_per_table_basic.test
new file mode 100644
index 00000000..2fd9783e
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_file_per_table_basic.test
@@ -0,0 +1,116 @@
+
+
+################## mysql-test\t\innodb_file_per_table_basic.test ##############
+# #
+# Variable Name: innodb_file_per_table #
+# Scope: Global #
+# Access Type: Dynamic #
+# Data Type: boolean #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable innodb_file_per_table #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_file_per_table;
+SELECT @start_global_value;
+
+
+--echo '#---------------------BS_STVARS_028_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.innodb_file_per_table);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_028_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+SET @@global.innodb_file_per_table = 0;
+SELECT @@global.innodb_file_per_table;
+
+SET @@global.innodb_file_per_table ='On' ;
+SELECT @@global.innodb_file_per_table;
+
+SET @@global.innodb_file_per_table ='Off' ;
+SELECT @@global.innodb_file_per_table;
+
+SET @@global.innodb_file_per_table = 1;
+SELECT @@global.innodb_file_per_table;
+
+--echo '#---------------------BS_STVARS_028_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+--disable_warnings
+SELECT IF(@@GLOBAL.innodb_file_per_table,'ON','OFF') = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_file_per_table';
+--enable_warnings
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.innodb_file_per_table);
+--echo 1 Expected
+
+--disable_warnings
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_file_per_table';
+--enable_warnings
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_028_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@innodb_file_per_table = @@GLOBAL.innodb_file_per_table;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_028_05----------------------#'
+################################################################################
+# Check if innodb_file_per_table can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@innodb_file_per_table);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.innodb_file_per_table);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.innodb_file_per_table);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.innodb_file_per_table);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT innodb_file_per_table = @@SESSION.innodb_file_per_table;
+
+#
+# Cleanup
+#
+
+SET @@global.innodb_file_per_table = @start_global_value;
+SELECT @@global.innodb_file_per_table;
diff --git a/mysql-test/suite/sys_vars/t/innodb_fill_factor_basic.test b/mysql-test/suite/sys_vars/t/innodb_fill_factor_basic.test
new file mode 100644
index 00000000..8e4caae0
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_fill_factor_basic.test
@@ -0,0 +1,41 @@
+
+#
+# 2014-03-26 - Added
+#
+
+--source include/have_innodb.inc
+
+#
+# show the global and session values;
+#
+select @@global.innodb_fill_factor;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_fill_factor;
+show global variables like 'innodb_fill_factor';
+show session variables like 'innodb_fill_factor';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_fill_factor';
+select * from information_schema.session_variables where variable_name='innodb_fill_factor';
+--enable_warnings
+
+#
+# test default, min, max value
+#
+let $innodb_fill_factor_orig=`select @@innodb_fill_factor`;
+
+set global innodb_fill_factor=9;
+select @@innodb_fill_factor;
+
+set global innodb_fill_factor=10;
+select @@innodb_fill_factor;
+
+set global innodb_fill_factor=75;
+select @@innodb_fill_factor;
+
+set global innodb_fill_factor=100;
+select @@innodb_fill_factor;
+
+set global innodb_fill_factor=101;
+select @@innodb_fill_factor;
+
+eval set global innodb_fill_factor=$innodb_fill_factor_orig;
diff --git a/mysql-test/suite/sys_vars/t/innodb_flush_log_at_timeout_basic.test b/mysql-test/suite/sys_vars/t/innodb_flush_log_at_timeout_basic.test
new file mode 100644
index 00000000..09a790fc
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_flush_log_at_timeout_basic.test
@@ -0,0 +1,164 @@
+################# mysql-test\t\innodb_flush_log_at_timeout_basic.test #########
+# #
+# Variable Name: innodb_flush_log_at_timeout #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 1 #
+# Range: 0-2700 #
+# #
+# #
+# Creation Date: 2012-05-10 #
+# Author: Nuno Carvalho #
+# #
+#Description: Test Cases of Dynamic System Variable #
+# innodb_flush_log_at_timeout that checks the behavior of #
+# this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF innodb_flush_log_at_timeout TESTS #
+########################################################################
+
+
+#############################################################################
+# Saving initial value of innodb_flush_log_at_timeout #
+#############################################################################
+
+
+SET @global_start_value = @@global.innodb_flush_log_at_timeout;
+SELECT @global_start_value;
+
+
+
+--echo '#--------------------FN_DYNVARS_046_01------------------------#'
+##########################################################################
+# Display the DEFAULT value of innodb_flush_log_at_timeout #
+##########################################################################
+
+SET @@global.innodb_flush_log_at_timeout = 0;
+SET @@global.innodb_flush_log_at_timeout = DEFAULT;
+SELECT @@global.innodb_flush_log_at_timeout;
+
+--echo '#---------------------FN_DYNVARS_046_02-------------------------#'
+###############################################################################
+# Check if variable can be accessed with and without @@ sign #
+###############################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET innodb_flush_log_at_timeout = 1;
+SELECT @@innodb_flush_log_at_timeout;
+
+
+--Error ER_UNKNOWN_TABLE
+SELECT local.innodb_flush_log_at_timeout;
+
+
+SET global innodb_flush_log_at_timeout = 0;
+SELECT @@global.innodb_flush_log_at_timeout;
+
+
+--echo '#--------------------FN_DYNVARS_046_03------------------------#'
+#############################################################################
+# change the value of innodb_flush_log_at_timeout to a valid value #
+#############################################################################
+
+
+SET @@global.innodb_flush_log_at_timeout = 0;
+SELECT @@global.innodb_flush_log_at_timeout;
+
+SET @@global.innodb_flush_log_at_timeout = 10;
+SELECT @@global.innodb_flush_log_at_timeout;
+SET @@global.innodb_flush_log_at_timeout = 2700;
+SELECT @@global.innodb_flush_log_at_timeout;
+
+--echo '#--------------------FN_DYNVARS_046_04-------------------------#'
+###############################################################################
+# Change the value of innodb_flush_log_at_timeout to invalid value #
+###############################################################################
+
+SET @@global.innodb_flush_log_at_timeout = -1;
+SELECT @@global.innodb_flush_log_at_timeout;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_flush_log_at_timeout = "T";
+SELECT @@global.innodb_flush_log_at_timeout;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_flush_log_at_timeout = "Y";
+SELECT @@global.innodb_flush_log_at_timeout;
+
+SET @@global.innodb_flush_log_at_timeout = 2701;
+SELECT @@global.innodb_flush_log_at_timeout;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_flush_log_at_timeout = ' ';
+SELECT @@global.innodb_flush_log_at_timeout;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_flush_log_at_timeout = " ";
+SELECT @@global.innodb_flush_log_at_timeout;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_flush_log_at_timeout = 1.1;
+SELECT @@global.innodb_flush_log_at_timeout;
+
+--echo '#----------------------FN_DYNVARS_046_05------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#########################################################################
+
+--disable_warnings
+SELECT @@global.innodb_flush_log_at_timeout =
+ VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='innodb_flush_log_at_timeout';
+--enable_warnings
+SELECT @@global.innodb_flush_log_at_timeout;
+--disable_warnings
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='innodb_flush_log_at_timeout';
+--enable_warnings
+
+--echo '#---------------------FN_DYNVARS_046_06-------------------------#'
+###################################################################
+# Check if ON and OFF values can be used on variable #
+###################################################################
+
+--ERROR ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_flush_log_at_timeout = OFF;
+SELECT @@global.innodb_flush_log_at_timeout;
+
+--ERROR ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_flush_log_at_timeout = ON;
+SELECT @@global.innodb_flush_log_at_timeout;
+
+--echo '#---------------------FN_DYNVARS_046_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+
+SET @@global.innodb_flush_log_at_timeout = TRUE;
+SELECT @@global.innodb_flush_log_at_timeout;
+SET @@global.innodb_flush_log_at_timeout = FALSE;
+SELECT @@global.innodb_flush_log_at_timeout;
+
+##############################
+# Restore initial value #
+##############################
+
+
+SET @@global.innodb_flush_log_at_timeout = @global_start_value;
+SELECT @@global.innodb_flush_log_at_timeout;
+
+###############################################################
+# END OF innodb_flush_log_at_timeout TESTS #
+###############################################################
diff --git a/mysql-test/suite/sys_vars/t/innodb_flush_log_at_trx_commit_basic.test b/mysql-test/suite/sys_vars/t/innodb_flush_log_at_trx_commit_basic.test
new file mode 100644
index 00000000..34510cdb
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_flush_log_at_trx_commit_basic.test
@@ -0,0 +1,168 @@
+################# mysql-test\t\innodb_flush_log_at_trx_commit_basic.test ######
+# #
+# Variable Name: innodb_flush_log_at_trx_commit #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 1 #
+# Range: 0-2 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+#Description: Test Cases of Dynamic System Variable #
+# innodb_flush_log_at_trx_commit that checks the behavior of #
+# this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF innodb_flush_log_at_trx_commit TESTS #
+########################################################################
+
+
+#############################################################################
+# Saving initial value of innodb_flush_log_at_trx_commit #
+#############################################################################
+
+
+SET @global_start_value = @@global.innodb_flush_log_at_trx_commit;
+SELECT @global_start_value;
+
+
+
+--echo '#--------------------FN_DYNVARS_046_01------------------------#'
+##########################################################################
+# Display the DEFAULT value of innodb_flush_log_at_trx_commit #
+##########################################################################
+
+SET @@global.innodb_flush_log_at_trx_commit = 0;
+SET @@global.innodb_flush_log_at_trx_commit = DEFAULT;
+SELECT @@global.innodb_flush_log_at_trx_commit;
+
+--echo '#---------------------FN_DYNVARS_046_02-------------------------#'
+###############################################################################
+# Check if variable can be accessed with and without @@ sign #
+###############################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET innodb_flush_log_at_trx_commit = 1;
+SELECT @@innodb_flush_log_at_trx_commit;
+
+
+--Error ER_UNKNOWN_TABLE
+SELECT local.innodb_flush_log_at_trx_commit;
+
+
+SET global innodb_flush_log_at_trx_commit = 0;
+SELECT @@global.innodb_flush_log_at_trx_commit;
+
+
+--echo '#--------------------FN_DYNVARS_046_03------------------------#'
+#############################################################################
+# change the value of innodb_flush_log_at_trx_commit to a valid value #
+#############################################################################
+
+
+SET @@global.innodb_flush_log_at_trx_commit = 0;
+SELECT @@global.innodb_flush_log_at_trx_commit;
+
+SET @@global.innodb_flush_log_at_trx_commit = 1;
+SELECT @@global.innodb_flush_log_at_trx_commit;
+SET @@global.innodb_flush_log_at_trx_commit = 2;
+SELECT @@global.innodb_flush_log_at_trx_commit;
+
+--echo '#--------------------FN_DYNVARS_046_04-------------------------#'
+###############################################################################
+# Change the value of innodb_flush_log_at_trx_commit to invalid value #
+###############################################################################
+
+SET @@global.innodb_flush_log_at_trx_commit = -1;
+SELECT @@global.innodb_flush_log_at_trx_commit;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_flush_log_at_trx_commit = "T";
+SELECT @@global.innodb_flush_log_at_trx_commit;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_flush_log_at_trx_commit = "Y";
+SELECT @@global.innodb_flush_log_at_trx_commit;
+
+SET @@global.innodb_flush_log_at_trx_commit = 1001;
+SELECT @@global.innodb_flush_log_at_trx_commit;
+
+SET @@global.innodb_flush_log_at_trx_commit = 100156787;
+SELECT @@global.innodb_flush_log_at_trx_commit;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_flush_log_at_trx_commit = " ";
+SELECT @@global.innodb_flush_log_at_trx_commit;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_flush_log_at_trx_commit = 1.1;
+SELECT @@global.innodb_flush_log_at_trx_commit;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_flush_log_at_trx_commit = ' ';
+SELECT @@global.innodb_flush_log_at_trx_commit;
+
+--echo '#----------------------FN_DYNVARS_046_05------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#########################################################################
+
+--disable_warnings
+SELECT @@global.innodb_flush_log_at_trx_commit =
+ VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='innodb_flush_log_at_trx_commit';
+--enable_warnings
+SELECT @@global.innodb_flush_log_at_trx_commit;
+--disable_warnings
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='innodb_flush_log_at_trx_commit';
+--enable_warnings
+
+--echo '#---------------------FN_DYNVARS_046_06-------------------------#'
+###################################################################
+# Check if ON and OFF values can be used on variable #
+###################################################################
+
+--ERROR ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_flush_log_at_trx_commit = OFF;
+SELECT @@global.innodb_flush_log_at_trx_commit;
+
+--ERROR ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_flush_log_at_trx_commit = ON;
+SELECT @@global.innodb_flush_log_at_trx_commit;
+
+--echo '#---------------------FN_DYNVARS_046_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+
+SET @@global.innodb_flush_log_at_trx_commit = TRUE;
+SELECT @@global.innodb_flush_log_at_trx_commit;
+SET @@global.innodb_flush_log_at_trx_commit = FALSE;
+SELECT @@global.innodb_flush_log_at_trx_commit;
+
+##############################
+# Restore initial value #
+##############################
+
+
+SET @@global.innodb_flush_log_at_trx_commit = @global_start_value;
+SELECT @@global.innodb_flush_log_at_trx_commit;
+
+###############################################################
+# END OF innodb_flush_log_at_trx_commit TESTS #
+###############################################################
diff --git a/mysql-test/suite/sys_vars/t/innodb_flush_method_basic.test b/mysql-test/suite/sys_vars/t/innodb_flush_method_basic.test
new file mode 100644
index 00000000..76a9ed9c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_flush_method_basic.test
@@ -0,0 +1,106 @@
+
+
+################## mysql-test\t\innodb_flush_method_basic.test ################
+# #
+# Variable Name: innodb_flush_method #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: enumeration #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable innodb_flush_method #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+
+--echo '#---------------------BS_STVARS_029_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.innodb_flush_method);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_029_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.innodb_flush_method=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.innodb_flush_method);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_029_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+--disable_warnings
+SELECT @@GLOBAL.innodb_flush_method = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_flush_method';
+--enable_warnings
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.innodb_flush_method);
+--echo 1 Expected
+
+--disable_warnings
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_flush_method';
+--enable_warnings
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_029_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@innodb_flush_method = @@GLOBAL.innodb_flush_method;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_029_05----------------------#'
+################################################################################
+# Check if innodb_flush_method can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@innodb_flush_method);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.innodb_flush_method);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.innodb_flush_method);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.innodb_flush_method);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT innodb_flush_method = @@SESSION.innodb_flush_method;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_flush_method_func.test b/mysql-test/suite/sys_vars/t/innodb_flush_method_func.test
new file mode 100644
index 00000000..7293a99d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_flush_method_func.test
@@ -0,0 +1,28 @@
+--source include/have_innodb.inc
+# Embedded server tests do not support restarting.
+--source include/not_embedded.inc
+# InnoDB: Cannot read first page of './ibdata1' I/O error
+--source include/not_valgrind.inc
+
+call mtr.add_suppression("InnoDB: Failed to set .*DIRECT");
+--replace_result unbuffered fsync
+select @@innodb_flush_method;
+
+create table t(a serial) engine=innodb;
+
+# kill and restart
+FLUSH TABLES;
+let $shutdown_timeout= 0;
+let $restart_parameters=--innodb-flush-method=5;
+--source include/restart_mysqld.inc
+select @@innodb_flush_method;
+
+insert into t values(0);
+# kill and restart
+FLUSH TABLES;
+let $shutdown_timeout= 0;
+let $restart_parameters=--innodb-flush-method=0;
+--source include/restart_mysqld.inc
+select @@innodb_flush_method;
+
+drop table t;
diff --git a/mysql-test/suite/sys_vars/t/innodb_flush_neighbors_basic.test b/mysql-test/suite/sys_vars/t/innodb_flush_neighbors_basic.test
new file mode 100644
index 00000000..671e6f58
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_flush_neighbors_basic.test
@@ -0,0 +1,85 @@
+
+
+# 2011-02-23 - Added
+#
+
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_flush_neighbors;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+select @@global.innodb_flush_neighbors;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_flush_neighbors;
+show global variables like 'innodb_flush_neighbors';
+show session variables like 'innodb_flush_neighbors';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_flush_neighbors';
+select * from information_schema.session_variables where variable_name='innodb_flush_neighbors';
+--enable_warnings
+
+#
+# show that it's writable
+#
+set global innodb_flush_neighbors=0;
+select @@global.innodb_flush_neighbors;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_flush_neighbors';
+select * from information_schema.session_variables where variable_name='innodb_flush_neighbors';
+--enable_warnings
+set @@global.innodb_flush_neighbors=TRUE;
+select @@global.innodb_flush_neighbors;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_flush_neighbors';
+select * from information_schema.session_variables where variable_name='innodb_flush_neighbors';
+--enable_warnings
+set global innodb_flush_neighbors=0;
+select @@global.innodb_flush_neighbors;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_flush_neighbors';
+select * from information_schema.session_variables where variable_name='innodb_flush_neighbors';
+--enable_warnings
+set @@global.innodb_flush_neighbors=2;
+select @@global.innodb_flush_neighbors;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_flush_neighbors';
+select * from information_schema.session_variables where variable_name='innodb_flush_neighbors';
+--enable_warnings
+set @@global.innodb_flush_neighbors=DEFAULT;
+select @@global.innodb_flush_neighbors;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_flush_neighbors';
+select * from information_schema.session_variables where variable_name='innodb_flush_neighbors';
+--enable_warnings
+--error ER_GLOBAL_VARIABLE
+set session innodb_flush_neighbors=0;
+--error ER_GLOBAL_VARIABLE
+set @@session.innodb_flush_neighbors=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_flush_neighbors='OFF';
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_flush_neighbors='ON';
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_flush_neighbors=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_flush_neighbors=1e1;
+set global innodb_flush_neighbors=3;
+select @@global.innodb_flush_neighbors;
+set global innodb_flush_neighbors=-3;
+select @@global.innodb_flush_neighbors;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_flush_neighbors='AUTO';
+
+#
+# Cleanup
+#
+
+SET @@global.innodb_flush_neighbors = @start_global_value;
+SELECT @@global.innodb_flush_neighbors;
diff --git a/mysql-test/suite/sys_vars/t/innodb_flush_sync_basic.test b/mysql-test/suite/sys_vars/t/innodb_flush_sync_basic.test
new file mode 100644
index 00000000..cb91cf87
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_flush_sync_basic.test
@@ -0,0 +1,72 @@
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_flush_sync;
+
+#
+# exists as global only
+#
+--echo Valid values are 'ON' and 'OFF'
+select @@global.innodb_flush_sync in (0, 1);
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_flush_sync;
+SET GLOBAL innodb_flush_sync = ON;
+show global variables like 'innodb_flush_sync';
+show session variables like 'innodb_flush_sync';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_flush_sync';
+select * from information_schema.session_variables where variable_name='innodb_flush_sync';
+--enable_warnings
+
+set global innodb_flush_sync='OFF';
+select @@global.innodb_flush_sync;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_flush_sync';
+select * from information_schema.session_variables where variable_name='innodb_flush_sync';
+--enable_warnings
+set @@global.innodb_flush_sync=1;
+select @@global.innodb_flush_sync;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_flush_sync';
+select * from information_schema.session_variables where variable_name='innodb_flush_sync';
+--enable_warnings
+set global innodb_flush_sync=0;
+select @@global.innodb_flush_sync;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_flush_sync';
+select * from information_schema.session_variables where variable_name='innodb_flush_sync';
+--enable_warnings
+set @@global.innodb_flush_sync='ON';
+select @@global.innodb_flush_sync;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_flush_sync';
+select * from information_schema.session_variables where variable_name='innodb_flush_sync';
+--enable_warnings
+--error ER_GLOBAL_VARIABLE
+set session innodb_flush_sync='OFF';
+--error ER_GLOBAL_VARIABLE
+set @@session.innodb_flush_sync='ON';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_flush_sync=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_flush_sync=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_flush_sync=2;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_flush_sync=-3;
+select @@global.innodb_flush_sync;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_flush_sync';
+select * from information_schema.session_variables where variable_name='innodb_flush_sync';
+--enable_warnings
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_flush_sync='AUTO';
+
+#
+# Cleanup
+#
+
+SET @@global.innodb_flush_sync = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/innodb_flushing_avg_loops_basic.test b/mysql-test/suite/sys_vars/t/innodb_flushing_avg_loops_basic.test
new file mode 100644
index 00000000..f23f9697
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_flushing_avg_loops_basic.test
@@ -0,0 +1,153 @@
+############ mysql-test\t\innodb_flushing_avg_loops_basic.test ################
+# #
+# Variable Name: innodb_flushing_avg_loops #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 10 #
+# Range: 0-70 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+#Description:Test Cases of Dynamic System Variable innodb_flushing_avg_loops #
+# that checks the behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF innodb_flushing_avg_loops TESTS #
+########################################################################
+
+
+###############################################################################
+#Saving initial value of innodb_flushing_avg_loops in a temporary variable #
+###############################################################################
+
+SET @global_start_value = @@global.innodb_flushing_avg_loops;
+SELECT @global_start_value;
+
+--echo '#--------------------FN_DYNVARS_046_01------------------------#'
+########################################################################
+# Display the DEFAULT value of innodb_flushing_avg_loops #
+########################################################################
+
+SET @@global.innodb_flushing_avg_loops = 1;
+SET @@global.innodb_flushing_avg_loops = DEFAULT;
+SELECT @@global.innodb_flushing_avg_loops;
+
+--echo '#---------------------FN_DYNVARS_046_02-------------------------#'
+##################################################################################
+# Check if innodb_flushing_avg_loops can be accessed with and without @@ sign #
+##################################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET innodb_flushing_avg_loops = 1;
+SELECT @@innodb_flushing_avg_loops;
+
+--Error ER_UNKNOWN_TABLE
+SELECT local.innodb_flushing_avg_loops;
+
+SET global innodb_flushing_avg_loops = 1;
+SELECT @@global.innodb_flushing_avg_loops;
+
+--echo '#--------------------FN_DYNVARS_046_03------------------------#'
+###############################################################################
+# change the value of innodb_flushing_avg_loops to a valid value #
+###############################################################################
+
+SET @@global.innodb_flushing_avg_loops = 1;
+SELECT @@global.innodb_flushing_avg_loops;
+
+SET @@global.innodb_flushing_avg_loops = 60;
+SELECT @@global.innodb_flushing_avg_loops;
+
+SET @@global.innodb_flushing_avg_loops = 1000;
+SELECT @@global.innodb_flushing_avg_loops;
+
+--echo '#--------------------FN_DYNVARS_046_04-------------------------#'
+###########################################################################
+# Change the value of innodb_flushing_avg_loops to invalid value #
+###########################################################################
+
+SET @@global.innodb_flushing_avg_loops = -1;
+SELECT @@global.innodb_flushing_avg_loops;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_flushing_avg_loops = "T";
+SELECT @@global.innodb_flushing_avg_loops;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_flushing_avg_loops = "Y";
+SELECT @@global.innodb_flushing_avg_loops;
+
+SET @@global.innodb_flushing_avg_loops = 1001;
+SELECT @@global.innodb_flushing_avg_loops;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_flushing_avg_loops = ' ';
+SELECT @@global.innodb_flushing_avg_loops;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_flushing_avg_loops = " ";
+SELECT @@global.innodb_flushing_avg_loops;
+
+--echo '#----------------------FN_DYNVARS_046_05------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#########################################################################
+
+--disable_warnings
+SELECT @@global.innodb_flushing_avg_loops =
+ VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='innodb_flushing_avg_loops';
+--enable_warnings
+SELECT @@global.innodb_flushing_avg_loops;
+--disable_warnings
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='innodb_flushing_avg_loops';
+--enable_warnings
+
+--echo '#---------------------FN_DYNVARS_046_06-------------------------#'
+###################################################################
+# Check if ON and OFF values can be used on variable #
+###################################################################
+
+--ERROR ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_flushing_avg_loops = OFF;
+SELECT @@global.innodb_flushing_avg_loops;
+
+--ERROR ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_flushing_avg_loops = ON;
+SELECT @@global.innodb_flushing_avg_loops;
+
+--echo '#---------------------FN_DYNVARS_046_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+
+SET @@global.innodb_flushing_avg_loops = TRUE;
+SELECT @@global.innodb_flushing_avg_loops;
+SET @@global.innodb_flushing_avg_loops = FALSE;
+SELECT @@global.innodb_flushing_avg_loops;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.innodb_flushing_avg_loops = @global_start_value;
+SELECT @@global.innodb_flushing_avg_loops;
+
+###############################################################
+# END OF innodb_flushing_avg_loops TESTS #
+###############################################################
diff --git a/mysql-test/suite/sys_vars/t/innodb_force_primary_key_basic.test b/mysql-test/suite/sys_vars/t/innodb_force_primary_key_basic.test
new file mode 100644
index 00000000..f760b354
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_force_primary_key_basic.test
@@ -0,0 +1,57 @@
+--source include/have_innodb.inc
+
+let $force_pk=`select @@innodb_force_primary_key`;
+
+SELECT COUNT(@@GLOBAL.innodb_force_primary_key);
+--echo 1 Expected
+
+####################################################################
+# Check if Value can set #
+####################################################################
+
+SET @@GLOBAL.innodb_force_primary_key=1;
+--echo Expected ok
+
+SELECT COUNT(@@GLOBAL.innodb_force_primary_key);
+--echo 1 Expected
+
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+SELECT IF(@@GLOBAL.innodb_force_primary_key, 'ON', 'OFF') = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_force_primary_key';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.innodb_force_primary_key);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_force_primary_key';
+--echo 1 Expected
+
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@innodb_force_primary_key = @@GLOBAL.innodb_force_primary_key;
+--echo 1 Expected
+
+SELECT COUNT(@@innodb_force_primary_key);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.innodb_force_primary_key);
+--echo Expected Variable 'innodb_force_primary_key' is a GLOBAL variable
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.innodb_force_primary_key);
+--echo Expected Variable 'innodb_force_primary_key' is a GLOBAL variable
+
+SELECT COUNT(@@GLOBAL.innodb_force_primary_key);
+--echo 1 Expected
+
+--disable_query_log
+eval set global innodb_force_primary_key=$force_pk;
+--enable_query_log
diff --git a/mysql-test/suite/sys_vars/t/innodb_force_recovery_basic.test b/mysql-test/suite/sys_vars/t/innodb_force_recovery_basic.test
new file mode 100644
index 00000000..a62c895c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_force_recovery_basic.test
@@ -0,0 +1,106 @@
+
+
+################## mysql-test\t\innodb_force_recovery_basic.test ##############
+# #
+# Variable Name: innodb_force_recovery #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: enumeration #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable innodb_force_recovery #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+
+--echo '#---------------------BS_STVARS_030_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.innodb_force_recovery);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_030_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.innodb_force_recovery=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.innodb_force_recovery);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_030_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+--disable_warnings
+SELECT @@GLOBAL.innodb_force_recovery = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_force_recovery';
+--enable_warnings
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.innodb_force_recovery);
+--echo 1 Expected
+
+--disable_warnings
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_force_recovery';
+--enable_warnings
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_030_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@innodb_force_recovery = @@GLOBAL.innodb_force_recovery;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_030_05----------------------#'
+################################################################################
+# Check if innodb_force_recovery can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@innodb_force_recovery);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.innodb_force_recovery);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.innodb_force_recovery);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.innodb_force_recovery);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT innodb_force_recovery = @@SESSION.innodb_force_recovery;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_ft_aux_table_basic.test b/mysql-test/suite/sys_vars/t/innodb_ft_aux_table_basic.test
new file mode 100644
index 00000000..04ca34c2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_ft_aux_table_basic.test
@@ -0,0 +1,43 @@
+
+
+# 2011-11-15 - Added
+#
+
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_ft_aux_table;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_ft_aux_table;
+show global variables like 'innodb_ft_aux_table';
+show session variables like 'innodb_ft_aux_table';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_ft_aux_table';
+select * from information_schema.session_variables where variable_name='innodb_ft_aux_table';
+--enable_warnings
+
+--error ER_GLOBAL_VARIABLE
+set session innodb_ft_aux_table='Salmon';
+--error ER_GLOBAL_VARIABLE
+set @@session.innodb_ft_aux_table='Salmon';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_ft_aux_table=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_ft_aux_table=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_ft_aux_table='Salmon';
+
+#
+# Cleanup
+#
+
+SET @@global.innodb_ft_aux_table = @start_global_value;
+SELECT @@global.innodb_ft_aux_table;
diff --git a/mysql-test/suite/sys_vars/t/innodb_ft_cache_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_ft_cache_size_basic.test
new file mode 100644
index 00000000..9def2e36
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_ft_cache_size_basic.test
@@ -0,0 +1,29 @@
+
+#
+# 2011-11-17 - Added
+#
+
+--source include/have_innodb.inc
+
+#
+# show the global and session values;
+#
+select @@global.innodb_ft_cache_size;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_ft_cache_size;
+show global variables like 'innodb_ft_cache_size';
+show session variables like 'innodb_ft_cache_size';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_ft_cache_size';
+select * from information_schema.session_variables where variable_name='innodb_ft_cache_size';
+--enable_warnings
+
+set global innodb_ft_cache_size=1;
+SHOW VARIABLES like 'innodb_ft_cache_size';
+
+--error ER_GLOBAL_VARIABLE
+set session innodb_ft_cache_size=1;
+
+set global innodb_ft_cache_size=512*1024*1024;
+SHOW VARIABLES like 'innodb_ft_cache_size';
+set global innodb_ft_cache_size=default;
diff --git a/mysql-test/suite/sys_vars/t/innodb_ft_enable_diag_print_basic.test b/mysql-test/suite/sys_vars/t/innodb_ft_enable_diag_print_basic.test
new file mode 100644
index 00000000..630ada00
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_ft_enable_diag_print_basic.test
@@ -0,0 +1,82 @@
+
+
+# 2011-11-15 - Added
+#
+
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_ft_enable_diag_print;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+--echo Valid values are 'ON' and 'OFF'
+select @@global.innodb_ft_enable_diag_print in (0, 1);
+select @@global.innodb_ft_enable_diag_print;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_ft_enable_diag_print;
+show global variables like 'innodb_ft_enable_diag_print';
+show session variables like 'innodb_ft_enable_diag_print';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_ft_enable_diag_print';
+select * from information_schema.session_variables where variable_name='innodb_ft_enable_diag_print';
+--enable_warnings
+
+#
+# show that it's writable
+#
+set global innodb_ft_enable_diag_print='OFF';
+select @@global.innodb_ft_enable_diag_print;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_ft_enable_diag_print';
+select * from information_schema.session_variables where variable_name='innodb_ft_enable_diag_print';
+--enable_warnings
+set @@global.innodb_ft_enable_diag_print=1;
+select @@global.innodb_ft_enable_diag_print;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_ft_enable_diag_print';
+select * from information_schema.session_variables where variable_name='innodb_ft_enable_diag_print';
+--enable_warnings
+set global innodb_ft_enable_diag_print=0;
+select @@global.innodb_ft_enable_diag_print;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_ft_enable_diag_print';
+select * from information_schema.session_variables where variable_name='innodb_ft_enable_diag_print';
+--enable_warnings
+set @@global.innodb_ft_enable_diag_print='ON';
+select @@global.innodb_ft_enable_diag_print;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_ft_enable_diag_print';
+select * from information_schema.session_variables where variable_name='innodb_ft_enable_diag_print';
+--enable_warnings
+--error ER_GLOBAL_VARIABLE
+set session innodb_ft_enable_diag_print='OFF';
+--error ER_GLOBAL_VARIABLE
+set @@session.innodb_ft_enable_diag_print='ON';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_ft_enable_diag_print=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_ft_enable_diag_print=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_ft_enable_diag_print=2;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_ft_enable_diag_print=-3;
+select @@global.innodb_ft_enable_diag_print;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_ft_enable_diag_print';
+select * from information_schema.session_variables where variable_name='innodb_ft_enable_diag_print';
+--enable_warnings
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_ft_enable_diag_print='AUTO';
+
+#
+# Cleanup
+#
+
+SET @@global.innodb_ft_enable_diag_print = @start_global_value;
+SELECT @@global.innodb_ft_enable_diag_print;
diff --git a/mysql-test/suite/sys_vars/t/innodb_ft_enable_stopword_basic.test b/mysql-test/suite/sys_vars/t/innodb_ft_enable_stopword_basic.test
new file mode 100644
index 00000000..5eb5af4d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_ft_enable_stopword_basic.test
@@ -0,0 +1,97 @@
+
+
+# 2011-11-15 - Added
+#
+
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_ft_enable_stopword;
+SELECT @start_global_value;
+
+#
+# exists as global and session
+#
+--echo Valid values are 'ON' and 'OFF'
+select @@global.innodb_ft_enable_stopword in (0, 1);
+select @@global.innodb_ft_enable_stopword;
+select @@session.innodb_ft_enable_stopword in (0, 1);
+select @@session.innodb_ft_enable_stopword;
+show global variables like 'innodb_ft_enable_stopword';
+show session variables like 'innodb_ft_enable_stopword';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_ft_enable_stopword';
+select * from information_schema.session_variables where variable_name='innodb_ft_enable_stopword';
+--enable_warnings
+
+#
+# show that it's writable
+#
+set global innodb_ft_enable_stopword='OFF';
+set session innodb_ft_enable_stopword='OFF';
+select @@global.innodb_ft_enable_stopword;
+select @@session.innodb_ft_enable_stopword;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_ft_enable_stopword';
+select * from information_schema.session_variables where variable_name='innodb_ft_enable_stopword';
+--enable_warnings
+set @@global.innodb_ft_enable_stopword=1;
+set @@session.innodb_ft_enable_stopword=1;
+select @@global.innodb_ft_enable_stopword;
+select @@session.innodb_ft_enable_stopword;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_ft_enable_stopword';
+select * from information_schema.session_variables where variable_name='innodb_ft_enable_stopword';
+--enable_warnings
+set global innodb_ft_enable_stopword=0;
+set session innodb_ft_enable_stopword=0;
+select @@global.innodb_ft_enable_stopword;
+select @@session.innodb_ft_enable_stopword;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_ft_enable_stopword';
+select * from information_schema.session_variables where variable_name='innodb_ft_enable_stopword';
+--enable_warnings
+set @@global.innodb_ft_enable_stopword='ON';
+set @@session.innodb_ft_enable_stopword='ON';
+select @@global.innodb_ft_enable_stopword;
+select @@session.innodb_ft_enable_stopword;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_ft_enable_stopword';
+select * from information_schema.session_variables where variable_name='innodb_ft_enable_stopword';
+--enable_warnings
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_ft_enable_stopword=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set session innodb_ft_enable_stopword=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_ft_enable_stopword=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set session innodb_ft_enable_stopword=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_ft_enable_stopword=2;
+--error ER_WRONG_VALUE_FOR_VAR
+set session innodb_ft_enable_stopword=2;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_ft_enable_stopword='AUTO';
+--error ER_WRONG_VALUE_FOR_VAR
+set session innodb_ft_enable_stopword='AUTO';
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_ft_enable_stopword=-3;
+--error ER_WRONG_VALUE_FOR_VAR
+set session innodb_ft_enable_stopword=-7;
+select @@global.innodb_ft_enable_stopword;
+select @@session.innodb_ft_enable_stopword;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_ft_enable_stopword';
+select * from information_schema.session_variables where variable_name='innodb_ft_enable_stopword';
+--enable_warnings
+
+#
+# Cleanup
+#
+
+SET @@global.innodb_ft_enable_stopword = @start_global_value;
+SELECT @@global.innodb_ft_enable_stopword;
diff --git a/mysql-test/suite/sys_vars/t/innodb_ft_max_token_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_ft_max_token_size_basic.test
new file mode 100644
index 00000000..8f6f93f7
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_ft_max_token_size_basic.test
@@ -0,0 +1,28 @@
+
+#
+# 2011-11-17 - Added
+#
+
+--source include/have_innodb.inc
+
+#
+# show the global and session values;
+#
+select @@global.innodb_ft_max_token_size;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_ft_max_token_size;
+show global variables like 'innodb_ft_max_token_size';
+show session variables like 'innodb_ft_max_token_size';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_ft_max_token_size';
+select * from information_schema.session_variables where variable_name='innodb_ft_max_token_size';
+--enable_warnings
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global innodb_ft_max_token_size=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session innodb_ft_max_token_size=1;
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_ft_min_token_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_ft_min_token_size_basic.test
new file mode 100644
index 00000000..753985e1
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_ft_min_token_size_basic.test
@@ -0,0 +1,28 @@
+
+#
+# 2011-11-17 - Added
+#
+
+--source include/have_innodb.inc
+
+#
+# show the global and session values;
+#
+select @@global.innodb_ft_min_token_size;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_ft_min_token_size;
+show global variables like 'innodb_ft_min_token_size';
+show session variables like 'innodb_ft_min_token_size';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_ft_min_token_size';
+select * from information_schema.session_variables where variable_name='innodb_ft_min_token_size';
+--enable_warnings
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global innodb_ft_min_token_size=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session innodb_ft_min_token_size=1;
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_ft_num_word_optimize_basic.test b/mysql-test/suite/sys_vars/t/innodb_ft_num_word_optimize_basic.test
new file mode 100644
index 00000000..f288398e
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_ft_num_word_optimize_basic.test
@@ -0,0 +1,58 @@
+
+#
+# 2011-11-17 - Added
+#
+
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_ft_num_word_optimize;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+--echo Valid values are zero or above
+select @@global.innodb_ft_num_word_optimize >=1000;
+select @@global.innodb_ft_num_word_optimize;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_ft_num_word_optimize;
+show global variables like 'innodb_ft_num_word_optimize';
+show session variables like 'innodb_ft_num_word_optimize';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_ft_num_word_optimize';
+select * from information_schema.session_variables where variable_name='innodb_ft_num_word_optimize';
+--enable_warnings
+
+#
+# show that it's writable
+#
+set global innodb_ft_num_word_optimize=1000;
+select @@global.innodb_ft_num_word_optimize;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_ft_num_word_optimize';
+select * from information_schema.session_variables where variable_name='innodb_ft_num_word_optimize';
+--enable_warnings
+--error ER_GLOBAL_VARIABLE
+set session innodb_ft_num_word_optimize=1000;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_ft_num_word_optimize=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_ft_num_word_optimize=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_ft_num_word_optimize="foo";
+
+set global innodb_ft_num_word_optimize=-7;
+select @@global.innodb_ft_num_word_optimize;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_ft_num_word_optimize';
+--enable_warnings
+
+#
+# cleanup
+#
+SET @@global.innodb_ft_num_word_optimize = @start_global_value;
+SELECT @@global.innodb_ft_num_word_optimize;
diff --git a/mysql-test/suite/sys_vars/t/innodb_ft_result_cache_limit.test b/mysql-test/suite/sys_vars/t/innodb_ft_result_cache_limit.test
new file mode 100644
index 00000000..b1ad2cd3
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_ft_result_cache_limit.test
@@ -0,0 +1,9 @@
+--source include/word_size.inc
+--source include/have_innodb.inc
+
+let $innodb_ft_result_cache_limit_orig=`select @@innodb_ft_result_cache_limit`;
+
+set global innodb_ft_result_cache_limit=5000000000;
+select @@innodb_ft_result_cache_limit;
+
+eval set global innodb_ft_result_cache_limit=$innodb_ft_result_cache_limit_orig;
diff --git a/mysql-test/suite/sys_vars/t/innodb_ft_result_cache_limit_basic.test b/mysql-test/suite/sys_vars/t/innodb_ft_result_cache_limit_basic.test
new file mode 100644
index 00000000..31cdfed4
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_ft_result_cache_limit_basic.test
@@ -0,0 +1,39 @@
+
+#
+# 2013-05-09 - Added
+#
+
+--source include/have_innodb.inc
+--source include/word_size.inc
+
+#
+# show the global and session values;
+#
+select @@global.innodb_ft_result_cache_limit;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_ft_result_cache_limit;
+show global variables like 'innodb_ft_result_cache_limit';
+show session variables like 'innodb_ft_result_cache_limit';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_ft_result_cache_limit';
+select * from information_schema.session_variables where variable_name='innodb_ft_result_cache_limit';
+--enable_warnings
+
+#
+# test default, min, max value
+#
+SET @save_limit = @@innodb_ft_result_cache_limit;
+
+set global innodb_ft_result_cache_limit=900000;
+select @@innodb_ft_result_cache_limit;
+
+set global innodb_ft_result_cache_limit=1000000;
+select @@innodb_ft_result_cache_limit;
+
+set global innodb_ft_result_cache_limit=4294967295;
+select @@innodb_ft_result_cache_limit;
+
+set global innodb_ft_result_cache_limit=4*1024*1024*1024;
+select @@innodb_ft_result_cache_limit;
+
+set global innodb_ft_result_cache_limit = @save_limit;
diff --git a/mysql-test/suite/sys_vars/t/innodb_ft_server_stopword_table_basic.test b/mysql-test/suite/sys_vars/t/innodb_ft_server_stopword_table_basic.test
new file mode 100644
index 00000000..5de822a5
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_ft_server_stopword_table_basic.test
@@ -0,0 +1,45 @@
+
+
+# 2011-11-15 - Added
+#
+
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_ft_server_stopword_table;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_ft_server_stopword_table;
+show global variables like 'innodb_ft_server_stopword_table';
+show session variables like 'innodb_ft_server_stopword_table';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_ft_server_stopword_table';
+select * from information_schema.session_variables where variable_name='innodb_ft_server_stopword_table';
+--enable_warnings
+
+call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table Salmon does not exist.");
+
+--error ER_GLOBAL_VARIABLE
+set session innodb_ft_server_stopword_table='Salmon';
+--error ER_GLOBAL_VARIABLE
+set @@session.innodb_ft_server_stopword_table='Salmon';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_ft_server_stopword_table=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_ft_server_stopword_table=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_ft_server_stopword_table='Salmon';
+
+#
+# Cleanup
+#
+
+SET @@global.innodb_ft_server_stopword_table = @start_global_value;
+SELECT @@global.innodb_ft_server_stopword_table;
diff --git a/mysql-test/suite/sys_vars/t/innodb_ft_sort_pll_degree_basic.test b/mysql-test/suite/sys_vars/t/innodb_ft_sort_pll_degree_basic.test
new file mode 100644
index 00000000..cacd6a69
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_ft_sort_pll_degree_basic.test
@@ -0,0 +1,28 @@
+
+#
+# 2011-11-17 - Added
+#
+
+--source include/have_innodb.inc
+
+#
+# show the global and session values;
+#
+select @@global.innodb_ft_sort_pll_degree;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_ft_sort_pll_degree;
+show global variables like 'innodb_ft_sort_pll_degree';
+show session variables like 'innodb_ft_sort_pll_degree';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_ft_sort_pll_degree';
+select * from information_schema.session_variables where variable_name='innodb_ft_sort_pll_degree';
+--enable_warnings
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global innodb_ft_sort_pll_degree=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session innodb_ft_sort_pll_degree=1;
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_ft_total_cache_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_ft_total_cache_size_basic.test
new file mode 100644
index 00000000..d032cd76
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_ft_total_cache_size_basic.test
@@ -0,0 +1,28 @@
+
+#
+# 2011-11-17 - Added
+#
+
+--source include/have_innodb.inc
+
+#
+# show the global and session values;
+#
+select @@global.innodb_ft_total_cache_size;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_ft_total_cache_size;
+show global variables like 'innodb_ft_total_cache_size';
+show session variables like 'innodb_ft_total_cache_size';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_ft_total_cache_size';
+select * from information_schema.session_variables where variable_name='innodb_ft_total_cache_size';
+--enable_warnings
+
+set global innodb_ft_total_cache_size=1;
+--error ER_GLOBAL_VARIABLE
+set session innodb_ft_total_cache_size=1;
+
+SHOW VARIABLES like 'innodb_ft_total_cache_size';
+set global innodb_ft_total_cache_size=512*1024*1024;
+show variables like 'innodb_ft_total_cache_size';
+set global innodb_ft_total_cache_size=default;
diff --git a/mysql-test/suite/sys_vars/t/innodb_ft_user_stopword_table_basic.test b/mysql-test/suite/sys_vars/t/innodb_ft_user_stopword_table_basic.test
new file mode 100644
index 00000000..475bf8df
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_ft_user_stopword_table_basic.test
@@ -0,0 +1,41 @@
+
+
+# 2011-11-15 - Added
+#
+
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_ft_user_stopword_table;
+SELECT @start_global_value;
+
+#
+# exists as session as well
+#
+select @@session.innodb_ft_user_stopword_table;
+
+show global variables like 'innodb_ft_user_stopword_table';
+show session variables like 'innodb_ft_user_stopword_table';
+
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_ft_user_stopword_table';
+select * from information_schema.session_variables where variable_name='innodb_ft_user_stopword_table';
+--enable_warnings
+
+call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table Salmon does not exist.");
+
+--error ER_WRONG_VALUE_FOR_VAR
+set session innodb_ft_user_stopword_table='Salmon';
+
+--error ER_WRONG_VALUE_FOR_VAR
+set @@session.innodb_ft_user_stopword_table='Salmon';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_ft_user_stopword_table=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_ft_user_stopword_table=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_ft_user_stopword_table='Salmon';
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_immediate_scrub_data_uncompressed_basic.test b/mysql-test/suite/sys_vars/t/innodb_immediate_scrub_data_uncompressed_basic.test
new file mode 100644
index 00000000..f3a3fba1
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_immediate_scrub_data_uncompressed_basic.test
@@ -0,0 +1,41 @@
+# bool global
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_immediate_scrub_data_uncompressed;
+
+--echo #
+--echo # exists as global only
+--echo #
+select @@global.innodb_immediate_scrub_data_uncompressed;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_immediate_scrub_data_uncompressed;
+show global variables like 'innodb_immediate_scrub_data_uncompressed';
+show session variables like 'innodb_immediate_scrub_data_uncompressed';
+select * from information_schema.global_variables
+where variable_name='innodb_immediate_scrub_data_uncompressed';
+select * from information_schema.session_variables
+where variable_name='innodb_immediate_scrub_data_uncompressed';
+
+--echo #
+--echo # show that it's writable
+--echo #
+set global innodb_immediate_scrub_data_uncompressed=ON;
+select @@global.innodb_immediate_scrub_data_uncompressed;
+set global innodb_immediate_scrub_data_uncompressed=OFF;
+select @@global.innodb_immediate_scrub_data_uncompressed;
+set global innodb_immediate_scrub_data_uncompressed=1;
+select @@global.innodb_immediate_scrub_data_uncompressed;
+--error ER_GLOBAL_VARIABLE
+set session innodb_immediate_scrub_data_uncompressed=1;
+
+--echo #
+--echo # incorrect types
+--echo #
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_immediate_scrub_data_uncompressed=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_immediate_scrub_data_uncompressed=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_immediate_scrub_data_uncompressed="foo";
+
+SET @@global.innodb_immediate_scrub_data_uncompressed = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/innodb_instant_alter_column_allowed_basic.test b/mysql-test/suite/sys_vars/t/innodb_instant_alter_column_allowed_basic.test
new file mode 100644
index 00000000..c9921b18
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_instant_alter_column_allowed_basic.test
@@ -0,0 +1,34 @@
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_instant_alter_column_allowed;
+SET GLOBAL innodb_instant_alter_column_allowed=never;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_instant_alter_column_allowed;
+show global variables like 'innodb_instant_alter_column_allowed';
+show session variables like 'innodb_instant_alter_column_allowed';
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_instant_alter_column_allowed';
+SELECT * FROM information_schema.session_variables
+WHERE variable_name='innodb_instant_alter_column_allowed';
+
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_instant_alter_column_allowed=no;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_instant_alter_column_allowed=1.1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_instant_alter_column_allowed=-1;
+select @@global.innodb_instant_alter_column_allowed;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_instant_alter_column_allowed=3;
+select @@global.innodb_instant_alter_column_allowed;
+set global innodb_instant_alter_column_allowed=2;
+select @@global.innodb_instant_alter_column_allowed;
+set global innodb_instant_alter_column_allowed=1;
+select @@global.innodb_instant_alter_column_allowed;
+set global innodb_instant_alter_column_allowed=0;
+select @@global.innodb_instant_alter_column_allowed;
+set global innodb_instant_alter_column_allowed=default;
+select @@global.innodb_instant_alter_column_allowed;
+
+SET GLOBAL innodb_instant_alter_column_allowed = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/innodb_io_capacity_basic.test b/mysql-test/suite/sys_vars/t/innodb_io_capacity_basic.test
new file mode 100644
index 00000000..0ced5800
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_io_capacity_basic.test
@@ -0,0 +1,62 @@
+
+
+# 2010-01-27 - Added
+#
+
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_io_capacity;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+--echo Valid value 100 or more
+select @@global.innodb_io_capacity > 99;
+select @@global.innodb_io_capacity;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_io_capacity;
+show global variables like 'innodb_io_capacity';
+show session variables like 'innodb_io_capacity';
+select * from information_schema.global_variables where variable_name='innodb_io_capacity';
+select * from information_schema.session_variables where variable_name='innodb_io_capacity';
+
+#
+# show that it's writable
+#
+set global innodb_io_capacity=123;
+select @@global.innodb_io_capacity;
+select * from information_schema.global_variables where variable_name='innodb_io_capacity';
+select * from information_schema.session_variables where variable_name='innodb_io_capacity';
+--error ER_GLOBAL_VARIABLE
+set session innodb_io_capacity=444;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_io_capacity=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_io_capacity=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_io_capacity="foo";
+
+set global innodb_io_capacity=7;
+select @@global.innodb_io_capacity;
+select * from information_schema.global_variables where variable_name='innodb_io_capacity';
+set global innodb_io_capacity=-7;
+select @@global.innodb_io_capacity;
+select * from information_schema.global_variables where variable_name='innodb_io_capacity';
+
+#
+# min/max values
+#
+set global innodb_io_capacity=100;
+select @@global.innodb_io_capacity;
+
+#
+# cleanup
+#
+
+SET @@global.innodb_io_capacity = @start_global_value;
+SELECT @@global.innodb_io_capacity;
diff --git a/mysql-test/suite/sys_vars/t/innodb_io_capacity_max_basic.test b/mysql-test/suite/sys_vars/t/innodb_io_capacity_max_basic.test
new file mode 100644
index 00000000..cedc6c0c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_io_capacity_max_basic.test
@@ -0,0 +1,85 @@
+
+
+# 2012-04-02 - Added
+#
+
+--source include/have_innodb.inc
+
+SET @start_innodb_max_capacity = @@global.innodb_io_capacity_max;
+SELECT @start_innodb_max_capacity;
+
+SET @start_innodb_capacity = @@global.innodb_io_capacity;
+SELECT @start_innodb_capacity;
+
+#
+# exists as global only
+#
+--echo Valid value 100 or more
+select @@global.innodb_io_capacity_max > 99;
+select @@global.innodb_io_capacity_max;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_io_capacity_max;
+show global variables like 'innodb_io_capacity_max';
+show session variables like 'innodb_io_capacity_max';
+select * from information_schema.global_variables where variable_name='innodb_io_capacity_max';
+select * from information_schema.session_variables where variable_name='innodb_io_capacity_max';
+
+#
+# show that it's writable.
+#
+set global innodb_io_capacity_max=@start_innodb_capacity + 1;
+select @@global.innodb_io_capacity_max;
+select * from information_schema.global_variables where variable_name='innodb_io_capacity_max';
+select * from information_schema.session_variables where variable_name='innodb_io_capacity_max';
+--error ER_GLOBAL_VARIABLE
+set session innodb_io_capacity_max=444;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_io_capacity_max=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_io_capacity_max=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_io_capacity_max="foo";
+
+#
+# Setting io_capacity_max lower than io_capacity affects also io_capacity
+#
+set global innodb_io_capacity_max=1000;
+set global innodb_io_capacity=500;
+set global innodb_io_capacity_max=400;
+select @@global.innodb_io_capacity_max;
+select @@global.innodb_io_capacity;
+select * from information_schema.global_variables where variable_name='innodb_io_capacity_max';
+select * from information_schema.global_variables where variable_name='innodb_io_capacity';
+
+#
+# Setting io_capacity higher than io_capacity_max affects also io_capacity_max
+#
+set global innodb_io_capacity_max=1000;
+set global innodb_io_capacity=500;
+set global innodb_io_capacity=1400;
+select @@global.innodb_io_capacity_max;
+select @@global.innodb_io_capacity;
+select * from information_schema.global_variables where variable_name='innodb_io_capacity_max';
+select * from information_schema.global_variables where variable_name='innodb_io_capacity';
+#
+# min/max values
+#
+# first set innodb_io_cpaacity lower
+set global innodb_io_capacity=100;
+set global innodb_io_capacity_max=100;
+select @@global.innodb_io_capacity_max;
+
+#
+# cleanup
+#
+
+SET @@global.innodb_io_capacity_max = @start_innodb_max_capacity;
+SELECT @@global.innodb_io_capacity_max;
+
+SET @@global.innodb_io_capacity = @start_innodb_capacity;
+SELECT @@global.innodb_io_capacity;
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_limit_optimistic_insert_debug_basic.test b/mysql-test/suite/sys_vars/t/innodb_limit_optimistic_insert_debug_basic.test
new file mode 100644
index 00000000..8f2271cb
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_limit_optimistic_insert_debug_basic.test
@@ -0,0 +1,56 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+
+SET @start_global_value = @@global.innodb_limit_optimistic_insert_debug;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+select @@global.innodb_limit_optimistic_insert_debug;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_limit_optimistic_insert_debug;
+show global variables like 'innodb_limit_optimistic_insert_debug';
+show session variables like 'innodb_limit_optimistic_insert_debug';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_limit_optimistic_insert_debug';
+select * from information_schema.session_variables where variable_name='innodb_limit_optimistic_insert_debug';
+--enable_warnings
+
+#
+# show that it's writable
+#
+set global innodb_limit_optimistic_insert_debug=1;
+select @@global.innodb_limit_optimistic_insert_debug;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_limit_optimistic_insert_debug';
+select * from information_schema.session_variables where variable_name='innodb_limit_optimistic_insert_debug';
+--enable_warnings
+set @@global.innodb_limit_optimistic_insert_debug=0;
+select @@global.innodb_limit_optimistic_insert_debug;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_limit_optimistic_insert_debug';
+select * from information_schema.session_variables where variable_name='innodb_limit_optimistic_insert_debug';
+--enable_warnings
+--error ER_GLOBAL_VARIABLE
+set session innodb_limit_optimistic_insert_debug='some';
+--error ER_GLOBAL_VARIABLE
+set @@session.innodb_limit_optimistic_insert_debug='some';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_limit_optimistic_insert_debug=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_limit_optimistic_insert_debug='foo';
+set global innodb_limit_optimistic_insert_debug=-2;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_limit_optimistic_insert_debug=1e1;
+
+#
+# Cleanup
+#
+
+SET @@global.innodb_limit_optimistic_insert_debug = @start_global_value;
+SELECT @@global.innodb_limit_optimistic_insert_debug;
diff --git a/mysql-test/suite/sys_vars/t/innodb_lock_wait_timeout_basic.test b/mysql-test/suite/sys_vars/t/innodb_lock_wait_timeout_basic.test
new file mode 100644
index 00000000..a2aecf4c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_lock_wait_timeout_basic.test
@@ -0,0 +1,171 @@
+
+
+################## mysql-test\t\innodb_lock_wait_timeout_basic.test ###########
+# #
+# Variable Name: innodb_lock_wait_timeout #
+# Scope: Global , Session #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable innodb_lock_wait_timeout #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+
+SET @start_global_value=@@global.innodb_lock_wait_timeout;
+SELECT @start_global_value;
+
+--echo '#---------------------BS_STVARS_032_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.innodb_lock_wait_timeout);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_032_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+SET global innodb_lock_wait_timeout=60;
+SELECT @@global.innodb_lock_wait_timeout;
+SET session innodb_lock_wait_timeout=60;
+SELECT @@session.innodb_lock_wait_timeout;
+
+--echo '#---------------------BS_STVARS_032_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+--disable_warnings
+SELECT @@GLOBAL.innodb_lock_wait_timeout = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_lock_wait_timeout';
+--enable_warnings
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.innodb_lock_wait_timeout);
+--echo 1 Expected
+
+--disable_warnings
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_lock_wait_timeout';
+--enable_warnings
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_032_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@innodb_lock_wait_timeout = @@GLOBAL.innodb_lock_wait_timeout;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_032_05----------------------#'
+################################################################################
+# Check if innodb_lock_wait_timeout can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@innodb_lock_wait_timeout);
+--echo 1 Expected
+
+SELECT COUNT(@@local.innodb_lock_wait_timeout);
+
+SELECT COUNT(@@SESSION.innodb_lock_wait_timeout);
+
+SELECT COUNT(@@GLOBAL.innodb_lock_wait_timeout);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT innodb_lock_wait_timeout = @@SESSION.innodb_lock_wait_timeout;
+
+#
+# check the default value
+#
+set @@global.innodb_lock_wait_timeout=100;
+set @@global.innodb_lock_wait_timeout=DEFAULT;
+select @@global.innodb_lock_wait_timeout;
+set @@session.innodb_lock_wait_timeout=100;
+set @@session.innodb_lock_wait_timeout=DEFAULT;
+select @@session.innodb_lock_wait_timeout;
+
+#
+# check for valid values
+#
+
+SET @@global.innodb_lock_wait_timeout=1;
+SELECT @@global.innodb_lock_wait_timeout;
+SET @@global.innodb_lock_wait_timeout=1024;
+SELECT @@global.innodb_lock_wait_timeout;
+SET @@global.innodb_lock_wait_timeout=1073741824;
+SELECT @@global.innodb_lock_wait_timeout;
+
+SET @@session.innodb_lock_wait_timeout=1;
+SELECT @@session.innodb_lock_wait_timeout;
+SET @@session.innodb_lock_wait_timeout=1024;
+SELECT @@session.innodb_lock_wait_timeout;
+SET @@session.innodb_lock_wait_timeout=1073741824;
+SELECT @@session.innodb_lock_wait_timeout;
+
+#
+# check for invalid values
+#
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_lock_wait_timeout="t";
+SELECT @@global.innodb_lock_wait_timeout;
+SET @@global.innodb_lock_wait_timeout=-1024;
+SELECT @@global.innodb_lock_wait_timeout;
+SET @@global.innodb_lock_wait_timeout=1073741825;
+SELECT @@global.innodb_lock_wait_timeout;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_lock_wait_timeout=" ";
+SELECT @@global.innodb_lock_wait_timeout;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_lock_wait_timeout=' ';
+SELECT @@global.innodb_lock_wait_timeout;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_lock_wait_timeout=1.1;
+SELECT @@global.innodb_lock_wait_timeout;
+
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.innodb_lock_wait_timeout="T";
+SELECT @@session.innodb_lock_wait_timeout;
+SET @@session.innodb_lock_wait_timeout=-1024;
+SELECT @@session.innodb_lock_wait_timeout;
+SET @@session.innodb_lock_wait_timeout=1073999999;
+SELECT @@session.innodb_lock_wait_timeout;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.innodb_lock_wait_timeout=' ';
+SELECT @@session.innodb_lock_wait_timeout;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.innodb_lock_wait_timeout=" ";
+SELECT @@session.innodb_lock_wait_timeout;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.innodb_lock_wait_timeout=1.1;
+SELECT @@session.innodb_lock_wait_timeout;
+
+
+
+# Cleanup
+#
+
+SET @@global.innodb_lock_wait_timeout = @start_global_value;
+SELECT @@global.innodb_lock_wait_timeout;
diff --git a/mysql-test/suite/sys_vars/t/innodb_log_buffer_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_log_buffer_size_basic.test
new file mode 100644
index 00000000..550bba0c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_log_buffer_size_basic.test
@@ -0,0 +1,106 @@
+
+
+################## mysql-test\t\innodb_log_buffer_size_basic.test #############
+# #
+# Variable Name: innodb_log_buffer_size #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: numeric #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable innodb_log_buffer_size #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+
+--echo '#---------------------BS_STVARS_033_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.innodb_log_buffer_size);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_033_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.innodb_log_buffer_size=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.innodb_log_buffer_size);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_033_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+--disable_warnings
+SELECT @@GLOBAL.innodb_log_buffer_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_log_buffer_size';
+--enable_warnings
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.innodb_log_buffer_size);
+--echo 1 Expected
+
+--disable_warnings
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_log_buffer_size';
+--enable_warnings
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_033_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@innodb_log_buffer_size = @@GLOBAL.innodb_log_buffer_size;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_033_05----------------------#'
+################################################################################
+# Check if innodb_log_buffer_size can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@innodb_log_buffer_size);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.innodb_log_buffer_size);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.innodb_log_buffer_size);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.innodb_log_buffer_size);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT innodb_log_buffer_size = @@SESSION.innodb_log_buffer_size;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_log_checkpoint_now_basic.test b/mysql-test/suite/sys_vars/t/innodb_log_checkpoint_now_basic.test
new file mode 100644
index 00000000..f59ebf64
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_log_checkpoint_now_basic.test
@@ -0,0 +1,81 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+# Valgrind builds may block on this one
+--source include/not_valgrind.inc
+
+SET @start_global_value = @@global.innodb_log_checkpoint_now;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+select @@global.innodb_log_checkpoint_now in (0, 1);
+select @@global.innodb_log_checkpoint_now;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_log_checkpoint_now;
+show global variables like 'innodb_log_checkpoint_now';
+show session variables like 'innodb_log_checkpoint_now';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_log_checkpoint_now';
+select * from information_schema.session_variables where variable_name='innodb_log_checkpoint_now';
+--enable_warnings
+
+#
+# show that it's writable
+#
+set global innodb_log_checkpoint_now=1;
+# Should always be OFF
+select @@global.innodb_log_checkpoint_now;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_log_checkpoint_now';
+select * from information_schema.session_variables where variable_name='innodb_log_checkpoint_now';
+--enable_warnings
+
+set @@global.innodb_log_checkpoint_now=0;
+# Should always be OFF
+select @@global.innodb_log_checkpoint_now;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_log_checkpoint_now';
+select * from information_schema.session_variables where variable_name='innodb_log_checkpoint_now';
+--enable_warnings
+
+set global innodb_log_checkpoint_now=ON;
+# Should always be OFF
+select @@global.innodb_log_checkpoint_now;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_log_checkpoint_now';
+select * from information_schema.session_variables where variable_name='innodb_log_checkpoint_now';
+--enable_warnings
+
+set global innodb_log_checkpoint_now=OFF;
+# Should always be OFF
+select @@global.innodb_log_checkpoint_now;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_log_checkpoint_now';
+select * from information_schema.session_variables where variable_name='innodb_log_checkpoint_now';
+--enable_warnings
+
+--error ER_GLOBAL_VARIABLE
+set session innodb_log_checkpoint_now='some';
+
+--error ER_GLOBAL_VARIABLE
+set @@session.innodb_log_checkpoint_now='some';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_log_checkpoint_now=1.1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_log_checkpoint_now='foo';
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_log_checkpoint_now=-2;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_log_checkpoint_now=1e1;
+
+#
+# Cleanup
+#
+
+SET @@global.innodb_log_checkpoint_now = @start_global_value;
+SELECT @@global.innodb_log_checkpoint_now;
diff --git a/mysql-test/suite/sys_vars/t/innodb_log_file_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_log_file_size_basic.test
new file mode 100644
index 00000000..4d67c22e
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_log_file_size_basic.test
@@ -0,0 +1,105 @@
+
+
+################## mysql-test\t\innodb_log_file_size_basic.test ###############
+# #
+# Variable Name: innodb_log_file_size #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: numeric #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable innodb_log_file_size #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+
+--echo '#---------------------BS_STVARS_035_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.innodb_log_file_size);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_035_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+#--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.innodb_log_file_size=10485760;
+
+SELECT COUNT(@@GLOBAL.innodb_log_file_size);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_035_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+--disable_warnings
+SELECT @@GLOBAL.innodb_log_file_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_log_file_size';
+--enable_warnings
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.innodb_log_file_size);
+--echo 1 Expected
+
+--disable_warnings
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_log_file_size';
+--enable_warnings
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_035_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@innodb_log_file_size = @@GLOBAL.innodb_log_file_size;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_035_05----------------------#'
+################################################################################
+# Check if innodb_log_file_size can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@innodb_log_file_size);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.innodb_log_file_size);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.innodb_log_file_size);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.innodb_log_file_size);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT innodb_log_file_size = @@SESSION.innodb_log_file_size;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_log_group_home_dir_basic.test b/mysql-test/suite/sys_vars/t/innodb_log_group_home_dir_basic.test
new file mode 100644
index 00000000..d6d5446c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_log_group_home_dir_basic.test
@@ -0,0 +1,106 @@
+
+
+################## mysql-test\t\innodb_log_group_home_dir_basic.test ##########
+# #
+# Variable Name: innodb_log_group_home_dir #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: filename #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable innodb_log_group_home_dir #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+
+--echo '#---------------------BS_STVARS_036_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.innodb_log_group_home_dir);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_036_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.innodb_log_group_home_dir=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.innodb_log_group_home_dir);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_036_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+--disable_warnings
+SELECT @@GLOBAL.innodb_log_group_home_dir = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_log_group_home_dir';
+--enable_warnings
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.innodb_log_group_home_dir);
+--echo 1 Expected
+
+--disable_warnings
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_log_group_home_dir';
+--enable_warnings
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_036_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@innodb_log_group_home_dir = @@GLOBAL.innodb_log_group_home_dir;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_036_05----------------------#'
+################################################################################
+# Check if innodb_log_group_home_dir can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@innodb_log_group_home_dir);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.innodb_log_group_home_dir);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.innodb_log_group_home_dir);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.innodb_log_group_home_dir);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT innodb_log_group_home_dir = @@SESSION.innodb_log_group_home_dir;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_lru_scan_depth_basic.test b/mysql-test/suite/sys_vars/t/innodb_lru_scan_depth_basic.test
new file mode 100644
index 00000000..8f08a1bf
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_lru_scan_depth_basic.test
@@ -0,0 +1,66 @@
+
+
+# 2011-02-23 - Added
+#
+
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_lru_scan_depth;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+--echo Valid value 100 or more
+select @@global.innodb_lru_scan_depth >= 100;
+select @@global.innodb_lru_scan_depth;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_lru_scan_depth;
+show global variables like 'innodb_lru_scan_depth';
+show session variables like 'innodb_lru_scan_depth';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_lru_scan_depth';
+select * from information_schema.session_variables where variable_name='innodb_lru_scan_depth';
+--enable_warnings
+
+#
+# show that it's writable
+#
+set global innodb_lru_scan_depth=325;
+select @@global.innodb_lru_scan_depth;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_lru_scan_depth';
+select * from information_schema.session_variables where variable_name='innodb_lru_scan_depth';
+--enable_warnings
+--error ER_GLOBAL_VARIABLE
+set session innodb_lru_scan_depth=444;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_lru_scan_depth=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_lru_scan_depth=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_lru_scan_depth="foo";
+
+set global innodb_lru_scan_depth=7;
+select @@global.innodb_lru_scan_depth;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_lru_scan_depth';
+--enable_warnings
+set global innodb_lru_scan_depth=-7;
+select @@global.innodb_lru_scan_depth;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_lru_scan_depth';
+--enable_warnings
+
+#
+# min/max values
+#
+set global innodb_lru_scan_depth=100;
+select @@global.innodb_lru_scan_depth;
+
+SET @@global.innodb_lru_scan_depth = @start_global_value;
+SELECT @@global.innodb_lru_scan_depth;
diff --git a/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_basic.test b/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_basic.test
new file mode 100644
index 00000000..0459d46a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_basic.test
@@ -0,0 +1,195 @@
+################# mysql-test\t\innodb_max_dirty_pages_pct_basic.test ##########
+# #
+# Variable Name: innodb_max_dirty_pages_pct #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 75 #
+# Range: 0-99 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+#Description: Test Cases of Dynamic System Variable #
+# innodb_max_dirty_pages_pct that checks the behavior of #
+# this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+--source include/have_innodb.inc
+--source include/load_sysvars.inc
+
+# set default value for test
+SET @save_innodb_max_dirty_pages_pct=@@global.innodb_max_dirty_pages_pct;
+set @@global.innodb_max_dirty_pages_pct=75;
+
+######################################################################
+# START OF innodb_max_dirty_pages_pct TESTS #
+######################################################################
+
+
+################################################################################
+# Saving initial value of innodb_max_dirty_pages_pct in a temporary variable #
+################################################################################
+
+SET @global_start_value = @@global.innodb_max_dirty_pages_pct;
+SELECT @global_start_value;
+
+# need this because setting innodb_max_dirty_pages_pct to lower than this
+# should cause a warning
+SET @global_start_max_dirty_lwm_value = @@global.innodb_max_dirty_pages_pct_lwm;
+SELECT @global_start_max_dirty_lwm_value;
+
+
+SET @@global.innodb_max_dirty_pages_pct_lwm = 0;
+SELECT @@global.innodb_max_dirty_pages_pct_lwm;
+
+--echo '#--------------------FN_DYNVARS_046_01------------------------#'
+########################################################################
+# Display the DEFAULT value of innodb_max_dirty_pages_pct #
+########################################################################
+
+SET @@global.innodb_max_dirty_pages_pct = 0;
+SET @@global.innodb_max_dirty_pages_pct = DEFAULT;
+SELECT @@global.innodb_max_dirty_pages_pct;
+
+--echo '#---------------------FN_DYNVARS_046_02-------------------------#'
+################################################################################
+# check if innodb_max_dirty_pages_pct can be accessed with and without @@ sign #
+################################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET innodb_max_dirty_pages_pct = 1;
+SELECT @@innodb_max_dirty_pages_pct;
+
+--Error ER_UNKNOWN_TABLE
+SELECT local.innodb_max_dirty_pages_pct;
+
+SET global innodb_max_dirty_pages_pct = 0;
+SELECT @@global.innodb_max_dirty_pages_pct;
+
+--echo '#--------------------FN_DYNVARS_046_03------------------------#'
+##########################################################################
+# change the value of innodb_max_dirty_pages_pct to a valid value #
+##########################################################################
+
+SET @@global.innodb_max_dirty_pages_pct = 0.0;
+SELECT @@global.innodb_max_dirty_pages_pct;
+
+SET @@global.innodb_max_dirty_pages_pct = 1;
+SELECT @@global.innodb_max_dirty_pages_pct;
+SET @@global.innodb_max_dirty_pages_pct = 99;
+SELECT @@global.innodb_max_dirty_pages_pct;
+
+--echo '#--------------------FN_DYNVARS_046_04------------------------#'
+##########################################################################
+# change value of based on innodb_max_dirty_pages_pct_lwm #
+##########################################################################
+SET @@global.innodb_max_dirty_pages_pct_lwm = @global_start_value - 1;
+SELECT @@global.innodb_max_dirty_pages_pct_lwm;
+
+# this should cause warning
+SET @@global.innodb_max_dirty_pages_pct = @global_start_value - 2;
+SELECT @@global.innodb_max_dirty_pages_pct;
+
+--echo '#--------------------FN_DYNVARS_046_05-------------------------#'
+###########################################################################
+# Change the value of innodb_max_dirty_pages_pct to invalid value #
+###########################################################################
+
+SET @@global.innodb_max_dirty_pages_pct = -1;
+SELECT @@global.innodb_max_dirty_pages_pct;
+SET @@global.innodb_max_dirty_pages_pct = -1024;
+SELECT @@global.innodb_max_dirty_pages_pct;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_max_dirty_pages_pct = "T";
+SELECT @@global.innodb_max_dirty_pages_pct;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_max_dirty_pages_pct = "Y";
+SELECT @@global.innodb_max_dirty_pages_pct;
+
+SET @@global.innodb_max_dirty_pages_pct = 100;
+SELECT @@global.innodb_max_dirty_pages_pct;
+SET @@global.innodb_max_dirty_pages_pct = 1001;
+SELECT @@global.innodb_max_dirty_pages_pct;
+SET @@global.innodb_max_dirty_pages_pct = 100000;
+SELECT @@global.innodb_max_dirty_pages_pct;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_max_dirty_pages_pct = ' ';
+SELECT @@global.innodb_max_dirty_pages_pct;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_max_dirty_pages_pct = " ";
+SELECT @@global.innodb_max_dirty_pages_pct;
+SET @@global.innodb_max_dirty_pages_pct = 1.1;
+SELECT @@global.innodb_max_dirty_pages_pct;
+set global innodb_max_dirty_pages_pct = 0.1;
+SELECT @@global.innodb_max_dirty_pages_pct;
+set global innodb_max_dirty_pages_pct = 31.34;
+SELECT @@global.innodb_max_dirty_pages_pct;
+set global innodb_max_dirty_pages_pct = 100;
+SELECT @@global.innodb_max_dirty_pages_pct;
+set global innodb_max_dirty_pages_pct = 99.999;
+SELECT @@global.innodb_max_dirty_pages_pct;
+
+--echo '#----------------------FN_DYNVARS_046_06------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#########################################################################
+
+--disable_warnings
+SELECT @@global.innodb_max_dirty_pages_pct =
+ VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='innodb_max_dirty_pages_pct';
+--enable_warnings
+SELECT @@global.innodb_max_dirty_pages_pct;
+--disable_warnings
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='innodb_max_dirty_pages_pct';
+--enable_warnings
+
+--echo '#---------------------FN_DYNVARS_046_07-------------------------#'
+###################################################################
+# Check if ON and OFF values can be used on variable #
+###################################################################
+
+--ERROR ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_max_dirty_pages_pct = OFF;
+SELECT @@global.innodb_max_dirty_pages_pct;
+
+--ERROR ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_max_dirty_pages_pct = ON;
+SELECT @@global.innodb_max_dirty_pages_pct;
+
+--echo '#---------------------FN_DYNVARS_046_08----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.innodb_max_dirty_pages_pct = TRUE;
+SELECT @@global.innodb_max_dirty_pages_pct;
+SET @@global.innodb_max_dirty_pages_pct = FALSE;
+SELECT @@global.innodb_max_dirty_pages_pct;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.innodb_max_dirty_pages_pct = @global_start_value;
+SELECT @@global.innodb_max_dirty_pages_pct;
+
+SET @@global.innodb_max_dirty_pages_pct_lwm = @global_start_max_dirty_lwm_value;
+SELECT @@global.innodb_max_dirty_pages_pct_lwm;
+
+SET @@global.innodb_max_dirty_pages_pct=@save_innodb_max_dirty_pages_pct;
+
+###############################################################
+# END OF innodb_max_dirty_pages_pct TESTS #
+###############################################################
diff --git a/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_func.test b/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_func.test
new file mode 100644
index 00000000..45432290
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_func.test
@@ -0,0 +1,175 @@
+###############################################################################
+# #
+# Variable Name: innodb_max_dirty_pages_pct #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 90 #
+# Range: 0-100 #
+# #
+# #
+# Creation Date: 2008-03-08 #
+# Author: Rizwan #
+# Modified: HHunger 2009-01-29 Fix for bug#39382, replaced sleep by wait cond.#
+# added comments, beautifications. #
+# #
+# Description: #
+# Test Cases of Dynamic System Variable innodb_max_dirty_pages_pct that #
+# checks the behavior of this variable #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+
+# safe initial value
+SET @innodb_max_dirty_pages_pct_lwm = @@global.innodb_max_dirty_pages_pct_lwm;
+SET @innodb_max_dirty_pages_pct = @@global.innodb_max_dirty_pages_pct;
+
+--echo '#--------------------FN_DYNVARS_044_02-------------------------#'
+############################################################################
+# Check if setting innodb_max_dirty_pages_pct is changed in new connection #
+############################################################################
+
+SET @@global.innodb_max_dirty_pages_pct_lwm = 0;
+SET @@global.innodb_max_dirty_pages_pct = 80;
+SET @@global.innodb_max_dirty_pages_pct_lwm = 80;
+connect (con1,localhost,root,,,,);
+connection con1;
+SELECT @@global.innodb_max_dirty_pages_pct;
+SET @@global.innodb_max_dirty_pages_pct = 70;
+SELECT @@global.innodb_max_dirty_pages_pct_lwm;
+connect (con2,localhost,root,,,,);
+connection con2;
+SELECT @@global.innodb_max_dirty_pages_pct;
+connection default;
+disconnect con2;
+disconnect con1;
+# restore initial value
+SET @@global.innodb_max_dirty_pages_pct = @innodb_max_dirty_pages_pct;
+
+--echo '#--------------------FN_DYNVARS_044_02-------------------------#'
+###################################################################
+# Begin the functionality Testing of innodb_max_dirty_pages_pct #
+###################################################################
+
+
+--disable_warnings
+DROP PROCEDURE IF EXISTS add_records;
+DROP PROCEDURE IF EXISTS add_until;
+DROP PROCEDURE IF EXISTS check_pct;
+DROP FUNCTION IF EXISTS dirty_pct;
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+DELIMITER //;
+CREATE PROCEDURE add_records(IN num INT)
+BEGIN
+ START TRANSACTION;
+ WHILE (num > 0) DO
+ INSERT INTO t1(b) VALUES('MYSQL');
+ SET num = num - 1;
+ END WHILE;
+ COMMIT;
+END//
+
+CREATE FUNCTION dirty_pct() RETURNS DECIMAL(20,17)
+BEGIN
+ DECLARE res DECIMAL(20,17);
+ DECLARE a1, b1 VARCHAR(256);
+ DECLARE a2, b2 VARCHAR(256);
+ DECLARE dirty CURSOR FOR SELECT * FROM information_schema.global_status
+ WHERE variable_name LIKE 'Innodb_buffer_pool_pages_dirty';
+ DECLARE total CURSOR FOR SELECT * FROM information_schema.global_status
+ WHERE variable_name LIKE 'Innodb_buffer_pool_pages_total';
+
+ OPEN dirty;
+ OPEN total;
+
+ FETCH dirty INTO a1, b1;
+ FETCH total INTO a2, b2;
+
+ SET res = (CONVERT(b1,DECIMAL) * 100) / CONVERT(b2,DECIMAL);
+
+ CLOSE dirty;
+ CLOSE total;
+ RETURN res;
+END//
+
+CREATE PROCEDURE add_until(IN num DECIMAL)
+BEGIN
+ DECLARE pct,last DECIMAL(20,17);
+ SET pct = dirty_pct();
+ SET last = 0;
+ WHILE (pct < num AND pct < 100) DO
+ CALL add_records(500);
+ SET pct = dirty_pct();
+ IF (pct < last) THEN
+ SET pct = num + 1;
+ ELSE
+ SET last = pct;
+ END IF;
+ END WHILE;
+END//
+
+CREATE PROCEDURE check_pct(IN success_on_wait BOOLEAN)
+BEGIN
+ IF (success_on_wait > 0) THEN
+ SELECT 'BELOW_MAX' AS PCT_VALUE;
+ ELSE
+ SELECT 'ABOVE_MAX or TimeOut Of The Test' AS PCT_VALUE;
+ END IF;
+END//
+
+DELIMITER ;//
+
+CREATE TABLE t1(
+a INT AUTO_INCREMENT PRIMARY KEY,
+b CHAR(200)
+) ENGINE = INNODB;
+
+#==========================================================
+--echo '---Check when innodb_max_dirty_pages_pct is 10---'
+#==========================================================
+
+SET @@global.innodb_max_dirty_pages_pct = 10;
+SELECT @@global.innodb_max_dirty_pages_pct_lwm;
+SET GLOBAL innodb_max_dirty_pages_pct_lwm = 15;
+SELECT @@global.innodb_max_dirty_pages_pct_lwm;
+SELECT @@global.innodb_max_dirty_pages_pct;
+
+FLUSH STATUS;
+
+# add rows until dirty pages pct is about @@global.innodb_max_dirty_pages_pc
+CALL add_until(10);
+
+# Give the server some time to flush dirty pages
+FLUSH TABLES;
+
+# Add more pages to be over @@global.innodb_max_dirty_pages_pc
+CALL add_records(500);
+
+# Give server time to write pages to disk (depends on performance of the system)
+let $wait_condition= SELECT (dirty_pct() <= @@global.innodb_max_dirty_pages_pct);
+--source include/wait_condition.inc
+
+--echo 'We expect dirty pages pct to be BELOW_MAX after some time depending on performance'
+# Value For $success will be set from include/wait_condition.inc file. It can have values 1 or 0. It will be 1 if dirty_pct() <= @@global.innodb_max_dirty_pages_pct else it will be 0.
+eval CALL check_pct($success);
+DROP PROCEDURE add_records;
+DROP PROCEDURE add_until;
+DROP PROCEDURE check_pct;
+DROP FUNCTION dirty_pct;
+DROP TABLE t1;
+
+# restore initial value
+SET GLOBAL innodb_max_dirty_pages_pct_lwm = 0;
+SET @@global.innodb_max_dirty_pages_pct = @innodb_max_dirty_pages_pct;
+SET @@global.innodb_max_dirty_pages_pct_lwm = @innodb_max_dirty_pages_pct_lwm;
+
+##################################################################
+# End of functionality Testing for innodb_max_dirty_pages_pct #
+##################################################################
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_lwm_basic.test b/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_lwm_basic.test
new file mode 100644
index 00000000..947c1bfa
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_lwm_basic.test
@@ -0,0 +1,175 @@
+############# mysql-test\t\innodb_max_dirty_pages_pct_lwm_basic.test ##########
+# #
+# Variable Name: innodb_max_dirty_pages_pct_lwm #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 75 #
+# Range: 0-99 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+#Description: Test Cases of Dynamic System Variable #
+# innodb_max_dirty_pages_pct_lwm that checks the behavior of #
+# this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+--source include/have_innodb.inc
+--source include/load_sysvars.inc
+
+# set default value for test
+SET @save_innodb_max_dirty_pages_pct=@@global.innodb_max_dirty_pages_pct;
+set @@global.innodb_max_dirty_pages_pct=75;
+
+######################################################################
+# START OF innodb_max_dirty_pages_pct_lwm TESTS #
+######################################################################
+
+
+#################################################################################
+#Saving initial value of innodb_max_dirty_pages_pct_lwm in a temporary variable #
+#################################################################################
+
+SET @pct_lwm_start_value = @@global.innodb_max_dirty_pages_pct_lwm;
+SELECT @pct_lwm_start_value;
+
+SET @pct_start_value = @@global.innodb_max_dirty_pages_pct;
+SELECT @pct_start_value;
+
+--echo '#--------------------FN_DYNVARS_046_01------------------------#'
+########################################################################
+# Display the DEFAULT value of innodb_max_dirty_pages_pct_lwm #
+########################################################################
+
+SET @@global.innodb_max_dirty_pages_pct_lwm = 0;
+SET @@global.innodb_max_dirty_pages_pct_lwm = DEFAULT;
+SELECT @@global.innodb_max_dirty_pages_pct_lwm;
+
+--echo '#---------------------FN_DYNVARS_046_02-------------------------#'
+###################################################################################
+#check if innodb_max_dirty_pages_pct_lwm can be accessed with and without @@ sign #
+###################################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET innodb_max_dirty_pages_pct_lwm = 1;
+SELECT @@innodb_max_dirty_pages_pct_lwm;
+
+--Error ER_UNKNOWN_TABLE
+SELECT local.innodb_max_dirty_pages_pct_lwm;
+
+SET global innodb_max_dirty_pages_pct_lwm = 0;
+SELECT @@global.innodb_max_dirty_pages_pct_lwm;
+
+--echo '#--------------------FN_DYNVARS_046_03------------------------#'
+##########################################################################
+# change the value of innodb_max_dirty_pages_pct_lwm to a valid value #
+# Aloowed values are <= innodb_max_dirty_pages_pct value #
+##########################################################################
+
+SET @@global.innodb_max_dirty_pages_pct_lwm = 0;
+SELECT @@global.innodb_max_dirty_pages_pct_lwm;
+
+SET @@global.innodb_max_dirty_pages_pct_lwm = @pct_start_value;
+SELECT @@global.innodb_max_dirty_pages_pct_lwm;
+
+--echo '#--------------------FN_DYNVARS_046_04-------------------------#'
+###########################################################################
+# Change the value of innodb_max_dirty_pages_pct_lwm to invalid value #
+###########################################################################
+
+SET @@global.innodb_max_dirty_pages_pct_lwm = -1;
+SELECT @@global.innodb_max_dirty_pages_pct_lwm;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_max_dirty_pages_pct_lwm = "T";
+SELECT @@global.innodb_max_dirty_pages_pct_lwm;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_max_dirty_pages_pct_lwm = "Y";
+SELECT @@global.innodb_max_dirty_pages_pct_lwm;
+
+SET @@global.innodb_max_dirty_pages_pct_lwm = @pct_start_value + 1;
+SELECT @@global.innodb_max_dirty_pages_pct_lwm;
+
+
+SET @@global.innodb_max_dirty_pages_pct_lwm = 0.0;
+SELECT @@global.innodb_max_dirty_pages_pct_lwm;
+
+SET @@global.innodb_max_dirty_pages_pct_lwm = 1.1;
+SELECT @@global.innodb_max_dirty_pages_pct_lwm;
+
+SET @@global.innodb_max_dirty_pages_pct_lwm = 51.12;
+SELECT @@global.innodb_max_dirty_pages_pct_lwm;
+
+SET @@global.innodb_max_dirty_pages_pct_lwm = 100;
+SELECT @@global.innodb_max_dirty_pages_pct_lwm;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_max_dirty_pages_pct_lwm = " ";
+SELECT @@global.innodb_max_dirty_pages_pct_lwm;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_max_dirty_pages_pct_lwm = ' ';
+SELECT @@global.innodb_max_dirty_pages_pct_lwm;
+
+--echo '#----------------------FN_DYNVARS_046_05------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#########################################################################
+
+--disable_warnings
+SELECT @@global.innodb_max_dirty_pages_pct_lwm =
+ VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='innodb_max_dirty_pages_pct_lwm';
+--enable_warnings
+SELECT @@global.innodb_max_dirty_pages_pct_lwm;
+--disable_warnings
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='innodb_max_dirty_pages_pct_lwm';
+--enable_warnings
+
+--echo '#---------------------FN_DYNVARS_046_06-------------------------#'
+###################################################################
+# Check if ON and OFF values can be used on variable #
+###################################################################
+
+--ERROR ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_max_dirty_pages_pct_lwm = OFF;
+SELECT @@global.innodb_max_dirty_pages_pct_lwm;
+
+--ERROR ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_max_dirty_pages_pct_lwm = ON;
+SELECT @@global.innodb_max_dirty_pages_pct_lwm;
+
+--echo '#---------------------FN_DYNVARS_046_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.innodb_max_dirty_pages_pct_lwm = TRUE;
+SELECT @@global.innodb_max_dirty_pages_pct_lwm;
+SET @@global.innodb_max_dirty_pages_pct_lwm = FALSE;
+SELECT @@global.innodb_max_dirty_pages_pct_lwm;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.innodb_max_dirty_pages_pct = @pct_start_value;
+SELECT @@global.innodb_max_dirty_pages_pct;
+
+SET @@global.innodb_max_dirty_pages_pct_lwm = @pct_lwm_start_value;
+SELECT @@global.innodb_max_dirty_pages_pct_lwm;
+
+SET @@global.innodb_max_dirty_pages_pct=@save_innodb_max_dirty_pages_pct;
+
+###############################################################
+# END OF innodb_max_dirty_pages_pct_lwm TESTS #
+###############################################################
diff --git a/mysql-test/suite/sys_vars/t/innodb_max_purge_lag_basic.test b/mysql-test/suite/sys_vars/t/innodb_max_purge_lag_basic.test
new file mode 100644
index 00000000..6c7676f1
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_max_purge_lag_basic.test
@@ -0,0 +1,179 @@
+################# mysql-test\t\innodb_max_purge_lag_basic.test ################
+# #
+# Variable Name: innodb_max_purge_lag #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 0 #
+# Range: 0-4294967295 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+#Description:Test Cases of Dynamic System Variable innodb_max_purge_lag #
+# that checks the behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF innodb_max_purge_lag TESTS #
+########################################################################
+
+################################################################################
+# Saving initial value of innodb_max_purge_lag in a temporary variable #
+################################################################################
+
+SET @global_start_value = @@global.innodb_max_purge_lag;
+SELECT @global_start_value;
+
+--echo '#--------------------FN_DYNVARS_046_01------------------------#'
+########################################################################
+# Display the DEFAULT value of innodb_max_purge_lag #
+########################################################################
+
+SET @@global.innodb_max_purge_lag = 0;
+SET @@global.innodb_max_purge_lag = DEFAULT;
+SELECT @@global.innodb_max_purge_lag;
+
+--echo '#---------------------FN_DYNVARS_046_02-------------------------#'
+############################################################################
+# Check if innodb_max_purge_lag can be accessed with and without @@ sign #
+############################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET innodb_max_purge_lag = 1;
+SELECT @@innodb_max_purge_lag;
+
+--Error ER_UNKNOWN_TABLE
+SELECT local.innodb_max_purge_lag;
+
+SET global innodb_max_purge_lag = 0;
+SELECT @@global.innodb_max_purge_lag;
+
+--echo '#--------------------FN_DYNVARS_046_03------------------------#'
+##########################################################################
+# change the value of innodb_max_purge_lag to a valid value #
+##########################################################################
+
+SET @@global.innodb_max_purge_lag = 0;
+SELECT @@global.innodb_max_purge_lag;
+
+SET @@global.innodb_max_purge_lag = 1;
+SELECT @@global.innodb_max_purge_lag;
+
+SET @@global.innodb_max_purge_lag = 4294967295;
+SELECT @@global.innodb_max_purge_lag;
+
+--echo '#--------------------FN_DYNVARS_046_04------------------------#'
+##########################################################################
+# check the value of innodb_concurrency_tickets for out of bounds #
+##########################################################################
+
+# With a 64 bit mysqld:18446744073709551615,with a 32 bit mysqld: 4294967295
+--disable_warnings
+SET @@global.innodb_max_purge_lag = 4294967296;
+--enable_warnings
+SELECT @@global.innodb_max_purge_lag IN (4294967296,4294967295);
+
+--disable_warnings
+SET @@global.innodb_max_purge_lag = 12345678901;
+--enable_warnings
+SELECT @@global.innodb_max_purge_lag IN (12345678901,4294967295);
+
+--disable_warnings
+SET @@global.innodb_max_purge_lag = 18446744073709551615;
+--enable_warnings
+SELECT @@global.innodb_max_purge_lag IN (18446744073709551615,4294967295);
+
+--echo '#--------------------FN_DYNVARS_046_05-------------------------#'
+###########################################################################
+# Change the value of innodb_max_purge_lag to invalid value #
+###########################################################################
+
+SET @@global.innodb_max_purge_lag = -1;
+SELECT @@global.innodb_max_purge_lag;
+
+SET @@global.innodb_max_purge_lag = -1024;
+SELECT @@global.innodb_max_purge_lag;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_max_purge_lag = "T";
+SELECT @@global.innodb_max_purge_lag;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_max_purge_lag = "Y";
+SELECT @@global.innodb_max_purge_lag;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_max_purge_lag = 1.1;
+SELECT @@global.innodb_max_purge_lag;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_max_purge_lag = ' ';
+SELECT @@global.innodb_max_purge_lag;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_max_purge_lag = " ";
+SELECT @@global.innodb_max_purge_lag;
+
+--echo '#----------------------FN_DYNVARS_046_06------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#########################################################################
+
+--disable_warnings
+SELECT @@global.innodb_max_purge_lag =
+ VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='innodb_max_purge_lag';
+--enable_warnings
+SELECT @@global.innodb_max_purge_lag;
+--disable_warnings
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='innodb_max_purge_lag';
+--enable_warnings
+
+--echo '#---------------------FN_DYNVARS_046_07-------------------------#'
+###################################################################
+# Check if ON and OFF values can be used on variable #
+###################################################################
+
+--ERROR ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_max_purge_lag = OFF;
+SELECT @@global.innodb_max_purge_lag;
+
+--ERROR ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_max_purge_lag = ON;
+SELECT @@global.innodb_max_purge_lag;
+
+--echo '#---------------------FN_DYNVARS_046_08----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.innodb_max_purge_lag = TRUE;
+SELECT @@global.innodb_max_purge_lag;
+SET @@global.innodb_max_purge_lag = FALSE;
+SELECT @@global.innodb_max_purge_lag;
+
+##############################
+# Restore initial value #
+##############################
+
+
+SET @@global.innodb_max_purge_lag = @global_start_value;
+SELECT @@global.innodb_max_purge_lag;
+
+###############################################################
+# END OF innodb_max_purge_lag TESTS #
+###############################################################
diff --git a/mysql-test/suite/sys_vars/t/innodb_max_purge_lag_delay_basic.test b/mysql-test/suite/sys_vars/t/innodb_max_purge_lag_delay_basic.test
new file mode 100644
index 00000000..f7580c99
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_max_purge_lag_delay_basic.test
@@ -0,0 +1,45 @@
+# Variable Name: innodb_max_purge_lag_delay
+# Scope: Global #
+# Access Type: Static #
+# Data Type: numeric #
+
+--source include/have_innodb.inc
+
+SELECT @@GLOBAL.innodb_max_purge_lag_delay;
+--echo 0 Expected
+
+SET @@GLOBAL.innodb_max_purge_lag_delay=1;
+
+SELECT COUNT(@@GLOBAL.innodb_max_purge_lag_delay);
+--echo 1 Expected
+
+--disable_warnings
+SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_max_purge_lag_delay';
+--enable_warnings
+--echo 1 Expected
+
+SELECT @@innodb_max_purge_lag_delay = @@GLOBAL.innodb_max_purge_lag_delay;
+--echo 1 Expected
+
+SELECT COUNT(@@innodb_max_purge_lag_delay);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.innodb_max_purge_lag_delay);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.innodb_max_purge_lag_delay);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_BAD_FIELD_ERROR
+SELECT innodb_max_purge_lag_delay = @@SESSION.innodb_max_purge_lag_delay;
+
+set global innodb_max_purge_lag_delay = -1;
+set global innodb_max_purge_lag_delay = 1000000;
+set global innodb_max_purge_lag_delay = 10000000;
+set global innodb_max_purge_lag_delay = 100000000;
+set global innodb_max_purge_lag_delay = 100000001;
+set global innodb_max_purge_lag_delay = 0;
diff --git a/mysql-test/suite/sys_vars/t/innodb_max_undo_log_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_max_undo_log_size_basic.test
new file mode 100644
index 00000000..e311d6fb
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_max_undo_log_size_basic.test
@@ -0,0 +1,103 @@
+
+
+############### mysql-test\t\innodb_max_undo_log_size_basic.test ###############
+# #
+# Variable Name: innodb_max_undo_log_size #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: numeric #
+# #
+# #
+# Creation Date: 2014-27-05 #
+# Author : Krunal Bauskar #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable innodb_max_undo_log_size #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+
+--echo '#---------------------BS_STVARS_035_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.innodb_max_undo_log_size);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_035_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+SET @save = @@GLOBAL.innodb_max_undo_log_size;
+
+SET @@GLOBAL.innodb_max_undo_log_size=1073741824;
+
+SELECT COUNT(@@GLOBAL.innodb_max_undo_log_size);
+--echo 1 Expected
+
+SET @@GLOBAL.innodb_max_undo_log_size=18446744073709551615;
+SELECT FLOOR(@@GLOBAL.innodb_max_undo_log_size / @@GLOBAL.innodb_page_size);
+--echo 4294967296 Expected
+
+SET @@GLOBAL.innodb_max_undo_log_size=1073741824;
+
+SET GLOBAL innodb_max_undo_log_size = @save;
+
+--echo '#---------------------BS_STVARS_035_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+--disable_warnings
+SELECT @@GLOBAL.innodb_max_undo_log_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_max_undo_log_size';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.innodb_max_undo_log_size);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_max_undo_log_size';
+--echo 1 Expected
+--enable_warnings
+
+
+--echo '#---------------------BS_STVARS_035_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@innodb_max_undo_log_size = @@GLOBAL.innodb_max_undo_log_size;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_035_05----------------------#'
+################################################################################
+# Check if innodb_max_undo_log_size can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@innodb_max_undo_log_size);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.innodb_max_undo_log_size);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.innodb_max_undo_log_size);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.innodb_max_undo_log_size);
+--echo 1 Expected
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_merge_threshold_set_all_debug_basic.test b/mysql-test/suite/sys_vars/t/innodb_merge_threshold_set_all_debug_basic.test
new file mode 100644
index 00000000..0ea30277
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_merge_threshold_set_all_debug_basic.test
@@ -0,0 +1,30 @@
+--echo #
+--echo # Basic test for innodb_merge_threshold_set_all_debug
+--echo #
+
+--source include/have_innodb.inc
+
+# The config variable is a debug variable
+-- source include/have_debug.inc
+
+SELECT @@global.innodb_merge_threshold_set_all_debug;
+
+set global innodb_merge_threshold_set_all_debug = 1;
+
+SELECT @@global.innodb_merge_threshold_set_all_debug;
+
+set global innodb_merge_threshold_set_all_debug = 51;
+
+SELECT @@global.innodb_merge_threshold_set_all_debug;
+
+set global innodb_merge_threshold_set_all_debug = 0;
+
+SELECT @@global.innodb_merge_threshold_set_all_debug;
+
+--error ER_GLOBAL_VARIABLE
+set innodb_merge_threshold_set_all_debug = 50;
+
+set global innodb_merge_threshold_set_all_debug = 50;
+
+SELECT @@global.innodb_merge_threshold_set_all_debug;
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_numa_interleave_basic-master.opt b/mysql-test/suite/sys_vars/t/innodb_numa_interleave_basic-master.opt
new file mode 100644
index 00000000..c1c2bb26
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_numa_interleave_basic-master.opt
@@ -0,0 +1 @@
+--loose-innodb_numa_interleave=1
diff --git a/mysql-test/suite/sys_vars/t/innodb_numa_interleave_basic.test b/mysql-test/suite/sys_vars/t/innodb_numa_interleave_basic.test
new file mode 100644
index 00000000..fcbf766a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_numa_interleave_basic.test
@@ -0,0 +1,15 @@
+--source include/have_innodb.inc
+--source include/have_numa.inc
+
+call mtr.add_suppression("InnoDB: Failed to set NUMA memory policy");
+
+SELECT @@GLOBAL.innodb_numa_interleave;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.innodb_numa_interleave=off;
+
+SELECT @@GLOBAL.innodb_numa_interleave;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@SESSION.innodb_numa_interleave;
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_old_blocks_pct_basic.test b/mysql-test/suite/sys_vars/t/innodb_old_blocks_pct_basic.test
new file mode 100644
index 00000000..1f72fc25
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_old_blocks_pct_basic.test
@@ -0,0 +1,83 @@
+
+
+# 2010-01-25 - Added
+#
+
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_old_blocks_pct;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+--echo Valid values are between 5 and 95
+select @@global.innodb_old_blocks_pct between 5 and 95;
+select @@global.innodb_old_blocks_pct;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_old_blocks_pct;
+show global variables like 'innodb_old_blocks_pct';
+show session variables like 'innodb_old_blocks_pct';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_old_blocks_pct';
+select * from information_schema.session_variables where variable_name='innodb_old_blocks_pct';
+--enable_warnings
+
+#
+# show that it's writable
+#
+set global innodb_old_blocks_pct=10;
+select @@global.innodb_old_blocks_pct;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_old_blocks_pct';
+select * from information_schema.session_variables where variable_name='innodb_old_blocks_pct';
+--enable_warnings
+--error ER_GLOBAL_VARIABLE
+set session innodb_old_blocks_pct=1;
+
+#
+# check the default value
+#
+set @@global.innodb_old_blocks_pct=DEFAULT;
+select @@global.innodb_old_blocks_pct;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_old_blocks_pct=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_old_blocks_pct=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_old_blocks_pct="foo";
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_old_blocks_pct=" ";
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_old_blocks_pct='';
+
+set global innodb_old_blocks_pct=4;
+select @@global.innodb_old_blocks_pct;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_old_blocks_pct';
+--enable_warnings
+set global innodb_old_blocks_pct=-7;
+select @@global.innodb_old_blocks_pct;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_old_blocks_pct';
+--enable_warnings
+set global innodb_old_blocks_pct=96;
+select @@global.innodb_old_blocks_pct;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_old_blocks_pct';
+--enable_warnings
+
+#
+# min/max values
+#
+set global innodb_old_blocks_pct=5;
+select @@global.innodb_old_blocks_pct;
+set global innodb_old_blocks_pct=95;
+select @@global.innodb_old_blocks_pct;
+
+SET @@global.innodb_old_blocks_pct = @start_global_value;
+SELECT @@global.innodb_old_blocks_pct;
diff --git a/mysql-test/suite/sys_vars/t/innodb_old_blocks_time_basic.test b/mysql-test/suite/sys_vars/t/innodb_old_blocks_time_basic.test
new file mode 100644
index 00000000..d05e7244
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_old_blocks_time_basic.test
@@ -0,0 +1,58 @@
+
+#
+# 2010-01-25 - Added
+#
+
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_old_blocks_time;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+--echo Valid values are zero or above
+select @@global.innodb_old_blocks_time >=0;
+select @@global.innodb_old_blocks_time;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_old_blocks_time;
+show global variables like 'innodb_old_blocks_time';
+show session variables like 'innodb_old_blocks_time';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_old_blocks_time';
+select * from information_schema.session_variables where variable_name='innodb_old_blocks_time';
+--enable_warnings
+
+#
+# show that it's writable
+#
+set global innodb_old_blocks_time=10;
+select @@global.innodb_old_blocks_time;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_old_blocks_time';
+select * from information_schema.session_variables where variable_name='innodb_old_blocks_time';
+--enable_warnings
+--error ER_GLOBAL_VARIABLE
+set session innodb_old_blocks_time=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_old_blocks_time=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_old_blocks_time=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_old_blocks_time="foo";
+
+set global innodb_old_blocks_time=-7;
+select @@global.innodb_old_blocks_time;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_old_blocks_time';
+--enable_warnings
+
+#
+# cleanup
+#
+SET @@global.innodb_old_blocks_time = @start_global_value;
+SELECT @@global.innodb_old_blocks_time;
diff --git a/mysql-test/suite/sys_vars/t/innodb_online_alter_log_max_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_online_alter_log_max_size_basic.test
new file mode 100644
index 00000000..b86f04ca
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_online_alter_log_max_size_basic.test
@@ -0,0 +1,57 @@
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_online_alter_log_max_size;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+select @@global.innodb_online_alter_log_max_size >= 524288;
+select @@global.innodb_online_alter_log_max_size;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_online_alter_log_max_size;
+show global variables like 'innodb_online_alter_log_max_size';
+show session variables like 'innodb_online_alter_log_max_size';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_online_alter_log_max_size';
+select * from information_schema.session_variables where variable_name='innodb_online_alter_log_max_size';
+--enable_warnings
+
+#
+# show that it's writable
+#
+set global innodb_online_alter_log_max_size=1048576;
+select @@global.innodb_online_alter_log_max_size;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_online_alter_log_max_size';
+select * from information_schema.session_variables where variable_name='innodb_online_alter_log_max_size';
+--enable_warnings
+set @@global.innodb_online_alter_log_max_size=524288;
+select @@global.innodb_online_alter_log_max_size;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_online_alter_log_max_size';
+select * from information_schema.session_variables where variable_name='innodb_online_alter_log_max_size';
+--enable_warnings
+--error ER_GLOBAL_VARIABLE
+set session innodb_online_alter_log_max_size='some';
+--error ER_GLOBAL_VARIABLE
+set @@session.innodb_online_alter_log_max_size='some';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_online_alter_log_max_size=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_online_alter_log_max_size='foo';
+set global innodb_online_alter_log_max_size=-2;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_online_alter_log_max_size=1e1;
+set global innodb_online_alter_log_max_size=2;
+
+#
+# Cleanup
+#
+
+SET @@global.innodb_online_alter_log_max_size = @start_global_value;
+SELECT @@global.innodb_online_alter_log_max_size;
diff --git a/mysql-test/suite/sys_vars/t/innodb_open_files_basic.test b/mysql-test/suite/sys_vars/t/innodb_open_files_basic.test
new file mode 100644
index 00000000..d6b7c857
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_open_files_basic.test
@@ -0,0 +1,106 @@
+
+
+################## mysql-test\t\innodb_open_files_basic.test ##################
+# #
+# Variable Name: innodb_open_files #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: numeric #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable innodb_open_files #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+
+--echo '#---------------------BS_STVARS_038_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.innodb_open_files);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_038_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.innodb_open_files=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.innodb_open_files);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_038_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+--disable_warnings
+SELECT @@GLOBAL.innodb_open_files = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_open_files';
+--enable_warnings
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.innodb_open_files);
+--echo 1 Expected
+
+--disable_warnings
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_open_files';
+--enable_warnings
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_038_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@innodb_open_files = @@GLOBAL.innodb_open_files;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_038_05----------------------#'
+################################################################################
+# Check if innodb_open_files can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@innodb_open_files);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.innodb_open_files);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.innodb_open_files);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.innodb_open_files);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT innodb_open_files = @@SESSION.innodb_open_files;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_optimize_fulltext_only_basic.test b/mysql-test/suite/sys_vars/t/innodb_optimize_fulltext_only_basic.test
new file mode 100644
index 00000000..08b8c137
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_optimize_fulltext_only_basic.test
@@ -0,0 +1,82 @@
+
+
+# 2011-11-16 - Added
+#
+
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_optimize_fulltext_only;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+--echo Valid values are 'ON' and 'OFF'
+select @@global.innodb_optimize_fulltext_only in (0, 1);
+select @@global.innodb_optimize_fulltext_only;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_optimize_fulltext_only;
+show global variables like 'innodb_optimize_fulltext_only';
+show session variables like 'innodb_optimize_fulltext_only';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_optimize_fulltext_only';
+select * from information_schema.session_variables where variable_name='innodb_optimize_fulltext_only';
+--enable_warnings
+
+#
+# show that it's writable
+#
+set global innodb_optimize_fulltext_only='ON';
+select @@global.innodb_optimize_fulltext_only;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_optimize_fulltext_only';
+select * from information_schema.session_variables where variable_name='innodb_optimize_fulltext_only';
+--enable_warnings
+set @@global.innodb_optimize_fulltext_only=0;
+select @@global.innodb_optimize_fulltext_only;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_optimize_fulltext_only';
+select * from information_schema.session_variables where variable_name='innodb_optimize_fulltext_only';
+--enable_warnings
+set global innodb_optimize_fulltext_only=1;
+select @@global.innodb_optimize_fulltext_only;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_optimize_fulltext_only';
+select * from information_schema.session_variables where variable_name='innodb_optimize_fulltext_only';
+--enable_warnings
+set @@global.innodb_optimize_fulltext_only='OFF';
+select @@global.innodb_optimize_fulltext_only;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_optimize_fulltext_only';
+select * from information_schema.session_variables where variable_name='innodb_optimize_fulltext_only';
+--enable_warnings
+--error ER_GLOBAL_VARIABLE
+set session innodb_optimize_fulltext_only='OFF';
+--error ER_GLOBAL_VARIABLE
+set @@session.innodb_optimize_fulltext_only='ON';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_optimize_fulltext_only=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_optimize_fulltext_only=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_optimize_fulltext_only=2;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_optimize_fulltext_only=-3;
+select @@global.innodb_optimize_fulltext_only;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_optimize_fulltext_only';
+select * from information_schema.session_variables where variable_name='innodb_optimize_fulltext_only';
+--enable_warnings
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_optimize_fulltext_only='AUTO';
+
+#
+# Cleanup
+#
+
+SET @@global.innodb_optimize_fulltext_only = @start_global_value;
+SELECT @@global.innodb_optimize_fulltext_only;
diff --git a/mysql-test/suite/sys_vars/t/innodb_page_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_page_size_basic.test
new file mode 100644
index 00000000..1d4f9353
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_page_size_basic.test
@@ -0,0 +1,16 @@
+#
+# Basic test for innodb_page_size
+#
+
+-- source include/have_innodb.inc
+
+# Check the default value
+SET @orig = @@global.innodb_page_size;
+--replace_result 65536 {valid_page_size} 32768 {valid_page_size} 16384 {valid_page_size} 8192 {valid_page_size} 4096 {valid_page_size}
+SELECT @orig;
+
+# Confirm that we can not change the value
+-- error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET GLOBAL innodb_page_size = 4k;
+-- error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET GLOBAL innodb_page_size = 8k;
diff --git a/mysql-test/suite/sys_vars/t/innodb_print_all_deadlocks_basic.test b/mysql-test/suite/sys_vars/t/innodb_print_all_deadlocks_basic.test
new file mode 100644
index 00000000..5693a829
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_print_all_deadlocks_basic.test
@@ -0,0 +1,93 @@
+
+# 2010-01-25 - Added
+#
+
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_print_all_deadlocks;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+--echo Valid values are 'ON' and 'OFF'
+SELECT @@global.innodb_print_all_deadlocks in (0, 1);
+SELECT @@global.innodb_print_all_deadlocks;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.innodb_print_all_deadlocks;
+SHOW global variables LIKE 'innodb_print_all_deadlocks';
+SHOW session variables LIKE 'innodb_print_all_deadlocks';
+--disable_warnings
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_print_all_deadlocks';
+SELECT * FROM information_schema.session_variables
+WHERE variable_name='innodb_print_all_deadlocks';
+--enable_warnings
+
+#
+# SHOW that it's writable
+#
+SET global innodb_print_all_deadlocks='OFF';
+SELECT @@global.innodb_print_all_deadlocks;
+--disable_warnings
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_print_all_deadlocks';
+SELECT * FROM information_schema.session_variables
+WHERE variable_name='innodb_print_all_deadlocks';
+--enable_warnings
+SET @@global.innodb_print_all_deadlocks=1;
+SELECT @@global.innodb_print_all_deadlocks;
+--disable_warnings
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_print_all_deadlocks';
+SELECT * FROM information_schema.session_variables
+WHERE variable_name='innodb_print_all_deadlocks';
+--enable_warnings
+SET global innodb_print_all_deadlocks=0;
+SELECT @@global.innodb_print_all_deadlocks;
+--disable_warnings
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_print_all_deadlocks';
+SELECT * FROM information_schema.session_variables
+WHERE variable_name='innodb_print_all_deadlocks';
+--enable_warnings
+SET @@global.innodb_print_all_deadlocks='ON';
+SELECT @@global.innodb_print_all_deadlocks;
+--disable_warnings
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_print_all_deadlocks';
+SELECT * FROM information_schema.session_variables
+WHERE variable_name='innodb_print_all_deadlocks';
+--enable_warnings
+--error ER_GLOBAL_VARIABLE
+SET session innodb_print_all_deadlocks='OFF';
+--error ER_GLOBAL_VARIABLE
+SET @@session.innodb_print_all_deadlocks='ON';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+SET global innodb_print_all_deadlocks=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+SET global innodb_print_all_deadlocks=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+SET global innodb_print_all_deadlocks=2;
+--error ER_WRONG_VALUE_FOR_VAR
+SET global innodb_print_all_deadlocks=-3;
+SELECT @@global.innodb_print_all_deadlocks;
+--disable_warnings
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_print_all_deadlocks';
+SELECT * FROM information_schema.session_variables
+WHERE variable_name='innodb_print_all_deadlocks';
+--enable_warnings
+--error ER_WRONG_VALUE_FOR_VAR
+SET global innodb_print_all_deadlocks='AUTO';
+
+#
+# Cleanup
+#
+
+SET @@global.innodb_print_all_deadlocks = @start_global_value;
+SELECT @@global.innodb_print_all_deadlocks;
diff --git a/mysql-test/suite/sys_vars/t/innodb_purge_batch_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_purge_batch_size_basic.test
new file mode 100644
index 00000000..4f3dc9f3
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_purge_batch_size_basic.test
@@ -0,0 +1,155 @@
+################# mysql-test\t\innodb_purge_batch_size_basic.test #############
+# #
+# Variable Name: innodb_purge_batch_size #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 20 #
+# Range: 0-4294967295 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+#Description:Test Cases of Dynamic System Variable innodb_purge_batch_size #
+# that checks the behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF innodb_purge_batch_size TESTS #
+########################################################################
+
+
+############################################################################
+# Saving initial value of innodb_purge_batch_size in a temporary variable #
+############################################################################
+
+SET @global_start_value = @@global.innodb_purge_batch_size;
+SELECT @global_start_value;
+
+--echo '#--------------------FN_DYNVARS_046_01------------------------#'
+########################################################################
+# Display the DEFAULT value of innodb_purge_batch_size #
+########################################################################
+
+SET @@global.innodb_purge_batch_size = 1;
+SET @@global.innodb_purge_batch_size = DEFAULT;
+SELECT @@global.innodb_purge_batch_size;
+
+--echo '#---------------------FN_DYNVARS_046_02-------------------------#'
+##############################################################################
+# Check if innodb_purge_batch_size can be accessed with and without @@ sign #
+##############################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET innodb_purge_batch_size = 1;
+SELECT @@innodb_purge_batch_size;
+
+--Error ER_UNKNOWN_TABLE
+SELECT local.innodb_purge_batch_size;
+
+SET global innodb_purge_batch_size = 1;
+SELECT @@global.innodb_purge_batch_size;
+
+--echo '#--------------------FN_DYNVARS_046_03------------------------#'
+##########################################################################
+# change the value of innodb_purge_batch_size to a valid value #
+##########################################################################
+
+SET @@global.innodb_purge_batch_size = 1;
+SELECT @@global.innodb_purge_batch_size;
+
+SET @@global.innodb_purge_batch_size = 5000;
+SELECT @@global.innodb_purge_batch_size;
+SET @@global.innodb_purge_batch_size = 4294967295;
+SELECT @@global.innodb_purge_batch_size;
+
+--echo '#--------------------FN_DYNVARS_046_04-------------------------#'
+###########################################################################
+# Change the value of innodb_purge_batch_size to invalid value #
+###########################################################################
+
+SET @@global.innodb_purge_batch_size = 0;
+SELECT @@global.innodb_purge_batch_size;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_purge_batch_size = "T";
+SELECT @@global.innodb_purge_batch_size;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_purge_batch_size = "Y";
+SELECT @@global.innodb_purge_batch_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_purge_batch_size = ' ';
+SELECT @@global.innodb_purge_batch_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_purge_batch_size = " ";
+SELECT @@global.innodb_purge_batch_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_purge_batch_size = 1.1;
+SELECT @@global.innodb_purge_batch_size;
+
+SET @@global.innodb_purge_batch_size = 4294967297;
+SELECT @@global.innodb_purge_batch_size;
+
+--echo '#----------------------FN_DYNVARS_046_05------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#########################################################################
+
+--disable_warnings
+SELECT @@global.innodb_purge_batch_size =
+ VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='innodb_purge_batch_size';
+--enable_warnings
+SELECT @@global.innodb_purge_batch_size;
+--disable_warnings
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='innodb_purge_batch_size';
+--enable_warnings
+
+--echo '#---------------------FN_DYNVARS_046_06-------------------------#'
+###################################################################
+# Check if ON and OFF values can be used on variable #
+###################################################################
+
+--ERROR ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_purge_batch_size = OFF;
+SELECT @@global.innodb_purge_batch_size;
+
+--ERROR ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_purge_batch_size = ON;
+SELECT @@global.innodb_purge_batch_size;
+
+--echo '#---------------------FN_DYNVARS_046_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+
+SET @@global.innodb_purge_batch_size = TRUE;
+SELECT @@global.innodb_purge_batch_size;
+SET @@global.innodb_purge_batch_size = FALSE;
+SELECT @@global.innodb_purge_batch_size;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.innodb_purge_batch_size = @global_start_value;
+SELECT @@global.innodb_purge_batch_size;
+
+###############################################################
+# END OF innodb_purge_batch_size TESTS #
+###############################################################
diff --git a/mysql-test/suite/sys_vars/t/innodb_purge_rseg_truncate_frequency_basic.test b/mysql-test/suite/sys_vars/t/innodb_purge_rseg_truncate_frequency_basic.test
new file mode 100644
index 00000000..e0871ba4
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_purge_rseg_truncate_frequency_basic.test
@@ -0,0 +1,161 @@
+###### mysql-test\t\innodb_purge_rseg_truncate_frequency_basic.test ###########
+# #
+# Variable Name: innodb_purge_rseg_truncate_frequency #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 128 #
+# Range: 1 - 128 #
+# #
+# #
+# Creation Date: 2014-27-05 #
+# Author: Krunal Bauskar #
+# #
+#Description:Test Cases of Dynamic System Variable #
+# innodb_purge_rseg_truncate_frequency #
+# that checks the behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF innodb_purge_rseg_truncate_frequency TESTS #
+########################################################################
+
+###############################################################################
+# Saving initial value of innodb_purge_rseg_truncate_frequency in a #
+# temporary variable #
+###############################################################################
+
+SET @global_start_value = @@global.innodb_purge_rseg_truncate_frequency;
+SELECT @global_start_value;
+
+--echo '#--------------------FN_DYNVARS_046_01------------------------#'
+########################################################################
+# Display the DEFAULT value of innodb_purge_rseg_truncate_frequency #
+########################################################################
+
+SET @@global.innodb_purge_rseg_truncate_frequency = 1;
+SET @@global.innodb_purge_rseg_truncate_frequency = DEFAULT;
+SELECT @@global.innodb_purge_rseg_truncate_frequency;
+
+--echo '#---------------------FN_DYNVARS_046_02-------------------------#'
+############################################################################
+# Check if innodb_purge_rseg_truncate_frequency can be accessed with and #
+# without @@ sign #
+############################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET innodb_purge_rseg_truncate_frequency = 1;
+SELECT @@innodb_purge_rseg_truncate_frequency;
+
+--Error ER_UNKNOWN_TABLE
+SELECT local.innodb_purge_rseg_truncate_frequency;
+
+SET global innodb_purge_rseg_truncate_frequency = 1;
+SELECT @@global.innodb_purge_rseg_truncate_frequency;
+
+--echo '#--------------------FN_DYNVARS_046_03------------------------#'
+##########################################################################
+# change the value of innodb_purge_rseg_truncate_frequency to a valid #
+# value #
+##########################################################################
+
+SET @@global.innodb_purge_rseg_truncate_frequency = 1;
+SELECT @@global.innodb_purge_rseg_truncate_frequency;
+
+SET @@global.innodb_purge_rseg_truncate_frequency = 1;
+SELECT @@global.innodb_purge_rseg_truncate_frequency;
+
+SET @@global.innodb_purge_rseg_truncate_frequency = 128;
+SELECT @@global.innodb_purge_rseg_truncate_frequency;
+
+--echo '#--------------------FN_DYNVARS_046_05-------------------------#'
+###########################################################################
+# Change the value of innodb_purge_rseg_truncate_frequency to #
+# invalid value #
+###########################################################################
+
+SET @@global.innodb_purge_rseg_truncate_frequency = -1;
+SELECT @@global.innodb_purge_rseg_truncate_frequency;
+
+SET @@global.innodb_purge_rseg_truncate_frequency = -1024;
+SELECT @@global.innodb_purge_rseg_truncate_frequency;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_purge_rseg_truncate_frequency = "T";
+SELECT @@global.innodb_purge_rseg_truncate_frequency;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_purge_rseg_truncate_frequency = "Y";
+SELECT @@global.innodb_purge_rseg_truncate_frequency;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_purge_rseg_truncate_frequency = 1.1;
+SELECT @@global.innodb_purge_rseg_truncate_frequency;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_purge_rseg_truncate_frequency = ' ';
+SELECT @@global.innodb_purge_rseg_truncate_frequency;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_purge_rseg_truncate_frequency = " ";
+SELECT @@global.innodb_purge_rseg_truncate_frequency;
+
+--echo '#----------------------FN_DYNVARS_046_06------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#########################################################################
+
+--disable_warnings
+SELECT @@global.innodb_purge_rseg_truncate_frequency =
+ VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='innodb_purge_rseg_truncate_frequency';
+SELECT @@global.innodb_purge_rseg_truncate_frequency;
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='innodb_purge_rseg_truncate_frequency';
+--enable_warnings
+
+--echo '#---------------------FN_DYNVARS_046_07-------------------------#'
+###################################################################
+# Check if ON and OFF values can be used on variable #
+###################################################################
+
+--ERROR ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_purge_rseg_truncate_frequency = OFF;
+SELECT @@global.innodb_purge_rseg_truncate_frequency;
+
+--ERROR ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_purge_rseg_truncate_frequency = ON;
+SELECT @@global.innodb_purge_rseg_truncate_frequency;
+
+--echo '#---------------------FN_DYNVARS_046_08----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.innodb_purge_rseg_truncate_frequency = TRUE;
+SELECT @@global.innodb_purge_rseg_truncate_frequency;
+SET @@global.innodb_purge_rseg_truncate_frequency = FALSE;
+SELECT @@global.innodb_purge_rseg_truncate_frequency;
+
+##############################
+# Restore initial value #
+##############################
+
+
+SET @@global.innodb_purge_rseg_truncate_frequency = @global_start_value;
+SELECT @@global.innodb_purge_rseg_truncate_frequency;
+
+###############################################################
+# END OF innodb_purge_rseg_truncate_frequency TESTS #
+###############################################################
diff --git a/mysql-test/suite/sys_vars/t/innodb_purge_threads_basic.test b/mysql-test/suite/sys_vars/t/innodb_purge_threads_basic.test
new file mode 100644
index 00000000..1156fa40
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_purge_threads_basic.test
@@ -0,0 +1,63 @@
+# Variable name: innodb_purge_threads
+# Scope: Global
+# Access type: Static
+# Data type: numeric
+
+--source include/have_innodb.inc
+
+SELECT COUNT(@@GLOBAL.innodb_purge_threads);
+--echo 1 Expected
+
+SELECT COUNT(@@innodb_purge_threads);
+--echo 1 Expected
+
+SET @save_threads = @@GLOBAL.innodb_purge_threads;
+
+SET @@GLOBAL.innodb_purge_threads=-1;
+SELECT @@GLOBAL.innodb_purge_threads;
+SET @@GLOBAL.innodb_purge_threads=0;
+SELECT @@GLOBAL.innodb_purge_threads;
+SET @@GLOBAL.innodb_purge_threads=33;
+SELECT @@GLOBAL.innodb_purge_threads;
+
+SET @@GLOBAL.innodb_purge_threads=1;
+SET @@GLOBAL.innodb_purge_threads=32;
+
+--Error ER_BAD_FIELD_ERROR
+SELECT innodb_purge_threads = @@SESSION.innodb_purge_threads;
+--echo Expected error 'Read-only variable'
+
+--disable_warnings
+SELECT @@GLOBAL.innodb_purge_threads = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_purge_threads';
+--enable_warnings
+--echo 1 Expected
+
+--disable_warnings
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_purge_threads';
+--enable_warnings
+--echo 1 Expected
+
+SELECT @@innodb_purge_threads = @@GLOBAL.innodb_purge_threads;
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.innodb_purge_threads);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.innodb_purge_threads);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+# Check the default value
+--disable_warnings
+SELECT VARIABLE_NAME, VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME = 'innodb_purge_threads';
+--enable_warnings
+
+
+SET GLOBAL innodb_purge_threads = @save_threads;
diff --git a/mysql-test/suite/sys_vars/t/innodb_random_read_ahead_basic.test b/mysql-test/suite/sys_vars/t/innodb_random_read_ahead_basic.test
new file mode 100644
index 00000000..a805fc80
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_random_read_ahead_basic.test
@@ -0,0 +1,82 @@
+
+
+# 2010-01-25 - Added
+#
+
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_random_read_ahead;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+--echo Valid values are 'ON' and 'OFF'
+select @@global.innodb_random_read_ahead in (0, 1);
+select @@global.innodb_random_read_ahead;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_random_read_ahead;
+show global variables like 'innodb_random_read_ahead';
+show session variables like 'innodb_random_read_ahead';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_random_read_ahead';
+select * from information_schema.session_variables where variable_name='innodb_random_read_ahead';
+--enable_warnings
+
+#
+# show that it's writable
+#
+set global innodb_random_read_ahead='ON';
+select @@global.innodb_random_read_ahead;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_random_read_ahead';
+select * from information_schema.session_variables where variable_name='innodb_random_read_ahead';
+--enable_warnings
+set @@global.innodb_random_read_ahead=0;
+select @@global.innodb_random_read_ahead;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_random_read_ahead';
+select * from information_schema.session_variables where variable_name='innodb_random_read_ahead';
+--enable_warnings
+set global innodb_random_read_ahead=1;
+select @@global.innodb_random_read_ahead;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_random_read_ahead';
+select * from information_schema.session_variables where variable_name='innodb_random_read_ahead';
+--enable_warnings
+set @@global.innodb_random_read_ahead='OFF';
+select @@global.innodb_random_read_ahead;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_random_read_ahead';
+select * from information_schema.session_variables where variable_name='innodb_random_read_ahead';
+--enable_warnings
+--error ER_GLOBAL_VARIABLE
+set session innodb_random_read_ahead='OFF';
+--error ER_GLOBAL_VARIABLE
+set @@session.innodb_random_read_ahead='ON';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_random_read_ahead=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_random_read_ahead=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_random_read_ahead=2;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_random_read_ahead=-3;
+select @@global.innodb_random_read_ahead;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_random_read_ahead';
+select * from information_schema.session_variables where variable_name='innodb_random_read_ahead';
+--enable_warnings
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_random_read_ahead='AUTO';
+
+#
+# Cleanup
+#
+
+SET @@global.innodb_random_read_ahead = @start_global_value;
+SELECT @@global.innodb_random_read_ahead;
diff --git a/mysql-test/suite/sys_vars/t/innodb_read_ahead_threshold_basic.test b/mysql-test/suite/sys_vars/t/innodb_read_ahead_threshold_basic.test
new file mode 100644
index 00000000..65bb9c03
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_read_ahead_threshold_basic.test
@@ -0,0 +1,79 @@
+
+
+# 2010-01-27 - Added
+#
+
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_read_ahead_threshold;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+--echo Valid values are between 0 and 64
+select @@global.innodb_read_ahead_threshold between 0 and 64;
+select @@global.innodb_read_ahead_threshold;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_read_ahead_threshold;
+show global variables like 'innodb_read_ahead_threshold';
+show session variables like 'innodb_read_ahead_threshold';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_read_ahead_threshold';
+select * from information_schema.session_variables where variable_name='innodb_read_ahead_threshold';
+--enable_warnings
+
+#
+# show that it's writable
+#
+set global innodb_read_ahead_threshold=10;
+select @@global.innodb_read_ahead_threshold;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_read_ahead_threshold';
+select * from information_schema.session_variables where variable_name='innodb_read_ahead_threshold';
+--enable_warnings
+--error ER_GLOBAL_VARIABLE
+set session innodb_read_ahead_threshold=1;
+#
+# check the default value
+#
+set global innodb_read_ahead_threshold=DEFAULT;
+select @@global.innodb_read_ahead_threshold;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_read_ahead_threshold=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_read_ahead_threshold=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_read_ahead_threshold="foo";
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_read_ahead_threshold=' ';
+select @@global.innodb_read_ahead_threshold;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_read_ahead_threshold=" ";
+select @@global.innodb_read_ahead_threshold;
+
+set global innodb_read_ahead_threshold=-7;
+select @@global.innodb_read_ahead_threshold;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_read_ahead_threshold';
+--enable_warnings
+set global innodb_read_ahead_threshold=96;
+select @@global.innodb_read_ahead_threshold;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_read_ahead_threshold';
+--enable_warnings
+
+#
+# min/max values
+#
+set global innodb_read_ahead_threshold=0;
+select @@global.innodb_read_ahead_threshold;
+set global innodb_read_ahead_threshold=64;
+select @@global.innodb_read_ahead_threshold;
+
+SET @@global.innodb_read_ahead_threshold = @start_global_value;
+SELECT @@global.innodb_read_ahead_threshold;
diff --git a/mysql-test/suite/sys_vars/t/innodb_read_io_threads_basic.opt b/mysql-test/suite/sys_vars/t/innodb_read_io_threads_basic.opt
new file mode 100644
index 00000000..3ead0984
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_read_io_threads_basic.opt
@@ -0,0 +1 @@
+--innodb_read_io_threads=2
diff --git a/mysql-test/suite/sys_vars/t/innodb_read_io_threads_basic.test b/mysql-test/suite/sys_vars/t/innodb_read_io_threads_basic.test
new file mode 100644
index 00000000..14887147
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_read_io_threads_basic.test
@@ -0,0 +1,36 @@
+
+#
+# 2010-01-27 OBN - Added (this variable is also covered in innodb_file_io_threads_basic.test)
+#
+
+--source include/have_innodb.inc
+
+#
+# show the global and session values;
+#
+select @@global.innodb_read_io_threads;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_read_io_threads;
+show global variables like 'innodb_read_io_threads';
+show session variables like 'innodb_read_io_threads';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_read_io_threads';
+select * from information_schema.session_variables where variable_name='innodb_read_io_threads';
+--enable_warnings
+
+#
+# show that it's not read-only
+#
+select @@innodb_read_io_threads into @n;
+--disable_warnings
+set global innodb_read_io_threads = 1;
+--enable_warnings
+select @@innodb_read_io_threads;
+--disable_warnings
+set global innodb_read_io_threads=64;
+--enable_warnings
+select @@innodb_read_io_threads;
+--error ER_GLOBAL_VARIABLE
+set session innodb_read_io_threads=1;
+set global innodb_read_io_threads=@n;
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_read_only_basic.test b/mysql-test/suite/sys_vars/t/innodb_read_only_basic.test
new file mode 100644
index 00000000..31cbe779
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_read_only_basic.test
@@ -0,0 +1,22 @@
+--source include/have_innodb.inc
+
+# Can only be set from the command line.
+# show the global and session values;
+
+--echo Valid values are 'ON' and 'OFF'
+select @@global.innodb_read_only;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_read_only;
+show global variables like 'innodb_read_only';
+show session variables like 'innodb_read_only';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_read_only';
+select * from information_schema.session_variables where variable_name='innodb_read_only';
+--enable_warnings
+
+# Show that it's read-only
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global innodb_read_only=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session innodb_read_only=1;
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_rollback_on_timeout_basic.test b/mysql-test/suite/sys_vars/t/innodb_rollback_on_timeout_basic.test
new file mode 100644
index 00000000..2aee2e25
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_rollback_on_timeout_basic.test
@@ -0,0 +1,106 @@
+
+
+################## mysql-test\t\innodb_rollback_on_timeout_basic.test #########
+# #
+# Variable Name: innodb_rollback_on_timeout #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: boolean #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable innodb_rollback_on_timeout#
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+
+--echo '#---------------------BS_STVARS_039_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.innodb_rollback_on_timeout);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_039_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.innodb_rollback_on_timeout=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.innodb_rollback_on_timeout);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_039_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+--disable_warnings
+SELECT IF(@@GLOBAL.innodb_rollback_on_timeout, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_rollback_on_timeout';
+--enable_warnings
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.innodb_rollback_on_timeout);
+--echo 1 Expected
+
+--disable_warnings
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_rollback_on_timeout';
+--enable_warnings
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_039_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@innodb_rollback_on_timeout = @@GLOBAL.innodb_rollback_on_timeout;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_039_05----------------------#'
+################################################################################
+# Check if innodb_rollback_on_timeout can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@innodb_rollback_on_timeout);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.innodb_rollback_on_timeout);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.innodb_rollback_on_timeout);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.innodb_rollback_on_timeout);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT innodb_rollback_on_timeout = @@SESSION.innodb_rollback_on_timeout;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_saved_page_number_debug_basic.test b/mysql-test/suite/sys_vars/t/innodb_saved_page_number_debug_basic.test
new file mode 100644
index 00000000..d0996ae9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_saved_page_number_debug_basic.test
@@ -0,0 +1,37 @@
+--echo #
+--echo # Basic test for innodb_saved_page_number_debug.
+--echo #
+
+--source include/have_innodb.inc
+
+# The config variable is a debug variable
+-- source include/have_debug.inc
+
+SELECT @@global.innodb_saved_page_number_debug;
+
+set global innodb_saved_page_number_debug = 10;
+
+SELECT @@global.innodb_saved_page_number_debug;
+
+set global innodb_saved_page_number_debug = 100;
+
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_saved_page_number_debug = dummy;
+
+--error ER_GLOBAL_VARIABLE
+set innodb_saved_page_number_debug = ON;
+
+--echo # An example usage.
+create table t1 (f1 int primary key) engine = innodb;
+--enable_prepare_warnings
+select space from information_schema.innodb_sys_tables
+where name = 'test/t1' into @space_id;
+--disable_prepare_warnings
+set global innodb_saved_page_number_debug = 0;
+set global innodb_fil_make_page_dirty_debug = @space_id;
+drop table t1;
+
+set global innodb_saved_page_number_debug = 0;
+
+SELECT @@global.innodb_saved_page_number_debug;
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_sort_buffer_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_sort_buffer_size_basic.test
new file mode 100644
index 00000000..49318c00
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_sort_buffer_size_basic.test
@@ -0,0 +1,28 @@
+
+#
+# 2011-11-17 - Added
+#
+
+--source include/have_innodb.inc
+
+#
+# show the global and session values;
+#
+select @@global.innodb_sort_buffer_size;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_sort_buffer_size;
+show global variables like 'innodb_sort_buffer_size';
+show session variables like 'innodb_sort_buffer_size';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_sort_buffer_size';
+select * from information_schema.session_variables where variable_name='innodb_sort_buffer_size';
+--enable_warnings
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global innodb_sort_buffer_size=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session innodb_sort_buffer_size=1;
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_spin_wait_delay_basic.test b/mysql-test/suite/sys_vars/t/innodb_spin_wait_delay_basic.test
new file mode 100644
index 00000000..d144d24a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_spin_wait_delay_basic.test
@@ -0,0 +1,92 @@
+
+#
+# 2010-01-27 - Added
+#
+
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_spin_wait_delay;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+--echo Valid values are zero or above
+select @@global.innodb_spin_wait_delay >=0;
+select @@global.innodb_spin_wait_delay;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_spin_wait_delay;
+show global variables like 'innodb_spin_wait_delay';
+show session variables like 'innodb_spin_wait_delay';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_spin_wait_delay';
+select * from information_schema.session_variables where variable_name='innodb_spin_wait_delay';
+--enable_warnings
+
+#
+# show that it's writable
+#
+set global innodb_spin_wait_delay=10;
+select @@global.innodb_spin_wait_delay;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_spin_wait_delay';
+select * from information_schema.session_variables where variable_name='innodb_spin_wait_delay';
+--enable_warnings
+--error ER_GLOBAL_VARIABLE
+set session innodb_spin_wait_delay=1;
+
+#
+# check the default value
+#
+set global innodb_spin_wait_delay=DEFAULT;
+select @@global.innodb_spin_wait_delay;
+
+#
+# valid values
+#
+set global innodb_spin_wait_delay=0;
+select @@global.innodb_spin_wait_delay;
+set global innodb_spin_wait_delay=5000;
+select @@global.innodb_spin_wait_delay;
+#
+# invalid values
+#
+set global innodb_spin_wait_delay=65535;
+select @@global.innodb_spin_wait_delay;
+set global innodb_spin_wait_delay=4294967295;
+select @@global.innodb_spin_wait_delay;
+set @@global.innodb_spin_wait_delay = 4294967296;
+select @@global.innodb_spin_wait_delay;
+set @@global.innodb_spin_wait_delay = 12345678901;
+select @@global.innodb_spin_wait_delay;
+set @@global.innodb_spin_wait_delay = 18446744073709551615;
+select @@global.innodb_spin_wait_delay;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_spin_wait_delay=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_spin_wait_delay=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_spin_wait_delay="foo";
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_spin_wait_delay=' ';
+select @@global.innodb_spin_wait_delay;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_spin_wait_delay=" ";
+select @@global.innodb_spin_wait_delay;
+set global innodb_spin_wait_delay=-7;
+select @@global.innodb_spin_wait_delay;
+set global innodb_spin_wait_delay=-1024;
+select @@global.innodb_spin_wait_delay;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_spin_wait_delay';
+--enable_warnings
+
+#
+# cleanup
+#
+SET @@global.innodb_spin_wait_delay = @start_global_value;
+SELECT @@global.innodb_spin_wait_delay;
diff --git a/mysql-test/suite/sys_vars/t/innodb_stats_auto_recalc_basic.test b/mysql-test/suite/sys_vars/t/innodb_stats_auto_recalc_basic.test
new file mode 100644
index 00000000..0020c493
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_stats_auto_recalc_basic.test
@@ -0,0 +1,31 @@
+#
+# innodb_stats_auto_recalc
+#
+
+-- source include/have_innodb.inc
+
+# show the default value
+SELECT @@innodb_stats_auto_recalc;
+
+# check that it is writeable
+SET GLOBAL innodb_stats_auto_recalc=ON;
+SELECT @@innodb_stats_auto_recalc;
+
+SET GLOBAL innodb_stats_auto_recalc=OFF;
+SELECT @@innodb_stats_auto_recalc;
+
+SET GLOBAL innodb_stats_auto_recalc=1;
+SELECT @@innodb_stats_auto_recalc;
+
+SET GLOBAL innodb_stats_auto_recalc=0;
+SELECT @@innodb_stats_auto_recalc;
+
+# should be a boolean
+-- error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL innodb_stats_auto_recalc=123;
+
+-- error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL innodb_stats_auto_recalc='foo';
+
+# restore the environment
+SET GLOBAL innodb_stats_auto_recalc=default;
diff --git a/mysql-test/suite/sys_vars/t/innodb_stats_include_delete_marked_basic.test b/mysql-test/suite/sys_vars/t/innodb_stats_include_delete_marked_basic.test
new file mode 100644
index 00000000..2a3a0f9b
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_stats_include_delete_marked_basic.test
@@ -0,0 +1,53 @@
+###############################################################################
+# #
+# Variable Name: innodb_stats_include_delete_marked #
+# Scope: Global #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# #
+# #
+# Creation Date: 2016-08-29 #
+# Author : Aditya #
+# #
+# #
+# Description: #
+# * Value check #
+# * Scope check #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+
+####################################################################
+# Display default value #
+####################################################################
+SELECT @@innodb_stats_include_delete_marked;
+
+SET GLOBAL innodb_stats_include_delete_marked=1;
+
+SELECT @@innodb_stats_include_delete_marked;
+
+# check error
+--error ER_GLOBAL_VARIABLE
+SET SESSION innodb_stats_include_delete_marked=1;
+
+# check error
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL innodb_stats_include_delete_marked=100;
+
+# check error
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL innodb_stats_include_delete_marked=foo;
+
+SET GLOBAL innodb_stats_include_delete_marked=OFF ;
+
+SELECT @@innodb_stats_include_delete_marked;
+
+SET GLOBAL innodb_stats_include_delete_marked=ON ;
+
+SELECT @@innodb_stats_include_delete_marked;
+
+# Check with default setting
+SET GLOBAL innodb_stats_include_delete_marked=Default ;
+
+SELECT @@innodb_stats_include_delete_marked;
diff --git a/mysql-test/suite/sys_vars/t/innodb_stats_method_basic.test b/mysql-test/suite/sys_vars/t/innodb_stats_method_basic.test
new file mode 100644
index 00000000..77288dfb
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_stats_method_basic.test
@@ -0,0 +1,80 @@
+#
+# 2011-08-05 - Added
+#
+
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_stats_method;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+--echo Valid values are 'nulls_equal', 'nulls_unequal', 'nulls_ignored'
+SELECT @@global.innodb_stats_method in ('nulls_equal', 'nulls_unequal',
+'nulls_ignored');
+SELECT @@global.innodb_stats_method;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.innodb_stats_method;
+SHOW global variables LIKE 'innodb_stats_method';
+SHOW session variables LIKE 'innodb_stats_method';
+--disable_warnings
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_stats_method';
+SELECT * FROM information_schema.session_variables
+WHERE variable_name='innodb_stats_method';
+--enable_warnings
+
+#
+# show that it's writable
+#
+SET global innodb_stats_method='nulls_equal';
+SELECT @@global.innodb_stats_method;
+--disable_warnings
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_stats_method';
+SELECT * FROM information_schema.session_variables
+WHERE variable_name='innodb_stats_method';
+--enable_warnings
+SET @@global.innodb_stats_method='nulls_unequal';
+SELECT @@global.innodb_stats_method;
+--disable_warnings
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_stats_method';
+SELECT * FROM information_schema.session_variables
+WHERE variable_name='innodb_stats_method';
+--enable_warnings
+SET global innodb_stats_method=2;
+SELECT @@global.innodb_stats_method;
+--disable_warnings
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_stats_method';
+SELECT * FROM information_schema.session_variables
+WHERE variable_name='innodb_stats_method';
+--enable_warnings
+
+--error ER_GLOBAL_VARIABLE
+SET session innodb_stats_method='nulls_equal';
+--error ER_GLOBAL_VARIABLE
+SET @@session.innodb_stats_method='nulls_ignored';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+SET global innodb_stats_method=1.1;
+--error ER_WRONG_VALUE_FOR_VAR
+SET global innodb_stats_method=4;
+--error ER_WRONG_VALUE_FOR_VAR
+SET global innodb_stats_method=-2;
+--error ER_WRONG_TYPE_FOR_VAR
+SET global innodb_stats_method=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+SET global innodb_stats_method='some';
+
+#
+# Cleanup
+#
+
+SET @@global.innodb_stats_method = @start_global_value;
+SELECT @@global.innodb_stats_method;
diff --git a/mysql-test/suite/sys_vars/t/innodb_stats_modified_counter_basic.test b/mysql-test/suite/sys_vars/t/innodb_stats_modified_counter_basic.test
new file mode 100644
index 00000000..98fc8049
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_stats_modified_counter_basic.test
@@ -0,0 +1,47 @@
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_stats_modified_counter;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+--echo Valid values are one or above
+select @@global.innodb_stats_modified_counter >=1;
+select @@global.innodb_stats_modified_counter;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_stats_modified_counter;
+show global variables like 'innodb_stats_modified_counter';
+show session variables like 'innodb_stats_modified_counter';
+select * from information_schema.global_variables where variable_name='innodb_stats_modified_counter';
+select * from information_schema.session_variables where variable_name='innodb_stats_modified_counter';
+
+#
+# show that it's writable
+#
+set global innodb_stats_modified_counter=10;
+select @@global.innodb_stats_modified_counter;
+select * from information_schema.global_variables where variable_name='innodb_stats_modified_counter';
+select * from information_schema.session_variables where variable_name='innodb_stats_modified_counter';
+--error ER_GLOBAL_VARIABLE
+set session innodb_stats_modified_counter=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_stats_modified_counter=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_stats_modified_counter=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_stats_modified_counter="foo";
+
+set global innodb_stats_modified_counter=-7;
+select @@global.innodb_stats_modified_counter;
+select * from information_schema.global_variables where variable_name='innodb_stats_modified_counter';
+
+#
+# cleanup
+#
+SET @@global.innodb_stats_modified_counter = @start_global_value;
+SELECT @@global.innodb_stats_modified_counter;
diff --git a/mysql-test/suite/sys_vars/t/innodb_stats_on_metadata_basic.test b/mysql-test/suite/sys_vars/t/innodb_stats_on_metadata_basic.test
new file mode 100644
index 00000000..a0bccb50
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_stats_on_metadata_basic.test
@@ -0,0 +1,82 @@
+
+
+# 2010-01-25 - Added
+#
+
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_stats_on_metadata;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+--echo Valid values are 'ON' and 'OFF'
+select @@global.innodb_stats_on_metadata in (0, 1);
+select @@global.innodb_stats_on_metadata;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_stats_on_metadata;
+show global variables like 'innodb_stats_on_metadata';
+show session variables like 'innodb_stats_on_metadata';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_stats_on_metadata';
+select * from information_schema.session_variables where variable_name='innodb_stats_on_metadata';
+--enable_warnings
+
+#
+# show that it's writable
+#
+set global innodb_stats_on_metadata='OFF';
+select @@global.innodb_stats_on_metadata;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_stats_on_metadata';
+select * from information_schema.session_variables where variable_name='innodb_stats_on_metadata';
+--enable_warnings
+set @@global.innodb_stats_on_metadata=1;
+select @@global.innodb_stats_on_metadata;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_stats_on_metadata';
+select * from information_schema.session_variables where variable_name='innodb_stats_on_metadata';
+--enable_warnings
+set global innodb_stats_on_metadata=0;
+select @@global.innodb_stats_on_metadata;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_stats_on_metadata';
+select * from information_schema.session_variables where variable_name='innodb_stats_on_metadata';
+--enable_warnings
+set @@global.innodb_stats_on_metadata='ON';
+select @@global.innodb_stats_on_metadata;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_stats_on_metadata';
+select * from information_schema.session_variables where variable_name='innodb_stats_on_metadata';
+--enable_warnings
+--error ER_GLOBAL_VARIABLE
+set session innodb_stats_on_metadata='OFF';
+--error ER_GLOBAL_VARIABLE
+set @@session.innodb_stats_on_metadata='ON';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_stats_on_metadata=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_stats_on_metadata=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_stats_on_metadata=2;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_stats_on_metadata=-3;
+select @@global.innodb_stats_on_metadata;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_stats_on_metadata';
+select * from information_schema.session_variables where variable_name='innodb_stats_on_metadata';
+--enable_warnings
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_stats_on_metadata='AUTO';
+
+#
+# Cleanup
+#
+
+SET @@global.innodb_stats_on_metadata = @start_global_value;
+SELECT @@global.innodb_stats_on_metadata;
diff --git a/mysql-test/suite/sys_vars/t/innodb_stats_persistent_basic.test b/mysql-test/suite/sys_vars/t/innodb_stats_persistent_basic.test
new file mode 100644
index 00000000..e1b65018
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_stats_persistent_basic.test
@@ -0,0 +1,32 @@
+#
+# innodb_stats_persistent
+#
+
+-- source include/have_innodb.inc
+
+SET @save_stats_persistent=@@GLOBAL.innodb_stats_persistent;
+# show the default value
+SELECT @@innodb_stats_persistent;
+
+# check that it is writeable
+SET GLOBAL innodb_stats_persistent=ON;
+SELECT @@innodb_stats_persistent;
+
+SET GLOBAL innodb_stats_persistent=OFF;
+SELECT @@innodb_stats_persistent;
+
+SET GLOBAL innodb_stats_persistent=1;
+SELECT @@innodb_stats_persistent;
+
+SET GLOBAL innodb_stats_persistent=0;
+SELECT @@innodb_stats_persistent;
+
+# should be a boolean
+-- error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL innodb_stats_persistent=123;
+
+-- error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL innodb_stats_persistent='foo';
+
+# restore the environment
+SET GLOBAL innodb_stats_persistent=@save_stats_persistent;
diff --git a/mysql-test/suite/sys_vars/t/innodb_stats_persistent_sample_pages_basic.test b/mysql-test/suite/sys_vars/t/innodb_stats_persistent_sample_pages_basic.test
new file mode 100644
index 00000000..5fc62f0a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_stats_persistent_sample_pages_basic.test
@@ -0,0 +1,87 @@
+
+#
+# 2010-01-25 - Added
+#
+
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_stats_persistent_sample_pages;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+--echo Valid values are zero or above
+SELECT @@global.innodb_stats_persistent_sample_pages >=0;
+SELECT @@global.innodb_stats_persistent_sample_pages;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.innodb_stats_persistent_sample_pages;
+SHOW global variables LIKE 'innodb_stats_persistent_sample_pages';
+SHOW session variables LIKE 'innodb_stats_persistent_sample_pages';
+--disable_warnings
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_stats_persistent_sample_pages';
+SELECT * FROM information_schema.session_variables
+WHERE variable_name='innodb_stats_persistent_sample_pages';
+--enable_warnings
+
+#
+# SHOW that it's writable
+#
+SET global innodb_stats_persistent_sample_pages=10;
+SELECT @@global.innodb_stats_persistent_sample_pages;
+--disable_warnings
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_stats_persistent_sample_pages';
+SELECT * FROM information_schema.session_variables
+WHERE variable_name='innodb_stats_persistent_sample_pages';
+--enable_warnings
+--error ER_GLOBAL_VARIABLE
+SET session innodb_stats_persistent_sample_pages=1;
+
+#
+# show the default value
+#
+set global innodb_stats_persistent_sample_pages=DEFAULT;
+select @@global.innodb_stats_persistent_sample_pages;
+
+#
+# valid values
+#
+SET global innodb_stats_persistent_sample_pages=0;
+SELECT @@global.innodb_stats_persistent_sample_pages;
+
+SET global innodb_stats_persistent_sample_pages=10;
+SELECT @@global.innodb_stats_persistent_sample_pages;
+
+
+
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+SET global innodb_stats_persistent_sample_pages=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+SET global innodb_stats_persistent_sample_pages=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+SET global innodb_stats_persistent_sample_pages="foo";
+--error ER_WRONG_TYPE_FOR_VAR
+SET global innodb_stats_persistent_sample_pages=' ';
+SELECT @@global.innodb_stats_persistent_sample_pages;
+--error ER_WRONG_TYPE_FOR_VAR
+SET global innodb_stats_persistent_sample_pages=" ";
+SELECT @@global.innodb_stats_persistent_sample_pages;
+SET global innodb_stats_persistent_sample_pages=-7;
+SELECT @@global.innodb_stats_persistent_sample_pages;
+--disable_warnings
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_stats_persistent_sample_pages';
+--enable_warnings
+
+
+#
+# cleanup
+#
+SET @@global.innodb_stats_persistent_sample_pages = @start_global_value;
+SELECT @@global.innodb_stats_persistent_sample_pages;
diff --git a/mysql-test/suite/sys_vars/t/innodb_stats_traditional_basic.test b/mysql-test/suite/sys_vars/t/innodb_stats_traditional_basic.test
new file mode 100644
index 00000000..d0872616
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_stats_traditional_basic.test
@@ -0,0 +1,65 @@
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_stats_traditional;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+--echo Valid values are 'ON' and 'OFF'
+select @@global.innodb_stats_traditional in (0, 1);
+select @@global.innodb_stats_traditional;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_stats_traditional;
+show global variables like 'innodb_stats_traditional';
+show session variables like 'innodb_stats_traditional';
+select * from information_schema.global_variables where variable_name='innodb_stats_traditional';
+select * from information_schema.session_variables where variable_name='innodb_stats_traditional';
+
+#
+# show that it's writable
+#
+set global innodb_stats_traditional='OFF';
+select @@global.innodb_stats_traditional;
+select * from information_schema.global_variables where variable_name='innodb_stats_traditional';
+select * from information_schema.session_variables where variable_name='innodb_stats_traditional';
+set @@global.innodb_stats_traditional=1;
+select @@global.innodb_stats_traditional;
+select * from information_schema.global_variables where variable_name='innodb_stats_traditional';
+select * from information_schema.session_variables where variable_name='innodb_stats_traditional';
+set global innodb_stats_traditional=0;
+select @@global.innodb_stats_traditional;
+select * from information_schema.global_variables where variable_name='innodb_stats_traditional';
+select * from information_schema.session_variables where variable_name='innodb_stats_traditional';
+set @@global.innodb_stats_traditional='ON';
+select @@global.innodb_stats_traditional;
+select * from information_schema.global_variables where variable_name='innodb_stats_traditional';
+select * from information_schema.session_variables where variable_name='innodb_stats_traditional';
+--error ER_GLOBAL_VARIABLE
+set session innodb_stats_traditional='OFF';
+--error ER_GLOBAL_VARIABLE
+set @@session.innodb_stats_traditional='ON';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_stats_traditional=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_stats_traditional=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_stats_traditional=2;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_stats_traditional=-3;
+select @@global.innodb_stats_traditional;
+select * from information_schema.global_variables where variable_name='innodb_stats_traditional';
+select * from information_schema.session_variables where variable_name='innodb_stats_traditional';
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_stats_traditional='AUTO';
+
+#
+# Cleanup
+#
+
+SET @@global.innodb_stats_traditional = @start_global_value;
+SELECT @@global.innodb_stats_traditional;
diff --git a/mysql-test/suite/sys_vars/t/innodb_stats_transient_sample_pages_basic.test b/mysql-test/suite/sys_vars/t/innodb_stats_transient_sample_pages_basic.test
new file mode 100644
index 00000000..d3d50890
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_stats_transient_sample_pages_basic.test
@@ -0,0 +1,71 @@
+
+#
+# 2010-01-25 - Added
+#
+
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_stats_transient_sample_pages;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+--echo Valid values are one or above
+SELECT @@global.innodb_stats_transient_sample_pages >=1;
+SELECT @@global.innodb_stats_transient_sample_pages;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.innodb_stats_transient_sample_pages;
+SHOW global variables LIKE 'innodb_stats_transient_sample_pages';
+SHOW session variables LIKE 'innodb_stats_transient_sample_pages';
+--disable_warnings
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_stats_transient_sample_pages';
+SELECT * FROM information_schema.session_variables
+WHERE variable_name='innodb_stats_transient_sample_pages';
+--enable_warnings
+
+#
+# show the default value
+#
+set global innodb_stats_transient_sample_pages=DEFAULT;
+select @@global.innodb_stats_transient_sample_pages;
+
+#
+# SHOW that it's writable
+#
+SET global innodb_stats_transient_sample_pages=10;
+SELECT @@global.innodb_stats_transient_sample_pages;
+--disable_warnings
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_stats_transient_sample_pages';
+SELECT * FROM information_schema.session_variables
+WHERE variable_name='innodb_stats_transient_sample_pages';
+--enable_warnings
+--error ER_GLOBAL_VARIABLE
+SET session innodb_stats_transient_sample_pages=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+SET global innodb_stats_transient_sample_pages=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+SET global innodb_stats_transient_sample_pages=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+SET global innodb_stats_transient_sample_pages="foo";
+--error ER_WRONG_TYPE_FOR_VAR
+SET global innodb_stats_transient_sample_pages=' ';
+
+SET global innodb_stats_transient_sample_pages=-7;
+SELECT @@global.innodb_stats_transient_sample_pages;
+--disable_warnings
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_stats_transient_sample_pages';
+--enable_warnings
+
+#
+# cleanup
+#
+SET @@global.innodb_stats_transient_sample_pages = @start_global_value;
+SELECT @@global.innodb_stats_transient_sample_pages;
diff --git a/mysql-test/suite/sys_vars/t/innodb_status_output_basic.test b/mysql-test/suite/sys_vars/t/innodb_status_output_basic.test
new file mode 100644
index 00000000..8e33b364
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_status_output_basic.test
@@ -0,0 +1,83 @@
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_status_output;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+--echo Valid values are 'ON' and 'OFF'
+select @@global.innodb_status_output in (0, 1);
+select @@global.innodb_status_output;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_status_output;
+show global variables like 'innodb_status_output';
+show session variables like 'innodb_status_output';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_status_output';
+select * from information_schema.session_variables where variable_name='innodb_status_output';
+--enable_warnings
+
+#
+# show that it's writable
+#
+set global innodb_status_output='OFF';
+select @@global.innodb_status_output;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_status_output';
+select * from information_schema.session_variables where variable_name='innodb_status_output';
+--enable_warnings
+set @@global.innodb_status_output=1;
+select @@global.innodb_status_output;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_status_output';
+select * from information_schema.session_variables where variable_name='innodb_status_output';
+--enable_warnings
+set global innodb_status_output=0;
+select @@global.innodb_status_output;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_status_output';
+select * from information_schema.session_variables where variable_name='innodb_status_output';
+--enable_warnings
+set @@global.innodb_status_output='ON';
+select @@global.innodb_status_output;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_status_output';
+select * from information_schema.session_variables where variable_name='innodb_status_output';
+--enable_warnings
+--error ER_GLOBAL_VARIABLE
+set session innodb_status_output='OFF';
+--error ER_GLOBAL_VARIABLE
+set @@session.innodb_status_output='ON';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_status_output=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_status_output=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_status_output=2;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_status_output=-3;
+select @@global.innodb_status_output;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_status_output';
+select * from information_schema.session_variables where variable_name='innodb_status_output';
+--enable_warnings
+set global innodb_status_output=DEFAULT;
+select @@global.innodb_status_output;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_status_output';
+select * from information_schema.session_variables where variable_name='innodb_status_output';
+--enable_warnings
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_status_output='AUTO';
+
+#
+# Cleanup
+#
+
+SET @@global.innodb_status_output = @start_global_value;
+SELECT @@global.innodb_status_output;
diff --git a/mysql-test/suite/sys_vars/t/innodb_status_output_locks_basic.test b/mysql-test/suite/sys_vars/t/innodb_status_output_locks_basic.test
new file mode 100644
index 00000000..9f510c2f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_status_output_locks_basic.test
@@ -0,0 +1,83 @@
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_status_output_locks;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+--echo Valid values are 'ON' and 'OFF'
+select @@global.innodb_status_output_locks in (0, 1);
+select @@global.innodb_status_output_locks;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_status_output_locks;
+show global variables like 'innodb_status_output_locks';
+show session variables like 'innodb_status_output_locks';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_status_output_locks';
+select * from information_schema.session_variables where variable_name='innodb_status_output_locks';
+--enable_warnings
+
+#
+# show that it's writable
+#
+set global innodb_status_output_locks='OFF';
+select @@global.innodb_status_output_locks;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_status_output_locks';
+select * from information_schema.session_variables where variable_name='innodb_status_output_locks';
+--enable_warnings
+set @@global.innodb_status_output_locks=1;
+select @@global.innodb_status_output_locks;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_status_output_locks';
+select * from information_schema.session_variables where variable_name='innodb_status_output_locks';
+--enable_warnings
+set global innodb_status_output_locks=0;
+select @@global.innodb_status_output_locks;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_status_output_locks';
+select * from information_schema.session_variables where variable_name='innodb_status_output_locks';
+--enable_warnings
+set @@global.innodb_status_output_locks='ON';
+select @@global.innodb_status_output_locks;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_status_output_locks';
+select * from information_schema.session_variables where variable_name='innodb_status_output_locks';
+--enable_warnings
+--error ER_GLOBAL_VARIABLE
+set session innodb_status_output_locks='OFF';
+--error ER_GLOBAL_VARIABLE
+set @@session.innodb_status_output_locks='ON';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_status_output_locks=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_status_output_locks=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_status_output_locks=2;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_status_output_locks=-3;
+select @@global.innodb_status_output_locks;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_status_output_locks';
+select * from information_schema.session_variables where variable_name='innodb_status_output_locks';
+--enable_warnings
+set global innodb_status_output_locks=DEFAULT;
+select @@global.innodb_status_output_locks;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_status_output_locks';
+select * from information_schema.session_variables where variable_name='innodb_status_output_locks';
+--enable_warnings
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_status_output_locks='AUTO';
+
+#
+# Cleanup
+#
+
+SET @@global.innodb_status_output_locks = @start_global_value;
+SELECT @@global.innodb_status_output_locks;
diff --git a/mysql-test/suite/sys_vars/t/innodb_strict_mode_basic.test b/mysql-test/suite/sys_vars/t/innodb_strict_mode_basic.test
new file mode 100644
index 00000000..243985f9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_strict_mode_basic.test
@@ -0,0 +1,97 @@
+
+
+# 2010-01-25 - Added
+#
+
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_strict_mode;
+SELECT @start_global_value;
+
+#
+# exists as global and session
+#
+--echo Valid values are 'ON' and 'OFF'
+select @@global.innodb_strict_mode in (0, 1);
+select @@global.innodb_strict_mode;
+select @@session.innodb_strict_mode in (0, 1);
+select @@session.innodb_strict_mode;
+show global variables like 'innodb_strict_mode';
+show session variables like 'innodb_strict_mode';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_strict_mode';
+select * from information_schema.session_variables where variable_name='innodb_strict_mode';
+--enable_warnings
+
+#
+# show that it's writable
+#
+set global innodb_strict_mode='OFF';
+set session innodb_strict_mode='OFF';
+select @@global.innodb_strict_mode;
+select @@session.innodb_strict_mode;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_strict_mode';
+select * from information_schema.session_variables where variable_name='innodb_strict_mode';
+--enable_warnings
+set @@global.innodb_strict_mode=1;
+set @@session.innodb_strict_mode=1;
+select @@global.innodb_strict_mode;
+select @@session.innodb_strict_mode;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_strict_mode';
+select * from information_schema.session_variables where variable_name='innodb_strict_mode';
+--enable_warnings
+set global innodb_strict_mode=0;
+set session innodb_strict_mode=0;
+select @@global.innodb_strict_mode;
+select @@session.innodb_strict_mode;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_strict_mode';
+select * from information_schema.session_variables where variable_name='innodb_strict_mode';
+--enable_warnings
+set @@global.innodb_strict_mode='ON';
+set @@session.innodb_strict_mode='ON';
+select @@global.innodb_strict_mode;
+select @@session.innodb_strict_mode;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_strict_mode';
+select * from information_schema.session_variables where variable_name='innodb_strict_mode';
+--enable_warnings
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_strict_mode=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set session innodb_strict_mode=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_strict_mode=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set session innodb_strict_mode=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_strict_mode=2;
+--error ER_WRONG_VALUE_FOR_VAR
+set session innodb_strict_mode=2;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_strict_mode='AUTO';
+--error ER_WRONG_VALUE_FOR_VAR
+set session innodb_strict_mode='AUTO';
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_strict_mode=-3;
+--error ER_WRONG_VALUE_FOR_VAR
+set session innodb_strict_mode=-7;
+select @@global.innodb_strict_mode;
+select @@session.innodb_strict_mode;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_strict_mode';
+select * from information_schema.session_variables where variable_name='innodb_strict_mode';
+--enable_warnings
+
+#
+# Cleanup
+#
+
+SET @@global.innodb_strict_mode = @start_global_value;
+SELECT @@global.innodb_strict_mode;
diff --git a/mysql-test/suite/sys_vars/t/innodb_sync_spin_loops_basic.test b/mysql-test/suite/sys_vars/t/innodb_sync_spin_loops_basic.test
new file mode 100644
index 00000000..138e877d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_sync_spin_loops_basic.test
@@ -0,0 +1,180 @@
+################# mysql-test\t\innodb_sync_spin_loops_basic.test ##############
+# #
+# Variable Name: innodb_sync_spin_loops #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 20 #
+# Range: 0-4294967295 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+#Description:Test Cases of Dynamic System Variable innodb_sync_spin_loops #
+# that checks the behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF innodb_sync_spin_loops TESTS #
+########################################################################
+
+
+############################################################################
+# Saving initial value of innodb_sync_spin_loops in a temporary variable #
+############################################################################
+
+SET @global_start_value = @@global.innodb_sync_spin_loops;
+SELECT @global_start_value;
+
+--echo '#--------------------FN_DYNVARS_046_01------------------------#'
+########################################################################
+# Display the DEFAULT value of innodb_sync_spin_loops #
+########################################################################
+
+SET @@global.innodb_sync_spin_loops = 0;
+SET @@global.innodb_sync_spin_loops = DEFAULT;
+SELECT @@global.innodb_sync_spin_loops;
+
+--echo '#---------------------FN_DYNVARS_046_02-------------------------#'
+##############################################################################
+# Check if innodb_sync_spin_loops can be accessed with and without @@ sign #
+##############################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET innodb_sync_spin_loops = 1;
+SELECT @@innodb_sync_spin_loops;
+
+--Error ER_UNKNOWN_TABLE
+SELECT local.innodb_sync_spin_loops;
+
+SET global innodb_sync_spin_loops = 0;
+SELECT @@global.innodb_sync_spin_loops;
+
+--echo '#--------------------FN_DYNVARS_046_03------------------------#'
+##########################################################################
+# change the value of innodb_sync_spin_loops to a valid value #
+##########################################################################
+
+SET @@global.innodb_sync_spin_loops = 0;
+SELECT @@global.innodb_sync_spin_loops;
+
+SET @@global.innodb_sync_spin_loops = 65535;
+SELECT @@global.innodb_sync_spin_loops;
+
+SET @@global.innodb_sync_spin_loops = 4294967295;
+SELECT @@global.innodb_sync_spin_loops;
+
+--echo '#--------------------FN_DYNVARS_046_04-------------------------#'
+###########################################################################
+# Check the value of innodb_sync_spin_loops for out of bounds #
+###########################################################################
+
+# With a 64 bit mysqld:18446744073709551615,with a 32 bit mysqld: 4294967295
+--disable_warnings
+SET @@global.innodb_sync_spin_loops = 4294967296;
+--enable_warnings
+SELECT @@global.innodb_sync_spin_loops IN (4294967296,4294967295);
+
+--disable_warnings
+SET @@global.innodb_sync_spin_loops = 12345678901;
+--enable_warnings
+SELECT @@global.innodb_sync_spin_loops IN (12345678901,4294967295);
+
+--disable_warnings
+SET @@global.innodb_sync_spin_loops = 18446744073709551615;
+--enable_warnings
+SELECT @@global.innodb_sync_spin_loops IN (18446744073709551615,4294967295);
+
+--echo '#--------------------FN_DYNVARS_046_05-------------------------#'
+###########################################################################
+# Change the value of innodb_sync_spin_loops to invalid value #
+###########################################################################
+
+SET @@global.innodb_sync_spin_loops = -1;
+SELECT @@global.innodb_sync_spin_loops;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_sync_spin_loops = "T";
+SELECT @@global.innodb_sync_spin_loops;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_sync_spin_loops = "Y";
+SELECT @@global.innodb_sync_spin_loops;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_sync_spin_loops = 65535.01;
+SELECT @@global.innodb_sync_spin_loops;
+
+SET @@global.innodb_sync_spin_loops = -1024;
+SELECT @@global.innodb_sync_spin_loops;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_sync_spin_loops = " ";
+SELECT @@global.innodb_sync_spin_loops;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_sync_spin_loops = ' ';
+SELECT @@global.innodb_sync_spin_loops;
+
+--echo '#----------------------FN_DYNVARS_046_06------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#########################################################################
+
+--disable_warnings
+SELECT @@global.innodb_sync_spin_loops =
+ VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='innodb_sync_spin_loops';
+--enable_warnings
+SELECT @@global.innodb_sync_spin_loops;
+--disable_warnings
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='innodb_sync_spin_loops';
+--enable_warnings
+
+--echo '#---------------------FN_DYNVARS_046_07-------------------------#'
+###################################################################
+# Check if ON and OFF values can be used on variable #
+###################################################################
+
+--ERROR ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_sync_spin_loops = OFF;
+SELECT @@global.innodb_sync_spin_loops;
+
+--ERROR ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_sync_spin_loops = ON;
+SELECT @@global.innodb_sync_spin_loops;
+
+--echo '#---------------------FN_DYNVARS_046_08----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+
+SET @@global.innodb_sync_spin_loops = TRUE;
+SELECT @@global.innodb_sync_spin_loops;
+SET @@global.innodb_sync_spin_loops = FALSE;
+SELECT @@global.innodb_sync_spin_loops;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.innodb_sync_spin_loops = @global_start_value;
+SELECT @@global.innodb_sync_spin_loops;
+
+###############################################################
+# END OF innodb_sync_spin_loops TESTS #
+###############################################################
diff --git a/mysql-test/suite/sys_vars/t/innodb_table_locks_basic.test b/mysql-test/suite/sys_vars/t/innodb_table_locks_basic.test
new file mode 100644
index 00000000..e3e4bda3
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_table_locks_basic.test
@@ -0,0 +1,238 @@
+################# mysql-test\t\innodb_table_locks_basic.test ##################
+# #
+# Variable Name: innodb_table_locks #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: boolean #
+# Default Value: 1 #
+# Range: 0,1 #
+# #
+# #
+# Creation Date: 2008-02-20 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable innodb_table_locks #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF innodb_table_locks TESTS #
+########################################################################
+
+
+################################################################################
+# Saving initial value of innodb_table_locks in a temporary variable #
+################################################################################
+
+
+SET @session_start_value = @@session.innodb_table_locks;
+SELECT @session_start_value;
+
+
+SET @global_start_value = @@global.innodb_table_locks;
+SELECT @global_start_value;
+
+
+
+--echo '#--------------------FN_DYNVARS_046_01------------------------#'
+########################################################################
+# Display the DEFAULT value of innodb_table_locks #
+########################################################################
+
+SET @@session.innodb_table_locks = 0;
+SET @@session.innodb_table_locks = DEFAULT;
+SELECT @@session.innodb_table_locks;
+
+SET @@global.innodb_table_locks = 0;
+SET @@global.innodb_table_locks = DEFAULT;
+SELECT @@global.innodb_table_locks;
+
+--echo '#---------------------FN_DYNVARS_046_02-------------------------#'
+###############################################################################
+# Check if innodb_table_locks can be accessed with and without @@ sign #
+###############################################################################
+
+SET innodb_table_locks = 1;
+SELECT @@innodb_table_locks;
+
+--Error ER_UNKNOWN_TABLE
+SELECT session.innodb_table_locks;
+
+--Error ER_UNKNOWN_TABLE
+SELECT local.innodb_table_locks;
+
+--Error ER_UNKNOWN_TABLE
+SELECT global.innodb_table_locks;
+#using another syntax for accessing system variables
+SET session innodb_table_locks = 0;
+SELECT @@session.innodb_table_locks;
+
+SET global innodb_table_locks = 0;
+SELECT @@global.innodb_table_locks;
+
+
+--echo '#--------------------FN_DYNVARS_046_03------------------------#'
+##########################################################################
+# change the value of innodb_table_locks to a valid value #
+##########################################################################
+# for session
+SET @@session.innodb_table_locks = 0;
+SELECT @@session.innodb_table_locks;
+SET @@session.innodb_table_locks = 1;
+SELECT @@session.innodb_table_locks;
+
+# for global
+SET @@global.innodb_table_locks = 0;
+SELECT @@global.innodb_table_locks;
+SET @@global.innodb_table_locks = 1;
+SELECT @@global.innodb_table_locks;
+
+
+--echo '#--------------------FN_DYNVARS_046_04-------------------------#'
+###########################################################################
+# Change the value of innodb_table_locks to invalid value #
+###########################################################################
+
+# for session
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.innodb_table_locks = -6;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.innodb_table_locks = 1.6;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.innodb_table_locks = "T";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.innodb_table_locks = "Y";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.innodb_table_locks = TRÜE;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.innodb_table_locks = ÕN;
+
+SET @@session.innodb_table_locks = OF;
+SELECT @@session.innodb_table_locks;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.innodb_table_locks = ÓFF;
+
+# for global
+
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.innodb_table_locks = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.innodb_table_locks = 2;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.innodb_table_locks = "T";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.innodb_table_locks = "Y";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.innodb_table_locks = TRÜE;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.innodb_table_locks = QN;
+
+SET @@global.innodb_table_locks = OF;
+SELECT @@global.innodb_table_locks;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+#SET @@global.innodb_table_locks = ÓFF;
+
+
+--echo '#-------------------FN_DYNVARS_046_05----------------------------#'
+###########################################################################
+# Test if changing global variable effects session and vice versa #
+###########################################################################
+
+SET @@global.innodb_table_locks = 0;
+SET @@session.innodb_table_locks = 1;
+SELECT @@global.innodb_table_locks AS res_is_0;
+
+SET @@global.innodb_table_locks = 0;
+SELECT @@session.innodb_table_locks AS res_is_1;
+
+--echo '#----------------------FN_DYNVARS_046_06------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#########################################################################
+
+--disable_warnings
+SELECT IF(@@global.innodb_table_locks, "ON", "OFF") =
+ VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='innodb_table_locks';
+--enable_warnings
+SELECT @@global.innodb_table_locks;
+--disable_warnings
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='innodb_table_locks';
+--enable_warnings
+
+--echo '#----------------------FN_DYNVARS_046_07------------------------#'
+#########################################################################
+# Check if the value in SESSION Table matches value in variable #
+#########################################################################
+
+--disable_warnings
+SELECT IF(@@session.innodb_table_locks, "ON", "OFF") =
+ VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+ WHERE VARIABLE_NAME='innodb_table_locks';
+--enable_warnings
+SELECT @@session.innodb_table_locks;
+--disable_warnings
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+ WHERE VARIABLE_NAME='innodb_table_locks';
+--enable_warnings
+
+
+--echo '#---------------------FN_DYNVARS_046_08-------------------------#'
+###################################################################
+# Check if ON and OFF values can be used on variable #
+###################################################################
+
+SET @@session.innodb_table_locks = OFF;
+SELECT @@session.innodb_table_locks;
+SET @@session.innodb_table_locks = ON;
+SELECT @@session.innodb_table_locks;
+
+SET @@global.innodb_table_locks = OFF;
+SELECT @@global.innodb_table_locks;
+SET @@global.innodb_table_locks = ON;
+SELECT @@global.innodb_table_locks;
+
+--echo '#---------------------FN_DYNVARS_046_09----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@session.innodb_table_locks = TRUE;
+SELECT @@session.innodb_table_locks;
+SET @@session.innodb_table_locks = FALSE;
+SELECT @@session.innodb_table_locks;
+
+SET @@global.innodb_table_locks = TRUE;
+SELECT @@global.innodb_table_locks;
+SET @@global.innodb_table_locks = FALSE;
+SELECT @@global.innodb_table_locks;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@session.innodb_table_locks = @session_start_value;
+SELECT @@session.innodb_table_locks;
+
+SET @@global.innodb_table_locks = @global_start_value;
+SELECT @@global.innodb_table_locks;
+
+###############################################################
+# END OF innodb_table_locks TESTS #
+###############################################################
diff --git a/mysql-test/suite/sys_vars/t/innodb_table_locks_func.test b/mysql-test/suite/sys_vars/t/innodb_table_locks_func.test
new file mode 100644
index 00000000..330addd6
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_table_locks_func.test
@@ -0,0 +1,95 @@
+################# mysql-test\t\innodb_table_locks_func.test ##################
+# #
+# Variable Name: innodb_table_locks #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: boolean #
+# Default Value: 1 #
+# Range: 0,1 #
+# #
+# #
+# Creation Date: 2008-03-08 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable innodb_table_locks #
+# that checks the behavior of this variable #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# #
+###############################################################################
+
+--source include/not_embedded.inc
+--source include/have_innodb.inc
+
+--echo '#--------------------FN_DYNVARS_048_01-------------------------#'
+####################################################################
+# Check if setting innodb_table_locks is changed in new connection #
+####################################################################
+
+SET @start_value= @@global.innodb_table_locks;
+SELECT @start_value;
+
+SET @@global.innodb_table_locks = OFF;
+--echo 'connect (con1,localhost,root,,,,)'
+connect (con1,localhost,root,,,,);
+--echo 'connection con1'
+connection con1;
+SELECT @@global.innodb_table_locks;
+SELECT @@session.innodb_table_locks;
+disconnect con1;
+
+
+--echo '#--------------------FN_DYNVARS_048_02-------------------------#'
+###########################################################
+# Begin the functionality Testing of innodb_table_locks #
+###########################################################
+
+#==============================================================================
+--echo '----check when innodb_table_locks = ON and autocommit = OFF---'
+#==============================================================================
+--echo 'connect (con2,localhost,root,,,,)'
+connect (con2,localhost,root,,,,);
+
+--echo 'connection default'
+connection default;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+CREATE TABLE t1 (a INT) ENGINE=INNODB;
+
+SET @@autocommit = OFF;
+SET @@innodb_table_locks = ON;
+
+BEGIN;
+INSERT INTO t1 VALUES(1);
+SELECT * FROM t1 FOR UPDATE;
+
+--echo 'CONNECTION con2'
+CONNECTION con2;
+SET @@innodb_table_locks = ON;
+SET @@autocommit = OFF;
+send LOCK TABLES t1 WRITE;
+
+--echo 'CONNECTION default'
+CONNECTION default;
+COMMIT;
+
+--echo 'CONNECTION con2'
+CONNECTION con2;
+reap;
+UNLOCK tables;
+
+DROP TABLE t1;
+disconnect con2;
+
+connection default;
+SET @@global.innodb_table_locks= @start_value;
+SELECT @@global.innodb_table_locks;
+
+##########################################################
+# End of functionality Testing for innodb_table_locks #
+##########################################################
+
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_temp_data_file_path_basic.test b/mysql-test/suite/sys_vars/t/innodb_temp_data_file_path_basic.test
new file mode 100644
index 00000000..607ee9b2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_temp_data_file_path_basic.test
@@ -0,0 +1,106 @@
+
+
+################ mysql-test\t\innodb_temp_data_file_path_basic.test ############
+# #
+# Variable Name: innodb_temp_data_file_path #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: filename #
+# #
+# #
+# Creation Date: 2012-12-27 #
+# Author : Krunal Bauskar #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable innodb_temp_data_file_path#
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+
+--echo '#---------------------BS_STVARS_024_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.innodb_temp_data_file_path);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_024_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.innodb_temp_data_file_path=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.innodb_temp_data_file_path);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_024_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+--disable_warnings
+SELECT @@GLOBAL.innodb_temp_data_file_path = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_temp_data_file_path';
+--enable_warnings
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.innodb_temp_data_file_path);
+--echo 1 Expected
+
+--disable_warnings
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_temp_data_file_path';
+--enable_warnings
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_024_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@innodb_temp_data_file_path = @@GLOBAL.innodb_temp_data_file_path;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_024_05----------------------#'
+################################################################################
+#Check if innodb_temp_data_file_path can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@innodb_temp_data_file_path);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.innodb_temp_data_file_path);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.innodb_temp_data_file_path);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.innodb_temp_data_file_path);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT innodb_temp_data_file_path = @@SESSION.innodb_temp_data_file_path;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_tmpdir_basic.test b/mysql-test/suite/sys_vars/t/innodb_tmpdir_basic.test
new file mode 100644
index 00000000..2f9da412
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_tmpdir_basic.test
@@ -0,0 +1,43 @@
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_tmpdir;
+SELECT @start_global_value;
+
+#
+# exists as global and session
+#
+select @@session.innodb_tmpdir;
+
+show global variables like 'innodb_tmpdir';
+show session variables like 'innodb_tmpdir';
+
+select * from information_schema.global_variables where variable_name='innodb_tmpdir';
+select * from information_schema.session_variables where variable_name='innodb_tmpdir';
+#
+# Show that it is writable
+#
+
+set global innodb_tmpdir=@@global.tmpdir;
+set session innodb_tmpdir=@@global.tmpdir;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_tmpdir=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_tmpdir=1e1;
+
+#
+# path len more than 512
+#
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_tmpdir=repeat('a',1000);
+show warnings;
+
+#
+# Cleanup
+#
+
+SET @@global.innodb_tmpdir = @start_global_value;
+SELECT @@global.innodb_tmpdir;
diff --git a/mysql-test/suite/sys_vars/t/innodb_trx_purge_view_update_only_debug_basic.test b/mysql-test/suite/sys_vars/t/innodb_trx_purge_view_update_only_debug_basic.test
new file mode 100644
index 00000000..04f406a3
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_trx_purge_view_update_only_debug_basic.test
@@ -0,0 +1,60 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+
+SET @start_global_value = @@global.innodb_trx_purge_view_update_only_debug;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+select @@global.innodb_trx_purge_view_update_only_debug in (0, 1);
+select @@global.innodb_trx_purge_view_update_only_debug;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_trx_purge_view_update_only_debug;
+show global variables like 'innodb_trx_purge_view_update_only_debug';
+show session variables like 'innodb_trx_purge_view_update_only_debug';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_trx_purge_view_update_only_debug';
+select * from information_schema.session_variables where variable_name='innodb_trx_purge_view_update_only_debug';
+--enable_warnings
+
+#
+# show that it's writable
+#
+set global innodb_trx_purge_view_update_only_debug=1;
+select @@global.innodb_trx_purge_view_update_only_debug;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_trx_purge_view_update_only_debug';
+select * from information_schema.session_variables where variable_name='innodb_trx_purge_view_update_only_debug';
+--enable_warnings
+set @@global.innodb_trx_purge_view_update_only_debug=0;
+select @@global.innodb_trx_purge_view_update_only_debug;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_trx_purge_view_update_only_debug';
+select * from information_schema.session_variables where variable_name='innodb_trx_purge_view_update_only_debug';
+--enable_warnings
+--error ER_GLOBAL_VARIABLE
+set session innodb_trx_purge_view_update_only_debug='some';
+--error ER_GLOBAL_VARIABLE
+set @@session.innodb_trx_purge_view_update_only_debug='some';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_trx_purge_view_update_only_debug=1.1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_trx_purge_view_update_only_debug='foo';
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_trx_purge_view_update_only_debug=-2;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_trx_purge_view_update_only_debug=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_trx_purge_view_update_only_debug=2;
+
+#
+# Cleanup
+#
+
+SET @@global.innodb_trx_purge_view_update_only_debug = @start_global_value;
+SELECT @@global.innodb_trx_purge_view_update_only_debug;
diff --git a/mysql-test/suite/sys_vars/t/innodb_trx_rseg_n_slots_debug_basic.test b/mysql-test/suite/sys_vars/t/innodb_trx_rseg_n_slots_debug_basic.test
new file mode 100644
index 00000000..858e1b63
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_trx_rseg_n_slots_debug_basic.test
@@ -0,0 +1,59 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+
+SET @start_global_value = @@global.innodb_trx_rseg_n_slots_debug;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+select @@global.innodb_trx_rseg_n_slots_debug between 0 and 1024;
+select @@global.innodb_trx_rseg_n_slots_debug;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_trx_rseg_n_slots_debug;
+show global variables like 'innodb_trx_rseg_n_slots_debug';
+show session variables like 'innodb_trx_rseg_n_slots_debug';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_trx_rseg_n_slots_debug';
+select * from information_schema.session_variables where variable_name='innodb_trx_rseg_n_slots_debug';
+--enable_warnings
+
+#
+# show that it's writable
+#
+set global innodb_trx_rseg_n_slots_debug=1;
+select @@global.innodb_trx_rseg_n_slots_debug;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_trx_rseg_n_slots_debug';
+select * from information_schema.session_variables where variable_name='innodb_trx_rseg_n_slots_debug';
+--enable_warnings
+set @@global.innodb_trx_rseg_n_slots_debug=0;
+select @@global.innodb_trx_rseg_n_slots_debug;
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_trx_rseg_n_slots_debug';
+select * from information_schema.session_variables where variable_name='innodb_trx_rseg_n_slots_debug';
+--enable_warnings
+--error ER_GLOBAL_VARIABLE
+set session innodb_trx_rseg_n_slots_debug='some';
+--error ER_GLOBAL_VARIABLE
+set @@session.innodb_trx_rseg_n_slots_debug='some';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_trx_rseg_n_slots_debug=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_trx_rseg_n_slots_debug='foo';
+set global innodb_trx_rseg_n_slots_debug=-2;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_trx_rseg_n_slots_debug=1e1;
+set global innodb_trx_rseg_n_slots_debug=1024;
+set global innodb_trx_rseg_n_slots_debug=1025;
+
+#
+# Cleanup
+#
+
+SET @@global.innodb_trx_rseg_n_slots_debug = @start_global_value;
+SELECT @@global.innodb_trx_rseg_n_slots_debug;
diff --git a/mysql-test/suite/sys_vars/t/innodb_undo_directory_basic.test b/mysql-test/suite/sys_vars/t/innodb_undo_directory_basic.test
new file mode 100644
index 00000000..0df071c2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_undo_directory_basic.test
@@ -0,0 +1,89 @@
+################## mysql-test/t/innodb_undo_directory_basic.test ##############
+# #
+# Variable Name: innodb_undo_directory #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: string #
+# #
+# #
+# Creation Date: 2011-07-05 #
+# Author : Sunny Bains #
+# #
+# #
+# Description: Read-only config global variable innodb_undo_directory #
+# * Value check #
+# * Scope check #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+
+####################################################################
+# Display the default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.innodb_undo_directory);
+--echo 1 Expected
+
+
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.innodb_undo_directory="/tmp";
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.innodb_undo_directory);
+--echo 1 Expected
+
+
+################################################################################
+# Check if the value in GLOBAL table matches value in variable #
+################################################################################
+
+--disable_warnings
+SELECT @@GLOBAL.innodb_undo_directory = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_undo_directory';
+--enable_warnings
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.innodb_undo_directory);
+--echo 1 Expected
+
+--disable_warnings
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_undo_directory';
+--enable_warnings
+--echo 1 Expected
+
+
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@innodb_undo_directory = @@GLOBAL.innodb_undo_directory;
+--echo 1 Expected
+
+
+################################################################################
+# Check if innodb_undo_directory can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@innodb_undo_directory);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.innodb_undo_directory);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.innodb_undo_directory);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.innodb_undo_directory);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT innodb_undo_directory = @@SESSION.innodb_undo_directory;
+--echo Expected error 'Readonly variable'
diff --git a/mysql-test/suite/sys_vars/t/innodb_undo_log_truncate_basic.test b/mysql-test/suite/sys_vars/t/innodb_undo_log_truncate_basic.test
new file mode 100644
index 00000000..b60f9be2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_undo_log_truncate_basic.test
@@ -0,0 +1,113 @@
+
+
+############### mysql-test\t\innodb_undo_log_truncate_basic.test ##############
+# #
+# Variable Name: innodb_undo_log_truncate #
+# Scope: Global #
+# Access Type: Dynamic #
+# Data Type: boolean #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable innodb_undo_log_truncate #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_undo_log_truncate;
+SELECT @start_global_value;
+
+
+--echo '#---------------------BS_STVARS_028_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.innodb_undo_log_truncate);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_028_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+SET @@global.innodb_undo_log_truncate = 0;
+SELECT @@global.innodb_undo_log_truncate;
+
+SET @@global.innodb_undo_log_truncate ='On' ;
+SELECT @@global.innodb_undo_log_truncate;
+
+SET @@global.innodb_undo_log_truncate ='Off' ;
+SELECT @@global.innodb_undo_log_truncate;
+
+SET @@global.innodb_undo_log_truncate = 1;
+SELECT @@global.innodb_undo_log_truncate;
+
+--echo '#---------------------BS_STVARS_028_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+--disable_warnings
+SELECT IF(@@GLOBAL.innodb_undo_log_truncate,'ON','OFF') = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_undo_log_truncate';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.innodb_undo_log_truncate);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_undo_log_truncate';
+--echo 1 Expected
+--enable_warnings
+
+
+--echo '#---------------------BS_STVARS_028_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@innodb_undo_log_truncate = @@GLOBAL.innodb_undo_log_truncate;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_028_05----------------------#'
+################################################################################
+# Check if innodb_undo_log_truncate can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@innodb_undo_log_truncate);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.innodb_undo_log_truncate);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.innodb_undo_log_truncate);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.innodb_undo_log_truncate);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT innodb_undo_log_truncate = @@SESSION.innodb_undo_log_truncate;
+
+#
+# Cleanup
+#
+
+SET @@global.innodb_undo_log_truncate = @start_global_value;
+SELECT @@global.innodb_undo_log_truncate;
diff --git a/mysql-test/suite/sys_vars/t/innodb_undo_tablespaces_basic.test b/mysql-test/suite/sys_vars/t/innodb_undo_tablespaces_basic.test
new file mode 100644
index 00000000..e1744b09
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_undo_tablespaces_basic.test
@@ -0,0 +1,78 @@
+################## mysql-test/t/innodb_undo_tablespaces_basic.test ############
+# #
+# Variable Name: innodb_undo_tablespaces #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: string #
+# #
+# #
+# Creation Date: 2011-07-05 #
+# Author : Sunny Bains #
+# #
+# #
+# Description: Read-only config global variable innodb_undo_tablespaces #
+# * Value check #
+# * Scope check #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+
+SELECT @@GLOBAL.innodb_undo_tablespaces >= 0;
+let $undo_tablespaces=`SELECT @@GLOBAL.innodb_undo_tablespaces`;
+
+
+####################################################################
+# Check if value can be set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.innodb_undo_tablespaces=128;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.innodb_undo_tablespaces);
+--echo 1 Expected
+
+
+################################################################################
+# Check if the value in GLOBAL table matches value in variable #
+################################################################################
+
+--disable_warnings
+--disable_query_log
+eval SELECT VARIABLE_VALUE-$undo_tablespaces DIFFERENCE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_undo_tablespaces';
+--enable_query_log
+--enable_warnings
+--echo 0 Expected
+
+
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@innodb_undo_tablespaces = @@GLOBAL.innodb_undo_tablespaces;
+--echo 1 Expected
+
+
+################################################################################
+# Check if innodb_undo_tablespaces can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@innodb_undo_tablespaces);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.innodb_undo_tablespaces);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.innodb_undo_tablespaces);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.innodb_undo_tablespaces);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT innodb_undo_tablespaces = @@SESSION.innodb_undo_tablespaces;
+--echo Expected error 'Readonly variable'
diff --git a/mysql-test/suite/sys_vars/t/innodb_use_atomic_writes_basic.test b/mysql-test/suite/sys_vars/t/innodb_use_atomic_writes_basic.test
new file mode 100644
index 00000000..e14f618e
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_use_atomic_writes_basic.test
@@ -0,0 +1,22 @@
+--source include/have_innodb.inc
+# bool readonly
+
+#
+# show values;
+#
+select @@global.innodb_use_atomic_writes;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_use_atomic_writes;
+show global variables like 'innodb_use_atomic_writes';
+show session variables like 'innodb_use_atomic_writes';
+select * from information_schema.global_variables where variable_name='innodb_use_atomic_writes';
+select * from information_schema.session_variables where variable_name='innodb_use_atomic_writes';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global innodb_use_atomic_writes=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session innodb_use_atomic_writes=1;
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_use_native_aio_basic.test b/mysql-test/suite/sys_vars/t/innodb_use_native_aio_basic.test
new file mode 100644
index 00000000..67a5755f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_use_native_aio_basic.test
@@ -0,0 +1,106 @@
+
+
+################## mysql-test\t\innodb_use_native_aio_basic.test ##############
+# #
+# Variable Name: innodb_use_native_aio #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: numeric #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable innodb_use_native_aio #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+
+--echo '#---------------------BS_STVARS_035_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.innodb_use_native_aio);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_035_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.innodb_use_native_aio=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.innodb_use_native_aio);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_035_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+--disable_warnings
+SELECT IF(@@GLOBAL.innodb_use_native_aio, 'ON', 'OFF') = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_use_native_aio';
+--enable_warnings
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.innodb_use_native_aio);
+--echo 1 Expected
+
+--disable_warnings
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_use_native_aio';
+--enable_warnings
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_035_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@innodb_use_native_aio = @@GLOBAL.innodb_use_native_aio;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_035_05----------------------#'
+################################################################################
+# Check if innodb_use_native_aio can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@innodb_use_native_aio);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.innodb_use_native_aio);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.innodb_use_native_aio);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.innodb_use_native_aio);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT innodb_use_native_aio = @@SESSION.innodb_use_native_aio;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_write_io_threads_basic.opt b/mysql-test/suite/sys_vars/t/innodb_write_io_threads_basic.opt
new file mode 100644
index 00000000..9740d1ad
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_write_io_threads_basic.opt
@@ -0,0 +1 @@
+--innodb_write_io_threads=2
diff --git a/mysql-test/suite/sys_vars/t/innodb_write_io_threads_basic.test b/mysql-test/suite/sys_vars/t/innodb_write_io_threads_basic.test
new file mode 100644
index 00000000..9ee9f5ba
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_write_io_threads_basic.test
@@ -0,0 +1,36 @@
+
+#
+# 2010-01-27 OBN - Added (this variable is also covered in innodb_file_io_threads_basic.test)
+#
+
+--source include/have_innodb.inc
+
+#
+# show the global and session values;
+#
+select @@global.innodb_write_io_threads;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_write_io_threads;
+show global variables like 'innodb_write_io_threads';
+show session variables like 'innodb_write_io_threads';
+--disable_warnings
+select * from information_schema.global_variables where variable_name='innodb_write_io_threads';
+select * from information_schema.session_variables where variable_name='innodb_write_io_threads';
+--enable_warnings
+
+#
+# show that it's not read-only
+#
+select @@innodb_write_io_threads into @n;
+--disable_warnings
+set global innodb_write_io_threads=1;
+--enable_warnings
+select @@innodb_write_io_threads;
+--disable_warnings
+set global innodb_write_io_threads=64;
+--enable_warnings
+select @@innodb_write_io_threads;
+--disable_warnings
+set global innodb_write_io_threads=@n;
+--enable_warnings
+
diff --git a/mysql-test/suite/sys_vars/t/insert_id_basic.test b/mysql-test/suite/sys_vars/t/insert_id_basic.test
new file mode 100644
index 00000000..36272e99
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/insert_id_basic.test
@@ -0,0 +1,186 @@
+############## mysql-test\t\insert_id_basic.test ###############
+# #
+# Variable Name: insert_id #
+# Scope: SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value:- #
+# Range: - #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable insert_id #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+
+################################################################
+# START OF insert_id TESTS #
+################################################################
+
+
+################################################################
+# Saving initial value of insert_id in a temporary variable #
+################################################################
+
+SET @start_value = @@session.insert_id;
+SELECT @start_value;
+
+
+--echo '#--------------------FN_DYNVARS_051_01------------------------#'
+#################################################################
+# Display the DEFAULT value of insert_id #
+#################################################################
+
+SET @@session.insert_id = 99;
+# SET @@session.insert_id = DEFAULT;
+--echo 'Variable is giving error on assigning Default value';
+SELECT @@session.insert_id;
+
+
+--echo '#---------------------FN_DYNVARS_051_02-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@session.insert_id = @start_value;
+SELECT @@session.insert_id = 0;
+
+
+--echo '#--------------------FN_DYNVARS_051_03------------------------#'
+#################################################################
+# Change the value of insert_id to a valid value #
+#################################################################
+
+SET @@session.insert_id = 0;
+SELECT @@session.insert_id;
+SET @@session.insert_id = 1099;
+SELECT @@session.insert_id;
+SET @@session.insert_id = 1800;
+SELECT @@session.insert_id;
+SET @@session.insert_id = 65535;
+SELECT @@session.insert_id;
+
+
+--echo '#--------------------FN_DYNVARS_051_04-------------------------#'
+####################################################################
+# Change the value of insert_id to invalid value #
+####################################################################
+
+SET @@session.insert_id = -1;
+SELECT @@session.insert_id;
+SET @@session.insert_id = 100000000000;
+SELECT @@session.insert_id;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.insert_id = 10000.01;
+SELECT @@session.insert_id;
+SET @@session.insert_id = -1024;
+SELECT @@session.insert_id;
+SET @@session.insert_id = 42949672950;
+SELECT @@session.insert_id;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.insert_id = ON;
+SELECT @@session.insert_id;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.insert_id = 'test';
+SELECT @@session.insert_id;
+
+
+--echo '#-------------------FN_DYNVARS_051_05----------------------------#'
+###################################################################
+# Test if accessing global insert_id gives error #
+###################################################################
+
+--Error ER_LOCAL_VARIABLE
+SET @@global.insert_id = 0;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@global.insert_id;
+
+
+--echo '#----------------------FN_DYNVARS_051_06------------------------#'
+##############################################################################
+# Check if the value in GLOBAL & SESSION Tables matches values in variable #
+##############################################################################
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@global.insert_id = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='insert_id';
+
+SELECT @@session.insert_id = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='insert_id';
+
+
+--echo '#-------------------FN_DYNVARS_051_07----------------------------#'
+######################################################################
+# Test if accessing GLOBAL identity gives error #
+######################################################################
+
+--Error ER_LOCAL_VARIABLE
+SET @@global.insert_id = 0;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@global.insert_id;
+
+
+--echo '#---------------------FN_DYNVARS_051_08----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@session.insert_id = TRUE;
+SELECT @@session.insert_id;
+SET @@session.insert_id = FALSE;
+SELECT @@session.insert_id;
+
+
+--echo '#---------------------FN_DYNVARS_051_09----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@session.insert_id = 1;
+SELECT @@insert_id = @@session.insert_id;
+SELECT @@session.insert_id = @@local.insert_id;
+
+
+--echo '#---------------------FN_DYNVARS_051_10----------------------#'
+###################################################################
+# Check if insert_id can be accessed with and without @@ sign #
+###################################################################
+
+
+SET insert_id = 1;
+SELECT @@insert_id;
+--Error ER_UNKNOWN_TABLE
+SELECT local.insert_id;
+--Error ER_UNKNOWN_TABLE
+SELECT session.insert_id;
+--Error ER_BAD_FIELD_ERROR
+SELECT insert_id = @@session.insert_id;
+
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@session.insert_id = @start_value;
+SELECT @@session.insert_id;
+
+
+#################################################################
+# END OF insert_id TESTS #
+#################################################################
+
diff --git a/mysql-test/suite/sys_vars/t/insert_id_func.test b/mysql-test/suite/sys_vars/t/insert_id_func.test
new file mode 100644
index 00000000..feb510c0
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/insert_id_func.test
@@ -0,0 +1,125 @@
+################### mysql-test\t\insert_id_func.test ##########################
+# #
+# Variable Name: insert_id #
+# Scope: SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value:- #
+# Range: - #
+# #
+# #
+# Creation Date: 2008-03-07 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable insert_id #
+# that checks the functionality of this variable #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#########################
+# Creating new table #
+#########################
+
+--echo ## Creating new table t1 ##
+CREATE TABLE t1
+(
+id INT NOT NULL auto_increment,
+PRIMARY KEY (id),
+name VARCHAR(30)
+);
+
+--echo '#--------------------FN_DYNVARS_051_01-------------------------#'
+#######################################################################
+# Setting initial value of insert_id and verifying its behavior #
+#######################################################################
+
+--echo ## Setting value of variable to 100 ##
+SET @@session.insert_id = 100;
+SELECT @@session.insert_id;
+
+--echo ## Inserting some rows in table ##
+INSERT into t1(name) values('Record_1');
+INSERT into t1(name) values('Record_2');
+
+--echo ## Verifying rows in table ##
+SELECT * from t1;
+SELECT @@session.insert_id;
+
+INSERT into t1(name) values('Record_3');
+
+
+
+--echo '#--------------------FN_DYNVARS_051_02-------------------------#'
+##########################################################
+# Verifying value of insert_id with new connection #
+##########################################################
+
+connect (test_con1, localhost, root,,);
+connection test_con1;
+
+--echo ## Setting value of insert_id to 50 ##
+SET @@session.insert_id = 50;
+SELECT @@session.insert_id;
+
+--echo ## Inserting rows in table t1 ##
+INSERT into t1(name) values('Record_4');
+INSERT into t1(name) values('Record_5');
+INSERT into t1(name) values('Record_6');
+
+SELECT * from t1;
+
+--echo 'Bug#35376 Value of insert_id automatically resets to 0 after inserting
+--echo ' 1st row'
+
+--echo '#--------------------FN_DYNVARS_051_03-------------------------#'
+#############################################################################
+# Now verifying some new value of insert_id with second new connection #
+#############################################################################
+
+connect (test_con2, localhost, root,,);
+connection test_con2;
+
+--echo ## Setting session value of variable to 25 ##
+SET @@session.insert_id = 25;
+
+--echo ## Inserting some rows in table ##
+INSERT into t1(name) values('Record_7');
+INSERT into t1(name) values('Record_8');
+
+--echo ## Verifying data in table t1 ##
+SELECT * from t1;
+
+
+--echo ## Dropping table t1 ##
+drop table t1;
+
+disconnect test_con1;
+disconnect test_con2;
+
+# MDEV-22711 Assertion `nr != 0' failed in handler::update_auto_increment.
+#
+connection default;
+CREATE TABLE t1(id int primary key auto_increment);
+SET SESSION insert_id=123;
+SET SESSION insert_id=0;
+INSERT INTO t1 VALUES ();
+SET SESSION insert_id=123;
+SET SESSION insert_id=default;
+INSERT INTO t1 VALUES ();
+SET SESSION insert_id=123;
+SET SESSION insert_id=-1;
+INSERT INTO t1 VALUES ();
+SET SESSION insert_id=123;
+SET SESSION insert_id=-10;
+INSERT INTO t1 VALUES ();
+SELECT * FROM t1;
+DROP TABLE t1;
+
diff --git a/mysql-test/suite/sys_vars/t/interactive_timeout_basic.test b/mysql-test/suite/sys_vars/t/interactive_timeout_basic.test
new file mode 100644
index 00000000..5f7d0e15
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/interactive_timeout_basic.test
@@ -0,0 +1,206 @@
+############## mysql-test\t\interactive_timeout_basic.test ###############
+# #
+# Variable Name: interactive_timeout #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value:28800 #
+# Minvalue: 1 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable interactive_timeout #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+
+###################################################################
+# START OF interactive_timeout TESTS #
+###################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.interactive_timeout;
+SELECT @start_global_value;
+SET @start_session_value = @@session.interactive_timeout;
+SELECT @start_session_value;
+
+
+--echo '#--------------------FN_DYNVARS_052_01-------------------------#'
+###################################################################
+# Display the DEFAULT value of interactive_timeout #
+###################################################################
+
+SET @@global.interactive_timeout = 100;
+SET @@global.interactive_timeout = DEFAULT;
+SELECT @@global.interactive_timeout;
+
+SET @@session.interactive_timeout = 200;
+SET @@session.interactive_timeout = DEFAULT;
+SELECT @@session.interactive_timeout;
+
+
+--echo '#--------------------FN_DYNVARS_052_02-------------------------#'
+###################################################################
+# Check the DEFAULT value of interactive_timeout #
+###################################################################
+
+SET @@global.interactive_timeout = DEFAULT;
+SELECT @@global.interactive_timeout = 28800;
+
+SET @@session.interactive_timeout = DEFAULT;
+SELECT @@session.interactive_timeout = 28800;
+
+
+--echo '#--------------------FN_DYNVARS_052_03-------------------------#'
+#############################################################################
+# Change the value of interactive_timeout to a valid value for GLOBAL Scope #
+#############################################################################
+
+SET @@global.interactive_timeout = 1;
+SELECT @@global.interactive_timeout;
+SET @@global.interactive_timeout = 60020;
+SELECT @@global.interactive_timeout;
+SET @@global.interactive_timeout = 65535;
+SELECT @@global.interactive_timeout;
+
+
+--echo '#--------------------FN_DYNVARS_052_04-------------------------#'
+##############################################################################
+# Change the value of interactive_timeout to a valid value for SESSION Scope #
+##############################################################################
+
+SET @@session.interactive_timeout = 1;
+SELECT @@session.interactive_timeout;
+SET @@session.interactive_timeout = 50050;
+SELECT @@session.interactive_timeout;
+SET @@session.interactive_timeout = 65535;
+SELECT @@session.interactive_timeout;
+
+
+--echo '#------------------FN_DYNVARS_052_05-----------------------#'
+###############################################################
+# Change the value of interactive_timeout to an invalid value #
+###############################################################
+
+SET @@global.interactive_timeout = 0;
+SELECT @@global.interactive_timeout;
+SET @@global.interactive_timeout = -1024;
+SELECT @@global.interactive_timeout;
+SET @@global.interactive_timeout = 1000000000;
+SELECT @@global.interactive_timeout;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.interactive_timeout = 65530.34;
+SELECT @@global.interactive_timeout;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.interactive_timeout = test;
+SELECT @@global.interactive_timeout;
+
+SET @@session.interactive_timeout = 0;
+SELECT @@session.interactive_timeout;
+SET @@session.interactive_timeout = -2;
+SELECT @@session.interactive_timeout;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.interactive_timeout = 65530.34;
+SET @@session.interactive_timeout = 100000000;
+SELECT @@session.interactive_timeout;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.interactive_timeout = test;
+SELECT @@session.interactive_timeout;
+
+
+--echo '#------------------FN_DYNVARS_052_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT @@global.interactive_timeout = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='interactive_timeout';
+
+--echo '#------------------FN_DYNVARS_052_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.interactive_timeout = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='interactive_timeout';
+
+
+--echo '#------------------FN_DYNVARS_052_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.interactive_timeout = TRUE;
+SELECT @@global.interactive_timeout;
+SET @@global.interactive_timeout = FALSE;
+SELECT @@global.interactive_timeout;
+
+
+--echo '#---------------------FN_DYNVARS_052_09----------------------#'
+#################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+#################################################################################
+
+SET @@global.interactive_timeout = 10;
+SELECT @@interactive_timeout = @@global.interactive_timeout;
+
+
+--echo '#---------------------FN_DYNVARS_052_10----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@interactive_timeout = 100;
+SELECT @@interactive_timeout = @@local.interactive_timeout;
+SELECT @@local.interactive_timeout = @@session.interactive_timeout;
+
+
+--echo '#---------------------FN_DYNVARS_052_11----------------------#'
+##############################################################################
+# Check if interactive_timeout can be accessed with and without @@ sign #
+##############################################################################
+
+SET interactive_timeout = 1;
+SELECT @@interactive_timeout;
+--Error ER_UNKNOWN_TABLE
+SELECT local.interactive_timeout;
+--Error ER_UNKNOWN_TABLE
+SELECT session.interactive_timeout;
+--Error ER_BAD_FIELD_ERROR
+SELECT interactive_timeout = @@session.interactive_timeout;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.interactive_timeout = @start_global_value;
+SELECT @@global.interactive_timeout;
+SET @@session.interactive_timeout = @start_session_value;
+SELECT @@session.interactive_timeout;
+
+
+########################################################
+# END OF interactive_timeout TESTS #
+########################################################
+
diff --git a/mysql-test/suite/sys_vars/t/interactive_timeout_func.test b/mysql-test/suite/sys_vars/t/interactive_timeout_func.test
new file mode 100644
index 00000000..28487a7b
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/interactive_timeout_func.test
@@ -0,0 +1,82 @@
+################################################################################
+# #
+# Variable Name: interactive_timeout #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value:28800 #
+# Minvalue: 1 #
+# #
+# #
+# Creation Date: 2008-03-07 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable interactive_timeout #
+# that checks the functionality of this variable #
+# Modified: HHunger 2009-02-26 Inserted clean up, beautifications. #
+# It is not yet possible to set CLIENT_INTERACIVE #
+# When connecting, so the test has not the #
+# desired effect. See 'wait_timeout_func'. #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# #
+################################################################################
+
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+##############################
+# Creating two new tables #
+##############################
+
+--echo ## Creating new table t1 ##
+CREATE TABLE t1
+(
+id INT NOT NULL auto_increment,
+PRIMARY KEY (id),
+name VARCHAR(30)
+);
+
+
+--echo '#--------------------FN_DYNVARS_052_01-------------------------#'
+#######################################################################
+# Setting initial value of interactive_timeout to 1 and verifying its
+# behavior
+#######################################################################
+let $start_value= `SELECT @@global.interactive_timeout`;
+
+--echo ## Setting initial value of variable to 1 ##
+SET @@global.interactive_timeout = 1;
+
+# Not yet possible to set CLEAN_INTERACTIVE flag
+connect (test_con1, localhost, root,,,,,);
+connection test_con1;
+
+--echo ## Inserting record in table ##
+INSERT into t1(name) values('Record_1');
+
+--echo ## Setting session value of interactive_timeout ##
+SET @@session.interactive_timeout = 1;
+
+--echo ## Verifying values of variable ##
+SELECT @@session.interactive_timeout;
+SELECT @@global.interactive_timeout;
+
+connection default;
+--echo ## Using sleep to check timeout ##
+--echo sleep 2;
+sleep 2;
+
+connection test_con1;
+SELECT * from t1;
+
+INSERT into t1(name) values('Record_2');
+
+connection default;
+
+disconnect test_con1;
+DROP TABLE t1;
+
+eval SET @@global.interactive_timeout= $start_value;
diff --git a/mysql-test/suite/sys_vars/t/join_buffer_size_basic.test b/mysql-test/suite/sys_vars/t/join_buffer_size_basic.test
new file mode 100644
index 00000000..d610ddb1
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/join_buffer_size_basic.test
@@ -0,0 +1,187 @@
+############## mysql-test\t\join_buffer_size_basic.test ###############
+# #
+# Variable Name: join_buffer_size #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 131072 #
+# Range: 8200-4294967295 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable join_buffer_size #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+################################################################
+# START OF join_buffer_size TESTS #
+################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.join_buffer_size;
+SET @start_session_value = @@session.join_buffer_size;
+
+--echo '#--------------------FN_DYNVARS_053_01-------------------------#'
+################################################################
+# Display the DEFAULT value of join_buffer_size #
+################################################################
+
+SET @@global.join_buffer_size = DEFAULT;
+SELECT @@global.join_buffer_size > 0;
+
+SET @@session.join_buffer_size = DEFAULT;
+SELECT @@session.join_buffer_size > 0;
+
+
+--echo '#--------------------FN_DYNVARS_053_03-------------------------#'
+##########################################################################
+# Change the value of join_buffer_size to a valid value for GLOBAL Scope #
+##########################################################################
+
+SET @@global.join_buffer_size = 8200;
+SELECT @@global.join_buffer_size;
+SET @@global.join_buffer_size = 65536;
+SELECT @@global.join_buffer_size;
+SET @@global.join_buffer_size = 4294967295;
+SELECT @@global.join_buffer_size;
+
+--echo '#--------------------FN_DYNVARS_053_04-------------------------#'
+###########################################################################
+# Change the value of join_buffer_size to a valid value for SESSION Scope #
+###########################################################################
+
+SET @@session.join_buffer_size = 8200;
+SELECT @@session.join_buffer_size;
+SET @@session.join_buffer_size = 65536;
+SELECT @@session.join_buffer_size;
+SET @@session.join_buffer_size = 4294967295;
+SELECT @@session.join_buffer_size;
+
+--echo '#------------------FN_DYNVARS_053_05-----------------------#'
+############################################################
+# Change the value of join_buffer_size to an invalid value #
+############################################################
+
+SET @@global.join_buffer_size = 0;
+SELECT @@global.join_buffer_size;
+SET @@global.join_buffer_size = -1024;
+SELECT @@global.join_buffer_size;
+SET @@global.join_buffer_size = 127;
+SELECT @@global.join_buffer_size;
+SET @@global.join_buffer_size = 42949672951;
+--replace_result 42949672832 max_join_buffer_size 4294967168 max_join_buffer_size
+SELECT @@global.join_buffer_size;
+SET @@global.join_buffer_size = 1024*1024;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.join_buffer_size = 65530.34;
+SELECT @@global.join_buffer_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.join_buffer_size = test;
+SELECT @@global.join_buffer_size;
+
+SET @@session.join_buffer_size = 0;
+SELECT @@session.join_buffer_size;
+SET @@session.join_buffer_size = -1024;
+SELECT @@session.join_buffer_size;
+SET @@session.join_buffer_size = 127;
+SELECT @@session.join_buffer_size;
+SET @@session.join_buffer_size = 42949672951;
+--replace_result 42949672832 max_join_buffer_size 4294967168 max_join_buffer_size
+SELECT @@session.join_buffer_size;
+SET @@session.join_buffer_size = 1024*1024;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.join_buffer_size = 65530.34;
+SELECT @@session.join_buffer_size;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.join_buffer_size = test;
+SELECT @@session.join_buffer_size;
+
+--echo '#------------------FN_DYNVARS_053_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT @@global.join_buffer_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='join_buffer_size';
+
+--echo '#------------------FN_DYNVARS_053_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.join_buffer_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='join_buffer_size';
+
+
+--echo '#------------------FN_DYNVARS_053_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.join_buffer_size = TRUE;
+SET @@global.join_buffer_size = FALSE;
+
+--echo '#---------------------FN_DYNVARS_001_09----------------------#'
+#################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+#################################################################################
+
+SET @@global.join_buffer_size = 10;
+SELECT @@join_buffer_size = @@global.join_buffer_size;
+
+--echo '#---------------------FN_DYNVARS_001_10----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@join_buffer_size = 100;
+SELECT @@join_buffer_size = @@local.join_buffer_size;
+SELECT @@local.join_buffer_size = @@session.join_buffer_size;
+
+--echo '#---------------------FN_DYNVARS_001_11----------------------#'
+##############################################################################
+# Check if join_buffer_size can be accessed with and without @@ sign #
+##############################################################################
+
+SET join_buffer_size = 1;
+SELECT @@join_buffer_size;
+--Error ER_UNKNOWN_TABLE
+SELECT local.join_buffer_size;
+--Error ER_UNKNOWN_TABLE
+SELECT session.join_buffer_size;
+--Error ER_BAD_FIELD_ERROR
+SELECT join_buffer_size = @@session.join_buffer_size;
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.join_buffer_size = @start_global_value;
+SET @@session.join_buffer_size = @start_session_value;
+
+########################################################
+# END OF join_buffer_size TESTS #
+########################################################
+
diff --git a/mysql-test/suite/sys_vars/t/join_buffer_space_limit_basic.test b/mysql-test/suite/sys_vars/t/join_buffer_space_limit_basic.test
new file mode 100644
index 00000000..0182820f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/join_buffer_space_limit_basic.test
@@ -0,0 +1,45 @@
+# ulonglong session
+
+SET @start_global_value = @@global.join_buffer_space_limit;
+
+#
+# exists as global and session
+#
+--replace_column 2 #
+show global variables like 'join_buffer_space_limit';
+--replace_column 2 #
+show session variables like 'join_buffer_space_limit';
+--replace_column 2 #
+select * from information_schema.global_variables where variable_name='join_buffer_space_limit';
+--replace_column 2 #
+select * from information_schema.session_variables where variable_name='join_buffer_space_limit';
+
+#
+# show that it's writable
+#
+set global join_buffer_space_limit=10;
+select @@global.join_buffer_space_limit;
+set session join_buffer_space_limit=10;
+select @@session.join_buffer_space_limit;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global join_buffer_space_limit=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set session join_buffer_space_limit=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global join_buffer_space_limit="foo";
+
+#
+# min/max values, block size
+#
+set global join_buffer_space_limit=0;
+select @@global.join_buffer_space_limit;
+set global join_buffer_space_limit=4095;
+select @@global.join_buffer_space_limit;
+set session join_buffer_space_limit=cast(-1 as unsigned int);
+select @@session.join_buffer_space_limit;
+
+SET @@global.join_buffer_space_limit = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/join_cache_level_basic.test b/mysql-test/suite/sys_vars/t/join_cache_level_basic.test
new file mode 100644
index 00000000..a39ddffe
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/join_cache_level_basic.test
@@ -0,0 +1,43 @@
+# ulong session
+
+SET @start_global_value = @@global.join_cache_level;
+
+#
+# exists as global only
+#
+--replace_column 2 #
+show global variables like 'join_cache_level';
+--replace_column 2 #
+show session variables like 'join_cache_level';
+--replace_column 2 #
+select * from information_schema.global_variables where variable_name='join_cache_level';
+--replace_column 2 #
+select * from information_schema.session_variables where variable_name='join_cache_level';
+
+#
+# show that it's writable
+#
+set global join_cache_level=4;
+select @@global.join_cache_level;
+set session join_cache_level=4;
+select @@session.join_cache_level;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global join_cache_level=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set session join_cache_level=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global join_cache_level="foo";
+
+#
+# min/max values, block size
+#
+set global join_cache_level=0;
+select @@global.join_cache_level;
+set session join_cache_level=cast(-1 as unsigned int);
+select @@session.join_cache_level;
+
+SET @@global.join_cache_level = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/keep_files_on_create_basic.test b/mysql-test/suite/sys_vars/t/keep_files_on_create_basic.test
new file mode 100644
index 00000000..e6141af4
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/keep_files_on_create_basic.test
@@ -0,0 +1,219 @@
+############## mysql-test\t\keep_files_on_create_basic.test ###################
+# #
+# Variable Name: keep_files_on_create #
+# Scope: GLOBAL & SESSION #
+# Access Type: Dynamic #
+# Data Type: boolean #
+# Default Value: OFF #
+# Range: #
+# #
+# #
+# Creation Date: 2008-02-11 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable keep_files_on_create #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_keep_files_on_create #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+####################################################################
+# START OF keep_files_on_create TESTS #
+####################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.keep_files_on_create;
+SELECT @start_global_value;
+SET @start_session_value = @@session.keep_files_on_create;
+SELECT @start_session_value;
+
+
+--echo '#--------------------FN_DYNVARS_054_01-------------------------#'
+########################################################################
+# Display the DEFAULT value of keep_files_on_create #
+########################################################################
+
+SET @@global.keep_files_on_create = ON;
+SET @@global.keep_files_on_create = DEFAULT;
+SELECT @@global.keep_files_on_create;
+
+SET @@session.keep_files_on_create = ON;
+SET @@session.keep_files_on_create = DEFAULT;
+SELECT @@session.keep_files_on_create;
+
+
+--echo '#--------------------FN_DYNVARS_054_02-------------------------#'
+########################################################################
+# Check the DEFAULT value of keep_files_on_create #
+########################################################################
+
+SET @@global.keep_files_on_create = DEFAULT;
+SELECT @@global.keep_files_on_create = 'OFF';
+
+SET @@session.keep_files_on_create = DEFAULT;
+SELECT @@session.keep_files_on_create = 'OFF';
+
+
+--echo '#--------------------FN_DYNVARS_054_03-------------------------#'
+##############################################################################
+# Change the value of keep_files_on_create to a valid value for GLOBAL Scope #
+##############################################################################
+
+SET @@global.keep_files_on_create = ON;
+SELECT @@global.keep_files_on_create;
+SET @@global.keep_files_on_create = OFF;
+SELECT @@global.keep_files_on_create;
+SET @@global.keep_files_on_create = 0;
+SELECT @@global.keep_files_on_create;
+SET @@global.keep_files_on_create = 1;
+SELECT @@global.keep_files_on_create;
+SET @@global.keep_files_on_create = TRUE;
+SELECT @@global.keep_files_on_create;
+SET @@global.keep_files_on_create = FALSE;
+SELECT @@global.keep_files_on_create;
+
+
+
+--echo '#--------------------FN_DYNVARS_054_04-------------------------#'
+###############################################################################
+# Change the value of keep_files_on_create to a valid value for SESSION Scope #
+###############################################################################
+
+SET @@session.keep_files_on_create = ON;
+SELECT @@session.keep_files_on_create;
+SET @@session.keep_files_on_create = OFF;
+SELECT @@session.keep_files_on_create;
+SET @@session.keep_files_on_create = 0;
+SELECT @@session.keep_files_on_create;
+SET @@session.keep_files_on_create = 1;
+SELECT @@session.keep_files_on_create;
+SET @@session.keep_files_on_create = TRUE;
+SELECT @@session.keep_files_on_create;
+SET @@session.keep_files_on_create = FALSE;
+SELECT @@session.keep_files_on_create;
+
+
+--echo '#------------------FN_DYNVARS_054_05-----------------------#'
+################################################################
+# Change the value of keep_files_on_create to an invalid value #
+################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.keep_files_on_create = 'ONN';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.keep_files_on_create = "OFFF";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.keep_files_on_create = TTRUE;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.keep_files_on_create = FELSE;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.keep_files_on_create = -1024;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.keep_files_on_create = 65536;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.keep_files_on_create = 65530.34;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.keep_files_on_create = test;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.keep_files_on_create = ONN;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.keep_files_on_create = ONF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.keep_files_on_create = OF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.keep_files_on_create = 'OFN';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.keep_files_on_create = -2;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.keep_files_on_create = 65530.34;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.keep_files_on_create = 65550;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.keep_files_on_create = test;
+SELECT @@session.keep_files_on_create;
+
+
+--echo '#------------------FN_DYNVARS_054_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT IF(@@global.keep_files_on_create, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='keep_files_on_create';
+
+--echo '#------------------FN_DYNVARS_054_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT IF(@@session.keep_files_on_create, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='keep_files_on_create';
+
+
+--echo '#---------------------FN_DYNVARS_001_08----------------------#'
+###############################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+###############################################################################
+
+SET @@keep_files_on_create = OFF;
+SET @@global.keep_files_on_create = ON;
+SELECT @@keep_files_on_create = @@global.keep_files_on_create;
+
+
+--echo '#---------------------FN_DYNVARS_001_09----------------------#'
+##############################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points #
+# to same session variable #
+##############################################################################
+
+SET @@keep_files_on_create = ON;
+SELECT @@keep_files_on_create = @@local.keep_files_on_create;
+SELECT @@local.keep_files_on_create = @@session.keep_files_on_create;
+
+
+--echo '#---------------------FN_DYNVARS_001_10----------------------#'
+###############################################################################
+# Check if keep_files_on_create can be accessed with and without @@ sign #
+###############################################################################
+
+SET keep_files_on_create = 1;
+SELECT @@keep_files_on_create;
+--Error ER_UNKNOWN_TABLE
+SELECT local.keep_files_on_create;
+--Error ER_UNKNOWN_TABLE
+SELECT session.keep_files_on_create;
+--Error ER_BAD_FIELD_ERROR
+SELECT keep_files_on_create = @@session.keep_files_on_create;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.keep_files_on_create = @start_global_value;
+SELECT @@global.keep_files_on_create;
+SET @@session.keep_files_on_create = @start_session_value;
+SELECT @@session.keep_files_on_create;
+
+
+#########################################################
+# END OF keep_files_on_create TESTS #
+#########################################################
+
diff --git a/mysql-test/suite/sys_vars/t/key_buffer_size_basic.test b/mysql-test/suite/sys_vars/t/key_buffer_size_basic.test
new file mode 100644
index 00000000..a737b30a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/key_buffer_size_basic.test
@@ -0,0 +1,147 @@
+############## mysql-test\t\key_buffer_size_basic.test ########################
+# #
+# Variable Name: key_buffer_size #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 131072 #
+# Range:8-4294967295 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable key_buffer_size #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# Modified: Horst Hunger 2008-11-27 #
+# Due to OS depending values the check has been changed #
+# from concrete values to ranges. #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF key_buffer_size TESTS #
+########################################################################
+
+########################################################################
+# Saving initial value of key_buffer_size in a temporary variable #
+########################################################################
+
+SET @start_value = @@global.key_buffer_size;
+
+--echo '#--------------------FN_DYNVARS_055_01------------------------#'
+########################################################################
+# Display the DEFAULT value of key_buffer_size #
+########################################################################
+
+SET @@global.key_buffer_size = DEFAULT;
+SELECT @@global.key_buffer_size;
+
+--echo '#---------------------FN_DYNVARS_055_02-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@global.key_buffer_size = @start_value;
+SELECT @@global.key_buffer_size = @start_value;
+
+--echo '#--------------------FN_DYNVARS_055_03------------------------#'
+########################################################################
+# Change the value of key_buffer_size to a valid value #
+########################################################################
+
+SET @@global.key_buffer_size = 65535;
+SELECT @@global.key_buffer_size;
+
+--echo '#--------------------FN_DYNVARS_055_04-------------------------#'
+###########################################################################
+# Change the value of key_buffer_size to invalid value #
+###########################################################################
+
+--Error ER_WARN_CANT_DROP_DEFAULT_KEYCACHE
+SET @@global.key_buffer_size = -1;
+--Error ER_WARN_CANT_DROP_DEFAULT_KEYCACHE
+SET @@global.key_buffer_size = 4;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.key_buffer_size = 10000.01;
+SELECT @@global.key_buffer_size;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.key_buffer_size = ON;
+SELECT @@global.key_buffer_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.key_buffer_size = 'test';
+SELECT @@global.key_buffer_size;
+
+--echo '#-------------------FN_DYNVARS_055_05----------------------------#'
+###########################################################################
+# Test if accessing session key_buffer_size gives error #
+###########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.key_buffer_size = 0;
+
+--echo '#----------------------FN_DYNVARS_055_06------------------------#'
+##############################################################################
+# Check if the value in GLOBAL & SESSION Tables matches values in variable #
+##############################################################################
+
+SELECT @@global.key_buffer_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='key_buffer_size';
+
+SELECT @@key_buffer_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='key_buffer_size';
+
+--echo '#---------------------FN_DYNVARS_055_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+--Error ER_WARN_CANT_DROP_DEFAULT_KEYCACHE
+SET @@global.key_buffer_size = TRUE;
+--Error ER_WARN_CANT_DROP_DEFAULT_KEYCACHE
+SET @@global.key_buffer_size = FALSE;
+
+--echo '#---------------------FN_DYNVARS_055_08----------------------#'
+#####################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE #
+# points to same session variable #
+#####################################################################
+
+SELECT @@key_buffer_size = @@global.key_buffer_size;
+
+--echo '#---------------------FN_DYNVARS_055_09----------------------#'
+##########################################################################
+# Check if key_buffer_size can be accessed with and without @@ sign #
+##########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET key_buffer_size = 8 ;
+--Error ER_UNKNOWN_TABLE
+SELECT local.key_buffer_size;
+--Error ER_UNKNOWN_TABLE
+SELECT global.key_buffer_size;
+--Error ER_BAD_FIELD_ERROR
+SELECT key_buffer_size = @@session.key_buffer_size;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.key_buffer_size = @start_value;
+
+#######################################################################
+# END OF key_buffer_size TESTS #
+#######################################################################
+
diff --git a/mysql-test/suite/sys_vars/t/key_buffer_size_func.test b/mysql-test/suite/sys_vars/t/key_buffer_size_func.test
new file mode 100644
index 00000000..77637bb8
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/key_buffer_size_func.test
@@ -0,0 +1,114 @@
+################### mysql-test\t\key_buffer_size_func.test ####################
+# #
+# Variable Name: key_buffer_size #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 131072 #
+# Range:8-4294967295 #
+# #
+# #
+# Creation Date: 2008-03-07 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable key_buffer_size #
+# that checks the functionality of this variable #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# #
+###############################################################################
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+#########################
+# Creating new table #
+#########################
+
+--echo ## Creating new table t1 ##
+CREATE TABLE t1
+(
+id INT NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id),
+rollno INT NOT NULL,
+name VARCHAR(30)
+);
+
+SET @start_value= @@global.key_buffer_size;
+
+FLUSH STATUS;
+
+--echo '#--------------------FN_DYNVARS_055_01-------------------------#'
+########################################################################
+# Setting initial value of key_buffer_size, inserting some rows
+# & creating 2 new connections
+########################################################################
+
+--echo ## Setting initial value of variable to 131072 ##
+SET @@global.key_buffer_size = 131072;
+
+
+CONNECT (test_con1,localhost,root,,);
+CONNECT (test_con2,localhost,root,,);
+
+
+--echo '#--------------------FN_DYNVARS_055_02-------------------------#'
+###############################################################################
+# Verifying initial behavior of variable by concatinating values greater than 4
+###############################################################################
+
+CONNECTION test_con1;
+SELECT @@global.key_buffer_size;
+
+
+--echo ## Inserting some rows in table ##
+INSERT INTO t1(rollno, name) VALUES(1, 'Record_1');
+INSERT INTO t1(rollno, name) VALUES(2, 'Record_2');
+INSERT INTO t1(rollno, name) VALUES(1, 'Record_3');
+INSERT INTO t1(rollno, name) VALUES(3, 'Record_4');
+INSERT INTO t1(rollno, name) VALUES(1, 'Record_5');
+INSERT INTO t1(rollno, name) VALUES(3, 'Record_6');
+INSERT INTO t1(rollno, name) VALUES(4, 'Record_7');
+INSERT INTO t1(rollno, name) VALUES(4, 'Record_8');
+INSERT INTO t1(rollno, name) VALUES(4, 'Record_9');
+INSERT INTO t1(rollno, name) VALUES(4, 'Record_10');
+
+--echo ## Key_reads must be zero (no disk access) ##
+show status like 'Key_reads';
+
+connection test_con2;
+
+--echo ## Key_reads must be zero (no disk access) ##
+show status like 'Key_reads';
+
+CONNECTION test_con1;
+
+--echo ## Inserting some rows in table ##
+INSERT INTO t1(rollno, name) VALUES(5, 'Record_11');
+INSERT INTO t1(rollno, name) VALUES(6, 'Record_12');
+INSERT INTO t1(rollno, name) VALUES(5, 'Record_13');
+INSERT INTO t1(rollno, name) VALUES(7, 'Record_14');
+INSERT INTO t1(rollno, name) VALUES(5, 'Record_15');
+INSERT INTO t1(rollno, name) VALUES(7, 'Record_16');
+INSERT INTO t1(rollno, name) VALUES(8, 'Record_17');
+INSERT INTO t1(rollno, name) VALUES(8, 'Record_18');
+INSERT INTO t1(rollno, name) VALUES(8, 'Record_19');
+INSERT INTO t1(rollno, name) VALUES(8, 'Record_20');
+
+--echo ## Key_reads must be zero (no disk access) ##
+show status like 'Key_reads';
+
+############################################################
+# Disconnecting all connection & dropping table #
+############################################################
+
+--echo ## Dropping table ##
+DROP TABLE IF EXISTS t1;
+
+DISCONNECT test_con2;
+DISCONNECT test_con1;
+
+connection default;
+SET @@global.key_buffer_size= @start_value;
diff --git a/mysql-test/suite/sys_vars/t/key_cache_age_threshold_basic.test b/mysql-test/suite/sys_vars/t/key_cache_age_threshold_basic.test
new file mode 100644
index 00000000..0d47dc3f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/key_cache_age_threshold_basic.test
@@ -0,0 +1,169 @@
+############## mysql-test\t\key_cache_age_threshold_basic.test ###############
+# #
+# Variable Name: key_cache_age_threshold #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 300 #
+# Range: 100-4294967295 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable key_cache_age_threshold #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF key_cache_age_threshold TESTS #
+########################################################################
+
+
+#############################################################################
+# Saving initial value of key_cache_age_threshold in a temporary variable #
+#############################################################################
+
+SET @start_value = @@global.key_cache_age_threshold;
+SELECT @start_value;
+
+
+--echo '#--------------------FN_DYNVARS_056_01------------------------#'
+################################################################################
+# Display the DEFAULT value of key_cache_age_threshold #
+################################################################################
+
+SET @@global.key_cache_age_threshold = DEFAULT;
+SELECT @@global.key_cache_age_threshold;
+
+
+--echo '#---------------------FN_DYNVARS_056_02-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@global.key_cache_age_threshold = @start_value;
+SELECT @@global.key_cache_age_threshold = 300;
+
+
+--echo '#--------------------FN_DYNVARS_056_03------------------------#'
+###############################################################################
+# Change the value of key_cache_age_threshold to a valid value #
+###############################################################################
+
+SET @@global.key_cache_age_threshold = 100;
+SELECT @@global.key_cache_age_threshold;
+SET @@global.key_cache_age_threshold = 4294967295;
+SELECT @@global.key_cache_age_threshold;
+SET @@global.key_cache_age_threshold = 1800;
+SELECT @@global.key_cache_age_threshold;
+SET @@global.key_cache_age_threshold = 65535;
+SELECT @@global.key_cache_age_threshold;
+
+--echo '#--------------------FN_DYNVARS_056_04-------------------------#'
+###########################################################################
+# Change the value of key_cache_age_threshold to invalid value #
+###########################################################################
+
+SET @@global.key_cache_age_threshold = -1;
+SELECT @@global.key_cache_age_threshold;
+SET @@global.key_cache_age_threshold = 42949672951;
+SELECT @@global.key_cache_age_threshold;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.key_cache_age_threshold = 10000.01;
+SELECT @@global.key_cache_age_threshold;
+SET @@global.key_cache_age_threshold = -1024;
+SELECT @@global.key_cache_age_threshold;
+SET @@global.key_cache_age_threshold = 99;
+SELECT @@global.key_cache_age_threshold;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.key_cache_age_threshold = ON;
+SELECT @@global.key_cache_age_threshold;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.key_cache_age_threshold = 'test';
+SELECT @@global.key_cache_age_threshold;
+
+
+--echo '#-------------------FN_DYNVARS_056_05----------------------------#'
+###########################################################################
+# Test if accessing session key_cache_age_threshold gives error #
+###########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.key_cache_age_threshold = 0;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.key_cache_age_threshold;
+
+
+--echo '#----------------------FN_DYNVARS_056_06------------------------#'
+##############################################################################
+# Check if the value in GLOBAL & SESSION Tables matches values in variable #
+##############################################################################
+
+SELECT @@global.key_cache_age_threshold = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='key_cache_age_threshold';
+
+SELECT @@key_cache_age_threshold = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='key_cache_age_threshold';
+
+
+--echo '#---------------------FN_DYNVARS_056_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.key_cache_age_threshold = TRUE;
+SELECT @@global.key_cache_age_threshold;
+SET @@global.key_cache_age_threshold = FALSE;
+SELECT @@global.key_cache_age_threshold;
+
+
+--echo '#---------------------FN_DYNVARS_056_08----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@global.key_cache_age_threshold = 101;
+SELECT @@key_cache_age_threshold = @@global.key_cache_age_threshold;
+
+
+--echo '#---------------------FN_DYNVARS_056_09----------------------#'
+########################################################################## #######
+# Check if key_cache_age_threshold can be accessed with and without @@ sign #
+##################################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET key_cache_age_threshold = 8000;
+SELECT @@key_cache_age_threshold;
+--Error ER_UNKNOWN_TABLE
+SELECT local.key_cache_age_threshold;
+--Error ER_UNKNOWN_TABLE
+SELECT global.key_cache_age_threshold;
+--Error ER_BAD_FIELD_ERROR
+SELECT key_cache_age_threshold = @@session.key_cache_age_threshold;
+
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.key_cache_age_threshold = @start_value;
+SELECT @@global.key_cache_age_threshold;
+
+
+########################################################################
+# END OF key_cache_age_threshold TESTS #
+########################################################################
diff --git a/mysql-test/suite/sys_vars/t/key_cache_block_size_basic.test b/mysql-test/suite/sys_vars/t/key_cache_block_size_basic.test
new file mode 100644
index 00000000..6e84b121
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/key_cache_block_size_basic.test
@@ -0,0 +1,174 @@
+############## mysql-test\t\key_cache_block_size_basic.test ###############
+# #
+# Variable Name: key_cache_block_size #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: numeric 1024 #
+# Default Value: #
+# Range: 512-16384 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable key_cache_block_size #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+#####################################################################
+# START OF key_cache_block_size TESTS #
+#####################################################################
+
+
+##########################################################################
+# Saving initial value of key_cache_block_size in a temporary variable #
+##########################################################################
+
+SET @start_value = @@global.key_cache_block_size;
+SELECT @start_value;
+
+
+--echo '#--------------------FN_DYNVARS_057_01------------------------#'
+################################################################################
+# Display the DEFAULT value of key_cache_block_size #
+################################################################################
+
+SET @@global.key_cache_block_size = DEFAULT;
+SELECT @@global.key_cache_block_size;
+
+
+--echo '#---------------------FN_DYNVARS_057_02-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@global.key_cache_block_size = @start_value;
+SELECT @@global.key_cache_block_size = 1024;
+
+
+--echo '#--------------------FN_DYNVARS_057_03------------------------#'
+###############################################################################
+# Change the value of key_cache_block_size to a valid value #
+###############################################################################
+
+SET @@global.key_cache_block_size = 1024;
+SELECT @@global.key_cache_block_size;
+SET @@global.key_cache_block_size = 16384;
+SELECT @@global.key_cache_block_size;
+SET @@global.key_cache_block_size = 1800;
+SELECT @@global.key_cache_block_size;
+SET @@global.key_cache_block_size = 16383;
+SELECT @@global.key_cache_block_size;
+
+--echo '#--------------------FN_DYNVARS_057_04-------------------------#'
+###########################################################################
+# Change the value of key_cache_block_size to invalid value #
+###########################################################################
+
+SET @@global.key_cache_block_size = -1;
+SELECT @@global.key_cache_block_size;
+SET @@global.key_cache_block_size = 42949672951;
+SELECT @@global.key_cache_block_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.key_cache_block_size = 10000.01;
+SELECT @@global.key_cache_block_size;
+SET @@global.key_cache_block_size = -1024;
+SELECT @@global.key_cache_block_size;
+SET @@global.key_cache_block_size = 256;
+SELECT @@global.key_cache_block_size;
+SET @@global.key_cache_block_size = 511;
+SELECT @@global.key_cache_block_size;
+SET @@global.key_cache_block_size = 16385;
+SELECT @@global.key_cache_block_size;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.key_cache_block_size = ON;
+SELECT @@global.key_cache_block_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.key_cache_block_size = 'test';
+SELECT @@global.key_cache_block_size;
+
+
+--echo '#-------------------FN_DYNVARS_057_05----------------------------#'
+###########################################################################
+# Test if accessing session key_cache_block_size gives error #
+###########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.key_cache_block_size = 0;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.key_cache_block_size;
+
+
+--echo '#----------------------FN_DYNVARS_057_06------------------------#'
+##############################################################################
+# Check if the value in GLOBAL & SESSION Tables matches values in variable #
+##############################################################################
+
+SELECT @@global.key_cache_block_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='key_cache_block_size';
+
+SELECT @@key_cache_block_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='key_cache_block_size';
+
+
+--echo '#---------------------FN_DYNVARS_057_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.key_cache_block_size = TRUE;
+SELECT @@global.key_cache_block_size;
+SET @@global.key_cache_block_size = FALSE;
+SELECT @@global.key_cache_block_size;
+
+
+--echo '#---------------------FN_DYNVARS_057_08----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@global.key_cache_block_size = 1024;
+SELECT @@key_cache_block_size = @@global.key_cache_block_size;
+
+
+--echo '#---------------------FN_DYNVARS_057_09----------------------#'
+###############################################################################
+# Check if key_cache_block_size can be accessed with and without @@ sign #
+###############################################################################;
+
+--Error ER_GLOBAL_VARIABLE
+SET key_cache_block_size = 8000;
+SELECT @@key_cache_block_size;
+--Error ER_UNKNOWN_TABLE
+SELECT local.key_cache_block_size;
+--Error ER_UNKNOWN_TABLE
+SELECT global.key_cache_block_size;
+--Error ER_BAD_FIELD_ERROR
+SELECT key_cache_block_size = @@session.key_cache_block_size;
+
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.key_cache_block_size = @start_value;
+SELECT @@global.key_cache_block_size;
+
+
+#####################################################################
+# END OF key_cache_block_size TESTS #
+#####################################################################
+
diff --git a/mysql-test/suite/sys_vars/t/key_cache_division_limit_basic.test b/mysql-test/suite/sys_vars/t/key_cache_division_limit_basic.test
new file mode 100644
index 00000000..a1770d62
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/key_cache_division_limit_basic.test
@@ -0,0 +1,175 @@
+############## mysql-test\t\key_cache_division_limit_basic.test ###############
+# #
+# Variable Name: key_cache_division_limit #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 100 #
+# Range: 1-100 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable key_cache_division_limit #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+#####################################################################
+# START OF key_cache_division_limit TESTS #
+#####################################################################
+
+
+##############################################################################
+# Saving initial value of key_cache_division_limit in a temporary variable #
+##############################################################################
+
+SET @start_value = @@global.key_cache_division_limit;
+SELECT @start_value;
+
+
+--echo '#--------------------FN_DYNVARS_058_01------------------------#'
+################################################################################
+# Display the DEFAULT value of key_cache_division_limit #
+################################################################################
+
+SET @@global.key_cache_division_limit = DEFAULT;
+SELECT @@global.key_cache_division_limit;
+
+
+--echo '#---------------------FN_DYNVARS_058_02-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@global.key_cache_division_limit = @start_value;
+SELECT @@global.key_cache_division_limit = 100;
+
+
+--echo '#--------------------FN_DYNVARS_058_03------------------------#'
+###############################################################################
+# Change the value of key_cache_division_limit to a valid value #
+###############################################################################
+
+SET @@global.key_cache_division_limit = 1;
+SELECT @@global.key_cache_division_limit;
+SET @@global.key_cache_division_limit = 50;
+SELECT @@global.key_cache_division_limit;
+SET @@global.key_cache_division_limit = 99;
+SELECT @@global.key_cache_division_limit;
+SET @@global.key_cache_division_limit = 2;
+SELECT @@global.key_cache_division_limit;
+
+
+--echo '#--------------------FN_DYNVARS_058_04-------------------------#'
+###########################################################################
+# Change the value of key_cache_division_limit to invalid value #
+###########################################################################
+
+SET @@global.key_cache_division_limit = -1;
+SELECT @@global.key_cache_division_limit;
+SET @@global.key_cache_division_limit = 101;
+SELECT @@global.key_cache_division_limit;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.key_cache_division_limit = 10000.01;
+SELECT @@global.key_cache_division_limit;
+SET @@global.key_cache_division_limit = -1024;
+SELECT @@global.key_cache_division_limit;
+SET @@global.key_cache_division_limit = 0;
+SELECT @@global.key_cache_division_limit;
+SET @@global.key_cache_division_limit = 200;
+SELECT @@global.key_cache_division_limit;
+SET @@global.key_cache_division_limit = 65535;
+SELECT @@global.key_cache_division_limit;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.key_cache_division_limit = ON;
+SELECT @@global.key_cache_division_limit;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.key_cache_division_limit = 'test';
+SELECT @@global.key_cache_division_limit;
+
+
+--echo '#-------------------FN_DYNVARS_058_05----------------------------#'
+###########################################################################
+# Test if accessing session key_cache_division_limit gives error #
+###########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.key_cache_division_limit = 0;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.key_cache_division_limit;
+
+
+--echo '#----------------------FN_DYNVARS_058_06------------------------#'
+##############################################################################
+# Check if the value in GLOBAL & SESSION Tables matches values in variable #
+##############################################################################
+
+SELECT @@global.key_cache_division_limit = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='key_cache_division_limit';
+
+SELECT @@key_cache_division_limit = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='key_cache_division_limit';
+
+
+--echo '#---------------------FN_DYNVARS_058_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.key_cache_division_limit = TRUE;
+SELECT @@global.key_cache_division_limit;
+SET @@global.key_cache_division_limit = FALSE;
+SELECT @@global.key_cache_division_limit;
+
+
+--echo '#---------------------FN_DYNVARS_058_08----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@global.key_cache_division_limit = 90;
+SELECT @@key_cache_division_limit = @@global.key_cache_division_limit;
+
+
+--echo '#---------------------FN_DYNVARS_058_09----------------------#'
+###############################################################################
+# Check if key_cache_division_limit can be accessed with and without @@ sign #
+###############################################################################;
+
+--Error ER_GLOBAL_VARIABLE
+SET key_cache_division_limit = 80;
+SELECT @@key_cache_division_limit;
+--Error ER_UNKNOWN_TABLE
+SELECT local.key_cache_division_limit;
+--Error ER_UNKNOWN_TABLE
+SELECT global.key_cache_division_limit;
+--Error ER_BAD_FIELD_ERROR
+SELECT key_cache_division_limit = @@session.key_cache_division_limit;
+
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.key_cache_division_limit = @start_value;
+SELECT @@global.key_cache_division_limit;
+
+
+#####################################################################
+# END OF key_cache_division_limit TESTS #
+#####################################################################
+
diff --git a/mysql-test/suite/sys_vars/t/key_cache_file_hash_size_basic.test b/mysql-test/suite/sys_vars/t/key_cache_file_hash_size_basic.test
new file mode 100644
index 00000000..b8caa5bb
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/key_cache_file_hash_size_basic.test
@@ -0,0 +1,164 @@
+################# mysql-test\t\key_cache_file_hash_size.test ##################
+# #
+# Variable Name: key_cache_file_hash_size #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 300 #
+# Range: 100-4294967295 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable key_cache_file_hash_size #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF key_cache_file_hash_size TESTS #
+########################################################################
+
+
+#############################################################################
+# Saving initial value of key_cache_file_hash_size in a temporary variable #
+#############################################################################
+
+SET @start_value = @@global.key_cache_file_hash_size;
+SELECT @start_value;
+
+
+--echo '#--------------------FN_DYNVARS_056_01------------------------#'
+################################################################################
+# Display the DEFAULT value of key_cache_file_hash_size #
+################################################################################
+
+SET @@global.key_cache_file_hash_size = DEFAULT;
+SELECT @@global.key_cache_file_hash_size;
+
+
+--echo '#---------------------FN_DYNVARS_056_02-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@global.key_cache_file_hash_size = @start_value;
+SELECT @@global.key_cache_file_hash_size = 300;
+
+
+--echo '#--------------------FN_DYNVARS_056_03------------------------#'
+###############################################################################
+# Change the value of key_cache_file_hash_size to a valid value #
+###############################################################################
+
+SET @@global.key_cache_file_hash_size = 128;
+SET @@global.key_cache_file_hash_size = 16384;
+SELECT @@global.key_cache_file_hash_size;
+
+--echo '#--------------------FN_DYNVARS_056_04-------------------------#'
+###########################################################################
+# Change the value of key_cache_file_hash_size to invalid value #
+###########################################################################
+
+SET @@global.key_cache_file_hash_size = -1;
+SELECT @@global.key_cache_file_hash_size;
+SET @@global.key_cache_file_hash_size = 42949672951;
+SELECT @@global.key_cache_file_hash_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.key_cache_file_hash_size = 10000.01;
+SELECT @@global.key_cache_file_hash_size;
+SET @@global.key_cache_file_hash_size = -1024;
+SELECT @@global.key_cache_file_hash_size;
+SET @@global.key_cache_file_hash_size = 99;
+SELECT @@global.key_cache_file_hash_size;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.key_cache_file_hash_size = ON;
+SELECT @@global.key_cache_file_hash_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.key_cache_file_hash_size = 'test';
+SELECT @@global.key_cache_file_hash_size;
+
+
+--echo '#-------------------FN_DYNVARS_056_05----------------------------#'
+###########################################################################
+# Test if accessing session key_cache_file_hash_size gives error #
+###########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.key_cache_file_hash_size = 0;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.key_cache_file_hash_size;
+
+
+--echo '#----------------------FN_DYNVARS_056_06------------------------#'
+##############################################################################
+# Check if the value in GLOBAL & SESSION Tables matches values in variable #
+##############################################################################
+
+SELECT @@global.key_cache_file_hash_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='key_cache_file_hash_size';
+
+SELECT @@key_cache_file_hash_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='key_cache_file_hash_size';
+
+
+--echo '#---------------------FN_DYNVARS_056_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.key_cache_file_hash_size = TRUE;
+SELECT @@global.key_cache_file_hash_size;
+SET @@global.key_cache_file_hash_size = FALSE;
+SELECT @@global.key_cache_file_hash_size;
+
+
+--echo '#---------------------FN_DYNVARS_056_08----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@global.key_cache_file_hash_size = 150;
+SELECT @@key_cache_file_hash_size = @@global.key_cache_file_hash_size;
+
+
+--echo '#---------------------FN_DYNVARS_056_09----------------------#'
+########################################################################## #######
+# Check if key_cache_file_hash_size can be accessed with and without @@ sign #
+##################################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET key_cache_file_hash_size = 8000;
+SELECT @@key_cache_file_hash_size;
+--Error ER_UNKNOWN_TABLE
+SELECT local.key_cache_file_hash_size;
+--Error ER_UNKNOWN_TABLE
+SELECT global.key_cache_file_hash_size;
+--Error ER_BAD_FIELD_ERROR
+SELECT key_cache_file_hash_size = @@session.key_cache_file_hash_size;
+
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.key_cache_file_hash_size = @start_value;
+SELECT @@global.key_cache_file_hash_size;
+
+
+########################################################################
+# END OF key_cache_file_hash_size TESTS #
+########################################################################
diff --git a/mysql-test/suite/sys_vars/t/key_cache_segments_basic.test b/mysql-test/suite/sys_vars/t/key_cache_segments_basic.test
new file mode 100644
index 00000000..ce0c736e
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/key_cache_segments_basic.test
@@ -0,0 +1,42 @@
+# ulong global
+
+SET @start_global_value = @@global.key_cache_segments;
+
+#
+# exists as global only
+#
+select @@global.key_cache_segments;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.key_cache_segments;
+show global variables like 'key_cache_segments';
+show session variables like 'key_cache_segments';
+select * from information_schema.global_variables where variable_name='key_cache_segments';
+select * from information_schema.session_variables where variable_name='key_cache_segments';
+
+#
+# show that it's writable
+#
+set global key_cache_segments=1;
+select @@global.key_cache_segments;
+--error ER_GLOBAL_VARIABLE
+set session key_cache_segments=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global key_cache_segments=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global key_cache_segments=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global key_cache_segments="foo";
+
+#
+# min/max values
+#
+set global key_cache_segments=0;
+select @@global.key_cache_segments;
+set global key_cache_segments=cast(-1 as unsigned int);
+select @@global.key_cache_segments;
+
+SET @@global.key_cache_segments = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/large_files_support_basic.test b/mysql-test/suite/sys_vars/t/large_files_support_basic.test
new file mode 100644
index 00000000..690b32fc
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/large_files_support_basic.test
@@ -0,0 +1,19 @@
+#
+# only global
+#
+select @@global.large_files_support;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.large_files_support;
+show global variables like 'large_files_support';
+show session variables like 'large_files_support';
+select * from information_schema.global_variables where variable_name='large_files_support';
+select * from information_schema.session_variables where variable_name='large_files_support';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global large_files_support=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session large_files_support=1;
+
diff --git a/mysql-test/suite/sys_vars/t/large_page_size_basic.test b/mysql-test/suite/sys_vars/t/large_page_size_basic.test
new file mode 100644
index 00000000..cff90336
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/large_page_size_basic.test
@@ -0,0 +1,23 @@
+#
+# only global
+#
+select @@global.large_page_size = 1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.large_page_size;
+--replace_column 2 #
+show global variables like 'large_page_size';
+--replace_column 2 #
+show session variables like 'large_page_size';
+--replace_column 2 #
+select * from information_schema.global_variables where variable_name='large_page_size';
+--replace_column 2 #
+select * from information_schema.session_variables where variable_name='large_page_size';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global large_page_size=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session large_page_size=1;
+
diff --git a/mysql-test/suite/sys_vars/t/large_pages_basic.test b/mysql-test/suite/sys_vars/t/large_pages_basic.test
new file mode 100644
index 00000000..840b9176
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/large_pages_basic.test
@@ -0,0 +1,19 @@
+#
+# show the global and session values;
+#
+select @@global.large_pages;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.large_pages;
+show global variables like 'large_pages';
+show session variables like 'large_pages';
+select * from information_schema.global_variables where variable_name='large_pages';
+select * from information_schema.session_variables where variable_name='large_pages';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global large_pages=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session large_pages=1;
+
diff --git a/mysql-test/suite/sys_vars/t/last_gtid_basic.test b/mysql-test/suite/sys_vars/t/last_gtid_basic.test
new file mode 100644
index 00000000..85fbf079
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/last_gtid_basic.test
@@ -0,0 +1,11 @@
+--source include/not_embedded.inc
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@global.last_gtid;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET GLOBAL last_gtid= 10;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET SESSION last_gtid= 20;
+
+SELECT @@session.last_gtid;
diff --git a/mysql-test/suite/sys_vars/t/last_insert_id_basic.test b/mysql-test/suite/sys_vars/t/last_insert_id_basic.test
new file mode 100644
index 00000000..ca971c66
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/last_insert_id_basic.test
@@ -0,0 +1,38 @@
+
+#
+# exists as a session only
+#
+# 2010-01-20 OBN - Added check for variable value matching I_S tables
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@global.last_insert_id;
+select @@session.last_insert_id;
+show global variables like 'last_insert_id';
+show session variables like 'last_insert_id';
+select * from information_schema.global_variables where variable_name='last_insert_id';
+select * from information_schema.session_variables where variable_name='last_insert_id';
+
+#
+# show that it's writable
+#
+--error ER_LOCAL_VARIABLE
+set global last_insert_id=99;
+set session last_insert_id=42;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@global.last_insert_id;
+select @@session.last_insert_id;
+show global variables like 'last_insert_id';
+show session variables like 'last_insert_id';
+select * from information_schema.global_variables where variable_name='last_insert_id';
+select * from information_schema.session_variables where variable_name='last_insert_id';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set session last_insert_id=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set session last_insert_id=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set session last_insert_id="foo";
+
diff --git a/mysql-test/suite/sys_vars/t/last_insert_id_func-master.opt b/mysql-test/suite/sys_vars/t/last_insert_id_func-master.opt
new file mode 100644
index 00000000..03f5ae2d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/last_insert_id_func-master.opt
@@ -0,0 +1,2 @@
+--loose-innodb
+
diff --git a/mysql-test/suite/sys_vars/t/last_insert_id_func.test b/mysql-test/suite/sys_vars/t/last_insert_id_func.test
new file mode 100644
index 00000000..f68dbe61
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/last_insert_id_func.test
@@ -0,0 +1,138 @@
+################# mysql-test\t\last_insert_id_func.test #######################
+# #
+# Variable Name: last_insert_id #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: - #
+# Range: - #
+# #
+# #
+# Creation Date: 2008-03-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable key_buffer_size #
+# that checks the functionality of this variable #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#########################
+# Creating new table #
+#########################
+
+--echo ## Creating new table ##
+CREATE TABLE t1
+(
+id INT NOT NULL auto_increment,
+PRIMARY KEY (id),
+name VARCHAR(30)
+) ENGINE = INNODB;
+
+--echo '#--------------------FN_DYNVARS_059_01-------------------------#'
+#######################################################################
+# Setting initial value of last_insert_id and verifying its behavior #
+#######################################################################
+
+--echo ## Verifying initial value of ##
+SELECT @@session.last_insert_id;
+
+--echo ## Inserting records in table t1 ##
+INSERT into t1(name) values('Record_1');
+INSERT into t1(name) values('Record_2');
+SELECT * from t1;
+
+--echo ## Verifying value of variable after inserting some rows ##
+SELECT @@session.last_insert_id = 2;
+
+
+--echo '#--------------------FN_DYNVARS_059_02-------------------------#'
+#################################################################################
+# Verifying value of last_insert_id with new connection without committing rows #
+#################################################################################
+
+connect (test_con1, localhost, root,,);
+connection test_con1;
+
+SET @@autocommit = 0;
+
+--echo ## Verifying initial value of variable in new connection ##
+SELECT @@session.last_insert_id;
+
+--echo ## Inserting rows in table t1 ##
+START TRANSACTION;
+INSERT into t1(name) values('Record_3');
+INSERT into t1(name) values('Record_4');
+INSERT into t1(name) values('Record_5');
+
+--echo ## Verifying value of variable without committing rows ##
+SELECT @@session.last_insert_id;
+
+--echo '#--------------------FN_DYNVARS_059_03-------------------------#'
+#########################################################################
+# Now verifying value of last_insert_id with second new connection #
+#########################################################################
+
+connect (test_con2, localhost, root,,);
+connection test_con2;
+
+--echo ## Inserting values through new connection ##
+INSERT into t1(name) values('Record_6');
+INSERT into t1(name) values('Record_7');
+
+SELECT * from t1;
+
+--echo ## Verifying value of variable in second connection ##
+SELECT @@last_insert_id;
+
+
+
+--echo '#--------------------FN_DYNVARS_059_04-------------------------#'
+############################################################################
+# Now verifying value of last_insert_id after committing rows in
+# connection # 1
+############################################################################
+
+connection test_con1;
+
+--echo ## Verifying all records in table & value of variable ##
+SELECT * from t1;
+SELECT @@session.last_insert_id;
+
+--echo ## Commiting records in table ##
+COMMIT;
+SELECT @@session.last_insert_id;
+
+
+--echo ## Switching to test_con2 & verifying value of variable in it ##
+connection test_con2;
+SELECT @@session.last_insert_id;
+
+
+
+--echo '#--------------------FN_DYNVARS_059_05-------------------------#'
+#####################################################################
+# Verify value after explicitly setting value of variable #
+#####################################################################
+
+--echo ## Setting value of variable ##
+SET @@session.last_insert_id = 100;
+SELECT @@session.last_insert_id;
+
+--echo ## Inserting new record and verifying variable's effect on it ##
+INSERT into t1(name) values('Record_8');
+SELECT @@session.last_insert_id;
+
+--echo ## Dropping table t1 ##
+drop table t1;
+
+disconnect test_con1;
+disconnect test_con2;
diff --git a/mysql-test/suite/sys_vars/t/lc_messages_basic.test b/mysql-test/suite/sys_vars/t/lc_messages_basic.test
new file mode 100644
index 00000000..a76381e8
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/lc_messages_basic.test
@@ -0,0 +1,42 @@
+#
+# 2010-01-20 OBN - Added check for variable value matching I_S tables
+#
+
+
+SET @start_global_value = @@global.lc_messages;
+SELECT @start_global_value;
+
+#
+# exists as global and session
+#
+select @@global.lc_messages;
+select @@session.lc_messages;
+show global variables like 'lc_messages';
+show session variables like 'lc_messages';
+select * from information_schema.global_variables where variable_name='lc_messages';
+select * from information_schema.session_variables where variable_name='lc_messages';
+
+#
+# show that it's writable
+#
+set global lc_messages=1;
+select @@global.lc_messages;
+set session lc_messages=2;
+select @@session.lc_messages;
+set global lc_messages="en_US";
+set session lc_messages="en_GB";
+select @@global.lc_messages;
+select @@session.lc_messages;
+select * from information_schema.global_variables where variable_name='lc_messages';
+select * from information_schema.session_variables where variable_name='lc_messages';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global lc_messages=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global lc_messages=1e1;
+
+SET @@global.lc_messages = @start_global_value;
+SELECT @@global.lc_messages;
diff --git a/mysql-test/suite/sys_vars/t/lc_messages_dir_basic.test b/mysql-test/suite/sys_vars/t/lc_messages_dir_basic.test
new file mode 100644
index 00000000..6d452a36
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/lc_messages_dir_basic.test
@@ -0,0 +1,23 @@
+#
+# only global
+#
+--replace_result $MYSQL_SHAREDIR MYSQL_SHAREDIR
+select @@global.lc_messages_dir;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.lc_messages_dir;
+--replace_result $MYSQL_SHAREDIR MYSQL_SHAREDIR
+show global variables like 'lc_messages_dir';
+--replace_result $MYSQL_SHAREDIR MYSQL_SHAREDIR
+show session variables like 'lc_messages_dir';
+--replace_result $MYSQL_SHAREDIR MYSQL_SHAREDIR
+select * from information_schema.global_variables where variable_name='lc_messages_dir';
+--replace_result $MYSQL_SHAREDIR MYSQL_SHAREDIR
+select * from information_schema.session_variables where variable_name='lc_messages_dir';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global lc_messages_dir=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session lc_messages_dir=1;
diff --git a/mysql-test/suite/sys_vars/t/lc_time_names_basic.test b/mysql-test/suite/sys_vars/t/lc_time_names_basic.test
new file mode 100644
index 00000000..7e634eda
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/lc_time_names_basic.test
@@ -0,0 +1,719 @@
+###################### mysql-test\t\lc_time_names_basic.test ##################
+# #
+# Variable Name: lc_time_names #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: string #
+# Default Value: en_ZA #
+# Range: NA #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable lc_time_names #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+###################################################
+## START OF lc_time_names TESTS ##
+###################################################
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @global_start_value = @@global.lc_time_names;
+SELECT @global_start_value;
+# Save initial session value
+SET @session_start_value = @@lc_time_names;
+SELECT @session_start_value;
+# now save using local access
+SET @session_start_value = @@local.lc_time_names;
+SELECT @session_start_value;
+# save using default access (session)
+SET @session_start_value = @@session.lc_time_names;
+SELECT @session_start_value;
+
+
+--echo '#--------------------FN_DYNVARS_060_01------------------#'
+###############################################################################
+# Test Variable access and assignment with and withoud @@ #
+###############################################################################
+
+# select without @@
+--error ER_BAD_FIELD_ERROR
+SELECT lc_time_names;
+# assign value without @@
+SET lc_time_names=ar_AE;
+SELECT @@session.lc_time_names;
+# using another syntax for accessing session variable
+SET session lc_time_names=ar_AE;
+# accessing variable with scope the wrong way
+--Error ER_BAD_FIELD_ERROR
+SELECT session lc_time_names;
+# using another syntax for accessing dynamic variable
+SET global lc_time_names=ar_AE;
+--Error ER_BAD_FIELD_ERROR
+SELECT global lc_time_names;
+
+
+--echo '#--------------------FN_DYNVARS_060_02-------------------------#'
+###############################################################################
+# Check the DEFAULT value of lc_time_names for session and global #
+###############################################################################
+
+SET @@lc_time_names = en_ZA;
+SET @@lc_time_names = DEFAULT;
+SELECT @@lc_time_names AS DEFAULT_VALUE;
+
+SET @@global.lc_time_names = en_ZA;
+SET @@global.lc_time_names = DEFAULT;
+SELECT @@global.lc_time_names;
+
+--echo '#--------------------FN_DYNVARS_060_03-------------------------#'
+##########################################################################
+# see if setting global value changes session value and vice versa #
+##########################################################################
+
+SET @@session.lc_time_names = en_IN;
+SELECT @@session.lc_time_names;
+SET @@global.lc_time_names = en_NZ;
+SELECT @@global.lc_time_names;
+SELECT @@session.lc_time_names AS res_is_en_IN;
+
+SET @@session.lc_time_names = en_AU;
+SELECT @@session.lc_time_names;
+SELECT @@global.lc_time_names AS res_is_en_NZ;
+# composite check
+SELECT @@global.lc_time_names=@@session.lc_time_names AS res_is_false;
+
+
+--echo '#--------------------FN_DYNVARS_060_04-------------------------#'
+###########################################################################
+# Check if accessing variable with and without session point to session
+# variable
+###########################################################################
+
+SELECT @@lc_time_names = @@session.lc_time_names AS res;
+SELECT @@lc_time_names = @@local.lc_time_names AS res;
+
+--echo '#--------------------FN_DYNVARS_060_05-------------------------#'
+###########################################################################
+# Check if combining character set works #
+###########################################################################
+--Error ER_BAD_FIELD_ERROR
+SET @@lc_time_names = en_US | en_GB ;
+
+--echo '#--------------------FN_DYNVARS_060_06-------------------------#'
+###########################################################################
+# Change the value of lc_time_names to a valid value for session #
+###########################################################################
+SET @@session.lc_time_names=ar_AE;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=ar_BH;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=ar_DZ;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=ar_EG;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=ar_IN;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=ar_IQ;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=ar_JO;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=ar_KW;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=ar_LB;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=ar_LY;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=ar_MA;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=ar_OM;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=ar_QA;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=ar_SA;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=ar_SD;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=ar_SY;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=ar_TN;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=ar_YE;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=be_BY;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=bg_BG;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=ca_ES;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=cs_CZ;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=da_DK;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=de_AT;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=de_BE;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=de_CH;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=de_DE;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=de_LU;
+SELECT @@session.lc_time_names;
+
+--error ER_UNKNOWN_LOCALE
+SET @@session.lc_time_names=EE;
+--echo 'Bug: The locale for Estonian - Estonia is not supported. It is present';
+--echo 'in manual';
+--echo 'See http://dev.mysql.com/doc/refman/5.1/en/locale-support.html'
+
+SET @@session.lc_time_names=en_AU;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=en_CA;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=en_GB;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=en_IN;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=en_NZ;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=en_PH;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=en_US;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=en_ZA;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=en_ZW;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=es_AR;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=es_BO;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=es_CL;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=es_CO;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=es_CR;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=es_DO;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=es_EC;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=es_ES;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=es_GT;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=es_HN;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=es_MX;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=es_NI;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=es_PA;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=es_PE;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=es_PR;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=es_PY;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=es_SV;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=es_US;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=es_UY;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=es_VE;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=eu_ES;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=fi_FI;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=fo_FO;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=fr_BE;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=fr_CA;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=fr_CH;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=fr_FR;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=fr_LU;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=gl_ES;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=gu_IN;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=he_IL;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=hi_IN;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=hr_HR;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=hu_HU;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=id_ID;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=is_IS;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=it_CH;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=it_IT;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=ja_JP;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=ko_KR;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=lt_LT;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=lv_LV;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=mk_MK;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=mn_MN;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=ms_MY;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=nb_NO;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=nl_BE;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=nl_NL;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=no_NO;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=pl_PL;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=pt_BR;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=pt_PT;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=ro_RO;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=ru_RU;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=ru_UA;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=sk_SK;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=sl_SI;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=sq_AL;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=sr_YU;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=sv_FI;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=sr_RS;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=sv_SE;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=ta_IN;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=te_IN;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=th_TH;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=tr_TR;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=uk_UA;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=ur_PK;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=vi_VN;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=zh_CN;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=zh_HK;
+SELECT @@session.lc_time_names;
+SET @@session.lc_time_names=zh_TW;
+SELECT @@session.lc_time_names;
+
+
+--echo '#--------------------FN_DYNVARS_060_07-------------------------#'
+##########################################################################
+# Change the value of lc_time_names to a valid value for global #
+##########################################################################
+SET @@global.lc_time_names=ar_AE;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=ar_BH;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=ar_DZ;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=ar_EG;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=ar_IN;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=ar_IQ;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=ar_JO;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=ar_KW;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=ar_LB;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=ar_LY;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=ar_MA;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=ar_OM;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=ar_QA;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=ar_SA;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=ar_SD;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=ar_SY;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=ar_TN;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=ar_YE;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=be_BY;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=bg_BG;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=ca_ES;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=cs_CZ;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=da_DK;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=de_AT;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=de_BE;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=de_CH;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=de_DE;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=de_LU;
+SELECT @@global.lc_time_names;
+
+--error ER_UNKNOWN_LOCALE
+SET @@global.lc_time_names=EE;
+--echo 'Bug: The locale for Estonian - Estonia is not supported. It is';
+--echo 'present in manual';
+--echo 'See http://dev.mysql.com/doc/refman/5.1/en/locale-support.html';
+
+
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=en_AU;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=en_CA;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=en_GB;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=en_IN;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=en_NZ;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=en_PH;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=en_US;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=en_ZA;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=en_ZW;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=es_AR;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=es_BO;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=es_CL;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=es_CO;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=es_CR;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=es_DO;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=es_EC;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=es_ES;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=es_GT;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=es_HN;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=es_MX;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=es_NI;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=es_PA;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=es_PE;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=es_PR;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=es_PY;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=es_SV;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=es_US;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=es_UY;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=es_VE;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=eu_ES;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=fi_FI;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=fo_FO;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=fr_BE;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=fr_CA;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=fr_CH;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=fr_FR;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=fr_LU;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=gl_ES;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=gu_IN;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=he_IL;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=hi_IN;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=hr_HR;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=hu_HU;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=id_ID;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=is_IS;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=it_CH;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=it_IT;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=ja_JP;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=ko_KR;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=lt_LT;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=lv_LV;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=mk_MK;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=mn_MN;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=ms_MY;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=nb_NO;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=nl_BE;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=nl_NL;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=no_NO;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=pl_PL;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=pt_BR;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=pt_PT;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=ro_RO;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=ru_RU;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=ru_UA;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=sk_SK;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=sl_SI;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=sq_AL;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=sr_YU;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=sv_FI;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=sr_RS;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=sv_SE;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=ta_IN;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=te_IN;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=th_TH;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=tr_TR;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=uk_UA;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=ur_PK;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=vi_VN;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=zh_CN;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=zh_HK;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names=zh_TW;
+SELECT @@global.lc_time_names;
+
+
+--echo '#--------------------FN_DYNVARS_060_08-------------------------#'
+##########################################################################
+# Change the value of lc_time_names to a valid value with uppercase,
+# lowercase and mixedcase
+##########################################################################
+
+SET @@lc_time_names = ur_pk;
+SELECT @@lc_time_names;
+SET @@lc_time_names = UR_PK;
+SELECT @@lc_time_names;
+SET @@lc_time_names = uR_pK;
+SELECT @@lc_time_names;
+
+
+--echo '#--------------------FN_DYNVARS_060_09-------------------------#'
+##############################################################
+# Check if 0,1,2,3, ... values can be used on variable #
+##############################################################
+
+SET @@lc_time_names = 0;
+SELECT @@lc_time_names;
+SET @@lc_time_names = 1;
+SELECT @@lc_time_names;
+SET @@lc_time_names = 2;
+SELECT @@lc_time_names;
+SET @@lc_time_names = 3;
+SELECT @@lc_time_names;
+SET @@lc_time_names = 10;
+SELECT @@lc_time_names;
+SET @@lc_time_names = 50;
+SELECT @@lc_time_names;
+SET @@lc_time_names = 100;
+SELECT @@lc_time_names;
+SET @@lc_time_names = 101;
+SELECT @@lc_time_names;
+SET @@lc_time_names = 107;
+SELECT @@lc_time_names;
+SET @@lc_time_names = 108;
+SELECT @@lc_time_names;
+SET @@lc_time_names = 109;
+SELECT @@lc_time_names;
+SET @@lc_time_names = 110;
+SELECT @@lc_time_names;
+SET @@lc_time_names = 111;
+SELECT @@lc_time_names;
+--Error ER_UNKNOWN_LOCALE
+SET @@lc_time_names = 112;
+
+--echo '#--------------------FN_DYNVARS_060_10-------------------------#'
+#############################################################################
+# Change the value of lc_time_names to an invalid value for session #
+#############################################################################
+
+--Error ER_UNKNOWN_LOCALE
+SET @@lc_time_names = en_EN;
+--Error ER_UNKNOWN_LOCALE
+SET @@lc_time_names = US_en;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@lc_time_names = 1.1;
+--Error ER_UNKNOWN_LOCALE
+SET @@lc_time_names = -1;
+--Error ER_UNKNOWN_LOCALE
+SET @@lc_time_names = 'en US';
+--Error ER_UNKNOWN_LOCALE
+SET @@lc_time_names = 'enUS';
+
+SET @@lc_time_names = true;
+SELECT @@lc_time_names AS res_with_true;
+SET @@lc_time_names = false;
+SELECT @@lc_time_names AS res_with_false;
+
+--Error ER_UNKNOWN_LOCALE
+SET @@lc_time_names = ON;
+
+
+--echo '#--------------------FN_DYNVARS_060_11-------------------------#'
+############################################################################
+# Change the value of lc_time_names to an invalid value for global #
+############################################################################
+
+--Error ER_UNKNOWN_LOCALE
+SET @@global.lc_time_names = en_EN;
+--Error ER_UNKNOWN_LOCALE
+SET @@global.lc_time_names = US_en;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.lc_time_names = 1.1;
+--Error ER_UNKNOWN_LOCALE
+SET @@global.lc_time_names = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.lc_time_names = NULL;
+--Error ER_UNKNOWN_LOCALE
+SET @@global.lc_time_names = 'enUS';
+
+SET @@global.lc_time_names = true;
+SELECT @@global.lc_time_names;
+SET @@global.lc_time_names = false;
+SELECT @@global.lc_time_names;
+
+--Error ER_UNKNOWN_LOCALE
+SET @@global.lc_time_names = ON;
+
+--echo '#--------------------FN_DYNVARS_060_12-------------------------#'
+##############################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+##############################################################################
+SELECT @@global.lc_time_names = (SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='lc_time_names') AS res;
+SET @@global.lc_time_names = 1;
+SELECT @@global.lc_time_names;
+SELECT @@global.lc_time_names = (SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='lc_time_names') AS res;
+
+--echo '#--------------------FN_DYNVARS_060_13-------------------------#'
+##############################################################################
+# Check if the value in SESSION Table matches value in variable #
+##############################################################################
+SELECT @@lc_time_names = (SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='lc_time_names') AS res;
+SELECT @@local.lc_time_names = (SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='lc_time_names') AS res;
+SELECT @@session.lc_time_names = (SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='lc_time_names') AS res;
+
+####################################
+# Restore initial value #
+####################################
+SET @@global.lc_time_names = @global_start_value;
+SELECT @@global.lc_time_names;
+SET @@session.lc_time_names = @session_start_value;
+SELECT @@session.lc_time_names;
+
+#############################################################
+# END OF lc_time_names TESTS #
+#############################################################
diff --git a/mysql-test/suite/sys_vars/t/lc_time_names_func.test b/mysql-test/suite/sys_vars/t/lc_time_names_func.test
new file mode 100644
index 00000000..22a48d58
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/lc_time_names_func.test
@@ -0,0 +1,81 @@
+###################### mysql-test\t\lc_time_names_func.test ##################
+# #
+# Variable Name: lc_time_names #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: string #
+# Default Value: en_US #
+# Range: NA #
+# #
+# #
+# Creation Date: 2008-03-08 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable lc_time_names #
+# that checks the behavior of this variable #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--echo '#--------------------FN_DYNVARS_060_01-------------------------#'
+######################################################################
+# Check if setting global lc_time_names is changed in new connection #
+######################################################################
+
+SET @@global.lc_time_names = "en_CA";
+connect (con1,localhost,root,,,,);
+connection con1;
+SELECT @@global.lc_time_names;
+SELECT @@session.lc_time_names;
+SET @@global.lc_time_names = "en_IN";
+connect (con2,localhost,root,,,,);
+connection con2;
+SELECT @@global.lc_time_names;
+SELECT @@session.lc_time_names;
+disconnect con2;
+disconnect con1;
+
+
+--echo '#--------------------FN_DYNVARS_060_02-------------------------#'
+#################################################################
+# Begin the functionality Testing of lc_time_names #
+#################################################################
+
+connection default;
+
+SET NAMES 'utf8';
+
+SET @@session.lc_time_names = 'en_US';
+SELECT DATE_FORMAT('2010-01-01','%W %a %M %b'), DAYNAME('2010-05-05'),MONTHNAME('2010-12-12');
+
+
+SET @@session.lc_time_names = 'ar_AE';
+SELECT DATE_FORMAT('2010-01-01','%W %a %M %b'), DAYNAME('2010-05-05'),MONTHNAME('2010-12-12');
+
+SET @@session.lc_time_names = 'es_ES';
+SELECT DATE_FORMAT('2010-01-01','%W %a %M %b'), DAYNAME('2010-05-05'),MONTHNAME('2010-12-12');
+
+SET @@session.lc_time_names = 'fi_FI';
+SELECT DATE_FORMAT('2010-01-01','%W %a %M %b'), DAYNAME('2010-05-05'),MONTHNAME('2010-12-12');
+
+SET @@session.lc_time_names = 'gu_IN';
+SELECT DATE_FORMAT('2010-01-01','%W %a %M %b'), DAYNAME('2010-05-05'),MONTHNAME('2010-12-12');
+
+SET @@session.lc_time_names = 'it_IT';
+SELECT DATE_FORMAT('2010-01-01','%W %a %M %b'), DAYNAME('2010-05-05'),MONTHNAME('2010-12-12');
+
+SET @@session.lc_time_names = 'pt_BR';
+SELECT DATE_FORMAT('2010-01-01','%W %a %M %b'), DAYNAME('2010-05-05'),MONTHNAME('2010-12-12');
+
+SET @@session.lc_time_names = 'ur_PK';
+SELECT DATE_FORMAT('2010-01-01','%W %a %M %b'), DAYNAME('2010-05-05'),MONTHNAME('2010-12-12');
+
+
+# restore default
+SET @@global.lc_time_names = "en_US";
+
+##########################################################
+# End of functionality Testing for lc_time_names #
+##########################################################
diff --git a/mysql-test/suite/sys_vars/t/license_basic.test b/mysql-test/suite/sys_vars/t/license_basic.test
new file mode 100644
index 00000000..e0c761dc
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/license_basic.test
@@ -0,0 +1,100 @@
+
+
+################## mysql-test\t\license_basic.test ############################
+# #
+# Variable Name: license #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: string #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable license #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--echo '#---------------------BS_STVARS_040_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.license);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_040_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.license=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.license);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_040_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+SELECT @@GLOBAL.license = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='license';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.license);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='license';
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_040_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@license = @@GLOBAL.license;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_040_05----------------------#'
+################################################################################
+# Check if license can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@license);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.license);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.license);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.license);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT license = @@SESSION.license;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/local_infile_basic.test b/mysql-test/suite/sys_vars/t/local_infile_basic.test
new file mode 100644
index 00000000..4430fa32
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/local_infile_basic.test
@@ -0,0 +1,171 @@
+############## mysql-test\t\local_infile_basic.test ############################
+# #
+# Variable Name: local_infile #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: Boolean #
+# Default Value: 1 #
+# Valid Values: #
+# #
+# #
+# Creation Date: 2008-02-19 #
+# Author: Rizwan Maredia #
+# #
+# Description: Test Cases of Dynamic System Variable "local_infile" #
+# that checks behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_local_infile #
+# #
+################################################################################
+
+--source include/load_sysvars.inc
+
+############################################################
+# START OF local_infile TESTS #
+############################################################
+
+
+####################################################################
+# Saving initial value of local_infile in a temporary variable #
+####################################################################
+
+SET @start_value = @@global.local_infile;
+SELECT @start_value;
+
+--echo '#--------------------FN_DYNVARS_018_01------------------------#'
+####################################################################
+# Display the DEFAULT value of local_infile #
+####################################################################
+
+SET @@global.local_infile = 0;
+SET @@global.local_infile = DEFAULT;
+SELECT @@global.local_infile;
+
+--echo '#---------------------FN_DYNVARS_018_02-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@global.local_infile = DEFAULT;
+SELECT @@global.local_infile = 1;
+
+
+--echo '#--------------------FN_DYNVARS_018_03------------------------#'
+####################################################################
+# Change the value of local_infile to a valid value #
+####################################################################
+
+SET @@global.local_infile = 0;
+SELECT @@global.local_infile;
+SET @@global.local_infile = 1;
+SELECT @@global.local_infile;
+
+--echo '#--------------------FN_DYNVARS_018_04-------------------------#'
+######################################################################
+# Change the value of local_infile to invalid value #
+######################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.local_infile = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.local_infile = 2;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.local_infile = 100;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.local_infile = TRUEF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.local_infile = TRUE_F;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.local_infile = FALSE0;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.local_infile = OON;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.local_infile = ONN;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.local_infile = OOFF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.local_infile = 0FF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.local_infile = ' ';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.local_infile = " ";
+
+
+--echo '#-------------------FN_DYNVARS_018_05----------------------------#'
+################################################################
+# Test if accessing session local_infile gives error #
+################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.local_infile = 1;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.local_infile = 1;
+
+
+--echo '#----------------------FN_DYNVARS_018_06------------------------#'
+####################################################################
+# Check if the value in GLOBAL Tables matches values in variable #
+####################################################################
+
+SELECT IF(@@global.local_infile, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='local_infile';
+
+
+--echo '#---------------------FN_DYNVARS_018_07----------------------#'
+###################################################################
+# Check if ON and OFF values can be used on variable #
+###################################################################
+
+SET @@global.local_infile = OFF;
+SELECT @@global.local_infile;
+SET @@global.local_infile = ON;
+SELECT @@global.local_infile;
+
+--echo '#---------------------FN_DYNVARS_018_08----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.local_infile = TRUE;
+SELECT @@global.local_infile;
+SET @@global.local_infile = FALSE;
+SELECT @@global.local_infile;
+
+--echo '#---------------------FN_DYNVARS_018_09----------------------#'
+###############################################################################
+# Check if accessing variable without SCOPE points to same global variable #
+###############################################################################
+
+SET @@global.local_infile = 1;
+SELECT @@local_infile = @@global.local_infile;
+
+
+--echo '#---------------------FN_DYNVARS_018_10----------------------#'
+##########################################################################
+# Check if local_infile can be accessed with and without @@ sign #
+##########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET local_infile = 1;
+SELECT @@local_infile;
+--Error ER_UNKNOWN_TABLE
+SELECT global.local_infile;
+--Error ER_BAD_FIELD_ERROR
+SELECT local_infile = @@session.local_infile;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.local_infile = @start_value;
+SELECT @@global.local_infile;
+
+##################################################
+# END OF local_infile TESTS #
+##################################################
diff --git a/mysql-test/suite/sys_vars/t/local_infile_func.test b/mysql-test/suite/sys_vars/t/local_infile_func.test
new file mode 100644
index 00000000..be26fb5b
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/local_infile_func.test
@@ -0,0 +1,88 @@
+############## mysql-test\t\local_infile_func.test ############################
+# #
+# Variable Name: local_infile #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: Boolean #
+# Default Value: 1 #
+# Valid Values: #
+# #
+# #
+# Creation Date: 2008-03-08 #
+# Author: Rizwan Maredia #
+# #
+# Description: Test Cases of Dynamic System Variable "local_infile" #
+# that checks behavior of this variable #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_local_infile #
+# #
+################################################################################
+
+--source include/not_embedded.inc
+
+--echo '#--------------------FN_DYNVARS_037_01-------------------------#'
+####################################################################
+# Check if setting local_infile is changed in every new connection #
+####################################################################
+
+SET @@global.local_infile = 0;
+
+# con1 will be default connection from now on
+connect (con1,localhost,root,,,,);
+connection con1;
+SELECT @@global.local_infile;
+SET @@global.local_infile = 1;
+
+connect (con2,localhost,root,,,,);
+connection con2;
+SELECT @@global.local_infile;
+disconnect con2;
+
+
+--echo '#--------------------FN_DYNVARS_037_02-------------------------#'
+######################################################
+# Begin the functionality Testing of local_infile #
+######################################################
+
+connection con1;
+
+#=============================================================
+--echo '-----Checking LOAD DATA when local_infile is 1-------'
+#=============================================================
+SET @@global.local_infile = 1;
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+create table t1(a int);
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval LOAD DATA LOCAL INFILE
+'$MYSQLTEST_VARDIR/std_data/numbers.txt' INTO TABLE test.t1;
+
+SELECT count(*) from t1;
+
+#=============================================================
+--echo '-----Checking LOAD DATA when local_infile is 0-------'
+#=============================================================
+SET @@global.local_infile = 0;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+create table t1(a int);
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--Error ER_LOAD_INFILE_CAPABILITY_DISABLED
+eval LOAD DATA LOCAL INFILE
+'$MYSQLTEST_VARDIR/std_data/numbers.txt' INTO TABLE test.t1;
+
+SELECT count(*) from t1;
+
+# clean up and restore
+DROP TABLE t1;
+SET @@global.local_infile = 1;
+######################################################
+# Endo of functionality Testing for local_infile #
+######################################################
diff --git a/mysql-test/suite/sys_vars/t/lock_wait_timeout_basic.test b/mysql-test/suite/sys_vars/t/lock_wait_timeout_basic.test
new file mode 100644
index 00000000..770bda0e
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/lock_wait_timeout_basic.test
@@ -0,0 +1,213 @@
+############## mysql-test\t\lock_wait_timeout_basic.test #######################
+# #
+# Variable Name: lock_wait_timeout #
+# Scope: GLOBAL & SESSION #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 1 #
+# Range: 1 - 31536000 #
+# #
+# #
+# Creation Date: 2010-02-08 #
+# Author: Jon Olav Hauglid #
+# #
+# Description: Test Cases of Dynamic System Variable "lock_wait_timeout" #
+# that checks behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.5/en/ #
+# server-system-variables.html#option_mysqld_lock-wait-timeout #
+# #
+################################################################################
+
+--source include/load_sysvars.inc
+
+#####################################################################
+# START OF lock_wait_timeout TESTS #
+#####################################################################
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.lock_wait_timeout;
+SELECT @start_global_value;
+SET @start_session_value = @@session.lock_wait_timeout;
+SELECT @start_session_value;
+
+
+--echo '#--------------------FN_DYNVARS_002_01-------------------------#'
+#####################################################################
+# Display the DEFAULT value of lock_wait_timeout #
+#####################################################################
+
+SET @@global.lock_wait_timeout = 100;
+SET @@global.lock_wait_timeout = DEFAULT;
+SELECT @@global.lock_wait_timeout;
+
+SET @@session.lock_wait_timeout = 200;
+SET @@session.lock_wait_timeout = DEFAULT;
+SELECT @@session.lock_wait_timeout;
+
+
+--echo '#--------------------FN_DYNVARS_002_02-------------------------#'
+#####################################################################
+# Check the DEFAULT value of lock_wait_timeout #
+#####################################################################
+
+SET @@global.lock_wait_timeout = @start_global_value;
+SELECT @@global.lock_wait_timeout = 31536000;
+SET @@session.lock_wait_timeout = @start_session_value;
+SELECT @@session.lock_wait_timeout = 31536000;
+
+
+--echo '#--------------------FN_DYNVARS_002_03-------------------------#'
+###############################################################################
+# Change the value of lock_wait_timeout to a valid value for GLOBAL Scope #
+###############################################################################
+
+SET @@global.lock_wait_timeout = 1;
+SELECT @@global.lock_wait_timeout;
+SET @@global.lock_wait_timeout = 60020;
+SELECT @@global.lock_wait_timeout;
+SET @@global.lock_wait_timeout = 65535;
+SELECT @@global.lock_wait_timeout;
+
+
+--echo '#--------------------FN_DYNVARS_002_04-------------------------#'
+###############################################################################
+# Change the value of lock_wait_timeout to a valid value for SESSION Scope #
+###############################################################################
+
+SET @@session.lock_wait_timeout = 1;
+SELECT @@session.lock_wait_timeout;
+SET @@session.lock_wait_timeout = 50050;
+SELECT @@session.lock_wait_timeout;
+SET @@session.lock_wait_timeout = 65535;
+SELECT @@session.lock_wait_timeout;
+
+
+--echo '#------------------FN_DYNVARS_002_05-----------------------#'
+#################################################################
+# Change the value of lock_wait_timeout to an invalid value #
+#################################################################
+# for global scope
+SET @@global.lock_wait_timeout = 0;
+SELECT @@global.lock_wait_timeout;
+SET @@global.lock_wait_timeout = -1024;
+SELECT @@global.lock_wait_timeout;
+SET @@global.lock_wait_timeout = 31536001;
+SELECT @@global.lock_wait_timeout;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.lock_wait_timeout = ON;
+SELECT @@global.lock_wait_timeout;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.lock_wait_timeout = OFF;
+SELECT @@global.lock_wait_timeout;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.lock_wait_timeout = test;
+SELECT @@global.lock_wait_timeout;
+# for session scope
+SET @@session.lock_wait_timeout = 0;
+SELECT @@session.lock_wait_timeout;
+SET @@session.lock_wait_timeout = -2;
+SELECT @@session.lock_wait_timeout;
+SET @@session.lock_wait_timeout = 31537000;
+SELECT @@session.lock_wait_timeout;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.lock_wait_timeout = ON;
+SELECT @@session.lock_wait_timeout;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.lock_wait_timeout = OFF;
+SELECT @@session.lock_wait_timeout;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.lock_wait_timeout = test;
+SELECT @@session.lock_wait_timeout;
+
+
+
+--echo '#------------------FN_DYNVARS_002_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+SELECT @@global.lock_wait_timeout = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='lock_wait_timeout';
+
+
+--echo '#------------------FN_DYNVARS_002_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.lock_wait_timeout = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='lock_wait_timeout';
+
+
+--echo '#------------------FN_DYNVARS_002_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.lock_wait_timeout = TRUE;
+SELECT @@global.lock_wait_timeout;
+SET @@global.lock_wait_timeout = FALSE;
+SELECT @@global.lock_wait_timeout;
+
+
+--echo '#---------------------FN_DYNVARS_001_09----------------------#'
+###############################################################################
+# Check if global and session variables are independant of each other #
+###############################################################################
+
+SET @@global.lock_wait_timeout = 10;
+SET @@session.lock_wait_timeout = 11;
+SELECT @@lock_wait_timeout = @@global.lock_wait_timeout;
+
+
+--echo '#---------------------FN_DYNVARS_001_10----------------------#'
+##############################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points #
+# to same session variable #
+##############################################################################
+
+SET @@lock_wait_timeout = 100;
+SELECT @@lock_wait_timeout = @@local.lock_wait_timeout;
+SELECT @@local.lock_wait_timeout = @@session.lock_wait_timeout;
+
+
+--echo '#---------------------FN_DYNVARS_001_11----------------------#'
+###############################################################################
+# Check if lock_wait_timeout can be accessed with and without @@ sign #
+###############################################################################
+
+SET lock_wait_timeout = 1;
+SELECT @@lock_wait_timeout;
+--Error ER_UNKNOWN_TABLE
+SELECT local.lock_wait_timeout;
+--Error ER_UNKNOWN_TABLE
+SELECT session.lock_wait_timeout;
+--Error ER_BAD_FIELD_ERROR
+SELECT lock_wait_timeout = @@session.lock_wait_timeout;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.lock_wait_timeout = @start_global_value;
+SELECT @@global.lock_wait_timeout;
+SET @@session.lock_wait_timeout = @start_session_value;
+SELECT @@session.lock_wait_timeout;
+
+
+###################################################
+# END OF lock_wait_timeout TESTS #
+###################################################
+
diff --git a/mysql-test/suite/sys_vars/t/locked_in_memory_basic.test b/mysql-test/suite/sys_vars/t/locked_in_memory_basic.test
new file mode 100644
index 00000000..97313b7f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/locked_in_memory_basic.test
@@ -0,0 +1,20 @@
+--source include/not_windows.inc
+#
+# only global
+#
+select @@global.locked_in_memory;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.locked_in_memory;
+show global variables like 'locked_in_memory';
+show session variables like 'locked_in_memory';
+select * from information_schema.global_variables where variable_name='locked_in_memory';
+select * from information_schema.session_variables where variable_name='locked_in_memory';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global locked_in_memory=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session locked_in_memory=1;
+
diff --git a/mysql-test/suite/sys_vars/t/log_bin_basename_basic.test b/mysql-test/suite/sys_vars/t/log_bin_basename_basic.test
new file mode 100644
index 00000000..8ad5bd22
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/log_bin_basename_basic.test
@@ -0,0 +1,13 @@
+#
+# WL#5465: System variables: paths to relay log and binary log files
+#
+# Test for variable:
+# Variable Name: log_bin_basename
+# Variable Scope: Global
+# Dynamic Variable: No
+
+--source include/not_embedded.inc
+--source include/have_log_bin.inc
+
+--let $rpl_log_var_name=log_bin_basename
+--source suite/sys_vars/inc/bin_relay_log_basename_index.inc
diff --git a/mysql-test/suite/sys_vars/t/log_bin_basic.test b/mysql-test/suite/sys_vars/t/log_bin_basic.test
new file mode 100644
index 00000000..0712b42a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/log_bin_basic.test
@@ -0,0 +1,19 @@
+#
+# only global
+#
+select @@global.log_bin;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.log_bin;
+show global variables like 'log_bin';
+show session variables like 'log_bin';
+select * from information_schema.global_variables where variable_name='log_bin';
+select * from information_schema.session_variables where variable_name='log_bin';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global log_bin=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session log_bin=1;
+
diff --git a/mysql-test/suite/sys_vars/t/log_bin_compress_grant.test b/mysql-test/suite/sys_vars/t/log_bin_compress_grant.test
new file mode 100644
index 00000000..3b2c7849
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/log_bin_compress_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21963 Bind BINLOG ADMIN to a number of global system variables
+--echo #
+
+--let var = log_bin_compress
+--let grant = BINLOG ADMIN
+--let value = 1
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/log_bin_compress_min_len_grant.test b/mysql-test/suite/sys_vars/t/log_bin_compress_min_len_grant.test
new file mode 100644
index 00000000..26eff8c9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/log_bin_compress_min_len_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21963 Bind BINLOG ADMIN to a number of global system variables
+--echo #
+
+--let var = log_bin_compress_min_len
+--let grant = BINLOG ADMIN
+--let value = 512
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/log_bin_index_basic.test b/mysql-test/suite/sys_vars/t/log_bin_index_basic.test
new file mode 100644
index 00000000..c99df79f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/log_bin_index_basic.test
@@ -0,0 +1,13 @@
+#
+# WL#5465: System variables: paths to relay log and binary log files
+#
+# Test for variable:
+# Variable Name: log_bin_index
+# Variable Scope: Global
+# Dynamic Variable: No
+
+--source include/not_embedded.inc
+--source include/have_log_bin.inc
+
+--let $rpl_log_var_name=log_bin_index
+--source suite/sys_vars/inc/bin_relay_log_basename_index.inc
diff --git a/mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_basic.test b/mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_basic.test
new file mode 100644
index 00000000..15ffad27
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_basic.test
@@ -0,0 +1,164 @@
+############## mysql-test\t\log_bin_trust_function_creators_basic.test ########
+# #
+# Variable Name: log_bin_trust_function_creators #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: boolean #
+# Default Value: False #
+# Range: #
+# #
+# #
+# Creation Date: 2008-02-11 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable #
+# log_bin_trust_function_creators that checks the behavior of #
+# this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/server-system #
+# -variables.html#option_mysqld_log-bin-trust-function-ceators #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+####################################################################
+# START OF log_bin_trust_function_creators TESTS #
+####################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.log_bin_trust_function_creators;
+SELECT @start_global_value;
+
+--echo '#--------------------FN_DYNVARS_063_01-------------------------#'
+########################################################################
+# Display the DEFAULT value of log_bin_trust_function_creators #
+########################################################################
+
+SET @@global.log_bin_trust_function_creators = TRUE;
+SET @@global.log_bin_trust_function_creators = DEFAULT;
+SELECT @@global.log_bin_trust_function_creators;
+
+
+--echo '#--------------------FN_DYNVARS_063_02-------------------------#'
+###############################################################################
+# Check the DEFAULT value of log_bin_trust_function_creators #
+###############################################################################
+
+SET @@global.log_bin_trust_function_creators = DEFAULT;
+SELECT @@global.log_bin_trust_function_creators = 'FALSE';
+
+
+--echo '#--------------------FN_DYNVARS_063_03-------------------------#'
+##################################################################
+# Change the value of variable to a valid value for GLOBAL Scope #
+##################################################################
+
+SET @@global.log_bin_trust_function_creators = ON;
+SELECT @@global.log_bin_trust_function_creators;
+SET @@global.log_bin_trust_function_creators = OFF;
+SELECT @@global.log_bin_trust_function_creators;
+SET @@global.log_bin_trust_function_creators = 0;
+SELECT @@global.log_bin_trust_function_creators;
+SET @@global.log_bin_trust_function_creators = 1;
+SELECT @@global.log_bin_trust_function_creators;
+SET @@global.log_bin_trust_function_creators = TRUE;
+SELECT @@global.log_bin_trust_function_creators;
+SET @@global.log_bin_trust_function_creators = FALSE;
+SELECT @@global.log_bin_trust_function_creators;
+
+
+--echo '#-------------------FN_DYNVARS_063_04----------------------------#'
+###############################################################################
+# Test if accessing session log_bin_trust_function_creators gives error #
+###############################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.log_bin_trust_function_creators = 0;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.log_bin_trust_function_creators;
+
+--echo '#------------------FN_DYNVARS_063_05-----------------------#'
+###########################################################################
+# Change the value of log_bin_trust_function_creators to an invalid value #
+###########################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_bin_trust_function_creators = 'ONN';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_bin_trust_function_creators = "OFFF";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_bin_trust_function_creators = OF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_bin_trust_function_creators = TTRUE;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_bin_trust_function_creators = FELSE;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_bin_trust_function_creators = -1024;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_bin_trust_function_creators = 65536;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.log_bin_trust_function_creators = 65530.34;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_bin_trust_function_creators = test;
+
+--echo '#------------------FN_DYNVARS_063_06-----------------------#'
+###############################################################################
+# Check if the value in GLOBAL & SESSION Tables matches value in variable #
+###############################################################################
+
+
+SELECT IF(@@global.log_bin_trust_function_creators, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='log_bin_trust_function_creators';
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT IF(@@session.log_bin_trust_function_creators, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='log_bin_trust_function_creators';
+
+--echo '#---------------------FN_DYNVARS_063_07----------------------#'
+###############################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+###############################################################################
+
+
+SET @@global.log_bin_trust_function_creators = TRUE;
+SELECT @@log_bin_trust_function_creators = @@global.log_bin_trust_function_creators;
+
+
+--echo '#---------------------FN_DYNVARS_063_08----------------------#'
+###################################################################
+# Check if variable can be accessed with and without @@ sign #
+###################################################################
+
+SET @@global.log_bin_trust_function_creators = TRUE;
+SELECT @@log_bin_trust_function_creators;
+--Error ER_UNKNOWN_TABLE
+SELECT local.log_bin_trust_function_creators;
+--Error ER_UNKNOWN_TABLE
+SELECT session.log_bin_trust_function_creators;
+--Error ER_BAD_FIELD_ERROR
+SELECT log_bin_trust_function_creators = @@session.log_bin_trust_function_creators;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.log_bin_trust_function_creators = @start_global_value;
+SELECT @@global.log_bin_trust_function_creators;
+
+
+#########################################################
+# END OF log_bin_trust_function_creators TESTS #
+#########################################################
+
diff --git a/mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_func.test b/mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_func.test
new file mode 100644
index 00000000..958ae5d6
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_func.test
@@ -0,0 +1,148 @@
+############## mysql-test\t\log_bin_trust_function_creators_func.test #########
+# #
+# Variable Name: log_bin_trust_function_creators #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: boolean #
+# Default Value: False #
+# Range: #
+# #
+# #
+# Creation Date: 2008-03-11 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable #
+# log_bin_trust_function_creators that checks the functionality #
+# of this variable in the following ways #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/server-system #
+# -variables.html#option_mysqld_log-bin-trust-function-ceators #
+# #
+###############################################################################
+
+source include/have_log_bin.inc;
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+
+--echo '#--------------------FN_DYNVARS_063_01-------------------------#'
+########################################################################
+# Setting initial value of variable to 0 and verifying whether user
+# is allowed to create function or not.
+########################################################################
+SET @start_value= @@global.log_bin_trust_function_creators;
+
+--echo ## Creating new user tt ##
+CREATE USER tt@localhost;
+GRANT ALL ON test.* TO tt@localhost;
+
+--echo ## Setting value of variable to 0 ##
+SET @@global.log_bin_trust_function_creators = 0;
+
+--echo ## Creating new table t2 ##
+CREATE TABLE t2 (a INT);
+
+connect (test_con1,localhost,tt,,);
+connection test_con1;
+
+SELECT @@log_bin_trust_function_creators;
+
+--echo ## Creating new function f1 fails because no DETERMINISTIC ###
+delimiter |;
+--error ER_BINLOG_UNSAFE_ROUTINE
+CREATE FUNCTION f1(a INT) RETURNS INT
+BEGIN
+ IF (a < 3) THEN
+ INSERT INTO t2 VALUES (a);
+ END IF;
+ RETURN 1;
+END|
+delimiter ;|
+
+--echo ## Creating new function f1 fails because non-super user ##
+delimiter |;
+--error ER_BINLOG_CREATE_ROUTINE_NEED_SUPER
+CREATE FUNCTION f1(a INT) RETURNS INT DETERMINISTIC
+BEGIN
+ IF (a < 3) THEN
+ INSERT INTO t2 VALUES (a);
+ END IF;
+ RETURN 1;
+END|
+delimiter ;|
+
+connection default;
+
+--echo ## Creating new function f1 succeeds ##
+delimiter |;
+CREATE FUNCTION f1(a INT) RETURNS INT DETERMINISTIC
+BEGIN
+ IF (a < 3) THEN
+ INSERT INTO t2 VALUES (a);
+ END IF;
+ RETURN 1;
+END|
+delimiter ;|
+
+--echo ## Creating new table t1 ##
+CREATE TABLE t1 (a INT);
+
+--echo ## Inserting some records in t1 ##
+INSERT INTO t1 VALUES (1),(2),(3);
+SELECT f1(a) FROM t1;
+
+--echo ## Dropping function f1 & table t1 ##
+DROP FUNCTION f1;
+DROP TABLE t1;
+
+--echo '#--------------------FN_DYNVARS_063_02-------------------------#'
+########################################################################
+# Setting initial value of variable to 1 and verifying whether user
+# is allowed to create function or not.
+########################################################################
+
+connection default;
+
+--echo ## Setting value of variable to 1 ##
+SET @@global.log_bin_trust_function_creators = 1;
+
+connect (test_con2,localhost,tt,,);
+connection test_con2;
+
+--echo ## Verifying value of variable ##
+SELECT @@log_bin_trust_function_creators;
+SELECT @@sql_log_bin;
+
+--echo ## Creating new function f1 ##
+delimiter |;
+CREATE FUNCTION f1(a INT) RETURNS INT
+BEGIN
+ IF (a < 3) THEN
+ INSERT INTO t2 VALUES (a);
+ END IF;
+ RETURN 1;
+END|
+delimiter ;|
+
+--echo ## Creating new table t1 ##
+CREATE TABLE t1 (a INT);
+
+--echo ## Inserting values in table t1 ##
+INSERT INTO t1 VALUES (1),(2),(3);
+SELECT f1(a) FROM t1;
+
+--echo ## Dropping function f1 ##
+DROP FUNCTION f1;
+
+--echo ## Dropping table t1 & t2 ##
+DROP TABLE t1,t2;
+
+disconnect test_con2;
+
+connection default;
+
+DROP USER tt@localhost;
+SET @@global.log_bin_trust_function_creators= @start_value;
+
diff --git a/mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_grant.test b/mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_grant.test
new file mode 100644
index 00000000..0744987e
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21963 Bind BINLOG ADMIN to a number of global system variables
+--echo #
+
+--let var = log_bin_trust_function_creators
+--let grant = BINLOG ADMIN
+--let value = 1
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/log_disabled_statements_basic.test b/mysql-test/suite/sys_vars/t/log_disabled_statements_basic.test
new file mode 100644
index 00000000..f6191629
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/log_disabled_statements_basic.test
@@ -0,0 +1,51 @@
+# set session
+
+SET @start_global_value = @@global.log_disabled_statements;
+
+#
+# exists as global only
+#
+select @@global.log_disabled_statements;
+select @@session.log_disabled_statements;
+show global variables like 'log_disabled_statements';
+show session variables like 'log_disabled_statements';
+select * from information_schema.global_variables where variable_name='log_disabled_statements';
+select * from information_schema.session_variables where variable_name='log_disabled_statements';
+
+#
+# show that it's writable
+#
+set global log_disabled_statements=1;
+select @@global.log_disabled_statements;
+set session log_disabled_statements=1;
+select @@session.log_disabled_statements;
+
+#
+# all valid values
+#
+set session log_disabled_statements=1;
+select @@session.log_disabled_statements;
+set session log_disabled_statements=2;
+select @@session.log_disabled_statements;
+set session log_disabled_statements='slave';
+select @@session.log_disabled_statements;
+set session log_disabled_statements='sp';
+select @@session.log_disabled_statements;
+set session log_disabled_statements='slave,sp';
+select @@session.log_disabled_statements;
+set session log_disabled_statements='';
+select @@session.log_disabled_statements;
+
+#
+# incorrect types/values
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set session log_disabled_statements=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set session log_disabled_statements=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set session log_disabled_statements="foo";
+--error ER_WRONG_VALUE_FOR_VAR
+set session log_disabled_statements=1024;
+
+SET @@global.log_disabled_statements = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/log_disabled_statements_func-master.opt b/mysql-test/suite/sys_vars/t/log_disabled_statements_func-master.opt
new file mode 100644
index 00000000..c9f62c1a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/log_disabled_statements_func-master.opt
@@ -0,0 +1,2 @@
+--general-log
+--general-log-file=test.log
diff --git a/mysql-test/suite/sys_vars/t/log_disabled_statements_func.test b/mysql-test/suite/sys_vars/t/log_disabled_statements_func.test
new file mode 100644
index 00000000..1e5602ea
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/log_disabled_statements_func.test
@@ -0,0 +1,67 @@
+SET @old_log_output= @@global.log_output;
+SET @old_log_disable_statements= @@global.log_disabled_statements;
+
+
+CREATE TABLE t1 (i INT PRIMARY KEY AUTO_INCREMENT, j VARCHAR(255) ) ENGINE=MyISAM;
+insert into t1 (j) values ('a'),('b'),('c'),('d');
+
+# enable slow logging to table
+SET GLOBAL log_output = 'file,table';
+
+DELIMITER $;
+CREATE PROCEDURE slow()
+BEGIN
+ SELECT count(if(sleep(1) >= 0,0,NULL)) from t1 where j>'b';
+ SELECT count(*) from t1 where j>'a';
+END
+$
+
+DELIMITER ;$
+
+select @@log_disabled_statements;
+TRUNCATE TABLE mysql.general_log;
+check table t1;
+CALL slow();
+--disable_ps2_protocol
+SELECT count(if(sleep(1) >= 0,0,NULL)) from t1 where j>'b and part2';
+--enable_ps2_protocol
+
+--echo -->
+SELECT argument FROM mysql.general_log where command_type <> "Close stmt" and command_type <> "Prepare" and argument not like "%general_log%";
+--echo <--
+
+TRUNCATE TABLE mysql.general_log;
+SET SESSION log_disabled_statements="";
+check table t1;
+CALL slow();
+--disable_ps2_protocol
+SELECT count(if(sleep(1) >= 0,0,NULL)) from t1 where j>'b and part3';
+--enable_ps2_protocol
+
+--echo -->
+SELECT argument FROM mysql.general_log where command_type <> "Close stmt" and command_type <> "Prepare" and argument not like "%general_log%";
+--echo <--
+
+TRUNCATE TABLE mysql.general_log;
+SET SESSION log_disabled_statements="sp,slave";
+check table t1;
+CALL slow();
+--disable_ps2_protocol
+SELECT count(if(sleep(1) >= 0,0,NULL)) from t1 where j>'b and part4';
+--enable_ps2_protocol
+
+--echo -->
+SELECT argument FROM mysql.general_log where command_type <> "Close stmt" and command_type <> "Prepare" and argument not like "%general_log%";
+--echo <--
+
+DROP TABLE t1;
+DROP PROCEDURE slow;
+
+#
+# Restore setup
+#
+TRUNCATE TABLE mysql.general_log;
+SET @@global.log_output= @old_log_output;
+SET @@global.log_disabled_statements= @old_log_disable_statements;
+
+
diff --git a/mysql-test/suite/sys_vars/t/log_error_func.test b/mysql-test/suite/sys_vars/t/log_error_func.test
new file mode 100644
index 00000000..926398a7
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/log_error_func.test
@@ -0,0 +1,23 @@
+# embedded .cnf doesn't have log-error option
+source include/not_embedded.inc;
+
+# Test for BUG#51215 "log-error partially works with version 5.5"
+# when --log-error is used without argument
+
+# check displayed value. We can check only the base name, the rest
+# depends on paths, symbolic links, --vardir, etc...
+select (@err_log:=variable_value)*0 from information_schema.global_variables where variable_name="log_error";
+select instr(@err_log, "mysqld.1.err")>0;
+
+# Check file's existence. The displayed value may be relative or not.
+let $err_log=`select @err_log`;
+let $err_log_relative=`select instr(@err_log, ".")=1`;
+if ($err_log_relative)
+{
+ let $MYSQLD_DATADIR= `SELECT @@datadir`;
+ file_exists $MYSQLD_DATADIR/$err_log;
+}
+if (!$err_log_relative)
+{
+ file_exists $err_log;
+}
diff --git a/mysql-test/suite/sys_vars/t/log_error_func2.opt b/mysql-test/suite/sys_vars/t/log_error_func2.opt
new file mode 100644
index 00000000..4658d62a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/log_error_func2.opt
@@ -0,0 +1 @@
+--log-error
diff --git a/mysql-test/suite/sys_vars/t/log_error_func2.test b/mysql-test/suite/sys_vars/t/log_error_func2.test
new file mode 100644
index 00000000..e9f91e9c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/log_error_func2.test
@@ -0,0 +1,20 @@
+# Test for BUG#51215 "log-error partially works with version 5.5"
+# when --log-error is used without argument
+
+# check displayed value. We can check only the suffix, because
+# the rest depends on paths, symbolic links, --vardir, etc...
+select (@err_log:=variable_value)*0 from information_schema.global_variables where variable_name="log_error";
+select instr(@err_log, ".err")>0;
+
+# Check file's existence. The displayed value may be relative or not.
+let $err_log=`select @err_log`;
+let $err_log_relative=`select instr(@err_log, ".")=1`;
+if ($err_log_relative)
+{
+ let $MYSQLD_DATADIR= `SELECT @@datadir`;
+ file_exists $MYSQLD_DATADIR/$err_log;
+}
+if (!$err_log_relative)
+{
+ file_exists $err_log;
+}
diff --git a/mysql-test/suite/sys_vars/t/log_error_func3.opt b/mysql-test/suite/sys_vars/t/log_error_func3.opt
new file mode 100644
index 00000000..a236474f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/log_error_func3.opt
@@ -0,0 +1 @@
+--disable-log-error
diff --git a/mysql-test/suite/sys_vars/t/log_error_func3.test b/mysql-test/suite/sys_vars/t/log_error_func3.test
new file mode 100644
index 00000000..c6b076f3
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/log_error_func3.test
@@ -0,0 +1,5 @@
+# Test for BUG#51215 "log-error partially works with version 5.5"
+# when --log-error is not used
+
+# check displayed value. Should be empty.
+select variable_value from information_schema.global_variables where variable_name="log_error";
diff --git a/mysql-test/suite/sys_vars/t/log_output_basic.test b/mysql-test/suite/sys_vars/t/log_output_basic.test
new file mode 100644
index 00000000..b45d30f1
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/log_output_basic.test
@@ -0,0 +1,217 @@
+################# mysql-test\t\log_output_basic.test ##########################
+# #
+# Variable Name: log_output #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: enumeration #
+# Default Value: TABLE #
+# Range: TABLE, FILE, NONE #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable log_output #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF log_output TESTS #
+########################################################################
+
+
+########################################################################
+# Saving initial value of log_output in a temporary variable #
+########################################################################
+
+SET @start_value = @@global.log_output;
+SELECT @start_value;
+
+
+--echo '#--------------------FN_DYNVARS_065_01------------------------#'
+########################################################################
+# Display the DEFAULT value of log_output #
+########################################################################
+
+SET @@global.log_output = FILE;
+SET @@global.log_output = DEFAULT;
+SELECT @@global.log_output;
+
+--echo '#---------------------FN_DYNVARS_065_02-------------------------#'
+##################################################
+# Check if NULL or empty value is accepeted #
+##################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_output = NULL;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_output = "";
+
+--echo '#--------------------FN_DYNVARS_065_03------------------------#'
+########################################################################
+# Change the value of log_output to a valid value #
+########################################################################
+
+SET @@global.log_output = 'TABLE';
+SELECT @@global.log_output;
+
+SET @@global.log_output = 'FILE';
+SELECT @@global.log_output;
+
+SET @@global.log_output = 'NONE';
+SELECT @@global.log_output;
+
+SET @@global.log_output = 'FILE,TABLE';
+SELECT @@global.log_output;
+
+SET @@global.log_output = 'TABLE,FILE';
+SELECT @@global.log_output;
+
+SET @@global.log_output = 'NONE,TABLE';
+SELECT @@global.log_output;
+
+SET @@global.log_output = 'NONE,FILE';
+SELECT @@global.log_output;
+
+SET @@global.log_output = 'FILE,TABLE,NONE';
+SELECT @@global.log_output;
+
+SET @@global.log_output = 'TABLE,NONE';
+SELECT @@global.log_output;
+
+SET @@global.log_output = 'TABLE,TABLE';
+SELECT @@global.log_output;
+
+SET @@global.log_output = ',TABLE';
+SELECT @@global.log_output;
+
+SET @@global.log_output = 'TABLE,,FILE,,,';
+SELECT @@global.log_output;
+
+
+--echo '#--------------------FN_DYNVARS_065_04-------------------------#'
+###########################################################################
+# Change the value of log_output to invalid value #
+###########################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_output = -1;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_output = TAB;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_output = NIL;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_output = 'FIL';
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_output = 'T';
+
+# use of space in value
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_output = 'TABLE, FILE';
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_output = ' TABLE,FILE';
+
+--echo '#-------------------FN_DYNVARS_065_05----------------------------#'
+######################################################################
+# Test if accessing session log_output gives error #
+######################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@log_output = 0;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.log_output;
+
+
+--echo '#----------------------FN_DYNVARS_065_06------------------------#'
+########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+########################################################################
+
+SELECT @@log_output = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='log_output';
+
+
+--echo '#---------------------FN_DYNVARS_065_07-------------------------#'
+###################################################################
+# Check if numbers can be used on variable #
+###################################################################
+
+# test if variable accepts 0,1,2
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_output = 0;
+SELECT @@global.log_output;
+
+SET @@global.log_output = 1;
+SELECT @@global.log_output;
+
+SET @@global.log_output = 2;
+SELECT @@global.log_output;
+
+SET @@global.log_output = 3;
+SELECT @@global.log_output;
+
+SET @@global.log_output = 4;
+SELECT @@global.log_output;
+
+SET @@global.log_output = 5;
+SELECT @@global.log_output;
+
+SET @@global.log_output = 6;
+SELECT @@global.log_output;
+
+SET @@global.log_output = 7;
+SELECT @@global.log_output;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_output = 8;
+
+
+--echo '#---------------------FN_DYNVARS_065_08----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.log_output = TRUE;
+SELECT @@global.log_output;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_output = FALSE;
+SELECT @@global.log_output;
+
+--echo '#---------------------FN_DYNVARS_065_09----------------------#'
+################################################################
+# Check if log_output can be accessed with and without @@ sign #
+################################################################
+--Error ER_GLOBAL_VARIABLE
+SET log_output = ON;
+
+SET global log_output = 'TABLE';
+SELECT @@global.log_output;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.log_output = @start_value;
+SELECT @@global.log_output;
+
+###################################################################
+# END OF log_output TESTS #
+###################################################################
diff --git a/mysql-test/suite/sys_vars/t/log_output_func.test b/mysql-test/suite/sys_vars/t/log_output_func.test
new file mode 100644
index 00000000..eac00407
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/log_output_func.test
@@ -0,0 +1,123 @@
+################# mysql-test\t\log_output_func.test ##########################
+# #
+# Variable Name: log_output #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: enumeration #
+# Default Value: TABLE #
+# Range: TABLE, FILE, NONE #
+# #
+# #
+# Creation Date: 2008-03-08 #
+# Author: Rizwan #
+# Modified: HHunger 2008-08-29
+# #
+# Description: Test Cases of Dynamic System Variable log_output #
+# that checks the behavior of this variable #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# #
+###############################################################################
+
+# The access to mysql.general_log delivers different result depending on
+# ps-protocol. So, it is switched off.
+--disable_ps_protocol
+
+SET @start_value= @@global.log_output;
+SET @start_general_log= @@global.general_log;
+#SET @start_general_log_file= @@global.general_log_file;
+LET $start_general_log_file= `SELECT @@global.general_log_file`;
+
+--echo '#--------------------FN_DYNVARS_065_01-------------------------#'
+##################################################################
+# Check if setting log_output is changed in every new connection #
+##################################################################
+
+SET @@global.log_output = 'NONE';
+# con1 will be default connection from now on
+connect (con1,localhost,root,,,,);
+SET @@global.log_output = 'TABLE,FILE';
+
+# Test that the effect is global
+connect (con2,localhost,root,,,,);
+SELECT @@global.log_output;
+
+--echo '#--------------------FN_DYNVARS_065_02-------------------------#'
+####################################################
+# Begin the functionality Testing of log_output #
+####################################################
+
+connection con1;
+
+#===============================================================
+--echo '---Checking general_log when log_output is NONE---'
+#===============================================================
+
+SET @@global.log_output = 'NONE';
+TRUNCATE TABLE mysql.general_log;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUE(1);
+SELECT 'abc';
+SELECT count(*) FROM mysql.general_log;
+
+#===============================================================
+--echo '---Checking general_log when log_output is TABLE---'
+#===============================================================
+
+SET @@global.log_output = 'TABLE';
+TRUNCATE TABLE mysql.general_log;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+CREATE TABLE t1(a int);
+INSERT INTO t1 VALUE(1);
+SELECT 'abc';
+# At least the last 4 statement should be logged.
+SELECT count(*)>4 FROM mysql.general_log;
+
+#===============================================================
+# Checking general_log when log_output is FILE
+#===============================================================
+
+SET @@global.general_log = 'OFF';
+FLUSH LOGS;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval SET @@global.general_log_file = '$MYSQLTEST_VARDIR/run/mytest.log';
+SET @@global.general_log = 'ON';
+SET @@global.log_output = 'FILE';
+TRUNCATE TABLE mysql.general_log;
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUE(1);
+SELECT 'abc';
+SELECT count(*) FROM mysql.general_log;
+
+DROP TABLE t1;
+
+file_exists $MYSQLTEST_VARDIR/run/mytest.log ;
+
+#==============================================================
+# Clean up
+#==============================================================
+
+connection default;
+SET @@global.general_log= 'OFF';
+#SET @@global.general_log_file= @start_general_log_file;
+--replace_result $start_general_log_file start_general_log_file
+eval SET @@global.general_log_file= '$start_general_log_file';
+SET @@global.log_output= @start_value;
+SET @@global.general_log= @start_general_log;
+SET @@global.general_log= 'ON';
+
+--enable_ps_protocol
+####################################################
+# End of functionality Testing for log_output #
+####################################################
diff --git a/mysql-test/suite/sys_vars/t/log_queries_not_using_indexes_basic.test b/mysql-test/suite/sys_vars/t/log_queries_not_using_indexes_basic.test
new file mode 100644
index 00000000..57109204
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/log_queries_not_using_indexes_basic.test
@@ -0,0 +1,135 @@
+################## mysql-test\t\log_queries_not_using_indexes_basic.test ######
+# #
+# Variable Name: log_queries_not_using_indexes #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# Description:Test Cases of Dynamic System Variable #
+# log_queries_not_using_indexes #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# #
+###############################################################################
+
+SET @start_value= @@global.log_queries_not_using_indexes;
+SET @filter_start_value= @@global.log_slow_filter;
+
+####################################################################
+# Check that variable is both session and global #
+####################################################################
+
+SET @@global.log_queries_not_using_indexes= TRUE;
+SET @@session.log_queries_not_using_indexes= TRUE;
+SET @@global.log_queries_not_using_indexes= FALSE;
+SET @@session.log_queries_not_using_indexes= FALSE;
+
+####################################################################
+# Valid values for boolean #
+####################################################################
+SET @@global.log_queries_not_using_indexes= DEFAULT;
+SELECT @@global.log_queries_not_using_indexes;
+
+SET @@global.log_queries_not_using_indexes= TRUE;
+SELECT @@global.log_queries_not_using_indexes;
+
+SET @@global.log_queries_not_using_indexes= true;
+SELECT @@global.log_queries_not_using_indexes;
+
+SET @@global.log_queries_not_using_indexes= 0;
+SELECT @@global.log_queries_not_using_indexes;
+
+SET @@global.log_queries_not_using_indexes= 1;
+SELECT @@global.log_queries_not_using_indexes;
+
+SET @goodvar= TRUE;
+SET @@global.log_queries_not_using_indexes= @goodvar;
+SELECT @@global.log_queries_not_using_indexes;
+
+SET GLOBAL log_queries_not_using_indexes= DEFAULT;
+SELECT @@global.log_queries_not_using_indexes;
+
+SET GLOBAL log_queries_not_using_indexes= ON;
+SELECT @@global.log_queries_not_using_indexes;
+
+SET GLOBAL log_queries_not_using_indexes= OFF;
+SELECT @@global.log_queries_not_using_indexes;
+
+SET GLOBAL log_queries_not_using_indexes= -0;
+SELECT @@global.log_queries_not_using_indexes;
+
+--error ER_WRONG_TYPE_FOR_VAR
+SET GLOBAL log_queries_not_using_indexes= 0.00;
+
+SET GLOBAL log_queries_not_using_indexes= +0;
+SELECT @@global.log_queries_not_using_indexes;
+
+#################################################################
+# Not valid values for the variable #
+#################################################################
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_queries_not_using_indexes= 'DEFAULT';
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_queries_not_using_indexes= 'true';
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_queries_not_using_indexes= BLABLA;
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_queries_not_using_indexes= 25;
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL log_queries_not_using_indexes= -1;
+
+SET @badvar= 'true';
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_queries_not_using_indexes= @badvar;
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL log_queries_not_using_indexes= 'DEFAULT';
+
+--error ER_PARSE_ERROR
+SET @@global log_queries_not_using_indexes= TRUE;
+
+--error ER_PARSE_ERROR
+SET @@SESSION log_queries_not_using_indexes= TRUE;
+
+####################################################################
+# Ensure that the value matches log_slow_filter #
+####################################################################
+
+SET @@SESSION.log_queries_not_using_indexes= TRUE;
+select @@SESSION.log_slow_filter;
+SET @@SESSION.log_queries_not_using_indexes= FALSE;
+select @@SESSION.log_slow_filter;
+SET @@GLOBAL.log_queries_not_using_indexes= TRUE;
+select @@GLOBAL.log_slow_filter;
+SET @@GLOBAL.log_queries_not_using_indexes= FALSE;
+select @@GLOBAL.log_slow_filter;
+
+SET @@SESSION.log_slow_filter="";
+select @@SESSION.log_queries_not_using_indexes;
+SET @@SESSION.log_slow_filter="not_using_index";
+select @@SESSION.log_queries_not_using_indexes;
+
+SET @@GLOBAL.log_slow_filter="";
+select @@GLOBAL.log_queries_not_using_indexes;
+SET @@GLOBAL.log_slow_filter="not_using_index";
+select @@GLOBAL.log_queries_not_using_indexes;
+
+####################################################################
+# Restore original value #
+####################################################################
+
+SET @@global.log_queries_not_using_indexes= @start_value;
+SET @@global.log_slow_filter= @filter_start_value;
diff --git a/mysql-test/suite/sys_vars/t/log_slave_updates_basic.test b/mysql-test/suite/sys_vars/t/log_slave_updates_basic.test
new file mode 100644
index 00000000..93212e4f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/log_slave_updates_basic.test
@@ -0,0 +1,19 @@
+--source include/not_embedded.inc
+#
+# only global
+#
+select @@global.log_slave_updates;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.log_slave_updates;
+show global variables like 'log_slave_updates';
+show session variables like 'log_slave_updates';
+select * from information_schema.global_variables where variable_name='log_slave_updates';
+select * from information_schema.session_variables where variable_name='log_slave_updates';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global log_slave_updates=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session log_slave_updates=1;
diff --git a/mysql-test/suite/sys_vars/t/log_slow_admin_statements_func.test b/mysql-test/suite/sys_vars/t/log_slow_admin_statements_func.test
new file mode 100644
index 00000000..b8a76a84
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/log_slow_admin_statements_func.test
@@ -0,0 +1,90 @@
+--source include/no_valgrind_without_big.inc
+-- source include/have_innodb.inc
+
+SET @old_log_output= @@global.log_output;
+SET @old_slow_query_log= @@global.slow_query_log;
+SET @old_long_query_time= @@session.long_query_time;
+SET @old_log_slow_admin_statements= @@global.log_slow_admin_statements;
+
+USE test;
+CREATE TABLE log_slow_admin_statements (
+ i INT PRIMARY KEY AUTO_INCREMENT,
+ j VARCHAR(255)
+) ENGINE=InnoDB;
+
+# enable slow logging to table
+SET GLOBAL log_output = 'file,table';
+SET GLOBAL slow_query_log = on;
+SET SESSION long_query_time = 0;
+SET SESSION log_slow_admin_statements = on;
+
+# test ALTER, OPTIMIZE and CHECK against the table shown up
+ALTER TABLE log_slow_admin_statements ADD COLUMN k INT DEFAULT 17;
+
+# add rows so OPTIMIZE and CHECK runs
+DELIMITER $;
+
+CREATE PROCEDURE add_rows()
+BEGIN
+ DECLARE count INT;
+ SET count = 1;
+ INSERT INTO log_slow_admin_statements(j) values (REPEAT('A', 255));
+ WHILE count <= 15 DO
+ INSERT INTO log_slow_admin_statements(j) SELECT j FROM log_slow_admin_statements;
+ SET count = count + 1;
+ END WHILE;
+END
+$
+
+DELIMITER ;$
+
+CALL add_rows();
+
+# OPTIMIZE TABLE
+OPTIMIZE TABLE log_slow_admin_statements;
+
+# CHECK TABLE
+CHECK TABLE log_slow_admin_statements EXTENDED;
+
+# DROP TABLE
+DROP TABLE log_slow_admin_statements;
+
+# ALTER, OPTIMIZE, CHECK and DROP operations should be logged in slow query log.
+--disable_ps2_protocol
+SELECT sql_text FROM mysql.slow_log WHERE sql_text LIKE '%TABLE log_slow_admin_statements%';
+--enable_ps2_protocol
+
+SET @@global.log_output= @old_log_output;
+SET @@global.slow_query_log= @old_slow_query_log;
+SET @@session.long_query_time= @old_long_query_time;
+SET @@global.log_slow_admin_statements= @old_log_slow_admin_statements;
+
+DROP PROCEDURE add_rows;
+TRUNCATE TABLE mysql.slow_log;
+
+#
+# Ensure that log_slow_admin_statements maps to log_slow_disable_statements
+#
+
+SET @save_log_slow_disabled_statements= @@global.log_slow_disabled_statements;
+SET @@SESSION.log_slow_admin_statements= TRUE;
+select @@SESSION.log_slow_disabled_statements;
+SET @@SESSION.log_slow_admin_statements= FALSE;
+select @@SESSION.log_slow_disabled_statements;
+SET @@GLOBAL.log_slow_admin_statements= TRUE;
+select @@GLOBAL.log_slow_disabled_statements;
+SET @@GLOBAL.log_slow_admin_statements= FALSE;
+select @@GLOBAL.log_slow_disabled_statements;
+
+SET @@SESSION.log_slow_disabled_statements="";
+select @@SESSION.log_slow_admin_statements;
+SET @@SESSION.log_slow_disabled_statements="admin";
+select @@SESSION.log_slow_admin_statements;
+
+SET @@GLOBAL.log_slow_disabled_statements="";
+select @@GLOBAL.log_slow_admin_statements;
+SET @@GLOBAL.log_slow_disabled_statements="admin";
+select @@GLOBAL.log_slow_admin_statements;
+
+SET @@global.log_slow_disabled_statements= @save_log_slow_disabled_statements;
+
diff --git a/mysql-test/suite/sys_vars/t/log_slow_disabled_statements_func.test b/mysql-test/suite/sys_vars/t/log_slow_disabled_statements_func.test
new file mode 100644
index 00000000..db9bc8fb
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/log_slow_disabled_statements_func.test
@@ -0,0 +1,94 @@
+SET @old_log_output= @@global.log_output;
+SET @old_slow_query_log= @@global.slow_query_log;
+SET @old_long_query_time= @@session.long_query_time;
+SET @old_log_slow_disable_statements= @@global.log_slow_disabled_statements;
+
+# Log everything to slow log
+SET @@session.log_slow_verbosity="explain,innodb,query_plan";
+
+CREATE TABLE t1 (i INT PRIMARY KEY AUTO_INCREMENT, j blob) ENGINE=MyISAM;
+insert into t1 (j) values ('a'),('b'),('c'),('d');
+create table t2 (a int auto_increment primary key) engine=myisam;
+
+# enable slow logging to table
+SET GLOBAL log_output = 'file,table';
+SET GLOBAL slow_query_log = on;
+
+DELIMITER $;
+CREATE PROCEDURE slow()
+BEGIN
+ SELECT count(if(sleep(1) >= 0,0,NULL)) from t1 where j>'b';
+ SELECT count(*) from t1 where j>'a';
+ insert into t2 () values();
+END
+$
+
+CREATE PROCEDURE slow2()
+BEGIN
+ SELECT j,count(*) from t1 group by j;
+ create temporary table t3 (a int);
+ alter table t3 add column (b int);
+ call slow();
+ drop temporary table t3;
+ SELECT j,count(*)+1 from t1 group by j,i;
+END
+$
+
+DELIMITER ;$
+
+SET SESSION long_query_time = 0;
+
+--disable_ps2_protocol
+SELECT @@log_slow_disabled_statements;
+TRUNCATE TABLE mysql.slow_log;
+ALTER TABLE t1 add column extra int;
+CALL slow2();
+SELECT count(if(sleep(1) >= 0,0,NULL)) from t1 where j>'b and part2';
+
+--echo -->
+SELECT sql_text FROM mysql.slow_log where sql_text <> "Close stmt" and sql_text <> "Prepare";
+--echo <--
+
+SET SESSION log_slow_disabled_statements="call,admin";
+TRUNCATE TABLE mysql.slow_log;
+ALTER TABLE t1 add column extra2 int;
+CALL slow2();
+SELECT count(if(sleep(1) >= 0,0,NULL)) from t1 where j>'b and part3';
+
+--echo -->
+SELECT sql_text FROM mysql.slow_log where sql_text <> "Close stmt" and sql_text <> "Prepare";
+--echo <--
+
+SET SESSION log_slow_disabled_statements="";
+TRUNCATE TABLE mysql.slow_log;
+ALTER TABLE t1 add column extra3 int;
+CALL slow2();
+SELECT count(if(sleep(1) >= 0,0,NULL)) from t1 where j>'b and part4';
+
+--echo -->
+SELECT sql_text FROM mysql.slow_log where sql_text <> "Close stmt" and sql_text <> "Prepare";
+--echo <--
+
+SET SESSION log_slow_disabled_statements="call,admin,slave,sp";
+TRUNCATE TABLE mysql.slow_log;
+ALTER TABLE t1 add column extra4 int;
+CALL slow2();
+SELECT count(if(sleep(1) >= 0,0,NULL)) from t1 where j>'b and part5';
+
+--echo -->
+SELECT sql_text FROM mysql.slow_log where sql_text <> "Close stmt" and sql_text <> "Prepare";
+--echo <--
+--enable_ps2_protocol
+
+DROP TABLE t1,t2;
+DROP PROCEDURE slow;
+DROP PROCEDURE slow2;
+
+#
+# Restore setup
+#
+SET @@session.long_query_time= @old_long_query_time;
+TRUNCATE TABLE mysql.slow_log;
+SET @@global.log_output= @old_log_output;
+SET @@global.slow_query_log= @old_slow_query_log;
+SET @@global.log_slow_disabled_statements= @old_log_slow_disable_statements;
diff --git a/mysql-test/suite/sys_vars/t/log_slow_verbosity_basic.test b/mysql-test/suite/sys_vars/t/log_slow_verbosity_basic.test
new file mode 100644
index 00000000..3e27f25b
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/log_slow_verbosity_basic.test
@@ -0,0 +1,73 @@
+# set session
+
+SET @start_global_value = @@global.log_slow_verbosity;
+select @@global.log_slow_verbosity = @@session.log_slow_verbosity;
+SET @@global.log_slow_verbosity="",@@session.log_slow_verbosity="";
+
+#
+# exists as global only
+#
+show global variables like 'log_slow_verbosity';
+show session variables like 'log_slow_verbosity';
+select * from information_schema.global_variables where variable_name='log_slow_verbosity';
+select * from information_schema.session_variables where variable_name='log_slow_verbosity';
+
+#
+# show that it's writable
+#
+set global log_slow_verbosity=1;
+select @@global.log_slow_verbosity;
+set session log_slow_verbosity=1;
+select @@session.log_slow_verbosity;
+
+#
+# all valid values
+#
+set session log_slow_verbosity=1;
+select @@session.log_slow_verbosity;
+set session log_slow_verbosity=2;
+select @@session.log_slow_verbosity;
+set session log_slow_verbosity=3;
+select @@session.log_slow_verbosity;
+set session log_slow_verbosity=4;
+select @@session.log_slow_verbosity;
+set session log_slow_verbosity=5;
+select @@session.log_slow_verbosity;
+set session log_slow_verbosity=6;
+select @@session.log_slow_verbosity;
+set session log_slow_verbosity=7;
+select @@session.log_slow_verbosity;
+set session log_slow_verbosity=8;
+select @@session.log_slow_verbosity;
+set session log_slow_verbosity=16;
+select @@session.log_slow_verbosity;
+set session log_slow_verbosity=32;
+select @@session.log_slow_verbosity;
+
+
+set session log_slow_verbosity='innodb';
+select @@session.log_slow_verbosity;
+set session log_slow_verbosity='query_plan';
+select @@session.log_slow_verbosity;
+set session log_slow_verbosity='innodb,query_plan';
+select @@session.log_slow_verbosity;
+set session log_slow_verbosity='explain';
+select @@session.log_slow_verbosity;
+set session log_slow_verbosity='innodb,query_plan,explain,engine,warnings,full';
+select @@session.log_slow_verbosity;
+set session log_slow_verbosity='';
+select @@session.log_slow_verbosity;
+
+#
+# incorrect types/values
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set session log_slow_verbosity=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set session log_slow_verbosity=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set session log_slow_verbosity="foo";
+--error ER_WRONG_VALUE_FOR_VAR
+set session log_slow_verbosity=64;
+
+SET @@global.log_slow_verbosity = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/log_tc_size_basic.test b/mysql-test/suite/sys_vars/t/log_tc_size_basic.test
new file mode 100644
index 00000000..221338d0
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/log_tc_size_basic.test
@@ -0,0 +1,5 @@
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET GLOBAL log_tc_size=1;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET SESSION log_tc_size=1;
diff --git a/mysql-test/suite/sys_vars/t/log_warnings_basic.test b/mysql-test/suite/sys_vars/t/log_warnings_basic.test
new file mode 100644
index 00000000..54b4fc4c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/log_warnings_basic.test
@@ -0,0 +1,209 @@
+############## mysql-test\t\log_warnings_basic.test ###############
+# #
+# Variable Name: log_warnings #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 1 #
+# Range: - #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable log_warnings #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+############################################################
+# START OF log_warnings TESTS #
+############################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.log_warnings;
+SELECT @start_global_value;
+SET @start_session_value = @@session.log_warnings;
+SELECT @start_session_value;
+
+
+--echo '#--------------------FN_DYNVARS_067_01-------------------------#'
+########################################################################
+# Display the DEFAULT value of log_warnings #
+########################################################################
+
+SET @@global.log_warnings = 100;
+SET @@global.log_warnings = DEFAULT;
+SELECT @@global.log_warnings;
+
+SET @@session.log_warnings = 200;
+SET @@session.log_warnings = DEFAULT;
+SELECT @@session.log_warnings;
+
+
+--echo '#--------------------FN_DYNVARS_067_02-------------------------#'
+########################################################################
+# Check the DEFAULT value of log_warnings #
+########################################################################
+
+SET @@global.log_warnings = DEFAULT;
+SELECT @@global.log_warnings = 1;
+
+SET @@session.log_warnings = DEFAULT;
+SELECT @@session.log_warnings = 1;
+
+
+--echo '#--------------------FN_DYNVARS_067_03-------------------------#'
+######################################################################
+# Change the value of log_warnings to a valid value for GLOBAL Scope #
+######################################################################
+
+SET @@global.log_warnings = 0;
+SELECT @@global.log_warnings;
+SET @@global.log_warnings = 1;
+SELECT @@global.log_warnings;
+SET @@global.log_warnings = 60020;
+SELECT @@global.log_warnings;
+SET @@global.log_warnings = 65535;
+SELECT @@global.log_warnings;
+SET @@global.log_warnings = 65536;
+SELECT @@global.log_warnings;
+
+
+--echo '#--------------------FN_DYNVARS_067_04-------------------------#'
+#######################################################################
+# Change the value of log_warnings to a valid value for SESSION Scope #
+#######################################################################
+
+SET @@session.log_warnings = 0;
+SELECT @@session.log_warnings;
+SET @@session.log_warnings = 1;
+SELECT @@session.log_warnings;
+SET @@session.log_warnings = 50050;
+SELECT @@session.log_warnings;
+SET @@session.log_warnings = 65535;
+SELECT @@session.log_warnings;
+SET @@session.log_warnings = 65550;
+SELECT @@session.log_warnings;
+
+
+--echo '#------------------FN_DYNVARS_067_05-----------------------#'
+########################################################
+# Change the value of log_warnings to an invalid value #
+########################################################
+
+SET @@global.log_warnings = 100000000000;
+SELECT @@global.log_warnings;
+SET @@global.log_warnings = -1024;
+SELECT @@global.log_warnings;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.log_warnings = 65530.34;
+SELECT @@global.log_warnings;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.log_warnings = test;
+SELECT @@global.log_warnings;
+
+SET @@session.log_warnings = 100000000000;
+SELECT @@session.log_warnings;
+SET @@session.log_warnings = -2;
+SELECT @@session.log_warnings;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.log_warnings = 65530.34;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.log_warnings = test;
+SELECT @@session.log_warnings;
+
+
+--echo '#------------------FN_DYNVARS_067_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT @@global.log_warnings = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='log_warnings';
+
+--echo '#------------------FN_DYNVARS_067_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.log_warnings = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='log_warnings';
+
+
+--echo '#------------------FN_DYNVARS_067_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.log_warnings = TRUE;
+SELECT @@global.log_warnings;
+SET @@global.log_warnings = FALSE;
+SELECT @@global.log_warnings;
+
+
+--echo '#---------------------FN_DYNVARS_067_09----------------------#'
+#################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+#################################################################################
+
+SET @@global.log_warnings = 10;
+SELECT @@log_warnings = @@global.log_warnings;
+
+
+--echo '#---------------------FN_DYNVARS_067_10----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@log_warnings = 100;
+SELECT @@log_warnings = @@local.log_warnings;
+SELECT @@local.log_warnings = @@session.log_warnings;
+
+
+--echo '#---------------------FN_DYNVARS_067_11----------------------#'
+#######################################################################
+# Check if log_warnings can be accessed with and without @@ sign #
+#######################################################################
+
+SET log_warnings = 1;
+SELECT @@log_warnings;
+--Error ER_UNKNOWN_TABLE
+SELECT local.log_warnings;
+--Error ER_UNKNOWN_TABLE
+SELECT session.log_warnings;
+--Error ER_BAD_FIELD_ERROR
+SELECT log_warnings = @@session.log_warnings;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.log_warnings = @start_global_value;
+SELECT @@global.log_warnings;
+SET @@session.log_warnings = @start_session_value;
+SELECT @@session.log_warnings;
+
+
+#############################################################
+# END OF log_warnings TESTS #
+#############################################################
+
diff --git a/mysql-test/suite/sys_vars/t/long_query_time_basic.test b/mysql-test/suite/sys_vars/t/long_query_time_basic.test
new file mode 100644
index 00000000..f3acdb61
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/long_query_time_basic.test
@@ -0,0 +1,187 @@
+####################### mysql-test\t\long_query_time_basic.test ###############
+# #
+# Variable Name: long_query_time #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value:10 #
+# Min Value: 1 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable long_query_time #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+############################################################
+# START OF long_query_time TESTS #
+############################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.long_query_time;
+SET @start_session_value = @@session.long_query_time;
+
+--echo '#--------------------FN_DYNVARS_068_01-------------------------#'
+###############################################################
+# Display the DEFAULT value of long_query_time #
+###############################################################
+
+SET @@global.long_query_time = 100;
+SET @@global.long_query_time = DEFAULT;
+SELECT @@global.long_query_time >= 0;
+
+SET @@session.long_query_time = 200;
+SET @@session.long_query_time = DEFAULT;
+SELECT @@session.long_query_time >= 0;
+
+--echo '#--------------------FN_DYNVARS_068_03-------------------------#'
+#########################################################################
+# Change the value of long_query_time to a valid value for GLOBAL Scope #
+#########################################################################
+
+SET @@global.long_query_time = 0;
+SELECT @@global.long_query_time;
+SET @@global.long_query_time = 1;
+SELECT @@global.long_query_time;
+SET @@global.long_query_time = 60020;
+SELECT @@global.long_query_time;
+SET @@global.long_query_time = 31536000;
+SELECT @@global.long_query_time;
+SET @@global.long_query_time = 65536;
+SELECT @@global.long_query_time;
+
+
+--echo '#--------------------FN_DYNVARS_068_04-------------------------#'
+##########################################################################
+# Change the value of long_query_time to a valid value for SESSION Scope #
+##########################################################################
+
+SET @@session.long_query_time = 0;
+SELECT @@session.long_query_time;
+SET @@session.long_query_time = 1;
+SELECT @@session.long_query_time;
+SET @@session.long_query_time = 50050;
+SELECT @@session.long_query_time;
+SET @@session.long_query_time = 31536000;
+SELECT @@session.long_query_time;
+SET @@session.long_query_time = 65550;
+SELECT @@session.long_query_time;
+
+
+--echo '#------------------FN_DYNVARS_068_05-----------------------#'
+########################################################
+# Change the value of long_query_time to an invalid value #
+########################################################
+
+SET @@global.long_query_time = 100000000000;
+SELECT @@global.long_query_time;
+SET @@global.long_query_time = -1;
+SELECT @@global.long_query_time;
+SET @@global.long_query_time = 65530.34;
+SELECT @@global.long_query_time;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.long_query_time = test;
+SELECT @@global.long_query_time;
+
+SET @@session.long_query_time = 100000000000;
+SELECT @@session.long_query_time;
+SET @@session.long_query_time = -2;
+SELECT @@session.long_query_time;
+SET @@session.long_query_time = 65530.34;
+SELECT @@session.long_query_time;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.long_query_time = test;
+SELECT @@session.long_query_time;
+
+
+--echo '#------------------FN_DYNVARS_068_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT @@global.long_query_time = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='long_query_time';
+
+--echo '#------------------FN_DYNVARS_068_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.long_query_time = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='long_query_time';
+
+
+--echo '#------------------FN_DYNVARS_068_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.long_query_time = TRUE;
+SELECT @@global.long_query_time;
+SET @@global.long_query_time = FALSE;
+SELECT @@global.long_query_time;
+
+
+--echo '#---------------------FN_DYNVARS_001_09----------------------#'
+#################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+#################################################################################
+
+SET @@global.long_query_time = 10;
+SELECT @@long_query_time = @@global.long_query_time;
+
+
+--echo '#---------------------FN_DYNVARS_001_10----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@long_query_time = 100;
+SELECT @@long_query_time = @@local.long_query_time;
+SELECT @@local.long_query_time = @@session.long_query_time;
+
+
+--echo '#---------------------FN_DYNVARS_001_11----------------------#'
+##########################################################################
+# Check if long_query_time can be accessed with and without @@ sign #
+##########################################################################
+
+SET long_query_time = 1;
+SELECT @@long_query_time;
+--Error ER_UNKNOWN_TABLE
+SELECT local.long_query_time;
+--Error ER_UNKNOWN_TABLE
+SELECT session.long_query_time;
+--Error ER_BAD_FIELD_ERROR
+SELECT long_query_time = @@session.long_query_time;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.long_query_time = @start_global_value;
+
+####################################################
+# END OF long_query_time TESTS #
+####################################################
diff --git a/mysql-test/suite/sys_vars/t/low_priority_updates_basic.test b/mysql-test/suite/sys_vars/t/low_priority_updates_basic.test
new file mode 100644
index 00000000..e00688ef
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/low_priority_updates_basic.test
@@ -0,0 +1,218 @@
+############## mysql-test\t\low_priority_updates_basic.test ###################
+# #
+# Variable Name: low_priority_updates #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: boolean #
+# Default Value: FALSE #
+# Range: #
+# #
+# #
+# Creation Date: 2008-02-11 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable low_priority_updates #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_low-priority-updates #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+####################################################################
+# START OF low_priority_updates TESTS #
+####################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.low_priority_updates;
+SELECT @start_global_value;
+SET @start_session_value = @@session.low_priority_updates;
+SELECT @start_session_value;
+
+
+--echo '#--------------------FN_DYNVARS_069_01-------------------------#'
+####################################################################
+# Display the DEFAULT value of low_priority_updates #
+####################################################################
+
+SET @@global.low_priority_updates = ON;
+SET @@global.low_priority_updates = DEFAULT;
+SELECT @@global.low_priority_updates;
+
+SET @@session.low_priority_updates = ON;
+SET @@session.low_priority_updates = DEFAULT;
+SELECT @@session.low_priority_updates;
+
+
+--echo '#--------------------FN_DYNVARS_069_02-------------------------#'
+########################################################################
+# Check the DEFAULT value of low_priority_updates #
+########################################################################
+
+SET @@global.low_priority_updates = DEFAULT;
+SELECT @@global.low_priority_updates = 'FALSE';
+
+SET @@session.low_priority_updates = DEFAULT;
+SELECT @@session.low_priority_updates = 'FALSE';
+
+
+--echo '#--------------------FN_DYNVARS_069_03-------------------------#'
+##############################################################################
+# Change the value of low_priority_updates to a valid value for GLOBAL Scope #
+##############################################################################
+
+SET @@global.low_priority_updates = ON;
+SELECT @@global.low_priority_updates;
+SET @@global.low_priority_updates = OFF;
+SELECT @@global.low_priority_updates;
+SET @@global.low_priority_updates = 0;
+SELECT @@global.low_priority_updates;
+SET @@global.low_priority_updates = 1;
+SELECT @@global.low_priority_updates;
+SET @@global.low_priority_updates = TRUE;
+SELECT @@global.low_priority_updates;
+SET @@global.low_priority_updates = FALSE;
+SELECT @@global.low_priority_updates;
+
+
+
+--echo '#--------------------FN_DYNVARS_069_04-------------------------#'
+###############################################################################
+# Change the value of low_priority_updates to a valid value for SESSION Scope #
+###############################################################################
+
+SET @@session.low_priority_updates = ON;
+SELECT @@session.low_priority_updates;
+SET @@session.low_priority_updates = OFF;
+SELECT @@session.low_priority_updates;
+SET @@session.low_priority_updates = 0;
+SELECT @@session.low_priority_updates;
+SET @@session.low_priority_updates = 1;
+SELECT @@session.low_priority_updates;
+SET @@session.low_priority_updates = TRUE;
+SELECT @@session.low_priority_updates;
+SET @@session.low_priority_updates = FALSE;
+SELECT @@session.low_priority_updates;
+
+
+--echo '#------------------FN_DYNVARS_069_05-----------------------#'
+################################################################
+# Change the value of low_priority_updates to an invalid value #
+################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.low_priority_updates = 'ONN';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.low_priority_updates = "OFFF";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.low_priority_updates = TTRUE;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.low_priority_updates = FELSE;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.low_priority_updates = -1024;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.low_priority_updates = 65536;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.low_priority_updates = 65530.34;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.low_priority_updates = test;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.low_priority_updates = ONN;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.low_priority_updates = ONF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.low_priority_updates = OF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.low_priority_updates = 'OFN';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.low_priority_updates = -2;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.low_priority_updates = 65530.34;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.low_priority_updates = 65550;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.low_priority_updates = test;
+
+
+--echo '#------------------FN_DYNVARS_069_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT IF(@@global.low_priority_updates, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='low_priority_updates';
+
+--echo '#------------------FN_DYNVARS_069_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT IF(@@session.low_priority_updates, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='low_priority_updates';
+
+
+--echo '#---------------------FN_DYNVARS_069_08----------------------#'
+###############################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+###############################################################################
+
+SET @@low_priority_updates = FALSE;
+SET @@global.low_priority_updates = TRUE;
+SELECT @@low_priority_updates = @@global.low_priority_updates;
+
+
+--echo '#---------------------FN_DYNVARS_069_09----------------------#'
+########################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE #
+# points to same session variable #
+########################################################################
+
+SET @@low_priority_updates = ON;
+SELECT @@low_priority_updates = @@local.low_priority_updates;
+SELECT @@local.low_priority_updates = @@session.low_priority_updates;
+
+
+--echo '#---------------------FN_DYNVARS_069_10----------------------#'
+###############################################################################
+# Check if low_priority_updates can be accessed with and without @@ sign #
+###############################################################################
+
+SET low_priority_updates = 1;
+SELECT @@low_priority_updates;
+--Error ER_UNKNOWN_TABLE
+SELECT local.low_priority_updates;
+--Error ER_UNKNOWN_TABLE
+SELECT session.low_priority_updates;
+--Error ER_BAD_FIELD_ERROR
+SELECT low_priority_updates = @@session.low_priority_updates;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.low_priority_updates = @start_global_value;
+SELECT @@global.low_priority_updates;
+SET @@session.low_priority_updates = @start_session_value;
+SELECT @@session.low_priority_updates;
+
+
+#########################################################
+# END OF low_priority_updates TESTS #
+#########################################################
+
diff --git a/mysql-test/suite/sys_vars/t/lower_case_file_system_basic.test b/mysql-test/suite/sys_vars/t/lower_case_file_system_basic.test
new file mode 100644
index 00000000..6c2af693
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/lower_case_file_system_basic.test
@@ -0,0 +1,31 @@
+#
+# only global
+#
+# 2010-01-20 OBN - Modified to include check for valid values
+# - Added check for variable value matching I_S tables
+#
+select @@global.lower_case_file_system=2;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.lower_case_file_system;
+
+# Show variable has a valid value
+SELECT @@global.lower_case_file_system in (0,1);
+
+# Show that value of the variable matches the value in the GLOBAL I_S table
+SELECT IF(@@global.lower_case_file_system, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='lower_case_file_system';
+
+# Show that value of the variable matches the value in the SESSION I_S table
+SELECT IF(@@global.lower_case_file_system, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='lower_case_file_system';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global lower_case_file_system=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session lower_case_file_system=1;
+
diff --git a/mysql-test/suite/sys_vars/t/lower_case_table_names_basic.test b/mysql-test/suite/sys_vars/t/lower_case_table_names_basic.test
new file mode 100644
index 00000000..eaa6c959
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/lower_case_table_names_basic.test
@@ -0,0 +1,32 @@
+#
+# only global
+#
+# 2010-01-20 OBN - Modified to include check for valid values
+# - Added check for variable value matching I_S tables
+#
+
+select @@global.lower_case_table_names=20;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.lower_case_table_names;
+
+# Show variable has a valid value
+SELECT @@global.lower_case_table_names in (0,1,2);
+
+# Show that value of the variable matches the value in the GLOBAL I_S table
+SELECT @@global.lower_case_table_names = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='lower_case_table_names';
+
+# Show that value of the variable matches the value in the SESSION I_S table
+SELECT @@global.lower_case_table_names = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='lower_case_table_names';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global lower_case_table_names=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session lower_case_table_names=1;
+
diff --git a/mysql-test/suite/sys_vars/t/master_verify_checksum_basic.test b/mysql-test/suite/sys_vars/t/master_verify_checksum_basic.test
new file mode 100644
index 00000000..b70040ff
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/master_verify_checksum_basic.test
@@ -0,0 +1,19 @@
+--source include/not_embedded.inc
+
+# suite/rpl/t/rpl_checksum.test contains similar testing of
+# all checksum related system variables.
+
+set @save_master_verify_checksum = @@global.master_verify_checksum;
+
+select @@global.master_verify_checksum as 'must be zero because of default';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.master_verify_checksum as 'no session var';
+
+set @@global.master_verify_checksum = 0;
+set @@global.master_verify_checksum = default;
+
+--error ER_WRONG_VALUE_FOR_VAR
+set @@global.master_verify_checksum = 2; # the var is of bool type
+
+# cleanup
+set @@global.master_verify_checksum = @save_master_verify_checksum;
diff --git a/mysql-test/suite/sys_vars/t/master_verify_checksum_grant.test b/mysql-test/suite/sys_vars/t/master_verify_checksum_grant.test
new file mode 100644
index 00000000..33fa2a8a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/master_verify_checksum_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21972 Bind REPLICATION MASTER ADMIN to master_verify_checksum
+--echo #
+
+--let var = master_verify_checksum
+--let grant = REPLICATION MASTER ADMIN
+--let value = 1
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/max_allowed_packet_basic.test b/mysql-test/suite/sys_vars/t/max_allowed_packet_basic.test
new file mode 100644
index 00000000..fda349fc
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/max_allowed_packet_basic.test
@@ -0,0 +1,224 @@
+############## mysql-test\t\max_allowed_packet_basic.test ###############
+# #
+# Variable Name: max_allowed_packet #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value:1048576 #
+# Range:1024-1073741824 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable max_allowed_packet #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+##################################################################
+# START OF max_allowed_packet TESTS #
+##################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.max_allowed_packet;
+
+# give a known value to @@session.max_allowed_packet by assigning to
+# @@global and setting up a new connection (for deterministic result
+# file diffing)
+SET @@global.max_allowed_packet = DEFAULT;
+connect (conn1, localhost, root,,);
+
+
+
+--echo '#--------------------FN_DYNVARS_070_01-------------------------#'
+##################################################################
+# Display the DEFAULT value of max_allowed_packet #
+##################################################################
+
+SET @@global.max_allowed_packet = 1000;
+SET @@global.max_allowed_packet = DEFAULT;
+SELECT @@global.max_allowed_packet;
+
+--Error ER_VARIABLE_IS_READONLY
+SET @@session.max_allowed_packet = 20000;
+--Error ER_VARIABLE_IS_READONLY
+SET @@session.max_allowed_packet = DEFAULT;
+SELECT @@session.max_allowed_packet;
+
+
+--echo '#--------------------FN_DYNVARS_070_02-------------------------#'
+##################################################################
+# Check the DEFAULT value of max_allowed_packet #
+##################################################################
+
+SET @@global.max_allowed_packet = DEFAULT;
+SELECT @@global.max_allowed_packet = 1048576;
+
+
+--echo '#--------------------FN_DYNVARS_070_03-------------------------#'
+############################################################################
+# Change the value of max_allowed_packet to a valid value for GLOBAL Scope #
+############################################################################
+
+SET @@global.max_allowed_packet = 1024;
+SELECT @@global.max_allowed_packet;
+SET @@global.max_allowed_packet = 1025;
+SELECT @@global.max_allowed_packet;
+SET @@global.max_allowed_packet = 1073741824;
+SELECT @@global.max_allowed_packet;
+SET @@global.max_allowed_packet = 1073741823;
+SELECT @@global.max_allowed_packet;
+
+--echo '#--------------------FN_DYNVARS_070_04-------------------------#'
+#############################################################################
+# Change the value of max_allowed_packet to a valid value for SESSION Scope #
+#############################################################################
+
+--Error ER_VARIABLE_IS_READONLY
+SET @@session.max_allowed_packet = 1024;
+SELECT @@session.max_allowed_packet;
+--Error ER_VARIABLE_IS_READONLY
+SET @@session.max_allowed_packet = 1025;
+SELECT @@session.max_allowed_packet;
+--Error ER_VARIABLE_IS_READONLY
+SET @@session.max_allowed_packet = 65535;
+SELECT @@session.max_allowed_packet;
+--Error ER_VARIABLE_IS_READONLY
+SET @@session.max_allowed_packet = 1073741824;
+SELECT @@session.max_allowed_packet;
+--Error ER_VARIABLE_IS_READONLY
+SET @@session.max_allowed_packet = 1073741823;
+SELECT @@session.max_allowed_packet;
+
+
+--echo '#------------------FN_DYNVARS_070_05-----------------------#'
+##############################################################
+# Change the value of max_allowed_packet to an invalid value #
+##############################################################
+
+SET @@global.max_allowed_packet = 0;
+SELECT @@global.max_allowed_packet;
+SET @@global.max_allowed_packet = -1024;
+SELECT @@global.max_allowed_packet;
+SET @@global.max_allowed_packet = 1023;
+SELECT @@global.max_allowed_packet;
+SET @@global.max_allowed_packet = 10737418241;
+SELECT @@global.max_allowed_packet;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_allowed_packet = 65530.34;
+SELECT @@global.max_allowed_packet;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_allowed_packet = test;
+SELECT @@global.max_allowed_packet;
+
+--Error ER_VARIABLE_IS_READONLY
+SET @@session.max_allowed_packet = 0;
+SELECT @@session.max_allowed_packet;
+--Error ER_VARIABLE_IS_READONLY
+SET @@session.max_allowed_packet = 1023;
+SELECT @@session.max_allowed_packet;
+--Error ER_VARIABLE_IS_READONLY
+SET @@session.max_allowed_packet = -2;
+SELECT @@session.max_allowed_packet;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.max_allowed_packet = 65530.34;
+--Error ER_VARIABLE_IS_READONLY
+SET @@session.max_allowed_packet = 10737418241;
+SELECT @@session.max_allowed_packet;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.max_allowed_packet = test;
+SELECT @@session.max_allowed_packet;
+
+
+--echo '#------------------FN_DYNVARS_070_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT @@global.max_allowed_packet = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='max_allowed_packet';
+
+--echo '#------------------FN_DYNVARS_070_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.max_allowed_packet = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='max_allowed_packet';
+
+
+--echo '#------------------FN_DYNVARS_070_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.max_allowed_packet = TRUE;
+SELECT @@global.max_allowed_packet;
+SET @@global.max_allowed_packet = FALSE;
+SELECT @@global.max_allowed_packet;
+
+
+--echo '#---------------------FN_DYNVARS_070_09----------------------#'
+#################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+#################################################################################
+
+SET @@global.max_allowed_packet = 2048;
+SELECT @@max_allowed_packet = @@global.max_allowed_packet;
+
+
+--echo '#---------------------FN_DYNVARS_070_10----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+--Error ER_VARIABLE_IS_READONLY
+SET @@max_allowed_packet = 100000;
+SELECT @@max_allowed_packet = @@local.max_allowed_packet;
+SELECT @@local.max_allowed_packet = @@session.max_allowed_packet;
+
+
+--echo '#---------------------FN_DYNVARS_070_11----------------------#'
+#############################################################################
+# Check if max_allowed_packet can be accessed with and without @@ sign #
+#############################################################################
+
+--Error ER_VARIABLE_IS_READONLY
+SET max_allowed_packet = 1024;
+SELECT @@max_allowed_packet;
+--Error ER_UNKNOWN_TABLE
+SELECT local.max_allowed_packet;
+--Error ER_UNKNOWN_TABLE
+SELECT session.max_allowed_packet;
+--Error ER_BAD_FIELD_ERROR
+SELECT max_allowed_packet = @@session.max_allowed_packet;
+
+
+####################################
+# Restore initial value #
+####################################
+
+connection default;
+SET @@global.max_allowed_packet = @start_global_value;
+
+#######################################################
+# END OF max_allowed_packet TESTS #
+#######################################################
diff --git a/mysql-test/suite/sys_vars/t/max_allowed_packet_func.test b/mysql-test/suite/sys_vars/t/max_allowed_packet_func.test
new file mode 100644
index 00000000..d60c10a1
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/max_allowed_packet_func.test
@@ -0,0 +1,83 @@
+################## mysql-test\t\max_allowed_packet_func.test ##################
+# #
+# Variable Name: max_allowed_packet #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value:1048576 #
+# Range:1024-1073741824 #
+# #
+# #
+# Creation Date: 2008-03-07 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable max_allowed_packet #
+# that checks the functionality of this variable #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# #
+###############################################################################
+
+#due to lost connection on win64
+--source include/not_windows.inc
+
+SET @start_max_allowed_packet= @@global.max_allowed_packet;
+SET @start_value= @@global.net_buffer_length;
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#########################
+# Creating new table #
+#########################
+
+--echo ## Creating new table t1 ##
+CREATE TABLE t1
+(
+id INT NOT NULL auto_increment,
+PRIMARY KEY (id),
+name BLOB
+);
+
+--echo '#--------------------FN_DYNVARS_070_01-------------------------#'
+###############################################################################
+# Setting initial value of max_allowed_packet to 1024 at session level
+# should result in an error (session variable is readonly)
+###############################################################################
+
+--echo ## Setting value of max_allowed packet and net_buffer_length to 1024 ##
+--error ER_VARIABLE_IS_READONLY
+SET @@session.max_allowed_packet = 1024;
+SELECT @@session.max_allowed_packet > 0;
+
+--error ER_VARIABLE_IS_READONLY
+SET @@session.net_buffer_length = 1024;
+SELECT @@session.net_buffer_length > 0;
+
+
+--echo '#--------------------FN_DYNVARS_070_02-------------------------#'
+###############################################################################
+# Setting value of max_allowed_packet to 1024 at global level and
+# verifying its behavior after inserting data greater than 1024 bytes
+###############################################################################
+
+--echo ## Setting value of max_allowed packet and net_buffer_length to 1024 ##
+SET @@global.max_allowed_packet = 1024;
+SET @@global.net_buffer_length = 1024;
+SELECT @@global.max_allowed_packet;
+SELECT @@global.net_buffer_length;
+
+connect (test_con1,localhost,root,,);
+connection test_con1;
+
+--echo ## Inserting and fetching data of length greater than 1024 ##
+--Error 0,ER_NET_PACKET_TOO_LARGE
+INSERT into t1(name) values("aaassssssssddddddddffffffgggggggg, askdlfjalsdkjfalksdjflaksdjfalkjdflaksjdflakjdflajsflajflajdfalsjfdlajfladjslfajdflajdsflajsflakjsdfla;kjflsdjkf;aljfa;lkdsfjla;sjlkajffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllakjsdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa;;;;;;;;;;;;;;;;;;;;;;;;;;;dsklfjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjkljffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdkskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
+
+disconnect test_con1;
+connection default;
+drop table t1;
+SET @@global.max_allowed_packet= @start_max_allowed_packet;
+SET @@global.net_buffer_length= @start_value;
diff --git a/mysql-test/suite/sys_vars/t/max_binlog_cache_size_basic.test b/mysql-test/suite/sys_vars/t/max_binlog_cache_size_basic.test
new file mode 100644
index 00000000..974ec95c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/max_binlog_cache_size_basic.test
@@ -0,0 +1,187 @@
+############## mysql-test\t\max_binlog_cache_size_basic.test ###############
+# #
+# Variable Name: max_binlog_cache_size #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value:4294967295 #
+# Range: 4096-4294967295 #
+# #
+# #
+# #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable max_binlog_cache_size #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF max_binlog_cache_size TESTS #
+########################################################################
+
+
+########################################################################
+# Saving initial value of max_binlog_cache_size in a temporary variable#
+########################################################################
+
+SET @start_value = @@global.max_binlog_cache_size;
+--replace_result 18446744073709547520 max_binlog_cache_size 4294963200 max_binlog_cache_size
+SELECT @start_value;
+
+
+--echo '#--------------------FN_DYNVARS_072_01------------------------#'
+########################################################################
+# Display the DEFAULT value of max_binlog_cache_size #
+########################################################################
+
+SET @@global.max_binlog_cache_size = 5000;
+SET @@global.max_binlog_cache_size = DEFAULT;
+--replace_result 18446744073709547520 max_binlog_cache_size 4294963200 max_binlog_cache_size
+SELECT @@global.max_binlog_cache_size;
+
+
+--echo '#---------------------FN_DYNVARS_072_02-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@global.max_binlog_cache_size = @start_value;
+SELECT @@global.max_binlog_cache_size = 4294967295;
+
+--echo '#--------------------FN_DYNVARS_072_03------------------------#'
+########################################################################
+# Change the value of max_binlog_cache_size to a valid value #
+########################################################################
+
+SET @@global.max_binlog_cache_size = 4096;
+SELECT @@global.max_binlog_cache_size;
+SET @@global.max_binlog_cache_size = 4294967295;
+SELECT @@global.max_binlog_cache_size;
+SET @@global.max_binlog_cache_size = 4294967294;
+SELECT @@global.max_binlog_cache_size;
+SET @@global.max_binlog_cache_size = 4097;
+SELECT @@global.max_binlog_cache_size;
+SET @@global.max_binlog_cache_size = 65535;
+SELECT @@global.max_binlog_cache_size;
+
+
+--echo '#--------------------FN_DYNVARS_072_04-------------------------#'
+###########################################################################
+# Change the value of max_binlog_cache_size to invalid value #
+###########################################################################
+
+SET @@global.max_binlog_cache_size = -1;
+SELECT @@global.max_binlog_cache_size;
+SET @@global.max_binlog_cache_size = 100000000000;
+--replace_result 99999997952 max_binlog_cache_size 4294963200 max_binlog_cache_size
+SELECT @@global.max_binlog_cache_size;
+SET @@global.max_binlog_cache_size = 1024*1024;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_binlog_cache_size = 10000.01;
+SELECT @@global.max_binlog_cache_size;
+SET @@global.max_binlog_cache_size = -1024;
+SELECT @@global.max_binlog_cache_size;
+SET @@global.max_binlog_cache_size = 1024;
+SELECT @@global.max_binlog_cache_size;
+--disable_warnings
+SET @@global.max_binlog_cache_size = 4294967296;
+--enable_warnings
+--replace_result 4294963200 max_binlog_cache_size 4294967296 max_binlog_cache_size
+SELECT @@global.max_binlog_cache_size;
+SET @@global.max_binlog_cache_size = 4095;
+SELECT @@global.max_binlog_cache_size;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_binlog_cache_size = ON;
+SELECT @@global.max_binlog_cache_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_binlog_cache_size = 'test';
+SELECT @@global.max_binlog_cache_size;
+
+
+--echo '#-------------------FN_DYNVARS_072_05----------------------------#'
+###########################################################################
+# Test if accessing session max_binlog_cache_size gives error #
+###########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.max_binlog_cache_size = 4096;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.max_binlog_cache_size;
+
+
+--echo '#----------------------FN_DYNVARS_072_06------------------------#'
+##############################################################################
+# Check if the value in GLOBAL & SESSION Tables matches values in variable #
+##############################################################################
+
+SELECT @@global.max_binlog_cache_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='max_binlog_cache_size';
+
+SELECT @@max_binlog_cache_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='max_binlog_cache_size';
+
+
+--echo '#---------------------FN_DYNVARS_072_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.max_binlog_cache_size = TRUE;
+SELECT @@global.max_binlog_cache_size;
+SET @@global.max_binlog_cache_size = FALSE;
+SELECT @@global.max_binlog_cache_size;
+
+
+--echo '#---------------------FN_DYNVARS_072_08----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@global.max_binlog_cache_size = 5000;
+SELECT @@max_binlog_cache_size = @@global.max_binlog_cache_size;
+
+
+--echo '#---------------------FN_DYNVARS_072_09----------------------#'
+################################################################################
+# Check if max_binlog_cache_size can be accessed with and without @@ sign #
+################################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET max_binlog_cache_size = 6000;
+SELECT @@max_binlog_cache_size;
+--Error ER_UNKNOWN_TABLE
+SELECT local.max_binlog_cache_size;
+--Error ER_UNKNOWN_TABLE
+SELECT global.max_binlog_cache_size;
+--Error ER_BAD_FIELD_ERROR
+SELECT max_binlog_cache_size = @@session.max_binlog_cache_size;
+
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.max_binlog_cache_size = @start_value;
+--replace_result 4294963200 max_binlog_cache_size 18446744073709547520 max_binlog_cache_size
+SELECT @@global.max_binlog_cache_size;
+
+
+########################################################################
+# END OF max_binlog_cache_size TESTS #
+########################################################################
diff --git a/mysql-test/suite/sys_vars/t/max_binlog_cache_size_grant.test b/mysql-test/suite/sys_vars/t/max_binlog_cache_size_grant.test
new file mode 100644
index 00000000..ae1178ca
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/max_binlog_cache_size_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21963 Bind BINLOG ADMIN to a number of global system variables
+--echo #
+
+--let var = max_binlog_cache_size
+--let grant = BINLOG ADMIN
+--let value = 4096
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/max_binlog_size_basic.test b/mysql-test/suite/sys_vars/t/max_binlog_size_basic.test
new file mode 100644
index 00000000..22e8808e
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/max_binlog_size_basic.test
@@ -0,0 +1,175 @@
+############## mysql-test\t\max_binlog_size_basic.test ###############
+# #
+# Variable Name: max_binlog_size #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value:1073741824 #
+# Min Value:4096 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable max_binlog_size #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+##################################################################
+# START OF max_binlog_size TESTS #
+##################################################################
+
+
+##################################################################
+# Saving initial value of max_binlog_size in a temporary variable#
+##################################################################
+
+SET @start_value = @@global.max_binlog_size;
+SELECT @start_value;
+
+
+--echo '#--------------------FN_DYNVARS_072_01------------------------#'
+##################################################################
+# Display the DEFAULT value of max_binlog_size #
+##################################################################
+
+SET @@global.max_binlog_size = 5000;
+SET @@global.max_binlog_size = DEFAULT;
+SELECT @@global.max_binlog_size;
+
+--echo '#---------------------FN_DYNVARS_072_02-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@global.max_binlog_size = @start_value;
+SELECT @@global.max_binlog_size = 1073741824;
+
+--echo '#--------------------FN_DYNVARS_072_03------------------------#'
+##################################################################
+# Change the value of max_binlog_size to a valid value #
+##################################################################
+
+SET @@global.max_binlog_size = 4096;
+SELECT @@global.max_binlog_size;
+SET @@global.max_binlog_size = 1073741824;
+SELECT @@global.max_binlog_size;
+SET @@global.max_binlog_size = 1073741823;
+SELECT @@global.max_binlog_size;
+SET @@global.max_binlog_size = 4097;
+SELECT @@global.max_binlog_size;
+SET @@global.max_binlog_size = 65535;
+SELECT @@global.max_binlog_size;
+
+
+--echo '#--------------------FN_DYNVARS_072_04-------------------------#'
+#####################################################################
+# Change the value of max_binlog_size to invalid value #
+#####################################################################
+
+SET @@global.max_binlog_size = -1;
+SELECT @@global.max_binlog_size;
+SET @@global.max_binlog_size = 100000000000;
+SELECT @@global.max_binlog_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_binlog_size = 10000.01;
+SELECT @@global.max_binlog_size;
+SET @@global.max_binlog_size = -1024;
+SELECT @@global.max_binlog_size;
+SET @@global.max_binlog_size = 1024;
+SELECT @@global.max_binlog_size;
+SET @@global.max_binlog_size = 4294967296;
+SELECT @@global.max_binlog_size;
+SET @@global.max_binlog_size = 4095;
+SELECT @@global.max_binlog_size;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_binlog_size = ON;
+SELECT @@global.max_binlog_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_binlog_size = 'test';
+SELECT @@global.max_binlog_size;
+
+
+--echo '#-------------------FN_DYNVARS_072_05----------------------------#'
+#####################################################################
+# Test if accessing session max_binlog_size gives error #
+#####################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.max_binlog_size = 4096;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.max_binlog_size;
+
+
+--echo '#----------------------FN_DYNVARS_072_06------------------------#'
+##############################################################################
+# Check if the value in GLOBAL & SESSION Tables matches values in variable #
+##############################################################################
+
+SELECT @@global.max_binlog_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='max_binlog_size';
+
+SELECT @@max_binlog_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='max_binlog_size';
+
+
+--echo '#---------------------FN_DYNVARS_072_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.max_binlog_size = TRUE;
+SELECT @@global.max_binlog_size;
+SET @@global.max_binlog_size = FALSE;
+SELECT @@global.max_binlog_size;
+
+
+--echo '#---------------------FN_DYNVARS_072_08----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@global.max_binlog_size = 5000;
+SELECT @@max_binlog_size = @@global.max_binlog_size;
+
+
+--echo '#---------------------FN_DYNVARS_072_09----------------------#'
+##########################################################################
+# Check if max_binlog_size can be accessed with and without @@ sign #
+##########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET max_binlog_size = 6000;
+SELECT @@max_binlog_size;
+--Error ER_UNKNOWN_TABLE
+SELECT local.max_binlog_size;
+--Error ER_UNKNOWN_TABLE
+SELECT global.max_binlog_size;
+--Error ER_BAD_FIELD_ERROR
+SELECT max_binlog_size = @@session.max_binlog_size;
+
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.max_binlog_size = @start_value;
+SELECT @@global.max_binlog_size;
+
+
+##################################################################
+# END OF max_binlog_size TESTS #
+##################################################################
+
diff --git a/mysql-test/suite/sys_vars/t/max_binlog_size_grant.test b/mysql-test/suite/sys_vars/t/max_binlog_size_grant.test
new file mode 100644
index 00000000..05b7b266
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/max_binlog_size_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21963 Bind BINLOG ADMIN to a number of global system variables
+--echo #
+
+--let var = max_binlog_size
+--let grant = BINLOG ADMIN
+--let value = 4096
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/max_binlog_stmt_cache_size_basic.test b/mysql-test/suite/sys_vars/t/max_binlog_stmt_cache_size_basic.test
new file mode 100644
index 00000000..ba528e26
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/max_binlog_stmt_cache_size_basic.test
@@ -0,0 +1,188 @@
+############ mysql-test\t\max_binlog_stmt_cache_size_basic.test ###############
+# #
+# Variable Name: max_binlog_stmt_cache_size #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value:4294967295 #
+# Range: 4096-4294967295 #
+# #
+# #
+# #
+# #
+# #
+# Creation Date: 2010-11-05 #
+# Author: Alfranio #
+# #
+# Description: Test Cases of Dynamic System Variable #
+# max_binlog_stmt_cache_size that checks #
+# the behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.5/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+##########################################################################
+# START OF max_binlog_stmt_cache_size TESTS #
+##########################################################################
+
+
+##############################################################################
+# Saving initial value of max_binlog_stmt_cache_size in a temporary variable #
+##############################################################################
+
+SET @start_value = @@global.max_binlog_stmt_cache_size;
+--replace_result 18446744073709547520 max_binlog_stmt_cache_size 4294963200 max_binlog_stmt_cache_size
+SELECT @start_value;
+
+
+--echo '#--------------------FN_DYNVARS_072_01------------------------#'
+########################################################################
+# Display the DEFAULT value of max_binlog_stmt_cache_size #
+########################################################################
+
+SET @@global.max_binlog_stmt_cache_size = 5000;
+SET @@global.max_binlog_stmt_cache_size = DEFAULT;
+--replace_result 18446744073709547520 max_binlog_stmt_cache_size 4294963200 max_binlog_stmt_cache_size
+SELECT @@global.max_binlog_stmt_cache_size;
+
+
+--echo '#---------------------FN_DYNVARS_072_02-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@global.max_binlog_stmt_cache_size = @start_value;
+SELECT @@global.max_binlog_stmt_cache_size = 4294967295;
+
+--echo '#--------------------FN_DYNVARS_072_03------------------------#'
+########################################################################
+# Change the value of max_binlog_stmt_cache_size to a valid value #
+########################################################################
+
+SET @@global.max_binlog_stmt_cache_size = 4096;
+SELECT @@global.max_binlog_stmt_cache_size;
+SET @@global.max_binlog_stmt_cache_size = 4294967295;
+SELECT @@global.max_binlog_stmt_cache_size;
+SET @@global.max_binlog_stmt_cache_size = 4294967294;
+SELECT @@global.max_binlog_stmt_cache_size;
+SET @@global.max_binlog_stmt_cache_size = 4097;
+SELECT @@global.max_binlog_stmt_cache_size;
+SET @@global.max_binlog_stmt_cache_size = 65535;
+SELECT @@global.max_binlog_stmt_cache_size;
+
+
+--echo '#--------------------FN_DYNVARS_072_04-------------------------#'
+###########################################################################
+# Change the value of max_binlog_stmt_cache_size to invalid value #
+###########################################################################
+
+SET @@global.max_binlog_stmt_cache_size = -1;
+SELECT @@global.max_binlog_stmt_cache_size;
+SET @@global.max_binlog_stmt_cache_size = 100000000000;
+--replace_result 99999997952 max_binlog_stmt_cache_size 4294963200 max_binlog_stmt_cache_size
+SELECT @@global.max_binlog_stmt_cache_size;
+SET @@global.max_binlog_stmt_cache_size = 1024*1024;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_binlog_stmt_cache_size = 10000.01;
+SELECT @@global.max_binlog_stmt_cache_size;
+SET @@global.max_binlog_stmt_cache_size = -1024;
+SELECT @@global.max_binlog_stmt_cache_size;
+SET @@global.max_binlog_stmt_cache_size = 1024;
+SELECT @@global.max_binlog_stmt_cache_size;
+--disable_warnings
+SET @@global.max_binlog_stmt_cache_size = 4294967296;
+--enable_warnings
+--replace_result 4294963200 max_binlog_stmt_cache_size 4294967296 max_binlog_stmt_cache_size
+SELECT @@global.max_binlog_stmt_cache_size;
+SET @@global.max_binlog_stmt_cache_size = 4095;
+SELECT @@global.max_binlog_stmt_cache_size;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_binlog_stmt_cache_size = ON;
+SELECT @@global.max_binlog_stmt_cache_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_binlog_stmt_cache_size = 'test';
+SELECT @@global.max_binlog_stmt_cache_size;
+
+
+--echo '#-------------------FN_DYNVARS_072_05----------------------------#'
+###########################################################################
+# Test if accessing session max_binlog_stmt_cache_size gives error #
+###########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.max_binlog_stmt_cache_size = 4096;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.max_binlog_stmt_cache_size;
+
+
+--echo '#----------------------FN_DYNVARS_072_06------------------------#'
+##############################################################################
+# Check if the value in GLOBAL & SESSION Tables matches values in variable #
+##############################################################################
+
+SELECT @@global.max_binlog_stmt_cache_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='max_binlog_stmt_cache_size';
+
+SELECT @@max_binlog_stmt_cache_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='max_binlog_stmt_cache_size';
+
+
+--echo '#---------------------FN_DYNVARS_072_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.max_binlog_stmt_cache_size = TRUE;
+SELECT @@global.max_binlog_stmt_cache_size;
+SET @@global.max_binlog_stmt_cache_size = FALSE;
+SELECT @@global.max_binlog_stmt_cache_size;
+
+
+--echo '#---------------------FN_DYNVARS_072_08----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@global.max_binlog_stmt_cache_size = 5000;
+SELECT @@max_binlog_stmt_cache_size = @@global.max_binlog_stmt_cache_size;
+
+
+--echo '#---------------------FN_DYNVARS_072_09----------------------#'
+################################################################################
+# Check if max_binlog_stmt_cache_size can be accessed with and without @@ sign #
+################################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET max_binlog_stmt_cache_size = 6000;
+SELECT @@max_binlog_stmt_cache_size;
+--Error ER_UNKNOWN_TABLE
+SELECT local.max_binlog_stmt_cache_size;
+--Error ER_UNKNOWN_TABLE
+SELECT global.max_binlog_stmt_cache_size;
+--Error ER_BAD_FIELD_ERROR
+SELECT max_binlog_stmt_cache_size = @@session.max_binlog_stmt_cache_size;
+
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.max_binlog_stmt_cache_size = @start_value;
+--replace_result 4294963200 max_binlog_stmt_cache_size 18446744073709547520 max_binlog_stmt_cache_size
+SELECT @@global.max_binlog_stmt_cache_size;
+
+
+########################################################################
+# END OF max_binlog_stmt_cache_size TESTS #
+########################################################################
diff --git a/mysql-test/suite/sys_vars/t/max_binlog_stmt_cache_size_grant.test b/mysql-test/suite/sys_vars/t/max_binlog_stmt_cache_size_grant.test
new file mode 100644
index 00000000..d9decb6e
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/max_binlog_stmt_cache_size_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21963 Bind BINLOG ADMIN to a number of global system variables
+--echo #
+
+--let var = max_binlog_stmt_cache_size
+--let grant = BINLOG ADMIN
+--let value = 4096
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/max_connect_errors_basic.test b/mysql-test/suite/sys_vars/t/max_connect_errors_basic.test
new file mode 100644
index 00000000..654ccfd4
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/max_connect_errors_basic.test
@@ -0,0 +1,170 @@
+############## mysql-test\t\max_connect_errors_basic.test ###############
+# #
+# Variable Name: max_connect_errors #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 10 #
+# Range: 1-4294967295 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable max_connect_errors #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+##################################################################
+# START OF max_connect_errors TESTS #
+##################################################################
+
+
+######################################################################
+# Saving initial value of max_connect_errors in a temporary variable #
+######################################################################
+
+SET @start_value = @@global.max_connect_errors;
+SELECT @start_value >= 0;
+
+
+--echo '#--------------------FN_DYNVARS_073_01------------------------#'
+##################################################################
+# Display the DEFAULT value of max_connect_errors #
+##################################################################
+
+SET @@global.max_connect_errors = 5000;
+SET @@global.max_connect_errors = DEFAULT;
+
+--echo '#---------------------FN_DYNVARS_073_02-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@global.max_connect_errors = @start_value;
+SELECT @@global.max_connect_errors = @start_value;
+
+--echo '#--------------------FN_DYNVARS_073_03------------------------#'
+##################################################################
+# Change the value of max_connect_errors to a valid value #
+##################################################################
+
+SET @@global.max_connect_errors = 4096;
+SELECT @@global.max_connect_errors;
+SET @@global.max_connect_errors = 4294967294;
+SELECT @@global.max_connect_errors;
+SET @@global.max_connect_errors = 4294967295;
+SELECT @@global.max_connect_errors;
+SET @@global.max_connect_errors = 1;
+SELECT @@global.max_connect_errors;
+SET @@global.max_connect_errors = 2;
+SELECT @@global.max_connect_errors;
+
+
+--echo '#--------------------FN_DYNVARS_073_04-------------------------#'
+#####################################################################
+# Change the value of max_connect_errors to invalid value #
+#####################################################################
+
+SET @@global.max_connect_errors = -1;
+SELECT @@global.max_connect_errors;
+SET @@global.max_connect_errors = 100000000000;
+SELECT @@global.max_connect_errors;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_connect_errors = 10000.01;
+SELECT @@global.max_connect_errors;
+SET @@global.max_connect_errors = -1024;
+SELECT @@global.max_connect_errors;
+SET @@global.max_connect_errors = 0;
+SELECT @@global.max_connect_errors;
+SET @@global.max_connect_errors = 4294967296;
+SELECT @@global.max_connect_errors;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_connect_errors = ON;
+SELECT @@global.max_connect_errors;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_connect_errors = 'test';
+SELECT @@global.max_connect_errors;
+
+
+--echo '#-------------------FN_DYNVARS_073_05----------------------------#'
+#####################################################################
+# Test if accessing session max_connect_errors gives error #
+#####################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.max_connect_errors = 4096;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.max_connect_errors;
+
+
+--echo '#----------------------FN_DYNVARS_073_06------------------------#'
+##############################################################################
+# Check if the value in GLOBAL & SESSION Tables matches values in variable #
+##############################################################################
+
+SELECT @@global.max_connect_errors = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='max_connect_errors';
+
+SELECT @@max_connect_errors = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='max_connect_errors';
+
+
+--echo '#---------------------FN_DYNVARS_073_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.max_connect_errors = TRUE;
+SELECT @@global.max_connect_errors;
+SET @@global.max_connect_errors = FALSE;
+SELECT @@global.max_connect_errors;
+
+
+--echo '#---------------------FN_DYNVARS_073_08----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@global.max_connect_errors = 5000;
+SELECT @@max_connect_errors = @@global.max_connect_errors;
+
+
+--echo '#---------------------FN_DYNVARS_073_09----------------------#'
+##########################################################################
+# Check if max_connect_errors can be accessed with and without @@ sign #
+##########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET max_connect_errors = 6000;
+SELECT @@max_connect_errors;
+--Error ER_UNKNOWN_TABLE
+SELECT local.max_connect_errors;
+--Error ER_UNKNOWN_TABLE
+SELECT global.max_connect_errors;
+--Error ER_BAD_FIELD_ERROR
+SELECT max_connect_errors = @@session.max_connect_errors;
+
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.max_connect_errors = @start_value;
+
+##################################################################
+# END OF max_connect_errors TESTS #
+##################################################################
diff --git a/mysql-test/suite/sys_vars/t/max_connect_errors_grant.test b/mysql-test/suite/sys_vars/t/max_connect_errors_grant.test
new file mode 100644
index 00000000..d349d938
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/max_connect_errors_grant.test
@@ -0,0 +1,56 @@
+--source include/not_embedded.inc
+
+SET @global=@@global.max_connect_errors;
+
+--echo #
+--echo # MDEV-21961 Bind CONNECTION ADMIN to a number of global system variables
+--echo #
+
+--echo # Test that "SET max_connect_errors" is not allowed without CONNECTION ADMIN or SUPER
+
+CREATE USER user1@localhost;
+GRANT ALL PRIVILEGES ON *.* TO user1@localhost;
+REVOKE CONNECTION ADMIN, SUPER ON *.* FROM user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+SET GLOBAL max_connect_errors=10;
+--error ER_GLOBAL_VARIABLE
+SET max_connect_errors=10;
+--error ER_GLOBAL_VARIABLE
+SET SESSION max_connect_errors=10;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET max_connect_errors" is allowed with CONNECTION ADMIN
+
+CREATE USER user1@localhost;
+GRANT CONNECTION ADMIN ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+SET GLOBAL max_connect_errors=10;
+--error ER_GLOBAL_VARIABLE
+SET max_connect_errors=10;
+--error ER_GLOBAL_VARIABLE
+SET SESSION max_connect_errors=10;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET max_connect_errors" is allowed with SUPER
+
+CREATE USER user1@localhost;
+GRANT SUPER ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+SET GLOBAL max_connect_errors=10;
+--error ER_GLOBAL_VARIABLE
+SET max_connect_errors=10;
+--error ER_GLOBAL_VARIABLE
+SET SESSION max_connect_errors=10;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+SET @@global.max_connect_errors=@global;
diff --git a/mysql-test/suite/sys_vars/t/max_connections_basic.test b/mysql-test/suite/sys_vars/t/max_connections_basic.test
new file mode 100644
index 00000000..b4f3afbf
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/max_connections_basic.test
@@ -0,0 +1,173 @@
+############## mysql-test\t\max_connections_basic.test ###############
+# #
+# Variable Name: max_connections #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value:151 #
+# Range: 1-100000 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable max_connections #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+###############################################################
+# START OF max_connections TESTS #
+###############################################################
+
+
+###################################################################
+# Saving initial value of max_connections in a temporary variable #
+###################################################################
+
+SET @start_value = @@global.max_connections;
+SELECT @start_value > 0;
+
+
+--echo '#--------------------FN_DYNVARS_074_01------------------------#'
+##################################################################
+# Display the DEFAULT value of max_connections #
+##################################################################
+
+SET @@global.max_connections = @start_value+1;
+SET @@global.max_connections = DEFAULT;
+SELECT @@global.max_connections <> @start_value+1;
+
+--echo '#---------------------FN_DYNVARS_074_02-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@global.max_connections = @start_value;
+SELECT @@global.max_connections = @start_value;
+
+
+--echo '#--------------------FN_DYNVARS_074_03------------------------#'
+##################################################################
+# Change the value of max_connections to a valid value #
+##################################################################
+
+SET @@global.max_connections = 100000;
+SELECT @@global.max_connections;
+SET @@global.max_connections = 99999;
+SELECT @@global.max_connections;
+SET @@global.max_connections = 65536;
+SELECT @@global.max_connections;
+SET @@global.max_connections = 1;
+SELECT @@global.max_connections;
+SET @@global.max_connections = 2;
+SELECT @@global.max_connections;
+
+
+--echo '#--------------------FN_DYNVARS_074_04-------------------------#'
+#####################################################################
+# Change the value of max_connections to invalid value #
+#####################################################################
+
+SET @@global.max_connections = -1;
+SELECT @@global.max_connections;
+SET @@global.max_connections = 100000000000;
+SELECT @@global.max_connections;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_connections = 10000.01;
+SELECT @@global.max_connections;
+SET @@global.max_connections = -1024;
+SELECT @@global.max_connections;
+SET @@global.max_connections = 0;
+SELECT @@global.max_connections;
+SET @@global.max_connections = 100001;
+SELECT @@global.max_connections;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_connections = ON;
+SELECT @@global.max_connections;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_connections = 'test';
+SELECT @@global.max_connections;
+
+
+--echo '#-------------------FN_DYNVARS_074_05----------------------------#'
+#####################################################################
+# Test if accessing session max_connections gives error #
+#####################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.max_connections = 4096;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.max_connections;
+
+
+--echo '#----------------------FN_DYNVARS_074_06------------------------#'
+##############################################################################
+# Check if the value in GLOBAL & SESSION Tables matches values in variable #
+##############################################################################
+
+SELECT @@global.max_connections = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='max_connections';
+
+SELECT @@max_connections = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='max_connections';
+
+
+--echo '#---------------------FN_DYNVARS_074_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.max_connections = TRUE;
+SELECT @@global.max_connections;
+SET @@global.max_connections = FALSE;
+SELECT @@global.max_connections;
+
+
+--echo '#---------------------FN_DYNVARS_074_08----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@global.max_connections = 5000;
+SELECT @@max_connections = @@global.max_connections;
+
+
+--echo '#---------------------FN_DYNVARS_074_09----------------------#'
+##########################################################################
+# Check if max_connections can be accessed with and without @@ sign #
+##########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET max_connections = 6000;
+SELECT @@max_connections;
+--Error ER_UNKNOWN_TABLE
+SELECT local.max_connections;
+--Error ER_UNKNOWN_TABLE
+SELECT global.max_connections;
+--Error ER_BAD_FIELD_ERROR
+SELECT max_connections = @@session.max_connections;
+
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.max_connections = @start_value;
+
+
+##################################################################
+# END OF max_connections TESTS #
+##################################################################
diff --git a/mysql-test/suite/sys_vars/t/max_connections_grant.test b/mysql-test/suite/sys_vars/t/max_connections_grant.test
new file mode 100644
index 00000000..d51bd08e
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/max_connections_grant.test
@@ -0,0 +1,56 @@
+--source include/not_embedded.inc
+
+SET @global=@@global.max_connections;
+
+--echo #
+--echo # MDEV-21961 Bind CONNECTION ADMIN to a number of global system variables
+--echo #
+
+--echo # Test that "SET max_connections" is not allowed without CONNECTION ADMIN or SUPER
+
+CREATE USER user1@localhost;
+GRANT ALL PRIVILEGES ON *.* TO user1@localhost;
+REVOKE CONNECTION ADMIN, SUPER ON *.* FROM user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+SET GLOBAL max_connections=10;
+--error ER_GLOBAL_VARIABLE
+SET max_connections=10;
+--error ER_GLOBAL_VARIABLE
+SET SESSION max_connections=10;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET max_connections" is allowed with CONNECTION ADMIN
+
+CREATE USER user1@localhost;
+GRANT CONNECTION ADMIN ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+SET GLOBAL max_connections=10;
+--error ER_GLOBAL_VARIABLE
+SET max_connections=10;
+--error ER_GLOBAL_VARIABLE
+SET SESSION max_connections=10;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET max_connections" is allowed with SUPER
+
+CREATE USER user1@localhost;
+GRANT SUPER ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+SET GLOBAL max_connections=10;
+--error ER_GLOBAL_VARIABLE
+SET max_connections=10;
+--error ER_GLOBAL_VARIABLE
+SET SESSION max_connections=10;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+SET @@global.max_connections=@global;
diff --git a/mysql-test/suite/sys_vars/t/max_delayed_threads_basic.test b/mysql-test/suite/sys_vars/t/max_delayed_threads_basic.test
new file mode 100644
index 00000000..43947500
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/max_delayed_threads_basic.test
@@ -0,0 +1,223 @@
+############## mysql-test\t\max_delayed_threads_basic.test ###############
+# #
+# Variable Name: max_delayed_threads #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 20 #
+# Range: 0-16384 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable max_delayed_threads #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+##################################################################
+# START OF max_delayed_threads TESTS #
+##################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.max_delayed_threads;
+SELECT @start_global_value;
+SET @start_session_value = @@session.max_delayed_threads;
+SELECT @start_session_value;
+
+
+--echo '#--------------------FN_DYNVARS_075_01-------------------------#'
+##################################################################
+# Display the DEFAULT value of max_delayed_threads #
+##################################################################
+
+SET @@global.max_delayed_threads = 1000;
+SET @@global.max_delayed_threads = DEFAULT;
+SELECT @@global.max_delayed_threads;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.max_delayed_threads = 1000;
+SET @@session.max_delayed_threads = DEFAULT;
+SELECT @@session.max_delayed_threads;
+
+
+--echo '#--------------------FN_DYNVARS_075_02-------------------------#'
+##################################################################
+# Check the DEFAULT value of max_delayed_threads #
+##################################################################
+
+SET @@global.max_delayed_threads = DEFAULT;
+SELECT @@global.max_delayed_threads = 20;
+
+SET @@session.max_delayed_threads = DEFAULT;
+SELECT @@session.max_delayed_threads = 20;
+
+
+--echo '#--------------------FN_DYNVARS_075_03-------------------------#'
+############################################################################
+# Change the value of max_delayed_threads to a valid value for GLOBAL Scope #
+############################################################################
+
+SET @@global.max_delayed_threads = 1;
+SELECT @@global.max_delayed_threads;
+SET @@global.max_delayed_threads = 1025;
+SELECT @@global.max_delayed_threads;
+
+SET @@global.max_delayed_threads = 0;
+SELECT @@global.max_delayed_threads;
+SET @@global.max_delayed_threads = 16384;
+SELECT @@global.max_delayed_threads;
+SET @@global.max_delayed_threads = 16383;
+SELECT @@global.max_delayed_threads;
+
+--echo '#--------------------FN_DYNVARS_075_04-------------------------#'
+#############################################################################
+# Change the value of max_delayed_threads to a valid value for SESSION Scope #
+#############################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.max_delayed_threads = 1;
+SELECT @@session.max_delayed_threads;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.max_delayed_threads = 1025;
+SELECT @@session.max_delayed_threads;
+
+SET @@session.max_delayed_threads = 0;
+SELECT @@session.max_delayed_threads;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.max_delayed_threads = 16384;
+SELECT @@session.max_delayed_threads;
+
+SET @@session.max_delayed_threads = 16383;
+SELECT @@session.max_delayed_threads;
+
+
+--echo '#------------------FN_DYNVARS_075_05-----------------------#'
+##############################################################
+# Change the value of max_delayed_threads to an invalid value #
+##############################################################
+
+SET @@global.max_delayed_threads = -1024;
+SELECT @@global.max_delayed_threads;
+SET @@global.max_delayed_threads = -1;
+SELECT @@global.max_delayed_threads;
+SET @@global.max_delayed_threads = 16385;
+SELECT @@global.max_delayed_threads;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_delayed_threads = 65530.34;
+SELECT @@global.max_delayed_threads;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_delayed_threads = test;
+SELECT @@global.max_delayed_threads;
+SET @@session.max_delayed_threads = 16385;
+SELECT @@session.max_delayed_threads;
+SET @@session.max_delayed_threads = -1;
+SELECT @@session.max_delayed_threads;
+SET @@session.max_delayed_threads = -2;
+SELECT @@session.max_delayed_threads;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.max_delayed_threads = 65530.34;
+SET @@session.max_delayed_threads = 10737418241;
+SELECT @@session.max_delayed_threads;
+
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.max_delayed_threads = test;
+SELECT @@session.max_delayed_threads;
+
+
+--echo '#------------------FN_DYNVARS_075_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT @@global.max_delayed_threads = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='max_delayed_threads';
+
+--echo '#------------------FN_DYNVARS_075_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.max_delayed_threads = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='max_delayed_threads';
+
+
+--echo '#------------------FN_DYNVARS_075_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.max_delayed_threads = TRUE;
+SELECT @@global.max_delayed_threads;
+SET @@global.max_delayed_threads = FALSE;
+SELECT @@global.max_delayed_threads;
+
+
+--echo '#---------------------FN_DYNVARS_001_09----------------------#'
+#################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+#################################################################################
+
+SET @@global.max_delayed_threads = 2048;
+SELECT @@max_delayed_threads = @@global.max_delayed_threads;
+
+
+--echo '#---------------------FN_DYNVARS_001_10----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@max_delayed_threads = 100000;
+SELECT @@max_delayed_threads = @@local.max_delayed_threads;
+SELECT @@local.max_delayed_threads = @@session.max_delayed_threads;
+
+
+--echo '#---------------------FN_DYNVARS_001_11----------------------#'
+#############################################################################
+# Check if max_delayed_threads can be accessed with and without @@ sign #
+#############################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET max_delayed_threads = 1024;
+SELECT @@max_delayed_threads;
+--Error ER_UNKNOWN_TABLE
+SELECT local.max_delayed_threads;
+--Error ER_UNKNOWN_TABLE
+SELECT session.max_delayed_threads;
+--Error ER_BAD_FIELD_ERROR
+SELECT max_delayed_threads = @@session.max_delayed_threads;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.max_delayed_threads = @start_global_value;
+SELECT @@global.max_delayed_threads;
+SET @@session.max_delayed_threads = @start_session_value;
+SELECT @@session.max_delayed_threads;
+
+
+#######################################################
+# END OF max_delayed_threads TESTS #
+#######################################################
+
diff --git a/mysql-test/suite/sys_vars/t/max_digest_length_basic.test b/mysql-test/suite/sys_vars/t/max_digest_length_basic.test
new file mode 100644
index 00000000..92a74175
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/max_digest_length_basic.test
@@ -0,0 +1,46 @@
+# Copyright (C) 2010 Sun Microsystems, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
+
+--source include/not_embedded.inc
+
+#
+# Only global
+#
+
+select @@global.max_digest_length;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.max_digest_length;
+
+show global variables like 'max_digest_length';
+
+show session variables like 'max_digest_length';
+
+select * from information_schema.global_variables
+ where variable_name='max_digest_length';
+
+select * from information_schema.session_variables
+ where variable_name='max_digest_length';
+
+#
+# Read-only
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global max_digest_length=1;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session max_digest_length=1;
+
diff --git a/mysql-test/suite/sys_vars/t/max_error_count_basic.test b/mysql-test/suite/sys_vars/t/max_error_count_basic.test
new file mode 100644
index 00000000..987cc159
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/max_error_count_basic.test
@@ -0,0 +1,213 @@
+############## mysql-test\t\max_error_count_basic.test ###############
+# #
+# Variable Name: max_error_count #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 64 #
+# Range: 0-65535 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable max_error_count #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+###############################################################
+# START OF max_error_count TESTS #
+###############################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.max_error_count;
+SELECT @start_global_value;
+SET @start_session_value = @@session.max_error_count;
+SELECT @start_session_value;
+
+
+--echo '#--------------------FN_DYNVARS_076_01-------------------------#'
+###############################################################
+# Display the DEFAULT value of max_error_count #
+###############################################################
+
+SET @@global.max_error_count = 1000;
+SET @@global.max_error_count = DEFAULT;
+SELECT @@global.max_error_count;
+
+SET @@session.max_error_count = 20000;
+SET @@session.max_error_count = DEFAULT;
+SELECT @@session.max_error_count;
+
+
+--echo '#--------------------FN_DYNVARS_076_02-------------------------#'
+##################################################################
+# Check the DEFAULT value of max_error_count #
+##################################################################
+
+SET @@global.max_error_count = DEFAULT;
+SELECT @@global.max_error_count = 64;
+
+SET @@session.max_error_count = DEFAULT;
+SELECT @@session.max_error_count = 64;
+
+
+--echo '#--------------------FN_DYNVARS_076_03-------------------------#'
+############################################################################
+# Change the value of max_error_count to a valid value for GLOBAL Scope #
+############################################################################
+
+SET @@global.max_error_count = 1;
+SELECT @@global.max_error_count;
+SET @@global.max_error_count = 0;
+SELECT @@global.max_error_count;
+
+SET @@global.max_error_count = 65535;
+SELECT @@global.max_error_count;
+SET @@global.max_error_count = 65534;
+SELECT @@global.max_error_count;
+
+--echo '#--------------------FN_DYNVARS_076_04-------------------------#'
+#############################################################################
+# Change the value of max_error_count to a valid value for SESSION Scope #
+#############################################################################
+
+SET @@session.max_error_count = 0;
+SELECT @@session.max_error_count;
+SET @@session.max_error_count = 1;
+SELECT @@session.max_error_count;
+SET @@session.max_error_count = 65535;
+SELECT @@session.max_error_count;
+SET @@session.max_error_count = 65534;
+SELECT @@session.max_error_count;
+
+
+--echo '#------------------FN_DYNVARS_076_05-----------------------#'
+##############################################################
+# Change the value of max_error_count to an invalid value #
+##############################################################
+
+SET @@global.max_error_count = -1;
+SELECT @@global.max_error_count;
+SET @@global.max_error_count = -1024;
+SELECT @@global.max_error_count;
+SET @@global.max_error_count = 65536;
+SELECT @@global.max_error_count;
+SET @@global.max_error_count = 10737418241;
+SELECT @@global.max_error_count;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_error_count = 65530.34;
+SELECT @@global.max_error_count;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_error_count = test;
+SELECT @@global.max_error_count;
+
+SET @@session.max_error_count = -1;
+SELECT @@session.max_error_count;
+SET @@session.max_error_count = 65536;
+SELECT @@session.max_error_count;
+SET @@session.max_error_count = -2;
+SELECT @@session.max_error_count;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.max_error_count = 65530.34;
+SET @@session.max_error_count = 10737418241;
+SELECT @@session.max_error_count;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.max_error_count = test;
+SELECT @@session.max_error_count;
+
+
+--echo '#------------------FN_DYNVARS_076_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT @@global.max_error_count = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='max_error_count';
+
+--echo '#------------------FN_DYNVARS_076_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.max_error_count = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='max_error_count';
+
+
+--echo '#------------------FN_DYNVARS_076_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.max_error_count = TRUE;
+SELECT @@global.max_error_count;
+SET @@global.max_error_count = FALSE;
+SELECT @@global.max_error_count;
+
+
+--echo '#---------------------FN_DYNVARS_001_09----------------------#'
+#################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+#################################################################################
+
+SET @@global.max_error_count = 2048;
+SELECT @@max_error_count = @@global.max_error_count;
+
+
+--echo '#---------------------FN_DYNVARS_001_10----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@max_error_count = 60000;
+SELECT @@max_error_count = @@local.max_error_count;
+SELECT @@local.max_error_count = @@session.max_error_count;
+
+
+--echo '#---------------------FN_DYNVARS_001_11----------------------#'
+#############################################################################
+# Check if max_error_count can be accessed with and without @@ sign #
+#############################################################################
+
+SET max_error_count = 1024;
+SELECT @@max_error_count;
+--Error ER_UNKNOWN_TABLE
+SELECT local.max_error_count;
+--Error ER_UNKNOWN_TABLE
+SELECT session.max_error_count;
+--Error ER_BAD_FIELD_ERROR
+SELECT max_error_count = @@session.max_error_count;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.max_error_count = @start_global_value;
+SELECT @@global.max_error_count;
+SET @@session.max_error_count = @start_session_value;
+SELECT @@session.max_error_count;
+
+
+#######################################################
+# END OF max_error_count TESTS #
+#######################################################
+
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
new file mode 100644
index 00000000..26216814
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/max_heap_table_size_basic.test
@@ -0,0 +1,210 @@
+############## mysql-test\t\max_heap_table_size_basic.test ###############
+# #
+# Variable Name: max_heap_table_size #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 16777216 #
+# Range: 16384-4294967295 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable max_heap_table_size #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+###############################################################
+# START OF max_heap_table_size TESTS #
+###############################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.max_heap_table_size;
+SET @start_session_value = @@session.max_heap_table_size;
+SELECT @start_session_value = @start_global_value;
+
+
+--echo '#--------------------FN_DYNVARS_077_01-------------------------#'
+###############################################################
+# Display the DEFAULT value of max_heap_table_size #
+###############################################################
+
+SET @@global.max_heap_table_size = 1677721610;
+SET @@global.max_heap_table_size = DEFAULT;
+SELECT @@global.max_heap_table_size > 0;
+
+SET @@session.max_heap_table_size = 1677721610;
+SET @@session.max_heap_table_size = DEFAULT;
+SELECT @@session.max_heap_table_size > 0;
+
+
+--echo '#--------------------FN_DYNVARS_077_03-------------------------#'
+############################################################################
+# Change the value of max_heap_table_size to a valid value for GLOBAL Scope #
+############################################################################
+
+SET @@global.max_heap_table_size = 16384;
+SELECT @@global.max_heap_table_size;
+SET @@global.max_heap_table_size = 16385;
+SELECT @@global.max_heap_table_size;
+SET @@global.max_heap_table_size = 65535;
+SELECT @@global.max_heap_table_size;
+SET @@global.max_heap_table_size = 4294967294;
+SELECT @@global.max_heap_table_size;
+SET @@global.max_heap_table_size = 4294967295;
+SELECT @@global.max_heap_table_size;
+
+--echo '#--------------------FN_DYNVARS_077_04-------------------------#'
+#############################################################################
+# Change the value of max_heap_table_size to a valid value for SESSION Scope #
+#############################################################################
+
+SET @@session.max_heap_table_size = 16384;
+SELECT @@session.max_heap_table_size;
+SET @@session.max_heap_table_size = 16385;
+SELECT @@session.max_heap_table_size;
+SET @@session.max_heap_table_size = 65535;
+SELECT @@session.max_heap_table_size;
+SET @@session.max_heap_table_size = 4294967294;
+SELECT @@session.max_heap_table_size;
+SET @@session.max_heap_table_size = 4294967295;
+SELECT @@session.max_heap_table_size;
+
+--echo '#------------------FN_DYNVARS_077_05-----------------------#'
+##############################################################
+# Change the value of max_heap_table_size to an invalid value #
+##############################################################
+
+SET @@global.max_heap_table_size = -1;
+SELECT @@global.max_heap_table_size;
+SET @@global.max_heap_table_size = -1024;
+SELECT @@global.max_heap_table_size;
+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;
+
+
+--echo '#------------------FN_DYNVARS_077_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT @@global.max_heap_table_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='max_heap_table_size';
+
+--echo '#------------------FN_DYNVARS_077_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.max_heap_table_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='max_heap_table_size';
+
+
+--echo '#------------------FN_DYNVARS_077_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.max_heap_table_size = TRUE;
+SELECT @@global.max_heap_table_size;
+SET @@global.max_heap_table_size = FALSE;
+SELECT @@global.max_heap_table_size;
+
+
+--echo '#---------------------FN_DYNVARS_077_09----------------------#'
+#################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+#################################################################################
+
+SET @@global.max_heap_table_size = 163845;
+SELECT @@max_heap_table_size = @@global.max_heap_table_size;
+
+
+--echo '#---------------------FN_DYNVARS_077_10----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@max_heap_table_size = 16777216;
+SELECT @@max_heap_table_size = @@local.max_heap_table_size;
+SELECT @@local.max_heap_table_size = @@session.max_heap_table_size;
+
+
+--echo '#---------------------FN_DYNVARS_077_11----------------------#'
+#############################################################################
+# Check if max_heap_table_size can be accessed with and without @@ sign #
+#############################################################################
+
+SET max_heap_table_size = 316777216;
+SELECT @@max_heap_table_size;
+--Error ER_UNKNOWN_TABLE
+SELECT local.max_heap_table_size;
+--Error ER_UNKNOWN_TABLE
+SELECT session.max_heap_table_size;
+--Error ER_BAD_FIELD_ERROR
+SELECT max_heap_table_size = @@session.max_heap_table_size;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.max_heap_table_size = @start_global_value;
+
+
+#######################################################
+# END OF max_heap_table_size TESTS #
+#######################################################
diff --git a/mysql-test/suite/sys_vars/t/max_join_size_basic.test b/mysql-test/suite/sys_vars/t/max_join_size_basic.test
new file mode 100644
index 00000000..bbe13457
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/max_join_size_basic.test
@@ -0,0 +1,54 @@
+
+
+#
+# 2010-01-20 - OBN - Added check for variable value sameas I_S table
+# after variable value change
+#
+
+
+SET @start_global_value = @@global.max_join_size;
+SELECT @start_global_value;
+
+#
+# exists as global and session
+#
+select @@global.max_join_size;
+select @@session.max_join_size;
+show global variables like 'max_join_size';
+show session variables like 'max_join_size';
+select * from information_schema.global_variables where variable_name='max_join_size';
+select * from information_schema.session_variables where variable_name='max_join_size';
+
+#
+# show that it's writable
+#
+set global max_join_size=10;
+set session max_join_size=20;
+select @@global.max_join_size;
+select @@session.max_join_size;
+show global variables like 'max_join_size';
+show session variables like 'max_join_size';
+select * from information_schema.global_variables where variable_name='max_join_size';
+select * from information_schema.session_variables where variable_name='max_join_size';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global max_join_size=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global max_join_size=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global max_join_size="foo";
+
+#
+# affects OPTION_BIG_SELECTS
+#
+select @@sql_big_selects;
+set max_join_size=cast(-1 as unsigned int);
+select @@sql_big_selects;
+set max_join_size=100;
+select @@sql_big_selects;
+
+SET @@global.max_join_size = @start_global_value;
+SELECT @@global.max_join_size;
diff --git a/mysql-test/suite/sys_vars/t/max_join_size_func.test b/mysql-test/suite/sys_vars/t/max_join_size_func.test
new file mode 100644
index 00000000..c649c036
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/max_join_size_func.test
@@ -0,0 +1,120 @@
+################# mysql-test\t\max_join_size_func.test ########################
+# #
+# Variable Name: max_join_size #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 4294967295 #
+# Range: 1-4294967295 #
+# #
+# #
+# Creation Date: 2008-03-07 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable max_join_size #
+# that checks the functionality of this variable #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+##############################
+# Creating two new tables #
+##############################
+
+--echo ## Creating new table t1 ##
+CREATE TABLE t1
+(
+id INT NOT NULL auto_increment,
+PRIMARY KEY (id),
+name VARCHAR(30)
+);
+
+--echo ## Creating another table t2 ##
+CREATE TABLE t2
+(
+id INT NOT NULL auto_increment,
+PRIMARY KEY (id),
+name VARCHAR(30)
+);
+
+#########################################
+# Inserting some data in both tables #
+#########################################
+
+--echo ## Inserting records in both the tables ##
+INSERT INTO t1(name) VALUES('Record_1');
+INSERT INTO t1(name) VALUES('Record_2');
+INSERT INTO t1(name) VALUES('Record_3');
+INSERT INTO t1(name) VALUES('Record_4');
+INSERT INTO t1(name) VALUES('Record_5');
+
+INSERT INTO t2(name) VALUES('Record_1_1');
+INSERT INTO t2(name) VALUES('Record_2_1');
+INSERT INTO t2(name) VALUES('Record_3_1');
+INSERT INTO t2(name) VALUES('Record_4_1');
+INSERT INTO t2(name) VALUES('Record_5_1');
+
+
+--echo '#--------------------FN_DYNVARS_079_01-------------------------#'
+#######################################################################
+# Verifying case where max_join_size is greater than the join size #
+#######################################################################
+
+
+--echo ## Setting max_join size value to 10 ##
+SET @@session.max_join_size=10;
+
+--echo ## This should work ##
+SELECT * FROM t1 INNER JOIN t2 ON t1.id = t2.id;
+
+
+--echo '#--------------------FN_DYNVARS_079_02-------------------------#'
+####################################################################
+# Verifying case where max_join_size is less than the join size #
+####################################################################
+
+connect (test_con1, localhost, root,,);
+connection test_con1;
+
+--echo ## Setting value of max_join_size ##
+SET @@session.max_join_size=8;
+
+--echo ## Since total joins are more than max_join_size value so error will occur ##
+--Error ER_TOO_BIG_SELECT
+SELECT * FROM t1 INNER JOIN t2 ON t1.id = t2.id;
+
+
+--echo '#--------------------FN_DYNVARS_079_03-------------------------#'
+##########################################################
+# Verifying behavior of max_join_size on global scope #
+##########################################################
+
+--echo ## Setting global value of variable ##
+SET @@global.max_join_size=8;
+
+connect (test_con2, localhost, root,,);
+connection test_con2;
+
+--echo ## Verifying value of max_join_size ##
+SELECT @@global.max_join_size;
+
+--echo ## Since total joins are more than max_join_size value so error will occur ##
+--Error ER_TOO_BIG_SELECT
+SELECT * FROM t1 INNER JOIN t2 ON t1.id = t2.id;
+
+--echo ## Dropping both the tables ##
+Drop table t1, t2;
+
+--echo ## Restoring values ##
+SET @@global.max_join_size = DEFAULT;
+SET @@session.max_join_size = DEFAULT;
+
+disconnect test_con1;
+disconnect test_con2;
diff --git a/mysql-test/suite/sys_vars/t/max_length_for_sort_data_basic.test b/mysql-test/suite/sys_vars/t/max_length_for_sort_data_basic.test
new file mode 100644
index 00000000..167c2052
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/max_length_for_sort_data_basic.test
@@ -0,0 +1,224 @@
+############## mysql-test\t\max_length_for_sort_data_basic.test ###############
+# #
+# Variable Name: max_length_for_sort_data #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 1024 #
+# Range: 4-8388608 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable max_length_for_sort_data #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+#####################################################
+# START OF max_length_for_sort_data TESTS #
+#####################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.max_length_for_sort_data;
+SELECT @start_global_value;
+SET @start_session_value = @@session.max_length_for_sort_data;
+SELECT @start_session_value;
+
+
+--echo '#--------------------FN_DYNVARS_080_01-------------------------#'
+################################################################
+# Display the DEFAULT value of max_length_for_sort_data #
+################################################################
+
+SET @@global.max_length_for_sort_data = 1000;
+SET @@global.max_length_for_sort_data = DEFAULT;
+SELECT @@global.max_length_for_sort_data;
+
+
+SET @@session.max_length_for_sort_data = 1000;
+SET @@session.max_length_for_sort_data = DEFAULT;
+SELECT @@session.max_length_for_sort_data;
+
+
+--echo '#--------------------FN_DYNVARS_080_02-------------------------#'
+################################################################
+# Check the DEFAULT value of max_length_for_sort_data #
+################################################################
+
+SET @@global.max_length_for_sort_data = DEFAULT;
+SELECT @@global.max_length_for_sort_data = 1024;
+
+SET @@session.max_length_for_sort_data = DEFAULT;
+SELECT @@session.max_length_for_sort_data = 1024;
+
+
+
+--echo '#--------------------FN_DYNVARS_080_03-------------------------#'
+##################################################################################
+# Change the value of max_length_for_sort_data to a valid value for GLOBAL Scope #
+##################################################################################
+
+SET @@global.max_length_for_sort_data = 4;
+SELECT @@global.max_length_for_sort_data;
+SET @@global.max_length_for_sort_data = 5;
+SELECT @@global.max_length_for_sort_data;
+SET @@global.max_length_for_sort_data = 8388608;
+SELECT @@global.max_length_for_sort_data;
+SET @@global.max_length_for_sort_data = 8388607;
+SELECT @@global.max_length_for_sort_data;
+SET @@global.max_length_for_sort_data = 65536;
+SELECT @@global.max_length_for_sort_data;
+
+--echo '#--------------------FN_DYNVARS_080_04-------------------------#'
+###################################################################################
+# Change the value of max_length_for_sort_data to a valid value for SESSION Scope #
+###################################################################################
+
+SET @@session.max_length_for_sort_data = 4;
+SELECT @@session.max_length_for_sort_data;
+
+SET @@session.max_length_for_sort_data = 5;
+SELECT @@session.max_length_for_sort_data;
+
+SET @@session.max_length_for_sort_data = 8388608;
+SELECT @@session.max_length_for_sort_data;
+
+SET @@session.max_length_for_sort_data = 8388607;
+SELECT @@session.max_length_for_sort_data;
+
+SET @@session.max_length_for_sort_data = 65536;
+SELECT @@session.max_length_for_sort_data;
+
+
+--echo '#------------------FN_DYNVARS_080_05-----------------------#'
+####################################################################
+# Change the value of max_length_for_sort_data to an invalid value #
+####################################################################
+
+SET @@global.max_length_for_sort_data = -1024;
+SELECT @@global.max_length_for_sort_data;
+SET @@global.max_length_for_sort_data = 3;
+SELECT @@global.max_length_for_sort_data;
+SET @@global.max_length_for_sort_data = 8388609;
+SELECT @@global.max_length_for_sort_data;
+SET @@global.max_length_for_sort_data = 0;
+SELECT @@global.max_length_for_sort_data;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_length_for_sort_data = 65530.34;
+SELECT @@global.max_length_for_sort_data;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_length_for_sort_data = test;
+SELECT @@global.max_length_for_sort_data;
+
+SET @@session.max_length_for_sort_data = 8388610;
+SELECT @@session.max_length_for_sort_data;
+SET @@session.max_length_for_sort_data = -1;
+SELECT @@session.max_length_for_sort_data;
+SET @@session.max_length_for_sort_data = 3;
+SELECT @@session.max_length_for_sort_data;
+SET @@session.max_length_for_sort_data = 0;
+SELECT @@session.max_length_for_sort_data;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.max_length_for_sort_data = 65530.34;
+SET @@session.max_length_for_sort_data = 10737418241;
+SELECT @@session.max_length_for_sort_data;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.max_length_for_sort_data = test;
+SELECT @@session.max_length_for_sort_data;
+
+
+--echo '#------------------FN_DYNVARS_080_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT @@global.max_length_for_sort_data = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='max_length_for_sort_data';
+
+--echo '#------------------FN_DYNVARS_080_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.max_length_for_sort_data = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='max_length_for_sort_data';
+
+
+--echo '#------------------FN_DYNVARS_080_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.max_length_for_sort_data = TRUE;
+SELECT @@global.max_length_for_sort_data;
+SET @@global.max_length_for_sort_data = FALSE;
+SELECT @@global.max_length_for_sort_data;
+
+
+--echo '#---------------------FN_DYNVARS_080_09----------------------#'
+#################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+#################################################################################
+
+SET @@global.max_length_for_sort_data = 2048;
+SELECT @@max_length_for_sort_data = @@global.max_length_for_sort_data;
+
+
+--echo '#---------------------FN_DYNVARS_080_10----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@max_length_for_sort_data = 100000;
+SELECT @@max_length_for_sort_data = @@local.max_length_for_sort_data;
+SELECT @@local.max_length_for_sort_data = @@session.max_length_for_sort_data;
+
+
+--echo '#---------------------FN_DYNVARS_080_11----------------------#'
+###################################################################################
+# Check if max_length_for_sort_data can be accessed with and without @@ sign #
+###################################################################################
+
+
+SET max_length_for_sort_data = 1024;
+SELECT @@max_length_for_sort_data;
+--Error ER_UNKNOWN_TABLE
+SELECT local.max_length_for_sort_data;
+--Error ER_UNKNOWN_TABLE
+SELECT session.max_length_for_sort_data;
+--Error ER_BAD_FIELD_ERROR
+SELECT max_length_for_sort_data = @@session.max_length_for_sort_data;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.max_length_for_sort_data = @start_global_value;
+SELECT @@global.max_length_for_sort_data;
+SET @@session.max_length_for_sort_data = @start_session_value;
+SELECT @@session.max_length_for_sort_data;
+
+
+#############################################################
+# END OF max_length_for_sort_data TESTS #
+#############################################################
+
diff --git a/mysql-test/suite/sys_vars/t/max_password_errors_grant.test b/mysql-test/suite/sys_vars/t/max_password_errors_grant.test
new file mode 100644
index 00000000..f11c1fb8
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/max_password_errors_grant.test
@@ -0,0 +1,56 @@
+--source include/not_embedded.inc
+
+SET @global=@@global.max_password_errors;
+
+--echo #
+--echo # MDEV-21961 Bind CONNECTION ADMIN to a number of global system variables
+--echo #
+
+--echo # Test that "SET max_password_errors" is not allowed without CONNECTION ADMIN or SUPER
+
+CREATE USER user1@localhost;
+GRANT ALL PRIVILEGES ON *.* TO user1@localhost;
+REVOKE CONNECTION ADMIN, SUPER ON *.* FROM user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+SET GLOBAL max_password_errors=10;
+--error ER_GLOBAL_VARIABLE
+SET max_password_errors=10;
+--error ER_GLOBAL_VARIABLE
+SET SESSION max_password_errors=10;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET max_password_errors" is allowed with CONNECTION ADMIN
+
+CREATE USER user1@localhost;
+GRANT CONNECTION ADMIN ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+SET GLOBAL max_password_errors=10;
+--error ER_GLOBAL_VARIABLE
+SET max_password_errors=10;
+--error ER_GLOBAL_VARIABLE
+SET SESSION max_password_errors=10;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET max_password_errors" is allowed with SUPER
+
+CREATE USER user1@localhost;
+GRANT SUPER ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+SET GLOBAL max_password_errors=10;
+--error ER_GLOBAL_VARIABLE
+SET max_password_errors=10;
+--error ER_GLOBAL_VARIABLE
+SET SESSION max_password_errors=10;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+SET @@global.max_password_errors=@global;
diff --git a/mysql-test/suite/sys_vars/t/max_prepared_stmt_count_basic.test b/mysql-test/suite/sys_vars/t/max_prepared_stmt_count_basic.test
new file mode 100644
index 00000000..799dd0c8
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/max_prepared_stmt_count_basic.test
@@ -0,0 +1,179 @@
+############## mysql-test\t\max_prepared_stmt_count_basic.test ###############
+# #
+# Variable Name: max_prepared_stmt_count #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 16382 #
+# Range: 0-1048576 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable max_prepared_stmt_count #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+#Due to differences in the results, ps-protocol is switched off.
+--disable_ps_protocol
+
+--source include/load_sysvars.inc
+
+
+########################################################################
+# START OF max_prepared_stmt_count TESTS #
+########################################################################
+
+
+###########################################################################
+# Saving initial value of max_prepared_stmt_count in a temporary variable #
+###########################################################################
+
+SET @start_value = @@global.max_prepared_stmt_count;
+SELECT @start_value;
+
+
+--echo '#--------------------FN_DYNVARS_081_01------------------------#'
+##########################################################################
+# Display the DEFAULT value of max_prepared_stmt_count #
+##########################################################################
+
+SET @@global.max_prepared_stmt_count = 5000;
+SET @@global.max_prepared_stmt_count = DEFAULT;
+SELECT @@global.max_prepared_stmt_count;
+
+
+--echo '#---------------------FN_DYNVARS_081_02-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@global.max_prepared_stmt_count = @start_value;
+SELECT @@global.max_prepared_stmt_count = 16382;
+
+
+--echo '#--------------------FN_DYNVARS_081_03------------------------#'
+##########################################################################
+# Change the value of max_prepared_stmt_count to a valid value #
+##########################################################################
+
+SET @@global.max_prepared_stmt_count = 0;
+SELECT @@global.max_prepared_stmt_count;
+SET @@global.max_prepared_stmt_count = 1;
+SELECT @@global.max_prepared_stmt_count;
+SET @@global.max_prepared_stmt_count = 1048576;
+SELECT @@global.max_prepared_stmt_count;
+SET @@global.max_prepared_stmt_count = 1048575;
+SELECT @@global.max_prepared_stmt_count;
+SET @@global.max_prepared_stmt_count = 65535;
+SELECT @@global.max_prepared_stmt_count;
+
+
+--echo '#--------------------FN_DYNVARS_081_04-------------------------#'
+#############################################################################
+# Change the value of max_prepared_stmt_count to invalid value #
+#############################################################################
+
+SET @@global.max_prepared_stmt_count = -1;
+SELECT @@global.max_prepared_stmt_count;
+SET @@global.max_prepared_stmt_count = 100000000000;
+SELECT @@global.max_prepared_stmt_count;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_prepared_stmt_count = 10000.01;
+SELECT @@global.max_prepared_stmt_count;
+SET @@global.max_prepared_stmt_count = -1024;
+SELECT @@global.max_prepared_stmt_count;
+SET @@global.max_prepared_stmt_count = 4294967296;
+SELECT @@global.max_prepared_stmt_count;
+SET @@global.max_prepared_stmt_count = 4294967295*1024;
+SELECT @@global.max_prepared_stmt_count;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_prepared_stmt_count = ON;
+SELECT @@global.max_prepared_stmt_count;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_prepared_stmt_count = 'test';
+SELECT @@global.max_prepared_stmt_count;
+
+
+--echo '#-------------------FN_DYNVARS_081_05----------------------------#'
+#############################################################################
+# Test if accessing session max_prepared_stmt_count gives error #
+#############################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.max_prepared_stmt_count = 4096;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.max_prepared_stmt_count;
+
+
+--echo '#----------------------FN_DYNVARS_081_06------------------------#'
+##############################################################################
+# Check if the value in GLOBAL & SESSION Tables matches values in variable #
+##############################################################################
+
+SELECT @@global.max_prepared_stmt_count = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='max_prepared_stmt_count';
+
+SELECT @@max_prepared_stmt_count = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='max_prepared_stmt_count';
+
+
+--echo '#---------------------FN_DYNVARS_081_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.max_prepared_stmt_count = TRUE;
+SELECT @@global.max_prepared_stmt_count;
+SET @@global.max_prepared_stmt_count = FALSE;
+SELECT @@global.max_prepared_stmt_count;
+
+
+--echo '#---------------------FN_DYNVARS_081_08----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@global.max_prepared_stmt_count = 5000;
+SELECT @@max_prepared_stmt_count = @@global.max_prepared_stmt_count;
+
+
+--echo '#---------------------FN_DYNVARS_081_09----------------------#'
+################################################################################
+# Check if max_prepared_stmt_count can be accessed with and without @@ sign #
+################################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET max_prepared_stmt_count = 6000;
+SELECT @@max_prepared_stmt_count;
+--Error ER_UNKNOWN_TABLE
+SELECT local.max_prepared_stmt_count;
+--Error ER_UNKNOWN_TABLE
+SELECT global.max_prepared_stmt_count;
+--Error ER_BAD_FIELD_ERROR
+SELECT max_prepared_stmt_count = @@session.max_prepared_stmt_count;
+
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.max_prepared_stmt_count = @start_value;
+SELECT @@global.max_prepared_stmt_count;
+
+--enable_ps_protocol
+########################################################################
+# END OF max_prepared_stmt_count TESTS #
+########################################################################
diff --git a/mysql-test/suite/sys_vars/t/max_prepared_stmt_count_func.test b/mysql-test/suite/sys_vars/t/max_prepared_stmt_count_func.test
new file mode 100644
index 00000000..c37fc7ab
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/max_prepared_stmt_count_func.test
@@ -0,0 +1,152 @@
+############# mysql-test\t\max_prepared_stmt_count_fn.test #####################
+# #
+# Variable Name: max_prepared_stmt_count #
+# Scope: SESSION #
+# Access Type: Dynamic #
+# Data Type: NUMERIC #
+# Default Value: 16382 #
+# Values: 0-1048576 #
+# #
+# #
+# Creation Date: 2008-03-02 #
+# Author: Sharique Abdullah #
+# #
+# Description: Test Cases of Dynamic System Variable "max_prepared_stmt_count" #
+# that checks behavior of this variable in the following ways #
+# * Functionality based on different values #
+# #
+#Reference: http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html#
+# option_mysqld_max_prepared_stmt_count #
+# #
+################################################################################
+--source include/no_protocol.inc
+
+--echo ** Setup **
+--echo
+#
+# Setup
+#
+
+SET @global_max_prepared_stmt_count = @@global.max_prepared_stmt_count;
+
+
+--echo '#---------------------FN_DYNVARS_031_01----------------------#'
+#################################################################################
+# Check if prepared stmt Can be created more then max_prepared_stmt_count value#
+#################################################################################
+
+SET GLOBAL max_prepared_stmt_count=2;
+--echo ** Prepare statements **
+#preparing stmts
+PREPARE stmt from "SELECT * FROM information_schema.CHARACTER_SETS C";
+PREPARE stmt1 from "SELECT * FROM information_schema.CHARACTER_SETS C";
+--Error ER_MAX_PREPARED_STMT_COUNT_REACHED
+PREPARE stmt2 from "SELECT * FROM information_schema.CHARACTER_SETS C";
+--echo Expected error "Max prepared statements count reached"
+
+SHOW STATUS like 'Prepared_stmt_count';
+--echo 2 Expected
+
+
+--echo '#---------------------FN_DYNVARS_031_02----------------------#'
+################################################################################
+# Check if prepared stmt Can be created more then max_prepared_stmt_count value
+################################################################################
+
+SET GLOBAL max_prepared_stmt_count=0;
+
+--Error ER_MAX_PREPARED_STMT_COUNT_REACHED
+PREPARE stmt3 from "SELECT * FROM information_schema.CHARACTER_SETS C";
+--echo Expected error "Max prepared statements count reached"
+
+SHOW STATUS like 'Prepared_stmt_count';
+--echo 2 Expected
+
+--Error ER_MAX_PREPARED_STMT_COUNT_REACHED
+PREPARE stmt from "SELECT * FROM information_schema.CHARACTER_SETS C";
+--echo Expected error "Max prepared statements count reached"
+
+SHOW STATUS like 'Prepared_stmt_count';
+--echo 2 Expected
+--echo 'Bug#35389 A pre existing valid prepared statement DROPS if a PREPARE'
+--echo 'STATEMENT command is issued with the same name that'
+--echo 'causes ER_MAX_PREPARED_STMT_COUNT_REACHED error'
+
+
+--echo '#---------------------FN_DYNVARS_031_03----------------------#'
+##############################################################################
+# check the status of prepared_max stmt after setting max_prepared_stmt_count
+##############################################################################
+
+
+SHOW STATUS like 'Prepared_stmt_count';
+SET GLOBAL max_prepared_stmt_count=4;
+PREPARE stmt from "SELECT * FROM information_schema.CHARACTER_SETS C";
+PREPARE stmt1 from "SELECT * FROM information_schema.CHARACTER_SETS C";
+PREPARE stmt2 from "SELECT * FROM information_schema.CHARACTER_SETS C";
+PREPARE stmt3 from "SELECT * FROM information_schema.CHARACTER_SETS C";
+--echo ** Value of prepared stmt'
+SHOW STATUS LIKE 'Prepared_stmt_count';
+--echo 4 Expected
+
+
+--echo '#---------------------FN_DYNVARS_031_04----------------------#'
+######################################################################
+# Setting value lower then number of prepared stmt #
+######################################################################
+
+--echo ** preparing stmts **
+#preparing stmts
+
+PREPARE stmt from "SELECT * FROM information_schema.CHARACTER_SETS C";
+PREPARE stmt1 from "SELECT * FROM information_schema.CHARACTER_SETS C";
+PREPARE stmt2 from "SELECT * FROM information_schema.CHARACTER_SETS C";
+
+--echo ** setting value **
+SET GLOBAL max_prepared_stmt_count=3;
+--echo ** Check wether any more statements can be prepared **
+
+--Error ER_MAX_PREPARED_STMT_COUNT_REACHED
+PREPARE stmt5 from "SELECT * FROM information_schema.CHARACTER_SETS C";
+--echo Expected error "Max prepared statements count reached"
+
+SHOW STATUS LIKE 'Prepared_stmt_count';
+--echo 4 Expected
+
+
+--echo '#---------------------FN_DYNVARS_031_05----------------------#'
+###########################################################################
+# Checking in stored procedure#
+###########################################################################
+
+SET GLOBAL max_prepared_stmt_count=3;
+
+--echo ** Creating procedure **
+# create procedure to add rows
+DROP PROCEDURE IF EXISTS sp_checkstmts;
+
+DELIMITER //;
+
+CREATE PROCEDURE sp_checkstmts ()
+BEGIN
+PREPARE newstmt from "SELECT * FROM information_schema.CHARACTER_SETS C";
+END //
+
+DELIMITER ;//
+
+-- Error ER_MAX_PREPARED_STMT_COUNT_REACHED
+CALL sp_checkstmts();
+--echo Expected error "Max prepared statements count reached"
+
+#
+# Cleanup
+#
+
+DROP PREPARE stmt;
+DROP PREPARE stmt1;
+DROP PREPARE stmt2;
+DROP PREPARE stmt3;
+
+DROP PROCEDURE sp_checkstmts;
+
+SET @@global.max_prepared_stmt_count = @global_max_prepared_stmt_count;
diff --git a/mysql-test/suite/sys_vars/t/max_relay_log_size_basic.test b/mysql-test/suite/sys_vars/t/max_relay_log_size_basic.test
new file mode 100644
index 00000000..de7cc395
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/max_relay_log_size_basic.test
@@ -0,0 +1,172 @@
+############## mysql-test\t\max_relay_log_size_basic.test ###############
+# #
+# Variable Name: max_relay_log_size #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 1024 #
+# Range: 0-1073741824 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable max_relay_log_size #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+--source include/not_embedded.inc
+
+###################################################################
+# START OF max_relay_log_size TESTS #
+###################################################################
+
+
+######################################################################
+# Saving initial value of max_relay_log_size in a temporary variable #
+######################################################################
+
+SET @start_value = @@global.max_relay_log_size;
+SELECT @start_value;
+
+
+--echo '#--------------------FN_DYNVARS_082_01------------------------#'
+#####################################################################
+# Display the DEFAULT value of max_relay_log_size #
+#####################################################################
+
+SET @@global.max_relay_log_size = 5000;
+SET @@global.max_relay_log_size = DEFAULT;
+SELECT @@global.max_relay_log_size;
+
+
+--echo '#---------------------FN_DYNVARS_082_02-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@global.max_relay_log_size = @start_value;
+SELECT @@global.max_relay_log_size = 1024;
+
+--echo '#--------------------FN_DYNVARS_082_03------------------------#'
+#####################################################################
+# Change the value of max_relay_log_size to a valid value #
+#####################################################################
+
+SET @@global.max_relay_log_size = 0;
+SELECT @@global.max_relay_log_size;
+SET @@global.max_relay_log_size = 1;
+SELECT @@global.max_relay_log_size;
+SET @@global.max_relay_log_size = 1073741824;
+SELECT @@global.max_relay_log_size;
+SET @@global.max_relay_log_size = 1073741823;
+SELECT @@global.max_relay_log_size;
+SET @@global.max_relay_log_size = 65535;
+SELECT @@global.max_relay_log_size;
+
+--echo '#--------------------FN_DYNVARS_082_04-------------------------#'
+########################################################################
+# Change the value of max_relay_log_size to invalid value #
+########################################################################
+
+SET @@global.max_relay_log_size = -1;
+SELECT @@global.max_relay_log_size;
+SET @@global.max_relay_log_size = 100000000000;
+SELECT @@global.max_relay_log_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_relay_log_size = 10000.01;
+SELECT @@global.max_relay_log_size;
+SET @@global.max_relay_log_size = -1024;
+SELECT @@global.max_relay_log_size;
+SET @@global.max_relay_log_size = 1073741825;
+SELECT @@global.max_relay_log_size;
+SET @@global.max_relay_log_size = 10737418241;
+SELECT @@global.max_relay_log_size;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_relay_log_size = ON;
+SELECT @@global.max_relay_log_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_relay_log_size = 'test';
+SELECT @@global.max_relay_log_size;
+
+
+--echo '#-------------------FN_DYNVARS_082_05----------------------------#'
+########################################################################
+# Test if accessing session max_relay_log_size gives error #
+########################################################################
+
+SET @@session.max_relay_log_size = 4096;
+SELECT @@session.max_relay_log_size;
+
+
+--echo '#----------------------FN_DYNVARS_082_06------------------------#'
+##############################################################################
+# Check if the value in GLOBAL & SESSION Tables matches values in variable #
+##############################################################################
+
+SELECT @@global.max_relay_log_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='max_relay_log_size';
+
+SELECT @@max_relay_log_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='max_relay_log_size';
+
+
+--echo '#---------------------FN_DYNVARS_082_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.max_relay_log_size = TRUE;
+SELECT @@global.max_relay_log_size;
+SET @@global.max_relay_log_size = FALSE;
+SELECT @@global.max_relay_log_size;
+
+
+--echo '#---------------------FN_DYNVARS_082_08----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@global.max_relay_log_size = 5000;
+SELECT @@max_relay_log_size = @@global.max_relay_log_size;
+
+
+--echo '#---------------------FN_DYNVARS_082_09----------------------#'
+#############################################################################
+# Check if max_relay_log_size can be accessed with and without @@ sign #
+#############################################################################
+
+SET max_relay_log_size = 6000;
+SELECT @@max_relay_log_size;
+--Error ER_UNKNOWN_TABLE
+SELECT local.max_relay_log_size;
+--Error ER_UNKNOWN_TABLE
+SELECT global.max_relay_log_size;
+--Error ER_BAD_FIELD_ERROR
+SELECT max_relay_log_size = @@session.max_relay_log_size;
+
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.max_relay_log_size = @start_value;
+SELECT @@global.max_relay_log_size;
+
+
+#####################################################################
+# END OF max_relay_log_size TESTS #
+#####################################################################
+
diff --git a/mysql-test/suite/sys_vars/t/max_seeks_for_key_basic.test b/mysql-test/suite/sys_vars/t/max_seeks_for_key_basic.test
new file mode 100644
index 00000000..08aff370
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/max_seeks_for_key_basic.test
@@ -0,0 +1,212 @@
+############## mysql-test\t\max_seeks_for_key_basic.test ###############
+# #
+# Variable Name: max_seeks_for_key #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 4294967295 #
+# Range: 1-4294967295 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable max_seeks_for_key #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+#################################################################
+# START OF max_seeks_for_key TESTS #
+#################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.max_seeks_for_key;
+SELECT @start_global_value;
+SET @start_session_value = @@session.max_seeks_for_key;
+SELECT @start_session_value;
+
+
+--echo '#--------------------FN_DYNVARS_083_01-------------------------#'
+#################################################################
+# Display the DEFAULT value of max_seeks_for_key #
+#################################################################
+
+SET @@global.max_seeks_for_key = 100;
+SET @@global.max_seeks_for_key = DEFAULT;
+SELECT @@global.max_seeks_for_key;
+
+SET @@session.max_seeks_for_key = 200;
+SET @@session.max_seeks_for_key = DEFAULT;
+SELECT @@session.max_seeks_for_key;
+
+
+--echo '#--------------------FN_DYNVARS_083_02-------------------------#'
+#################################################################
+# Check the DEFAULT value of max_seeks_for_key #
+#################################################################
+
+SET @@global.max_seeks_for_key = DEFAULT;
+SELECT @@global.max_seeks_for_key = 4294967295;
+
+SET @@session.max_seeks_for_key = DEFAULT;
+SELECT @@session.max_seeks_for_key = 4294967295;
+
+
+--echo '#--------------------FN_DYNVARS_083_03-------------------------#'
+###########################################################################
+# Change the value of max_seeks_for_key to a valid value for GLOBAL Scope #
+###########################################################################
+
+SET @@global.max_seeks_for_key = 1;
+SELECT @@global.max_seeks_for_key;
+SET @@global.max_seeks_for_key = 2;
+SELECT @@global.max_seeks_for_key;
+SET @@global.max_seeks_for_key = 65536;
+SELECT @@global.max_seeks_for_key;
+SET @@global.max_seeks_for_key = 4294967295;
+SELECT @@global.max_seeks_for_key;
+SET @@global.max_seeks_for_key = 4294967294;
+SELECT @@global.max_seeks_for_key;
+
+
+--echo '#--------------------FN_DYNVARS_083_04-------------------------#'
+############################################################################
+# Change the value of max_seeks_for_key to a valid value for SESSION Scope #
+############################################################################
+SET @@session.max_seeks_for_key = 1;
+SELECT @@session.max_seeks_for_key;
+SET @@session.max_seeks_for_key = 2;
+SELECT @@session.max_seeks_for_key;
+SET @@session.max_seeks_for_key = 4294967295;
+SELECT @@session.max_seeks_for_key;
+SET @@session.max_seeks_for_key = 4294967294;
+SELECT @@session.max_seeks_for_key;
+SET @@session.max_seeks_for_key = 65535;
+SELECT @@session.max_seeks_for_key;
+
+
+--echo '#------------------FN_DYNVARS_083_05-----------------------#'
+#############################################################
+# Change the value of max_seeks_for_key to an invalid value #
+#############################################################
+
+SET @@global.max_seeks_for_key = 0;
+SELECT @@global.max_seeks_for_key;
+SET @@global.max_seeks_for_key = -1024;
+SELECT @@global.max_seeks_for_key;
+SET @@global.max_seeks_for_key = 4294967296;
+SELECT @@global.max_seeks_for_key;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_seeks_for_key = 65530.34;
+SELECT @@global.max_seeks_for_key;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_seeks_for_key = test;
+SELECT @@global.max_seeks_for_key;
+
+SET @@session.max_seeks_for_key = 0;
+SELECT @@session.max_seeks_for_key;
+SET @@session.max_seeks_for_key = -2;
+SELECT @@session.max_seeks_for_key;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.max_seeks_for_key = 65530.34;
+SET @@session.max_seeks_for_key = 4294967296;
+SELECT @@session.max_seeks_for_key;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.max_seeks_for_key = test;
+SELECT @@session.max_seeks_for_key;
+
+
+--echo '#------------------FN_DYNVARS_083_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT @@global.max_seeks_for_key = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='max_seeks_for_key';
+
+--echo '#------------------FN_DYNVARS_083_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.max_seeks_for_key = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='max_seeks_for_key';
+
+
+--echo '#------------------FN_DYNVARS_083_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.max_seeks_for_key = TRUE;
+SELECT @@global.max_seeks_for_key;
+SET @@global.max_seeks_for_key = FALSE;
+SELECT @@global.max_seeks_for_key;
+
+
+--echo '#---------------------FN_DYNVARS_083_09----------------------#'
+#################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+#################################################################################
+
+SET @@global.max_seeks_for_key = 10;
+SELECT @@max_seeks_for_key = @@global.max_seeks_for_key;
+
+
+--echo '#---------------------FN_DYNVARS_083_10----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@max_seeks_for_key = 100;
+SELECT @@max_seeks_for_key = @@local.max_seeks_for_key;
+SELECT @@local.max_seeks_for_key = @@session.max_seeks_for_key;
+
+
+--echo '#---------------------FN_DYNVARS_083_11----------------------#'
+############################################################################
+# Check if max_seeks_for_key can be accessed with and without @@ sign #
+############################################################################
+
+SET max_seeks_for_key = 1;
+SELECT @@max_seeks_for_key;
+--Error ER_UNKNOWN_TABLE
+SELECT local.max_seeks_for_key;
+--Error ER_UNKNOWN_TABLE
+SELECT session.max_seeks_for_key;
+--Error ER_BAD_FIELD_ERROR
+SELECT max_seeks_for_key = @@session.max_seeks_for_key;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.max_seeks_for_key = @start_global_value;
+SELECT @@global.max_seeks_for_key;
+SET @@session.max_seeks_for_key = @start_session_value;
+SELECT @@session.max_seeks_for_key;
+
+
+#############################################################
+# END OF max_seeks_for_key TESTS #
+#############################################################
+
diff --git a/mysql-test/suite/sys_vars/t/max_seeks_for_key_func.test b/mysql-test/suite/sys_vars/t/max_seeks_for_key_func.test
new file mode 100644
index 00000000..0b850179
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/max_seeks_for_key_func.test
@@ -0,0 +1,101 @@
+# Test for max_seeks_for_key #
+
+--source include/default_optimizer_switch.inc
+set @@global.optimizer_switch=@@local.optimizer_switch;
+set @@global.join_cache_level=@@local.join_cache_level;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+
+#########################
+# Creating new table #
+#########################
+
+CREATE TABLE t1
+(a INT AUTO_INCREMENT PRIMARY KEY,
+b CHAR(20)
+);
+
+SET @start_value= @@global.max_seeks_for_key;
+
+--echo '#--------------------FN_DYNVARS_084_01-------------------------#'
+##########################################################
+# Test behavior of variable on new connection # 01 #
+##########################################################
+
+CONNECT (test_con1,localhost,root,,);
+CONNECTION test_con1;
+
+# Setting global value of variable and inserting data in table
+SET @@global.max_seeks_for_key = 20;
+SELECT @@global.max_seeks_for_key;
+INSERT INTO t1(b) VALUES("AREc");
+EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b;
+
+# Setting session value of variable and inserting data in table
+SET @@session.max_seeks_for_key = 2;
+SELECT @@session.max_seeks_for_key;
+INSERT INTO t1(b) VALUES("BREc");
+INSERT INTO t1(b) VALUES("CRec");
+EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b;
+
+
+--echo '#--------------------FN_DYNVARS_084_02-------------------------#'
+##########################################################
+# Test behavior of variable on new connection # 02 #
+##########################################################
+
+
+CONNECT (test_con2,localhost,root,,);
+connection test_con2;
+
+
+# Value of session & global vairable here should be 10
+SELECT @@global.max_seeks_for_key = 10;
+SELECT @@session.max_seeks_for_key = 10;
+
+# Setting global value of variable and inserting data in table
+SET @@global.max_seeks_for_key = 20;
+SELECT @@global.max_seeks_for_key;
+INSERT INTO t1(b) VALUES("AREc");
+EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b;
+
+# Setting session value of variable and inserting data in table
+SET @@session.max_seeks_for_key = 2;
+SELECT @@session.max_seeks_for_key;
+INSERT INTO t1(b) VALUES("BREc");
+INSERT INTO t1(b) VALUES("CRec");
+EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b;
+
+######################################################
+# Inserting values in table t and analyzing table #
+######################################################
+
+INSERT INTO t1 VALUES(null,"test");
+INSERT INTO t1 VALUES (null,"a"),(null,"a"),(null,"a"),
+ (null,"a"),(null,"a"),(null,"a"),(null,"a"),
+ (null,"a"),(null,"a"),(null,"a");
+EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b;
+ANALYZE TABLE t1;
+
+###################################################################
+# Setting new value for max_seeks_for_key and anaylyzing table #
+###################################################################
+
+SET MAX_SEEKS_FOR_KEY=1;
+
+
+EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b;
+SET MAX_SEEKS_FOR_KEY=DEFAULT;
+
+connection default;
+disconnect test_con1;
+disconnect test_con2;
+
+DROP TABLE t1;
+
+SET @@global.max_seeks_for_key= @start_value;
+SET @@global.optimizer_switch= @save_optimizer_switch;
+SET @@global.join_cache_level=  @save_join_cache_level;
diff --git a/mysql-test/suite/sys_vars/t/max_sort_length_func.test b/mysql-test/suite/sys_vars/t/max_sort_length_func.test
new file mode 100644
index 00000000..d54453a5
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/max_sort_length_func.test
@@ -0,0 +1,209 @@
+############# mysql-test\t\max_sort_length_func.test ###########################
+# #
+# Variable Name: sql_warnings #
+# Scope: SESSION #
+# Access Type: Dynamic #
+# Data Type: NUMERIC #
+# Default Value: 1024 #
+# Values: 4-8388608 #
+# #
+# #
+# Creation Date: 2008-03-02 #
+# Author: Sharique Abdullah #
+# #
+# Description: Test Cases of Dynamic System Variable max_sort_length #
+# that checks behavior of this variable in the following ways #
+# * Functionality based on different values #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# #
+################################################################################
+
+#
+# Setup
+#
+
+SET @start_value= @@global.max_sort_length;
+
+#########################
+# Creating new table #
+#########################
+
+--echo ** creating tables **
+CREATE TABLE t (id INT AUTO_INCREMENT PRIMARY KEY, c TEXT);
+CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY, c BLOB);
+CREATE TABLE t2 (id INT AUTO_INCREMENT PRIMARY KEY, c TEXT);
+
+--echo '#--------------------FN_DYNVARS_098_01-------------------------#'
+##########################################################
+# Test behavior of variable on new connection # 01 #
+##########################################################
+
+connect (test_con1,localhost,root,,);
+
+# Setting global value of variable and inserting data in table
+--echo ** Setting value to 70 and inserting data **
+SET @@global.max_sort_length = 70;
+SELECT @@global.max_sort_length;
+INSERT INTO t set c = repeat('x',69);
+INSERT INTO t set c = concat(repeat('x',68),'r','x');
+INSERT INTO t set c = concat(repeat('x',68),'s','y');
+INSERT INTO t set c = concat(repeat('x',68),'g','w');
+SELECT c from t ORDER BY c, id;
+--echo ** Results should be sorted **
+
+# Setting session value of variable and inserting data in table
+SET @@session.max_sort_length = 69;
+SELECT @@session.max_sort_length;
+INSERT INTO t set c = repeat('x',69);
+INSERT INTO t set c = concat(repeat('x',68),'r','x');
+INSERT INTO t set c = concat(repeat('x',68),'s','y');
+INSERT INTO t set c = concat(repeat('x',68),'g','w');
+SELECT c from t ORDER BY c, id;
+--echo ** Results should be sorted **
+
+--echo '#--------------------FN_DYNVARS_098_02-------------------------#'
+##########################################################
+# Test behavior of variable on new connection # 02 #
+##########################################################
+
+connect (test_con2,localhost,root,,);
+
+## Setting global value of variable and inserting data in table
+SET @@global.max_sort_length = 70;
+SELECT @@global.max_sort_length;
+INSERT INTO t set c = repeat('x',69);
+INSERT INTO t set c = concat(repeat('x',68),'r','x');
+INSERT INTO t set c = concat(repeat('x',68),'s','y');
+INSERT INTO t set c = concat(repeat('x',68),'g','w');
+SELECT c from t ORDER BY c, id;
+
+--echo ** Results should be sorted **
+
+# Setting session value of variable and inserting data in table
+SET @@session.max_sort_length = 64;
+SELECT @@session.max_sort_length;
+INSERT INTO t set c = repeat('x',69);
+INSERT INTO t set c = concat(repeat('x',68),'r','x');
+INSERT INTO t set c = concat(repeat('x',68),'s','y');
+INSERT INTO t set c = concat(repeat('x',68),'g','w');
+SELECT c from t ORDER BY c, id;
+
+--echo ** Results should not be sorted **
+
+--echo '#--------------------FN_DYNVARS_098_03-------------------------#'
+#########################################################
+#Check if sorting is applied with the max_sort_length=64#
+#########################################################
+
+###########################################
+# Setting new value for max_sort_length #
+###########################################
+
+SET max_sort_length=64;
+
+###################################
+# Inserting values in table t #
+###################################
+
+INSERT INTO t set c = repeat('x',69);
+INSERT INTO t set c = concat(repeat('x',68),'r','x');
+INSERT INTO t set c = concat(repeat('x',68),'s','y');
+INSERT INTO t set c = concat(repeat('x',68),'g','w');
+
+SELECT c from t ORDER BY c, id;
+--echo ** Results should not be sorted **
+
+RESET QUERY CACHE;
+
+--echo '#--------------------FN_DYNVARS_098_04-------------------------#'
+#########################################################
+#Check if sorting is applied with the max_sort_length=69#
+#########################################################
+
+SET max_sort_length=69;
+SELECT c from t ORDER BY c, id;
+--echo ** Results should be sorted **
+
+--echo '#--------------------FN_DYNVARS_098_05-------------------------#'
+#########################################################
+#Check if sorting is applied with the max_sort_length=70#
+#########################################################
+
+SET max_sort_length=70;
+SELECT c from t ORDER BY c, id;
+--echo ** Results should be sorted **
+
+--echo '#--------------------FN_DYNVARS_098_06-------------------------#'
+##############################################################
+#Check if sorting is applied with the max_sort_length=Default#
+##############################################################
+
+SET max_sort_length=default;
+SELECT @@max_sort_length;
+SELECT c from t ORDER BY c, id;
+--echo ** Results should be sorted **
+
+--echo '#--------------------FN_DYNVARS_098_07-------------------------#'
+###########################################
+#Check if sorting is applied on BLOB type #
+###########################################
+--echo Testing type BLOB
+# Setting global value of variable and inserting data in table
+SET @@max_sort_length = 70;
+SELECT @@max_sort_length;
+INSERT INTO t1 set c = repeat('x',69);
+INSERT INTO t1 set c = concat(repeat('x',68),'r','x');
+INSERT INTO t1 set c = concat(repeat('x',68),'s','y');
+INSERT INTO t1 set c = concat(repeat('x',68),'g','w');
+SELECT c from t1 ORDER BY c, id DESC;
+--echo ** Results should be sorted **
+
+# Setting session value of variable and inserting data in table
+SET @@session.max_sort_length = 64;
+SELECT @@session.max_sort_length;
+INSERT INTO t1 set c = repeat('x',69);
+INSERT INTO t1 set c = concat(repeat('x',68),'r','x');
+INSERT INTO t1 set c = concat(repeat('x',68),'s','y');
+INSERT INTO t1 set c = concat(repeat('x',68),'g','w');
+SELECT c from t1 ORDER BY c, id;
+--echo ** Results should not be sorted **
+
+--echo '#--------------------FN_DYNVARS_098_08-------------------------#'
+###########################################
+#Check if sorting is applied on CHAR type #
+###########################################
+--echo Testing type CHAR
+# Setting global value of variable and inserting data in table
+SET @@global.max_sort_length = 70;
+SELECT @@global.max_sort_length;
+INSERT INTO t2 set c = repeat('x',69);
+INSERT INTO t2 set c = concat(repeat('x',68),'r','x');
+INSERT INTO t2 set c = concat(repeat('x',68),'s','y');
+INSERT INTO t2 set c = concat(repeat('x',68),'g','w');
+SELECT c from t2 ORDER BY c, id;
+--echo ** Results should not be sorted **
+
+# Setting session value of variable and inserting data in table
+SET @@session.max_sort_length = 64;
+SELECT @@session.max_sort_length;
+INSERT INTO t2 set c = repeat('x',69);
+INSERT INTO t2 set c = concat(repeat('x',68),'r','x');
+INSERT INTO t2 set c = concat(repeat('x',68),'s','y');
+INSERT INTO t2 set c = concat(repeat('x',68),'g','w');
+SELECT c from t2 ORDER BY c, id;
+--echo ** Results should not be sorted **
+
+#
+# Cleanup
+#
+
+connection default;
+
+disconnect test_con1;
+disconnect test_con2;
+
+DROP TABLE t, t1, t2;
+
+SET @@global.max_sort_length= @start_value;
diff --git a/mysql-test/suite/sys_vars/t/max_sp_recursion_depth_basic.test b/mysql-test/suite/sys_vars/t/max_sp_recursion_depth_basic.test
new file mode 100644
index 00000000..1d3d6954
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/max_sp_recursion_depth_basic.test
@@ -0,0 +1,225 @@
+############## mysql-test\t\max_sp_recursion_depth_basic.test ###############
+# #
+# Variable Name: max_sp_recursion_depth #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value:0 #
+# Max value:255 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable max_sp_recursion_depth #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+
+############################################
+# START OF max_sp_recursion_depth TESTS #
+############################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.max_sp_recursion_depth;
+SELECT @start_global_value;
+SET @start_session_value = @@session.max_sp_recursion_depth;
+SELECT @start_session_value;
+
+
+--echo '#--------------------FN_DYNVARS_085_01-------------------------#'
+##############################################################
+# Display the DEFAULT value of max_sp_recursion_depth #
+##############################################################
+
+SET @@global.max_sp_recursion_depth = 1000;
+SET @@global.max_sp_recursion_depth = DEFAULT;
+SELECT @@global.max_sp_recursion_depth;
+
+
+SET @@session.max_sp_recursion_depth = 1000;
+SET @@session.max_sp_recursion_depth = DEFAULT;
+SELECT @@session.max_sp_recursion_depth;
+
+
+--echo '#--------------------FN_DYNVARS_085_02-------------------------#'
+##############################################################
+# Check the DEFAULT value of max_sp_recursion_depth #
+##############################################################
+
+SET @@global.max_sp_recursion_depth = DEFAULT;
+SELECT @@global.max_sp_recursion_depth = 0;
+
+SET @@session.max_sp_recursion_depth = DEFAULT;
+SELECT @@session.max_sp_recursion_depth = 0;
+
+
+
+--echo '#--------------------FN_DYNVARS_085_03-------------------------#'
+#########################################################################
+# Change the value of max_sp_recursion_depth to a valid value for GLOBAL Scope #
+#########################################################################
+
+SET @@global.max_sp_recursion_depth = 0;
+SELECT @@global.max_sp_recursion_depth;
+SET @@global.max_sp_recursion_depth = 1;
+SELECT @@global.max_sp_recursion_depth;
+SET @@global.max_sp_recursion_depth = 254;
+SELECT @@global.max_sp_recursion_depth;
+SET @@global.max_sp_recursion_depth = 255;
+SELECT @@global.max_sp_recursion_depth;
+SET @@global.max_sp_recursion_depth = 150;
+SELECT @@global.max_sp_recursion_depth;
+
+--echo '#--------------------FN_DYNVARS_085_04-------------------------#'
+#################################################################################
+# Change the value of max_sp_recursion_depth to a valid value for SESSION Scope #
+#################################################################################
+
+SET @@session.max_sp_recursion_depth = 0;
+SELECT @@session.max_sp_recursion_depth;
+
+SET @@session.max_sp_recursion_depth = 1;
+SELECT @@session.max_sp_recursion_depth;
+
+SET @@session.max_sp_recursion_depth = 254;
+SELECT @@session.max_sp_recursion_depth;
+
+SET @@session.max_sp_recursion_depth = 255;
+SELECT @@session.max_sp_recursion_depth;
+
+SET @@session.max_sp_recursion_depth = 150;
+SELECT @@session.max_sp_recursion_depth;
+
+
+--echo '#------------------FN_DYNVARS_085_05-----------------------#'
+##################################################################
+# Change the value of max_sp_recursion_depth to an invalid value #
+##################################################################
+
+SET @@global.max_sp_recursion_depth = -1024;
+SELECT @@global.max_sp_recursion_depth;
+SET @@global.max_sp_recursion_depth = 256;
+SELECT @@global.max_sp_recursion_depth;
+SET @@global.max_sp_recursion_depth = -1;
+SELECT @@global.max_sp_recursion_depth;
+SET @@global.max_sp_recursion_depth = 3000;
+SELECT @@global.max_sp_recursion_depth;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_sp_recursion_depth = 65530.34;
+SELECT @@global.max_sp_recursion_depth;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_sp_recursion_depth = test;
+SELECT @@global.max_sp_recursion_depth;
+
+SET @@session.max_sp_recursion_depth = 256;
+SELECT @@session.max_sp_recursion_depth;
+SET @@session.max_sp_recursion_depth = -1;
+SELECT @@session.max_sp_recursion_depth;
+SET @@session.max_sp_recursion_depth = 500000;
+SELECT @@session.max_sp_recursion_depth;
+SET @@session.max_sp_recursion_depth = -001;
+SELECT @@session.max_sp_recursion_depth;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.max_sp_recursion_depth = 65530.34;
+SET @@session.max_sp_recursion_depth = 10737418241;
+SELECT @@session.max_sp_recursion_depth;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.max_sp_recursion_depth = test;
+SELECT @@session.max_sp_recursion_depth;
+
+
+--echo '#------------------FN_DYNVARS_085_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT @@global.max_sp_recursion_depth = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='max_sp_recursion_depth';
+
+--echo '#------------------FN_DYNVARS_085_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.max_sp_recursion_depth = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='max_sp_recursion_depth';
+
+
+--echo '#------------------FN_DYNVARS_085_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.max_sp_recursion_depth = TRUE;
+SELECT @@global.max_sp_recursion_depth;
+SET @@global.max_sp_recursion_depth = FALSE;
+SELECT @@global.max_sp_recursion_depth;
+
+
+--echo '#---------------------FN_DYNVARS_085_09----------------------#'
+#################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+#################################################################################
+
+SET @@global.max_sp_recursion_depth = 20;
+SELECT @@max_sp_recursion_depth = @@global.max_sp_recursion_depth;
+
+
+--echo '#---------------------FN_DYNVARS_085_10----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@max_sp_recursion_depth = 255;
+SELECT @@max_sp_recursion_depth = @@local.max_sp_recursion_depth;
+SELECT @@local.max_sp_recursion_depth = @@session.max_sp_recursion_depth;
+
+
+--echo '#---------------------FN_DYNVARS_085_11----------------------#'
+##########################################################################
+# Check if max_sp_recursion_depth can be accessed with and without @@ sign #
+##########################################################################
+
+
+SET max_sp_recursion_depth = 102;
+SELECT @@max_sp_recursion_depth;
+--Error ER_UNKNOWN_TABLE
+SELECT local.max_sp_recursion_depth;
+--Error ER_UNKNOWN_TABLE
+SELECT session.max_sp_recursion_depth;
+--Error ER_BAD_FIELD_ERROR
+SELECT max_sp_recursion_depth = @@session.max_sp_recursion_depth;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.max_sp_recursion_depth = @start_global_value;
+SELECT @@global.max_sp_recursion_depth;
+SET @@session.max_sp_recursion_depth = @start_session_value;
+SELECT @@session.max_sp_recursion_depth;
+
+
+####################################################
+# END OF max_sp_recursion_depth TESTS #
+####################################################
+
diff --git a/mysql-test/suite/sys_vars/t/max_sp_recursion_depth_func.test b/mysql-test/suite/sys_vars/t/max_sp_recursion_depth_func.test
new file mode 100644
index 00000000..9e034643
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/max_sp_recursion_depth_func.test
@@ -0,0 +1,176 @@
+############# mysql-test\t\max_sp_recursion_depth_func.test ###################
+# #
+# Variable Name: max_sp_recursion_depth #
+# Scope: SESSION #
+# Access Type: Dynamic #
+# Data Type: NUMERIC #
+# Default Value: 0 #
+# Max Value: 25 #
+# #
+# #
+# Creation Date: 2008-03-02 #
+# Author: Sharique Abdullah #
+# #
+# Description: Test Cases of Dynamic System Variable "max_sp_recursion_depth #
+# that checks behavior of this variable in the following ways #
+# * Functionality based on different values #
+# #
+#Reference:http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html#
+# option_mysqld_max_sp_recursion_depth #
+# #
+###############################################################################
+
+
+#
+# Setup
+#
+
+SET @session_max_recursion_depth = @@SESSION.max_sp_recursion_depth;
+
+
+--echo '#--------------------FN_DYNVARS_099_01-------------------------#'
+##########################################################
+# Test behavior of variable on new connection # 01 #
+##########################################################
+CONNECT (test_con1,localhost,root,,);
+CONNECTION test_con1;
+
+
+# Setting session value of variable
+SET @@session.max_sp_recursion_depth = 10;
+SELECT @@session.max_sp_recursion_depth;
+# create procedure to add rows
+
+--disable_warnings
+DROP PROCEDURE IF EXISTS sp_addRecords;
+--enable_warnings
+
+DELIMITER //;
+
+CREATE PROCEDURE sp_addRecords (IN var1 INT,IN var2 INT)
+BEGIN
+SELECT var1,var2;
+IF var1 < var2 THEN
+ CALL sp_addRecords(var1+1,var2);
+ SELECT var1,var2;
+END IF;
+END //
+
+DELIMITER ;//
+
+
+CALL sp_addRecords(0,8);
+
+--echo '#--------------------FN_DYNVARS_099_02-------------------------#'
+##########################################################
+# Test behavior of variable on new connection # 02 #
+##########################################################
+
+CONNECT (test_con2,localhost,root,,);
+connection test_con2;
+
+
+# Setting session value of variable and inserting data in table
+SET @@session.max_sp_recursion_depth = 4;
+SELECT @@session.max_sp_recursion_depth;
+# create procedure to add rows
+
+--disable_warnings
+DROP PROCEDURE IF EXISTS sp_addRecords1;
+--enable_warnings
+
+DELIMITER //;
+
+CREATE PROCEDURE sp_addRecords1 (IN var1 INT,IN var2 INT)
+BEGIN
+SELECT var1,var2;
+IF var1 < var2 THEN
+ CALL sp_addRecords1(var1+1,var2);
+ SELECT var1,var2;
+END IF;
+END //
+
+DELIMITER ;//
+
+
+CALL sp_addRecords1(0,4);
+
+
+
+
+--echo '#---------------------FN_DYNVARS_99_03----------------------#'
+####################################################################
+# Check if max_sp_recursion_depth value is set to 10 #
+####################################################################
+SET @@max_sp_recursion_depth = 10;
+# create procedure to add rows
+
+--disable_warnings
+DROP PROCEDURE IF EXISTS sp_addRecords2;
+--enable_warnings
+
+DELIMITER //;
+
+CREATE PROCEDURE sp_addRecords2(IN var1 INT,IN var2 INT)
+BEGIN
+SELECT var1,var2;
+IF var1 < var2 THEN
+ CALL sp_addRecords2(var1+1,var2);
+ SELECT var1,var2;
+END IF;
+END //
+
+DELIMITER ;//
+
+
+CALL sp_addRecords2(0,8);
+
+
+--echo '#---------------------FN_DYNVARS_99_04----------------------#'
+###############################################################################
+#Check if max_sp_recursion_depth value is set lower then called recursion value
+###############################################################################
+
+
+SET @@max_sp_recursion_depth = 4;
+# create procedure to add rows
+#DROP PROCEDURE IF EXISTS sp_addRecords1;
+
+--disable_warnings
+DROP PROCEDURE IF EXISTS sp_addRecords3;
+--enable_warnings
+
+DELIMITER //;
+
+CREATE PROCEDURE sp_addRecords3 (IN var1 INT,IN var2 INT)
+BEGIN
+SELECT var1,var2;
+IF var1 < var2 THEN
+ CALL sp_addRecords3(var1+1,var2);
+ SELECT var1,var2;
+END IF;
+END //
+
+DELIMITER ;//
+
+--echo Expected error 'SP Recursion limit'
+--ERROR ER_SP_RECURSION_LIMIT
+CALL sp_addRecords3(0,8);
+
+#
+# Cleanup
+#
+
+connection default;
+
+disconnect test_con1;
+disconnect test_con2;
+
+--disable_warnings
+DROP PROCEDURE IF EXISTS sp_addRecords;
+DROP PROCEDURE IF EXISTS sp_addRecords1;
+DROP PROCEDURE IF EXISTS sp_addRecords2;
+DROP PROCEDURE IF EXISTS sp_addRecords3;
+--enable_warnings
+
+SET @@SESSION.max_sp_recursion_depth = @session_max_recursion_depth;
diff --git a/mysql-test/suite/sys_vars/t/max_statement_time_basic.test b/mysql-test/suite/sys_vars/t/max_statement_time_basic.test
new file mode 100644
index 00000000..186589dc
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/max_statement_time_basic.test
@@ -0,0 +1,217 @@
+####################### mysql-test\t\max_statement_time_basic.test ###############
+# #
+# Variable Name: max_statement_time #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value:10 #
+# Min Value: 1 #
+# #
+# #
+# Creation Date: 2012-12-30 #
+# Author: Monty #
+# #
+# Description: Test Cases of Dynamic System Variable max_statement_time #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: https://kb.askmonty.org/en/how-to-limittimeout-queries/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+############################################################
+# START OF max_statement_time TESTS #
+############################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.max_statement_time;
+SELECT @start_global_value;
+SET @start_session_value = @@session.max_statement_time;
+SELECT @start_session_value;
+
+
+--echo '#--------------------FN_DYNVARS_068_01-------------------------#'
+###############################################################
+# Display the DEFAULT value of max_statement_time #
+###############################################################
+
+SET @@global.max_statement_time = 100;
+SET @@global.max_statement_time = DEFAULT;
+SELECT @@global.max_statement_time;
+
+SET @@session.max_statement_time = 200;
+SET @@session.max_statement_time = DEFAULT;
+SELECT @@session.max_statement_time;
+
+
+--echo '#--------------------FN_DYNVARS_068_02-------------------------#'
+###############################################################
+# Check the DEFAULT value of max_statement_time #
+###############################################################
+
+SET @@global.max_statement_time = DEFAULT;
+SELECT @@global.max_statement_time = 0;
+
+SET @@session.max_statement_time = DEFAULT;
+SELECT @@session.max_statement_time = 0;
+
+
+--echo '#--------------------FN_DYNVARS_068_03-------------------------#'
+#########################################################################
+# Change the value of max_statement_time to a valid value for GLOBAL Scope #
+#########################################################################
+
+SET @@global.max_statement_time = 0;
+SELECT @@global.max_statement_time;
+SET @@global.max_statement_time = 0.123456;
+SELECT @@global.max_statement_time;
+SET @@global.max_statement_time = 60020;
+SELECT @@global.max_statement_time;
+SET @@global.max_statement_time = 31536000;
+SELECT @@global.max_statement_time;
+SET @@global.max_statement_time = 65536;
+SELECT @@global.max_statement_time;
+
+
+--echo '#--------------------FN_DYNVARS_068_04-------------------------#'
+##########################################################################
+# Change the value of max_statement_time to a valid value for SESSION Scope #
+##########################################################################
+
+SET @@session.max_statement_time = 0;
+SELECT @@session.max_statement_time;
+SET @@session.max_statement_time = 1;
+SELECT @@session.max_statement_time;
+SET @@session.max_statement_time = 50050;
+SELECT @@session.max_statement_time;
+SET @@session.max_statement_time = 31536000;
+SELECT @@session.max_statement_time;
+SET @@session.max_statement_time = 65550;
+SELECT @@session.max_statement_time;
+
+
+--echo '#------------------FN_DYNVARS_068_05-----------------------#'
+########################################################
+# Change the value of max_statement_time to an invalid value #
+########################################################
+
+SET @@global.max_statement_time = 100000000000;
+SELECT @@global.max_statement_time;
+SET @@global.max_statement_time = -1;
+SELECT @@global.max_statement_time;
+SET @@global.max_statement_time = 65530.34;
+SELECT @@global.max_statement_time;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_statement_time = test;
+SELECT @@global.max_statement_time;
+
+SET @@session.max_statement_time = 100000000000;
+SELECT @@session.max_statement_time;
+SET @@session.max_statement_time = -2;
+SELECT @@session.max_statement_time;
+SET @@session.max_statement_time = 65530.34;
+SELECT @@session.max_statement_time;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.max_statement_time = test;
+SELECT @@session.max_statement_time;
+
+
+--echo '#------------------FN_DYNVARS_068_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT @@global.max_statement_time = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='max_statement_time';
+
+--echo '#------------------FN_DYNVARS_068_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.max_statement_time = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='max_statement_time';
+
+
+--echo '#------------------FN_DYNVARS_068_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.max_statement_time = TRUE;
+SELECT @@global.max_statement_time;
+SET @@global.max_statement_time = FALSE;
+SELECT @@global.max_statement_time;
+
+
+--echo '#---------------------FN_DYNVARS_001_09----------------------#'
+#################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+#################################################################################
+
+SET @@global.max_statement_time = 10;
+SELECT @@max_statement_time = @@global.max_statement_time;
+
+
+--echo '#---------------------FN_DYNVARS_001_10----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@max_statement_time = 100;
+SELECT @@max_statement_time = @@local.max_statement_time;
+SELECT @@local.max_statement_time = @@session.max_statement_time;
+
+
+--echo '#---------------------FN_DYNVARS_001_11----------------------#'
+##########################################################################
+# Check if max_statement_time can be accessed with and without @@ sign #
+##########################################################################
+
+SET max_statement_time = 1;
+SELECT @@max_statement_time;
+--Error ER_UNKNOWN_TABLE
+SELECT local.max_statement_time;
+--Error ER_UNKNOWN_TABLE
+SELECT session.max_statement_time;
+--Error ER_BAD_FIELD_ERROR
+SELECT max_statement_time = @@session.max_statement_time;
+
+--echo #
+--echo # Check that one can use max_statement_time as a field
+--echo #
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+create table t1 (a int, max_statement_time int);
+drop table t1;
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.max_statement_time = @start_global_value;
+SELECT @@global.max_statement_time;
+SET @@session.max_statement_time = @start_session_value;
+SELECT @@session.max_statement_time;
+
+
+####################################################
+# END OF max_statement_time TESTS #
+####################################################
+
diff --git a/mysql-test/suite/sys_vars/t/max_tmp_tables_basic.test b/mysql-test/suite/sys_vars/t/max_tmp_tables_basic.test
new file mode 100644
index 00000000..236c5983
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/max_tmp_tables_basic.test
@@ -0,0 +1,227 @@
+############## mysql-test\t\max_tmp_tables_basic.test ###############
+# #
+# Variable Name: max_tmp_tables #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 32 #
+# Range: 1-4294967295 #
+# #
+# #
+# #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable max_tmp_tables #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+####################################
+# START OF max_tmp_tables TESTS #
+####################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.max_tmp_tables;
+SELECT @start_global_value;
+SET @start_session_value = @@session.max_tmp_tables;
+SELECT @start_session_value;
+
+
+--echo '#--------------------FN_DYNVARS_086_01-------------------------#'
+######################################################
+# Display the DEFAULT value of max_tmp_tables #
+######################################################
+
+SET @@global.max_tmp_tables = 1000;
+SET @@global.max_tmp_tables = DEFAULT;
+SELECT @@global.max_tmp_tables;
+
+
+SET @@session.max_tmp_tables = 1000;
+SET @@session.max_tmp_tables = DEFAULT;
+SELECT @@session.max_tmp_tables;
+
+
+--echo '#--------------------FN_DYNVARS_086_02-------------------------#'
+######################################################
+# Check the DEFAULT value of max_tmp_tables #
+######################################################
+
+SET @@global.max_tmp_tables = DEFAULT;
+SELECT @@global.max_tmp_tables = 32;
+
+SET @@session.max_tmp_tables = DEFAULT;
+SELECT @@session.max_tmp_tables = 32;
+
+
+
+--echo '#--------------------FN_DYNVARS_086_03-------------------------#'
+########################################################################
+# Change the value of max_tmp_tables to a valid value for GLOBAL Scope #
+########################################################################
+
+SET @@global.max_tmp_tables = 1;
+SELECT @@global.max_tmp_tables;
+SET @@global.max_tmp_tables = 2;
+SELECT @@global.max_tmp_tables;
+SET @@global.max_tmp_tables = 65536;
+SELECT @@global.max_tmp_tables;
+SET @@global.max_tmp_tables = 4294967295;
+SELECT @@global.max_tmp_tables;
+SET @@global.max_tmp_tables = 4294967294;
+SELECT @@global.max_tmp_tables;
+
+--echo '#--------------------FN_DYNVARS_086_04-------------------------#'
+#########################################################################
+# Change the value of max_tmp_tables to a valid value for SESSION Scope #
+#########################################################################
+
+SET @@session.max_tmp_tables = 1;
+SELECT @@session.max_tmp_tables;
+
+SET @@session.max_tmp_tables = 2;
+SELECT @@session.max_tmp_tables;
+
+SET @@session.max_tmp_tables = 65536;
+SELECT @@session.max_tmp_tables;
+
+SET @@session.max_tmp_tables = 4294967295;
+SELECT @@session.max_tmp_tables;
+
+SET @@session.max_tmp_tables = 4294967294;
+SELECT @@session.max_tmp_tables;
+
+
+--echo '#------------------FN_DYNVARS_086_05-----------------------#'
+##########################################################
+# Change the value of max_tmp_tables to an invalid value #
+##########################################################
+
+SET @@global.max_tmp_tables = -1024;
+SELECT @@global.max_tmp_tables;
+SET @@global.max_tmp_tables = 4294967296;
+SELECT @@global.max_tmp_tables;
+SET @@global.max_tmp_tables = -1;
+SELECT @@global.max_tmp_tables;
+SET @@global.max_tmp_tables = 429496729500;
+SELECT @@global.max_tmp_tables;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_tmp_tables = 65530.34;
+SELECT @@global.max_tmp_tables;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_tmp_tables = test;
+SELECT @@global.max_tmp_tables;
+
+SET @@session.max_tmp_tables = 4294967296;
+SELECT @@session.max_tmp_tables;
+SET @@session.max_tmp_tables = -1;
+SELECT @@session.max_tmp_tables;
+SET @@session.max_tmp_tables = 429496729500;
+SELECT @@session.max_tmp_tables;
+SET @@session.max_tmp_tables = -001;
+SELECT @@session.max_tmp_tables;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.max_tmp_tables = 65530.34;
+SET @@session.max_tmp_tables = 10737418241;
+SELECT @@session.max_tmp_tables;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.max_tmp_tables = test;
+SELECT @@session.max_tmp_tables;
+
+
+--echo '#------------------FN_DYNVARS_086_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT @@global.max_tmp_tables = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='max_tmp_tables';
+
+--echo '#------------------FN_DYNVARS_086_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.max_tmp_tables = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='max_tmp_tables';
+
+
+--echo '#------------------FN_DYNVARS_086_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.max_tmp_tables = TRUE;
+SELECT @@global.max_tmp_tables;
+SET @@global.max_tmp_tables = FALSE;
+SELECT @@global.max_tmp_tables;
+
+
+--echo '#---------------------FN_DYNVARS_086_09----------------------#'
+#################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+#################################################################################
+
+SET @@global.max_tmp_tables = 20;
+SELECT @@max_tmp_tables = @@global.max_tmp_tables;
+
+
+--echo '#---------------------FN_DYNVARS_086_10----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@max_tmp_tables = 255;
+SELECT @@max_tmp_tables = @@local.max_tmp_tables;
+SELECT @@local.max_tmp_tables = @@session.max_tmp_tables;
+
+
+--echo '#---------------------FN_DYNVARS_086_11----------------------#'
+#########################################################################
+# Check if max_tmp_tables can be accessed with and without @@ sign #
+#########################################################################
+
+
+SET max_tmp_tables = 102;
+SELECT @@max_tmp_tables;
+--Error ER_UNKNOWN_TABLE
+SELECT local.max_tmp_tables;
+--Error ER_UNKNOWN_TABLE
+SELECT session.max_tmp_tables;
+--Error ER_BAD_FIELD_ERROR
+SELECT max_tmp_tables = @@session.max_tmp_tables;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.max_tmp_tables = @start_global_value;
+SELECT @@global.max_tmp_tables;
+SET @@session.max_tmp_tables = @start_session_value;
+SELECT @@session.max_tmp_tables;
+
+
+###################################################
+# END OF max_tmp_tables TESTS #
+###################################################
+
diff --git a/mysql-test/suite/sys_vars/t/max_user_connections-2.test b/mysql-test/suite/sys_vars/t/max_user_connections-2.test
new file mode 100644
index 00000000..a376c78a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/max_user_connections-2.test
@@ -0,0 +1,11 @@
+#
+# Test behavior of various per-account limits (aka quotas)
+#
+--source include/not_embedded.inc
+
+#
+# We will get an error as it was set to 0 at startup
+#
+--error ER_OPTION_PREVENTS_STATEMENT
+set global max_user_connections=100;
+
diff --git a/mysql-test/suite/sys_vars/t/max_user_connections_basic-master.opt b/mysql-test/suite/sys_vars/t/max_user_connections_basic-master.opt
new file mode 100644
index 00000000..f507cd04
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/max_user_connections_basic-master.opt
@@ -0,0 +1 @@
+--max-user-connections=10
diff --git a/mysql-test/suite/sys_vars/t/max_user_connections_basic.test b/mysql-test/suite/sys_vars/t/max_user_connections_basic.test
new file mode 100644
index 00000000..8c9d0310
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/max_user_connections_basic.test
@@ -0,0 +1,167 @@
+############## mysql-test\t\max_user_connections_basic.test ###############
+# #
+# Variable Name: max_user_connections #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: - #
+# Range: 1-4294967295 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable max_user_connections #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+####################################
+# START OF max_user_connections TESTS #
+####################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.max_user_connections;
+SELECT @start_global_value;
+SET @start_session_value = @@session.max_user_connections;
+SELECT @start_session_value;
+
+
+--echo '#--------------------FN_DYNVARS_087_01-------------------------#'
+######################################################
+# Display the DEFAULT value of max_user_connections #
+######################################################
+
+SET @@global.max_user_connections = 1000;
+SET @@global.max_user_connections = DEFAULT;
+SELECT @@global.max_user_connections;
+
+--Error ER_VARIABLE_IS_READONLY
+SET @@session.max_user_connections = 1000;
+
+
+--echo '#--------------------FN_DYNVARS_087_02-------------------------#'
+######################################################
+# Check the DEFAULT value of max_user_connections #
+######################################################
+
+SET @@global.max_user_connections = DEFAULT;
+SELECT @@global.max_user_connections = 0;
+
+--Error ER_VARIABLE_IS_READONLY
+SET @@session.max_user_connections = DEFAULT;
+SELECT @@session.max_user_connections;
+
+
+--echo '#--------------------FN_DYNVARS_087_03-------------------------#'
+########################################################################
+# Change the value of max_user_connections to a valid value for GLOBAL Scope #
+########################################################################
+
+SET @@global.max_user_connections = 1;
+SELECT @@global.max_user_connections;
+SET @@global.max_user_connections = 2;
+SELECT @@global.max_user_connections;
+SET @@global.max_user_connections = 65536;
+SELECT @@global.max_user_connections;
+SET @@global.max_user_connections = 2147483647;
+SELECT @@global.max_user_connections;
+SET @@global.max_user_connections = 2147483646;
+SELECT @@global.max_user_connections;
+
+
+
+--echo '#------------------FN_DYNVARS_087_05-----------------------#'
+##########################################################
+# Change the value of max_user_connections to an invalid value #
+##########################################################
+
+SET @@global.max_user_connections = -1024;
+SELECT @@global.max_user_connections;
+SET @@global.max_user_connections = 4294967296;
+SELECT @@global.max_user_connections;
+SET @@global.max_user_connections = -1;
+SELECT @@global.max_user_connections;
+SET @@global.max_user_connections = 429496729500;
+SELECT @@global.max_user_connections;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_user_connections = 65530.34;
+SELECT @@global.max_user_connections;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_user_connections = test;
+SELECT @@global.max_user_connections;
+
+
+
+--echo '#------------------FN_DYNVARS_087_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT @@global.max_user_connections = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='max_user_connections';
+
+
+--echo '#------------------FN_DYNVARS_087_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.max_user_connections = TRUE;
+SELECT @@global.max_user_connections;
+SET @@global.max_user_connections = FALSE;
+SELECT @@global.max_user_connections;
+
+
+--echo '#---------------------FN_DYNVARS_087_09----------------------#'
+#################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+#################################################################################
+
+SET @@global.max_user_connections = 20;
+SELECT @@max_user_connections = @@global.max_user_connections;
+
+
+--echo '#---------------------FN_DYNVARS_087_11----------------------#'
+#########################################################################
+# Check if max_user_connections can be accessed with and without @@ sign #
+#########################################################################
+
+
+SET @@global.max_user_connections = 102;
+SELECT @@max_user_connections;
+--Error ER_UNKNOWN_TABLE
+SELECT local.max_user_connections;
+--Error ER_UNKNOWN_TABLE
+SELECT session.max_user_connections;
+--Error ER_BAD_FIELD_ERROR
+SELECT max_user_connections = @@session.max_user_connections;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.max_user_connections = @start_global_value;
+SELECT @@global.max_user_connections;
+
+
+###################################################
+# END OF max_user_connections TESTS #
+###################################################
+
diff --git a/mysql-test/suite/sys_vars/t/max_user_connections_func-master.opt b/mysql-test/suite/sys_vars/t/max_user_connections_func-master.opt
new file mode 100644
index 00000000..f507cd04
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/max_user_connections_func-master.opt
@@ -0,0 +1 @@
+--max-user-connections=10
diff --git a/mysql-test/suite/sys_vars/t/max_user_connections_func.test b/mysql-test/suite/sys_vars/t/max_user_connections_func.test
new file mode 100644
index 00000000..71d4be18
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/max_user_connections_func.test
@@ -0,0 +1,89 @@
+############# mysql-test\t\max_user_connections_func.test ####################
+# #
+# Variable Name: max_user_connections #
+# Scope: SESSION #
+# Access Type: Dynamic #
+# Data Type: NUMERIC #
+# Default Value: - #
+# Values: 1-4294967295 #
+# #
+# #
+# Creation Date: 2008-03-02 #
+# Author: Sharique Abdullah #
+# #
+# Description: Test Cases of Dynamic System Variable "max_user_connections #
+# that checks behavior of this variable in the following ways #
+# * Functionality based on different values #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# option_mysqld_max_user_connections #
+# #
+# Modified: 2008-07-10 HHUNGER: Inserted wait condition #
+# #
+##############################################################################
+
+--echo ** Setup **
+--echo
+#
+# Setup
+#
+
+--source include/not_embedded.inc
+
+SET @default_max_user_connections = @@global.max_user_connections;
+
+###################################
+#Setting value max_user_connection#
+###################################
+
+Set Global max_user_connections=2;
+
+CREATE USER test@localhost;
+GRANT USAGE on *.* TO test@localhost;
+
+--echo '#--------------------FN_DYNVARS_114_01-------------------------#'
+########################################
+#Should not make more then 2 connection#
+########################################
+
+CONNECT (conn1,localhost,test,,);
+
+CONNECT (conn2,localhost,test,,);
+
+--disable_query_log
+--Error ER_TOO_MANY_USER_CONNECTIONS
+CONNECT (conn3,localhost,test,,);
+--enable_query_log
+--echo Expected error "too many connections"
+
+DISCONNECT conn1;
+
+--echo ** Poll till disconnected conn1 disappears from processlist
+let $wait_condition= SELECT count(id) <= 2
+ FROM information_schema.processlist WHERE user = 'test';
+--source include/wait_condition.inc
+
+--echo '#--------------------FN_DYNVARS_114_02-------------------------#'
+#####################################################
+#Set value to 3 and see if 3 connections can be made#
+#####################################################
+
+connection default;
+Set Global max_user_connections=3;
+CONNECT (conn5,localhost,test,,);
+CONNECT (conn6,localhost,test,,);
+
+#
+# Cleanup
+#
+
+CONNECTION default;
+
+DISCONNECT conn2;
+DISCONNECT conn5;
+DISCONNECT conn6;
+
+drop user test@localhost;
+
+SET @@global.max_user_connections = @default_max_user_connections;
diff --git a/mysql-test/suite/sys_vars/t/max_write_lock_count_basic.test b/mysql-test/suite/sys_vars/t/max_write_lock_count_basic.test
new file mode 100644
index 00000000..4e92a305
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/max_write_lock_count_basic.test
@@ -0,0 +1,158 @@
+############## mysql-test\t\max_write_lock_count_basic.test ###############
+# #
+# Variable Name: max_write_lock_count #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 4294967295 #
+# Range:1-4294967295 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable max_write_lock_count #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+##########################################
+# START OF max_write_lock_count TESTS #
+##########################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.max_write_lock_count;
+SELECT @start_global_value;
+
+
+--echo '#--------------------FN_DYNVARS_088_01-------------------------#'
+############################################################
+# Display the DEFAULT value of max_write_lock_count #
+############################################################
+
+SET @@global.max_write_lock_count = 1000;
+SET @@global.max_write_lock_count = DEFAULT;
+SELECT @@global.max_write_lock_count;
+
+
+--echo '#--------------------FN_DYNVARS_088_02-------------------------#'
+############################################################
+# Check the DEFAULT value of max_write_lock_count #
+############################################################
+
+SET @@global.max_write_lock_count = DEFAULT;
+SELECT @@global.max_write_lock_count = 4294967295;
+
+
+--echo '#--------------------FN_DYNVARS_088_03-------------------------#'
+##############################################################################
+# Change the value of max_write_lock_count to a valid value for GLOBAL Scope #
+##############################################################################
+
+SET @@global.max_write_lock_count = 1;
+SELECT @@global.max_write_lock_count;
+SET @@global.max_write_lock_count = 2;
+SELECT @@global.max_write_lock_count;
+SET @@global.max_write_lock_count = 65536;
+SELECT @@global.max_write_lock_count;
+SET @@global.max_write_lock_count = 4294967295;
+SELECT @@global.max_write_lock_count;
+SET @@global.max_write_lock_count = 4294967294;
+SELECT @@global.max_write_lock_count;
+
+
+
+--echo '#------------------FN_DYNVARS_088_04-----------------------#'
+################################################################
+# Change the value of max_write_lock_count to an invalid value #
+################################################################
+
+SET @@global.max_write_lock_count = -1024;
+SELECT @@global.max_write_lock_count;
+SET @@global.max_write_lock_count = 4294967296;
+SELECT @@global.max_write_lock_count;
+SET @@global.max_write_lock_count = -1;
+SELECT @@global.max_write_lock_count;
+SET @@global.max_write_lock_count = 429496729500;
+SELECT @@global.max_write_lock_count;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_write_lock_count = 65530.34;
+SELECT @@global.max_write_lock_count;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.max_write_lock_count = test;
+SELECT @@global.max_write_lock_count;
+
+
+
+--echo '#------------------FN_DYNVARS_088_05-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT @@global.max_write_lock_count = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='max_write_lock_count';
+
+
+--echo '#------------------FN_DYNVARS_088_06-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.max_write_lock_count = TRUE;
+SELECT @@global.max_write_lock_count;
+SET @@global.max_write_lock_count = FALSE;
+SELECT @@global.max_write_lock_count;
+
+
+--echo '#---------------------FN_DYNVARS_088_07----------------------#'
+#################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+#################################################################################
+
+SET @@global.max_write_lock_count = 20;
+SELECT @@max_write_lock_count = @@global.max_write_lock_count;
+
+
+--echo '#---------------------FN_DYNVARS_088_08----------------------#'
+###############################################################################
+# Check if max_write_lock_count can be accessed with and without @@ sign #
+###############################################################################
+
+
+SET @@global.max_write_lock_count = 102;
+SELECT @@max_write_lock_count;
+--Error ER_UNKNOWN_TABLE
+SELECT local.max_write_lock_count;
+--Error ER_UNKNOWN_TABLE
+SELECT global.max_write_lock_count;
+--Error ER_BAD_FIELD_ERROR
+SELECT max_write_lock_count = @@global.max_write_lock_count;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.max_write_lock_count = @start_global_value;
+SELECT @@global.max_write_lock_count;
+
+
+###################################################
+# END OF max_write_lock_count TESTS #
+###################################################
+
diff --git a/mysql-test/suite/sys_vars/t/maximum_basic-master.opt b/mysql-test/suite/sys_vars/t/maximum_basic-master.opt
new file mode 100644
index 00000000..16e365d4
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/maximum_basic-master.opt
@@ -0,0 +1,5 @@
+--maximum-auto-increment-increment=8192
+--maximum-tmp-table-size=8192
+--maximum-max-join-size=8192
+--maximum-use-stat-tables=COMPLEMENTARY
+--maximum-sql-mode='REAL_AS_FLOAT,ANSI_QUOTES'
diff --git a/mysql-test/suite/sys_vars/t/maximum_basic.test b/mysql-test/suite/sys_vars/t/maximum_basic.test
new file mode 100644
index 00000000..3153d62d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/maximum_basic.test
@@ -0,0 +1,39 @@
+#
+# test for --maximum- my_getopt prefix
+#
+
+#
+# ulong
+#
+SET @@session.auto_increment_increment=40960;
+SELECT @@session.auto_increment_increment;
+#
+# ulonglong
+#
+SET @@session.tmp_table_size=40960;
+SELECT @@session.tmp_table_size;
+#
+# ha_rows
+#
+SET @@session.max_join_size=40960;
+SELECT @@session.max_join_size;
+
+#
+# enum
+#
+SET @@session.use_stat_tables= COMPLEMENTARY;
+SELECT @@session.use_stat_tables;
+SET @@session.use_stat_tables= PREFERABLY;
+SELECT @@session.use_stat_tables;
+SET @@session.use_stat_tables= 2;
+SELECT @@session.use_stat_tables;
+
+#
+# set
+#
+SET @@session.sql_mode= 'REAL_AS_FLOAT';
+SELECT @@session.sql_mode;
+SET @@session.sql_mode= 'REAL_AS_FLOAT,ANSI_QUOTES';
+SELECT @@session.sql_mode;
+SET @@session.sql_mode= 'ANSI_QUOTES,IGNORE_SPACE';
+SELECT @@session.sql_mode;
diff --git a/mysql-test/suite/sys_vars/t/metadata_locks_cache_size_basic-master.opt b/mysql-test/suite/sys_vars/t/metadata_locks_cache_size_basic-master.opt
new file mode 100644
index 00000000..77e019cd
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/metadata_locks_cache_size_basic-master.opt
@@ -0,0 +1 @@
+--metadata-locks-cache-size=256
diff --git a/mysql-test/suite/sys_vars/t/metadata_locks_cache_size_basic.test b/mysql-test/suite/sys_vars/t/metadata_locks_cache_size_basic.test
new file mode 100644
index 00000000..31b03357
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/metadata_locks_cache_size_basic.test
@@ -0,0 +1,25 @@
+#
+# Basic test coverage for --metadata-locks-cache-size startup
+# parameter and corresponding read-only global @@metadata_locks_cache_size
+# variable.
+#
+
+--echo #
+--echo # Check that the paremeter is correctly set by start-up
+--echo # option (.opt file sets it to 256 while default is 1024).
+select @@global.metadata_locks_cache_size = 256;
+
+--echo #
+--echo # Check that variable is read only
+--echo #
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set @@global.metadata_locks_cache_size= 1024;
+select @@global.metadata_locks_cache_size = 256;
+
+--echo #
+--echo # And only GLOBAL
+--echo #
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.metadata_locks_cache_size;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set @@session.metadata_locks_cache_size= 1024;
diff --git a/mysql-test/suite/sys_vars/t/metadata_locks_hash_instances_basic.test b/mysql-test/suite/sys_vars/t/metadata_locks_hash_instances_basic.test
new file mode 100644
index 00000000..5fcf1d95
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/metadata_locks_hash_instances_basic.test
@@ -0,0 +1,60 @@
+########## mysql-test\t\metadata_locks_hash_instances_basic.test ##############
+# #
+# Variable Name: metadata_locks_hash_instances #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: Integer #
+# #
+###############################################################################
+
+
+--echo ####################################################################
+--echo # Displaying default value #
+--echo ####################################################################
+SELECT @@GLOBAL.metadata_locks_hash_instances;
+
+
+--echo ####################################################################
+--echo # Check that value cannot be set (this variable is settable only #
+--echo # at start-up). #
+--echo ####################################################################
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.metadata_locks_hash_instances=1;
+
+SELECT @@GLOBAL.metadata_locks_hash_instances;
+
+
+--echo #################################################################
+--echo # Check if the value in GLOBAL Table matches value in variable #
+--echo #################################################################
+SELECT @@GLOBAL.metadata_locks_hash_instances = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='metadata_locks_hash_instances';
+
+SELECT @@GLOBAL.metadata_locks_hash_instances;
+
+SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='metadata_locks_hash_instances';
+
+
+--echo ######################################################################
+--echo # Check if accessing variable with and without GLOBAL point to same #
+--echo # variable #
+--echo ######################################################################
+SELECT @@metadata_locks_hash_instances = @@GLOBAL.metadata_locks_hash_instances;
+
+
+--echo ######################################################################
+--echo # Check if variable has only the GLOBAL scope #
+--echo ######################################################################
+
+SELECT @@metadata_locks_hash_instances;
+
+SELECT @@GLOBAL.metadata_locks_hash_instances;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@local.metadata_locks_hash_instances;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@SESSION.metadata_locks_hash_instances;
diff --git a/mysql-test/suite/sys_vars/t/min_examined_row_limit_basic.test b/mysql-test/suite/sys_vars/t/min_examined_row_limit_basic.test
new file mode 100644
index 00000000..cd80d1d0
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/min_examined_row_limit_basic.test
@@ -0,0 +1,218 @@
+############## mysql-test\t\min_examined_row_limit_basic.test ###############
+# #
+# Variable Name: min_examined_row_limit #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 0 #
+# Range:0-4294967295 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable min_examined_row_limit #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+######################################################################
+# START OF min_examined_row_limit TESTS #
+######################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.min_examined_row_limit;
+SELECT @start_global_value;
+SET @start_session_value = @@session.min_examined_row_limit;
+SELECT @start_session_value;
+
+
+--echo '#--------------------FN_DYNVARS_089_01-------------------------#'
+######################################################################
+# Display the DEFAULT value of min_examined_row_limit #
+######################################################################
+
+SET @@global.min_examined_row_limit = 100;
+SET @@global.min_examined_row_limit = DEFAULT;
+SELECT @@global.min_examined_row_limit;
+
+SET @@session.min_examined_row_limit = 200;
+SET @@session.min_examined_row_limit = DEFAULT;
+SELECT @@session.min_examined_row_limit;
+
+
+--echo '#--------------------FN_DYNVARS_089_02-------------------------#'
+########################################################################
+# Check the DEFAULT value of min_examined_row_limit #
+########################################################################
+
+SET @@global.min_examined_row_limit = DEFAULT;
+SELECT @@global.min_examined_row_limit = 0;
+
+SET @@session.min_examined_row_limit = DEFAULT;
+SELECT @@session.min_examined_row_limit = 0;
+
+
+--echo '#--------------------FN_DYNVARS_089_03-------------------------#'
+################################################################################
+# Change the value of min_examined_row_limit to a valid value for GLOBAL Scope #
+################################################################################
+
+SET @@global.min_examined_row_limit = 0;
+SELECT @@global.min_examined_row_limit;
+SET @@global.min_examined_row_limit = 1;
+SELECT @@global.min_examined_row_limit;
+SET @@global.min_examined_row_limit = 60020;
+SELECT @@global.min_examined_row_limit;
+SET @@global.min_examined_row_limit = 65535;
+SELECT @@global.min_examined_row_limit;
+SET @@global.min_examined_row_limit = 4294967295;
+SELECT @@global.min_examined_row_limit;
+SET @@global.min_examined_row_limit = 4294967294;
+SELECT @@global.min_examined_row_limit;
+
+
+
+--echo '#--------------------FN_DYNVARS_089_04-------------------------#'
+###################################################################################
+# Change the value of min_examined_row_limit to a valid value for SESSION Scope #
+###################################################################################
+
+SET @@session.min_examined_row_limit = 0;
+SELECT @@session.min_examined_row_limit;
+SET @@session.min_examined_row_limit = 1;
+SELECT @@session.min_examined_row_limit;
+SET @@session.min_examined_row_limit = 50050;
+SELECT @@session.min_examined_row_limit;
+SET @@session.min_examined_row_limit = 65535;
+SELECT @@session.min_examined_row_limit;
+SET @@session.min_examined_row_limit = 4294967295;
+SELECT @@session.min_examined_row_limit;
+SET @@session.min_examined_row_limit = 4294967294;
+SELECT @@session.min_examined_row_limit;
+
+
+--echo '#------------------FN_DYNVARS_089_05-----------------------#'
+####################################################################
+# Change the value of min_examined_row_limit to an invalid value #
+####################################################################
+
+SET @@global.min_examined_row_limit = 429496726;
+SELECT @@global.min_examined_row_limit;
+SET @@global.min_examined_row_limit = -1024;
+SELECT @@global.min_examined_row_limit;
+SET @@global.min_examined_row_limit = 429496729500;
+SELECT @@global.min_examined_row_limit;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.min_examined_row_limit = 65530.34;
+SELECT @@global.min_examined_row_limit;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.min_examined_row_limit = test;
+SELECT @@global.min_examined_row_limit;
+
+SET @@session.min_examined_row_limit = 4294967296;
+SELECT @@session.min_examined_row_limit;
+SET @@session.min_examined_row_limit = -1;
+SELECT @@session.min_examined_row_limit;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.min_examined_row_limit = 65530.34;
+SET @@session.min_examined_row_limit = 4294967295021;
+SELECT @@session.min_examined_row_limit;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.min_examined_row_limit = test;
+SELECT @@session.min_examined_row_limit;
+
+
+--echo '#------------------FN_DYNVARS_089_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT @@global.min_examined_row_limit = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='min_examined_row_limit';
+
+--echo '#------------------FN_DYNVARS_089_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.min_examined_row_limit = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='min_examined_row_limit';
+
+
+--echo '#------------------FN_DYNVARS_089_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.min_examined_row_limit = TRUE;
+SELECT @@global.min_examined_row_limit;
+SET @@global.min_examined_row_limit = FALSE;
+SELECT @@global.min_examined_row_limit;
+
+
+--echo '#---------------------FN_DYNVARS_089_09----------------------#'
+####################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+####################################################################################
+
+SET @@global.min_examined_row_limit = 10;
+SELECT @@min_examined_row_limit = @@global.min_examined_row_limit;
+
+
+--echo '#---------------------FN_DYNVARS_089_10----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@min_examined_row_limit = 100;
+SELECT @@min_examined_row_limit = @@local.min_examined_row_limit;
+SELECT @@local.min_examined_row_limit = @@session.min_examined_row_limit;
+
+
+--echo '#---------------------FN_DYNVARS_089_11----------------------#'
+###################################################################################
+# Check if min_examined_row_limit can be accessed with and without @@ sign #
+###################################################################################
+
+SET min_examined_row_limit = 1;
+SELECT @@min_examined_row_limit;
+--Error ER_UNKNOWN_TABLE
+SELECT local.min_examined_row_limit;
+--Error ER_UNKNOWN_TABLE
+SELECT session.min_examined_row_limit;
+--Error ER_BAD_FIELD_ERROR
+SELECT min_examined_row_limit = @@session.min_examined_row_limit;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.min_examined_row_limit = @start_global_value;
+SELECT @@global.min_examined_row_limit;
+SET @@session.min_examined_row_limit = @start_session_value;
+SELECT @@session.min_examined_row_limit;
+
+
+#############################################################
+# END OF min_examined_row_limit TESTS #
+#############################################################
+
diff --git a/mysql-test/suite/sys_vars/t/mrr_buffer_size_basic.test b/mysql-test/suite/sys_vars/t/mrr_buffer_size_basic.test
new file mode 100644
index 00000000..5641bb7d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/mrr_buffer_size_basic.test
@@ -0,0 +1,42 @@
+# ulong session
+
+SET @start_global_value = @@global.mrr_buffer_size;
+
+#
+# exists as global only
+#
+select @@global.mrr_buffer_size;
+select @@session.mrr_buffer_size;
+show global variables like 'mrr_buffer_size';
+show session variables like 'mrr_buffer_size';
+select * from information_schema.global_variables where variable_name='mrr_buffer_size';
+select * from information_schema.session_variables where variable_name='mrr_buffer_size';
+
+#
+# show that it's writable
+#
+set global mrr_buffer_size=10;
+select @@global.mrr_buffer_size;
+set session mrr_buffer_size=10;
+select @@session.mrr_buffer_size;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global mrr_buffer_size=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set session mrr_buffer_size=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global mrr_buffer_size="foo";
+
+#
+# min/max values, block size
+#
+set global mrr_buffer_size=0;
+select @@global.mrr_buffer_size;
+set session mrr_buffer_size=cast(-1 as unsigned int);
+select @@session.mrr_buffer_size;
+
+SET @@global.mrr_buffer_size = @start_global_value;
+
diff --git a/mysql-test/suite/sys_vars/t/myisam_block_size_basic.test b/mysql-test/suite/sys_vars/t/myisam_block_size_basic.test
new file mode 100644
index 00000000..a564d542
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/myisam_block_size_basic.test
@@ -0,0 +1,21 @@
+# ulong readonly
+
+#
+# show the global and session values;
+#
+select @@global.myisam_block_size;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.myisam_block_size;
+show global variables like 'myisam_block_size';
+show session variables like 'myisam_block_size';
+select * from information_schema.global_variables where variable_name='myisam_block_size';
+select * from information_schema.session_variables where variable_name='myisam_block_size';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global myisam_block_size=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session myisam_block_size=1;
+
diff --git a/mysql-test/suite/sys_vars/t/myisam_data_pointer_size_basic.test b/mysql-test/suite/sys_vars/t/myisam_data_pointer_size_basic.test
new file mode 100644
index 00000000..bd199250
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/myisam_data_pointer_size_basic.test
@@ -0,0 +1,179 @@
+
+############## mysql-test\t\myisam_data_pointer_size_basic.test ################
+# #
+# Variable Name: myisam_data_pointer_size #
+# Scope: GLOBAL & SESSION #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 1 #
+# Range: 1 - 65536 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan Maredia #
+# #
+# Description: Test Cases of Dynamic System Variable myisam_data_pointer_size #
+# that checks the behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+################################################################################
+
+--source include/load_sysvars.inc
+###################################################################
+# START OF myisam_data_pointer_size TESTS #
+###################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.myisam_data_pointer_size;
+SELECT @start_global_value;
+
+--echo '#--------------------FN_DYNVARS_093_01-------------------------#'
+###################################################################
+# Display the DEFAULT value of myisam_data_pointer_size #
+###################################################################
+
+SET @@global.myisam_data_pointer_size = 5;
+SET @@global.myisam_data_pointer_size = DEFAULT;
+SELECT @@global.myisam_data_pointer_size;
+
+--echo '#--------------------FN_DYNVARS_093_02-------------------------#'
+###################################################################
+# Check the DEFAULT value of myisam_data_pointer_size #
+###################################################################
+
+SET @@global.myisam_data_pointer_size = DEFAULT;
+SELECT @@global.myisam_data_pointer_size = 6;
+
+--echo '#--------------------FN_DYNVARS_093_03-------------------------#'
+##################################################################################
+# Change the value of myisam_data_pointer_size to a valid value for GLOBAL Scope #
+##################################################################################
+
+SET @@global.myisam_data_pointer_size = 2;
+SELECT @@global.myisam_data_pointer_size;
+SET @@global.myisam_data_pointer_size = 3;
+SELECT @@global.myisam_data_pointer_size;
+SET @@global.myisam_data_pointer_size = 4;
+SELECT @@global.myisam_data_pointer_size;
+SET @@global.myisam_data_pointer_size = 5;
+SELECT @@global.myisam_data_pointer_size;
+SET @@global.myisam_data_pointer_size = 6;
+SELECT @@global.myisam_data_pointer_size;
+SET @@global.myisam_data_pointer_size = 7;
+SELECT @@global.myisam_data_pointer_size;
+
+--echo '#--------------------FN_DYNVARS_093_04-------------------------#'
+#################################################################################
+# Check if variable can be access with session scope #
+#################################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@myisam_data_pointer_size = 2;
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.myisam_data_pointer_size = 3;
+
+--Error ER_GLOBAL_VARIABLE
+SET @@local.myisam_data_pointer_size = 4;
+
+
+
+--echo '#------------------FN_DYNVARS_093_05-----------------------#'
+####################################################################
+# Change the value of myisam_data_pointer_size to an invalid value #
+####################################################################
+
+SET @@global.myisam_data_pointer_size = -1;
+SELECT @@global.myisam_data_pointer_size;
+SET @@global.myisam_data_pointer_size = 8;
+SELECT @@global.myisam_data_pointer_size;
+SET @@global.myisam_data_pointer_size = 1;
+SELECT @@global.myisam_data_pointer_size;
+SET @@global.myisam_data_pointer_size = 4294967296;
+SELECT @@global.myisam_data_pointer_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.myisam_data_pointer_size = 65530.34;
+SELECT @@global.myisam_data_pointer_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.myisam_data_pointer_size = two;
+SELECT @@global.myisam_data_pointer_size;
+
+--echo '#------------------FN_DYNVARS_093_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+SET @@global.myisam_data_pointer_size = 3;
+SELECT @@global.myisam_data_pointer_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='myisam_data_pointer_size';
+
+
+--echo '#------------------FN_DYNVARS_093_07-----------------------#'
+###########################################################################
+# Check if the value is present in INFORMATION_SCHEMA.SESSION_VARIABLES #
+###########################################################################
+
+SELECT count(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='myisam_data_pointer_size';
+
+
+--echo '#------------------FN_DYNVARS_093_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.myisam_data_pointer_size = TRUE;
+SELECT @@global.myisam_data_pointer_size;
+SET @@global.myisam_data_pointer_size = FALSE;
+SELECT @@global.myisam_data_pointer_size;
+
+
+--echo '#---------------------FN_DYNVARS_001_09----------------------#'
+#################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+#################################################################################
+
+
+SET @@global.myisam_data_pointer_size = 5;
+SELECT @@myisam_data_pointer_size = @@global.myisam_data_pointer_size;
+
+
+--echo '#---------------------FN_DYNVARS_001_10----------------------#'
+##################################################################################
+# Check if myisam_data_pointer_size can be accessed without @@ sign and scope #
+##################################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET myisam_data_pointer_size = 7;
+--Error ER_BAD_FIELD_ERROR
+SELECT myisam_data_pointer_size;
+
+SELECT @@myisam_data_pointer_size;
+
+#verifying another syntax for setting value#
+
+SET global myisam_data_pointer_size = 2;
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.myisam_data_pointer_size = @start_global_value;
+SELECT @@global.myisam_data_pointer_size;
+
+########################################################
+# END OF myisam_data_pointer_size TESTS #
+########################################################
+
diff --git a/mysql-test/suite/sys_vars/t/myisam_data_pointer_size_func-master.opt b/mysql-test/suite/sys_vars/t/myisam_data_pointer_size_func-master.opt
new file mode 100644
index 00000000..d392e2e4
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/myisam_data_pointer_size_func-master.opt
@@ -0,0 +1 @@
+--log-error='dummy.log'
diff --git a/mysql-test/suite/sys_vars/t/myisam_data_pointer_size_func.test b/mysql-test/suite/sys_vars/t/myisam_data_pointer_size_func.test
new file mode 100644
index 00000000..48016056
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/myisam_data_pointer_size_func.test
@@ -0,0 +1,106 @@
+############## mysql-test\t\myisam_data_pointer_size_func.test ################
+# #
+# Variable Name: myisam_data_pointer_size #
+# Scope: GLOBAL & SESSION #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 1 #
+# Range: 1 - 65536 #
+# #
+# #
+# Creation Date: 2008-03-08 #
+# Author: Rizwan Maredia #
+# #
+# Description: Test Cases of Dynamic System Variable myisam_data_pointer_size #
+# that checks the behavior of this variable #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# #
+################################################################################
+
+call mtr.add_suppression("The table 't1' is full");
+
+--echo '#--------------------FN_DYNVARS_093_01-------------------------#'
+###############################################################################
+# Check if setting myisam_data_pointer_size is changed in every new connection#
+###############################################################################
+
+SET @start_value= @@global.myisam_data_pointer_size;
+SET @@global.myisam_data_pointer_size = 2;
+# con1 will be default connection from now on
+connect (con1,localhost,root,,,,);
+connection con1;
+SELECT @@global.myisam_data_pointer_size;
+SET @@global.myisam_data_pointer_size = 3;
+connect (con2,localhost,root,,,,);
+connection con2;
+SELECT @@global.myisam_data_pointer_size;
+disconnect con2;
+
+
+--echo '#--------------------FN_DYNVARS_093_02-------------------------#'
+#################################################################
+# Begin the functionality Testing of myisam_data_pointer_size #
+#################################################################
+
+connection con1;
+
+#===========================================================
+# Checking myisam_data_pointer_size is 2
+#===========================================================
+
+# create sp to add 'count' records
+--disable_warnings
+DROP PROCEDURE IF EXISTS sp_addRec;
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+DELIMITER //;
+CREATE PROCEDURE sp_addRec(IN count INT)
+BEGIN
+ WHILE (count>0) DO
+ INSERT INTO t1 value(1);
+ SET count = count -1;
+ END WHILE;
+END //
+DELIMITER ;//
+
+# setting 2 will allow data pointer to access files with size < 65536
+SET @@global.myisam_data_pointer_size = 2;
+
+CREATE TABLE t1(a INT);
+
+CALL sp_addRec(65535);
+
+--Error ER_RECORD_FILE_FULL
+CALL sp_addRec(1);
+
+SELECT count(*) from t1;
+
+#=======================================================================
+--echo '--Checking myisam_data_pointer_size with MAX_ROWS table option--'
+#=======================================================================
+
+# specifying MAX_ROWS table option renders pointer size useless
+SET @@global.myisam_data_pointer_size = 2;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1(a INT)MAX_ROWS=70000;
+
+CALL sp_addRec(65536);
+
+SELECT count(*) from t1;
+
+DROP PROCEDURE sp_addRec;
+DROP TABLE t1;
+
+connection default;
+SET @@global.myisam_data_pointer_size= @start_value;
+################################################################
+# End of functionality Testing for myisam_data_pointer_size #
+################################################################
+
diff --git a/mysql-test/suite/sys_vars/t/myisam_max_sort_file_size_basic.test b/mysql-test/suite/sys_vars/t/myisam_max_sort_file_size_basic.test
new file mode 100644
index 00000000..a8ab3476
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/myisam_max_sort_file_size_basic.test
@@ -0,0 +1,182 @@
+
+############## mysql-test\t\myisam_max_sort_file_size_basic.test ################
+# #
+# Variable Name: myisam_max_sort_file_size #
+# Scope: GLOBAL & SESSION #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 1 #
+# Range: 1 - 65536 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan Maredia #
+# #
+# Description: Test Cases of Dynamic System Variable myisam_max_sort_file_size #
+# that checks the behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+################################################################################
+
+--source include/load_sysvars.inc
+
+###################################################################
+# START OF myisam_max_sort_file_size TESTS #
+###################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.myisam_max_sort_file_size;
+--replace_result 9223372036853727232 2146435072
+SELECT @start_global_value;
+
+--echo '#--------------------FN_DYNVARS_094_01-------------------------#'
+###################################################################
+# Display the DEFAULT value of myisam_max_sort_file_size #
+###################################################################
+
+SET @@global.myisam_max_sort_file_size = 500000;
+SET @@global.myisam_max_sort_file_size = DEFAULT;
+--replace_result 9223372036853727232 2146435072
+SELECT @@global.myisam_max_sort_file_size;
+
+--echo '#--------------------FN_DYNVARS_094_02-------------------------#'
+###################################################################
+# Check the DEFAULT value of myisam_max_sort_file_size #
+###################################################################
+
+SET @@global.myisam_max_sort_file_size = DEFAULT;
+SELECT @@global.myisam_max_sort_file_size = 2147483648;
+
+--echo '#--------------------FN_DYNVARS_094_03-------------------------#'
+##################################################################################
+# Change the value of myisam_max_sort_file_size to a valid value for GLOBAL Scope #
+##################################################################################
+
+SET @@global.myisam_max_sort_file_size = 0;
+SELECT @@global.myisam_max_sort_file_size;
+SET @@global.myisam_max_sort_file_size = 1024;
+SELECT @@global.myisam_max_sort_file_size;
+SET @@global.myisam_max_sort_file_size = 123456789;
+SELECT @@global.myisam_max_sort_file_size;
+SET @@global.myisam_max_sort_file_size = 2147483648*2;
+SELECT @@global.myisam_max_sort_file_size;
+SET @@global.myisam_max_sort_file_size = 2147483648*1024;
+SELECT @@global.myisam_max_sort_file_size;
+SELECT @@global.myisam_max_sort_file_size;
+SET @@global.myisam_max_sort_file_size = 2147483648*2147483648;
+
+--echo '#--------------------FN_DYNVARS_094_04-------------------------#'
+#################################################################################
+# Check if variable can be access with session scope #
+#################################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@myisam_max_sort_file_size = 2;
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.myisam_max_sort_file_size = 3;
+
+--Error ER_GLOBAL_VARIABLE
+SET @@local.myisam_max_sort_file_size = 4;
+
+
+
+--echo '#------------------FN_DYNVARS_094_05-----------------------#'
+####################################################################
+# Change the value of myisam_max_sort_file_size to an invalid value #
+####################################################################
+
+SET @@global.myisam_max_sort_file_size = -1;
+SELECT @@global.myisam_max_sort_file_size;
+SET @@global.myisam_max_sort_file_size = -2147483648;
+SELECT @@global.myisam_max_sort_file_size;
+SET @@global.myisam_max_sort_file_size = -2147483649;
+SELECT @@global.myisam_max_sort_file_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.myisam_max_sort_file_size = 65530.34;
+SELECT @@global.myisam_max_sort_file_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.myisam_max_sort_file_size = 2147483649.56;
+SELECT @@global.myisam_max_sort_file_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.myisam_max_sort_file_size = 1G;
+
+--echo '#------------------FN_DYNVARS_094_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+SET @@global.myisam_max_sort_file_size = 3000;
+SELECT @@global.myisam_max_sort_file_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='myisam_max_sort_file_size';
+
+
+--echo '#------------------FN_DYNVARS_094_07-----------------------#'
+###########################################################################
+# Check if the value is present in INFORMATION_SCHEMA.SESSION_VARIABLES #
+###########################################################################
+
+SELECT count(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='myisam_max_sort_file_size';
+
+
+--echo '#------------------FN_DYNVARS_094_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.myisam_max_sort_file_size = TRUE;
+SELECT @@global.myisam_max_sort_file_size;
+SET @@global.myisam_max_sort_file_size = FALSE;
+SELECT @@global.myisam_max_sort_file_size;
+
+
+--echo '#---------------------FN_DYNVARS_001_09----------------------#'
+#################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+#################################################################################
+
+
+SET @@global.myisam_max_sort_file_size = 512;
+SELECT @@myisam_max_sort_file_size = @@global.myisam_max_sort_file_size;
+
+
+--echo '#---------------------FN_DYNVARS_001_10----------------------#'
+##################################################################################
+# Check if myisam_max_sort_file_size can be accessed without @@ sign and scope #
+##################################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET myisam_max_sort_file_size = 2048;
+--Error ER_BAD_FIELD_ERROR
+SELECT myisam_max_sort_file_size;
+
+SELECT @@myisam_max_sort_file_size;
+
+#verifying another syntax for setting value#
+SET global myisam_max_sort_file_size = 64;
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.myisam_max_sort_file_size = @start_global_value;
+--replace_result 9223372036853727232 2146435072
+SELECT @@global.myisam_max_sort_file_size;
+
+########################################################
+# END OF myisam_max_sort_file_size TESTS #
+########################################################
+
diff --git a/mysql-test/suite/sys_vars/t/myisam_mmap_size_basic.test b/mysql-test/suite/sys_vars/t/myisam_mmap_size_basic.test
new file mode 100644
index 00000000..c5d4f8d0
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/myisam_mmap_size_basic.test
@@ -0,0 +1,23 @@
+#
+# only global
+#
+--replace_result 4294967295 18446744073709551615
+select @@global.myisam_mmap_size;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.myisam_mmap_size;
+--replace_result 4294967295 18446744073709551615
+show global variables like 'myisam_mmap_size';
+--replace_result 4294967295 18446744073709551615
+show session variables like 'myisam_mmap_size';
+--replace_result 4294967295 18446744073709551615
+select * from information_schema.global_variables where variable_name='myisam_mmap_size';
+--replace_result 4294967295 18446744073709551615
+select * from information_schema.session_variables where variable_name='myisam_mmap_size';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global myisam_mmap_size=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session myisam_mmap_size=1;
diff --git a/mysql-test/suite/sys_vars/t/myisam_recover_options_basic.opt b/mysql-test/suite/sys_vars/t/myisam_recover_options_basic.opt
new file mode 100644
index 00000000..a818d14b
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/myisam_recover_options_basic.opt
@@ -0,0 +1 @@
+--myisam-recover-options=BACKUP,QUICK
diff --git a/mysql-test/suite/sys_vars/t/myisam_recover_options_basic.test b/mysql-test/suite/sys_vars/t/myisam_recover_options_basic.test
new file mode 100644
index 00000000..4d1b0784
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/myisam_recover_options_basic.test
@@ -0,0 +1,18 @@
+#
+# only global
+#
+select @@global.myisam_recover_options;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.myisam_recover_options;
+show global variables like 'myisam_recover_options';
+show session variables like 'myisam_recover_options';
+select * from information_schema.global_variables where variable_name='myisam_recover_options';
+select * from information_schema.session_variables where variable_name='myisam_recover_options';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global myisam_recover_options=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session myisam_recover_options=1;
diff --git a/mysql-test/suite/sys_vars/t/myisam_repair_threads_basic.test b/mysql-test/suite/sys_vars/t/myisam_repair_threads_basic.test
new file mode 100644
index 00000000..b968f00d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/myisam_repair_threads_basic.test
@@ -0,0 +1,248 @@
+############## mysql-test\t\myisam_repair_threads_basic.test ##################
+# #
+# Variable Name: myisam_repair_threads #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 1 #
+# Range: 1-4294967295 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Sharique Abdullah #
+# #
+# Description: Test Cases of Dynamic System Variable myisam_repair_threads #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+######################################################################
+# START OF myisam_repair_threads TESTS #
+######################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.myisam_repair_threads;
+SELECT @start_global_value;
+SET @start_session_value = @@session.myisam_repair_threads;
+SELECT @start_session_value;
+
+
+--echo '#--------------------FN_DYNVARS_005_01-------------------------#'
+#################################################################
+# Display the DEFAULT value of myisam_block_size #
+#################################################################
+
+SET @@global.myisam_repair_threads = 100;
+SET @@global.myisam_repair_threads = DEFAULT;
+SELECT @@global.myisam_repair_threads ;
+
+SET @@session.myisam_repair_threads = 200;
+SET @@session.myisam_repair_threads = DEFAULT;
+SELECT @@session.myisam_repair_threads ;
+
+
+--echo '#--------------------FN_DYNVARS_005_02-------------------------#'
+######################################################################
+# Check the DEFAULT value of myisam_repair_threads #
+######################################################################
+
+SET @@global.myisam_repair_threads = DEFAULT;
+SELECT @@global.myisam_repair_threads = 1;
+
+SET @@session.myisam_repair_threads = DEFAULT;
+SELECT @@session.myisam_repair_threads = 1;
+
+
+--echo '#--------------------FN_DYNVARS_005_03-------------------------#'
+###############################################################################
+# Change the value of myisam_repair_threads to a valid value for GLOBAL Scope#
+###############################################################################
+
+SET @@global.myisam_repair_threads = 1;
+SELECT @@global.myisam_repair_threads ;
+
+SET @@global.myisam_repair_threads = 4294967295;
+SELECT @@global.myisam_repair_threads ;
+
+SET @@global.myisam_repair_threads = 655354;
+SELECT @@global.myisam_repair_threads ;
+
+
+--echo '#--------------------FN_DYNVARS_005_04-------------------------#'
+###############################################################################
+# Change the value of myisam_repair_threads to a valid value for SESSION
+# Scope
+###############################################################################
+
+SET @@session.myisam_repair_threads = 1;
+SELECT @@session.myisam_repair_threads ;
+
+SET @@session.myisam_repair_threads = 4294967295;
+SELECT @@session.myisam_repair_threads ;
+
+SET @@session.myisam_repair_threads = 655345;
+SELECT @@session.myisam_repair_threads ;
+
+
+
+
+--echo '#------------------FN_DYNVARS_005_05-----------------------#'
+##################################################################
+# Change the value of myisam_repair_threads to an invalid value #
+##################################################################
+
+SET @@global.myisam_repair_threads = 0;
+SELECT @@global.myisam_repair_threads ;
+
+SET @@global.myisam_repair_threads = -1024;
+SELECT @@global.myisam_repair_threads ;
+--disable_warnings
+SET @@global.myisam_repair_threads = 429496729533;
+--enable_warnings
+--replace_result 429496729533 4294967295
+SELECT @@global.myisam_repair_threads ;
+
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.myisam_repair_threads = 65530.34;
+--replace_result 429496729533 4294967295
+SELECT @@global.myisam_repair_threads ;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.myisam_repair_threads = test;
+--replace_result 429496729533 4294967295
+SELECT @@global.myisam_repair_threads ;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.myisam_repair_threads = "test";
+--replace_result 429496729533 4294967295
+SELECT @@global.myisam_repair_threads ;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.myisam_repair_threads = 'test';
+--replace_result 429496729533 4294967295
+SELECT @@global.myisam_repair_threads ;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.myisam_repair_threads = ON;
+--replace_result 429496729533 4294967295
+SELECT @@global.myisam_repair_threads ;
+
+
+SET @@session.myisam_repair_threads = 0;
+SELECT @@session.myisam_repair_threads ;
+
+SET @@session.myisam_repair_threads = -2;
+SELECT @@session.myisam_repair_threads ;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.myisam_repair_threads = 65530.34;
+SELECT @@session.myisam_repair_threads ;
+
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.myisam_repair_threads = test;
+SELECT @@session.myisam_repair_threads ;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.myisam_repair_threads = "test";
+SELECT @@session.myisam_repair_threads ;
+
+
+--echo '#------------------FN_DYNVARS_005_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT @@global.myisam_repair_threads = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='myisam_repair_threads ';
+
+--echo '#------------------FN_DYNVARS_005_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.myisam_repair_threads = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='myisam_repair_threads ';
+
+
+--echo '#------------------FN_DYNVARS_005_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.myisam_repair_threads = TRUE;
+SELECT @@global.myisam_repair_threads ;
+SET @@global.myisam_repair_threads = FALSE;
+SELECT @@global.myisam_repair_threads ;
+
+
+
+--echo '#---------------------FN_DYNVARS_001_09----------------------#'
+###############################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+###############################################################################
+
+SET @@global.myisam_repair_threads = 10;
+SELECT @@myisam_repair_threads = @@global.myisam_repair_threads ;
+
+
+--echo '#---------------------FN_DYNVARS_001_10----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to
+# same session variable #
+########################################################################################################
+
+SET @@myisam_repair_threads = 100;
+SELECT @@myisam_repair_threads = @@local.myisam_repair_threads ;
+SELECT @@local.myisam_repair_threads = @@session.myisam_repair_threads ;
+
+
+--echo '#---------------------FN_DYNVARS_001_11----------------------#'
+###################################################################################
+# Check if myisam_repair_threads can be accessed with and without @@ sign #
+###################################################################################
+
+SET myisam_repair_threads = 1;
+SELECT @@myisam_repair_threads ;
+--Error ER_UNKNOWN_TABLE
+
+SELECT local.myisam_repair_threads ;
+
+--Error ER_UNKNOWN_TABLE
+SELECT session.myisam_repair_threads ;
+
+--Error ER_BAD_FIELD_ERROR
+SELECT myisam_repair_threads = @@session.myisam_repair_threads ;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.myisam_repair_threads = @start_global_value;
+SELECT @@global.myisam_repair_threads ;
+SET @@session.myisam_repair_threads = @start_session_value;
+SELECT @@session.myisam_repair_threads ;
+
+
+#############################################################
+# END OF myisam_repair_threads TESTS #
+#############################################################
+
diff --git a/mysql-test/suite/sys_vars/t/myisam_sort_buffer_size_basic.test b/mysql-test/suite/sys_vars/t/myisam_sort_buffer_size_basic.test
new file mode 100644
index 00000000..ac1e9d61
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/myisam_sort_buffer_size_basic.test
@@ -0,0 +1,225 @@
+############## mysql-test\t\myisam_sort_buffer_size_basic.test ###############
+# #
+# Variable Name: myisam_sort_buffer_size #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: #
+# Range: #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable myisam_sort_buffer_size #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF myisam_sort_buffer_size TESTS #
+########################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.myisam_sort_buffer_size ;
+SELECT @@session.myisam_sort_buffer_size = @@global.myisam_sort_buffer_size;
+SET @@global.myisam_sort_buffer_size= default;
+SET @default_myisam_sort_buffer_size= @@global.myisam_sort_buffer_size;
+
+--echo '#--------------------FN_DYNVARS_005_01-------------------------#'
+########################################################################
+# Display the DEFAULT value of myisam_block_size #
+########################################################################
+
+SET @@global.myisam_sort_buffer_size = 100;
+SET @@global.myisam_sort_buffer_size = DEFAULT;
+SELECT @@global.myisam_sort_buffer_size = @default_myisam_sort_buffer_size;
+
+SET @@session.myisam_sort_buffer_size = 200;
+SET @@session.myisam_sort_buffer_size = DEFAULT;
+SELECT @@session.myisam_sort_buffer_size = @default_myisam_sort_buffer_size;
+
+
+--echo '#--------------------FN_DYNVARS_005_03-------------------------#'
+##################################################################################
+# Change the value of myisam_sort_buffer_size to a valid value for GLOBAL Scope #
+##################################################################################
+
+SET @@global.myisam_sort_buffer_size = 4;
+SELECT @@global.myisam_sort_buffer_size ;
+
+SET @@global.myisam_sort_buffer_size = 268435455;
+SELECT @@global.myisam_sort_buffer_size ;
+
+SET @@global.myisam_sort_buffer_size = 655354;
+SELECT @@global.myisam_sort_buffer_size ;
+
+
+--echo '#--------------------FN_DYNVARS_005_04-------------------------#'
+###################################################################################
+# Change the value of myisam_sort_buffer_size to a valid value for SESSION Scope #
+###################################################################################
+
+SET @@session.myisam_sort_buffer_size = 4;
+SELECT @@session.myisam_sort_buffer_size ;
+
+SET @@session.myisam_sort_buffer_size = 268435455;
+SELECT @@session.myisam_sort_buffer_size ;
+
+SET @@session.myisam_sort_buffer_size = 655345;
+SELECT @@session.myisam_sort_buffer_size ;
+
+--echo '#------------------FN_DYNVARS_005_05-----------------------#'
+####################################################################
+# Change the value of myisam_sort_buffer_size to an invalid value #
+####################################################################
+
+SET @@global.myisam_sort_buffer_size = 0;
+SELECT @@global.myisam_sort_buffer_size ;
+
+SET @@global.myisam_sort_buffer_size = -1024;
+SELECT @@global.myisam_sort_buffer_size ;
+
+--disable_warnings
+SET @@global.myisam_sort_buffer_size = 429496729533;
+--enable_warnings
+--replace_result 429496729533 4294967295 268435455 4294967295
+SELECT @@global.myisam_sort_buffer_size ;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.myisam_sort_buffer_size = 65530.34;
+--replace_result 429496729533 4294967295 268435455 4294967295
+SELECT @@global.myisam_sort_buffer_size ;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.myisam_sort_buffer_size = test;
+--replace_result 429496729533 4294967295 268435455 4294967295
+SELECT @@global.myisam_sort_buffer_size ;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.myisam_sort_buffer_size = "test";
+--replace_result 429496729533 4294967295 268435455 4294967295
+SELECT @@global.myisam_sort_buffer_size ;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.myisam_sort_buffer_size = 'test';
+--replace_result 429496729533 4294967295 268435455 4294967295
+SELECT @@global.myisam_sort_buffer_size ;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.myisam_sort_buffer_size = ON;
+--replace_result 429496729533 4294967295 268435455 4294967295
+SELECT @@global.myisam_sort_buffer_size ;
+
+
+SET @@session.myisam_sort_buffer_size = 0;
+SELECT @@session.myisam_sort_buffer_size ;
+
+SET @@session.myisam_sort_buffer_size = -2;
+SELECT @@session.myisam_sort_buffer_size ;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.myisam_sort_buffer_size = 65530.34;
+SELECT @@session.myisam_sort_buffer_size ;
+
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.myisam_sort_buffer_size = test;
+SELECT @@session.myisam_sort_buffer_size ;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.myisam_sort_buffer_size = "test";
+SELECT @@session.myisam_sort_buffer_size ;
+
+
+--echo '#------------------FN_DYNVARS_005_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT @@global.myisam_sort_buffer_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='myisam_sort_buffer_size ';
+
+--echo '#------------------FN_DYNVARS_005_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.myisam_sort_buffer_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='myisam_sort_buffer_size ';
+
+
+--echo '#------------------FN_DYNVARS_005_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.myisam_sort_buffer_size = TRUE;
+SELECT @@global.myisam_sort_buffer_size ;
+SET @@global.myisam_sort_buffer_size = FALSE;
+SELECT @@global.myisam_sort_buffer_size ;
+
+
+
+--echo '#---------------------FN_DYNVARS_001_09----------------------#'
+####################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+####################################################################################
+
+SET @@global.myisam_sort_buffer_size = 10;
+SELECT @@myisam_sort_buffer_size = @@global.myisam_sort_buffer_size ;
+
+
+--echo '#---------------------FN_DYNVARS_001_10----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@myisam_sort_buffer_size = 100;
+SELECT @@myisam_sort_buffer_size = @@local.myisam_sort_buffer_size ;
+SELECT @@local.myisam_sort_buffer_size = @@session.myisam_sort_buffer_size ;
+
+
+--echo '#---------------------FN_DYNVARS_001_11----------------------#'
+###################################################################################
+# Check if myisam_sort_buffer_size can be accessed with and without @@ sign #
+###################################################################################
+
+SET myisam_sort_buffer_size = 1;
+SELECT @@myisam_sort_buffer_size ;
+--Error ER_UNKNOWN_TABLE
+
+SELECT local.myisam_sort_buffer_size ;
+
+--Error ER_UNKNOWN_TABLE
+SELECT session.myisam_sort_buffer_size ;
+
+--Error ER_BAD_FIELD_ERROR
+SELECT myisam_sort_buffer_size = @@session.myisam_sort_buffer_size ;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.myisam_sort_buffer_size = @start_global_value;
+
+#############################################################
+# END OF myisam_sort_buffer_size TESTS #
+#############################################################
diff --git a/mysql-test/suite/sys_vars/t/myisam_stats_method_basic.test b/mysql-test/suite/sys_vars/t/myisam_stats_method_basic.test
new file mode 100644
index 00000000..6fecee3f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/myisam_stats_method_basic.test
@@ -0,0 +1,199 @@
+############## mysql-test\t\myisam_stats_method_basic.test ####################
+# #
+# Variable Name: myisam_stats_method #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: enumeration #
+# Default Value: nulls_equal #
+# Valid Values: nulls_equal, nulls_unequal #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable myisam_stats_method #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF myisam_stats_method TESTS #
+########################################################################
+
+
+###########################################################################
+# Saving initial value of myisam_stats_method in a temporary variable #
+###########################################################################
+
+SET @global_start_value = @@global.myisam_stats_method;
+SELECT @global_start_value;
+
+SET @session_start_value = @@session.myisam_stats_method;
+SELECT @session_start_value;
+
+--echo '#--------------------FN_DYNVARS_097_01------------------------#'
+########################################################################
+# Display the DEFAULT value of myisam_stats_method #
+########################################################################
+
+SET @@global.myisam_stats_method = nulls_equal;
+SET @@global.myisam_stats_method = DEFAULT;
+SELECT @@global.myisam_stats_method;
+
+SET @@session.myisam_stats_method = nulls_equal;
+SET @@session.myisam_stats_method = DEFAULT;
+SELECT @@session.myisam_stats_method;
+
+
+--echo '#---------------------FN_DYNVARS_097_02-------------------------#'
+#########################################################
+# Check if NULL or empty value is accepeted #
+#########################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.myisam_stats_method = NULL;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.myisam_stats_method = '';
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.myisam_stats_method = NULL;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.myisam_stats_method = '';
+
+--echo '#--------------------FN_DYNVARS_097_03------------------------#'
+########################################################################
+# Change the value of myisam_stats_method to a valid value #
+########################################################################
+
+SET @@global.myisam_stats_method = 'nulls_equal';
+SELECT @@global.myisam_stats_method;
+
+SET @@global.myisam_stats_method = 'nulls_unequal';
+SELECT @@global.myisam_stats_method;
+
+SET @@global.myisam_stats_method = 'nulls_ignored';
+SELECT @@global.myisam_stats_method;
+
+--echo 'Bug: Value of nulls_ignored is not documented. Its ordinal value is 2'
+
+SET @@session.myisam_stats_method = 'nulls_equal';
+SELECT @@session.myisam_stats_method;
+
+SET @@session.myisam_stats_method = 'nulls_unequal';
+SELECT @@session.myisam_stats_method;
+
+SET @@session.myisam_stats_method = 'nulls_ignored';
+SELECT @@session.myisam_stats_method;
+
+
+--echo '#--------------------FN_DYNVARS_097_04-------------------------#'
+###########################################################################
+# Change the value of myisam_stats_method to invalid value #
+###########################################################################
+
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.myisam_stats_method = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.myisam_stats_method = unequal;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.myisam_stats_method = ENABLED;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.myisam_stats_method = 'equal';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.myisam_stats_method = 'null_equal';
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.myisam_stats_method = ' ';
+
+
+--echo '#-------------------FN_DYNVARS_097_05----------------------------#'
+#########################################################################
+# Check if the value in session Table matches value in variable #
+#########################################################################
+
+SELECT @@session.myisam_stats_method = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='myisam_stats_method';
+
+--echo '#----------------------FN_DYNVARS_097_06------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#########################################################################
+
+SELECT @@global.myisam_stats_method = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='myisam_stats_method';
+
+
+--echo '#---------------------FN_DYNVARS_097_07-------------------------#'
+###################################################################
+# Check if numbers can be used on variable #
+###################################################################
+
+# test if variable accepts 0,1,2
+SET @@global.myisam_stats_method = 0;
+SELECT @@global.myisam_stats_method;
+
+SET @@global.myisam_stats_method = 1;
+SELECT @@global.myisam_stats_method;
+
+SET @@global.myisam_stats_method = 2;
+SELECT @@global.myisam_stats_method;
+
+# use of decimal values
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.myisam_stats_method = 0.4;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.myisam_stats_method = 3;
+
+
+--echo '#---------------------FN_DYNVARS_097_08----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.myisam_stats_method = TRUE;
+SELECT @@global.myisam_stats_method;
+SET @@global.myisam_stats_method = FALSE;
+SELECT @@global.myisam_stats_method;
+
+--echo '#---------------------FN_DYNVARS_097_09----------------------#'
+#########################################################################
+# Check if myisam_stats_method can be accessed with and without @@ sign #
+#########################################################################
+
+SET myisam_stats_method = 'nulls_equal';
+
+SET session myisam_stats_method = 'nulls_equal';
+SELECT @@myisam_stats_method;
+
+SET global myisam_stats_method = 'nulls_equal';
+SELECT @@global.myisam_stats_method;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.myisam_stats_method = @global_start_value;
+SELECT @@global.myisam_stats_method;
+
+SET @@session.myisam_stats_method = @session_start_value;
+SELECT @@session.myisam_stats_method;
+
+########################################################################
+# END OF myisam_stats_method TESTS #
+########################################################################
diff --git a/mysql-test/suite/sys_vars/t/myisam_stats_method_func.test b/mysql-test/suite/sys_vars/t/myisam_stats_method_func.test
new file mode 100644
index 00000000..5cb01958
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/myisam_stats_method_func.test
@@ -0,0 +1,111 @@
+############## mysql-test\t\myisam_stats_method_func.test ####################
+# #
+# Variable Name: myisam_stats_method #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: enumeration #
+# Default Value: nulls_equal #
+# Valid Values: nulls_equal, nulls_unequal #
+# #
+# #
+# Creation Date: 2008-03-08 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable myisam_stats_method #
+# that checks the behavior of this variable #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# #
+###############################################################################
+
+--echo '#--------------------FN_DYNVARS_097_01-------------------------#'
+#####################################################################
+# Check if Setting myisam_stats_method is changed in new connection #
+#####################################################################
+
+SET @start_value = @@global.myisam_stats_method;
+
+SET @@global.myisam_stats_method = nulls_equal;
+connect (con1,localhost,root,,,,);
+connection con1;
+SELECT @@global.myisam_stats_method;
+SELECT @@session.myisam_stats_method;
+disconnect con1;
+
+--echo '#--------------------FN_DYNVARS_097_02-------------------------#'
+###########################################################
+# Begin the functionality Testing of myisam_stats_method #
+###########################################################
+
+connection default;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (a INT, KEY (a));
+INSERT INTO t1 VALUES (0),(1),(2),(3),(4);
+INSERT INTO t1 SELECT NULL FROM t1;
+
+#=======================================
+--echo 'default: NULLs considered unequal'
+#=======================================
+SET myisam_stats_method = nulls_unequal;
+
+ANALYZE TABLE t1;
+SHOW INDEX FROM t1;
+INSERT INTO t1 VALUES (11);
+DELETE FROM t1 WHERE a = 11;
+CHECK TABLE t1;
+SHOW INDEX FROM t1;
+
+
+#=====================================
+--echo 'Set nulls to be equal'
+#=====================================
+SET myisam_stats_method = nulls_equal;
+set @save_use_stat_tables= @@use_stat_tables;
+set @@use_stat_tables= COMPLEMENTARY;
+
+INSERT INTO t1 VALUES (11);
+DELETE FROM t1 WHERE a = 11;
+ANALYZE TABLE t1;
+SHOW INDEX FROM t1;
+INSERT INTO t1 VALUES (11);
+DELETE FROM t1 WHERE a = 11;
+CHECK TABLE t1;
+SHOW INDEX FROM t1;
+
+
+#=====================================
+--echo 'Set nulls to be ignored'
+#=====================================
+
+SET myisam_stats_method = nulls_ignored;
+SHOW VARIABLES LIKE 'myisam_stats_method';
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ a CHAR(3), b CHAR(4), c CHAR(5), d CHAR(6),
+ KEY(a,b,c,d)
+);
+INSERT INTO t1 VALUES ('bcd','def1', NULL, 'zz');
+INSERT INTO t1 VALUES ('bcd','def2', NULL, 'zz');
+INSERT INTO t1 VALUES ('bce','def1', 'yuu', NULL);
+INSERT INTO t1 VALUES ('bce','def2', NULL, 'quux');
+ANALYZE TABLE t1;
+SHOW INDEX FROM t1;
+DELETE FROM t1;
+ANALYZE TABLE t1;
+SHOW INDEX FROM t1;
+
+SET myisam_stats_method = DEFAULT;
+set @@use_stat_tables= @save_use_stat_tables;
+DROP TABLE t1;
+
+SET @@global.myisam_stats_method= @start_value;
+
+########################################################
+# End of functionality Testing for myisam_stats_method #
+########################################################
diff --git a/mysql-test/suite/sys_vars/t/myisam_use_mmap_basic.test b/mysql-test/suite/sys_vars/t/myisam_use_mmap_basic.test
new file mode 100644
index 00000000..dd1f8dbe
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/myisam_use_mmap_basic.test
@@ -0,0 +1,104 @@
+
+
+################## mysql-test\t\myisam_use_mmap_basic.test ####################
+# #
+# Variable Name: myisam_use_mmap #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable myisam_use_mmap #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--echo '#---------------------BS_STVARS_042_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.myisam_use_mmap);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_042_02----------------------#'
+#
+# Test case for Bug #35433
+#
+####################################################################
+# Check if Value can set #
+####################################################################
+
+#--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+#SET @@GLOBAL.myisam_use_mmap=1;
+--ECHO "BUG:It should give error on setting this variable as it is readonly variable"
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.myisam_use_mmap);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_042_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+SELECT IF(@@GLOBAL.myisam_use_mmap, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='myisam_use_mmap';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.myisam_use_mmap);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='myisam_use_mmap';
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_042_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@myisam_use_mmap = @@GLOBAL.myisam_use_mmap;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_042_05----------------------#'
+################################################################################
+# Check if myisam_use_mmap can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@myisam_use_mmap);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.myisam_use_mmap);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.myisam_use_mmap);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.myisam_use_mmap);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT myisam_use_mmap = @@SESSION.myisam_use_mmap;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/mysql56_temporal_format_basic.test b/mysql-test/suite/sys_vars/t/mysql56_temporal_format_basic.test
new file mode 100644
index 00000000..f6def41f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/mysql56_temporal_format_basic.test
@@ -0,0 +1,163 @@
+############## mysql-test\t\mysql56_temporal_format_basic.test ################
+# #
+# Variable Name: mysql56_temporal_format #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: boolean #
+# Default Value: OFF #
+# Range: #
+# #
+# Creation Date: 2014-08-27 #
+# #
+# Description: Test Cases of Dynamic System Variable mysql56_temporal_format #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+########################################################################
+# START OF mysql56_temporal_format TESTS #
+########################################################################
+
+
+###########################################################################
+# Saving initial value of mysql56_temporal_format in a temporary variable #
+###########################################################################
+
+SET @start_value = @@global.mysql56_temporal_format;
+SELECT @start_value;
+
+
+--echo '#--------------------FN_DYNVARS_030_01------------------------#'
+#############################################################
+# Display the DEFAULT value of mysql56_temporal_format #
+#############################################################
+
+SET @@global.mysql56_temporal_format = ON;
+SET @@global.mysql56_temporal_format = DEFAULT;
+SELECT @@global.mysql56_temporal_format;
+
+
+--echo '#---------------------FN_DYNVARS_030_02-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@global.mysql56_temporal_format = @start_value;
+SELECT @@global.mysql56_temporal_format;
+
+
+--echo '#--------------------FN_DYNVARS_030_03------------------------#'
+################################################################
+# Change the value of mysql56_temporal_format to a valid value #
+################################################################
+
+SET @@global.mysql56_temporal_format = ON;
+SELECT @@global.mysql56_temporal_format;
+SET @@global.mysql56_temporal_format = OFF;
+SELECT @@global.mysql56_temporal_format;
+SET @@global.mysql56_temporal_format = 0;
+SELECT @@global.mysql56_temporal_format;
+SET @@global.mysql56_temporal_format = 1;
+SELECT @@global.mysql56_temporal_format;
+
+
+--echo '#--------------------FN_DYNVARS_030_04-------------------------#'
+###########################################################################
+# Change the value of mysql56_temporal_format to invalid value #
+###########################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.mysql56_temporal_format = 2;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.mysql56_temporal_format = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.mysql56_temporal_format = TRUEF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.mysql56_temporal_format = TRUE_F;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.mysql56_temporal_format = FALSE0;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.mysql56_temporal_format = OON;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.mysql56_temporal_format = ONN;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.mysql56_temporal_format = OOFF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.mysql56_temporal_format = 0FF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.mysql56_temporal_format = ' ';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.mysql56_temporal_format = " ";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.mysql56_temporal_format = '';
+
+
+--echo '#-------------------FN_DYNVARS_030_05----------------------------#'
+###########################################################################
+# Test if accessing session mysql56_temporal_format gives error #
+###########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.mysql56_temporal_format = 1;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.mysql56_temporal_format;
+
+
+--echo '#----------------------FN_DYNVARS_030_06------------------------#'
+####################################################################
+# Check if the value in GLOBAL Tables matches values in variable #
+####################################################################
+
+SELECT IF(@@global.mysql56_temporal_format, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='mysql56_temporal_format';
+
+
+--echo '#---------------------FN_DYNVARS_030_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.mysql56_temporal_format = TRUE;
+SELECT @@global.mysql56_temporal_format;
+SET @@global.mysql56_temporal_format = FALSE;
+SELECT @@global.mysql56_temporal_format;
+
+
+--echo '#---------------------FN_DYNVARS_030_08----------------------#'
+###############################################################################
+# Check if accessing variable without SCOPE points to same global variable #
+###############################################################################
+
+SET @@global.mysql56_temporal_format = 1;
+SELECT @@mysql56_temporal_format = @@global.mysql56_temporal_format;
+
+--echo '#---------------------FN_DYNVARS_030_09----------------------#'
+#############################################################################
+# Check if mysql56_temporal_format can be accessed with and without @@ sign #
+#############################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET mysql56_temporal_format = 1;
+--Error ER_UNKNOWN_TABLE
+SELECT global.mysql56_temporal_format;
+--Error ER_BAD_FIELD_ERROR
+SELECT mysql56_temporal_format = @@session.mysql56_temporal_format;
+
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.mysql56_temporal_format = @start_value;
+SELECT @@global.mysql56_temporal_format;
+
+
+#############################################################
+# END OF mysql56_temporal_format TESTS #
+#############################################################
diff --git a/mysql-test/suite/sys_vars/t/mysql56_temporal_format_func.test b/mysql-test/suite/sys_vars/t/mysql56_temporal_format_func.test
new file mode 100644
index 00000000..b36a4e03
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/mysql56_temporal_format_func.test
@@ -0,0 +1,66 @@
+#
+# This test checks that DATETIME, DATETIME(5), TIME(5) columns
+# occupy different data length depending on @@mysql56_temporal_format:
+#
+# Type MariaDB MySQL
+# ---- ------- -----
+# DATETIME 8 5
+# DATETIME(5) 7 8
+# TIME(5) 5 6
+#
+# The DATETIME(1-3,4,6) and TIME(0-4,6) data types use the same size
+# in both MariaDB and MySQL formats.
+# TIMESTAMP(0-6) also uses the same size in both formats.
+#
+# We use two columns in the tests below, to make sure the record length
+# is longer than 7. Records whose fields occupy less then 7 bytes use
+# 7 bytes anyway (assuming the default MAX_ROWS values), to store deleted
+# record list pointers.
+#
+
+--echo #
+--echo # MariaDB-5.3 format
+--echo #
+SET @@global.mysql56_temporal_format=false;
+CREATE TABLE t1 (a DATETIME NOT NULL, b DATETIME NOT NULL);
+INSERT INTO t1 VALUES ('2001-01-01 10:10:10','2001-01-01 10:10:10');
+SELECT * FROM t1;
+SELECT (AVG_ROW_LENGTH-1) DIV 2 AS FIELD_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DATETIME(5) NOT NULL, b DATETIME(5) NOT NULL);
+INSERT INTO t1 VALUES ('2001-01-01 10:10:10.12345','2001-01-01 10:10:10.12345');
+SELECT (AVG_ROW_LENGTH-1) DIV 2 AS FIELD_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TIME(5) NOT NULL,b TIME(5) NOT NULL);
+INSERT INTO t1 VALUES ('10:10:10.12345','10:10:10.12345');
+SELECT * FROM t1;
+SELECT (AVG_ROW_LENGTH-1) DIV 2 AS FIELD_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
+DROP TABLE t1;
+
+--echo #
+--echo # MySQL-5.6 format
+--echo #
+
+SET @@global.mysql56_temporal_format=true;
+CREATE TABLE t1 (a DATETIME NOT NULL, b DATETIME NOT NULL);
+INSERT INTO t1 VALUES ('2001-01-01 10:10:10','2001-01-01 10:10:10');
+SELECT * FROM t1;
+SELECT (AVG_ROW_LENGTH-1) DIV 2 AS FIELD_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DATETIME(5) NOT NULL, b DATETIME(5) NOT NULL);
+INSERT INTO t1 VALUES ('2001-01-01 10:10:10.12345','2001-01-01 10:10:10.12345');
+SELECT * FROM t1;
+SELECT (AVG_ROW_LENGTH-1) DIV 2 AS FIELD_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
+DROP TABLE t1;
+
+CREATE TABLE t1 (a TIME(5) NOT NULL,b TIME(5) NOT NULL);
+INSERT INTO t1 VALUES ('10:10:10.12345','10:10:10.12345');
+SELECT * FROM t1;
+SELECT (AVG_ROW_LENGTH-1) DIV 2 AS FIELD_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
+DROP TABLE t1;
+
+SET @@global.mysql56_temporal_format=DEFAULT;
diff --git a/mysql-test/suite/sys_vars/t/named_pipe_basic.test b/mysql-test/suite/sys_vars/t/named_pipe_basic.test
new file mode 100644
index 00000000..f3b83a71
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/named_pipe_basic.test
@@ -0,0 +1,19 @@
+--source include/windows.inc
+#
+# only global
+#
+select @@global.named_pipe;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.named_pipe;
+show global variables like 'named_pipe';
+show session variables like 'named_pipe';
+select * from information_schema.global_variables where variable_name='named_pipe';
+select * from information_schema.session_variables where variable_name='named_pipe';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global named_pipe=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session named_pipe=1;
diff --git a/mysql-test/suite/sys_vars/t/net_buffer_length_basic.test b/mysql-test/suite/sys_vars/t/net_buffer_length_basic.test
new file mode 100644
index 00000000..b8336910
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/net_buffer_length_basic.test
@@ -0,0 +1,203 @@
+################# mysql-test\t\net_buffer_length_basic.test ###################
+# #
+# Variable Name: net_buffer_length #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 16384 #
+# Range: 1024-1048576 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable net_buffer_length #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+
+#################################################################
+# START OF net_buffer_length TESTS #
+#################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.net_buffer_length;
+# Due to differences in results of linux and windows
+#SELECT @start_global_value;
+
+# give a known value to @@session.net_buffer_length by assigning to
+# @@global and setting up a new connection (for deterministic result
+# file diffing)
+SET @@global.net_buffer_length = DEFAULT;
+connect(con1,localhost,root,,);
+connection con1;
+
+--echo '#--------------------FN_DYNVARS_109_01-------------------------#'
+#################################################################
+# Display the DEFAULT value of net_buffer_length #
+#################################################################
+
+SET @@global.net_buffer_length = 10000;
+SET @@global.net_buffer_length = DEFAULT;
+SELECT @@global.net_buffer_length;
+
+--Error ER_VARIABLE_IS_READONLY
+SET @@session.net_buffer_length = 20000;
+--Error ER_VARIABLE_IS_READONLY
+SET @@session.net_buffer_length = DEFAULT;
+SELECT @@session.net_buffer_length;
+
+
+--echo '#--------------------FN_DYNVARS_109_02-------------------------#'
+########################################################################
+# Check the DEFAULT value of net_buffer_length #
+########################################################################
+
+SET @@global.net_buffer_length = DEFAULT;
+SELECT @@global.net_buffer_length = 16384;
+
+
+--echo '#--------------------FN_DYNVARS_109_03-------------------------#'
+###########################################################################
+# Change the value of net_buffer_length to a valid value for GLOBAL Scope #
+###########################################################################
+
+SET @@global.net_buffer_length = 1024;
+SELECT @@global.net_buffer_length;
+SET @@global.net_buffer_length = 1025;
+SELECT @@global.net_buffer_length;
+SET @@global.net_buffer_length = 1048576;
+SELECT @@global.net_buffer_length;
+SET @@global.net_buffer_length = 1048575;
+SELECT @@global.net_buffer_length;
+SET @@global.net_buffer_length = 65535;
+SELECT @@global.net_buffer_length;
+
+--echo '#--------------------FN_DYNVARS_109_04-------------------------#'
+############################################################################
+# Change the value of net_buffer_length to a valid value for SESSION Scope #
+############################################################################
+
+# SESSION net_buffer_length is now read-only; assignments skipped
+
+
+--echo '#------------------FN_DYNVARS_109_05-----------------------#'
+#############################################################
+# Change the value of net_buffer_length to an invalid value #
+#############################################################
+
+SET @@global.net_buffer_length = 0;
+SELECT @@global.net_buffer_length;
+SET @@global.net_buffer_length = -1024;
+SELECT @@global.net_buffer_length;
+SET @@global.net_buffer_length = 1023;
+SELECT @@global.net_buffer_length;
+SET @@global.net_buffer_length = 1048577;
+SELECT @@global.net_buffer_length;
+SET @@global.net_buffer_length = 104857633;
+SELECT @@global.net_buffer_length;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.net_buffer_length = 65530.34;
+SELECT @@global.net_buffer_length;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.net_buffer_length = test;
+SELECT @@global.net_buffer_length;
+
+# SESSION net_buffer_length is now read-only; assignments skipped
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.net_buffer_length = test;
+SELECT @@session.net_buffer_length;
+
+
+--echo '#------------------FN_DYNVARS_109_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT @@global.net_buffer_length = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='net_buffer_length';
+
+--echo '#------------------FN_DYNVARS_109_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.net_buffer_length = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='net_buffer_length';
+
+
+--echo '#------------------FN_DYNVARS_109_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.net_buffer_length = TRUE;
+SELECT @@global.net_buffer_length;
+SET @@global.net_buffer_length = FALSE;
+SELECT @@global.net_buffer_length;
+
+
+--echo '#---------------------FN_DYNVARS_109_09----------------------#'
+#################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+#################################################################################
+
+SET @@global.net_buffer_length = 2048;
+SELECT @@net_buffer_length = @@global.net_buffer_length;
+
+
+--echo '#---------------------FN_DYNVARS_109_10----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+# SESSION net_buffer_length is now read-only; assignments skipped
+
+
+--echo '#---------------------FN_DYNVARS_109_11----------------------#'
+############################################################################
+# Check if net_buffer_length can be accessed with and without @@ sign #
+############################################################################
+
+# SESSION net_buffer_length is now read-only; assignments skipped
+SELECT @@net_buffer_length;
+--Error ER_UNKNOWN_TABLE
+SELECT local.net_buffer_length;
+--Error ER_UNKNOWN_TABLE
+SELECT session.net_buffer_length;
+--Error ER_BAD_FIELD_ERROR
+SELECT net_buffer_length = @@session.net_buffer_length;
+
+
+####################################
+# Restore initial value #
+####################################
+
+connection default;
+
+SET @@global.net_buffer_length = @start_global_value;
+# Due to differences in results of linux and windows
+#SELECT @@global.net_buffer_length;
+
+
+######################################################
+# END OF net_buffer_length TESTS #
+######################################################
diff --git a/mysql-test/suite/sys_vars/t/net_read_timeout_basic.test b/mysql-test/suite/sys_vars/t/net_read_timeout_basic.test
new file mode 100644
index 00000000..0eb78e41
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/net_read_timeout_basic.test
@@ -0,0 +1,206 @@
+############## mysql-test\t\net_read_timeout_basic.test ###############
+# #
+# Variable Name: net_read_timeout #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 30 #
+# Min Vlue: 1 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable net_read_timeout #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+
+#####################################################################
+# START OF net_read_timeout TESTS #
+#####################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.net_read_timeout;
+SELECT @start_global_value;
+SET @start_session_value = @@session.net_read_timeout;
+SELECT @start_session_value;
+
+
+--echo '#--------------------FN_DYNVARS_110_01-------------------------#'
+#####################################################################
+# Display the DEFAULT value of net_read_timeout #
+#####################################################################
+
+SET @@global.net_read_timeout = 100;
+SET @@global.net_read_timeout = DEFAULT;
+SELECT @@global.net_read_timeout;
+
+SET @@session.net_read_timeout = 200;
+SET @@session.net_read_timeout = DEFAULT;
+SELECT @@session.net_read_timeout;
+
+
+--echo '#--------------------FN_DYNVARS_110_02-------------------------#'
+########################################################################
+# Check the DEFAULT value of net_read_timeout #
+########################################################################
+
+SET @@global.net_read_timeout = DEFAULT;
+SELECT @@global.net_read_timeout = 30;
+
+SET @@session.net_read_timeout = DEFAULT;
+SELECT @@session.net_read_timeout = 30;
+
+
+--echo '#--------------------FN_DYNVARS_110_03-------------------------#'
+##################################################################################
+# Change the value of net_read_timeout to a valid value for GLOBAL Scope #
+##################################################################################
+
+SET @@global.net_read_timeout = 1;
+SELECT @@global.net_read_timeout;
+SET @@global.net_read_timeout = 60020;
+SELECT @@global.net_read_timeout;
+SET @@global.net_read_timeout = 65535;
+SELECT @@global.net_read_timeout;
+
+
+--echo '#--------------------FN_DYNVARS_110_04-------------------------#'
+###################################################################################
+# Change the value of net_read_timeout to a valid value for SESSION Scope #
+###################################################################################
+
+SET @@session.net_read_timeout = 1;
+SELECT @@session.net_read_timeout;
+SET @@session.net_read_timeout = 50050;
+SELECT @@session.net_read_timeout;
+SET @@session.net_read_timeout = 65535;
+SELECT @@session.net_read_timeout;
+
+
+--echo '#------------------FN_DYNVARS_110_05-----------------------#'
+####################################################################
+# Change the value of net_read_timeout to an invalid value #
+####################################################################
+
+SET @@global.net_read_timeout = 0;
+SELECT @@global.net_read_timeout;
+SET @@global.net_read_timeout = -1024;
+SELECT @@global.net_read_timeout;
+SET @@global.net_read_timeout = 655360354;
+SELECT @@global.net_read_timeout;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.net_read_timeout = 65530.34;
+SELECT @@global.net_read_timeout;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.net_read_timeout = test;
+SELECT @@global.net_read_timeout;
+
+SET @@session.net_read_timeout = 0;
+SELECT @@session.net_read_timeout;
+SET @@session.net_read_timeout = -2;
+SELECT @@session.net_read_timeout;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.net_read_timeout = 65530.34;
+SET @@session.net_read_timeout = 6555015425;
+SELECT @@session.net_read_timeout;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.net_read_timeout = test;
+SELECT @@session.net_read_timeout;
+
+
+--echo '#------------------FN_DYNVARS_110_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT @@global.net_read_timeout = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='net_read_timeout';
+
+--echo '#------------------FN_DYNVARS_110_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.net_read_timeout = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='net_read_timeout';
+
+
+--echo '#------------------FN_DYNVARS_110_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.net_read_timeout = TRUE;
+SELECT @@global.net_read_timeout;
+SET @@global.net_read_timeout = FALSE;
+SELECT @@global.net_read_timeout;
+
+
+--echo '#---------------------FN_DYNVARS_110_09----------------------#'
+####################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+####################################################################################
+
+SET @@global.net_read_timeout = 10;
+SELECT @@net_read_timeout = @@global.net_read_timeout;
+
+
+--echo '#---------------------FN_DYNVARS_110_10----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@net_read_timeout = 100;
+SELECT @@net_read_timeout = @@local.net_read_timeout;
+SELECT @@local.net_read_timeout = @@session.net_read_timeout;
+
+
+--echo '#---------------------FN_DYNVARS_110_11----------------------#'
+###################################################################################
+# Check if net_read_timeout can be accessed with and without @@ sign #
+###################################################################################
+
+SET net_read_timeout = 1;
+SELECT @@net_read_timeout;
+--Error ER_UNKNOWN_TABLE
+SELECT local.net_read_timeout;
+--Error ER_UNKNOWN_TABLE
+SELECT session.net_read_timeout;
+--Error ER_BAD_FIELD_ERROR
+SELECT net_read_timeout = @@session.net_read_timeout;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.net_read_timeout = @start_global_value;
+SELECT @@global.net_read_timeout;
+SET @@session.net_read_timeout = @start_session_value;
+SELECT @@session.net_read_timeout;
+
+
+#############################################################
+# END OF net_read_timeout TESTS #
+#############################################################
+
diff --git a/mysql-test/suite/sys_vars/t/net_retry_count_basic.test b/mysql-test/suite/sys_vars/t/net_retry_count_basic.test
new file mode 100644
index 00000000..46b8d035
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/net_retry_count_basic.test
@@ -0,0 +1,215 @@
+############## mysql-test\t\net_retry_count_basic.test ###############
+# #
+# Variable Name: net_retry_count #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value:10 #
+# Range: 1-4294967295 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable net_retry_count #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+###############################################################
+# START OF net_retry_count TESTS #
+###############################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.net_retry_count;
+SELECT @start_global_value;
+SET @start_session_value = @@session.net_retry_count;
+SELECT @start_session_value;
+
+
+--echo '#--------------------FN_DYNVARS_111_01-------------------------#'
+###############################################################
+# Display the DEFAULT value of net_retry_count #
+###############################################################
+
+SET @@global.net_retry_count = 100;
+SET @@global.net_retry_count = DEFAULT;
+SELECT @@global.net_retry_count;
+
+SET @@session.net_retry_count = 200;
+SET @@session.net_retry_count = DEFAULT;
+SELECT @@session.net_retry_count;
+
+
+--echo '#--------------------FN_DYNVARS_111_02-------------------------#'
+###############################################################
+# Check the DEFAULT value of net_retry_count #
+###############################################################
+
+SET @@global.net_retry_count = DEFAULT;
+SELECT @@global.net_retry_count = 10;
+
+SET @@session.net_retry_count = DEFAULT;
+SELECT @@session.net_retry_count = 10;
+
+
+--echo '#--------------------FN_DYNVARS_111_03-------------------------#'
+#########################################################################
+# Change the value of net_retry_count to a valid value for GLOBAL Scope #
+#########################################################################
+
+SET @@global.net_retry_count = 1;
+SELECT @@global.net_retry_count;
+SET @@global.net_retry_count = 2;
+SELECT @@global.net_retry_count;
+SET @@global.net_retry_count = 4294967295;
+SELECT @@global.net_retry_count;
+SET @@global.net_retry_count = 4294967294;
+SELECT @@global.net_retry_count;
+SET @@global.net_retry_count = 65536;
+SELECT @@global.net_retry_count;
+
+--echo '#--------------------FN_DYNVARS_111_04-------------------------#'
+##########################################################################
+# Change the value of net_retry_count to a valid value for SESSION Scope #
+##########################################################################
+
+SET @@session.net_retry_count = 1;
+SELECT @@session.net_retry_count;
+SET @@session.net_retry_count = 2;
+SELECT @@session.net_retry_count;
+SET @@session.net_retry_count = 65535;
+SELECT @@session.net_retry_count;
+SET @@session.net_retry_count = 4294967295;
+SELECT @@session.net_retry_count;
+SET @@session.net_retry_count = 4294967294;
+SELECT @@session.net_retry_count;
+
+--echo '#------------------FN_DYNVARS_111_05-----------------------#'
+###########################################################
+# Change the value of net_retry_count to an invalid value #
+###########################################################
+
+SET @@global.net_retry_count = 0;
+SELECT @@global.net_retry_count;
+SET @@global.net_retry_count = -1024;
+SELECT @@global.net_retry_count;
+SET @@global.net_retry_count = 4294967296;
+SELECT @@global.net_retry_count;
+SET @@global.net_retry_count = 429496729500;
+SELECT @@global.net_retry_count;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.net_retry_count = 65530.34;
+SELECT @@global.net_retry_count;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.net_retry_count = test;
+SELECT @@global.net_retry_count;
+
+SET @@session.net_retry_count = 0;
+SELECT @@session.net_retry_count;
+SET @@session.net_retry_count = -2;
+SELECT @@session.net_retry_count;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.net_retry_count = 65530.34;
+SET @@session.net_retry_count = 6555015425;
+SELECT @@session.net_retry_count;
+SET @@session.net_retry_count = 4294967296;
+SELECT @@session.net_retry_count;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.net_retry_count = test;
+SELECT @@session.net_retry_count;
+
+
+--echo '#------------------FN_DYNVARS_111_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT @@global.net_retry_count = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='net_retry_count';
+
+--echo '#------------------FN_DYNVARS_111_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.net_retry_count = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='net_retry_count';
+
+
+--echo '#------------------FN_DYNVARS_111_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.net_retry_count = TRUE;
+SELECT @@global.net_retry_count;
+SET @@global.net_retry_count = FALSE;
+SELECT @@global.net_retry_count;
+
+
+--echo '#---------------------FN_DYNVARS_111_09----------------------#'
+#################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+#################################################################################
+
+SET @@global.net_retry_count = 10;
+SELECT @@net_retry_count = @@global.net_retry_count;
+
+
+--echo '#---------------------FN_DYNVARS_111_10----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@net_retry_count = 100;
+SELECT @@net_retry_count = @@local.net_retry_count;
+SELECT @@local.net_retry_count = @@session.net_retry_count;
+
+
+--echo '#---------------------FN_DYNVARS_111_11----------------------#'
+##########################################################################
+# Check if net_retry_count can be accessed with and without @@ sign #
+##########################################################################
+
+SET net_retry_count = 1;
+SELECT @@net_retry_count;
+--Error ER_UNKNOWN_TABLE
+SELECT local.net_retry_count;
+--Error ER_UNKNOWN_TABLE
+SELECT session.net_retry_count;
+--Error ER_BAD_FIELD_ERROR
+SELECT net_retry_count = @@session.net_retry_count;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.net_retry_count = @start_global_value;
+SELECT @@global.net_retry_count;
+SET @@session.net_retry_count = @start_session_value;
+SELECT @@session.net_retry_count;
+
+
+####################################################
+# END OF net_retry_count TESTS #
+####################################################
+
diff --git a/mysql-test/suite/sys_vars/t/net_write_timeout_basic.test b/mysql-test/suite/sys_vars/t/net_write_timeout_basic.test
new file mode 100644
index 00000000..bd8a8b05
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/net_write_timeout_basic.test
@@ -0,0 +1,202 @@
+############## mysql-test\t\net_write_timeout_basic.test ###############
+# #
+# Variable Name: net_write_timeout #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 60 #
+# Min Value: 1 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable net_write_timeout #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+
+#################################################################
+# START OF net_write_timeout TESTS #
+#################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.net_write_timeout;
+SELECT @start_global_value;
+SET @start_session_value = @@session.net_write_timeout;
+SELECT @start_session_value;
+
+
+--echo '#--------------------FN_DYNVARS_112_01-------------------------#'
+#################################################################
+# Display the DEFAULT value of net_write_timeout #
+#################################################################
+
+SET @@global.net_write_timeout = 100;
+SET @@global.net_write_timeout = DEFAULT;
+SELECT @@global.net_write_timeout;
+
+SET @@session.net_write_timeout = 200;
+SET @@session.net_write_timeout = DEFAULT;
+SELECT @@session.net_write_timeout;
+
+
+--echo '#--------------------FN_DYNVARS_112_02-------------------------#'
+#################################################################
+# Check the DEFAULT value of net_write_timeout #
+#################################################################
+
+SET @@global.net_write_timeout = DEFAULT;
+SELECT @@global.net_write_timeout = 60;
+
+SET @@session.net_write_timeout = DEFAULT;
+SELECT @@session.net_write_timeout = 60;
+
+
+--echo '#--------------------FN_DYNVARS_112_03-------------------------#'
+###########################################################################
+# Change the value of net_write_timeout to a valid value for GLOBAL Scope #
+###########################################################################
+
+SET @@global.net_write_timeout = 1;
+SELECT @@global.net_write_timeout;
+SET @@global.net_write_timeout = 60020;
+SELECT @@global.net_write_timeout;
+SET @@global.net_write_timeout = 65535;
+SELECT @@global.net_write_timeout;
+
+
+--echo '#--------------------FN_DYNVARS_112_04-------------------------#'
+############################################################################
+# Change the value of net_write_timeout to a valid value for SESSION Scope #
+############################################################################
+
+SET @@session.net_write_timeout = 1;
+SELECT @@session.net_write_timeout;
+SET @@session.net_write_timeout = 50050;
+SELECT @@session.net_write_timeout;
+SET @@session.net_write_timeout = 65535;
+SELECT @@session.net_write_timeout;
+
+
+--echo '#------------------FN_DYNVARS_112_05-----------------------#'
+#############################################################
+# Change the value of net_write_timeout to an invalid value #
+#############################################################
+
+SET @@global.net_write_timeout = 0;
+SELECT @@global.net_write_timeout;
+SET @@global.net_write_timeout = -1024;
+SELECT @@global.net_write_timeout;
+SET @@global.net_write_timeout = 655360354;
+SELECT @@global.net_write_timeout;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.net_write_timeout = 65530.34;
+SELECT @@global.net_write_timeout;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.net_write_timeout = test;
+SELECT @@global.net_write_timeout;
+
+SET @@session.net_write_timeout = 0;
+SELECT @@session.net_write_timeout;
+SET @@session.net_write_timeout = -2;
+SELECT @@session.net_write_timeout;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.net_write_timeout = 65530.34;
+SET @@session.net_write_timeout = 6555015425;
+SELECT @@session.net_write_timeout;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.net_write_timeout = test;
+SELECT @@session.net_write_timeout;
+
+
+--echo '#------------------FN_DYNVARS_112_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT @@global.net_write_timeout = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='net_write_timeout';
+
+--echo '#------------------FN_DYNVARS_112_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.net_write_timeout = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='net_write_timeout';
+
+
+--echo '#------------------FN_DYNVARS_112_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.net_write_timeout = TRUE;
+SELECT @@global.net_write_timeout;
+SET @@global.net_write_timeout = FALSE;
+SELECT @@global.net_write_timeout;
+
+
+--echo '#---------------------FN_DYNVARS_112_09----------------------#'
+#################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+#################################################################################
+
+SET @@global.net_write_timeout = 10;
+SELECT @@net_write_timeout = @@global.net_write_timeout;
+
+
+--echo '#---------------------FN_DYNVARS_112_10----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@net_write_timeout = 100;
+SELECT @@net_write_timeout = @@local.net_write_timeout;
+SELECT @@local.net_write_timeout = @@session.net_write_timeout;
+
+
+--echo '#---------------------FN_DYNVARS_112_11----------------------#'
+############################################################################
+# Check if net_write_timeout can be accessed with and without @@ sign #
+############################################################################
+
+SET net_write_timeout = 1;
+SELECT @@net_write_timeout;
+--Error ER_UNKNOWN_TABLE
+SELECT local.net_write_timeout;
+--Error ER_UNKNOWN_TABLE
+SELECT session.net_write_timeout;
+--Error ER_BAD_FIELD_ERROR
+SELECT net_write_timeout = @@session.net_write_timeout;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.net_write_timeout = @start_global_value;
+SELECT @@global.net_write_timeout;
+SET @@session.net_write_timeout = @start_session_value;
+SELECT @@session.net_write_timeout;
+
+
+######################################################
+# END OF net_write_timeout TESTS #
+######################################################
+
diff --git a/mysql-test/suite/sys_vars/t/old_alter_table_basic.test b/mysql-test/suite/sys_vars/t/old_alter_table_basic.test
new file mode 100644
index 00000000..9a6cb477
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/old_alter_table_basic.test
@@ -0,0 +1,68 @@
+
+#
+# 2010-01-20 OBN - added check of I_S values after variable value changed
+#
+
+SET @start_global_value = @@global.old_alter_table;
+SELECT @start_global_value;
+
+#
+# exists as global and session
+#
+select @@global.old_alter_table;
+select @@session.old_alter_table;
+show global variables like 'old_alter_table';
+show session variables like 'old_alter_table';
+select * from information_schema.global_variables where variable_name='old_alter_table';
+select * from information_schema.session_variables where variable_name='old_alter_table';
+
+#
+# show that it's writable
+#
+set global old_alter_table=1;
+set session old_alter_table=1;
+select @@global.old_alter_table;
+select @@session.old_alter_table;
+show global variables like 'old_alter_table';
+show session variables like 'old_alter_table';
+select * from information_schema.global_variables where variable_name='old_alter_table';
+select * from information_schema.session_variables where variable_name='old_alter_table';
+
+set global old_alter_table=2;
+set session old_alter_table=2;
+select @@global.old_alter_table;
+select @@session.old_alter_table;
+show global variables like 'old_alter_table';
+show session variables like 'old_alter_table';
+select * from information_schema.global_variables where variable_name='old_alter_table';
+select * from information_schema.session_variables where variable_name='old_alter_table';
+
+set global old_alter_table=3;
+set session old_alter_table=3;
+select @@global.old_alter_table;
+select @@session.old_alter_table;
+show global variables like 'old_alter_table';
+show session variables like 'old_alter_table';
+select * from information_schema.global_variables where variable_name='old_alter_table';
+select * from information_schema.session_variables where variable_name='old_alter_table';
+
+set global old_alter_table=4;
+set session old_alter_table=4;
+select @@global.old_alter_table;
+select @@session.old_alter_table;
+show global variables like 'old_alter_table';
+show session variables like 'old_alter_table';
+select * from information_schema.global_variables where variable_name='old_alter_table';
+select * from information_schema.session_variables where variable_name='old_alter_table';
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global old_alter_table=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global old_alter_table=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global old_alter_table="foo";
+
+SET @@global.old_alter_table = @start_global_value;
+SELECT @@global.old_alter_table;
diff --git a/mysql-test/suite/sys_vars/t/old_basic.test b/mysql-test/suite/sys_vars/t/old_basic.test
new file mode 100644
index 00000000..f1bb5a52
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/old_basic.test
@@ -0,0 +1,15 @@
+#
+# show the global and session values;
+#
+select @@global.old;
+select @@session.old;
+show global variables like 'old';
+show session variables like 'old';
+select * from information_schema.global_variables where variable_name='old';
+select * from information_schema.session_variables where variable_name='old';
+
+set global old=1;
+set session old=1;
+select @@global.old;
+select @@session.old;
+set @@global.old=DEFAULT;
diff --git a/mysql-test/suite/sys_vars/t/old_mode_basic.test b/mysql-test/suite/sys_vars/t/old_mode_basic.test
new file mode 100644
index 00000000..631d6387
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/old_mode_basic.test
@@ -0,0 +1,352 @@
+#################### mysql-test\t\sql_mode_basic.test #########################
+# #
+# Variable Name: old_mode #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: enumeration #
+# Default Value: YES #
+# Valid Values : NO_DUP_KEY_WARNINGS_WITH_IGNORE, NO_PROGRESS_INFO #
+# #
+# #
+# Description: Test Cases of Dynamic System Variable old_mode #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+################################################################
+# START OF sql_mode TESTS #
+################################################################
+
+
+###################################################################
+# Saving initial value of sql_mode in a temporary variable #
+###################################################################
+
+SET @global_start_value = @@global.old_mode;
+SELECT @global_start_value;
+
+SET @session_start_value = @@session.old_mode;
+SELECT @session_start_value;
+
+--echo '#--------------------FN_DYNVARS_152_01------------------------#'
+################################################################
+# Display the DEFAULT value of old_mode #
+################################################################
+
+SET @@global.old_mode = "NO_PROGRESS_INFO";
+SET @@global.old_mode = DEFAULT;
+SELECT @@global.old_mode;
+
+SET @@session.old_mode = "NO_PROGRESS_INFO";
+SET @@session.old_mode = DEFAULT;
+SELECT @@session.old_mode;
+
+--echo '#---------------------FN_DYNVARS_152_02-------------------------#'
+#########################################################
+# Check if NULL or empty value is accepeted #
+#########################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.old_mode = NULL;
+
+# resets sql mode to nothing
+SET @@global.old_mode = '';
+SELECT @@global.old_mode;
+
+SET @@global.old_mode = ' ';
+SELECT @@global.old_mode;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.old_mode = NULL;
+
+SET @@session.old_mode = '';
+SELECT @@session.old_mode;
+
+SET @@session.old_mode = ' ';
+SELECT @@session.old_mode;
+
+
+--echo '#--------------------FN_DYNVARS_152_03------------------------#'
+########################################################################
+# Change the value of old_mode to a valid value #
+########################################################################
+
+# sql modes ref: http://dev.mysql.com/doc/refman/5.1/en/server-sql-mode.html
+
+# check valid values for global
+
+SET @@global.old_mode = NO_PROGRESS_INFO;
+SELECT @@global.old_mode;
+SET @@global.old_mode = NO_DUP_KEY_WARNINGS_WITH_IGNORE;
+SELECT @@global.old_mode;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.old_mode = OFF;
+
+#check valid values for session
+SET @@session.old_mode = NO_PROGRESS_INFO;
+SELECT @@session.old_mode;
+SET @@session.old_mode = NO_DUP_KEY_WARNINGS_WITH_IGNORE;
+SELECT @@session.old_mode;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.old_mode = OFF;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.old_mode = '?';
+SELECT @@global.old_mode;
+
+--echo '#--------------------FN_DYNVARS_152_04-------------------------#'
+###########################################################################
+# Change the value of old_mode to invalid value #
+###########################################################################
+
+# invalid values for global
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.old_mode = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.old_mode = ASCII;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.old_mode = NON_TRADITIONAL;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.old_mode = 'OF';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.old_mode = NONE;
+
+#invalid values for session
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.old_mode = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.old_mode = ANSI_SINGLE_QUOTES;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.old_mode = 'ON';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.old_mode = 'OF';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.old_mode = DISABLE;
+
+
+--echo '#-------------------FN_DYNVARS_152_05----------------------------#'
+#########################################################################
+# Check if the value in session Table matches value in variable #
+#########################################################################
+
+SELECT @@session.old_mode = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='old_mode';
+
+--echo '#----------------------FN_DYNVARS_152_06------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#########################################################################
+
+SELECT @@global.old_mode = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='old_mode';
+
+
+--echo '#---------------------FN_DYNVARS_152_07-------------------------#'
+###################################################################
+# Check if numbers can be used on variable #
+###################################################################
+
+# test if variable accepts 0,1,2
+SET @@global.old_mode = 0;
+SELECT @@global.old_mode;
+
+SET @@global.old_mode = 1;
+SELECT @@global.old_mode;
+
+SET @@global.old_mode = 2;
+SELECT @@global.old_mode;
+
+SET @@global.old_mode = 4;
+SELECT @@global.old_mode;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.old_mode = 64;
+SELECT @@global.old_mode;
+
+# use of decimal values
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.old_mode = 0.4;
+
+--echo '#---------------------FN_DYNVARS_152_08----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.old_mode = TRUE;
+SELECT @@global.old_mode;
+SET @@global.old_mode = FALSE;
+SELECT @@global.old_mode;
+
+--echo '#---------------------FN_DYNVARS_152_09----------------------#'
+#########################################################################
+# Check if old_mode can be accessed with and without @@ sign #
+#########################################################################
+
+SET old_mode = 'NO_PROGRESS_INFO';
+
+SET session old_mode = 1;
+SELECT @@old_mode;
+
+SET global old_mode = 0;
+SELECT @@global.old_mode;
+
+--echo '#---------------------FN_DYNVARS_152_10----------------------#'
+#######################################################################
+# Check if old_mode values can be combined as specified #
+#######################################################################
+
+SET @@session.old_mode = 'NO_PROGRESS_INFO,NO_DUP_KEY_WARNINGS_WITH_IGNORE';
+SELECT @@session.old_mode;
+
+SET @@global.old_mode = 'NO_DUP_KEY_WARNINGS_WITH_IGNORE,NO_PROGRESS_INFO';
+SELECT @@global.old_mode;
+
+#try combining invalid mode with correct mode
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.old_mode = 'NO_PROGRESS_INFO,NO_SUCH_MODE';
+
+#zero-length values are ok
+SET @@old_mode=',';
+SELECT @@old_mode;
+SET @@old_mode=',,,,NO_PROGRESS_INFO,,,';
+SELECT @@old_mode;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@old_mode=',,,,FOOBAR,,,,,';
+SELECT @@old_mode;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.old_mode = @global_start_value;
+SELECT @@global.old_mode;
+
+SET @@session.old_mode = @session_start_value;
+SELECT @@session.old_mode;
+
+--echo #
+--echo # Beginning of 10.6 test
+--echo #
+--echo # MDEV-8334: Rename utf8 to utf8mb3
+--echo #
+--echo # Save and display old values
+SET @save_old_mode = @@OLD_MODE;
+SET @save_character_set_server = @@character_set_server;
+SET @save_character_set_client = @@character_set_client;
+SET @save_character_set_results = @@character_set_results;
+SET @save_character_set_connection = @@character_set_connection;
+SET @save_character_set_filesystem = @@character_set_filesystem;
+SET @save_character_set_database = @@character_set_database;
+SET @save_collation_connection = @@collation_connection;
+SET @save_collation_server = @@collation_server;
+SET @save_collation_database = @@collation_database;
+SELECT @@OLD_MODE;
+SELECT @@character_set_server,@@character_set_client,@@character_set_results,
+@@character_set_connection, @@character_set_filesystem, @@character_set_database,
+@@collation_connection, @@collation_server, @@collation_database;
+--echo #
+--echo # UTF8MB3 alias for UTF8
+--echo #
+SET @@character_set_server = utf8;
+SET @@character_set_client = utf8;
+SET @@character_set_results = utf8;
+SET @@character_set_connection = utf8;
+SET @@character_set_filesystem = utf8;
+SET @@character_set_database = utf8;
+SET @@collation_connection = utf8_general_ci;
+SET @@collation_server = utf8_unicode_ci;
+SET @@collation_database = utf8_bin;
+SELECT @@character_set_server, @@character_set_client, @@character_set_results,
+@@character_set_connection, @@character_set_filesystem, @@character_set_database,
+@@collation_connection, @@collation_server, @@collation_database;
+CREATE DATABASE db1 CHARACTER SET = 'utf8' COLLATE = 'utf8_general_ci';
+ALTER DATABASE db1 CHARACTER SET = 'utf8' COLLATE = 'utf8_unicode_ci';
+CREATE TABLE tb1 (id1 INT) CHARACTER SET 'utf8' COLLATE 'utf8_bin';
+SHOW CREATE TABLE tb1;
+DROP TABLE tb1;
+DROP DATABASE db1;
+--echo #
+--echo # UTF8MB4 is alias for UTF8
+--echo #
+SET @@OLD_MODE=0;
+SET @@character_set_server = utf8;
+SET @@character_set_client = utf8;
+SET @@character_set_results = utf8;
+SET @@character_set_connection = utf8;
+SET @@character_set_filesystem = utf8;
+SET @@character_set_database = utf8;
+SET @@collation_connection = utf8_general_ci;
+SET @@collation_server = utf8_unicode_ci;
+SET @@collation_database = utf8_bin;
+SELECT @@character_set_server, @@character_set_client, @@character_set_results,
+@@character_set_connection, @@character_set_filesystem, @@character_set_database,
+@@collation_connection, @@collation_server, @@collation_database;
+CREATE DATABASE db1 CHARACTER SET = 'utf8' COLLATE = 'utf8_general_ci';
+ALTER DATABASE db1 CHARACTER SET = 'utf8' COLLATE = 'utf8_unicode_ci';
+CREATE TABLE tb1 (id1 INT) CHARACTER SET 'utf8' COLLATE 'utf8_bin';
+SHOW CREATE TABLE tb1;
+DROP TABLE tb1;
+DROP DATABASE db1;
+SET @@OLD_MODE = @save_old_mode;
+SET @@character_set_server = @save_character_set_server;
+SET @@character_set_client = @save_character_set_client;
+SET @@character_set_results = @save_character_set_results;
+SET @@character_set_connection = @save_character_set_connection;
+SET @@character_set_filesystem = @save_character_set_filesystem;
+SET @@character_set_database = @save_character_set_database;
+SET @@collation_connection = @save_collation_connection;
+SET @@collation_server = @save_collation_server;
+SET @@collation_database = @save_collation_database;
+--echo #
+--echo # End of 10.6 test
+--echo #
+
+--echo #
+--echo # Beginning of 10.9 test
+--echo #
+--echo #
+--echo # MDEV-24920: Merge "old" SQL variable to "old_mode" sql variable
+--echo #
+
+--echo # Checking that setting old will also set old_mode
+SELECT @@OLD_MODE;
+
+SET old= 1;
+SELECT @@OLD_MODE;
+
+SET old= DEFAULT;
+SELECT @@OLD_MODE;
+
+--echo # Checking that old_mode can be set independently as well
+
+SELECT @@OLD_MODE;
+
+SET @save_old_mode = @@OLD_MODE;
+
+SET @@OLD_MODE= IGNORE_INDEX_ONLY_FOR_JOIN;
+SELECT @@OLD_MODE;
+
+SET @@OLD_MODE= COMPAT_5_1_CHECKSUM;
+SELECT @@OLD_MODE;
+
+SET @@OLD_MODE= @save_old_mode;
+
+--echo #
+--echo # End of 10.9 test
+--echo #
+################################################################
+# END OF old_mode TESTS #
+################################################################
diff --git a/mysql-test/suite/sys_vars/t/old_passwords_basic.test b/mysql-test/suite/sys_vars/t/old_passwords_basic.test
new file mode 100644
index 00000000..f4965ad7
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/old_passwords_basic.test
@@ -0,0 +1,217 @@
+############## mysql-test\t\old_passwords_basic.test ##########################
+# #
+# Variable Name: old_passwords #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: boolean #
+# Default Value: FALSE #
+# Range: #
+# #
+# #
+# Creation Date: 2008-02-14 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable old_passwords #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_old-passwords #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+###################################################
+# START OF old_passwords TESTS #
+###################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.old_passwords;
+SELECT @start_global_value;
+SET @start_session_value = @@session.old_passwords;
+SELECT @start_session_value;
+
+
+--echo '#--------------------FN_DYNVARS_114_01-------------------------#'
+###################################################
+# Display the DEFAULT value of old_passwords #
+###################################################
+
+SET @@global.old_passwords = ON;
+SET @@global.old_passwords = DEFAULT;
+SELECT @@global.old_passwords;
+
+SET @@session.old_passwords = ON;
+SET @@session.old_passwords = DEFAULT;
+SELECT @@session.old_passwords;
+
+
+--echo '#--------------------FN_DYNVARS_114_02-------------------------#'
+###################################################
+# Check the DEFAULT value of old_passwords #
+###################################################
+
+SET @@global.old_passwords = DEFAULT;
+SELECT @@global.old_passwords = FALSE;
+
+SET @@session.old_passwords = DEFAULT;
+SELECT @@session.old_passwords = FALSE;
+
+
+--echo '#--------------------FN_DYNVARS_114_03-------------------------#'
+#######################################################################
+# Change the value of old_passwords to a valid value for GLOBAL Scope #
+#######################################################################
+
+SET @@global.old_passwords = ON;
+SELECT @@global.old_passwords;
+SET @@global.old_passwords = OFF;
+SELECT @@global.old_passwords;
+SET @@global.old_passwords = 0;
+SELECT @@global.old_passwords;
+SET @@global.old_passwords = 1;
+SELECT @@global.old_passwords;
+SET @@global.old_passwords = TRUE;
+SELECT @@global.old_passwords;
+SET @@global.old_passwords = FALSE;
+SELECT @@global.old_passwords;
+
+
+
+--echo '#--------------------FN_DYNVARS_114_04-------------------------#'
+########################################################################
+# Change the value of old_passwords to a valid value for SESSION Scope #
+########################################################################
+
+SET @@session.old_passwords = ON;
+SELECT @@session.old_passwords;
+SET @@session.old_passwords = OFF;
+SELECT @@session.old_passwords;
+SET @@session.old_passwords = 0;
+SELECT @@session.old_passwords;
+SET @@session.old_passwords = 1;
+SELECT @@session.old_passwords;
+SET @@session.old_passwords = TRUE;
+SELECT @@session.old_passwords;
+SET @@session.old_passwords = FALSE;
+SELECT @@session.old_passwords;
+
+
+--echo '#------------------FN_DYNVARS_114_05-----------------------#'
+#########################################################
+# Change the value of old_passwords to an invalid value #
+#########################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.old_passwords = 'ONN';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.old_passwords = "OFFF";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.old_passwords = TTRUE;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.old_passwords = FELSE;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.old_passwords = -1024;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.old_passwords = 65536;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.old_passwords = 65530.34;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.old_passwords = test;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.old_passwords = ONN;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.old_passwords = ONF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.old_passwords = OF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.old_passwords = 'OFN';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.old_passwords = -2;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.old_passwords = 65530.34;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.old_passwords = 65550;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.old_passwords = test;
+
+
+--echo '#------------------FN_DYNVARS_114_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT IF(@@global.old_passwords, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='old_passwords';
+
+--echo '#------------------FN_DYNVARS_114_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT IF(@@session.old_passwords, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='old_passwords';
+
+
+--echo '#---------------------FN_DYNVARS_114_08----------------------#'
+###############################################################################
+# Check if global and session variable are independent of each other #
+###############################################################################
+
+SET @@old_passwords = OFF;
+SET @@global.old_passwords = ON;
+SELECT @@old_passwords = @@global.old_passwords;
+
+
+--echo '#---------------------FN_DYNVARS_114_09----------------------#'
+###############################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points #
+# to same session variable #
+###############################################################################
+
+SET @@old_passwords = ON;
+SELECT @@old_passwords = @@local.old_passwords;
+SELECT @@local.old_passwords = @@session.old_passwords;
+
+
+--echo '#---------------------FN_DYNVARS_114_10----------------------#'
+########################################################################
+# Check if old_passwords can be accessed with and without @@ sign #
+########################################################################
+
+SET old_passwords = 1;
+SELECT @@old_passwords;
+--Error ER_UNKNOWN_TABLE
+SELECT local.old_passwords;
+--Error ER_UNKNOWN_TABLE
+SELECT session.old_passwords;
+--Error ER_BAD_FIELD_ERROR
+SELECT old_passwords = @@session.old_passwords;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.old_passwords = @start_global_value;
+SELECT @@global.old_passwords;
+SET @@session.old_passwords = @start_session_value;
+SELECT @@session.old_passwords;
+
+
+##################################################
+# END OF old_passwords TESTS #
+##################################################
+
diff --git a/mysql-test/suite/sys_vars/t/old_passwords_func.test b/mysql-test/suite/sys_vars/t/old_passwords_func.test
new file mode 100644
index 00000000..bf1d7dcc
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/old_passwords_func.test
@@ -0,0 +1,109 @@
+############# mysql-test\t\old_passwords_func.test ############################
+# #
+# Variable Name: old_passwords #
+# Scope: GLOBAL & SESSION #
+# Access Type: Dynamic #
+# Data Type: BOOLEAN #
+# Default Value: FALSE #
+# Values: TRUE, FALSE #
+# #
+# #
+# Creation Date: 2008-03-12 #
+# Author: Sharique Abdullah #
+# #
+# Description: Test Cases of Dynamic System Variable "old_passwords" #
+# that checks behavior of this variable in the following ways #
+# * Functionality based on different values #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.0/en #
+# /server-options.html#option_mysqld_old-passwords #
+# #
+###############################################################################
+
+#
+# Setup
+#
+
+--source include/not_embedded.inc
+
+SET @global_old_passwords = @@GLOBAL.old_passwords;
+SET @session_old_passwords = @@SESSION.old_passwords;
+SET @global_secure_auth = @@GLOBAL.secure_auth;
+
+
+--echo '#------------------------FN_DYNVARS_115_01---------------------------#'
+
+connection default;
+
+#
+# 2 Users with FALSE value
+#
+
+CREATE USER 'userNewPass1'@'localhost' IDENTIFIED BY 'pass1';
+CREATE USER 'userNewPass2'@'localhost' IDENTIFIED BY 'pass2';
+
+SET GLOBAL old_passwords = TRUE;
+SET SESSION old_passwords = TRUE;
+
+#
+# 1 User with TRUE value
+#
+
+CREATE USER 'userOldPass'@'localhost' IDENTIFIED BY 'pass3';
+
+SET GLOBAL secure_auth = FALSE;
+
+connect (con1,localhost,userNewPass1,pass1,);
+SELECT CURRENT_USER();
+--echo userNewPass1@localhost Expected
+
+connect (con2,localhost,userNewPass2,pass2,);
+SELECT CURRENT_USER();
+--echo userNewPass2@localhost Expected
+
+connect (con3,localhost,userOldPass,pass3,);
+SELECT CURRENT_USER();
+--echo userOldPass@localhost Expected
+
+connection default;
+
+disconnect con1;
+disconnect con2;
+disconnect con3;
+
+--echo '#------------------------FN_DYNVARS_115_02---------------------------#'
+
+SET GLOBAL secure_auth = TRUE;
+
+connect (con1,localhost,userNewPass1,pass1,);
+SELECT CURRENT_USER();
+--echo userNewPass1@localhost Expected
+
+connect (con2,localhost,userNewPass2,pass2,);
+SELECT CURRENT_USER();
+--echo userNewPass2@localhost Expected
+
+--disable_query_log
+--error ER_SERVER_IS_IN_SECURE_AUTH_MODE
+connect (con3,localhost,userOldPass,pass3,);
+--enable_query_log
+--echo Expected Error 'Server is running in secure auth mode'
+SELECT CURRENT_USER();
+--echo userNewPass2@localhost Expected
+
+connection default;
+
+disconnect con1;
+disconnect con2;
+
+#
+# Cleanup
+#
+
+DROP USER 'userNewPass1'@'localhost';
+DROP USER 'userNewPass2'@'localhost';
+DROP USER 'userOldPass'@'localhost';
+
+SET @@GLOBAL.old_passwords = @global_old_passwords;
+SET @@SESSION.old_passwords = @session_old_passwords;
+SET @@GLOBAL.secure_auth = @global_secure_auth;
diff --git a/mysql-test/suite/sys_vars/t/open_files_limit_basic.test b/mysql-test/suite/sys_vars/t/open_files_limit_basic.test
new file mode 100644
index 00000000..bac3c8f6
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/open_files_limit_basic.test
@@ -0,0 +1,24 @@
+#
+# show the global and session values;
+#
+--replace_column 1 #
+select @@global.open_files_limit;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.open_files_limit;
+--replace_column 2 #
+show global variables like 'open_files_limit';
+--replace_column 2 #
+show session variables like 'open_files_limit';
+--replace_column 2 #
+select * from information_schema.global_variables where variable_name='open_files_limit';
+--replace_column 2 #
+select * from information_schema.session_variables where variable_name='open_files_limit';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global open_files_limit=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session open_files_limit=1;
+
diff --git a/mysql-test/suite/sys_vars/t/optimizer_prune_level_basic.test b/mysql-test/suite/sys_vars/t/optimizer_prune_level_basic.test
new file mode 100644
index 00000000..c857653b
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/optimizer_prune_level_basic.test
@@ -0,0 +1,233 @@
+############## mysql-test\t\optimizer_prune_level_basic.test ##################
+# #
+# Variable Name: optimizer_prune_level #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: boolean #
+# Default Value: 1 #
+# Range: #
+# #
+# #
+# Creation Date: 2008-02-14 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable optimizer_prune_level #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_optimizer_prune_level #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+###################################################
+# START OF optimizer_prune_level TESTS #
+###################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.optimizer_prune_level;
+SELECT @start_global_value;
+SET @start_session_value = @@session.optimizer_prune_level;
+SELECT @start_session_value;
+
+
+--echo '#--------------------FN_DYNVARS_115_01-------------------------#'
+###########################################################
+# Display the DEFAULT value of optimizer_prune_level #
+###########################################################
+
+SET @@global.optimizer_prune_level = 0;
+SET @@global.optimizer_prune_level = DEFAULT;
+SELECT @@global.optimizer_prune_level;
+
+SET @@session.optimizer_prune_level = 0;
+SET @@session.optimizer_prune_level = DEFAULT;
+SELECT @@session.optimizer_prune_level;
+
+
+--echo '#--------------------FN_DYNVARS_115_02-------------------------#'
+###########################################################
+# Check the DEFAULT value of optimizer_prune_level #
+###########################################################
+
+SET @@global.optimizer_prune_level = DEFAULT;
+SELECT @@global.optimizer_prune_level = 2;
+
+SET @@session.optimizer_prune_level = DEFAULT;
+SELECT @@session.optimizer_prune_level = 2;
+
+
+--echo '#--------------------FN_DYNVARS_115_03-------------------------#'
+###############################################################################
+# Change the value of optimizer_prune_level to a valid value for GLOBAL Scope #
+###############################################################################
+
+
+SELECT @@global.optimizer_prune_level;
+SET @@global.optimizer_prune_level = 0;
+SELECT @@global.optimizer_prune_level;
+SET @@global.optimizer_prune_level = 1;
+SELECT @@global.optimizer_prune_level;
+SET @@global.optimizer_prune_level = 2;
+SELECT @@global.optimizer_prune_level;
+SET @@global.optimizer_prune_level = TRUE;
+SELECT @@global.optimizer_prune_level;
+SET @@global.optimizer_prune_level = FALSE;
+SELECT @@global.optimizer_prune_level;
+
+
+
+--echo '#--------------------FN_DYNVARS_115_04-------------------------#'
+###############################################################################
+# Change the value of optimizer_prune_level to a valid value for SESSION Scope#
+###############################################################################
+
+SELECT @@session.optimizer_prune_level;
+SET @@session.optimizer_prune_level = 0;
+SELECT @@session.optimizer_prune_level;
+SET @@session.optimizer_prune_level = 1;
+SELECT @@session.optimizer_prune_level;
+SET @@session.optimizer_prune_level = 2;
+SELECT @@session.optimizer_prune_level;
+SET @@session.optimizer_prune_level = TRUE;
+SELECT @@session.optimizer_prune_level;
+SET @@session.optimizer_prune_level = FALSE;
+SELECT @@session.optimizer_prune_level;
+
+
+--echo '#------------------FN_DYNVARS_115_05-----------------------#'
+#################################################################
+# Change the value of optimizer_prune_level to an invalid value #
+#################################################################
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.optimizer_prune_level = ON;
+--echo 'Bug# 34840: Since it is not a boolean variable, it should give errors on 'ON' & 'OFF' values';
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.optimizer_prune_level = OFF;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.optimizer_prune_level = 'ONN';
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.optimizer_prune_level = "OFFF";
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.optimizer_prune_level = TTRUE;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.optimizer_prune_level = FELSE;
+
+SET @@global.optimizer_prune_level = -1024;
+SELECT @@global.optimizer_prune_level;
+
+--echo 'Bug# 34840: Since it is not a boolean variable, it should no give errors on numeric values';
+
+SET @@global.optimizer_prune_level = 65536;
+SET @@global.optimizer_prune_level = 3;
+select @@global.optimizer_prune_level;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.optimizer_prune_level = 65530.34;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.optimizer_prune_level = test;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.optimizer_prune_level = ON;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.optimizer_prune_level = OFF;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.optimizer_prune_level = ONN;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.optimizer_prune_level = ONF;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.optimizer_prune_level = ON;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.optimizer_prune_level = OF;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.optimizer_prune_level = 'OFN';
+SET @@session.optimizer_prune_level = -2;
+SELECT @@session.optimizer_prune_level;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.optimizer_prune_level = 65530.34;
+
+SET @@session.optimizer_prune_level = 65550;
+SELECT @@session.optimizer_prune_level;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.optimizer_prune_level = test;
+
+--echo '#------------------FN_DYNVARS_115_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT @@global.optimizer_prune_level = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='optimizer_prune_level';
+
+--echo '#------------------FN_DYNVARS_115_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.optimizer_prune_level = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='optimizer_prune_level';
+
+
+
+--echo '#---------------------FN_DYNVARS_115_08----------------------#'
+###############################################################################
+# Check if global and session variable are independent of each other #
+###############################################################################
+
+SET @@optimizer_prune_level = 0;
+SET @@global.optimizer_prune_level = 1;
+SELECT @@optimizer_prune_level = @@global.optimizer_prune_level;
+
+
+--echo '#---------------------FN_DYNVARS_115_09----------------------#'
+###############################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points #
+# to same session variable #
+###############################################################################
+
+SET @@optimizer_prune_level = 1;
+SELECT @@optimizer_prune_level = @@local.optimizer_prune_level;
+SELECT @@local.optimizer_prune_level = @@session.optimizer_prune_level;
+
+
+--echo '#---------------------FN_DYNVARS_115_10----------------------#'
+###############################################################################
+# Check if optimizer_prune_level can be accessed with and without @@ sign #
+###############################################################################
+
+SET optimizer_prune_level = 1;
+SELECT @@optimizer_prune_level;
+--Error ER_UNKNOWN_TABLE
+SELECT local.optimizer_prune_level;
+--Error ER_UNKNOWN_TABLE
+SELECT session.optimizer_prune_level;
+--Error ER_BAD_FIELD_ERROR
+SELECT optimizer_prune_level = @@session.optimizer_prune_level;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.optimizer_prune_level = @start_global_value;
+SELECT @@global.optimizer_prune_level;
+SET @@session.optimizer_prune_level = @start_session_value;
+SELECT @@session.optimizer_prune_level;
+
+##########################################################
+# END OF optimizer_prune_level TESTS #
+##########################################################
+
diff --git a/mysql-test/suite/sys_vars/t/optimizer_search_depth_basic.test b/mysql-test/suite/sys_vars/t/optimizer_search_depth_basic.test
new file mode 100644
index 00000000..eda7992b
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/optimizer_search_depth_basic.test
@@ -0,0 +1,209 @@
+############## mysql-test\t\optimizer_search_depth_basic.test ###############
+# #
+# Variable Name: optimizer_search_depth #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 62 #
+# Range: - #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable optimizer_search_depth #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+######################################################################
+# START OF optimizer_search_depth TESTS #
+######################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.optimizer_search_depth;
+SELECT @start_global_value;
+SET @start_session_value = @@session.optimizer_search_depth;
+SELECT @start_session_value;
+
+
+--echo '#--------------------FN_DYNVARS_116_01-------------------------#'
+######################################################################
+# Display the DEFAULT value of optimizer_search_depth #
+######################################################################
+
+SET @@global.optimizer_search_depth = 100;
+SET @@global.optimizer_search_depth = DEFAULT;
+SELECT @@global.optimizer_search_depth;
+
+SET @@session.optimizer_search_depth = 200;
+SET @@session.optimizer_search_depth = DEFAULT;
+SELECT @@session.optimizer_search_depth;
+
+
+--echo '#--------------------FN_DYNVARS_116_02-------------------------#'
+######################################################################
+# Check the DEFAULT value of optimizer_search_depth #
+######################################################################
+
+SET @@global.optimizer_search_depth = DEFAULT;
+SELECT @@global.optimizer_search_depth = 62;
+
+SET @@session.optimizer_search_depth = DEFAULT;
+SELECT @@session.optimizer_search_depth = 62;
+
+
+--echo '#--------------------FN_DYNVARS_116_03-------------------------#'
+################################################################################
+# Change the value of optimizer_search_depth to a valid value for GLOBAL Scope #
+################################################################################
+
+SET @@global.optimizer_search_depth = 0;
+SELECT @@global.optimizer_search_depth;
+SET @@global.optimizer_search_depth = 1;
+SELECT @@global.optimizer_search_depth;
+SET @@global.optimizer_search_depth = 62;
+SELECT @@global.optimizer_search_depth;
+SET @@global.optimizer_search_depth = 63;
+SELECT @@global.optimizer_search_depth;
+
+
+--echo '#--------------------FN_DYNVARS_116_04-------------------------#'
+#################################################################################
+# Change the value of optimizer_search_depth to a valid value for SESSION Scope #
+#################################################################################
+
+SET @@session.optimizer_search_depth = 0;
+SELECT @@session.optimizer_search_depth;
+SET @@session.optimizer_search_depth = 1;
+SELECT @@session.optimizer_search_depth;
+SET @@session.optimizer_search_depth = 62;
+SELECT @@session.optimizer_search_depth;
+SET @@session.optimizer_search_depth = 63;
+SELECT @@session.optimizer_search_depth;
+
+
+--echo '#------------------FN_DYNVARS_116_05-----------------------#'
+##################################################################
+# Change the value of optimizer_search_depth to an invalid value #
+##################################################################
+
+SET @@global.optimizer_search_depth = 64;
+SELECT @@global.optimizer_search_depth;
+SET @@global.optimizer_search_depth = -1;
+SELECT @@global.optimizer_search_depth;
+SET @@global.optimizer_search_depth = 65536;
+SELECT @@global.optimizer_search_depth;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.optimizer_search_depth = 65530.34;
+SELECT @@global.optimizer_search_depth;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.optimizer_search_depth = test;
+SELECT @@global.optimizer_search_depth;
+
+SET @@session.optimizer_search_depth = 64;
+SELECT @@session.optimizer_search_depth;
+SET @@session.optimizer_search_depth = -2;
+SELECT @@session.optimizer_search_depth;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.optimizer_search_depth = 65530.34;
+SET @@session.optimizer_search_depth = 65550;
+SELECT @@session.optimizer_search_depth;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.optimizer_search_depth = test;
+SELECT @@session.optimizer_search_depth;
+
+
+--echo '#------------------FN_DYNVARS_116_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+SELECT @@global.optimizer_search_depth = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='optimizer_search_depth';
+
+
+--echo '#------------------FN_DYNVARS_116_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.optimizer_search_depth = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='optimizer_search_depth';
+
+
+--echo '#------------------FN_DYNVARS_116_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.optimizer_search_depth = TRUE;
+SELECT @@global.optimizer_search_depth;
+SET @@global.optimizer_search_depth = FALSE;
+SELECT @@global.optimizer_search_depth;
+
+
+--echo '#---------------------FN_DYNVARS_116_09----------------------#'
+#################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+#################################################################################
+
+SET @@global.optimizer_search_depth = 10;
+SELECT @@optimizer_search_depth = @@global.optimizer_search_depth;
+
+
+--echo '#---------------------FN_DYNVARS_116_10----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@optimizer_search_depth = 10;
+SELECT @@optimizer_search_depth = @@local.optimizer_search_depth;
+SELECT @@local.optimizer_search_depth = @@session.optimizer_search_depth;
+
+
+--echo '#---------------------FN_DYNVARS_116_11----------------------#'
+#################################################################################
+# Check if optimizer_search_depth can be accessed with and without @@ sign #
+#################################################################################
+
+SET optimizer_search_depth = 1;
+SELECT @@optimizer_search_depth;
+--Error ER_UNKNOWN_TABLE
+SELECT local.optimizer_search_depth;
+--Error ER_UNKNOWN_TABLE
+SELECT session.optimizer_search_depth;
+--Error ER_BAD_FIELD_ERROR
+SELECT optimizer_search_depth = @@session.optimizer_search_depth;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.optimizer_search_depth = @start_global_value;
+SELECT @@global.optimizer_search_depth;
+SET @@session.optimizer_search_depth = @start_session_value;
+SELECT @@session.optimizer_search_depth;
+
+
+###########################################################
+# END OF optimizer_search_depth TESTS #
+###########################################################
+
diff --git a/mysql-test/suite/sys_vars/t/optimizer_selectivity_sampling_limit_basic.test b/mysql-test/suite/sys_vars/t/optimizer_selectivity_sampling_limit_basic.test
new file mode 100644
index 00000000..232ff99d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/optimizer_selectivity_sampling_limit_basic.test
@@ -0,0 +1,154 @@
+
+--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 = 100;
+
+SET @@session.optimizer_selectivity_sampling_limit = DEFAULT;
+SELECT @@session.optimizer_selectivity_sampling_limit = 100;
+
+
+--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 #
+########################################################################
+
diff --git a/mysql-test/suite/sys_vars/t/optimizer_switch_basic.test b/mysql-test/suite/sys_vars/t/optimizer_switch_basic.test
new file mode 100644
index 00000000..ada22845
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/optimizer_switch_basic.test
@@ -0,0 +1,52 @@
+--source include/default_optimizer_switch.inc
+
+#
+# 2010-01-20 OBN Added check for I_S values after variable value changed
+#
+
+set @@global.optimizer_switch=@@optimizer_switch;
+
+#
+# exists as global and session
+#
+select @@global.optimizer_switch;
+select @@session.optimizer_switch;
+show global variables like 'optimizer_switch';
+show session variables like 'optimizer_switch';
+select * from information_schema.global_variables where variable_name='optimizer_switch';
+select * from information_schema.session_variables where variable_name='optimizer_switch';
+
+#
+# show that it's writable
+#
+set global optimizer_switch=4101;
+set session optimizer_switch=2058;
+select @@global.optimizer_switch;
+select @@session.optimizer_switch;
+set global optimizer_switch="index_merge_sort_union=on";
+set session optimizer_switch="index_merge=off";
+select @@global.optimizer_switch;
+select @@session.optimizer_switch;
+show global variables like 'optimizer_switch';
+show session variables like 'optimizer_switch';
+select * from information_schema.global_variables where variable_name='optimizer_switch';
+select * from information_schema.session_variables where variable_name='optimizer_switch';
+set session optimizer_switch="default";
+select @@session.optimizer_switch;
+
+set optimizer_switch = replace(@@optimizer_switch, '=off', '=on');
+select @@optimizer_switch;
+
+#
+# incorrect assignments
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global optimizer_switch=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global optimizer_switch=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set session optimizer_switch="index_merge";
+--error ER_WRONG_VALUE_FOR_VAR
+set session optimizer_switch="foobar";
+
+SET @@global.optimizer_switch = @save_optimizer_switch;
diff --git a/mysql-test/suite/sys_vars/t/optimizer_use_condition_selectivity_basic.test b/mysql-test/suite/sys_vars/t/optimizer_use_condition_selectivity_basic.test
new file mode 100644
index 00000000..1529db1a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/optimizer_use_condition_selectivity_basic.test
@@ -0,0 +1,122 @@
+
+--source include/load_sysvars.inc
+
+#################################################################
+# START OF optimizer_use_condition_selectivity TESTS #
+#################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.optimizer_use_condition_selectivity;
+SET @start_session_value = @@session.optimizer_use_condition_selectivity;
+
+--echo '#--------------------FN_DYNVARS_115_03-------------------------#'
+#############################################################################################
+# Change the value of optimizer_use_condition_selectivity to a valid value for GLOBAL Scope #
+#############################################################################################
+
+SET @@global.optimizer_use_condition_selectivity = 0;
+SELECT @@global.optimizer_use_condition_selectivity;
+SET @@global.optimizer_use_condition_selectivity = 1;
+SELECT @@global.optimizer_use_condition_selectivity;
+SET @@global.optimizer_use_condition_selectivity = 2;
+SELECT @@global.optimizer_use_condition_selectivity;
+SET @@global.optimizer_use_condition_selectivity = 3;
+SELECT @@global.optimizer_use_condition_selectivity;
+SET @@global.optimizer_use_condition_selectivity = 4;
+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-------------------------#'
+#############################################################################################
+# Change the value of optimizer_use_condition_selectivity to a valid value for SESSION Scope#
+#############################################################################################
+
+SET @@session.optimizer_use_condition_selectivity = 0;
+SELECT @@session.optimizer_use_condition_selectivity;
+SET @@session.optimizer_use_condition_selectivity = 1;
+SELECT @@session.optimizer_use_condition_selectivity;
+SET @@session.optimizer_use_condition_selectivity = 2;
+SELECT @@session.optimizer_use_condition_selectivity;
+SET @@session.optimizer_use_condition_selectivity = 3;
+SELECT @@session.optimizer_use_condition_selectivity;
+SET @@session.optimizer_use_condition_selectivity = 4;
+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-----------------------#'
+###############################################################################
+# Change the value of optimizer_use_condition_selectivity to an invalid value #
+##############################################################################
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.optimizer_use_condition_selectivity = ON;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.optimizer_use_condition_selectivity = OFF;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.optimizer_use_condition_selectivity = 65530.34;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.optimizer_use_condition_selectivity = test;
+
+--echo '#------------------FN_DYNVARS_115_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT @@global.optimizer_use_condition_selectivity = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='optimizer_use_condition_selectivity';
+
+--echo '#------------------FN_DYNVARS_115_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.optimizer_use_condition_selectivity = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='optimizer_use_condition_selectivity';
+
+
+--echo '#---------------------FN_DYNVARS_115_08----------------------#'
+###############################################################################
+# Check if global and session variable are independent of each other #
+###############################################################################
+
+SET @@optimizer_use_condition_selectivity = 1;
+SET @@global.optimizer_use_condition_selectivity = 3;
+SELECT @@optimizer_use_condition_selectivity = @@global.optimizer_use_condition_selectivity;
+
+
+--echo '#---------------------FN_DYNVARS_115_09----------------------#'
+###############################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points #
+# to same session variable #
+###############################################################################
+
+SET @@optimizer_use_condition_selectivity = 2;
+SELECT @@optimizer_use_condition_selectivity = @@local.optimizer_use_condition_selectivity;
+SELECT @@local.optimizer_use_condition_selectivity = @@session.optimizer_use_condition_selectivity;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.optimizer_use_condition_selectivity = @start_global_value;
+
+########################################################################
+# END OF optimizer_use_condition_selectivity TESTS #
+########################################################################
+
diff --git a/mysql-test/suite/sys_vars/t/oqgraph_allow_create_integer_latch_basic.test b/mysql-test/suite/sys_vars/t/oqgraph_allow_create_integer_latch_basic.test
new file mode 100644
index 00000000..62e4d570
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/oqgraph_allow_create_integer_latch_basic.test
@@ -0,0 +1 @@
+--echo Oqgraph extention
diff --git a/mysql-test/suite/sys_vars/t/performance_schema_basic-master.opt b/mysql-test/suite/sys_vars/t/performance_schema_basic-master.opt
new file mode 100644
index 00000000..542720c4
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/performance_schema_basic-master.opt
@@ -0,0 +1 @@
+--loose-enable-performance-schema
diff --git a/mysql-test/suite/sys_vars/t/performance_schema_basic.test b/mysql-test/suite/sys_vars/t/performance_schema_basic.test
new file mode 100644
index 00000000..bef8d6c5
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/performance_schema_basic.test
@@ -0,0 +1,32 @@
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+#
+# Only global
+#
+
+select @@global.performance_schema;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.performance_schema;
+
+show global variables like 'performance_schema';
+
+show session variables like 'performance_schema';
+
+select * from information_schema.global_variables
+ where variable_name='performance_schema';
+
+select * from information_schema.session_variables
+ where variable_name='performance_schema';
+
+#
+# Read-only
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global performance_schema=1;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session performance_schema=1;
+
diff --git a/mysql-test/suite/sys_vars/t/pfs_accounts_size_basic-master.opt b/mysql-test/suite/sys_vars/t/pfs_accounts_size_basic-master.opt
new file mode 100644
index 00000000..a51860b0
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_accounts_size_basic-master.opt
@@ -0,0 +1,2 @@
+--loose-enable-performance-schema
+--loose-performance-schema-accounts-size=123
diff --git a/mysql-test/suite/sys_vars/t/pfs_accounts_size_basic.test b/mysql-test/suite/sys_vars/t/pfs_accounts_size_basic.test
new file mode 100644
index 00000000..b055805d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_accounts_size_basic.test
@@ -0,0 +1,32 @@
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+#
+# Only global
+#
+
+select @@global.performance_schema_accounts_size;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.performance_schema_accounts_size;
+
+show global variables like 'performance_schema_accounts_size';
+
+show session variables like 'performance_schema_accounts_size';
+
+select * from information_schema.global_variables
+ where variable_name='performance_schema_accounts_size';
+
+select * from information_schema.session_variables
+ where variable_name='performance_schema_accounts_size';
+
+#
+# Read-only
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global performance_schema_accounts_size=1;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session performance_schema_accounts_size=1;
+
diff --git a/mysql-test/suite/sys_vars/t/pfs_digests_size-master_basic.opt b/mysql-test/suite/sys_vars/t/pfs_digests_size-master_basic.opt
new file mode 100644
index 00000000..d0a5cbeb
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_digests_size-master_basic.opt
@@ -0,0 +1,2 @@
+--loose-enable-performance-schema
+--loose-performance-schema-digests-size=200
diff --git a/mysql-test/suite/sys_vars/t/pfs_digests_size_basic.test b/mysql-test/suite/sys_vars/t/pfs_digests_size_basic.test
new file mode 100644
index 00000000..6b48ba95
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_digests_size_basic.test
@@ -0,0 +1,47 @@
+# Copyright (C) 2010 Sun Microsystems, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+#
+# Only global
+#
+
+select @@global.performance_schema_digests_size;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.performance_schema_digests_size;
+
+show global variables like 'performance_schema_digests_size';
+
+show session variables like 'performance_schema_digests_size';
+
+select * from information_schema.global_variables
+ where variable_name='performance_schema_digests_size';
+
+select * from information_schema.session_variables
+ where variable_name='performance_schema_digests_size';
+
+#
+# Read-only
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global performance_schema_digests_size=1;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session performance_schema_digests_size=1;
+
diff --git a/mysql-test/suite/sys_vars/t/pfs_events_stages_history_long_size_basic-master.opt b/mysql-test/suite/sys_vars/t/pfs_events_stages_history_long_size_basic-master.opt
new file mode 100644
index 00000000..b3aa4a08
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_events_stages_history_long_size_basic-master.opt
@@ -0,0 +1,2 @@
+--loose-enable-performance-schema
+--loose-performance-schema-events-stages-history-long-size=15000
diff --git a/mysql-test/suite/sys_vars/t/pfs_events_stages_history_long_size_basic.test b/mysql-test/suite/sys_vars/t/pfs_events_stages_history_long_size_basic.test
new file mode 100644
index 00000000..ab17ccf6
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_events_stages_history_long_size_basic.test
@@ -0,0 +1,32 @@
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+#
+# Only global
+#
+
+select @@global.performance_schema_events_stages_history_long_size;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.performance_schema_events_stages_history_long_size;
+
+show global variables like 'performance_schema_events_stages_history_long_size';
+
+show session variables like 'performance_schema_events_stages_history_long_size';
+
+select * from information_schema.global_variables
+ where variable_name='performance_schema_events_stages_history_long_size';
+
+select * from information_schema.session_variables
+ where variable_name='performance_schema_events_stages_history_long_size';
+
+#
+# Read-only
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global performance_schema_events_stages_history_long_size=1;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session performance_schema_events_stages_history_long_size=1;
+
diff --git a/mysql-test/suite/sys_vars/t/pfs_events_stages_history_size_basic-master.opt b/mysql-test/suite/sys_vars/t/pfs_events_stages_history_size_basic-master.opt
new file mode 100644
index 00000000..a0ba6e81
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_events_stages_history_size_basic-master.opt
@@ -0,0 +1,2 @@
+--loose-enable-performance-schema
+--loose-performance-schema-events-stages-history-size=15
diff --git a/mysql-test/suite/sys_vars/t/pfs_events_stages_history_size_basic.test b/mysql-test/suite/sys_vars/t/pfs_events_stages_history_size_basic.test
new file mode 100644
index 00000000..2b85c97a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_events_stages_history_size_basic.test
@@ -0,0 +1,32 @@
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+#
+# Only global
+#
+
+select @@global.performance_schema_events_stages_history_size;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.performance_schema_events_stages_history_size;
+
+show global variables like 'performance_schema_events_stages_history_size';
+
+show session variables like 'performance_schema_events_stages_history_size';
+
+select * from information_schema.global_variables
+ where variable_name='performance_schema_events_stages_history_size';
+
+select * from information_schema.session_variables
+ where variable_name='performance_schema_events_stages_history_size';
+
+#
+# Read-only
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global performance_schema_events_stages_history_size=1;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session performance_schema_events_stages_history_size=1;
+
diff --git a/mysql-test/suite/sys_vars/t/pfs_events_statements_history_long_size_basic-master.opt b/mysql-test/suite/sys_vars/t/pfs_events_statements_history_long_size_basic-master.opt
new file mode 100644
index 00000000..4ea716e3
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_events_statements_history_long_size_basic-master.opt
@@ -0,0 +1,2 @@
+--loose-enable-performance-schema
+--loose-performance-schema-events-statements-history-long-size=15000
diff --git a/mysql-test/suite/sys_vars/t/pfs_events_statements_history_long_size_basic.test b/mysql-test/suite/sys_vars/t/pfs_events_statements_history_long_size_basic.test
new file mode 100644
index 00000000..116fd738
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_events_statements_history_long_size_basic.test
@@ -0,0 +1,32 @@
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+#
+# Only global
+#
+
+select @@global.performance_schema_events_statements_history_long_size;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.performance_schema_events_statements_history_long_size;
+
+show global variables like 'performance_schema_events_statements_history_long_size';
+
+show session variables like 'performance_schema_events_statements_history_long_size';
+
+select * from information_schema.global_variables
+ where variable_name='performance_schema_events_statements_history_long_size';
+
+select * from information_schema.session_variables
+ where variable_name='performance_schema_events_statements_history_long_size';
+
+#
+# Read-only
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global performance_schema_events_statements_history_long_size=1;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session performance_schema_events_statements_history_long_size=1;
+
diff --git a/mysql-test/suite/sys_vars/t/pfs_events_statements_history_size_basic-master.opt b/mysql-test/suite/sys_vars/t/pfs_events_statements_history_size_basic-master.opt
new file mode 100644
index 00000000..70e70d56
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_events_statements_history_size_basic-master.opt
@@ -0,0 +1,2 @@
+--loose-enable-performance-schema
+--loose-performance-schema-events-statements-history-size=15
diff --git a/mysql-test/suite/sys_vars/t/pfs_events_statements_history_size_basic.test b/mysql-test/suite/sys_vars/t/pfs_events_statements_history_size_basic.test
new file mode 100644
index 00000000..60839714
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_events_statements_history_size_basic.test
@@ -0,0 +1,32 @@
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+#
+# Only global
+#
+
+select @@global.performance_schema_events_statements_history_size;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.performance_schema_events_statements_history_size;
+
+show global variables like 'performance_schema_events_statements_history_size';
+
+show session variables like 'performance_schema_events_statements_history_size';
+
+select * from information_schema.global_variables
+ where variable_name='performance_schema_events_statements_history_size';
+
+select * from information_schema.session_variables
+ where variable_name='performance_schema_events_statements_history_size';
+
+#
+# Read-only
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global performance_schema_events_statements_history_size=1;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session performance_schema_events_statements_history_size=1;
+
diff --git a/mysql-test/suite/sys_vars/t/pfs_events_waits_history_long_size_basic-master.opt b/mysql-test/suite/sys_vars/t/pfs_events_waits_history_long_size_basic-master.opt
new file mode 100644
index 00000000..ff1dd2a8
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_events_waits_history_long_size_basic-master.opt
@@ -0,0 +1 @@
+--loose-enable-performance-schema --loose-performance-schema-events-waits-history-long-size=15000
diff --git a/mysql-test/suite/sys_vars/t/pfs_events_waits_history_long_size_basic.test b/mysql-test/suite/sys_vars/t/pfs_events_waits_history_long_size_basic.test
new file mode 100644
index 00000000..032f1f32
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_events_waits_history_long_size_basic.test
@@ -0,0 +1,32 @@
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+#
+# Only global
+#
+
+select @@global.performance_schema_events_waits_history_long_size;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.performance_schema_events_waits_history_long_size;
+
+show global variables like 'performance_schema_events_waits_history_long_size';
+
+show session variables like 'performance_schema_events_waits_history_long_size';
+
+select * from information_schema.global_variables
+ where variable_name='performance_schema_events_waits_history_long_size';
+
+select * from information_schema.session_variables
+ where variable_name='performance_schema_events_waits_history_long_size';
+
+#
+# Read-only
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global performance_schema_events_waits_history_long_size=1;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session performance_schema_events_waits_history_long_size=1;
+
diff --git a/mysql-test/suite/sys_vars/t/pfs_events_waits_history_size_basic-master.opt b/mysql-test/suite/sys_vars/t/pfs_events_waits_history_size_basic-master.opt
new file mode 100644
index 00000000..488707fc
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_events_waits_history_size_basic-master.opt
@@ -0,0 +1 @@
+--loose-enable-performance-schema --loose-performance-schema-events-waits-history-size=15
diff --git a/mysql-test/suite/sys_vars/t/pfs_events_waits_history_size_basic.test b/mysql-test/suite/sys_vars/t/pfs_events_waits_history_size_basic.test
new file mode 100644
index 00000000..d7ea0590
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_events_waits_history_size_basic.test
@@ -0,0 +1,32 @@
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+#
+# Only global
+#
+
+select @@global.performance_schema_events_waits_history_size;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.performance_schema_events_waits_history_size;
+
+show global variables like 'performance_schema_events_waits_history_size';
+
+show session variables like 'performance_schema_events_waits_history_size';
+
+select * from information_schema.global_variables
+ where variable_name='performance_schema_events_waits_history_size';
+
+select * from information_schema.session_variables
+ where variable_name='performance_schema_events_waits_history_size';
+
+#
+# Read-only
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global performance_schema_events_waits_history_size=1;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session performance_schema_events_waits_history_size=1;
+
diff --git a/mysql-test/suite/sys_vars/t/pfs_hosts_size_basic-master.opt b/mysql-test/suite/sys_vars/t/pfs_hosts_size_basic-master.opt
new file mode 100644
index 00000000..4f122ac7
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_hosts_size_basic-master.opt
@@ -0,0 +1,2 @@
+--loose-enable-performance-schema
+--loose-performance-schema-hosts-size=123
diff --git a/mysql-test/suite/sys_vars/t/pfs_hosts_size_basic.test b/mysql-test/suite/sys_vars/t/pfs_hosts_size_basic.test
new file mode 100644
index 00000000..4830757f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_hosts_size_basic.test
@@ -0,0 +1,32 @@
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+#
+# Only global
+#
+
+select @@global.performance_schema_hosts_size;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.performance_schema_hosts_size;
+
+show global variables like 'performance_schema_hosts_size';
+
+show session variables like 'performance_schema_hosts_size';
+
+select * from information_schema.global_variables
+ where variable_name='performance_schema_hosts_size';
+
+select * from information_schema.session_variables
+ where variable_name='performance_schema_hosts_size';
+
+#
+# Read-only
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global performance_schema_hosts_size=1;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session performance_schema_hosts_size=1;
+
diff --git a/mysql-test/suite/sys_vars/t/pfs_max_cond_classes_basic-master.opt b/mysql-test/suite/sys_vars/t/pfs_max_cond_classes_basic-master.opt
new file mode 100644
index 00000000..438bc463
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_max_cond_classes_basic-master.opt
@@ -0,0 +1 @@
+--loose-enable-performance-schema --loose-performance-schema-max-cond-classes=123
diff --git a/mysql-test/suite/sys_vars/t/pfs_max_cond_classes_basic.test b/mysql-test/suite/sys_vars/t/pfs_max_cond_classes_basic.test
new file mode 100644
index 00000000..6f25cf8c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_max_cond_classes_basic.test
@@ -0,0 +1,32 @@
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+#
+# Only global
+#
+
+select @@global.performance_schema_max_cond_classes;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.performance_schema_max_cond_classes;
+
+show global variables like 'performance_schema_max_cond_classes';
+
+show session variables like 'performance_schema_max_cond_classes';
+
+select * from information_schema.global_variables
+ where variable_name='performance_schema_max_cond_classes';
+
+select * from information_schema.session_variables
+ where variable_name='performance_schema_max_cond_classes';
+
+#
+# Read-only
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global performance_schema_max_cond_classes=1;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session performance_schema_max_cond_classes=1;
+
diff --git a/mysql-test/suite/sys_vars/t/pfs_max_cond_instances_basic-master.opt b/mysql-test/suite/sys_vars/t/pfs_max_cond_instances_basic-master.opt
new file mode 100644
index 00000000..47b9d629
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_max_cond_instances_basic-master.opt
@@ -0,0 +1 @@
+--loose-enable-performance-schema --loose-performance-schema-max-cond-instances=123
diff --git a/mysql-test/suite/sys_vars/t/pfs_max_cond_instances_basic.test b/mysql-test/suite/sys_vars/t/pfs_max_cond_instances_basic.test
new file mode 100644
index 00000000..3ffd3619
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_max_cond_instances_basic.test
@@ -0,0 +1,32 @@
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+#
+# Only global
+#
+
+select @@global.performance_schema_max_cond_instances;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.performance_schema_max_cond_instances;
+
+show global variables like 'performance_schema_max_cond_instances';
+
+show session variables like 'performance_schema_max_cond_instances';
+
+select * from information_schema.global_variables
+ where variable_name='performance_schema_max_cond_instances';
+
+select * from information_schema.session_variables
+ where variable_name='performance_schema_max_cond_instances';
+
+#
+# Read-only
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global performance_schema_max_cond_instances=1;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session performance_schema_max_cond_instances=1;
+
diff --git a/mysql-test/suite/sys_vars/t/pfs_max_digest_length-master_basic.opt b/mysql-test/suite/sys_vars/t/pfs_max_digest_length-master_basic.opt
new file mode 100644
index 00000000..a98eb86d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_max_digest_length-master_basic.opt
@@ -0,0 +1,2 @@
+--loose-enable-performance-schema
+--loose-performance-schema-max_digest_length=1024
diff --git a/mysql-test/suite/sys_vars/t/pfs_max_digest_length_basic.test b/mysql-test/suite/sys_vars/t/pfs_max_digest_length_basic.test
new file mode 100644
index 00000000..9a89f9af
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_max_digest_length_basic.test
@@ -0,0 +1,47 @@
+# Copyright (C) 2010 Sun Microsystems, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+#
+# Only global
+#
+
+select @@global.performance_schema_max_digest_length;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.performance_schema_max_digest_length;
+
+show global variables like 'performance_schema_max_digest_length';
+
+show session variables like 'performance_schema_max_digest_length';
+
+select * from information_schema.global_variables
+ where variable_name='performance_schema_max_digest_length';
+
+select * from information_schema.session_variables
+ where variable_name='performance_schema_max_digest_length';
+
+#
+# Read-only
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global performance_schema_max_digest_length=1;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session performance_schema_max_digest_length=1;
+
diff --git a/mysql-test/suite/sys_vars/t/pfs_max_file_classes_basic-master.opt b/mysql-test/suite/sys_vars/t/pfs_max_file_classes_basic-master.opt
new file mode 100644
index 00000000..6ed54f9f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_max_file_classes_basic-master.opt
@@ -0,0 +1 @@
+--loose-enable-performance-schema --loose-performance-schema-max-file-classes=123
diff --git a/mysql-test/suite/sys_vars/t/pfs_max_file_classes_basic.test b/mysql-test/suite/sys_vars/t/pfs_max_file_classes_basic.test
new file mode 100644
index 00000000..58effd78
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_max_file_classes_basic.test
@@ -0,0 +1,32 @@
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+#
+# Only global
+#
+
+select @@global.performance_schema_max_file_classes;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.performance_schema_max_file_classes;
+
+show global variables like 'performance_schema_max_file_classes';
+
+show session variables like 'performance_schema_max_file_classes';
+
+select * from information_schema.global_variables
+ where variable_name='performance_schema_max_file_classes';
+
+select * from information_schema.session_variables
+ where variable_name='performance_schema_max_file_classes';
+
+#
+# Read-only
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global performance_schema_max_file_classes=1;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session performance_schema_max_file_classes=1;
+
diff --git a/mysql-test/suite/sys_vars/t/pfs_max_file_handles_basic-master.opt b/mysql-test/suite/sys_vars/t/pfs_max_file_handles_basic-master.opt
new file mode 100644
index 00000000..04633ae0
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_max_file_handles_basic-master.opt
@@ -0,0 +1 @@
+--loose-enable-performance-schema --loose-performance-schema-max-file-handles=123
diff --git a/mysql-test/suite/sys_vars/t/pfs_max_file_handles_basic.test b/mysql-test/suite/sys_vars/t/pfs_max_file_handles_basic.test
new file mode 100644
index 00000000..f1bb3c96
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_max_file_handles_basic.test
@@ -0,0 +1,32 @@
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+#
+# Only global
+#
+
+select @@global.performance_schema_max_file_handles;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.performance_schema_max_file_handles;
+
+show global variables like 'performance_schema_max_file_handles';
+
+show session variables like 'performance_schema_max_file_handles';
+
+select * from information_schema.global_variables
+ where variable_name='performance_schema_max_file_handles';
+
+select * from information_schema.session_variables
+ where variable_name='performance_schema_max_file_handles';
+
+#
+# Read-only
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global performance_schema_max_file_handles=1;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session performance_schema_max_file_handles=1;
+
diff --git a/mysql-test/suite/sys_vars/t/pfs_max_file_instances_basic-master.opt b/mysql-test/suite/sys_vars/t/pfs_max_file_instances_basic-master.opt
new file mode 100644
index 00000000..078a998c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_max_file_instances_basic-master.opt
@@ -0,0 +1 @@
+--loose-enable-performance-schema --loose-performance-schema-max-file-instances=123
diff --git a/mysql-test/suite/sys_vars/t/pfs_max_file_instances_basic.test b/mysql-test/suite/sys_vars/t/pfs_max_file_instances_basic.test
new file mode 100644
index 00000000..880db840
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_max_file_instances_basic.test
@@ -0,0 +1,32 @@
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+#
+# Only global
+#
+
+select @@global.performance_schema_max_file_instances;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.performance_schema_max_file_instances;
+
+show global variables like 'performance_schema_max_file_instances';
+
+show session variables like 'performance_schema_max_file_instances';
+
+select * from information_schema.global_variables
+ where variable_name='performance_schema_max_file_instances';
+
+select * from information_schema.session_variables
+ where variable_name='performance_schema_max_file_instances';
+
+#
+# Read-only
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global performance_schema_max_file_instances=1;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session performance_schema_max_file_instances=1;
+
diff --git a/mysql-test/suite/sys_vars/t/pfs_max_mutex_classes_basic-master.opt b/mysql-test/suite/sys_vars/t/pfs_max_mutex_classes_basic-master.opt
new file mode 100644
index 00000000..1525916a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_max_mutex_classes_basic-master.opt
@@ -0,0 +1 @@
+--loose-enable-performance-schema --loose-performance-schema-max-mutex-classes=123
diff --git a/mysql-test/suite/sys_vars/t/pfs_max_mutex_classes_basic.test b/mysql-test/suite/sys_vars/t/pfs_max_mutex_classes_basic.test
new file mode 100644
index 00000000..08f15526
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_max_mutex_classes_basic.test
@@ -0,0 +1,32 @@
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+#
+# Only global
+#
+
+select @@global.performance_schema_max_mutex_classes;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.performance_schema_max_mutex_classes;
+
+show global variables like 'performance_schema_max_mutex_classes';
+
+show session variables like 'performance_schema_max_mutex_classes';
+
+select * from information_schema.global_variables
+ where variable_name='performance_schema_max_mutex_classes';
+
+select * from information_schema.session_variables
+ where variable_name='performance_schema_max_mutex_classes';
+
+#
+# Read-only
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global performance_schema_max_mutex_classes=1;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session performance_schema_max_mutex_classes=1;
+
diff --git a/mysql-test/suite/sys_vars/t/pfs_max_mutex_instances_basic-master.opt b/mysql-test/suite/sys_vars/t/pfs_max_mutex_instances_basic-master.opt
new file mode 100644
index 00000000..98ce2ff3
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_max_mutex_instances_basic-master.opt
@@ -0,0 +1 @@
+--loose-enable-performance-schema --loose-performance-schema-max-mutex-instances=123
diff --git a/mysql-test/suite/sys_vars/t/pfs_max_mutex_instances_basic.test b/mysql-test/suite/sys_vars/t/pfs_max_mutex_instances_basic.test
new file mode 100644
index 00000000..ab5a8536
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_max_mutex_instances_basic.test
@@ -0,0 +1,32 @@
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+#
+# Only global
+#
+
+select @@global.performance_schema_max_mutex_instances;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.performance_schema_max_mutex_instances;
+
+show global variables like 'performance_schema_max_mutex_instances';
+
+show session variables like 'performance_schema_max_mutex_instances';
+
+select * from information_schema.global_variables
+ where variable_name='performance_schema_max_mutex_instances';
+
+select * from information_schema.session_variables
+ where variable_name='performance_schema_max_mutex_instances';
+
+#
+# Read-only
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global performance_schema_max_mutex_instances=1;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session performance_schema_max_mutex_instances=1;
+
diff --git a/mysql-test/suite/sys_vars/t/pfs_max_rwlock_classes_basic-master.opt b/mysql-test/suite/sys_vars/t/pfs_max_rwlock_classes_basic-master.opt
new file mode 100644
index 00000000..b5d53186
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_max_rwlock_classes_basic-master.opt
@@ -0,0 +1 @@
+--loose-enable-performance-schema --loose-performance-schema-max-rwlock-classes=123
diff --git a/mysql-test/suite/sys_vars/t/pfs_max_rwlock_classes_basic.test b/mysql-test/suite/sys_vars/t/pfs_max_rwlock_classes_basic.test
new file mode 100644
index 00000000..9b4d1d40
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_max_rwlock_classes_basic.test
@@ -0,0 +1,32 @@
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+#
+# Only global
+#
+
+select @@global.performance_schema_max_rwlock_classes;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.performance_schema_max_rwlock_classes;
+
+show global variables like 'performance_schema_max_rwlock_classes';
+
+show session variables like 'performance_schema_max_rwlock_classes';
+
+select * from information_schema.global_variables
+ where variable_name='performance_schema_max_rwlock_classes';
+
+select * from information_schema.session_variables
+ where variable_name='performance_schema_max_rwlock_classes';
+
+#
+# Read-only
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global performance_schema_max_rwlock_classes=1;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session performance_schema_max_rwlock_classes=1;
+
diff --git a/mysql-test/suite/sys_vars/t/pfs_max_rwlock_instances_basic-master.opt b/mysql-test/suite/sys_vars/t/pfs_max_rwlock_instances_basic-master.opt
new file mode 100644
index 00000000..5dcecd99
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_max_rwlock_instances_basic-master.opt
@@ -0,0 +1 @@
+--loose-enable-performance-schema --loose-performance-schema-max-rwlock-instances=123
diff --git a/mysql-test/suite/sys_vars/t/pfs_max_rwlock_instances_basic.test b/mysql-test/suite/sys_vars/t/pfs_max_rwlock_instances_basic.test
new file mode 100644
index 00000000..d551df25
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_max_rwlock_instances_basic.test
@@ -0,0 +1,32 @@
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+#
+# Only global
+#
+
+select @@global.performance_schema_max_rwlock_instances;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.performance_schema_max_rwlock_instances;
+
+show global variables like 'performance_schema_max_rwlock_instances';
+
+show session variables like 'performance_schema_max_rwlock_instances';
+
+select * from information_schema.global_variables
+ where variable_name='performance_schema_max_rwlock_instances';
+
+select * from information_schema.session_variables
+ where variable_name='performance_schema_max_rwlock_instances';
+
+#
+# Read-only
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global performance_schema_max_rwlock_instances=1;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session performance_schema_max_rwlock_instances=1;
+
diff --git a/mysql-test/suite/sys_vars/t/pfs_max_socket_classes_basic-master.opt b/mysql-test/suite/sys_vars/t/pfs_max_socket_classes_basic-master.opt
new file mode 100644
index 00000000..eb8cd536
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_max_socket_classes_basic-master.opt
@@ -0,0 +1 @@
+--loose-enable-performance-schema --loose-performance-schema-max-socket-classes=123
diff --git a/mysql-test/suite/sys_vars/t/pfs_max_socket_classes_basic.test b/mysql-test/suite/sys_vars/t/pfs_max_socket_classes_basic.test
new file mode 100644
index 00000000..01251be4
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_max_socket_classes_basic.test
@@ -0,0 +1,32 @@
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+#
+# Only global
+#
+
+select @@global.performance_schema_max_socket_classes;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.performance_schema_max_socket_classes;
+
+show global variables like 'performance_schema_max_socket_classes';
+
+show session variables like 'performance_schema_max_socket_classes';
+
+select * from information_schema.global_variables
+ where variable_name='performance_schema_max_socket_classes';
+
+select * from information_schema.session_variables
+ where variable_name='performance_schema_max_socket_classes';
+
+#
+# Read-only
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global performance_schema_max_socket_classes=1;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session performance_schema_max_socket_classes=1;
+
diff --git a/mysql-test/suite/sys_vars/t/pfs_max_socket_instances_basic-master.opt b/mysql-test/suite/sys_vars/t/pfs_max_socket_instances_basic-master.opt
new file mode 100644
index 00000000..e3c3d069
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_max_socket_instances_basic-master.opt
@@ -0,0 +1 @@
+--loose-enable-performance-schema --loose-performance-schema-max-socket-instances=123
diff --git a/mysql-test/suite/sys_vars/t/pfs_max_socket_instances_basic.test b/mysql-test/suite/sys_vars/t/pfs_max_socket_instances_basic.test
new file mode 100644
index 00000000..e370d6c0
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_max_socket_instances_basic.test
@@ -0,0 +1,32 @@
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+#
+# Only global
+#
+
+select @@global.performance_schema_max_socket_instances;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.performance_schema_max_socket_instances;
+
+show global variables like 'performance_schema_max_socket_instances';
+
+show session variables like 'performance_schema_max_socket_instances';
+
+select * from information_schema.global_variables
+ where variable_name='performance_schema_max_socket_instances';
+
+select * from information_schema.session_variables
+ where variable_name='performance_schema_max_socket_instances';
+
+#
+# Read-only
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global performance_schema_max_socket_instances=1;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session performance_schema_max_socket_instances=1;
+
diff --git a/mysql-test/suite/sys_vars/t/pfs_max_stage_classes_basic-master.opt b/mysql-test/suite/sys_vars/t/pfs_max_stage_classes_basic-master.opt
new file mode 100644
index 00000000..0e2130c3
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_max_stage_classes_basic-master.opt
@@ -0,0 +1,2 @@
+--loose-enable-performance-schema
+--loose-performance-schema-max-stage_classes=123
diff --git a/mysql-test/suite/sys_vars/t/pfs_max_stage_classes_basic.test b/mysql-test/suite/sys_vars/t/pfs_max_stage_classes_basic.test
new file mode 100644
index 00000000..19bc8d09
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_max_stage_classes_basic.test
@@ -0,0 +1,32 @@
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+#
+# Only global
+#
+
+select @@global.performance_schema_max_stage_classes;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.performance_schema_max_stage_classes;
+
+show global variables like 'performance_schema_max_stage_classes';
+
+show session variables like 'performance_schema_max_stage_classes';
+
+select * from information_schema.global_variables
+ where variable_name='performance_schema_max_stage_classes';
+
+select * from information_schema.session_variables
+ where variable_name='performance_schema_max_stage_classes';
+
+#
+# Read-only
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global performance_schema_max_stage_classes=1;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session performance_schema_max_stage_classes=1;
+
diff --git a/mysql-test/suite/sys_vars/t/pfs_max_statement_classes_basic-master.opt b/mysql-test/suite/sys_vars/t/pfs_max_statement_classes_basic-master.opt
new file mode 100644
index 00000000..1041dce7
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_max_statement_classes_basic-master.opt
@@ -0,0 +1,2 @@
+--loose-enable-performance-schema
+--loose-performance-schema-max-statement_classes=123
diff --git a/mysql-test/suite/sys_vars/t/pfs_max_statement_classes_basic.test b/mysql-test/suite/sys_vars/t/pfs_max_statement_classes_basic.test
new file mode 100644
index 00000000..f83aa317
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_max_statement_classes_basic.test
@@ -0,0 +1,32 @@
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+#
+# Only global
+#
+
+select @@global.performance_schema_max_statement_classes;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.performance_schema_max_statement_classes;
+
+show global variables like 'performance_schema_max_statement_classes';
+
+show session variables like 'performance_schema_max_statement_classes';
+
+select * from information_schema.global_variables
+ where variable_name='performance_schema_max_statement_classes';
+
+select * from information_schema.session_variables
+ where variable_name='performance_schema_max_statement_classes';
+
+#
+# Read-only
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global performance_schema_max_statement_classes=1;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session performance_schema_max_statement_classes=1;
+
diff --git a/mysql-test/suite/sys_vars/t/pfs_max_table_handles_basic-master.opt b/mysql-test/suite/sys_vars/t/pfs_max_table_handles_basic-master.opt
new file mode 100644
index 00000000..45e73c51
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_max_table_handles_basic-master.opt
@@ -0,0 +1 @@
+--loose-enable-performance-schema --loose-performance-schema-max-table-handles=123
diff --git a/mysql-test/suite/sys_vars/t/pfs_max_table_handles_basic.test b/mysql-test/suite/sys_vars/t/pfs_max_table_handles_basic.test
new file mode 100644
index 00000000..55869817
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_max_table_handles_basic.test
@@ -0,0 +1,32 @@
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+#
+# Only global
+#
+
+select @@global.performance_schema_max_table_handles;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.performance_schema_max_table_handles;
+
+show global variables like 'performance_schema_max_table_handles';
+
+show session variables like 'performance_schema_max_table_handles';
+
+select * from information_schema.global_variables
+ where variable_name='performance_schema_max_table_handles';
+
+select * from information_schema.session_variables
+ where variable_name='performance_schema_max_table_handles';
+
+#
+# Read-only
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global performance_schema_max_table_handles=1;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session performance_schema_max_table_handles=1;
+
diff --git a/mysql-test/suite/sys_vars/t/pfs_max_table_instances_basic-master.opt b/mysql-test/suite/sys_vars/t/pfs_max_table_instances_basic-master.opt
new file mode 100644
index 00000000..b8b0ba4b
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_max_table_instances_basic-master.opt
@@ -0,0 +1 @@
+--loose-enable-performance-schema --loose-performance-schema-max-table-instances=123
diff --git a/mysql-test/suite/sys_vars/t/pfs_max_table_instances_basic.test b/mysql-test/suite/sys_vars/t/pfs_max_table_instances_basic.test
new file mode 100644
index 00000000..4ea5901e
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_max_table_instances_basic.test
@@ -0,0 +1,32 @@
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+#
+# Only global
+#
+
+select @@global.performance_schema_max_table_instances;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.performance_schema_max_table_instances;
+
+show global variables like 'performance_schema_max_table_instances';
+
+show session variables like 'performance_schema_max_table_instances';
+
+select * from information_schema.global_variables
+ where variable_name='performance_schema_max_table_instances';
+
+select * from information_schema.session_variables
+ where variable_name='performance_schema_max_table_instances';
+
+#
+# Read-only
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global performance_schema_max_table_instances=1;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session performance_schema_max_table_instances=1;
+
diff --git a/mysql-test/suite/sys_vars/t/pfs_max_thread_classes_basic-master.opt b/mysql-test/suite/sys_vars/t/pfs_max_thread_classes_basic-master.opt
new file mode 100644
index 00000000..c0b64e58
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_max_thread_classes_basic-master.opt
@@ -0,0 +1 @@
+--loose-enable-performance-schema --loose-performance-schema-max-thread-classes=123
diff --git a/mysql-test/suite/sys_vars/t/pfs_max_thread_classes_basic.test b/mysql-test/suite/sys_vars/t/pfs_max_thread_classes_basic.test
new file mode 100644
index 00000000..7f739a25
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_max_thread_classes_basic.test
@@ -0,0 +1,32 @@
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+#
+# Only global
+#
+
+select @@global.performance_schema_max_thread_classes;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.performance_schema_max_thread_classes;
+
+show global variables like 'performance_schema_max_thread_classes';
+
+show session variables like 'performance_schema_max_thread_classes';
+
+select * from information_schema.global_variables
+ where variable_name='performance_schema_max_thread_classes';
+
+select * from information_schema.session_variables
+ where variable_name='performance_schema_max_thread_classes';
+
+#
+# Read-only
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global performance_schema_max_thread_classes=1;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session performance_schema_max_thread_classes=1;
+
diff --git a/mysql-test/suite/sys_vars/t/pfs_max_thread_instances_basic-master.opt b/mysql-test/suite/sys_vars/t/pfs_max_thread_instances_basic-master.opt
new file mode 100644
index 00000000..b70eda8a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_max_thread_instances_basic-master.opt
@@ -0,0 +1 @@
+--loose-enable-performance-schema --loose-performance-schema-max-thread-instances=123
diff --git a/mysql-test/suite/sys_vars/t/pfs_max_thread_instances_basic.test b/mysql-test/suite/sys_vars/t/pfs_max_thread_instances_basic.test
new file mode 100644
index 00000000..653b6bc1
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_max_thread_instances_basic.test
@@ -0,0 +1,32 @@
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+#
+# Only global
+#
+
+select @@global.performance_schema_max_thread_instances;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.performance_schema_max_thread_instances;
+
+show global variables like 'performance_schema_max_thread_instances';
+
+show session variables like 'performance_schema_max_thread_instances';
+
+select * from information_schema.global_variables
+ where variable_name='performance_schema_max_thread_instances';
+
+select * from information_schema.session_variables
+ where variable_name='performance_schema_max_thread_instances';
+
+#
+# Read-only
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global performance_schema_max_thread_instances=1;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session performance_schema_max_thread_instances=1;
+
diff --git a/mysql-test/suite/sys_vars/t/pfs_session_connect_attrs_size_basic-master.opt b/mysql-test/suite/sys_vars/t/pfs_session_connect_attrs_size_basic-master.opt
new file mode 100644
index 00000000..dcbb8a0b
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_session_connect_attrs_size_basic-master.opt
@@ -0,0 +1,2 @@
+--loose-enable-performance-schema
+--loose-performance-schema-session-connect-attrs-size=2048
diff --git a/mysql-test/suite/sys_vars/t/pfs_session_connect_attrs_size_basic.test b/mysql-test/suite/sys_vars/t/pfs_session_connect_attrs_size_basic.test
new file mode 100644
index 00000000..378646b0
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_session_connect_attrs_size_basic.test
@@ -0,0 +1,47 @@
+# Copyright (C) 2012 Sun Microsystems, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+#
+# Only global
+#
+
+select @@global.performance_schema_session_connect_attrs_size;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.performance_schema_session_connect_attrs_size;
+
+show global variables like 'performance_schema_session_connect_attrs_size';
+
+show session variables like 'performance_schema_session_connect_attrs_size';
+
+select * from information_schema.global_variables
+ where variable_name='performance_schema_session_connect_attrs_size';
+
+select * from information_schema.session_variables
+ where variable_name='performance_schema_session_connect_attrs_size';
+
+#
+# Read-only
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global performance_schema_session_connect_attrs_size=1;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session performance_schema_session_connect_attrs_size=1;
+
diff --git a/mysql-test/suite/sys_vars/t/pfs_setup_actors_size_basic-master.opt b/mysql-test/suite/sys_vars/t/pfs_setup_actors_size_basic-master.opt
new file mode 100644
index 00000000..33157f9f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_setup_actors_size_basic-master.opt
@@ -0,0 +1,2 @@
+--loose-enable-performance-schema
+--loose-performance-schema-setup-actors-size=123
diff --git a/mysql-test/suite/sys_vars/t/pfs_setup_actors_size_basic.test b/mysql-test/suite/sys_vars/t/pfs_setup_actors_size_basic.test
new file mode 100644
index 00000000..6cfb38b4
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_setup_actors_size_basic.test
@@ -0,0 +1,32 @@
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+#
+# Only global
+#
+
+select @@global.performance_schema_setup_actors_size;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.performance_schema_setup_actors_size;
+
+show global variables like 'performance_schema_setup_actors_size';
+
+show session variables like 'performance_schema_setup_actors_size';
+
+select * from information_schema.global_variables
+ where variable_name='performance_schema_setup_actors_size';
+
+select * from information_schema.session_variables
+ where variable_name='performance_schema_setup_actors_size';
+
+#
+# Read-only
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global performance_schema_setup_actors_size=1;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session performance_schema_setup_actors_size=1;
+
diff --git a/mysql-test/suite/sys_vars/t/pfs_setup_objects_size_basic-master.opt b/mysql-test/suite/sys_vars/t/pfs_setup_objects_size_basic-master.opt
new file mode 100644
index 00000000..b2ecaa07
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_setup_objects_size_basic-master.opt
@@ -0,0 +1,2 @@
+--loose-enable-performance-schema
+--loose-performance-schema-setup-objects-size=123
diff --git a/mysql-test/suite/sys_vars/t/pfs_setup_objects_size_basic.test b/mysql-test/suite/sys_vars/t/pfs_setup_objects_size_basic.test
new file mode 100644
index 00000000..9f21a7e3
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_setup_objects_size_basic.test
@@ -0,0 +1,32 @@
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+#
+# Only global
+#
+
+select @@global.performance_schema_setup_objects_size;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.performance_schema_setup_objects_size;
+
+show global variables like 'performance_schema_setup_objects_size';
+
+show session variables like 'performance_schema_setup_objects_size';
+
+select * from information_schema.global_variables
+ where variable_name='performance_schema_setup_objects_size';
+
+select * from information_schema.session_variables
+ where variable_name='performance_schema_setup_objects_size';
+
+#
+# Read-only
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global performance_schema_setup_objects_size=1;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session performance_schema_setup_objects_size=1;
+
diff --git a/mysql-test/suite/sys_vars/t/pfs_users_size_basic-master.opt b/mysql-test/suite/sys_vars/t/pfs_users_size_basic-master.opt
new file mode 100644
index 00000000..b64162b4
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_users_size_basic-master.opt
@@ -0,0 +1,2 @@
+--loose-enable-performance-schema
+--loose-performance-schema-users-size=123
diff --git a/mysql-test/suite/sys_vars/t/pfs_users_size_basic.test b/mysql-test/suite/sys_vars/t/pfs_users_size_basic.test
new file mode 100644
index 00000000..15012227
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pfs_users_size_basic.test
@@ -0,0 +1,32 @@
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+#
+# Only global
+#
+
+select @@global.performance_schema_users_size;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.performance_schema_users_size;
+
+show global variables like 'performance_schema_users_size';
+
+show session variables like 'performance_schema_users_size';
+
+select * from information_schema.global_variables
+ where variable_name='performance_schema_users_size';
+
+select * from information_schema.session_variables
+ where variable_name='performance_schema_users_size';
+
+#
+# Read-only
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global performance_schema_users_size=1;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session performance_schema_users_size=1;
+
diff --git a/mysql-test/suite/sys_vars/t/pid_file_basic.test b/mysql-test/suite/sys_vars/t/pid_file_basic.test
new file mode 100644
index 00000000..f4253593
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pid_file_basic.test
@@ -0,0 +1,23 @@
+#
+# only global
+#
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+select @@global.pid_file;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.pid_file;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+show global variables like 'pid_file';
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+show session variables like 'pid_file';
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+select * from information_schema.global_variables where variable_name='pid_file';
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+select * from information_schema.session_variables where variable_name='pid_file';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global pid_file=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session pid_file=1;
diff --git a/mysql-test/suite/sys_vars/t/plugin_dir_basic-master.opt b/mysql-test/suite/sys_vars/t/plugin_dir_basic-master.opt
new file mode 100644
index 00000000..69a9f0de
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/plugin_dir_basic-master.opt
@@ -0,0 +1 @@
+--plugin-dir=$MYSQL_TMP_DIR
diff --git a/mysql-test/suite/sys_vars/t/plugin_dir_basic.test b/mysql-test/suite/sys_vars/t/plugin_dir_basic.test
new file mode 100644
index 00000000..59889f7e
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/plugin_dir_basic.test
@@ -0,0 +1,29 @@
+#
+# only global
+#
+
+#
+# Don't rely on being able to guess the correct default.
+# -master.opt file for this test sets plugin_dir to a known directory
+#
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR /mysql/ /
+select @@global.plugin_dir;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.plugin_dir;
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR /mysql/ /
+show global variables like 'plugin_dir';
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR /mysql/ /
+show session variables like 'plugin_dir';
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR /mysql/ /
+select * from information_schema.global_variables where variable_name='plugin_dir';
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR /mysql/ /
+select * from information_schema.session_variables where variable_name='plugin_dir';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global plugin_dir=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session plugin_dir=1;
+
diff --git a/mysql-test/suite/sys_vars/t/plugin_maturity_basic.test b/mysql-test/suite/sys_vars/t/plugin_maturity_basic.test
new file mode 100644
index 00000000..2590e07c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/plugin_maturity_basic.test
@@ -0,0 +1,21 @@
+# enum readonly
+
+#
+# show the global and session values;
+#
+select @@global.plugin_maturity;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.plugin_maturity;
+show global variables like 'plugin_maturity';
+show session variables like 'plugin_maturity';
+select * from information_schema.global_variables where variable_name='plugin_maturity';
+select * from information_schema.session_variables where variable_name='plugin_maturity';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global plugin_maturity=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session plugin_maturity=1;
+
diff --git a/mysql-test/suite/sys_vars/t/port_basic.test b/mysql-test/suite/sys_vars/t/port_basic.test
new file mode 100644
index 00000000..e20ee119
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/port_basic.test
@@ -0,0 +1,23 @@
+#
+# only global
+#
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+select @@global.port;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.port;
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+show global variables like 'port';
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+show session variables like 'port';
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+select * from information_schema.global_variables where variable_name='port';
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+select * from information_schema.session_variables where variable_name='port';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global port=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session port=1;
diff --git a/mysql-test/suite/sys_vars/t/preload_buffer_size_basic.test b/mysql-test/suite/sys_vars/t/preload_buffer_size_basic.test
new file mode 100644
index 00000000..8eba7bba
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/preload_buffer_size_basic.test
@@ -0,0 +1,216 @@
+############## mysql-test\t\preload_buffer_size_basic.test ###############
+# #
+# Variable Name: preload_buffer_size #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 32768 #
+# Range:1024-1073741824 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable preload_buffer_size #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+
+###################################################################
+# START OF preload_buffer_size TESTS #
+###################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.preload_buffer_size;
+SELECT @start_global_value;
+SET @start_session_value = @@session.preload_buffer_size;
+SELECT @start_session_value;
+
+
+--echo '#--------------------FN_DYNVARS_129_01-------------------------#'
+###################################################################
+# Display the DEFAULT value of preload_buffer_size #
+###################################################################
+
+SET @@global.preload_buffer_size = 10000;
+SET @@global.preload_buffer_size = DEFAULT;
+SELECT @@global.preload_buffer_size;
+
+SET @@session.preload_buffer_size = 20000;
+SET @@session.preload_buffer_size = DEFAULT;
+SELECT @@session.preload_buffer_size;
+
+
+--echo '#--------------------FN_DYNVARS_129_02-------------------------#'
+###################################################################
+# Check the DEFAULT value of preload_buffer_size #
+###################################################################
+
+SET @@global.preload_buffer_size = DEFAULT;
+SELECT @@global.preload_buffer_size = 32768;
+
+SET @@session.preload_buffer_size = DEFAULT;
+SELECT @@session.preload_buffer_size = 32768;
+
+
+--echo '#--------------------FN_DYNVARS_129_03-------------------------#'
+#############################################################################
+# Change the value of preload_buffer_size to a valid value for GLOBAL Scope #
+#############################################################################
+
+SET @@global.preload_buffer_size = 1024;
+SELECT @@global.preload_buffer_size;
+SET @@global.preload_buffer_size = 1025;
+SELECT @@global.preload_buffer_size;
+SET @@global.preload_buffer_size = 1073741824;
+SELECT @@global.preload_buffer_size;
+SET @@global.preload_buffer_size = 1073741823;
+SELECT @@global.preload_buffer_size;
+SET @@global.preload_buffer_size = 65536;
+SELECT @@global.preload_buffer_size;
+
+--echo '#--------------------FN_DYNVARS_129_04-------------------------#'
+##############################################################################
+# Change the value of preload_buffer_size to a valid value for SESSION Scope #
+##############################################################################
+
+SET @@session.preload_buffer_size = 1024;
+SELECT @@session.preload_buffer_size;
+SET @@session.preload_buffer_size = 1025;
+SELECT @@session.preload_buffer_size;
+SET @@session.preload_buffer_size = 1073741824;
+SELECT @@session.preload_buffer_size;
+SET @@session.preload_buffer_size = 1073741823;
+SELECT @@session.preload_buffer_size;
+SET @@session.preload_buffer_size = 655536;
+SELECT @@session.preload_buffer_size;
+
+--echo '#------------------FN_DYNVARS_129_05-----------------------#'
+###############################################################
+# Change the value of preload_buffer_size to an invalid value #
+###############################################################
+
+SET @@global.preload_buffer_size = 64;
+SELECT @@global.preload_buffer_size;
+SET @@global.preload_buffer_size = -1;
+SELECT @@global.preload_buffer_size;
+SET @@global.preload_buffer_size = 1023;
+SELECT @@global.preload_buffer_size;
+SET @@global.preload_buffer_size = 1073741825;
+SELECT @@global.preload_buffer_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.preload_buffer_size = 65530.34;
+SELECT @@global.preload_buffer_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.preload_buffer_size = test;
+SELECT @@global.preload_buffer_size;
+
+SET @@session.preload_buffer_size = 64;
+SELECT @@session.preload_buffer_size;
+SET @@session.preload_buffer_size = -2;
+SELECT @@session.preload_buffer_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.preload_buffer_size = 65530.34;
+SET @@session.preload_buffer_size = 1023;
+SELECT @@session.preload_buffer_size;
+SET @@session.preload_buffer_size = 1073741825;
+SELECT @@session.preload_buffer_size;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.preload_buffer_size = test;
+SELECT @@session.preload_buffer_size;
+
+
+--echo '#------------------FN_DYNVARS_129_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+SELECT @@global.preload_buffer_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='preload_buffer_size';
+
+
+--echo '#------------------FN_DYNVARS_129_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.preload_buffer_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='preload_buffer_size';
+
+
+--echo '#------------------FN_DYNVARS_129_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.preload_buffer_size = TRUE;
+SELECT @@global.preload_buffer_size;
+SET @@global.preload_buffer_size = FALSE;
+SELECT @@global.preload_buffer_size;
+
+
+--echo '#---------------------FN_DYNVARS_129_09----------------------#'
+#################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+#################################################################################
+
+SET @@global.preload_buffer_size = 2048;
+SELECT @@preload_buffer_size = @@global.preload_buffer_size;
+
+
+--echo '#---------------------FN_DYNVARS_129_10----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@preload_buffer_size = 5000;
+SELECT @@preload_buffer_size = @@local.preload_buffer_size;
+SELECT @@local.preload_buffer_size = @@session.preload_buffer_size;
+
+
+--echo '#---------------------FN_DYNVARS_129_11----------------------#'
+##############################################################################
+# Check if preload_buffer_size can be accessed with and without @@ sign #
+##############################################################################
+
+SET preload_buffer_size = 1024;
+SELECT @@preload_buffer_size;
+--Error ER_UNKNOWN_TABLE
+SELECT local.preload_buffer_size;
+--Error ER_UNKNOWN_TABLE
+SELECT session.preload_buffer_size;
+--Error ER_BAD_FIELD_ERROR
+SELECT preload_buffer_size = @@session.preload_buffer_size;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.preload_buffer_size = @start_global_value;
+SELECT @@global.preload_buffer_size;
+SET @@session.preload_buffer_size = @start_session_value;
+SELECT @@session.preload_buffer_size;
+
+
+########################################################
+# END OF preload_buffer_size TESTS #
+########################################################
+
diff --git a/mysql-test/suite/sys_vars/t/preudo_thread_id_grant.test b/mysql-test/suite/sys_vars/t/preudo_thread_id_grant.test
new file mode 100644
index 00000000..eebf2cd3
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/preudo_thread_id_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21975 Add BINLOG REPLAY privilege and bind new privileges to gtid_seq_no, preudo_thread_id, server_id, gtid_domain_id
+--echo #
+
+--let var = pseudo_thread_id
+--let grant = BINLOG REPLAY
+--let value = 1
+
+--source suite/sys_vars/inc/sysvar_session_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/profiling_basic.test b/mysql-test/suite/sys_vars/t/profiling_basic.test
new file mode 100644
index 00000000..da54d5a2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/profiling_basic.test
@@ -0,0 +1,52 @@
+
+#
+# 2010-01-20 OBN - Added check for I_S values after variable value change
+#
+
+--source include/have_profiling.inc
+
+SET @start_global_value = @@global.profiling;
+SELECT @start_global_value;
+
+#
+# exists as global and session
+#
+select @@global.profiling;
+select @@session.profiling;
+show global variables like 'profiling';
+show session variables like 'profiling';
+select * from information_schema.global_variables where variable_name='profiling';
+select * from information_schema.session_variables where variable_name='profiling';
+
+#
+# show that it's writable
+#
+set global profiling=1;
+set session profiling=ON;
+select @@global.profiling;
+select @@session.profiling;
+show global variables like 'profiling';
+show session variables like 'profiling';
+select * from information_schema.global_variables where variable_name='profiling';
+select * from information_schema.session_variables where variable_name='profiling';
+set global profiling=0;
+set session profiling=OFF;
+select @@global.profiling;
+select @@session.profiling;
+show global variables like 'profiling';
+show session variables like 'profiling';
+select * from information_schema.global_variables where variable_name='profiling';
+select * from information_schema.session_variables where variable_name='profiling';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global profiling=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global profiling=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global profiling="foo";
+
+SET @@global.profiling = @start_global_value;
+SELECT @@global.profiling;
diff --git a/mysql-test/suite/sys_vars/t/profiling_history_size_basic.test b/mysql-test/suite/sys_vars/t/profiling_history_size_basic.test
new file mode 100644
index 00000000..26fdc553
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/profiling_history_size_basic.test
@@ -0,0 +1,52 @@
+
+#
+# 2010-01-20 OBN Added check for variable and I_S values after incorrect change attempt
+#
+
+--source include/have_profiling.inc
+
+SET @start_global_value = @@global.profiling_history_size;
+SELECT @start_global_value;
+
+#
+# exists as global and session
+#
+select @@global.profiling_history_size;
+select @@session.profiling_history_size;
+show global variables like 'profiling_history_size';
+show session variables like 'profiling_history_size';
+select * from information_schema.global_variables where variable_name='profiling_history_size';
+select * from information_schema.session_variables where variable_name='profiling_history_size';
+
+#
+# show that it's writable
+#
+set global profiling_history_size=10;
+set session profiling_history_size=20;
+select @@global.profiling_history_size;
+select @@session.profiling_history_size;
+show global variables like 'profiling_history_size';
+show session variables like 'profiling_history_size';
+select * from information_schema.global_variables where variable_name='profiling_history_size';
+select * from information_schema.session_variables where variable_name='profiling_history_size';
+
+#
+# incorrect assignments
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global profiling_history_size=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global profiling_history_size=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global profiling_history_size="foo";
+
+#
+# min/max
+#
+set session profiling_history_size=0;
+select @@profiling_history_size;
+set session profiling_history_size=101;
+select @@profiling_history_size;
+
+SET @@global.profiling_history_size = @start_global_value;
+SELECT @@global.profiling_history_size;
diff --git a/mysql-test/suite/sys_vars/t/progress_report_time_basic.test b/mysql-test/suite/sys_vars/t/progress_report_time_basic.test
new file mode 100644
index 00000000..1292ddec
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/progress_report_time_basic.test
@@ -0,0 +1,42 @@
+# ulong session
+
+SET @start_global_value = @@global.progress_report_time;
+
+#
+# exists as global only
+#
+select @@global.progress_report_time;
+select @@session.progress_report_time;
+show global variables like 'progress_report_time';
+show session variables like 'progress_report_time';
+select * from information_schema.global_variables where variable_name='progress_report_time';
+select * from information_schema.session_variables where variable_name='progress_report_time';
+
+#
+# show that it's writable
+#
+set global progress_report_time=10;
+select @@global.progress_report_time;
+set session progress_report_time=10;
+select @@session.progress_report_time;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global progress_report_time=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set session progress_report_time=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global progress_report_time="foo";
+
+#
+# min/max values, block size
+#
+set global progress_report_time=0;
+select @@global.progress_report_time;
+set session progress_report_time=cast(-1 as unsigned int);
+select @@session.progress_report_time;
+
+SET @@global.progress_report_time = @start_global_value;
+
diff --git a/mysql-test/suite/sys_vars/t/protocol_version_basic.test b/mysql-test/suite/sys_vars/t/protocol_version_basic.test
new file mode 100644
index 00000000..3446932b
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/protocol_version_basic.test
@@ -0,0 +1,18 @@
+#
+# only global
+#
+select @@global.protocol_version;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.protocol_version;
+show global variables like 'protocol_version';
+show session variables like 'protocol_version';
+select * from information_schema.global_variables where variable_name='protocol_version';
+select * from information_schema.session_variables where variable_name='protocol_version';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global protocol_version=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session protocol_version=1;
diff --git a/mysql-test/suite/sys_vars/t/proxy_protocol_networks_grant.test b/mysql-test/suite/sys_vars/t/proxy_protocol_networks_grant.test
new file mode 100644
index 00000000..f2dd8158
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/proxy_protocol_networks_grant.test
@@ -0,0 +1,56 @@
+--source include/not_embedded.inc
+
+SET @global=@@global.proxy_protocol_networks;
+
+--echo #
+--echo # MDEV-21961 Bind CONNECTION ADMIN to a number of global system variables
+--echo #
+
+--echo # Test that "SET proxy_protocol_networks" is not allowed without CONNECTION ADMIN or SUPER
+
+CREATE USER user1@localhost;
+GRANT ALL PRIVILEGES ON *.* TO user1@localhost;
+REVOKE CONNECTION ADMIN, SUPER ON *.* FROM user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+SET GLOBAL proxy_protocol_networks="";
+--error ER_GLOBAL_VARIABLE
+SET proxy_protocol_networks="";
+--error ER_GLOBAL_VARIABLE
+SET SESSION proxy_protocol_networks="";
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET proxy_protocol_networks" is allowed with CONNECTION ADMIN
+
+CREATE USER user1@localhost;
+GRANT CONNECTION ADMIN ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+SET GLOBAL proxy_protocol_networks="";
+--error ER_GLOBAL_VARIABLE
+SET proxy_protocol_networks="";
+--error ER_GLOBAL_VARIABLE
+SET SESSION proxy_protocol_networks="";
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET proxy_protocol_networks" is allowed with SUPER
+
+CREATE USER user1@localhost;
+GRANT SUPER ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+SET GLOBAL proxy_protocol_networks="";
+--error ER_GLOBAL_VARIABLE
+SET proxy_protocol_networks="";
+--error ER_GLOBAL_VARIABLE
+SET SESSION proxy_protocol_networks="";
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+SET @@global.proxy_protocol_networks=@global;
diff --git a/mysql-test/suite/sys_vars/t/proxy_user_basic.test b/mysql-test/suite/sys_vars/t/proxy_user_basic.test
new file mode 100644
index 00000000..8c7e2d0d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/proxy_user_basic.test
@@ -0,0 +1 @@
+SELECT @@SESSION.PROXY_USER FROM DUAL;
diff --git a/mysql-test/suite/sys_vars/t/pseudo_slave_mode_basic.test b/mysql-test/suite/sys_vars/t/pseudo_slave_mode_basic.test
new file mode 100644
index 00000000..3ef39bb8
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pseudo_slave_mode_basic.test
@@ -0,0 +1,168 @@
+####################### mysql-test\t\pseudo_slave_mode_basic.test ###################
+# #
+# Variable Name: pseudo_slave_mode #
+# Scope: SESSION #
+# Access Type: Dynamic #
+# Data Type: boolean #
+# Default Value: #
+# Valid Values: 0,1 #
+# #
+# #
+# Creation Date: 2012-11-16 #
+# #
+# Description: Test Cases of Dynamic System Variable pseudo_slave_mode #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.5/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF pseudo_slave_mode TESTS #
+########################################################################
+
+
+##############################################################################
+# Saving initial value of pseudo_slave_mode in a temporary variable #
+##############################################################################
+
+SET @session_start_value = @@session.pseudo_slave_mode;
+SELECT @session_start_value;
+
+--echo '#--------------------FN_DYNVARS_156_01------------------------#'
+########################################################################
+# Display the DEFAULT value of pseudo_slave_mode #
+########################################################################
+
+SET @@session.pseudo_slave_mode = 0;
+SET @@session.pseudo_slave_mode = DEFAULT;
+SELECT @@session.pseudo_slave_mode;
+
+SET @@session.pseudo_slave_mode = 1;
+SET @@session.pseudo_slave_mode = DEFAULT;
+SELECT @@session.pseudo_slave_mode;
+
+
+--echo '#---------------------FN_DYNVARS_156_02-------------------------#'
+#############################################################################
+# Check if pseudo_slave_mode can be accessed with and without @@ sign #
+#############################################################################
+
+SET pseudo_slave_mode = 1;
+SELECT @@pseudo_slave_mode;
+
+--Error ER_UNKNOWN_TABLE
+SELECT session.pseudo_slave_mode;
+
+--Error ER_UNKNOWN_TABLE
+SELECT local.pseudo_slave_mode;
+
+SET session pseudo_slave_mode = 0;
+SELECT @@session.pseudo_slave_mode;
+
+
+--echo '#--------------------FN_DYNVARS_156_03------------------------#'
+########################################################################
+# change the value of pseudo_slave_mode to a valid value #
+########################################################################
+
+SET @@session.pseudo_slave_mode = 0;
+SELECT @@session.pseudo_slave_mode;
+SET @@session.pseudo_slave_mode = 1;
+SELECT @@session.pseudo_slave_mode;
+
+
+--echo '#--------------------FN_DYNVARS_156_04-------------------------#'
+###########################################################################
+# Change the value of pseudo_slave_mode to invalid value #
+###########################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.pseudo_slave_mode = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.pseudo_slave_mode = 2;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.pseudo_slave_mode = "T";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.pseudo_slave_mode = "Y";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.pseudo_slave_mode = TRÜE;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.pseudo_slave_mode = ÕN;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.pseudo_slave_mode = OF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.pseudo_slave_mode = ÓFF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.pseudo_slave_mode = '¹';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.pseudo_slave_mode = NO;
+
+
+--echo '#-------------------FN_DYNVARS_156_05----------------------------#'
+###########################################################################
+# Test if accessing global pseudo_slave_mode gives error #
+###########################################################################
+
+--error ER_LOCAL_VARIABLE
+SET @@global.pseudo_slave_mode = 0;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@global.pseudo_slave_mode;
+
+--echo '#----------------------FN_DYNVARS_156_06------------------------#'
+#########################################################################
+# Check if the value in SESSION Table contains variable value #
+#########################################################################
+
+SELECT count(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='pseudo_slave_mode';
+
+--echo '#----------------------FN_DYNVARS_156_07------------------------#'
+#########################################################################
+# Check if the value in SESSION Table matches value in variable #
+#########################################################################
+
+SELECT IF(@@session.pseudo_slave_mode, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='pseudo_slave_mode';
+SELECT @@session.pseudo_slave_mode;
+SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='pseudo_slave_mode';
+
+--echo '#---------------------FN_DYNVARS_156_08-------------------------#'
+###################################################################
+# Check if ON and OFF values can be used on variable #
+###################################################################
+
+SET @@session.pseudo_slave_mode = OFF;
+SELECT @@session.pseudo_slave_mode;
+SET @@session.pseudo_slave_mode = ON;
+SELECT @@session.pseudo_slave_mode;
+
+--echo '#---------------------FN_DYNVARS_156_09----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@session.pseudo_slave_mode = TRUE;
+SELECT @@session.pseudo_slave_mode;
+SET @@session.pseudo_slave_mode = FALSE;
+SELECT @@session.pseudo_slave_mode;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@session.pseudo_slave_mode = @session_start_value;
+SELECT @@session.pseudo_slave_mode;
+
+###############################################################
+# END OF pseudo_slave_mode TESTS #
+###############################################################
diff --git a/mysql-test/suite/sys_vars/t/pseudo_thread_id_basic.test b/mysql-test/suite/sys_vars/t/pseudo_thread_id_basic.test
new file mode 100644
index 00000000..aaf87912
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pseudo_thread_id_basic.test
@@ -0,0 +1,45 @@
+
+#
+# exists as a session only
+#
+# 2010-01-20 OBN - Added check for session I_S values being equal to variable value
+# - Added check for session variable value being numberic
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@global.pseudo_thread_id;
+
+--echo should be empty
+show global variables like 'pseudo_thread_id';
+
+# Check that shows returns a value (can't confirm the actual one)
+--replace_column 2 #
+show session variables like 'pseudo_thread_id';
+
+# Global I_S variable is empty
+--echo should be empty
+select * from information_schema.global_variables where variable_name='pseudo_thread_id';
+
+# Check that I_S value is same as variable
+select @@session.pseudo_thread_id = variable_value from information_schema.session_variables where variable_name='pseudo_thread_id';
+
+#
+# show that it's writable
+#
+set session pseudo_thread_id=42;
+select @@session.pseudo_thread_id;
+select * from information_schema.global_variables where variable_name='pseudo_thread_id';
+select variable_value from information_schema.session_variables where variable_name='pseudo_thread_id';
+--error ER_LOCAL_VARIABLE
+set global pseudo_thread_id=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set session pseudo_thread_id=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set session pseudo_thread_id=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set session pseudo_thread_id="foo";
+
diff --git a/mysql-test/suite/sys_vars/t/query_alloc_block_size_basic.test b/mysql-test/suite/sys_vars/t/query_alloc_block_size_basic.test
new file mode 100644
index 00000000..17936523
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/query_alloc_block_size_basic.test
@@ -0,0 +1,210 @@
+############## mysql-test\t\query_alloc_block_size_basic.test ###############
+# #
+# Variable Name: query_alloc_block_size #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 8192 #
+# Range: 1024-4294967295 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable query_alloc_block_size #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+###################################################################
+# START OF query_alloc_block_size TESTS #
+###################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.query_alloc_block_size;
+SELECT @start_global_value;
+SET @start_session_value = @@session.query_alloc_block_size;
+SELECT @start_session_value;
+
+
+--echo '#--------------------FN_DYNVARS_130_01-------------------------#'
+###################################################################
+# Display the DEFAULT value of query_alloc_block_size #
+###################################################################
+
+SET @@global.query_alloc_block_size = 10000;
+SET @@global.query_alloc_block_size = DEFAULT;
+SELECT @@global.query_alloc_block_size;
+
+SET @@session.query_alloc_block_size = 20000;
+SET @@session.query_alloc_block_size = DEFAULT;
+SELECT @@session.query_alloc_block_size;
+
+
+--echo '#--------------------FN_DYNVARS_130_02-------------------------#'
+###################################################################
+# Check the DEFAULT value of query_alloc_block_size #
+###################################################################
+
+SET @@global.query_alloc_block_size = DEFAULT;
+SELECT @@global.query_alloc_block_size = 16384;
+
+SET @@session.query_alloc_block_size = DEFAULT;
+SELECT @@session.query_alloc_block_size = 16384;
+
+
+--echo '#--------------------FN_DYNVARS_130_03-------------------------#'
+#############################################################################
+# Change the value of query_alloc_block_size to a valid value for GLOBAL Scope #
+#############################################################################
+
+SET @@global.query_alloc_block_size = 1024;
+SELECT @@global.query_alloc_block_size;
+SET @@global.query_alloc_block_size = 1025;
+SELECT @@global.query_alloc_block_size;
+SET @@global.query_alloc_block_size = 65536;
+SELECT @@global.query_alloc_block_size;
+
+--echo '#--------------------FN_DYNVARS_130_04-------------------------#'
+#################################################################################
+# Change the value of query_alloc_block_size to a valid value for SESSION Scope #
+#################################################################################
+
+SET @@session.query_alloc_block_size = 1024;
+SELECT @@session.query_alloc_block_size;
+SET @@session.query_alloc_block_size = 1025;
+SELECT @@session.query_alloc_block_size;
+SET @@session.query_alloc_block_size = 655536;
+SELECT @@session.query_alloc_block_size;
+
+--echo '#------------------FN_DYNVARS_130_05-----------------------#'
+##################################################################
+# Change the value of query_alloc_block_size to an invalid value #
+##################################################################
+
+SET @@global.query_alloc_block_size = 64;
+SELECT @@global.query_alloc_block_size;
+SET @@global.query_alloc_block_size = -1;
+SELECT @@global.query_alloc_block_size;
+SET @@global.query_alloc_block_size = 1023;
+SELECT @@global.query_alloc_block_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.query_alloc_block_size = 65530.34;
+SELECT @@global.query_alloc_block_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.query_alloc_block_size = test;
+SELECT @@global.query_alloc_block_size;
+
+SET @@session.query_alloc_block_size = 64;
+SELECT @@session.query_alloc_block_size;
+SET @@session.query_alloc_block_size = -2;
+SELECT @@session.query_alloc_block_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.query_alloc_block_size = 65530.34;
+SET @@session.query_alloc_block_size = 1023;
+SELECT @@session.query_alloc_block_size;
+#SET @@session.query_alloc_block_size = 4294967296;
+#SELECT @@session.query_alloc_block_size;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.query_alloc_block_size = test;
+SELECT @@session.query_alloc_block_size;
+
+--echo '#------------------FN_DYNVARS_130_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+#SET @@global.query_alloc_block_size = 1;
+#SET @@session.query_alloc_block_size = 12;
+
+SET @@global.query_alloc_block_size = 1;
+SET @@session.query_alloc_block_size = 12;
+
+SELECT @@global.query_alloc_block_size =
+VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='query_alloc_block_size';
+
+
+--echo '#------------------FN_DYNVARS_130_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.query_alloc_block_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='query_alloc_block_size';
+
+
+--echo '#------------------FN_DYNVARS_130_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.query_alloc_block_size = TRUE;
+SELECT @@global.query_alloc_block_size;
+SET @@global.query_alloc_block_size = FALSE;
+SELECT @@global.query_alloc_block_size;
+
+
+--echo '#---------------------FN_DYNVARS_130_09----------------------#'
+#################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+#################################################################################
+
+SET @@global.query_alloc_block_size = 2048;
+SELECT @@query_alloc_block_size = @@global.query_alloc_block_size;
+
+
+--echo '#---------------------FN_DYNVARS_130_10----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@query_alloc_block_size = 5000;
+SELECT @@query_alloc_block_size = @@local.query_alloc_block_size;
+SELECT @@local.query_alloc_block_size = @@session.query_alloc_block_size;
+
+
+--echo '#---------------------FN_DYNVARS_130_11----------------------#'
+##############################################################################
+# Check if query_alloc_block_size can be accessed with and without @@ sign #
+##############################################################################
+
+SET query_alloc_block_size = 1024;
+SELECT @@query_alloc_block_size;
+--Error ER_UNKNOWN_TABLE
+SELECT local.query_alloc_block_size;
+--Error ER_UNKNOWN_TABLE
+SELECT session.query_alloc_block_size;
+--Error ER_BAD_FIELD_ERROR
+SELECT query_alloc_block_size = @@session.query_alloc_block_size;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.query_alloc_block_size = @start_global_value;
+SELECT @@global.query_alloc_block_size;
+SET @@session.query_alloc_block_size = @start_session_value;
+SELECT @@session.query_alloc_block_size;
+
+
+########################################################
+# END OF query_alloc_block_size TESTS #
+########################################################
+
diff --git a/mysql-test/suite/sys_vars/t/query_cache_limit_basic.test b/mysql-test/suite/sys_vars/t/query_cache_limit_basic.test
new file mode 100644
index 00000000..98baa17d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/query_cache_limit_basic.test
@@ -0,0 +1,173 @@
+############## mysql-test\t\query_cache_limit_basic.test ###############
+# #
+# Variable Name: query_cache_limit #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 1048576 #
+# Min value: 0 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable query_cache_limit #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_query_cache.inc
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF query_cache_limit TESTS #
+########################################################################
+
+
+########################################################################
+# Saving initial value of query_cache_limit in a temporary variable #
+########################################################################
+
+SET @start_value = @@global.query_cache_limit;
+SELECT @start_value;
+
+
+--echo '#--------------------FN_DYNVARS_131_01------------------------#'
+########################################################################
+# Display the DEFAULT value of query_cache_limit #
+########################################################################
+
+SET @@global.query_cache_limit = 99;
+SET @@global.query_cache_limit = DEFAULT;
+SELECT @@global.query_cache_limit;
+
+
+--echo '#---------------------FN_DYNVARS_131_02-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@global.query_cache_limit = @start_value;
+SELECT @@global.query_cache_limit = 1048576;
+
+
+--echo '#--------------------FN_DYNVARS_131_03------------------------#'
+########################################################################
+# Change the value of query_cache_limit to a valid value #
+########################################################################
+
+SET @@global.query_cache_limit = 0;
+SELECT @@global.query_cache_limit;
+SET @@global.query_cache_limit = 1;
+SELECT @@global.query_cache_limit;
+SET @@global.query_cache_limit = 1048576;
+SELECT @@global.query_cache_limit;
+SET @@global.query_cache_limit = 1048575;
+SELECT @@global.query_cache_limit;
+
+
+--echo '#--------------------FN_DYNVARS_131_04-------------------------#'
+###########################################################################
+# Change the value of query_cache_limit to invalid value #
+###########################################################################
+
+SET @@global.query_cache_limit = -1;
+SELECT @@global.query_cache_limit;
+SET @@global.query_cache_limit = 4294967296;
+SELECT @@global.query_cache_limit;
+SET @@global.query_cache_limit = 10240022115;
+SELECT @@global.query_cache_limit;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.query_cache_limit = 10000.01;
+SELECT @@global.query_cache_limit;
+SET @@global.query_cache_limit = -1024;
+SELECT @@global.query_cache_limit;
+SET @@global.query_cache_limit = 42949672950;
+SELECT @@global.query_cache_limit;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.query_cache_limit = ON;
+SELECT @@global.query_cache_limit;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.query_cache_limit = 'test';
+SELECT @@global.query_cache_limit;
+
+
+--echo '#-------------------FN_DYNVARS_131_05----------------------------#'
+###########################################################################
+# Test if accessing session query_cache_limit gives error #
+###########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.query_cache_limit = 0;
+SELECT @@query_cache_limit;
+
+
+--echo '#----------------------FN_DYNVARS_131_06------------------------#'
+##############################################################################
+# Check if the value in GLOBAL & SESSION Tables matches values in variable #
+##############################################################################
+
+SELECT @@global.query_cache_limit = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='query_cache_limit';
+
+SELECT @@query_cache_limit = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='query_cache_limit';
+
+
+--echo '#---------------------FN_DYNVARS_131_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.query_cache_limit = TRUE;
+SELECT @@global.query_cache_limit;
+SET @@global.query_cache_limit = FALSE;
+SELECT @@global.query_cache_limit;
+
+
+--echo '#---------------------FN_DYNVARS_131_08----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@global.query_cache_limit = 1;
+SELECT @@query_cache_limit = @@global.query_cache_limit;
+
+
+--echo '#---------------------FN_DYNVARS_131_09----------------------#'
+##########################################################################
+# Check if query_cache_limit can be accessed with and without @@ sign #
+##########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET query_cache_limit = 1;
+SELECT @@query_cache_limit;
+--Error ER_UNKNOWN_TABLE
+SELECT local.query_cache_limit;
+--Error ER_UNKNOWN_TABLE
+SELECT global.query_cache_limit;
+--Error ER_BAD_FIELD_ERROR
+SELECT query_cache_limit = @@session.query_cache_limit;
+
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.query_cache_limit = @start_value;
+SELECT @@global.query_cache_limit;
+
+
+########################################################################
+# END OF query_cache_limit TESTS #
+########################################################################
diff --git a/mysql-test/suite/sys_vars/t/query_cache_limit_func.test b/mysql-test/suite/sys_vars/t/query_cache_limit_func.test
new file mode 100644
index 00000000..e0105c89
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/query_cache_limit_func.test
@@ -0,0 +1,182 @@
+############# mysql-test\t\Query_cache_limit_func.test ########################
+# #
+# Variable Name: Query_cache_limit #
+# Scope: SESSION #
+# Access Type: Dynamic #
+# Data Type: NUMERIC #
+# Default Value: 1048576 #
+# Min Value: 0 #
+# #
+# #
+# Creation Date: 2008-03-02 #
+# Author: Sharique Abdullah #
+# #
+# Description: Test Cases of Dynamic System Variable "Query_cache_limit" #
+# that checks behavior of this variable in the following ways #
+# * Functionality based on different values #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# #
+###############################################################################
+
+
+--echo ** Setup **
+--echo
+#
+# Setup
+#
+
+SET @global_query_cache_limit = @@global.query_cache_limit;
+SET @global_query_cache_size = @@global.query_cache_size;
+SET @global_query_cache_type = @@global.query_cache_type;
+
+SET GLOBAL query_cache_type= ON;
+SET LOCAL query_cache_type= ON;
+
+--echo ** warnings **
+--disable_warnings
+DROP TABLE IF EXISTS t;
+
+--enable_warnings
+#creating table#
+
+--echo ** creating table **
+
+CREATE TABLE t
+(
+id INT AUTO_INCREMENT PRIMARY KEY,
+c TEXT(30)
+);
+
+#inserting value#
+
+--echo **inserting value **
+
+INSERT INTO t set c = repeat('x',29);
+INSERT INTO t set c = concat(repeat('x',28),'r','x');
+INSERT INTO t set c = concat(repeat('x',28),'s','y');
+INSERT INTO t set c = concat(repeat('x',28),'g','w');
+
+# Reset cache & flush status
+--echo ** Reset cache values **
+FLUSH STATUS;
+RESET QUERY CACHE;
+
+# set query cache type value to on and allocating cache size
+--echo ** On query_cache_type **
+SET GLOBAL query_cache_type = ON;
+
+--echo ** Allocating cache size **
+SET GLOBAL query_cache_size = 131072;
+
+# reset values
+--echo ** Reset values
+SET GLOBAL query_cache_size = 0;
+SET GLOBAL query_cache_size = 131072;
+SET GLOBAL query_cache_type = ON;
+
+--echo '#---------------------FN_DYNVARS_132_01----------------------#'
+#
+#Check if results are cacheing on default value #
+#
+
+# Reset cache & flush status
+--echo ** Reset cache values **
+FLUSH STATUS;
+RESET QUERY CACHE;
+
+
+#fetching results#
+--echo ** fetching results **
+SELECT * FROM t;
+
+# Check status
+--echo ** check status on not setting query_cache_limit value **
+
+SHOW STATUS LIKE 'Qcache_not_cached';
+SHOW STATUS LIKE 'Qcache_queries_in_cache';
+
+
+--echo '#---------------------FN_DYNVARS_132_02----------------------#'
+#
+#Check if results are cacheing on setting value to 0 i.e. no caching#
+#
+
+# Reset cache & flush status
+--echo ** Reset cache values **
+FLUSH STATUS;
+RESET QUERY CACHE;
+
+#set cache limit
+--echo ** set cache limit **
+SET @@GLOBAL.query_cache_limit = 0;
+
+#fetching results#
+--echo ** fetching results **
+--disable_ps2_protocol
+SELECT * FROM t;
+--enable_ps2_protocol
+
+# Check status after setting value#
+--echo ** Check status after setting value **
+SHOW STATUS LIKE 'Qcache_not_cached';
+--echo 1 Expected
+SHOW STATUS LIKE 'Qcache_queries_in_cache';
+--echo 0 Expected
+
+
+--echo '#---------------------FN_DYNVARS_132_03----------------------#'
+#
+# Check if setting to 0 makes any difference to the cache or not #
+#
+
+#set cache limit to default
+--echo ** set cache limit **
+SET @@GLOBAL.query_cache_limit = DEFAULT;
+
+# Reset cache & flush status
+--echo ** Reset cache values **
+FLUSH STATUS;
+RESET QUERY CACHE;
+
+#fetching results#
+--echo ** fetching results **
+SELECT * FROM t;
+
+SHOW STATUS LIKE 'Qcache_not_cached';
+--echo 0 Expected
+SHOW STATUS LIKE 'Qcache_queries_in_cache';
+--echo 1 Expected
+
+SET @@GLOBAL.query_cache_limit = 0;
+
+SHOW STATUS LIKE 'Qcache_not_cached';
+--echo 0 Expected
+SHOW STATUS LIKE 'Qcache_queries_in_cache';
+--echo 1 Expected
+
+#fetching results#
+--echo ** fetching results **
+SELECT * FROM t;
+
+# Check status after setting value#
+--echo ** Check status after setting value **
+
+SHOW STATUS LIKE 'Qcache_not_cached';
+--echo 0 Expected
+SHOW STATUS LIKE 'Qcache_queries_in_cache';
+--echo 1 Expected
+
+#
+# Cleanup
+#
+
+SET @@GLOBAL.query_cache_limit = @global_query_cache_limit;
+SET GLOBAL query_cache_size = @global_query_cache_size;
+SET GLOBAL query_cache_type = @global_query_cache_type;
+
+--disable_warnings
+DROP TABLE IF EXISTS t;
+--enable_warnings
+
diff --git a/mysql-test/suite/sys_vars/t/query_cache_min_res_unit_basic.test b/mysql-test/suite/sys_vars/t/query_cache_min_res_unit_basic.test
new file mode 100644
index 00000000..b7916e73
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/query_cache_min_res_unit_basic.test
@@ -0,0 +1,180 @@
+############## mysql-test\t\query_cache_min_res_unit_basic.test ###############
+# #
+# Variable Name: query_cache_min_res_unit #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value:1024 #
+# Min Value:0 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable query_cache_min_res_unit #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_query_cache.inc
+--source include/load_sysvars.inc
+
+########################################################################
+
+
+########################################################################
+# START OF query_cache_min_res_unit TESTS #
+########################################################################
+
+
+###############################################################################
+# Saving initial value of query_cache_min_res_unit in a temporary variable #
+###############################################################################
+
+SET @start_value = @@global.query_cache_min_res_unit;
+SELECT @start_value;
+
+
+--echo '#--------------------FN_DYNVARS_132_01------------------------#'
+###############################################################################
+# Display the DEFAULT value of query_cache_min_res_unit #
+###############################################################################
+
+SET @@global.query_cache_min_res_unit = 99;
+SET @@global.query_cache_min_res_unit = DEFAULT;
+SELECT @@global.query_cache_min_res_unit;
+
+
+--echo '#---------------------FN_DYNVARS_132_02-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@global.query_cache_min_res_unit = @start_value;
+SELECT @@global.query_cache_min_res_unit = 4096;
+
+
+--echo '#--------------------FN_DYNVARS_132_03------------------------#'
+################################################################################
+# Change the value of query_cache_min_res_unit to a valid value #
+################################################################################
+
+SET @@global.query_cache_min_res_unit = 0;
+SELECT @@global.query_cache_min_res_unit;
+SET @@global.query_cache_min_res_unit = 1;
+SELECT @@global.query_cache_min_res_unit;
+SET @@global.query_cache_min_res_unit = 512;
+SELECT @@global.query_cache_min_res_unit;
+SET @@global.query_cache_min_res_unit = 513;
+SELECT @@global.query_cache_min_res_unit;
+SET @@global.query_cache_min_res_unit = 1048576;
+SELECT @@global.query_cache_min_res_unit;
+SET @@global.query_cache_min_res_unit = 1048575;
+SELECT @@global.query_cache_min_res_unit;
+
+
+--echo '#--------------------FN_DYNVARS_132_04-------------------------#'
+###################################################################################
+# Change the value of query_cache_min_res_unit to invalid value #
+###################################################################################
+
+SET @@global.query_cache_min_res_unit = -1;
+SELECT @@global.query_cache_min_res_unit;
+SET @@global.query_cache_min_res_unit = 4294967296;
+SELECT @@global.query_cache_min_res_unit;
+SET @@global.query_cache_min_res_unit = 511;
+SELECT @@global.query_cache_min_res_unit;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.query_cache_min_res_unit = 10000.01;
+SELECT @@global.query_cache_min_res_unit;
+SET @@global.query_cache_min_res_unit = -1024;
+SELECT @@global.query_cache_min_res_unit;
+SET @@global.query_cache_min_res_unit = 42949672950;
+SELECT @@global.query_cache_min_res_unit;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.query_cache_min_res_unit = ON;
+SELECT @@global.query_cache_min_res_unit;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.query_cache_min_res_unit = 'test';
+SELECT @@global.query_cache_min_res_unit;
+
+
+--echo '#-------------------FN_DYNVARS_132_05----------------------------#'
+###################################################################################
+# Test if accessing session query_cache_min_res_unit gives error #
+###################################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.query_cache_min_res_unit = 0;
+SELECT @@query_cache_min_res_unit;
+
+
+--echo '#----------------------FN_DYNVARS_132_06------------------------#'
+##############################################################################
+# Check if the value in GLOBAL & SESSION Tables matches values in variable #
+##############################################################################
+
+SELECT @@global.query_cache_min_res_unit = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='query_cache_min_res_unit';
+
+SELECT @@query_cache_min_res_unit = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='query_cache_min_res_unit';
+
+
+--echo '#---------------------FN_DYNVARS_132_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.query_cache_min_res_unit = TRUE;
+SELECT @@global.query_cache_min_res_unit;
+SET @@global.query_cache_min_res_unit = FALSE;
+SELECT @@global.query_cache_min_res_unit;
+
+
+--echo '#---------------------FN_DYNVARS_132_08----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@global.query_cache_min_res_unit = 1;
+SELECT @@query_cache_min_res_unit = @@global.query_cache_min_res_unit;
+
+
+--echo '#---------------------FN_DYNVARS_132_09----------------------#'
+##################################################################################
+# Check if query_cache_min_res_unit can be accessed with and without @@ sign #
+##################################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET query_cache_min_res_unit = 1;
+SELECT @@query_cache_min_res_unit;
+--Error ER_UNKNOWN_TABLE
+SELECT local.query_cache_min_res_unit;
+--Error ER_UNKNOWN_TABLE
+SELECT global.query_cache_min_res_unit;
+--Error ER_BAD_FIELD_ERROR
+SELECT query_cache_min_res_unit = @@session.query_cache_min_res_unit;
+
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.query_cache_min_res_unit = @start_value;
+SELECT @@global.query_cache_min_res_unit;
+
+
+########################################################################
+# END OF query_cache_min_res_unit TESTS #
+########################################################################
diff --git a/mysql-test/suite/sys_vars/t/query_cache_size_basic.test b/mysql-test/suite/sys_vars/t/query_cache_size_basic.test
new file mode 100644
index 00000000..352cc29a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/query_cache_size_basic.test
@@ -0,0 +1,161 @@
+############## mysql-test\t\query_cache_size_basic.test ###############
+# #
+# Variable Name: query_cache_size #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 0 #
+# Range: - #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable query_cache_size #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_query_cache.inc
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF query_cache_size TESTS #
+########################################################################
+
+
+###############################################################################
+# Saving initial value of query_cache_size in a temporary variable #
+###############################################################################
+
+SET @start_value = @@global.query_cache_size;
+
+--echo '#--------------------FN_DYNVARS_133_01------------------------#'
+###############################################################################
+# Display the DEFAULT value of query_cache_size #
+###############################################################################
+
+SET @@global.query_cache_size = 99;
+SET @@global.query_cache_size = DEFAULT;
+SELECT @@global.query_cache_size;
+
+--echo '#---------------------FN_DYNVARS_133_02-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@global.query_cache_size = @start_value;
+SELECT @@global.query_cache_size = @start_value;
+
+--echo '#--------------------FN_DYNVARS_133_03------------------------#'
+################################################################################
+# Change the value of query_cache_size to a valid value #
+################################################################################
+
+SET @@global.query_cache_size = 0;
+SELECT @@global.query_cache_size;
+SET @@global.query_cache_size = 1;
+SELECT @@global.query_cache_size;
+
+SET @@global.query_cache_size = 512;
+SELECT @@global.query_cache_size;
+SET @@global.query_cache_size = 1024;
+SELECT @@global.query_cache_size;
+SET @@global.query_cache_size = 1048576;
+SELECT @@global.query_cache_size;
+SET @@global.query_cache_size = 1048575;
+SELECT @@global.query_cache_size;
+
+--echo '#--------------------FN_DYNVARS_133_04-------------------------#'
+###################################################################################
+# Change the value of query_cache_size to invalid value #
+###################################################################################
+
+SET @@global.query_cache_size = -1;
+SELECT @@global.query_cache_size;
+SET @@global.query_cache_size = 511;
+SELECT @@global.query_cache_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.query_cache_size = 10000.01;
+SELECT @@global.query_cache_size;
+SET @@global.query_cache_size = -1024;
+SELECT @@global.query_cache_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.query_cache_size = ON;
+SELECT @@global.query_cache_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.query_cache_size = 'test';
+SELECT @@global.query_cache_size;
+
+--echo '#-------------------FN_DYNVARS_133_05----------------------------#'
+###################################################################################
+# Test if accessing session query_cache_size gives error #
+###################################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.query_cache_size = 0;
+SELECT @@query_cache_size;
+
+--echo '#----------------------FN_DYNVARS_133_06------------------------#'
+##############################################################################
+# Check if the value in GLOBAL & SESSION Tables matches values in variable #
+##############################################################################
+
+SELECT @@global.query_cache_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='query_cache_size';
+
+SELECT @@query_cache_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='query_cache_size';
+
+--echo '#---------------------FN_DYNVARS_133_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.query_cache_size = TRUE;
+SELECT @@global.query_cache_size;
+SET @@global.query_cache_size = FALSE;
+SELECT @@global.query_cache_size;
+
+--echo '#---------------------FN_DYNVARS_133_08----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@global.query_cache_size = 1;
+SELECT @@query_cache_size = @@global.query_cache_size;
+
+--echo '#---------------------FN_DYNVARS_133_09----------------------#'
+##################################################################################
+# Check if query_cache_size can be accessed with and without @@ sign #
+##################################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET query_cache_size = 1;
+SELECT @@query_cache_size;
+--Error ER_UNKNOWN_TABLE
+SELECT local.query_cache_size;
+--Error ER_UNKNOWN_TABLE
+SELECT global.query_cache_size;
+--Error ER_BAD_FIELD_ERROR
+SELECT query_cache_size = @@session.query_cache_size;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.query_cache_size = @start_value;
+
+########################################################################
+# END OF query_cache_size TESTS #
+########################################################################
+
diff --git a/mysql-test/suite/sys_vars/t/query_cache_strip_comments_basic.test b/mysql-test/suite/sys_vars/t/query_cache_strip_comments_basic.test
new file mode 100644
index 00000000..62bb4452
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/query_cache_strip_comments_basic.test
@@ -0,0 +1,39 @@
+# bool session
+
+SET @start_global_value = @@global.query_cache_strip_comments;
+
+select @@global.query_cache_strip_comments;
+select @@session.query_cache_strip_comments;
+show global variables like 'query_cache_strip_comments';
+show session variables like 'query_cache_strip_comments';
+select * from information_schema.global_variables where variable_name='query_cache_strip_comments';
+select * from information_schema.session_variables where variable_name='query_cache_strip_comments';
+
+#
+# show that it's writable
+#
+set global query_cache_strip_comments=ON;
+select @@global.query_cache_strip_comments;
+set global query_cache_strip_comments=OFF;
+select @@global.query_cache_strip_comments;
+set global query_cache_strip_comments=1;
+select @@global.query_cache_strip_comments;
+
+set session query_cache_strip_comments=ON;
+select @@session.query_cache_strip_comments;
+set session query_cache_strip_comments=OFF;
+select @@session.query_cache_strip_comments;
+set session query_cache_strip_comments=1;
+select @@session.query_cache_strip_comments;
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global query_cache_strip_comments=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set session query_cache_strip_comments=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set session query_cache_strip_comments="foo";
+
+SET @@global.query_cache_strip_comments = @start_global_value;
+
diff --git a/mysql-test/suite/sys_vars/t/query_cache_type_basic.test b/mysql-test/suite/sys_vars/t/query_cache_type_basic.test
new file mode 100644
index 00000000..19784270
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/query_cache_type_basic.test
@@ -0,0 +1,196 @@
+################ mysql-test\t\query_cache_type_basic.test #####################
+# #
+# Variable Name: query_cache_type #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: enumeration #
+# Default Value: 1 #
+# Range: 0,1 & 2 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable query_cache_type #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF query_cache_type TESTS #
+########################################################################
+
+
+###########################################################################
+# Saving initial value of query_cache_type in a temporary variable #
+###########################################################################
+
+SET @global_start_value = @@global.query_cache_type;
+SELECT @global_start_value;
+
+SET @session_start_value = @@session.query_cache_type;
+SELECT @session_start_value;
+
+--echo '#--------------------FN_DYNVARS_134_01------------------------#'
+########################################################################
+# Display the DEFAULT value of query_cache_type #
+########################################################################
+
+SET @@global.query_cache_type = 0;
+SET @@global.query_cache_type = DEFAULT;
+SELECT @@global.query_cache_type;
+
+SET @@session.query_cache_type = 0;
+SET @@session.query_cache_type = DEFAULT;
+SELECT @@session.query_cache_type;
+
+
+--echo '#---------------------FN_DYNVARS_134_02-------------------------#'
+#########################################################
+# Check if NULL or empty value is accepeted #
+#########################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.query_cache_type = NULL;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.query_cache_type = '';
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.query_cache_type = NULL;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.query_cache_type = '';
+
+--echo '#--------------------FN_DYNVARS_134_03------------------------#'
+########################################################################
+# Change the value of query_cache_type to a valid value #
+########################################################################
+
+SET @@global.query_cache_type = OFF;
+SELECT @@global.query_cache_type;
+
+SET @@global.query_cache_type = ON;
+SELECT @@global.query_cache_type;
+
+SET @@global.query_cache_type = DEMAND;
+SELECT @@global.query_cache_type;
+
+SET @@session.query_cache_type = OFF;
+SELECT @@session.query_cache_type;
+
+SET @@session.query_cache_type = ON;
+SELECT @@session.query_cache_type;
+
+SET @@session.query_cache_type = DEMAND;
+SELECT @@session.query_cache_type;
+
+
+--echo '#--------------------FN_DYNVARS_134_04-------------------------#'
+###########################################################################
+# Change the value of query_cache_type to invalid value #
+###########################################################################
+
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.query_cache_type = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.query_cache_type = ONDEMAND;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.query_cache_type = 'ON,OFF';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.query_cache_type = 'OF';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.query_cache_type = YES;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.query_cache_type = ' ';
+
+
+--echo '#-------------------FN_DYNVARS_134_05----------------------------#'
+#########################################################################
+# Check if the value in session Table matches value in variable #
+#########################################################################
+
+SELECT @@session.query_cache_type = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='query_cache_type';
+
+--echo '#----------------------FN_DYNVARS_134_06------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#########################################################################
+
+SELECT @@global.query_cache_type = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='query_cache_type';
+
+
+--echo '#---------------------FN_DYNVARS_134_07-------------------------#'
+###################################################################
+# Check if numbers can be used on variable #
+###################################################################
+
+# test if variable accepts 0,1,2
+SET @@global.query_cache_type = 0;
+SELECT @@global.query_cache_type;
+
+SET @@global.query_cache_type = 1;
+SELECT @@global.query_cache_type;
+
+SET @@global.query_cache_type = 2;
+SELECT @@global.query_cache_type;
+
+# use of decimal values
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.query_cache_type = 0.4;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.query_cache_type = 3;
+
+
+--echo '#---------------------FN_DYNVARS_134_08----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.query_cache_type = TRUE;
+SELECT @@global.query_cache_type;
+SET @@global.query_cache_type = FALSE;
+SELECT @@global.query_cache_type;
+
+--echo '#---------------------FN_DYNVARS_134_09----------------------#'
+######################################################################
+# Check if query_cache_type can be accessed with and without @@ sign #
+######################################################################
+
+SET global query_cache_type = 'ON';
+
+SET session query_cache_type = 1;
+SELECT @@query_cache_type;
+
+SET global query_cache_type = 0;
+SELECT @@global.query_cache_type;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.query_cache_type = @global_start_value;
+SELECT @@global.query_cache_type;
+
+SET @@session.query_cache_type = @session_start_value;
+SELECT @@session.query_cache_type;
+
+########################################################################
+# END OF query_cache_type TESTS #
+########################################################################
diff --git a/mysql-test/suite/sys_vars/t/query_cache_type_func.test b/mysql-test/suite/sys_vars/t/query_cache_type_func.test
new file mode 100644
index 00000000..e1b5f4d1
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/query_cache_type_func.test
@@ -0,0 +1,308 @@
+############# mysql-test\t\query_cache_type_func.test #########################
+# #
+# Variable Name: query_cache_type #
+# Scope: GLOBAL & SESSION #
+# Access Type: Dynamic #
+# Data Type: enumeration #
+# Default Value: ON #
+# Values: ON, OFF, DEMAND #
+# #
+# #
+# Creation Date: 2008-02-20 #
+# Author: Sharique Abdullah #
+# #
+# Description: Test Cases of Dynamic System Variable "query_cache_type" #
+# that checks behavior of this variable in the following ways #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# #
+###############################################################################
+
+--echo ** Setup **
+--echo
+
+# Setup
+#
+
+#
+# Save initial value
+#
+
+connect (con0,localhost,root,,);
+connection con0;
+
+SET @start_global_value = @@GLOBAL.query_cache_type;
+SET @start_session_value = @@SESSION.query_cache_type;
+SET @start_query_cache_size= @@global.query_cache_size;
+
+#
+# Creating test table
+#
+
+CREATE TABLE t1(id int, value varchar(10));
+
+INSERT INTO t1 VALUES(1, 'val1');
+INSERT INTO t1 VALUES(2, 'val2');
+INSERT INTO t1 VALUES(3, 'val3');
+
+#
+# Clearing the query cache and setting up cache size
+#
+
+SET @@GLOBAL.query_cache_size = 65536;
+
+--echo FLUSHING CACHE
+SET @@GLOBAL.query_cache_size = 0;
+SET @@GLOBAL.query_cache_size = 65536;
+
+#
+# SESSION SCOPE
+#
+
+--echo ** TESTING SESSION SCOPE **
+
+--echo '#--------------------FN_DYNVARS_135_01-------------------------#'
+#
+# Testing default value it should be ON by default
+#
+
+SET @@query_cache_type = DEFAULT;
+SELECT @@query_cache_type;
+--echo OFF Expected
+--error ER_QUERY_CACHE_IS_GLOBALY_DISABLED
+SET @@query_cache_type = ON;
+
+--echo '#--------------------FN_DYNVARS_135_02-------------------------#'
+#
+# Testing valid possible values
+#
+SET GLOBAL query_cache_type= ON;
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@query_cache_type = NULL;
+--echo Expected error: Wrong value for variable
+
+SET @@query_cache_type = ON;
+SELECT @@query_cache_type;
+--echo ON Expected
+
+SET @@query_cache_type = OFF;
+SELECT @@query_cache_type;
+--echo OFF Expected
+
+SET @@query_cache_type = DEMAND;
+SELECT @@query_cache_type;
+--echo DEMAND Expected
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@query_cache_type = XYZ;
+--echo Expected error: Wrong value for variable
+
+
+#
+# TESTING FOR VALUE ON or 1
+#
+
+--echo ** Turning cache to ON **
+
+SET @@query_cache_type = ON;
+
+--echo '#--------------------FN_DYNVARS_135_03-------------------------#'
+#
+# TESTING CACHE ADDITION
+#
+
+--echo ** CACHE ADDITION **
+--echo
+
+SHOW STATUS LIKE 'Qcache_queries_in_cache';
+--echo 0 Expected
+
+SELECT * FROM t1;
+
+SHOW STATUS LIKE 'Qcache_queries_in_cache';
+--echo 1 Expected
+
+SELECT value FROM t1;
+
+SHOW STATUS LIKE 'Qcache_queries_in_cache';
+--echo 2 Expected
+
+--echo '#--------------------FN_DYNVARS_135_04-------------------------#'
+#
+# TESTING CACHE HIT
+#
+
+--echo ** CACHE HIT **
+
+SELECT * FROM t1;
+
+SHOW STATUS LIKE 'Qcache_queries_in_cache';
+--echo 2 Expected
+
+SELECT SQL_CACHE value FROM t1;
+
+SHOW STATUS LIKE 'Qcache_queries_in_cache';
+--echo 3 Expected
+
+SELECT SQL_NO_CACHE value FROM t1;
+
+SHOW STATUS LIKE 'Qcache_queries_in_cache';
+--echo 3 Expected
+
+--echo '#--------------------FN_DYNVARS_135_05-------------------------#'
+#
+# Testing with store procedure
+#
+
+--echo Testing with store procedure
+
+delimiter |;
+
+CREATE PROCEDURE testProcHit()
+BEGIN
+ SELECT * FROM t1;
+ SELECT SQL_CACHE value FROM t1;
+END|
+
+delimiter ;|
+
+CALL testProcHit();
+
+SHOW STATUS LIKE 'Qcache_queries_in_cache';
+--echo Expected value : 3
+--echo ==================
+--echo Bug#35388: Stored procedure execution causes improper behavior of query cache.
+
+
+--echo '#--------------------FN_DYNVARS_135_06-------------------------#'
+#
+# TESTING FOR VALUE OFF or 0
+#
+
+--echo FLUSHING CACHE
+SET @@GLOBAL.query_cache_size = 0;
+SET @@GLOBAL.query_cache_size = 65536;
+
+--echo ** Turning cache to OFF **
+
+SET @@query_cache_type = OFF;
+SELECT @@query_cache_type;
+
+SELECT id FROM t1;
+
+SHOW STATUS LIKE 'Qcache_queries_in_cache';
+--echo 0 Expected
+
+--echo '#--------------------FN_DYNVARS_135_07-------------------------#'
+#
+# TESTING QUERY WITH SQL_CACHE
+#
+
+SELECT SQL_CACHE id FROM t1;
+
+SHOW STATUS LIKE 'Qcache_queries_in_cache';
+--echo 0 Expected
+
+SELECT SQL_CACHE * FROM t1;
+
+SHOW STATUS LIKE 'Qcache_queries_in_cache';
+--echo 0 Expected
+
+--echo '#--------------------FN_DYNVARS_135_08-------------------------#'
+#
+# TESTING FOR VALUE DEMAND or 2
+#
+
+--echo FLUSHING CACHE
+SET @@GLOBAL.query_cache_size = 0;
+SET @@GLOBAL.query_cache_size = 65536;
+
+--echo ** Turning cache to DEMAND **
+
+SET @@query_cache_type = DEMAND;
+SELECT @@query_cache_type;
+
+--echo '#--------------------FN_DYNVARS_135_09-------------------------#'
+#
+# TESTING NORMAL QUERY
+#
+
+SELECT value,id FROM t1;
+
+SHOW STATUS LIKE 'Qcache_queries_in_cache';
+--echo 0 Expected
+
+SELECT SQL_CACHE * FROM t1;
+
+SHOW STATUS LIKE 'Qcache_queries_in_cache';
+--echo 0 Expected
+
+#
+# GLOBAL SCOPE
+#
+
+--echo ** TESTING GLOBAL SCOPE **
+
+--echo '#--------------------FN_DYNVARS_135_10-------------------------#'
+#
+# Turning global cache to OFF
+#
+
+SET @@GLOBAL.query_cache_type = OFF;
+
+connect (con1,localhost,root,,);
+
+connection con1;
+
+SELECT @@query_cache_type;
+--echo OFF Expected
+
+--echo '#--------------------FN_DYNVARS_135_11-------------------------#'
+#
+# Turning global cache to DEMAND
+#
+SET @@GLOBAL.query_cache_type = DEMAND;
+
+connect (con2,localhost,root,,);
+
+connection con2;
+
+SELECT @@query_cache_type;
+--echo DEMAND Expected
+
+--echo '#--------------------FN_DYNVARS_135_12-------------------------#'
+#
+# Turning global cache to ON
+#
+SET @@GLOBAL.query_cache_type = ON;
+
+connect (con3,localhost,root,,);
+connection con3;
+
+SELECT @@query_cache_type;
+--echo ON Expected
+
+--echo
+--echo ** Cleanup **
+--echo
+#
+# Cleanup
+#
+
+disconnect con1;
+disconnect con2;
+disconnect con3;
+
+connection con0;
+
+SET @@GLOBAL.query_cache_type = @start_global_value;
+SET @@SESSION.query_cache_type = @start_session_value;
+SET GLOBAL query_cache_size = @start_query_cache_size;
+
+DROP TABLE t1;
+
+DROP PROCEDURE testProcHit;
+
+disconnect con0;
diff --git a/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_basic.test b/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_basic.test
new file mode 100644
index 00000000..055c3629
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_basic.test
@@ -0,0 +1,223 @@
+########### mysql-test\t\query_cache_wlock_invalidate_basic.test ##############
+# #
+# Variable Name: query_cache_wlock_invalidate #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: boolean #
+# Default Value: FALSE #
+# Range: TRUE, FALSE #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable #
+# query_cache_wlock_invalidate that checks the behavior of this #
+# variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF query_cache_wlock_invalidate TESTS #
+########################################################################
+
+
+###############################################################################
+# Saving initial value of query_cache_wlock_invalidate in a temporary variable#
+###############################################################################
+
+SET @session_start_value = @@session.query_cache_wlock_invalidate;
+SELECT @session_start_value;
+
+SET @global_start_value = @@global.query_cache_wlock_invalidate;
+SELECT @global_start_value;
+
+--echo '#--------------------FN_DYNVARS_135_01------------------------#'
+########################################################################
+# Display the DEFAULT value of query_cache_wlock_invalidate #
+########################################################################
+
+SET @@session.query_cache_wlock_invalidate = 1;
+SET @@session.query_cache_wlock_invalidate = DEFAULT;
+SELECT @@session.query_cache_wlock_invalidate;
+
+SET @@global.query_cache_wlock_invalidate = 1;
+SET @@global.query_cache_wlock_invalidate = DEFAULT;
+SELECT @@global.query_cache_wlock_invalidate;
+
+--echo '#---------------------FN_DYNVARS_135_02-------------------------#'
+###########################################################################
+# Check if query_cache_wlock_invalidate can be accessed with and without
+# @@ sign
+###########################################################################
+
+SET query_cache_wlock_invalidate = 1;
+SELECT @@query_cache_wlock_invalidate;
+
+--Error ER_UNKNOWN_TABLE
+SELECT session.query_cache_wlock_invalidate;
+
+--Error ER_UNKNOWN_TABLE
+SELECT local.query_cache_wlock_invalidate;
+
+--Error ER_UNKNOWN_TABLE
+SELECT global.query_cache_wlock_invalidate;
+
+#using another syntax for accessing system variables
+SET session query_cache_wlock_invalidate = 0;
+SELECT @@session.query_cache_wlock_invalidate;
+
+SET global query_cache_wlock_invalidate = 0;
+SELECT @@global.query_cache_wlock_invalidate;
+
+
+--echo '#--------------------FN_DYNVARS_135_03------------------------#'
+##########################################################################
+# change the value of query_cache_wlock_invalidate to a valid value #
+##########################################################################
+# for session
+SET @@session.query_cache_wlock_invalidate = 0;
+SELECT @@session.query_cache_wlock_invalidate;
+SET @@session.query_cache_wlock_invalidate = 1;
+SELECT @@session.query_cache_wlock_invalidate;
+
+# for global
+SET @@global.query_cache_wlock_invalidate = 0;
+SELECT @@global.query_cache_wlock_invalidate;
+SET @@global.query_cache_wlock_invalidate = 1;
+SELECT @@global.query_cache_wlock_invalidate;
+
+
+--echo '#--------------------FN_DYNVARS_135_04-------------------------#'
+###########################################################################
+# Change the value of query_cache_wlock_invalidate to invalid value #
+###########################################################################
+
+# for session
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.query_cache_wlock_invalidate = -1;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.query_cache_wlock_invalidate = 1.6;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.query_cache_wlock_invalidate = "T";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.query_cache_wlock_invalidate = "Y";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.query_cache_wlock_invalidate = TRÜE;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.query_cache_wlock_invalidate = ÕN;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.query_cache_wlock_invalidate = OF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.query_cache_wlock_invalidate = ÓFF;
+
+# for global
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.query_cache_wlock_invalidate = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.query_cache_wlock_invalidate = 2;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.query_cache_wlock_invalidate = "T";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.query_cache_wlock_invalidate = "Y";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.query_cache_wlock_invalidate = TRÜE;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.query_cache_wlock_invalidate = ÕN;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.query_cache_wlock_invalidate = OF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.query_cache_wlock_invalidate = ÓFF;
+
+
+--echo '#-------------------FN_DYNVARS_135_05----------------------------#'
+###########################################################################
+# Test if changing global variable effects session and vice versa #
+###########################################################################
+
+SET @@global.query_cache_wlock_invalidate = 0;
+SET @@session.query_cache_wlock_invalidate = 1;
+SELECT @@global.query_cache_wlock_invalidate AS res_is_0;
+
+SET @@global.query_cache_wlock_invalidate = 0;
+SELECT @@session.query_cache_wlock_invalidate AS res_is_1;
+
+--echo '#----------------------FN_DYNVARS_135_06------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#########################################################################
+
+SELECT IF(@@global.query_cache_wlock_invalidate, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='query_cache_wlock_invalidate';
+SELECT @@global.query_cache_wlock_invalidate;
+SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='query_cache_wlock_invalidate';
+
+--echo '#----------------------FN_DYNVARS_135_07------------------------#'
+#########################################################################
+# Check if the value in SESSION Table matches value in variable #
+#########################################################################
+
+SELECT IF(@@session.query_cache_wlock_invalidate, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='query_cache_wlock_invalidate';
+SELECT @@session.query_cache_wlock_invalidate;
+SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='query_cache_wlock_invalidate';
+
+--echo '#---------------------FN_DYNVARS_135_08-------------------------#'
+###################################################################
+# Check if ON and OFF values can be used on variable #
+###################################################################
+
+SET @@session.query_cache_wlock_invalidate = OFF;
+SELECT @@session.query_cache_wlock_invalidate;
+SET @@session.query_cache_wlock_invalidate = ON;
+SELECT @@session.query_cache_wlock_invalidate;
+
+SET @@global.query_cache_wlock_invalidate = OFF;
+SELECT @@global.query_cache_wlock_invalidate;
+SET @@global.query_cache_wlock_invalidate = ON;
+SELECT @@global.query_cache_wlock_invalidate;
+
+--echo '#---------------------FN_DYNVARS_135_09----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@session.query_cache_wlock_invalidate = TRUE;
+SELECT @@session.query_cache_wlock_invalidate;
+SET @@session.query_cache_wlock_invalidate = FALSE;
+SELECT @@session.query_cache_wlock_invalidate;
+
+SET @@global.query_cache_wlock_invalidate = TRUE;
+SELECT @@global.query_cache_wlock_invalidate;
+SET @@global.query_cache_wlock_invalidate = FALSE;
+SELECT @@global.query_cache_wlock_invalidate;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@session.query_cache_wlock_invalidate = @session_start_value;
+SELECT @@session.query_cache_wlock_invalidate;
+
+SET @@global.query_cache_wlock_invalidate = @global_start_value;
+SELECT @@global.query_cache_wlock_invalidate;
+
+###############################################################
+# END OF query_cache_wlock_invalidate TESTS #
+###############################################################
diff --git a/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_func.test b/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_func.test
new file mode 100644
index 00000000..6b38e3fa
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_func.test
@@ -0,0 +1,263 @@
+######################################################################################
+# #
+# Variable Name: query_cache_wlock_invalidate #
+# Scope: GLOBAL & SESSION #
+# Access Type: Dynamic #
+# Data Type: boolean #
+# Default Value: FALSE #
+# Values: TRUE / 1, FALSE / 0 #
+# #
+# #
+# Creation Date: 2008-02-21 #
+# Author: Sharique Abdullah #
+# Modified: HHunger 2009-02-27 Replaced sleeps, beautifications #
+# #
+# Description: Test Cases of Dynamic System Variable "query_cache_wlock_invalidate" #
+# that checks behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Cache behaviors #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# #
+######################################################################################
+
+--echo ** Setup **
+--echo
+#
+# Setup
+#
+
+--source include/not_embedded.inc
+
+# disabled due to differences in the result
+--disable_ps_protocol
+#
+# Save initial value
+#
+connect (con0,localhost,root,,);
+connect (con1, localhost, root,,);
+connection con0;
+
+SET @start_global_value = @@GLOBAL.query_cache_wlock_invalidate;
+SET @start_session_value = @@SESSION.query_cache_wlock_invalidate;
+
+SET @old_cache_size = @@GLOBAL.query_cache_size;
+SET @old_cache_type = @@GLOBAL.query_cache_type;
+SET GLOBAL query_cache_type= ON;
+SET LOCAL query_cache_type= ON;
+connection con1;
+SET LOCAL query_cache_type= ON;
+connection con0;
+
+#
+# Creating test table
+#
+
+CREATE TABLE t1(id int, value varchar(10));
+
+INSERT INTO t1 VALUES(1, 'val1');
+INSERT INTO t1 VALUES(2, 'val2');
+INSERT INTO t1 VALUES(3, 'val3');
+
+#
+# Clearing the query cache and setting up cache size
+#
+
+SET GLOBAL query_cache_size = 131072;
+
+--echo FLUSHING CACHE
+SET GLOBAL query_cache_size = 0;
+SET GLOBAL query_cache_size = 131072;
+
+SET GLOBAL query_cache_type = ON;
+
+#
+# Testing for value ON
+#
+--echo Testing for value ON
+
+connection con0;
+
+SET SESSION query_cache_wlock_invalidate = ON;
+
+connection con1;
+
+SET SESSION query_cache_wlock_invalidate = ON;
+
+--echo '#----------------------------FN_DYNVARS_136_01--------------#'
+#
+# Testing for cache invalidation
+#
+
+--echo Testing for cache invalidation
+
+SELECT * FROM t1;
+
+SHOW STATUS LIKE 'Qcache_queries_in_cache';
+--echo 1 Expected
+
+LOCK TABLE t1 WRITE;
+
+UNLOCK TABLES;
+
+SHOW STATUS LIKE 'Qcache_queries_in_cache';
+--echo 0 Expected
+
+--echo '#----------------------------FN_DYNVARS_136_02-----------------------#'
+#
+# Testing for blockage of access
+#
+
+disable_result_log;
+
+SELECT * FROM t1;
+
+SHOW STATUS LIKE 'Qcache_queries_in_cache';
+
+enable_result_log;
+
+connection con1;
+
+SELECT * FROM t1;
+
+connection con0;
+
+LOCK TABLE t1 WRITE;
+
+connection con1;
+
+--echo ** Asynchronous Execution **
+send SELECT * FROM t1;
+
+connection con0;
+
+--echo wait until table is locked
+let $wait_condition= SELECT count(*) > 0 FROM information_schema.processlist
+ WHERE state= 'Waiting for table metadata lock';
+--source include/wait_condition.inc
+UNLOCK TABLES;
+
+connection con1;
+--echo ** Asynchronous Result **
+reap;
+
+#
+# Testing for value OFF
+#
+--echo Testing for value OFF
+
+connection con0;
+
+SET SESSION query_cache_wlock_invalidate = OFF;
+
+connection con1;
+
+SET SESSION query_cache_wlock_invalidate = OFF;
+
+--echo '#----------------------------FN_DYNVARS_136_03------------------#'
+#
+# Testing for cache invalidation
+#
+
+--echo Testing for cache invalidation
+
+SELECT * FROM t1;
+
+SHOW STATUS LIKE 'Qcache_queries_in_cache';
+--echo 1 Expected
+
+LOCK TABLE t1 WRITE;
+
+UNLOCK TABLES;
+
+SHOW STATUS LIKE 'Qcache_queries_in_cache';
+--echo 0 Expected
+
+--echo '#----------------------------FN_DYNVARS_136_04---------------------#'
+#
+# Testing for blockage of access
+#
+
+SELECT * FROM t1;
+
+SHOW STATUS LIKE 'Qcache_queries_in_cache';
+--echo 1 Expected
+
+connection con1;
+
+SELECT * FROM t1;
+
+connection con0;
+LOCK TABLE t1 WRITE;
+
+connection con1;
+--echo ** Should not be blocked **
+SELECT * FROM t1;
+SELECT * FROM t1;
+SELECT * FROM t1;
+
+connection con0;
+UNLOCK TABLES;
+
+connection con1;
+
+--echo '#----------------------------FN_DYNVARS_136_05------------------------#'
+#
+# Session data integrity check & GLOBAL Value check
+#
+
+SET GLOBAL query_cache_wlock_invalidate = OFF;
+
+connect (con_int1,localhost,root,,);
+connection con_int1;
+
+SELECT @@SESSION.query_cache_wlock_invalidate;
+--echo Expected Value : 0 / OFF;
+SET SESSION query_cache_wlock_invalidate = ON;
+
+connect (con_int2,localhost,root,,);
+connection con_int2;
+
+SELECT @@SESSION.query_cache_wlock_invalidate;
+--echo Expected Value : 0 / OFF;
+
+SET SESSION query_cache_wlock_invalidate = OFF;
+
+connection con_int1;
+SELECT @@SESSION.query_cache_wlock_invalidate;
+--echo Expected Value : 1 / ON;
+
+connection con_int2;
+SELECT @@SESSION.query_cache_wlock_invalidate;
+--echo Expected Value : 0 / OFF;
+
+SELECT @@GLOBAL.query_cache_wlock_invalidate;
+--echo Expected Value : 0 / OFF;
+
+connection default;
+disconnect con_int1;
+disconnect con_int2;
+
+#
+# Cleanup
+#
+--echo
+--echo CLEANUP
+
+connection con0;
+
+SET @@GLOBAL.query_cache_wlock_invalidate = @start_global_value;
+SET @@SESSION.query_cache_wlock_invalidate = @start_session_value ;
+SET @@GLOBAL.query_cache_size = @old_cache_size;
+SET @@GLOBAL.query_cache_type = @old_cache_type;
+
+connection default;
+disconnect con0;
+disconnect con1;
+
+DROP TABLE t1;
+
+--enable_ps_protocol
diff --git a/mysql-test/suite/sys_vars/t/query_prealloc_size_basic.test b/mysql-test/suite/sys_vars/t/query_prealloc_size_basic.test
new file mode 100644
index 00000000..1a6ed56c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/query_prealloc_size_basic.test
@@ -0,0 +1,240 @@
+################# mysql-test\t\query_prealloc_size_basic.test ##################
+# #
+# Variable Name: query_prealloc_size #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 8192 #
+# Range: 8192-4294967295 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable query_prealloc_size #
+# that checks the behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# #
+################################################################################
+
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF query_prealloc_size TESTS #
+########################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.query_prealloc_size ;
+SELECT @start_global_value;
+SET @start_session_value = @@session.query_prealloc_size ;
+SELECT @start_session_value;
+
+
+--echo '#--------------------FN_DYNVARS_005_01-------------------------#'
+########################################################################
+# Display the DEFAULT value of myisam_block_size #
+########################################################################
+
+SET @@global.query_prealloc_size = 100;
+SET @@global.query_prealloc_size = DEFAULT;
+SELECT @@global.query_prealloc_size ;
+
+SET @@session.query_prealloc_size = 200;
+SET @@session.query_prealloc_size = DEFAULT;
+SELECT @@session.query_prealloc_size ;
+
+
+--echo '#--------------------FN_DYNVARS_005_02-------------------------#'
+########################################################################
+# Check the DEFAULT value of query_prealloc_size #
+########################################################################
+
+SET @@global.query_prealloc_size = DEFAULT;
+SELECT @@global.query_prealloc_size = 24576;
+
+SET @@session.query_prealloc_size = DEFAULT;
+SELECT @@session.query_prealloc_size = 24576;
+
+
+--echo '#--------------------FN_DYNVARS_005_03-------------------------#'
+################################################################################
+# Change the value of query_prealloc_size to a valid value for GLOBAL Scope #
+################################################################################
+
+SET @@global.query_prealloc_size = 8192;
+SELECT @@global.query_prealloc_size ;
+
+#SET @@global.query_prealloc_size = 4294967295;
+#SELECT @@global.query_prealloc_size ;
+
+SET @@global.query_prealloc_size = 655354;
+SELECT @@global.query_prealloc_size ;
+
+
+--echo '#--------------------FN_DYNVARS_005_04-------------------------#'
+##################################################################################
+# Change the value of query_prealloc_size to a valid value for SESSION Scope #
+##################################################################################
+
+SET @@session.query_prealloc_size = 8192;
+SELECT @@session.query_prealloc_size ;
+
+#SET @@session.query_prealloc_size = 4294967295;
+#SELECT @@session.query_prealloc_size ;
+
+SET @@session.query_prealloc_size = 655345;
+SELECT @@session.query_prealloc_size ;
+
+
+
+
+--echo '#------------------FN_DYNVARS_005_05-----------------------#'
+####################################################################
+# Change the value of query_prealloc_size to an invalid value #
+####################################################################
+
+SET @@global.query_prealloc_size = 0;
+SELECT @@global.query_prealloc_size ;
+
+#SET @@global.query_prealloc_size = -1024;
+#SELECT @@global.query_prealloc_size ;
+
+#SET @@global.query_prealloc_size = 429496729533;
+#SELECT @@global.query_prealloc_size ;
+
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.query_prealloc_size = 65530.34;
+SELECT @@global.query_prealloc_size ;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.query_prealloc_size = test;
+SELECT @@global.query_prealloc_size ;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.query_prealloc_size = "test";
+SELECT @@global.query_prealloc_size ;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.query_prealloc_size = 'test';
+SELECT @@global.query_prealloc_size ;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.query_prealloc_size = ON;
+SELECT @@global.query_prealloc_size ;
+
+
+SET @@session.query_prealloc_size = 0;
+SELECT @@session.query_prealloc_size ;
+
+#SET @@session.query_prealloc_size = -2;
+#SELECT @@session.query_prealloc_size ;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.query_prealloc_size = 65530.34;
+SELECT @@session.query_prealloc_size ;
+
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.query_prealloc_size = test;
+SELECT @@session.query_prealloc_size ;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.query_prealloc_size = "test";
+SELECT @@session.query_prealloc_size ;
+
+
+--echo '#------------------FN_DYNVARS_005_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT @@global.query_prealloc_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='query_prealloc_size ';
+
+--echo '#------------------FN_DYNVARS_005_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.query_prealloc_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='query_prealloc_size ';
+
+
+--echo '#------------------FN_DYNVARS_005_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.query_prealloc_size = TRUE;
+SELECT @@global.query_prealloc_size ;
+SET @@global.query_prealloc_size = FALSE;
+SELECT @@global.query_prealloc_size ;
+
+
+
+--echo '#---------------------FN_DYNVARS_001_09----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+
+SET @@global.query_prealloc_size = 10;
+SELECT @@query_prealloc_size = @@global.query_prealloc_size ;
+
+
+--echo '#---------------------FN_DYNVARS_001_10----------------------#'
+##############################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to #
+# to the same session variable #
+##############################################################################
+
+SET @@query_prealloc_size = 100;
+SELECT @@query_prealloc_size = @@local.query_prealloc_size ;
+SELECT @@local.query_prealloc_size = @@session.query_prealloc_size ;
+
+
+--echo '#---------------------FN_DYNVARS_001_11----------------------#'
+################################################################################
+# Check if query_prealloc_size can be accessed with and without @@ sign #
+################################################################################
+
+SET query_prealloc_size = 1;
+SELECT @@query_prealloc_size ;
+--Error ER_UNKNOWN_TABLE
+
+SELECT local.query_prealloc_size ;
+
+--Error ER_UNKNOWN_TABLE
+SELECT session.query_prealloc_size ;
+
+--Error ER_BAD_FIELD_ERROR
+SELECT query_prealloc_size = @@session.query_prealloc_size ;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.query_prealloc_size = @start_global_value;
+SELECT @@global.query_prealloc_size ;
+SET @@session.query_prealloc_size = @start_session_value;
+SELECT @@session.query_prealloc_size ;
+
+
+#############################################################
+# END OF query_prealloc_size TESTS #
+#############################################################
+
diff --git a/mysql-test/suite/sys_vars/t/query_prealloc_size_func.test b/mysql-test/suite/sys_vars/t/query_prealloc_size_func.test
new file mode 100644
index 00000000..ff765539
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/query_prealloc_size_func.test
@@ -0,0 +1,91 @@
+############# mysql-test\t\query_prealloc_size_func.test ######################
+# #
+# Variable Name: query_prealloc_size #
+# Scope: GLOBAL & SESSION #
+# Access Type: Dynamic #
+# Data Type: integer #
+# Default Value: 8192 #
+# Values: 8192-4294967295 #
+# #
+# #
+# Creation Date: 2008-02-22 #
+# Author: Sharique Abdullah #
+# #
+# Description: Test Cases of Dynamic System Variable "query_prealloc_size" #
+# that checks behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Cache behaviors #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# #
+###############################################################################
+
+
+
+--echo ** Setup **
+--echo
+#
+# Setup
+#
+
+#
+# Save initial value
+#
+
+SET @start_value = @@global.query_prealloc_size;
+
+CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY, val TEXT(200));
+
+INSERT INTO t1 VALUES(NULL,'a');
+INSERT INTO t1 VALUES(NULL,'b');
+INSERT INTO t1 VALUES(NULL,'c');
+INSERT INTO t1 VALUES(NULL,'d');
+
+SELECT * FROM t1 ORDER BY val;
+
+SET SESSION query_prealloc_size = 8192;
+
+
+--echo '#----------------------------FN_DYNVARS_137_05-----------------#'
+#
+# Session data integrity check & GLOBAL Value check
+#
+
+SET GLOBAL query_prealloc_size = 8192;
+
+connect (con_int1,localhost,root,,);
+connection con_int1;
+
+SELECT @@SESSION.query_prealloc_size;
+--echo Expected Value : 8192;
+SET SESSION query_prealloc_size = 16384;
+
+connect (con_int2,localhost,root,,);
+connection con_int2;
+
+SELECT @@SESSION.query_prealloc_size;
+--echo Expected Value : 8192;
+
+SET SESSION query_prealloc_size = 8192;
+
+connection con_int1;
+SELECT @@SESSION.query_prealloc_size;
+--echo Expected Value : 16384;
+
+connection con_int2;
+SELECT @@SESSION.query_prealloc_size;
+--echo Expected Value : 8192;
+
+SELECT @@GLOBAL.query_prealloc_size;
+--echo Expected Value : 8192;
+
+connection default;
+disconnect con_int1;
+disconnect con_int2;
+
+DROP TABLE t1;
+
+SET @@global.query_prealloc_size = @start_value;
diff --git a/mysql-test/suite/sys_vars/t/rand_seed1_basic.test b/mysql-test/suite/sys_vars/t/rand_seed1_basic.test
new file mode 100644
index 00000000..a64f8a64
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/rand_seed1_basic.test
@@ -0,0 +1,37 @@
+
+#
+# exists as a session only
+#
+# 2010-01-20 OBN - Added check for I_S value after variable value change
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@global.rand_seed1;
+--error ER_NO_DEFAULT
+set session rand_seed1=default;
+set session rand_seed1=10969771;
+select @@session.rand_seed1;
+show global variables like 'rand_seed1';
+show session variables like 'rand_seed1';
+select * from information_schema.global_variables where variable_name='rand_seed1';
+select * from information_schema.session_variables where variable_name='rand_seed1';
+
+#
+# show that it's writable (note value can be set but not read - returned value is zero)
+#
+set session rand_seed1=1;
+select @@session.rand_seed1;
+select * from information_schema.global_variables where variable_name='rand_seed1';
+select * from information_schema.session_variables where variable_name='rand_seed1';
+--error ER_LOCAL_VARIABLE
+set global rand_seed1=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set session rand_seed1=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set session rand_seed1=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set session rand_seed1="foo";
+
diff --git a/mysql-test/suite/sys_vars/t/rand_seed2_basic.test b/mysql-test/suite/sys_vars/t/rand_seed2_basic.test
new file mode 100644
index 00000000..091fd8f0
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/rand_seed2_basic.test
@@ -0,0 +1,38 @@
+
+#
+# exists as a session only
+#
+#
+# 2010-01-20 OBN - Added check for I_S value after variable value change
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@global.rand_seed2;
+--error ER_NO_DEFAULT
+set session rand_seed2=default;
+set session rand_seed2=10969771;
+select @@session.rand_seed2;
+show global variables like 'rand_seed2';
+show session variables like 'rand_seed2';
+select * from information_schema.global_variables where variable_name='rand_seed2';
+select * from information_schema.session_variables where variable_name='rand_seed2';
+
+#
+# show that it's writable (note value can be set but not read - returned value is zero)
+#
+set session rand_seed2=1;
+select @@session.rand_seed2;
+select * from information_schema.global_variables where variable_name='rand_seed2';
+select * from information_schema.session_variables where variable_name='rand_seed2';
+--error ER_LOCAL_VARIABLE
+set global rand_seed2=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set session rand_seed2=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set session rand_seed2=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set session rand_seed2="foo";
+
diff --git a/mysql-test/suite/sys_vars/t/range_alloc_block_size_basic.test b/mysql-test/suite/sys_vars/t/range_alloc_block_size_basic.test
new file mode 100644
index 00000000..cfa74665
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/range_alloc_block_size_basic.test
@@ -0,0 +1,205 @@
+############## mysql-test\t\range_alloc_block_size_basic.test ###############
+# #
+# Variable Name: range_alloc_block_size #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value:2048 #
+# Max value: 4294967295 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable range_alloc_block_size #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+######################################################################
+# START OF range_alloc_block_size TESTS #
+######################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.range_alloc_block_size;
+SELECT @start_global_value;
+SET @start_session_value = @@session.range_alloc_block_size;
+SELECT @start_session_value;
+
+
+--echo '#--------------------FN_DYNVARS_137_01-------------------------#'
+######################################################################
+# Display the DEFAULT value of range_alloc_block_size #
+######################################################################
+
+SET @@global.range_alloc_block_size = 100;
+SET @@global.range_alloc_block_size = DEFAULT;
+SELECT @@global.range_alloc_block_size;
+
+SET @@session.range_alloc_block_size = 200;
+SET @@session.range_alloc_block_size = DEFAULT;
+SELECT @@session.range_alloc_block_size;
+
+
+--echo '#--------------------FN_DYNVARS_137_02-------------------------#'
+######################################################################
+# Check the DEFAULT value of range_alloc_block_size #
+######################################################################
+
+SET @@global.range_alloc_block_size = DEFAULT;
+SELECT @@global.range_alloc_block_size = 2048;
+
+SET @@session.range_alloc_block_size = DEFAULT;
+SELECT @@session.range_alloc_block_size = 2048;
+
+
+--echo '#--------------------FN_DYNVARS_137_03-------------------------#'
+################################################################################
+# Change the value of range_alloc_block_size to a valid value for GLOBAL Scope #
+################################################################################
+
+SET @@global.range_alloc_block_size = 2048;
+SELECT @@global.range_alloc_block_size;
+SET @@global.range_alloc_block_size = 4294967295;
+SELECT @@global.range_alloc_block_size;
+SET @@global.range_alloc_block_size = 4294967294;
+SELECT @@global.range_alloc_block_size;
+
+
+--echo '#--------------------FN_DYNVARS_137_04-------------------------#'
+###################################################################################
+# Change the value of range_alloc_block_size to a valid value for SESSION Scope #
+###################################################################################
+
+SET @@session.range_alloc_block_size = 2048;
+SELECT @@session.range_alloc_block_size;
+SET @@session.range_alloc_block_size = 4294967295;
+SELECT @@session.range_alloc_block_size;
+SET @@session.range_alloc_block_size = 4294967294;
+SELECT @@session.range_alloc_block_size;
+
+
+--echo '#------------------FN_DYNVARS_137_05-----------------------#'
+##################################################################
+# Change the value of range_alloc_block_size to an invalid value #
+##################################################################
+
+SET @@global.range_alloc_block_size = 0;
+SELECT @@global.range_alloc_block_size;
+SET @@global.range_alloc_block_size = -1024;
+SELECT @@global.range_alloc_block_size;
+SET @@global.range_alloc_block_size = 42949672951;
+SELECT @@global.range_alloc_block_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.range_alloc_block_size = 65530.34;
+SELECT @@global.range_alloc_block_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.range_alloc_block_size = test;
+SELECT @@global.range_alloc_block_size;
+
+SET @@session.range_alloc_block_size = 0;
+SELECT @@session.range_alloc_block_size;
+SET @@session.range_alloc_block_size = -2;
+SELECT @@session.range_alloc_block_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.range_alloc_block_size = 65530.34;
+SET @@session.range_alloc_block_size = 4294967296;
+SELECT @@session.range_alloc_block_size;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.range_alloc_block_size = test;
+SELECT @@session.range_alloc_block_size;
+
+
+--echo '#------------------FN_DYNVARS_137_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT @@global.range_alloc_block_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='range_alloc_block_size';
+
+--echo '#------------------FN_DYNVARS_137_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.range_alloc_block_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='range_alloc_block_size';
+
+
+--echo '#------------------FN_DYNVARS_137_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.range_alloc_block_size = TRUE;
+SELECT @@global.range_alloc_block_size;
+SET @@global.range_alloc_block_size = FALSE;
+SELECT @@global.range_alloc_block_size;
+
+
+--echo '#---------------------FN_DYNVARS_137_09----------------------#'
+####################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+####################################################################################
+
+SET @@global.range_alloc_block_size = 10;
+SELECT @@range_alloc_block_size = @@global.range_alloc_block_size;
+
+
+--echo '#---------------------FN_DYNVARS_137_10----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@range_alloc_block_size = 100;
+SELECT @@range_alloc_block_size = @@local.range_alloc_block_size;
+SELECT @@local.range_alloc_block_size = @@session.range_alloc_block_size;
+
+
+--echo '#---------------------FN_DYNVARS_137_11----------------------#'
+###################################################################################
+# Check if range_alloc_block_size can be accessed with and without @@ sign #
+###################################################################################
+
+SET range_alloc_block_size = 1;
+SELECT @@range_alloc_block_size;
+--Error ER_UNKNOWN_TABLE
+SELECT local.range_alloc_block_size;
+--Error ER_UNKNOWN_TABLE
+SELECT session.range_alloc_block_size;
+--Error ER_BAD_FIELD_ERROR
+SELECT range_alloc_block_size = @@session.range_alloc_block_size;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.range_alloc_block_size = @start_global_value;
+SELECT @@global.range_alloc_block_size;
+SET @@session.range_alloc_block_size = @start_session_value;
+SELECT @@session.range_alloc_block_size;
+
+
+#############################################################
+# END OF range_alloc_block_size TESTS #
+#############################################################
+
diff --git a/mysql-test/suite/sys_vars/t/read_binlog_speed_limit_grant.test b/mysql-test/suite/sys_vars/t/read_binlog_speed_limit_grant.test
new file mode 100644
index 00000000..cb060e6c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/read_binlog_speed_limit_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21966 Bind REPLICATION SLAVE ADMIN to a number of global system variables
+--echo #
+
+--let var = read_binlog_speed_limit
+--let grant = REPLICATION SLAVE ADMIN
+--let value = 65536
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/read_buffer_size_basic.test b/mysql-test/suite/sys_vars/t/read_buffer_size_basic.test
new file mode 100644
index 00000000..8ce826bf
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/read_buffer_size_basic.test
@@ -0,0 +1,206 @@
+############## mysql-test\t\read_buffer_size_basic.test ###############
+# #
+# Variable Name: read_buffer_size #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 131072 #
+# Range: 8200-2147479552 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable read_buffer_size #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+######################################################################
+# START OF read_buffer_size TESTS #
+######################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.read_buffer_size;
+SELECT @start_global_value;
+SET @start_session_value = @@session.read_buffer_size;
+SELECT @start_session_value;
+
+
+--echo '#--------------------FN_DYNVARS_138_01-------------------------#'
+######################################################################
+# Display the DEFAULT value of read_buffer_size #
+######################################################################
+
+SET @@global.read_buffer_size = 1000;
+SET @@global.read_buffer_size = DEFAULT;
+SELECT @@global.read_buffer_size;
+
+SET @@session.read_buffer_size = 2000;
+SET @@session.read_buffer_size = DEFAULT;
+SELECT @@session.read_buffer_size;
+
+
+--echo '#--------------------FN_DYNVARS_138_02-------------------------#'
+######################################################################
+# Check the DEFAULT value of read_buffer_size #
+######################################################################
+
+SET @@global.read_buffer_size = DEFAULT;
+SELECT @@global.read_buffer_size = 131072;
+
+SET @@session.read_buffer_size = DEFAULT;
+SELECT @@session.read_buffer_size = 131072;
+
+
+--echo '#--------------------FN_DYNVARS_138_03-------------------------#'
+################################################################################
+# Change the value of read_buffer_size to a valid value for GLOBAL Scope #
+################################################################################
+
+SET @@global.read_buffer_size = 8201;
+SELECT @@global.read_buffer_size;
+SET @@global.read_buffer_size = 8200;
+SELECT @@global.read_buffer_size;
+SET @@global.read_buffer_size = 2147479552;
+SELECT @@global.read_buffer_size;
+SET @@global.read_buffer_size = 2147479551;
+SELECT @@global.read_buffer_size;
+
+--echo '#--------------------FN_DYNVARS_138_04-------------------------#'
+###################################################################################
+# Change the value of read_buffer_size to a valid value for SESSION Scope #
+###################################################################################
+
+SET @@session.read_buffer_size = 8200;
+SELECT @@session.read_buffer_size;
+SET @@session.read_buffer_size = 8201;
+SELECT @@session.read_buffer_size;
+SET @@session.read_buffer_size = 2147479552;
+SELECT @@session.read_buffer_size;
+SET @@session.read_buffer_size = 2147479551;
+SELECT @@session.read_buffer_size;
+
+
+--echo '#------------------FN_DYNVARS_138_05-----------------------#'
+##################################################################
+# Change the value of read_buffer_size to an invalid value #
+##################################################################
+
+SET @@global.read_buffer_size = 8199;
+SELECT @@global.read_buffer_size;
+SET @@global.read_buffer_size = -1024;
+SELECT @@global.read_buffer_size;
+SET @@global.read_buffer_size = 2147479553;
+SELECT @@global.read_buffer_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.read_buffer_size = 65530.34;
+SELECT @@global.read_buffer_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.read_buffer_size = test;
+SELECT @@global.read_buffer_size;
+
+SET @@session.read_buffer_size = 8199;
+SELECT @@session.read_buffer_size;
+SET @@session.read_buffer_size = -2;
+SELECT @@session.read_buffer_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.read_buffer_size = 65530.34;
+SET @@session.read_buffer_size = 2147479553;
+SELECT @@session.read_buffer_size;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.read_buffer_size = test;
+SELECT @@session.read_buffer_size;
+
+
+--echo '#------------------FN_DYNVARS_138_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT @@global.read_buffer_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='read_buffer_size';
+
+--echo '#------------------FN_DYNVARS_138_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.read_buffer_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='read_buffer_size';
+
+
+--echo '#------------------FN_DYNVARS_138_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.read_buffer_size = TRUE;
+SELECT @@global.read_buffer_size;
+SET @@global.read_buffer_size = FALSE;
+SELECT @@global.read_buffer_size;
+
+--echo '#---------------------FN_DYNVARS_138_09----------------------#'
+####################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+####################################################################################
+
+SET @@global.read_buffer_size = 9000;
+SELECT @@read_buffer_size = @@global.read_buffer_size;
+
+
+--echo '#---------------------FN_DYNVARS_138_10----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@read_buffer_size = 9000;
+SELECT @@read_buffer_size = @@local.read_buffer_size;
+SELECT @@local.read_buffer_size = @@session.read_buffer_size;
+
+
+--echo '#---------------------FN_DYNVARS_138_11----------------------#'
+###################################################################################
+# Check if read_buffer_size can be accessed with and without @@ sign #
+###################################################################################
+
+SET read_buffer_size = 9100;
+SELECT @@read_buffer_size;
+--Error ER_UNKNOWN_TABLE
+SELECT local.read_buffer_size;
+--Error ER_UNKNOWN_TABLE
+SELECT session.read_buffer_size;
+--Error ER_BAD_FIELD_ERROR
+SELECT read_buffer_size = @@session.read_buffer_size;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.read_buffer_size = @start_global_value;
+SELECT @@global.read_buffer_size;
+SET @@session.read_buffer_size = @start_session_value;
+SELECT @@session.read_buffer_size;
+
+
+#############################################################
+# END OF read_buffer_size TESTS #
+#############################################################
diff --git a/mysql-test/suite/sys_vars/t/read_only_basic.test b/mysql-test/suite/sys_vars/t/read_only_basic.test
new file mode 100644
index 00000000..3ef35020
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/read_only_basic.test
@@ -0,0 +1,168 @@
+############## mysql-test\t\read_only_basic.test ###############
+# #
+# Variable Name: read_only #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 0 #
+# Range: - #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable read_only #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+
+################################################################
+# START OF read_only TESTS #
+################################################################
+
+
+################################################################
+# Saving initial value of read_only in a temporary variable #
+################################################################
+
+SET @start_value = @@global.read_only;
+SELECT @start_value;
+
+
+--echo '#--------------------FN_DYNVARS_139_01------------------------#'
+################################################################
+# Display the DEFAULT value of read_only #
+################################################################
+
+SET @@global.read_only = 1;
+SET @@global.read_only = DEFAULT;
+SELECT @@global.read_only;
+
+
+--echo '#---------------------FN_DYNVARS_139_02-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@global.read_only = @start_value;
+SELECT @@global.read_only = 0;
+
+
+--echo '#--------------------FN_DYNVARS_139_03------------------------#'
+#################################################################
+# Change the value of read_only to a valid value #
+#################################################################
+
+SET @@global.read_only = 0;
+SELECT @@global.read_only;
+SET @@global.read_only = 1;
+SELECT @@global.read_only;
+SET @@global.read_only = TRUE;
+SELECT @@global.read_only;
+SET @@global.read_only = FALSE;
+SELECT @@global.read_only;
+SET @@global.read_only = ON;
+SELECT @@global.read_only;
+SET @@global.read_only = OFF;
+SELECT @@global.read_only;
+
+--echo '#--------------------FN_DYNVARS_139_04-------------------------#'
+####################################################################
+# Change the value of read_only to invalid value #
+####################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.read_only = -1;
+SELECT @@global.read_only;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.read_only = 4294967296;
+SELECT @@global.read_only;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.read_only = 10240022115;
+SELECT @@global.read_only;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.read_only = 10000.01;
+SELECT @@global.read_only;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.read_only = -1024;
+SELECT @@global.read_only;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.read_only = 42949672950;
+SELECT @@global.read_only;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.read_only = 'test';
+SELECT @@global.read_only;
+
+
+--echo '#-------------------FN_DYNVARS_139_05----------------------------#'
+####################################################################
+# Test if accessing session read_only gives error #
+####################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.read_only = 0;
+SELECT @@read_only;
+
+
+--echo '#----------------------FN_DYNVARS_139_06------------------------#'
+##############################################################################
+# Check if the value in GLOBAL & SESSION Tables matches values in variable #
+##############################################################################
+
+SELECT IF(@@global.read_only, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='read_only';
+
+SELECT IF(@@read_only, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='read_only';
+
+
+--echo '#---------------------FN_DYNVARS_139_07----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@global.read_only = 1;
+SELECT @@read_only = @@global.read_only;
+
+
+--echo '#---------------------FN_DYNVARS_139_08----------------------#'
+###################################################################
+# Check if read_only can be accessed with and without @@ sign #
+###################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET read_only = 1;
+SELECT @@read_only;
+--Error ER_UNKNOWN_TABLE
+SELECT local.read_only;
+--Error ER_UNKNOWN_TABLE
+SELECT global.read_only;
+--Error ER_BAD_FIELD_ERROR
+SELECT read_only = @@session.read_only;
+
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.read_only = @start_value;
+SELECT @@global.read_only;
+
+
+#################################################################
+# END OF read_only TESTS #
+#################################################################
+
diff --git a/mysql-test/suite/sys_vars/t/read_only_func.test b/mysql-test/suite/sys_vars/t/read_only_func.test
new file mode 100644
index 00000000..64141e3f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/read_only_func.test
@@ -0,0 +1,147 @@
+############ mysql-test\t\read_only_func.test ##################################
+# #
+#Variable Name: read_only #
+#Scope: SESSION #
+#Access Type: Dynamic #
+#Data Type: BOOLEAN #
+#Default Value: OFF #
+#Values: ON, OFF #
+# #
+# #
+#Creation Date: 2008-03-02 #
+#Author: Sharique Abdullah #
+# #
+#Description: Test Cases of Dynamic System Variable "read_only" #
+# that checks behavior of this variable in the following ways #
+# * Functionality based on different values #
+# #
+#Reference: http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html#
+# option_mysqld_read_only #
+# #
+################################################################################
+
+--echo ** Setup **
+--echo
+#
+# Setup
+#
+
+--source include/not_embedded.inc
+
+SET @default_read_only = @@read_only;
+
+--echo '#--------------------FN_DYNVARS_140_01-------------------------#'
+###################################
+#Setting Read only value ON #
+###################################
+
+SET Global read_only=ON;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+##################################
+# Creating table #
+##################################
+
+
+# creating table
+CREATE TABLE t1
+(
+id INT NOT NULL auto_increment,
+PRIMARY KEY (id),
+name BLOB
+);
+
+##################################
+# Inserting values #
+##################################
+
+
+INSERT into t1(name) values("aaassssssssddddddddffffff");
+
+###################################
+# Updating values #
+###################################
+
+update t1 set name="jfjdf" where id=1;
+
+###############################################
+# Select to see wether value is updated or not#
+###############################################
+
+select * from t1 where id=1;
+
+--echo '#--------------------FN_DYNVARS_140_02-------------------------#'
+#########################################
+#Creating user without Super privilege #
+#########################################
+
+
+--echo ** Creating new user with out super privilege**
+CREATE user sameea;
+grant all on test.* to sameea;
+CONNECT (connn,localhost,sameea,,);
+
+--Error ER_SPECIFIC_ACCESS_DENIED_ERROR
+SET Global read_ONLY=ON;
+--Error ER_OPTION_PREVENTS_STATEMENT
+CREATE TABLE t2
+(
+id INT NOT NULL auto_increment,
+PRIMARY KEY (id),
+name BLOB
+);
+
+# With ps-protocol the error is ER_NO_SUCH_TABLE
+--echo not updating values
+--Error ER_OPTION_PREVENTS_STATEMENT,ER_NO_SUCH_TABLE
+INSERT into t2(name) values("aaassssssssddddddddffffff");
+
+
+--Error ER_OPTION_PREVENTS_STATEMENT,ER_NO_SUCH_TABLE
+UPDATE t2 SET name="samia" where id=1;
+
+--echo '#--------------------FN_DYNVARS_140_03-------------------------#'
+
+###########################
+# Testing temporary table #
+###########################
+CREATE TEMPORARY TABLE t3(a int);
+
+--echo '#--------------------FN_DYNVARS_140_04-------------------------#'
+###########################
+# Turning read_only OFF #
+###########################
+connection default;
+
+SET Global read_only=OFF;
+connection connn;
+
+CREATE TABLE t2
+(
+id INT NOT NULL auto_increment,
+PRIMARY KEY (id),
+name BLOB
+);
+--echo updating values
+INSERT into t2(name) values("aaassssssssdddddddd");
+
+UPDATE t2 SET name="samia" where id=1;
+
+#
+# Cleanup
+#
+connection default;
+
+DISCONNECT connn;
+
+DROP USER sameea;
+
+DROP TABLE t1;
+DROP TABLE t2;
+SET global read_only = @default_read_only;
+
+--disable_info
+--enable_warnings
diff --git a/mysql-test/suite/sys_vars/t/read_only_grant.test b/mysql-test/suite/sys_vars/t/read_only_grant.test
new file mode 100644
index 00000000..9e82f30c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/read_only_grant.test
@@ -0,0 +1,45 @@
+--source include/not_embedded.inc
+
+--echo #
+--echo # MDEV-21960 Bind READ_ONLY ADMIN to @@read_only
+--echo #
+
+--echo # Test that "SET read_only" is not allowed without READ_ONLY ADMIN
+
+CREATE USER user1@localhost;
+GRANT ALL PRIVILEGES ON *.* TO user1@localhost;
+REVOKE READ_ONLY ADMIN ON *.* FROM user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+SET GLOBAL read_only=0;
+--error ER_GLOBAL_VARIABLE
+SET read_only=0;
+--error ER_GLOBAL_VARIABLE
+SET SESSION read_only=0;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET read_only" is allowed with READ_ONLY ADMIN
+
+CREATE USER user1@localhost;
+GRANT READ_ONLY ADMIN ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+SET GLOBAL read_only=0;
+--error ER_GLOBAL_VARIABLE
+SET read_only=0;
+--error ER_GLOBAL_VARIABLE
+SET SESSION read_only=0;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo #
+--echo # MDEV-29632 SUPER users created before 10.11 should retain READ_ONLY ADMIN privilege upon upgrade
+--echo #
+insert mysql.global_priv values ('bar', 'foo', '{"access":32768,"version_id":101000,"plugin":"mysql_native_password","authentication_string":""}');
+flush privileges;
+show grants for foo@bar;
+drop user foo@bar;
diff --git a/mysql-test/suite/sys_vars/t/read_rnd_buffer_size_basic.test b/mysql-test/suite/sys_vars/t/read_rnd_buffer_size_basic.test
new file mode 100644
index 00000000..f883a1be
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/read_rnd_buffer_size_basic.test
@@ -0,0 +1,185 @@
+############## mysql-test\t\read_rnd_buffer_size_basic.test ###############
+# #
+# Variable Name: read_rnd_buffer_size #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value:262144 #
+# Range: 8200-4294967295 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable read_rnd_buffer_size #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+
+######################################################################
+# START OF read_rnd_buffer_size TESTS #
+######################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.read_rnd_buffer_size;
+SELECT @start_global_value;
+SET @start_session_value = @@session.read_rnd_buffer_size;
+SELECT @start_session_value;
+
+
+--echo '#--------------------FN_DYNVARS_140_01-------------------------#'
+######################################################################
+# Display the DEFAULT value of read_rnd_buffer_size #
+######################################################################
+
+SET @@global.read_rnd_buffer_size = 1000;
+SET @@global.read_rnd_buffer_size = DEFAULT;
+SELECT @@global.read_rnd_buffer_size;
+
+SET @@session.read_rnd_buffer_size = 2000;
+SET @@session.read_rnd_buffer_size = DEFAULT;
+SELECT @@session.read_rnd_buffer_size;
+
+--echo '#--------------------FN_DYNVARS_140_03-------------------------#'
+################################################################################
+# Change the value of read_rnd_buffer_size to a valid value for GLOBAL Scope #
+################################################################################
+
+SET @@global.read_rnd_buffer_size = 8201;
+SELECT @@global.read_rnd_buffer_size;
+SET @@global.read_rnd_buffer_size = 8200;
+SELECT @@global.read_rnd_buffer_size;
+SET @@global.read_rnd_buffer_size = 2147479552;
+SELECT @@global.read_rnd_buffer_size;
+SET @@global.read_rnd_buffer_size = 2147479551;
+SELECT @@global.read_rnd_buffer_size;
+
+--echo '#--------------------FN_DYNVARS_140_04-------------------------#'
+###################################################################################
+# Change the value of read_rnd_buffer_size to a valid value for SESSION Scope #
+###################################################################################
+
+SET @@session.read_rnd_buffer_size = 8200;
+SELECT @@session.read_rnd_buffer_size;
+SET @@session.read_rnd_buffer_size = 8201;
+SELECT @@session.read_rnd_buffer_size;
+SET @@session.read_rnd_buffer_size = 2147479552;
+SELECT @@session.read_rnd_buffer_size;
+SET @@session.read_rnd_buffer_size = 2147479551;
+SELECT @@session.read_rnd_buffer_size;
+
+
+--echo '#------------------FN_DYNVARS_140_05-----------------------#'
+##################################################################
+# Change the value of read_rnd_buffer_size to an invalid value #
+##################################################################
+
+SET @@global.read_rnd_buffer_size = 8199;
+SELECT @@global.read_rnd_buffer_size;
+SET @@global.read_rnd_buffer_size = -1024;
+SELECT @@global.read_rnd_buffer_size;
+SET @@global.read_rnd_buffer_size = 2147479553;
+SELECT @@global.read_rnd_buffer_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.read_rnd_buffer_size = 65530.34;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.read_rnd_buffer_size = test;
+
+SET @@session.read_rnd_buffer_size = 8199;
+SELECT @@session.read_rnd_buffer_size;
+SET @@session.read_rnd_buffer_size = -2;
+SELECT @@session.read_rnd_buffer_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.read_rnd_buffer_size = 65530.34;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.read_rnd_buffer_size = test;
+
+--echo '#------------------FN_DYNVARS_140_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT @@global.read_rnd_buffer_size = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='read_rnd_buffer_size';
+
+--echo '#------------------FN_DYNVARS_140_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.read_rnd_buffer_size =
+VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='read_rnd_buffer_size';
+
+
+--echo '#------------------FN_DYNVARS_140_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.read_rnd_buffer_size = TRUE;
+SELECT @@global.read_rnd_buffer_size;
+SET @@global.read_rnd_buffer_size = FALSE;
+SELECT @@global.read_rnd_buffer_size;
+
+
+--echo '#---------------------FN_DYNVARS_140_09----------------------#'
+####################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+####################################################################################
+
+SET @@global.read_rnd_buffer_size = 9000;
+SELECT @@read_rnd_buffer_size = @@global.read_rnd_buffer_size;
+
+
+--echo '#---------------------FN_DYNVARS_140_10----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@read_rnd_buffer_size = 9000;
+SELECT @@read_rnd_buffer_size = @@local.read_rnd_buffer_size;
+SELECT @@local.read_rnd_buffer_size = @@session.read_rnd_buffer_size;
+
+
+--echo '#---------------------FN_DYNVARS_140_11----------------------#'
+###################################################################################
+# Check if read_rnd_buffer_size can be accessed with and without @@ sign #
+###################################################################################
+
+SET read_rnd_buffer_size = 9100;
+SELECT @@read_rnd_buffer_size;
+--Error ER_UNKNOWN_TABLE
+SELECT local.read_rnd_buffer_size;
+--Error ER_UNKNOWN_TABLE
+SELECT session.read_rnd_buffer_size;
+--Error ER_BAD_FIELD_ERROR
+SELECT read_rnd_buffer_size = @@session.read_rnd_buffer_size;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.read_rnd_buffer_size = @start_global_value;
+SELECT @@global.read_rnd_buffer_size;
+SET @@session.read_rnd_buffer_size = @start_session_value;
+SELECT @@session.read_rnd_buffer_size;
+
+
+#############################################################
+# END OF read_rnd_buffer_size TESTS #
+#############################################################
diff --git a/mysql-test/suite/sys_vars/t/relay_log_basename_basic.test b/mysql-test/suite/sys_vars/t/relay_log_basename_basic.test
new file mode 100644
index 00000000..29b70e6c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/relay_log_basename_basic.test
@@ -0,0 +1,16 @@
+#
+# WL#5465: System variables: paths to relay log and binary log files
+#
+# Test for variable:
+# Variable Name: relay_log_basename
+# Variable Scope: Global
+# Dynamic Variable: No
+
+--source include/not_embedded.inc
+--source include/master-slave.inc
+
+--connection slave
+--let $rpl_log_var_name=relay_log_basename
+--source suite/sys_vars/inc/bin_relay_log_basename_index.inc
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/sys_vars/t/relay_log_basic.test b/mysql-test/suite/sys_vars/t/relay_log_basic.test
new file mode 100644
index 00000000..c279c38f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/relay_log_basic.test
@@ -0,0 +1,27 @@
+--source include/not_embedded.inc
+
+let $MYSQLD_RELAY_LOG=`select @@global.relay_log`;
+
+#
+# only global
+#
+--replace_result $MYSQLD_RELAY_LOG RELAY_LOG
+select @@global.relay_log;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.relay_log;
+--replace_result $MYSQLD_RELAY_LOG RELAY_LOG
+show global variables like 'relay_log';
+--replace_result $MYSQLD_RELAY_LOG RELAY_LOG
+show session variables like 'relay_log';
+--replace_result $MYSQLD_RELAY_LOG RELAY_LOG
+select * from information_schema.global_variables where variable_name='relay_log';
+--replace_result $MYSQLD_RELAY_LOG RELAY_LOG
+select * from information_schema.session_variables where variable_name='relay_log';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global relay_log=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session relay_log=1;
diff --git a/mysql-test/suite/sys_vars/t/relay_log_index_basic.test b/mysql-test/suite/sys_vars/t/relay_log_index_basic.test
new file mode 100644
index 00000000..5a585ac2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/relay_log_index_basic.test
@@ -0,0 +1,33 @@
+--source include/not_embedded.inc
+--source include/master-slave.inc
+
+#
+# only global
+#
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+select @@global.relay_log_index;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.relay_log_index;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+show global variables like 'relay_log_index';
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+show session variables like 'relay_log_index';
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+select * from information_schema.global_variables where variable_name='relay_log_index';
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+select * from information_schema.session_variables where variable_name='relay_log_index';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global relay_log_index=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session relay_log_index=1;
+
+--connection slave
+--let $rpl_log_var_name=relay_log_index
+--source suite/sys_vars/inc/bin_relay_log_basename_index.inc
+
+--source include/rpl_end.inc
+
diff --git a/mysql-test/suite/sys_vars/t/relay_log_info_file_basic.test b/mysql-test/suite/sys_vars/t/relay_log_info_file_basic.test
new file mode 100644
index 00000000..4709b8e3
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/relay_log_info_file_basic.test
@@ -0,0 +1,19 @@
+--source include/not_embedded.inc
+#
+# only global
+#
+select @@global.relay_log_info_file;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.relay_log_info_file;
+show global variables like 'relay_log_info_file';
+show session variables like 'relay_log_info_file';
+select * from information_schema.global_variables where variable_name='relay_log_info_file';
+select * from information_schema.session_variables where variable_name='relay_log_info_file';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global relay_log_info_file=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session relay_log_info_file=1;
diff --git a/mysql-test/suite/sys_vars/t/relay_log_purge_basic.test b/mysql-test/suite/sys_vars/t/relay_log_purge_basic.test
new file mode 100644
index 00000000..dd211bb1
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/relay_log_purge_basic.test
@@ -0,0 +1,162 @@
+############## mysql-test\t\relay_log_purge_basic.test ########################
+# #
+# Variable Name: relay_log_purge #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: boolean #
+# Default Value: TRUE #
+# Range: #
+# #
+# #
+# Creation Date: 2008-02-14 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable relay_log_purge #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_relay_log_purge #
+# #
+###############################################################################
+
+--source include/not_embedded.inc
+--source include/load_sysvars.inc
+
+#####################################################################
+# START OF relay_log_purge TESTS #
+#####################################################################
+
+
+#######################################################################
+# Saving initial value of relay_log_purge in a temporary variable #
+#######################################################################
+
+SET @start_value = @@global.relay_log_purge;
+SELECT @start_value;
+
+
+--echo '#--------------------FN_DYNVARS_141_01------------------------#'
+#############################################################
+# Display the DEFAULT value of relay_log_purge #
+#############################################################
+
+SET @@global.relay_log_purge = FALSE;
+SET @@global.relay_log_purge = DEFAULT;
+SELECT @@global.relay_log_purge;
+
+
+--echo '#---------------------FN_DYNVARS_141_02-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@global.relay_log_purge = @start_value;
+SELECT @@global.relay_log_purge = TRUE;
+
+
+--echo '#--------------------FN_DYNVARS_141_03------------------------#'
+#############################################################
+# Change the value of relay_log_purge to a valid value #
+#############################################################
+
+SET @@global.relay_log_purge = ON;
+SELECT @@global.relay_log_purge;
+SET @@global.relay_log_purge = OFF;
+SELECT @@global.relay_log_purge;
+SET @@global.relay_log_purge = 0;
+SELECT @@global.relay_log_purge;
+SET @@global.relay_log_purge = 1;
+SELECT @@global.relay_log_purge;
+SET @@global.relay_log_purge = TRUE;
+SELECT @@global.relay_log_purge;
+SET @@global.relay_log_purge = FALSE;
+SELECT @@global.relay_log_purge;
+
+--echo '#--------------------FN_DYNVARS_141_04-------------------------#'
+###########################################################################
+# Change the value of relay_log_purge to invalid value #
+###########################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.relay_log_purge = 2;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.relay_log_purge = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.relay_log_purge = TRUEF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.relay_log_purge = TRUE_F;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.relay_log_purge = FALSE0;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.relay_log_purge = OON;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.relay_log_purge = ONN;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.relay_log_purge = OOFF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.relay_log_purge = 0FF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.relay_log_purge = ' ';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.relay_log_purge = " ";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.relay_log_purge = '';
+
+
+--echo '#-------------------FN_DYNVARS_141_05----------------------------#'
+###########################################################################
+# Test if accessing session relay_log_purge gives error #
+###########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.relay_log_purge = 1;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.relay_log_purge;
+
+
+--echo '#----------------------FN_DYNVARS_141_06------------------------#'
+#####################################################################
+# Check if the value in GLOBAL Tables matches values in variable #
+#####################################################################
+
+SELECT IF(@@global.relay_log_purge, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='relay_log_purge';
+
+--echo '#---------------------FN_DYNVARS_141_07----------------------#'
+###############################################################################
+# Check if accessing variable without SCOPE points to same session variable #
+###############################################################################
+
+SET @@global.relay_log_purge = 1;
+SELECT @@relay_log_purge = @@global.relay_log_purge;
+
+
+--echo '#---------------------FN_DYNVARS_141_08----------------------#'
+##########################################################################
+# Check if relay_log_purge can be accessed with and without @@ sign #
+##########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET relay_log_purge = 1;
+--Error ER_UNKNOWN_TABLE
+SELECT global.relay_log_purge;
+--Error ER_BAD_FIELD_ERROR
+SELECT relay_log_purge = @@session.relay_log_purge;
+
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.relay_log_purge = @start_value;
+SELECT @@global.relay_log_purge;
+
+
+#############################################################
+# END OF relay_log_purge TESTS #
+#############################################################
diff --git a/mysql-test/suite/sys_vars/t/relay_log_purge_grant.test b/mysql-test/suite/sys_vars/t/relay_log_purge_grant.test
new file mode 100644
index 00000000..f93d7048
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/relay_log_purge_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21969 Bind REPLICATION SLAVE ADMIN to relay_log_*, sync_master_info, sync_relay_log, sync_relay_log_info
+--echo #
+
+--let var = relay_log_purge
+--let grant = REPLICATION SLAVE ADMIN
+--let value = 1
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/relay_log_recovery_basic.test b/mysql-test/suite/sys_vars/t/relay_log_recovery_basic.test
new file mode 100644
index 00000000..a6f218a5
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/relay_log_recovery_basic.test
@@ -0,0 +1,49 @@
+
+
+#
+# 2010-01-10 - Added check for I_S values aver variable value change
+#
+
+--source include/not_embedded.inc
+
+SET @start_global_value = @@global.relay_log_recovery;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+select @@global.relay_log_recovery;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.relay_log_recovery;
+show global variables like 'relay_log_recovery';
+show session variables like 'relay_log_recovery';
+select * from information_schema.global_variables where variable_name='relay_log_recovery';
+select * from information_schema.session_variables where variable_name='relay_log_recovery';
+
+#
+# show that it's writable
+#
+set global relay_log_recovery=1;
+select @@global.relay_log_recovery;
+select * from information_schema.global_variables where variable_name='relay_log_recovery';
+select * from information_schema.session_variables where variable_name='relay_log_recovery';
+set global relay_log_recovery=OFF;
+select @@global.relay_log_recovery;
+select * from information_schema.global_variables where variable_name='relay_log_recovery';
+select * from information_schema.session_variables where variable_name='relay_log_recovery';
+--error ER_GLOBAL_VARIABLE
+set session relay_log_recovery=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global relay_log_recovery=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global relay_log_recovery=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global relay_log_recovery="foo";
+
+SET @@global.relay_log_recovery = @start_global_value;
+SELECT @@global.relay_log_recovery;
+
diff --git a/mysql-test/suite/sys_vars/t/relay_log_recovery_grant.test b/mysql-test/suite/sys_vars/t/relay_log_recovery_grant.test
new file mode 100644
index 00000000..1c052618
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/relay_log_recovery_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21969 Bind REPLICATION SLAVE ADMIN to relay_log_*, sync_master_info, sync_relay_log, sync_relay_log_info
+--echo #
+
+--let var = relay_log_recovery
+--let grant = REPLICATION SLAVE ADMIN
+--let value = 1
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/relay_log_space_limit_basic.test b/mysql-test/suite/sys_vars/t/relay_log_space_limit_basic.test
new file mode 100644
index 00000000..99c9fb37
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/relay_log_space_limit_basic.test
@@ -0,0 +1,19 @@
+--source include/not_embedded.inc
+#
+# only global
+#
+select @@global.relay_log_space_limit;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.relay_log_space_limit;
+show global variables like 'relay_log_space_limit';
+show session variables like 'relay_log_space_limit';
+select * from information_schema.global_variables where variable_name='relay_log_space_limit';
+select * from information_schema.session_variables where variable_name='relay_log_space_limit';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global relay_log_space_limit=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session relay_log_space_limit=1;
diff --git a/mysql-test/suite/sys_vars/t/replicate_annotate_row_events_basic.test b/mysql-test/suite/sys_vars/t/replicate_annotate_row_events_basic.test
new file mode 100644
index 00000000..f4d7221f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/replicate_annotate_row_events_basic.test
@@ -0,0 +1,23 @@
+# bool readonly
+
+--source include/not_embedded.inc
+
+#
+# show values;
+#
+select @@global.replicate_annotate_row_events;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.replicate_annotate_row_events;
+show global variables like 'replicate_annotate_row_events';
+show session variables like 'replicate_annotate_row_events';
+select * from information_schema.global_variables where variable_name='replicate_annotate_row_events';
+select * from information_schema.session_variables where variable_name='replicate_annotate_row_events';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global replicate_annotate_row_events=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session replicate_annotate_row_events=1;
+
diff --git a/mysql-test/suite/sys_vars/t/replicate_do_db_basic.test b/mysql-test/suite/sys_vars/t/replicate_do_db_basic.test
new file mode 100644
index 00000000..b7004d19
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/replicate_do_db_basic.test
@@ -0,0 +1,45 @@
+--source include/not_embedded.inc
+
+--echo #
+--echo # Basic testing of replicate_do_db.
+--echo #
+
+SET @save_replicate_do_db = @@GLOBAL.replicate_do_db;
+SELECT @save_replicate_do_db;
+
+--echo # Scope.
+
+--error ER_GLOBAL_VARIABLE
+SET @@SESSION.replicate_do_db = "";
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@SESSION.replicate_do_db;
+
+--echo # Incorrect type.
+
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@GLOBAL.replicate_do_db=1;
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@GLOBAL.replicate_do_db=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@GLOBAL.replicate_do_db=1e1;
+
+--echo # Argument syntax.
+
+SET @@GLOBAL.replicate_do_db="db1,,,,,db3";
+SELECT @@GLOBAL.replicate_do_db;
+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='replicate_do_db';
+
+SET @@GLOBAL.replicate_do_db="db1,,,db2,,,db3";
+SELECT @@GLOBAL.replicate_do_db;
+
+SET @@GLOBAL.replicate_do_db="";
+SELECT @@GLOBAL.replicate_do_db;
+
+SET @@GLOBAL.replicate_do_db=null;
+SELECT @@GLOBAL.replicate_do_db;
+
+SET @@GLOBAL.replicate_do_db=DEFAULT;
+SELECT @@GLOBAL.replicate_do_db;
+
+--echo # Cleanup.
+SET @@GLOBAL.replicate_do_db = @save_replicate_do_db;
diff --git a/mysql-test/suite/sys_vars/t/replicate_do_db_grant.test b/mysql-test/suite/sys_vars/t/replicate_do_db_grant.test
new file mode 100644
index 00000000..fa6023ce
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/replicate_do_db_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21966 Bind REPLICATION SLAVE ADMIN to a number of global system variables
+--echo #
+
+--let var = replicate_do_db
+--let grant = REPLICATION SLAVE ADMIN
+--let value = ''
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/replicate_do_table_basic.test b/mysql-test/suite/sys_vars/t/replicate_do_table_basic.test
new file mode 100644
index 00000000..346bdf3b
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/replicate_do_table_basic.test
@@ -0,0 +1,51 @@
+--source include/not_embedded.inc
+
+--echo #
+--echo # Basic testing of replicate_do_table.
+--echo #
+
+SET @save_replicate_do_table = @@GLOBAL.replicate_do_table;
+SELECT @save_replicate_do_table;
+
+--echo # Scope.
+
+--error ER_GLOBAL_VARIABLE
+SET @@SESSION.replicate_do_table = "";
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@SESSION.replicate_do_table;
+
+--echo # Incorrect type.
+
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@GLOBAL.replicate_do_table=1;
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@GLOBAL.replicate_do_table=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@GLOBAL.replicate_do_table=1e1;
+
+--echo # Incorrect arguments.
+
+--error ER_WRONG_ARGUMENTS
+SET @@GLOBAL.replicate_do_table="t1";
+--error ER_WRONG_ARGUMENTS
+SET @@GLOBAL.replicate_do_table="test.t1, t2";
+--error ER_WRONG_ARGUMENTS
+SET @@GLOBAL.replicate_do_table="test.,t1";
+
+--echo # Argument syntax.
+
+SET @@GLOBAL.replicate_do_table="test.t1,,,,,test.t3";
+SELECT @@GLOBAL.replicate_do_table;
+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='replicate_do_table';
+
+SET @@GLOBAL.replicate_do_table="test.t1,,,test2.t2,,,test.t3";
+SELECT @@GLOBAL.replicate_do_table;
+
+SET @@GLOBAL.replicate_do_table="";
+SELECT @@GLOBAL.replicate_do_table;
+
+SET @@GLOBAL.replicate_do_table=null;
+SELECT @@GLOBAL.replicate_do_table;
+
+--echo # Cleanup.
+SET @@GLOBAL.replicate_do_table = @save_replicate_do_table;
diff --git a/mysql-test/suite/sys_vars/t/replicate_do_table_grant.test b/mysql-test/suite/sys_vars/t/replicate_do_table_grant.test
new file mode 100644
index 00000000..7dc800a3
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/replicate_do_table_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21966 Bind REPLICATION SLAVE ADMIN to a number of global system variables
+--echo #
+
+--let var = replicate_do_table
+--let grant = REPLICATION SLAVE ADMIN
+--let value = ''
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/replicate_events_marked_for_skip_basic.test b/mysql-test/suite/sys_vars/t/replicate_events_marked_for_skip_basic.test
new file mode 100644
index 00000000..ecbbb821
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/replicate_events_marked_for_skip_basic.test
@@ -0,0 +1,31 @@
+source include/not_embedded.inc;
+
+--echo #
+--echo # Basic testing of replicate_events_marked_for_skip.
+--echo #
+
+SET @save_replicate_events_marked_for_skip = @@GLOBAL.replicate_events_marked_for_skip;
+SELECT @save_replicate_events_marked_for_skip;
+
+--echo # Scope.
+
+--error ER_GLOBAL_VARIABLE
+SET @@SESSION.replicate_events_marked_for_skip = "";
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@SESSION.replicate_events_marked_for_skip;
+
+--echo # Argument syntax.
+
+SET @@GLOBAL.replicate_events_marked_for_skip=filter_on_master;
+SELECT @@GLOBAL.replicate_events_marked_for_skip;
+SET @@GLOBAL.replicate_events_marked_for_skip=filter_on_slave;
+SELECT @@GLOBAL.replicate_events_marked_for_skip;
+SET @@GLOBAL.replicate_events_marked_for_skip=replicate;
+SELECT @@GLOBAL.replicate_events_marked_for_skip;
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@GLOBAL.replicate_events_marked_for_skip=filter;
+SELECT @@GLOBAL.replicate_events_marked_for_skip;
+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='replicate_events_marked_for_skip';
+
+--echo # Cleanup.
+SET @@GLOBAL.replicate_events_marked_for_skip = @save_replicate_events_marked_for_skip;
diff --git a/mysql-test/suite/sys_vars/t/replicate_events_marked_for_skip_grant.test b/mysql-test/suite/sys_vars/t/replicate_events_marked_for_skip_grant.test
new file mode 100644
index 00000000..1baed3fe
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/replicate_events_marked_for_skip_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21966 Bind REPLICATION SLAVE ADMIN to a number of global system variables
+--echo #
+
+--let var = replicate_events_marked_for_skip
+--let grant = REPLICATION SLAVE ADMIN
+--let value = REPLICATE
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/replicate_ignore_db_basic.test b/mysql-test/suite/sys_vars/t/replicate_ignore_db_basic.test
new file mode 100644
index 00000000..376397d1
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/replicate_ignore_db_basic.test
@@ -0,0 +1,42 @@
+--source include/not_embedded.inc
+
+--echo #
+--echo # Basic testing of replicate_ignore_db.
+--echo #
+
+SET @save_replicate_ignore_db = @@GLOBAL.replicate_ignore_db;
+SELECT @save_replicate_ignore_db;
+
+--echo # Scope.
+
+--error ER_GLOBAL_VARIABLE
+SET @@SESSION.replicate_ignore_db = "";
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@SESSION.replicate_ignore_db;
+
+--echo # Incorrect type.
+
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@GLOBAL.replicate_ignore_db=1;
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@GLOBAL.replicate_ignore_db=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@GLOBAL.replicate_ignore_db=1e1;
+
+--echo # Argument syntax.
+
+SET @@GLOBAL.replicate_ignore_db="db1,,,,,db3";
+SELECT @@GLOBAL.replicate_ignore_db;
+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='replicate_ignore_db';
+
+SET @@GLOBAL.replicate_ignore_db="db1,,,db2,,,db3";
+SELECT @@GLOBAL.replicate_ignore_db;
+
+SET @@GLOBAL.replicate_ignore_db="";
+SELECT @@GLOBAL.replicate_ignore_db;
+
+SET @@GLOBAL.replicate_ignore_db=null;
+SELECT @@GLOBAL.replicate_ignore_db;
+
+--echo # Cleanup.
+SET @@GLOBAL.replicate_ignore_db = @save_replicate_ignore_db;
diff --git a/mysql-test/suite/sys_vars/t/replicate_ignore_db_grant.test b/mysql-test/suite/sys_vars/t/replicate_ignore_db_grant.test
new file mode 100644
index 00000000..c073ccf2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/replicate_ignore_db_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21966 Bind REPLICATION SLAVE ADMIN to a number of global system variables
+--echo #
+
+--let var = replicate_ignore_db
+--let grant = REPLICATION SLAVE ADMIN
+--let value = ''
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/replicate_ignore_table_basic.test b/mysql-test/suite/sys_vars/t/replicate_ignore_table_basic.test
new file mode 100644
index 00000000..1cf6f010
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/replicate_ignore_table_basic.test
@@ -0,0 +1,58 @@
+--source include/not_embedded.inc
+
+--echo #
+--echo # Basic testing of replicate_ignore_table.
+--echo #
+
+SET @save_replicate_ignore_table = @@GLOBAL.replicate_ignore_table;
+SELECT @save_replicate_ignore_table;
+
+--echo # Scope.
+
+--error ER_GLOBAL_VARIABLE
+SET @@SESSION.replicate_ignore_table = "";
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@SESSION.replicate_ignore_table;
+
+--echo # Incorrect type.
+
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@GLOBAL.replicate_ignore_table=1;
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@GLOBAL.replicate_ignore_table=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@GLOBAL.replicate_ignore_table=1e1;
+
+--echo # Incorrect arguments.
+
+--error ER_WRONG_ARGUMENTS
+SET @@GLOBAL.replicate_ignore_table="t1";
+--error ER_WRONG_ARGUMENTS
+SET @@GLOBAL.replicate_ignore_table="test.t1, t2";
+--error ER_WRONG_ARGUMENTS
+SET @@GLOBAL.replicate_ignore_table="test.,t1";
+
+--echo # Argument syntax.
+
+SET @@GLOBAL.replicate_ignore_table="test.t1,,,,,test.t3";
+SELECT @@GLOBAL.replicate_ignore_table;
+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='replicate_ignore_table';
+
+SET @@GLOBAL.replicate_ignore_table="test.t1,,,test2.t2,,,test.t3";
+SELECT @@GLOBAL.replicate_ignore_table;
+
+SET @@GLOBAL.replicate_ignore_table="";
+SELECT @@GLOBAL.replicate_ignore_table;
+
+SET @@GLOBAL.replicate_ignore_table=null;
+SELECT @@GLOBAL.replicate_ignore_table;
+
+--echo # Cleanup.
+SET @@GLOBAL.replicate_ignore_table = @save_replicate_ignore_table;
+
+--echo #
+--echo # MDEV-20101 Assertion failure on select @@global.'m2'.replicate_ignore_table
+--echo #
+
+SET NAMES latin1;
+SELECT @@global.'m2'.replicate_ignore_table;
diff --git a/mysql-test/suite/sys_vars/t/replicate_ignore_table_grant.test b/mysql-test/suite/sys_vars/t/replicate_ignore_table_grant.test
new file mode 100644
index 00000000..d34a95cc
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/replicate_ignore_table_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21966 Bind REPLICATION SLAVE ADMIN to a number of global system variables
+--echo #
+
+--let var = replicate_ignore_table
+--let grant = REPLICATION SLAVE ADMIN
+--let value = ''
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/replicate_rewrite_db.opt b/mysql-test/suite/sys_vars/t/replicate_rewrite_db.opt
new file mode 100644
index 00000000..27468051
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/replicate_rewrite_db.opt
@@ -0,0 +1,3 @@
+"--replicate-rewrite-db=test->rewrite"
+"--replicate-rewrite-db= mysqltest1 -> test"
+"--replicate-rewrite-db=a -> b"
diff --git a/mysql-test/suite/sys_vars/t/replicate_rewrite_db.test b/mysql-test/suite/sys_vars/t/replicate_rewrite_db.test
new file mode 100644
index 00000000..7fbaab1f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/replicate_rewrite_db.test
@@ -0,0 +1,84 @@
+--source include/not_embedded.inc
+
+--echo #
+--echo # MDEV-15530: Variable replicate_rewrite_db
+--echo # cannot be found in "show global variables"
+--echo #
+
+SET @save_replicate_rewrite_db = @@GLOBAL.replicate_rewrite_db;
+SELECT @save_replicate_rewrite_db;
+
+--echo # Test session/Scope (it is global variable)
+
+select @@global.replicate_rewrite_db;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@SESSION.replicate_rewrite_db;
+--error ER_GLOBAL_VARIABLE
+SET @@SESSION.replicate_rewrite_db = "";
+show global variables like 'replicate_rewrite_db';
+show session variables like 'replicate_rewrite_db';
+select * from information_schema.global_variables where variable_name='replicate_rewrite_db';
+select * from information_schema.session_variables where variable_name='replicate_rewrite_db';
+
+--echo # Incorrect type
+
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@GLOBAL.replicate_rewrite_db=1;
+--error ER_WRONG_ARGUMENTS
+SET @@GLOBAL.replicate_rewrite_db="->";
+--error ER_WRONG_ARGUMENTS
+SET @@GLOBAL.replicate_rewrite_db=" ";
+--error ER_WRONG_ARGUMENTS
+SET @@GLOBAL.replicate_rewrite_db="a->";
+--error ER_WRONG_ARGUMENTS
+SET @@GLOBAL.replicate_rewrite_db="->b";
+
+--echo # Check arguments
+
+--error ER_GLOBAL_VARIABLE
+set session replicate_rewrite_db=1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global replicate_rewrite_db=1;
+--error ER_GLOBAL_VARIABLE
+SET @@SESSION.replicate_do_db = "";
+# This should work
+SET @@GLOBAL.replicate_rewrite_db="";
+SELECT @@GLOBAL.replicate_rewrite_db;
+SET @@GLOBAL.replicate_rewrite_db=null;
+SELECT @@GLOBAL.replicate_rewrite_db;
+SET @@GLOBAL.replicate_rewrite_db=DEFAULT;
+SELECT @@GLOBAL.replicate_rewrite_db;
+SET @@GLOBAL.replicate_rewrite_db="db1->db3";
+SELECT @@GLOBAL.replicate_rewrite_db;
+SET @@GLOBAL.replicate_rewrite_db="db2 ->db4";
+SELECT @@GLOBAL.replicate_rewrite_db;
+SET @@GLOBAL.replicate_rewrite_db=" db5 ->db7 ";
+SELECT @@GLOBAL.replicate_rewrite_db;
+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='replicate_rewrite_db';
+select * from information_schema.session_variables where variable_name='replicate_rewrite_db';
+show global variables like 'replicate_rewrite_db';
+
+SET @@GLOBAL.replicate_rewrite_db="db1->db2, db3->db4";
+SELECT @@GLOBAL.replicate_rewrite_db;
+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='replicate_rewrite_db';
+
+--echo # Check restart with appending the value
+--let $restart_parameters = "--replicate_rewrite_db='X->Y'"
+--source include/restart_mysqld.inc
+SELECT @@GLOBAL.replicate_rewrite_db;
+
+--echo # Check restart with wrong value on CLI
+--source include/shutdown_mysqld.inc
+# Expect the server to fail to come up with these options
+--let $args="--replicate_rewrite_db=x-" --log-warnings=1 --silent-startup --help --verbose
+--error 1
+--exec $MYSQLD_CMD $args > $MYSQL_TMP_DIR/mysqld--replicate.txt 2> $MYSQL_TMP_DIR/mysqld--replicate.err
+--replace_regex /mysqld/mariadbd/ /\d\d\d\d-\d*-\d* *\d*:\d*:\d* \d* //
+--cat_file $MYSQL_TMP_DIR/mysqld--replicate.err
+# Restart the server with the default options
+--let $restart_parameters = ""
+--source include/start_mysqld.inc
+SELECT @@GLOBAL.replicate_rewrite_db;
+
+--echo # Cleanup.
+SET @@GLOBAL.replicate_rewrite_db = @save_replicate_rewrite_db;
diff --git a/mysql-test/suite/sys_vars/t/replicate_wild_do_table_basic.test b/mysql-test/suite/sys_vars/t/replicate_wild_do_table_basic.test
new file mode 100644
index 00000000..832d3397
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/replicate_wild_do_table_basic.test
@@ -0,0 +1,51 @@
+--source include/not_embedded.inc
+
+--echo #
+--echo # Basic testing of replicate_wild_do_table.
+--echo #
+
+SET @save_replicate_wild_do_table = @@GLOBAL.replicate_wild_do_table;
+SELECT @save_replicate_wild_do_table;
+
+--echo # Scope.
+
+--error ER_GLOBAL_VARIABLE
+SET @@SESSION.replicate_wild_do_table = "";
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@SESSION.replicate_wild_do_table;
+
+--echo # Incorrect type.
+
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@GLOBAL.replicate_wild_do_table=1;
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@GLOBAL.replicate_wild_do_table=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@GLOBAL.replicate_wild_do_table=1e1;
+
+--echo # Incorrect arguments.
+
+--error ER_WRONG_ARGUMENTS
+SET @@GLOBAL.replicate_wild_do_table="t1";
+--error ER_WRONG_ARGUMENTS
+SET @@GLOBAL.replicate_wild_do_table="test.t, t2";
+--error ER_WRONG_ARGUMENTS
+SET @@GLOBAL.replicate_wild_do_table="test.,t1";
+
+--echo # Argument syntax.
+
+SET @@GLOBAL.replicate_wild_do_table="test.%,,,,,test.t3";
+SELECT @@GLOBAL.replicate_wild_do_table;
+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='replicate_wild_do_table';
+
+SET @@GLOBAL.replicate_wild_do_table="test.t1,,,test2.%,,,test.t3";
+SELECT @@GLOBAL.replicate_wild_do_table;
+
+SET @@GLOBAL.replicate_wild_do_table="";
+SELECT @@GLOBAL.replicate_wild_do_table;
+
+SET @@GLOBAL.replicate_wild_do_table=null;
+SELECT @@GLOBAL.replicate_wild_do_table;
+
+--echo # Cleanup.
+SET @@GLOBAL.replicate_wild_do_table = @save_replicate_wild_do_table;
diff --git a/mysql-test/suite/sys_vars/t/replicate_wild_do_table_grant.test b/mysql-test/suite/sys_vars/t/replicate_wild_do_table_grant.test
new file mode 100644
index 00000000..f787b333
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/replicate_wild_do_table_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21966 Bind REPLICATION SLAVE ADMIN to a number of global system variables
+--echo #
+
+--let var = replicate_wild_do_table
+--let grant = REPLICATION SLAVE ADMIN
+--let value = ''
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/replicate_wild_ignore_table_basic.test b/mysql-test/suite/sys_vars/t/replicate_wild_ignore_table_basic.test
new file mode 100644
index 00000000..5cb1ff6c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/replicate_wild_ignore_table_basic.test
@@ -0,0 +1,51 @@
+--source include/not_embedded.inc
+
+--echo #
+--echo # Basic testing of replicate_wild_ignore_table.
+--echo #
+
+SET @save_replicate_wild_ignore_table = @@GLOBAL.replicate_wild_ignore_table;
+SELECT @save_replicate_wild_ignore_table;
+
+--echo # Scope.
+
+--error ER_GLOBAL_VARIABLE
+SET @@SESSION.replicate_wild_ignore_table = "";
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@SESSION.replicate_wild_ignore_table;
+
+--echo # Incorrect type.
+
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@GLOBAL.replicate_wild_ignore_table=1;
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@GLOBAL.replicate_wild_ignore_table=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@GLOBAL.replicate_wild_ignore_table=1e1;
+
+--echo # Incorrect arguments.
+
+--error ER_WRONG_ARGUMENTS
+SET @@GLOBAL.replicate_wild_ignore_table="t1";
+--error ER_WRONG_ARGUMENTS
+SET @@GLOBAL.replicate_wild_ignore_table="test.t, t2";
+--error ER_WRONG_ARGUMENTS
+SET @@GLOBAL.replicate_wild_ignore_table="test.,t1";
+
+--echo # Argument syntax.
+
+SET @@GLOBAL.replicate_wild_ignore_table="test.%,,,,,test.t3";
+SELECT @@GLOBAL.replicate_wild_ignore_table;
+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='replicate_wild_ignore_table';
+
+SET @@GLOBAL.replicate_wild_ignore_table="test.t1,,,test2.%,,,test.t3";
+SELECT @@GLOBAL.replicate_wild_ignore_table;
+
+SET @@GLOBAL.replicate_wild_ignore_table="";
+SELECT @@GLOBAL.replicate_wild_ignore_table;
+
+SET @@GLOBAL.replicate_wild_ignore_table=null;
+SELECT @@GLOBAL.replicate_wild_ignore_table;
+
+--echo # Cleanup.
+SET @@GLOBAL.replicate_wild_ignore_table = @save_replicate_wild_ignore_table;
diff --git a/mysql-test/suite/sys_vars/t/replicate_wild_ignore_table_grant.test b/mysql-test/suite/sys_vars/t/replicate_wild_ignore_table_grant.test
new file mode 100644
index 00000000..f4ed0cc5
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/replicate_wild_ignore_table_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21966 Bind REPLICATION SLAVE ADMIN to a number of global system variables
+--echo #
+
+--let var = replicate_wild_ignore_table
+--let grant = REPLICATION SLAVE ADMIN
+--let value = ''
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/report_host_basic.test b/mysql-test/suite/sys_vars/t/report_host_basic.test
new file mode 100644
index 00000000..5565370f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/report_host_basic.test
@@ -0,0 +1,19 @@
+--source include/not_embedded.inc
+#
+# only global
+#
+select @@global.report_host;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.report_host;
+show global variables like 'report_host';
+show session variables like 'report_host';
+select * from information_schema.global_variables where variable_name='report_host';
+select * from information_schema.session_variables where variable_name='report_host';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global report_host=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session report_host=1;
diff --git a/mysql-test/suite/sys_vars/t/report_password_basic.test b/mysql-test/suite/sys_vars/t/report_password_basic.test
new file mode 100644
index 00000000..ed564cfe
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/report_password_basic.test
@@ -0,0 +1,19 @@
+--source include/not_embedded.inc
+#
+# only global
+#
+select @@global.report_password;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.report_password;
+show global variables like 'report_password';
+show session variables like 'report_password';
+select * from information_schema.global_variables where variable_name='report_password';
+select * from information_schema.session_variables where variable_name='report_password';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global report_password=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session report_password=1;
diff --git a/mysql-test/suite/sys_vars/t/report_port_basic.test b/mysql-test/suite/sys_vars/t/report_port_basic.test
new file mode 100644
index 00000000..dfe64dd4
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/report_port_basic.test
@@ -0,0 +1,25 @@
+--source include/not_embedded.inc
+#
+# only global
+#
+--replace_regex /[0-9]+/DEFAULT_MASTER_PORT/
+select @@global.report_port;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.report_port;
+--replace_column 2 'DEFAULT_MASTER_PORT'
+show global variables like 'report_port';
+--replace_column 2 'DEFAULT_MASTER_PORT'
+show session variables like 'report_port';
+--replace_column 2 'DEFAULT_MASTER_PORT'
+select * from information_schema.global_variables where variable_name='report_port';
+--replace_column 2 'DEFAULT_MASTER_PORT'
+select * from information_schema.session_variables where variable_name='report_port';
+--replace_column 2 'DEFAULT_MASTER_PORT'
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global report_port=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session report_port=1;
diff --git a/mysql-test/suite/sys_vars/t/report_user_basic.test b/mysql-test/suite/sys_vars/t/report_user_basic.test
new file mode 100644
index 00000000..192e6b77
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/report_user_basic.test
@@ -0,0 +1,19 @@
+--source include/not_embedded.inc
+#
+# only global
+#
+select @@global.report_user;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.report_user;
+show global variables like 'report_user';
+show session variables like 'report_user';
+select * from information_schema.global_variables where variable_name='report_user';
+select * from information_schema.session_variables where variable_name='report_user';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global report_user=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session report_user=1;
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
new file mode 100644
index 00000000..c7c734b7
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/rowid_merge_buff_size_basic.test
@@ -0,0 +1,43 @@
+# ulong session
+
+SET @start_global_value = @@global.rowid_merge_buff_size;
+
+#
+# exists as global only
+#
+select @@global.rowid_merge_buff_size;
+select @@session.rowid_merge_buff_size;
+show global variables like 'rowid_merge_buff_size';
+show session variables like 'rowid_merge_buff_size';
+select * from information_schema.global_variables where variable_name='rowid_merge_buff_size';
+select * from information_schema.session_variables where variable_name='rowid_merge_buff_size';
+
+#
+# show that it's writable
+#
+set global rowid_merge_buff_size=10;
+select @@global.rowid_merge_buff_size;
+set session rowid_merge_buff_size=10;
+select @@session.rowid_merge_buff_size;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global rowid_merge_buff_size=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set session rowid_merge_buff_size=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global rowid_merge_buff_size="foo";
+
+#
+# min/max values, block size
+#
+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 4294967295 9223372036854775807
+select @@session.rowid_merge_buff_size;
+
+SET @@global.rowid_merge_buff_size = @start_global_value;
+
diff --git a/mysql-test/suite/sys_vars/t/rpl_init_slave_func.test b/mysql-test/suite/sys_vars/t/rpl_init_slave_func.test
new file mode 100644
index 00000000..0e5ff7a3
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/rpl_init_slave_func.test
@@ -0,0 +1,111 @@
+###############################################################################
+# #
+# Variable Name: init_slave #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: string #
+# Default Value: #
+# Range: #
+# #
+# #
+# Creation Date: 2008-03-08 #
+# Author: Rizwan #
+# Modified: HHunger 2008-09-29 Fixed the bug by inserting the usual wait and #
+# SQL-Satements to control master and slave, #
+# deleted the sleep and made improvements like: #
+# - Replaced the opt file by dynamic variables, #
+# - Made the tests independant of the initial #
+# values of the global variables, #
+# - Reduced the test to the needed test case to #
+# save run time, #
+# - Beautification. #
+# #
+# Description: Test Cases of Dynamic System Variable init_slave #
+# that checks the behavior of this variable #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# #
+###############################################################################
+
+source include/master-slave.inc;
+
+# Since a part of slave SQL thread initialisation happens after Slave_SQL_Running
+# has been set to Yes, there is a race condition between initialisation above and
+# init_slave setting given below. Synchronise slave applier with master to ensure
+# init_slave is complete and applier had processed few events like FD.
+--source include/sync_slave_sql_with_master.inc
+
+--disable_query_log
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+--enable_query_log
+#
+# save the current values
+
+SET @start_max_connections= @@global.max_connections;
+SET @start_init_slave= @@global.init_slave;
+
+# setting of a global value with an effect on the next start of the slave server
+# check that @@global.init_slave could be set
+SET NAMES utf8;
+let $my_init_slave=
+ 'SET @@global.max_connections = @@global.max_connections + 1 -- комментарий';
+eval SET @@global.init_slave = $my_init_slave;
+
+# show the data type of the variable
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+CREATE TEMPORARY TABLE t1 AS SELECT @@global.init_slave AS my_column;
+--enable_warnings
+DESCRIBE t1;
+select length(my_column) from t1;
+DROP TABLE t1;
+#
+# check that the new setting of @@global.init_slave becomes immediately visible
+eval SELECT @@global.init_slave = $my_init_slave;
+--echo Expect 1
+# wait for the slave threads have set the global variable.
+let $wait_timeout= 90;
+let $wait_condition= SELECT @@global.max_connections = @start_max_connections;
+--source include/wait_condition_sp.inc
+# check that the action in init_slave does not happen immediately
+--let $assert_text= @@global.max_connections = @start_max_connections
+--let $assert_cond= @@global.max_connections = @start_max_connections
+--source include/assert.inc
+
+--source include/restart_slave_sql.inc
+
+# Upon slave start, sync the applier with master, to ensure slave has
+# completed init_slave command execution and processed FD event from the
+# master.
+--connection master
+--source include/sync_slave_sql_with_master.inc
+
+#
+# wait for the slave threads have set the global variable.
+let $wait_timeout= 90;
+let $wait_condition= SELECT @@global.max_connections = @start_max_connections + 1;
+--source include/wait_condition_sp.inc
+# check that the action in init_slave was executed and had the intended effect
+--let $assert_text= @@global.max_connections = @start_max_connections + 1
+--let $assert_cond= @@global.max_connections = @start_max_connections + 1
+--source include/assert.inc
+#
+# Setting a variable(which is local to a session) and must not be visible
+SET @@global.init_slave = "SET @a=5";
+#
+--source include/restart_slave_sql.inc
+#
+SHOW VARIABLES LIKE 'init_slave';
+# expect NULL
+SELECT @a;
+--echo Expect NULL
+#
+# Clean up
+SET @@global.max_connections= @start_max_connections;
+SET @@global.init_slave= @start_init_slave;
+##################################################
+# End of functionality Testing for init_slave #
+##################################################
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/sys_vars/t/rpl_max_binlog_size_func-master.opt b/mysql-test/suite/sys_vars/t/rpl_max_binlog_size_func-master.opt
new file mode 100644
index 00000000..89d47e66
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/rpl_max_binlog_size_func-master.opt
@@ -0,0 +1,3 @@
+--general-log
+--log-bin=mylog.log
+
diff --git a/mysql-test/suite/sys_vars/t/rpl_max_binlog_size_func.test b/mysql-test/suite/sys_vars/t/rpl_max_binlog_size_func.test
new file mode 100644
index 00000000..efcec456
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/rpl_max_binlog_size_func.test
@@ -0,0 +1,42 @@
+source include/have_log_bin.inc;
+
+###############################################################################
+# Begin the functionality testing of max_binlog_size #
+###############################################################################
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+#==============================================================
+--echo '--- check if log file is rotated after 4096 bytes ----'
+#==============================================================
+
+SET @saved_max_binlog_size= @@global.max_binlog_size;
+SET @@global.max_binlog_size = 4096;
+CREATE TABLE t1(a CHAR(5));
+
+# around 50 records are required to rotate bin log
+let $a = 50;
+--disable_query_log
+while ($a){
+INSERT INTO t1 VALUES ('mysql');
+dec $a;
+}
+--enable_query_log
+SELECT COUNT(*) FROM t1;
+
+# if log file is not created then this will fail
+let $MYSQLD_DATADIR=`select @@datadir`;
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--file_exists $MYSQLD_DATADIR/mylog.000002
+
+--echo 'mylog.000002 exists'
+
+SET @@global.max_binlog_size= @saved_max_binlog_size;
+
+DROP TABLE t1;
+
+###############################################################################
+# End of functionality testing for max_binlog_size #
+###############################################################################
+
diff --git a/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_enabled_basic.test b/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_enabled_basic.test
new file mode 100644
index 00000000..68653d3a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_enabled_basic.test
@@ -0,0 +1,88 @@
+
+#
+# exists as a global only
+#
+# 2010-01-21 OBN - Added
+#
+#
+source include/not_embedded.inc;
+select @@global.rpl_semi_sync_master_enabled;
+SET @start_global_value = @@global.rpl_semi_sync_master_enabled;
+
+select @@global.rpl_semi_sync_master_enabled in (0,1);
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.rpl_semi_sync_master_enabled;
+show global variables like 'rpl_semi_sync_master_enabled';
+show session variables like 'rpl_semi_sync_master_enabled';
+select * from information_schema.global_variables where variable_name='rpl_semi_sync_master_enabled';
+select * from information_schema.session_variables where variable_name='rpl_semi_sync_master_enabled';
+
+#
+# show that it's writable
+#
+set global rpl_semi_sync_master_enabled=0;
+--error ER_GLOBAL_VARIABLE
+set session rpl_semi_sync_master_enabled=0;
+select @@global.rpl_semi_sync_master_enabled;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.rpl_semi_sync_master_enabled;
+show global variables like 'rpl_semi_sync_master_enabled';
+show session variables like 'rpl_semi_sync_master_enabled';
+select * from information_schema.global_variables where variable_name='rpl_semi_sync_master_enabled';
+select * from information_schema.session_variables where variable_name='rpl_semi_sync_master_enabled';
+set global rpl_semi_sync_master_enabled=1;
+--error ER_GLOBAL_VARIABLE
+set session rpl_semi_sync_master_enabled=1;
+select @@global.rpl_semi_sync_master_enabled;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.rpl_semi_sync_master_enabled;
+show global variables like 'rpl_semi_sync_master_enabled';
+show session variables like 'rpl_semi_sync_master_enabled';
+select * from information_schema.global_variables where variable_name='rpl_semi_sync_master_enabled';
+select * from information_schema.session_variables where variable_name='rpl_semi_sync_master_enabled';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global rpl_semi_sync_master_enabled=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global rpl_semi_sync_master_enabled=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global rpl_semi_sync_master_enabled="some text";
+
+#
+# Test conflicting concurrent setting
+#
+--let $val_saved= `SELECT @@global.rpl_semi_sync_master_enabled`
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+--let $iter=100
+--disable_query_log
+while ($iter)
+{
+ --connection con1
+ --send_eval SET @@global.rpl_semi_sync_master_enabled = $iter % 2
+
+ --connection con2
+ --send_eval SET @@global.rpl_semi_sync_master_enabled = ($iter + 1) % 2
+
+ --connection con1
+ reap;
+ --connection con2
+ reap;
+
+ --dec $iter
+}
+--enable_query_log
+disconnect con1;
+disconnect con2;
+
+--connection default
+--eval SET @@global.rpl_semi_sync_master_enabled = $val_saved
+
+#
+# Cleanup
+#
+SET @@global.rpl_semi_sync_master_enabled = @start_global_value;
+select @@global.rpl_semi_sync_master_enabled;
diff --git a/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_enabled_grant.test b/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_enabled_grant.test
new file mode 100644
index 00000000..813f4240
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_enabled_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21967 Bind REPLICATION {MASTER|SLAVE} ADMIN to rpl_semi_sync_* variables
+--echo #
+
+--let var = rpl_semi_sync_master_enabled
+--let grant = REPLICATION MASTER ADMIN
+--let value = 1
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_timeout_basic.test b/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_timeout_basic.test
new file mode 100644
index 00000000..d312fa1c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_timeout_basic.test
@@ -0,0 +1,49 @@
+
+#
+# exists as a global only
+#
+# 2010-01-21 OBN - Added
+#
+source include/not_embedded.inc;
+select @@global.rpl_semi_sync_master_timeout;
+SET @start_global_value = @@global.rpl_semi_sync_master_timeout;
+
+--echo Assuming value will not be more then 100 sec
+select @@global.rpl_semi_sync_master_timeout between 1 and 100000;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.rpl_semi_sync_master_timeout;
+show global variables like 'rpl_semi_sync_master_timeout';
+show session variables like 'rpl_semi_sync_master_timeout';
+select * from information_schema.global_variables where variable_name='rpl_semi_sync_master_timeout';
+select * from information_schema.session_variables where variable_name='rpl_semi_sync_master_timeout';
+
+#
+# show that it's writable
+#
+set global rpl_semi_sync_master_timeout=42;
+--error ER_GLOBAL_VARIABLE
+set session rpl_semi_sync_master_timeout=99;
+select @@global.rpl_semi_sync_master_timeout;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.rpl_semi_sync_master_timeout;
+show global variables like 'rpl_semi_sync_master_timeout';
+show session variables like 'rpl_semi_sync_master_timeout';
+select * from information_schema.global_variables where variable_name='rpl_semi_sync_master_timeout';
+select * from information_schema.session_variables where variable_name='rpl_semi_sync_master_timeout';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global rpl_semi_sync_master_timeout=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global rpl_semi_sync_master_timeout=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global rpl_semi_sync_master_timeout="some text";
+
+
+#
+# Cleanup
+#
+SET @@global.rpl_semi_sync_master_timeout = @start_global_value;
+select @@global.rpl_semi_sync_master_timeout;
diff --git a/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_timeout_grant.test b/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_timeout_grant.test
new file mode 100644
index 00000000..6fbf219b
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_timeout_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21967 Bind REPLICATION {MASTER|SLAVE} ADMIN to rpl_semi_sync_* variables
+--echo #
+
+--let var = rpl_semi_sync_master_timeout
+--let grant = REPLICATION MASTER ADMIN
+--let value = 20000
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_trace_level_basic.test b/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_trace_level_basic.test
new file mode 100644
index 00000000..3419254b
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_trace_level_basic.test
@@ -0,0 +1,57 @@
+
+#
+# exists as a global only
+#
+# 2010-01-21 OBN - Added
+#
+source include/not_embedded.inc;
+select @@global.rpl_semi_sync_master_trace_level;
+SET @start_global_value = @@global.rpl_semi_sync_master_trace_level;
+
+select @@global.rpl_semi_sync_master_trace_level in (1,16,32,64);
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.rpl_semi_sync_master_trace_level;
+show global variables like 'rpl_semi_sync_master_trace_level';
+show session variables like 'rpl_semi_sync_master_trace_level';
+select * from information_schema.global_variables where variable_name='rpl_semi_sync_master_trace_level';
+select * from information_schema.session_variables where variable_name='rpl_semi_sync_master_trace_level';
+
+#
+# show that it's writable
+#
+set global rpl_semi_sync_master_trace_level=16;
+--error ER_GLOBAL_VARIABLE
+set session rpl_semi_sync_master_trace_level=99;
+select @@global.rpl_semi_sync_master_trace_level;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.rpl_semi_sync_master_trace_level;
+show global variables like 'rpl_semi_sync_master_trace_level';
+show session variables like 'rpl_semi_sync_master_trace_level';
+select * from information_schema.global_variables where variable_name='rpl_semi_sync_master_trace_level';
+select * from information_schema.session_variables where variable_name='rpl_semi_sync_master_trace_level';
+
+--echo NOTE: Value can also be set to values that are combinations of values
+set global rpl_semi_sync_master_trace_level=42;
+select @@global.rpl_semi_sync_master_trace_level;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.rpl_semi_sync_master_trace_level;
+show global variables like 'rpl_semi_sync_master_trace_level';
+show session variables like 'rpl_semi_sync_master_trace_level';
+select * from information_schema.global_variables where variable_name='rpl_semi_sync_master_trace_level';
+select * from information_schema.session_variables where variable_name='rpl_semi_sync_master_trace_level';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global rpl_semi_sync_master_trace_level=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global rpl_semi_sync_master_trace_level=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global rpl_semi_sync_master_trace_level="some text";
+
+#
+# Cleanup
+#
+SET @@global.rpl_semi_sync_master_trace_level = @start_global_value;
+select @@global.rpl_semi_sync_master_trace_level;
diff --git a/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_trace_level_grant.test b/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_trace_level_grant.test
new file mode 100644
index 00000000..66aa8272
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_trace_level_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21967 Bind REPLICATION {MASTER|SLAVE} ADMIN to rpl_semi_sync_* variables
+--echo #
+
+--let var = rpl_semi_sync_master_trace_level
+--let grant = REPLICATION MASTER ADMIN
+--let value = 64
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_wait_no_slave_basic.test b/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_wait_no_slave_basic.test
new file mode 100644
index 00000000..60ca4425
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_wait_no_slave_basic.test
@@ -0,0 +1,60 @@
+
+#
+# exists as a global only
+#
+# 2010-01-21 OBN - Added
+#
+#
+source include/not_embedded.inc;
+select @@global.rpl_semi_sync_master_wait_no_slave;
+SET @start_global_value = @@global.rpl_semi_sync_master_wait_no_slave;
+
+select @@global.rpl_semi_sync_master_wait_no_slave in (0,1);
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.rpl_semi_sync_master_wait_no_slave;
+show global variables like 'rpl_semi_sync_master_wait_no_slave';
+show session variables like 'rpl_semi_sync_master_wait_no_slave';
+select * from information_schema.global_variables where variable_name='rpl_semi_sync_master_wait_no_slave';
+select * from information_schema.session_variables where variable_name='rpl_semi_sync_master_wait_no_slave';
+
+#
+# show that it's writable
+#
+set global rpl_semi_sync_master_wait_no_slave=0;
+--error ER_GLOBAL_VARIABLE
+set session rpl_semi_sync_master_wait_no_slave=0;
+select @@global.rpl_semi_sync_master_wait_no_slave;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.rpl_semi_sync_master_wait_no_slave;
+show global variables like 'rpl_semi_sync_master_wait_no_slave';
+show session variables like 'rpl_semi_sync_master_wait_no_slave';
+select * from information_schema.global_variables where variable_name='rpl_semi_sync_master_wait_no_slave';
+select * from information_schema.session_variables where variable_name='rpl_semi_sync_master_wait_no_slave';
+set global rpl_semi_sync_master_wait_no_slave=1;
+--error ER_GLOBAL_VARIABLE
+set session rpl_semi_sync_master_wait_no_slave=1;
+select @@global.rpl_semi_sync_master_wait_no_slave;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.rpl_semi_sync_master_wait_no_slave;
+show global variables like 'rpl_semi_sync_master_wait_no_slave';
+show session variables like 'rpl_semi_sync_master_wait_no_slave';
+select * from information_schema.global_variables where variable_name='rpl_semi_sync_master_wait_no_slave';
+select * from information_schema.session_variables where variable_name='rpl_semi_sync_master_wait_no_slave';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global rpl_semi_sync_master_wait_no_slave=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global rpl_semi_sync_master_wait_no_slave=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global rpl_semi_sync_master_wait_no_slave="some text";
+
+
+#
+# Cleanup
+#
+SET @@global.rpl_semi_sync_master_wait_no_slave = @start_global_value;
+select @@global.rpl_semi_sync_master_wait_no_slave;
+
diff --git a/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_wait_no_slave_grant.test b/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_wait_no_slave_grant.test
new file mode 100644
index 00000000..33571013
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_wait_no_slave_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21967 Bind REPLICATION {MASTER|SLAVE} ADMIN to rpl_semi_sync_* variables
+--echo #
+
+--let var = rpl_semi_sync_master_wait_no_slave
+--let grant = REPLICATION MASTER ADMIN
+--let value = 1
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_wait_point_basic.test b/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_wait_point_basic.test
new file mode 100644
index 00000000..2f8cd8ec
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_wait_point_basic.test
@@ -0,0 +1,39 @@
+source include/not_embedded.inc;
+select @@global.rpl_semi_sync_master_wait_point;
+SET @start_global_value = @@global.rpl_semi_sync_master_wait_point;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.rpl_semi_sync_master_wait_point;
+show global variables like 'rpl_semi_sync_master_wait_point';
+show session variables like 'rpl_semi_sync_master_wait_point';
+select * from information_schema.global_variables where variable_name='rpl_semi_sync_master_wait_point';
+select * from information_schema.session_variables where variable_name='rpl_semi_sync_master_wait_point';
+
+#
+# show that it's writable
+#
+set global rpl_semi_sync_master_wait_point=AFTER_SYNC;
+--error ER_GLOBAL_VARIABLE
+set session rpl_semi_sync_master_wait_point=AFTER_COMMIT;
+select @@global.rpl_semi_sync_master_wait_point;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.rpl_semi_sync_master_wait_point;
+show global variables like 'rpl_semi_sync_master_wait_point';
+show session variables like 'rpl_semi_sync_master_wait_point';
+select * from information_schema.global_variables where variable_name='rpl_semi_sync_master_wait_point';
+select * from information_schema.session_variables where variable_name='rpl_semi_sync_master_wait_point';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global rpl_semi_sync_master_wait_point=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global rpl_semi_sync_master_wait_point=1e1;
+
+
+#
+# Cleanup
+#
+SET @@global.rpl_semi_sync_master_wait_point = @start_global_value;
+select @@global.rpl_semi_sync_master_wait_point;
diff --git a/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_wait_point_grant.test b/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_wait_point_grant.test
new file mode 100644
index 00000000..7f997d85
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_wait_point_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21967 Bind REPLICATION {MASTER|SLAVE} ADMIN to rpl_semi_sync_* variables
+--echo #
+
+--let var = rpl_semi_sync_master_wait_point
+--let grant = REPLICATION MASTER ADMIN
+--let value = AFTER_SYNC
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/rpl_semi_sync_slave_delay_master_grant.test b/mysql-test/suite/sys_vars/t/rpl_semi_sync_slave_delay_master_grant.test
new file mode 100644
index 00000000..2e065913
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/rpl_semi_sync_slave_delay_master_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21967 Bind REPLICATION {MASTER|SLAVE} ADMIN to rpl_semi_sync_* variables
+--echo #
+
+--let var = rpl_semi_sync_slave_delay_master
+--let grant = REPLICATION SLAVE ADMIN
+--let value = 1
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/rpl_semi_sync_slave_enabled_basic.test b/mysql-test/suite/sys_vars/t/rpl_semi_sync_slave_enabled_basic.test
new file mode 100644
index 00000000..71be941c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/rpl_semi_sync_slave_enabled_basic.test
@@ -0,0 +1,60 @@
+
+#
+# exists as a global only
+#
+# 2010-01-21 OBN - Added
+#
+#
+source include/not_embedded.inc;
+select @@global.rpl_semi_sync_slave_enabled;
+SET @start_global_value = @@global.rpl_semi_sync_slave_enabled;
+
+select @@global.rpl_semi_sync_slave_enabled in (0,1);
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.rpl_semi_sync_slave_enabled;
+show global variables like 'rpl_semi_sync_slave_enabled';
+show session variables like 'rpl_semi_sync_slave_enabled';
+select * from information_schema.global_variables where variable_name='rpl_semi_sync_slave_enabled';
+select * from information_schema.session_variables where variable_name='rpl_semi_sync_slave_enabled';
+
+#
+# show that it's writable
+#
+set global rpl_semi_sync_slave_enabled=0;
+--error ER_GLOBAL_VARIABLE
+set session rpl_semi_sync_slave_enabled=0;
+select @@global.rpl_semi_sync_slave_enabled;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.rpl_semi_sync_slave_enabled;
+show global variables like 'rpl_semi_sync_slave_enabled';
+show session variables like 'rpl_semi_sync_slave_enabled';
+select * from information_schema.global_variables where variable_name='rpl_semi_sync_slave_enabled';
+select * from information_schema.session_variables where variable_name='rpl_semi_sync_slave_enabled';
+set global rpl_semi_sync_slave_enabled=1;
+--error ER_GLOBAL_VARIABLE
+set session rpl_semi_sync_slave_enabled=1;
+select @@global.rpl_semi_sync_slave_enabled;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.rpl_semi_sync_slave_enabled;
+show global variables like 'rpl_semi_sync_slave_enabled';
+show session variables like 'rpl_semi_sync_slave_enabled';
+select * from information_schema.global_variables where variable_name='rpl_semi_sync_slave_enabled';
+select * from information_schema.session_variables where variable_name='rpl_semi_sync_slave_enabled';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global rpl_semi_sync_slave_enabled=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global rpl_semi_sync_slave_enabled=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global rpl_semi_sync_slave_enabled="some text";
+--error ER_WRONG_VALUE_FOR_VAR
+
+
+#
+# Cleanup
+#
+SET @@global.rpl_semi_sync_slave_enabled = @start_global_value;
+select @@global.rpl_semi_sync_slave_enabled;
diff --git a/mysql-test/suite/sys_vars/t/rpl_semi_sync_slave_enabled_grant.test b/mysql-test/suite/sys_vars/t/rpl_semi_sync_slave_enabled_grant.test
new file mode 100644
index 00000000..d0515fbb
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/rpl_semi_sync_slave_enabled_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21967 Bind REPLICATION {MASTER|SLAVE} ADMIN to rpl_semi_sync_* variables
+--echo #
+
+--let var = rpl_semi_sync_slave_enabled
+--let grant = REPLICATION SLAVE ADMIN
+--let value = 1
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/rpl_semi_sync_slave_kill_conn_timeout_grant.test b/mysql-test/suite/sys_vars/t/rpl_semi_sync_slave_kill_conn_timeout_grant.test
new file mode 100644
index 00000000..ccbd2d96
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/rpl_semi_sync_slave_kill_conn_timeout_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21967 Bind REPLICATION {MASTER|SLAVE} ADMIN to rpl_semi_sync_* variables
+--echo #
+
+--let var = rpl_semi_sync_slave_kill_conn_timeout
+--let grant = REPLICATION SLAVE ADMIN
+--let value = 1
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/rpl_semi_sync_slave_trace_level_basic.test b/mysql-test/suite/sys_vars/t/rpl_semi_sync_slave_trace_level_basic.test
new file mode 100644
index 00000000..74b6ac0a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/rpl_semi_sync_slave_trace_level_basic.test
@@ -0,0 +1,57 @@
+
+#
+# exists as a global only
+#
+# 2010-01-21 OBN - Added
+#
+source include/not_embedded.inc;
+select @@global.rpl_semi_sync_slave_trace_level;
+SET @start_global_value = @@global.rpl_semi_sync_slave_trace_level;
+
+select @@global.rpl_semi_sync_slave_trace_level in (1,16,32,64);
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.rpl_semi_sync_slave_trace_level;
+show global variables like 'rpl_semi_sync_slave_trace_level';
+show session variables like 'rpl_semi_sync_slave_trace_level';
+select * from information_schema.global_variables where variable_name='rpl_semi_sync_slave_trace_level';
+select * from information_schema.session_variables where variable_name='rpl_semi_sync_slave_trace_level';
+
+#
+# show that it's writable
+#
+set global rpl_semi_sync_slave_trace_level=16;
+--error ER_GLOBAL_VARIABLE
+set session rpl_semi_sync_slave_trace_level=99;
+select @@global.rpl_semi_sync_slave_trace_level;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.rpl_semi_sync_slave_trace_level;
+show global variables like 'rpl_semi_sync_slave_trace_level';
+show session variables like 'rpl_semi_sync_slave_trace_level';
+select * from information_schema.global_variables where variable_name='rpl_semi_sync_slave_trace_level';
+select * from information_schema.session_variables where variable_name='rpl_semi_sync_slave_trace_level';
+
+--echo NOTE: Value can also be set to values that are combinations of values
+set global rpl_semi_sync_slave_trace_level=42;
+select @@global.rpl_semi_sync_slave_trace_level;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.rpl_semi_sync_slave_trace_level;
+show global variables like 'rpl_semi_sync_slave_trace_level';
+show session variables like 'rpl_semi_sync_slave_trace_level';
+select * from information_schema.global_variables where variable_name='rpl_semi_sync_slave_trace_level';
+select * from information_schema.session_variables where variable_name='rpl_semi_sync_slave_trace_level';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global rpl_semi_sync_slave_trace_level=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global rpl_semi_sync_slave_trace_level=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global rpl_semi_sync_slave_trace_level="some text";
+
+#
+# Cleanup
+#
+SET @@global.rpl_semi_sync_slave_trace_level = @start_global_value;
+select @@global.rpl_semi_sync_slave_trace_level;
diff --git a/mysql-test/suite/sys_vars/t/rpl_semi_sync_slave_trace_level_grant.test b/mysql-test/suite/sys_vars/t/rpl_semi_sync_slave_trace_level_grant.test
new file mode 100644
index 00000000..0314dd1a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/rpl_semi_sync_slave_trace_level_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21967 Bind REPLICATION {MASTER|SLAVE} ADMIN to rpl_semi_sync_* variables
+--echo #
+
+--let var = rpl_semi_sync_slave_trace_level
+--let grant = REPLICATION SLAVE ADMIN
+--let value = 64
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/secure_auth_basic.test b/mysql-test/suite/sys_vars/t/secure_auth_basic.test
new file mode 100644
index 00000000..4e4566ce
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/secure_auth_basic.test
@@ -0,0 +1,170 @@
+################ mysql-test\t\secure_auth_basic.test ##########################
+# #
+# Variable Name: secure_auth #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: boolean #
+# Default Value: FALSE #
+# Valid Values: TRUE, FALSE #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable secure_auth #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF secure_auth TESTS #
+########################################################################
+
+
+###############################################################################
+# Saving initial value of secure_auth in a temporary variable #
+###############################################################################
+
+SET @global_start_value = @@global.secure_auth;
+SELECT @global_start_value;
+
+--echo '#--------------------FN_DYNVARS_143_01------------------------#'
+########################################################################
+# Display the DEFAULT value of secure_auth #
+########################################################################
+
+SET @@global.secure_auth = 1;
+SET @@global.secure_auth = DEFAULT;
+SELECT @@global.secure_auth;
+
+--echo '#---------------------FN_DYNVARS_143_02-------------------------#'
+#############################################################################
+# Check if secure_auth can be accessed with and without @@ sign #
+#############################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET secure_auth = 1;
+SELECT @@secure_auth;
+--Error ER_UNKNOWN_TABLE
+SELECT global.secure_auth;
+
+SET global secure_auth = 1;
+SELECT @@global.secure_auth;
+
+
+--echo '#--------------------FN_DYNVARS_143_03------------------------#'
+########################################################################
+# Change the value of secure_auth to a valid value #
+########################################################################
+
+SET @@global.secure_auth = 0;
+SELECT @@global.secure_auth;
+SET @@global.secure_auth = 1;
+SELECT @@global.secure_auth;
+
+
+--echo '#--------------------FN_DYNVARS_143_04-------------------------#'
+###########################################################################
+# Change the value of secure_auth to invalid value #
+###########################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.secure_auth = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.secure_auth = 2;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.secure_auth = "T";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.secure_auth = "Y";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.secure_auth = YES;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.secure_auth = ONN;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.secure_auth = OOF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.secure_auth = 0FF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.secure_auth = ' 1';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.secure_auth = NO;
+
+
+--echo '#-------------------FN_DYNVARS_143_05----------------------------#'
+###########################################################################
+# Test if accessing session secure_auth gives error #
+###########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.secure_auth = 0;
+--Error ER_GLOBAL_VARIABLE
+SET @@secure_auth = 0;
+--Error ER_GLOBAL_VARIABLE
+SET @@local.secure_auth = 0;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.secure_auth;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@local.secure_auth;
+
+--echo '#----------------------FN_DYNVARS_143_06------------------------#'
+#########################################################################
+# Check if the value in SESSION Table contains variable value #
+#########################################################################
+
+SELECT count(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='secure_auth';
+
+
+--echo '#----------------------FN_DYNVARS_143_07------------------------#'
+########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+########################################################################
+
+SELECT IF(@@global.secure_auth, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='secure_auth';
+SELECT @@global.secure_auth;
+SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='secure_auth';
+
+--echo '#---------------------FN_DYNVARS_143_08-------------------------#'
+###################################################################
+# Check if ON and OFF values can be used on variable #
+###################################################################
+
+SET @@global.secure_auth = OFF;
+SELECT @@global.secure_auth;
+SET @@global.secure_auth = ON;
+SELECT @@global.secure_auth;
+
+--echo '#---------------------FN_DYNVARS_143_09----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.secure_auth = TRUE;
+SELECT @@global.secure_auth;
+SET @@global.secure_auth = FALSE;
+SELECT @@global.secure_auth;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.secure_auth = @global_start_value;
+SELECT @@global.secure_auth;
+
+###############################################################
+# END OF secure_auth TESTS #
+###############################################################
diff --git a/mysql-test/suite/sys_vars/t/secure_auth_func-master.opt b/mysql-test/suite/sys_vars/t/secure_auth_func-master.opt
new file mode 100644
index 00000000..38ba956d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/secure_auth_func-master.opt
@@ -0,0 +1,2 @@
+--secure-auth
+
diff --git a/mysql-test/suite/sys_vars/t/secure_auth_func.test b/mysql-test/suite/sys_vars/t/secure_auth_func.test
new file mode 100644
index 00000000..905164ba
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/secure_auth_func.test
@@ -0,0 +1,121 @@
+############# mysql-test\t\secure_auth_func.test ##########################
+# #
+# Variable Name: secure_auth #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: boolean #
+# Default Value: FALSE #
+# Values: TRUE / 1, FALSE / 0 #
+# #
+# #
+# Creation Date: 2008-02-22 #
+# Author: Sharique Abdullah #
+# #
+# Description: Test Cases of Dynamic System Variable "secure_auth " #
+# that checks behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Cache behaviors #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_secure_auth #
+# #
+###########################################################################
+
+--echo ** Setup **
+--echo
+#
+# Setup
+#
+
+--source include/not_embedded.inc
+
+#
+# Save initial value
+#
+
+SET @old_secure_auth = @@GLOBAL.secure_auth;
+
+--echo '#--------------------FN_DYNVARS_144_01-------------------------#'
+#
+# Testing command line option value
+#
+
+SELECT @@GLOBAL.secure_auth;
+--echo 1 / ON Expected
+
+--echo '#--------------------FN_DYNVARS_144_02-------------------------#'
+#
+# Value OFF
+#
+SET GLOBAL secure_auth = OFF;
+
+#
+# Creating user with password in NEW format
+#
+CREATE USER 'testUser'@'localhost' IDENTIFIED BY 'newpass';
+
+connect (con_user1,localhost,testUser,newpass,);
+
+connection default;
+
+#
+# Setting password in OLD format
+#
+SET PASSWORD FOR 'testUser'@'localhost' = OLD_PASSWORD('newpass');
+
+connect (con_user2,localhost,testUser,newpass,);
+
+connection default;
+
+--echo '#--------------------FN_DYNVARS_144_03-------------------------#'
+#
+# Value ON
+#
+SET GLOBAL secure_auth = ON;
+
+#
+# Setting password in NEW format
+#
+SET PASSWORD FOR 'testUser'@'localhost' = PASSWORD('newpass');
+
+connect (con_user3,localhost,testUser,newpass,);
+connection default;
+
+#
+# Setting password in OLD format
+#
+SET PASSWORD FOR 'testUser'@'localhost' = OLD_PASSWORD('newpass');
+
+--disable_query_log
+--error ER_SERVER_IS_IN_SECURE_AUTH_MODE
+connect (con_user4,localhost,testUser,newpass,);
+--enable_query_log
+--echo Expected error "Server is in secure auth mode"
+
+connection default;
+
+#
+# Setting password back in NEW format
+#
+SET PASSWORD FOR 'testUser'@'localhost' = PASSWORD('newpass');
+
+connect (con_user4,localhost,testUser,newpass,);
+
+connection default;
+
+#
+# Cleanup
+#
+
+SET GLOBAL secure_auth = @old_secure_auth;
+
+disconnect con_user1;
+disconnect con_user2;
+disconnect con_user3;
+disconnect con_user4;
+
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'testUser'@'localhost';
+
+DROP USER 'testUser'@'localhost';
diff --git a/mysql-test/suite/sys_vars/t/secure_auth_grant.test b/mysql-test/suite/sys_vars/t/secure_auth_grant.test
new file mode 100644
index 00000000..f597ec79
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/secure_auth_grant.test
@@ -0,0 +1,56 @@
+--source include/not_embedded.inc
+
+SET @global=@@global.secure_auth;
+
+--echo #
+--echo # MDEV-21961 Bind CONNECTION ADMIN to a number of global system variables
+--echo #
+
+--echo # Test that "SET secure_auth" is not allowed without CONNECTION ADMIN or SUPER
+
+CREATE USER user1@localhost;
+GRANT ALL PRIVILEGES ON *.* TO user1@localhost;
+REVOKE CONNECTION ADMIN, SUPER ON *.* FROM user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+SET GLOBAL secure_auth=1;
+--error ER_GLOBAL_VARIABLE
+SET secure_auth=1;
+--error ER_GLOBAL_VARIABLE
+SET SESSION secure_auth=1;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET secure_auth" is allowed with CONNECTION ADMIN
+
+CREATE USER user1@localhost;
+GRANT CONNECTION ADMIN ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+SET GLOBAL secure_auth=1;
+--error ER_GLOBAL_VARIABLE
+SET secure_auth=1;
+--error ER_GLOBAL_VARIABLE
+SET SESSION secure_auth=1;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET secure_auth" is allowed with SUPER
+
+CREATE USER user1@localhost;
+GRANT SUPER ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+SET GLOBAL secure_auth=1;
+--error ER_GLOBAL_VARIABLE
+SET secure_auth=1;
+--error ER_GLOBAL_VARIABLE
+SET SESSION secure_auth=1;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+SET @@global.secure_auth=@global;
diff --git a/mysql-test/suite/sys_vars/t/secure_file_priv-master.opt b/mysql-test/suite/sys_vars/t/secure_file_priv-master.opt
new file mode 100644
index 00000000..b41d9b04
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/secure_file_priv-master.opt
@@ -0,0 +1 @@
+--secure_file_priv=''
diff --git a/mysql-test/suite/sys_vars/t/secure_file_priv.test b/mysql-test/suite/sys_vars/t/secure_file_priv.test
new file mode 100644
index 00000000..d9dff17b
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/secure_file_priv.test
@@ -0,0 +1,50 @@
+--echo #
+--echo # Bug50373 --secure-file-priv=""
+--echo #
+CREATE TABLE t1 (c1 VARCHAR(50));
+INSERT INTO t1 VALUES ("one"),("two"),("three"),("four"),("five");
+SHOW VARIABLES LIKE 'secure_file_priv';
+--disable_query_log
+
+# Atempt to create a file where we normally aren't allowed to create one.
+#
+# Doing this in a portable manner is difficult but we should be able to
+# count on the directory hierarchy used. A step up from MYSQLTEST_VARDIR
+# should definitely lead us to a "protected" directory,
+# but at the same time should still be writable since MTR was able
+# to create the vardir itself there.
+# If we run tests normally, it will be mysql-test directory.
+# If we run tests with --mem, it will be /dev/shm.
+# If we run tests with --parallel, it will be mysql-test/var
+# (because MYSQLTEST_VARDIR in this case is mysql-test/var/N).
+
+--perl
+use File::Basename;
+my $protected_file= dirname($ENV{MYSQLTEST_VARDIR}).'/bug50373.txt';
+# Ensure bug50373.txt does not exist (e.g. leftover from previous
+# test runs).
+unlink $protected_file;
+open(FILE, ">", "$ENV{MYSQL_TMP_DIR}/bug50373.inc") or die;
+print FILE "--disable_ps2_protocol\n";
+print FILE "SELECT * FROM t1 INTO OUTFILE '".$protected_file."';\n";
+print FILE "--enable_ps2_protocol\n";
+print FILE "DELETE FROM t1;\n";
+print FILE "LOAD DATA INFILE '".$protected_file."' INTO TABLE t1;\n";
+print FILE "SELECT * FROM t1;\n";
+print FILE "SELECT load_file('",$protected_file,"') AS loaded_file;\n";
+close(FILE);
+EOF
+
+--enable_prepare_warnings
+--source $MYSQL_TMP_DIR/bug50373.inc
+--disable_prepare_warnings
+--remove_file $MYSQL_TMP_DIR/bug50373.inc
+--enable_query_log
+
+DROP TABLE t1;
+
+--perl
+use File::Basename;
+unlink dirname($ENV{MYSQLTEST_VARDIR}).'/bug50373.txt';
+EOF
+
diff --git a/mysql-test/suite/sys_vars/t/secure_file_priv2-master.opt b/mysql-test/suite/sys_vars/t/secure_file_priv2-master.opt
new file mode 100644
index 00000000..1d9a49c8
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/secure_file_priv2-master.opt
@@ -0,0 +1 @@
+--secure_file_priv=$SECURE_LOAD_PATH
diff --git a/mysql-test/suite/sys_vars/t/secure_file_priv2.test b/mysql-test/suite/sys_vars/t/secure_file_priv2.test
new file mode 100644
index 00000000..0ca0a183
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/secure_file_priv2.test
@@ -0,0 +1,23 @@
+#
+# Bug58747 breaks secure_file_priv+not secure yet+still accesses other folders
+#
+CREATE TABLE t1 (c1 INT);
+#
+# Before the patch this statement failed with
+# Linux:
+# -> errno 13: 'Can't get stat of '
+# Windows:
+# -> Warning 1366 Incorrect integer value: '■■☺' for
+# -> column 'c1' at row 1
+# Now it should consistently fail with ER_OPTION_PREVENTS_STATEMENT
+# on all platforms.
+--error ER_OPTION_PREVENTS_STATEMENT
+LOAD DATA INFILE "t1.MYI" into table t1;
+
+#
+# The following test makes the assuption that /test isn't a valid path in any
+# operating system running the test suite.
+--error ER_OPTION_PREVENTS_STATEMENT
+LOAD DATA INFILE "/test" into table t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/sys_vars/t/secure_file_priv_basic.test b/mysql-test/suite/sys_vars/t/secure_file_priv_basic.test
new file mode 100644
index 00000000..836990cb
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/secure_file_priv_basic.test
@@ -0,0 +1,25 @@
+--source include/not_var_link.inc
+
+#
+# only global
+#
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+select @@global.secure_file_priv;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.secure_file_priv;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+show global variables like 'secure_file_priv';
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+show session variables like 'secure_file_priv';
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+select * from information_schema.global_variables where variable_name='secure_file_priv';
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+select * from information_schema.session_variables where variable_name='secure_file_priv';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global secure_file_priv=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session secure_file_priv=1;
diff --git a/mysql-test/suite/sys_vars/t/secure_timestamp_no-slave.opt b/mysql-test/suite/sys_vars/t/secure_timestamp_no-slave.opt
new file mode 100644
index 00000000..4c9000c0
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/secure_timestamp_no-slave.opt
@@ -0,0 +1 @@
+--secure-timestamp=no
diff --git a/mysql-test/suite/sys_vars/t/secure_timestamp_no.test b/mysql-test/suite/sys_vars/t/secure_timestamp_no.test
new file mode 100644
index 00000000..8871666a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/secure_timestamp_no.test
@@ -0,0 +1,4 @@
+#
+# MDEV-15923 option to control who can set session @@timestamp
+#
+source inc/secure_timestamp_func.inc;
diff --git a/mysql-test/suite/sys_vars/t/secure_timestamp_rpl-slave.opt b/mysql-test/suite/sys_vars/t/secure_timestamp_rpl-slave.opt
new file mode 100644
index 00000000..13754861
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/secure_timestamp_rpl-slave.opt
@@ -0,0 +1 @@
+--secure-timestamp=replication
diff --git a/mysql-test/suite/sys_vars/t/secure_timestamp_rpl.test b/mysql-test/suite/sys_vars/t/secure_timestamp_rpl.test
new file mode 100644
index 00000000..8871666a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/secure_timestamp_rpl.test
@@ -0,0 +1,4 @@
+#
+# MDEV-15923 option to control who can set session @@timestamp
+#
+source inc/secure_timestamp_func.inc;
diff --git a/mysql-test/suite/sys_vars/t/secure_timestamp_super-slave.opt b/mysql-test/suite/sys_vars/t/secure_timestamp_super-slave.opt
new file mode 100644
index 00000000..f747ec6c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/secure_timestamp_super-slave.opt
@@ -0,0 +1 @@
+--secure-timestamp=super
diff --git a/mysql-test/suite/sys_vars/t/secure_timestamp_super.test b/mysql-test/suite/sys_vars/t/secure_timestamp_super.test
new file mode 100644
index 00000000..8871666a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/secure_timestamp_super.test
@@ -0,0 +1,4 @@
+#
+# MDEV-15923 option to control who can set session @@timestamp
+#
+source inc/secure_timestamp_func.inc;
diff --git a/mysql-test/suite/sys_vars/t/secure_timestamp_yes-slave.opt b/mysql-test/suite/sys_vars/t/secure_timestamp_yes-slave.opt
new file mode 100644
index 00000000..a74d6895
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/secure_timestamp_yes-slave.opt
@@ -0,0 +1 @@
+--secure-timestamp=yes
diff --git a/mysql-test/suite/sys_vars/t/secure_timestamp_yes.test b/mysql-test/suite/sys_vars/t/secure_timestamp_yes.test
new file mode 100644
index 00000000..8871666a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/secure_timestamp_yes.test
@@ -0,0 +1,4 @@
+#
+# MDEV-15923 option to control who can set session @@timestamp
+#
+source inc/secure_timestamp_func.inc;
diff --git a/mysql-test/suite/sys_vars/t/server_id_basic.test b/mysql-test/suite/sys_vars/t/server_id_basic.test
new file mode 100644
index 00000000..c2dfa4c5
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/server_id_basic.test
@@ -0,0 +1,187 @@
+############## mysql-test\t\server_id_basic.test ################
+# #
+# Variable Name: server_id #
+# Scope: GLOBAL & SESSION #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 1 #
+# Range: 1 - 65536 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan Maredia #
+# #
+# Description: Test Cases of Dynamic System Variable server_id #
+# that checks the behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+################################################################################
+
+--source include/load_sysvars.inc
+
+###################################################################
+# START OF server_id TESTS #
+###################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+let $save_general_log= `SELECT @@global.general_log`;
+SET @@global.general_log= 0;
+SET @start_global_value = @@global.server_id;
+SELECT @start_global_value;
+
+--echo '#--------------------FN_DYNVARS_144_01-------------------------#'
+###################################################################
+# Display the DEFAULT value of server_id #
+###################################################################
+
+SET @@global.server_id = 500000;
+SET @@global.server_id = DEFAULT;
+SELECT @@global.server_id;
+
+--echo '#--------------------FN_DYNVARS_144_02-------------------------#'
+###################################################################
+# Check the DEFAULT value of server_id #
+###################################################################
+
+SET @@global.server_id = DEFAULT;
+SELECT @@global.server_id = 1;
+
+--echo '#--------------------FN_DYNVARS_144_03-------------------------#'
+##################################################################################
+# Change the value of server_id to a valid value for GLOBAL Scope #
+##################################################################################
+
+SET @@global.server_id = 0;
+SELECT @@global.server_id;
+SET @@global.server_id = 1;
+SELECT @@global.server_id;
+SET @@global.server_id = 15;
+SELECT @@global.server_id;
+SET @@global.server_id = 1024;
+SELECT @@global.server_id;
+SET @@global.server_id = 123456789;
+SELECT @@global.server_id;
+SET @@global.server_id = 2147483648;
+SELECT @@global.server_id;
+SET @@global.server_id = 2147483648*2-1;
+SELECT @@global.server_id;
+
+
+--echo '#--------------------FN_DYNVARS_144_04-------------------------#'
+#################################################################################
+# Check if variable can be access with session scope #
+#################################################################################
+
+SELECT @@server_id;
+SET @@server_id = 2;
+SELECT @@server_id;
+
+SET @@session.server_id = 3;
+SELECT @@server_id;
+
+SET @@local.server_id = 4;
+--Error ER_GLOBAL_VARIABLE
+
+
+
+--echo '#------------------FN_DYNVARS_144_05-----------------------#'
+####################################################################
+# Change the value of server_id to an invalid value #
+####################################################################
+
+SET @@global.server_id = -1;
+SELECT @@global.server_id;
+
+SET @@global.server_id = -2147483648;
+SELECT @@global.server_id;
+
+SET @@global.server_id = 2147483649*2;
+SELECT @@global.server_id;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.server_id = 65530.34;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.server_id = '125';
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.server_id = 7483649.56;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.server_id = 1G;
+
+--echo '#------------------FN_DYNVARS_144_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+SET @@global.server_id = 3000;
+SELECT @@global.server_id = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='server_id';
+
+
+--echo '#------------------FN_DYNVARS_144_07-----------------------#'
+###########################################################################
+# Check if the value is present in INFORMATION_SCHEMA.SESSION_VARIABLES #
+###########################################################################
+
+SELECT count(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='server_id';
+
+
+--echo '#------------------FN_DYNVARS_144_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.server_id = TRUE;
+SELECT @@global.server_id;
+SET @@global.server_id = FALSE;
+SELECT @@global.server_id;
+
+
+--echo '#---------------------FN_DYNVARS_001_09----------------------#'
+#################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+#################################################################################
+
+
+SET @@global.server_id = 512;
+SELECT @@server_id = @@global.server_id;
+
+
+--echo '#---------------------FN_DYNVARS_001_10----------------------#'
+##################################################################################
+# Check if server_id can be accessed without @@ sign and scope #
+##################################################################################
+
+SET server_id = 2048;
+--Error ER_BAD_FIELD_ERROR
+SELECT server_id;
+
+SELECT @@server_id;
+
+#verifying another another syntax for setting value
+SET global server_id = 99;
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.server_id = @start_global_value;
+SELECT @@global.server_id;
+
+eval SET @@global.general_log= $save_general_log;
+########################################################
+# END OF server_id TESTS #
+########################################################
+
diff --git a/mysql-test/suite/sys_vars/t/server_id_grant.test b/mysql-test/suite/sys_vars/t/server_id_grant.test
new file mode 100644
index 00000000..9b0072b9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/server_id_grant.test
@@ -0,0 +1,16 @@
+--echo #
+--echo # MDEV-21975 Add BINLOG REPLAY privilege and bind new privileges to gtid_seq_no, preudo_thread_id, server_id, gtid_domain_id
+--echo #
+
+--let var = server_id
+--let grant = REPLICATION MASTER ADMIN
+--let value = 1
+
+--source suite/sys_vars/inc/sysvar_global_grant_alone.inc
+
+
+--let var = server_id
+--let grant = BINLOG REPLAY
+--let value = 1
+
+--source suite/sys_vars/inc/sysvar_session_grant_alone.inc
diff --git a/mysql-test/suite/sys_vars/t/session_track_system_variables_basic.test b/mysql-test/suite/sys_vars/t/session_track_system_variables_basic.test
new file mode 100644
index 00000000..8c1d5dd6
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/session_track_system_variables_basic.test
@@ -0,0 +1,128 @@
+--source include/not_embedded.inc
+
+--echo #
+--echo # Variable name : session_track_system_variables
+--echo # Scope : Global & Session
+--echo #
+
+--echo # Global - default
+SELECT @@global.session_track_system_variables;
+--echo # Session - default
+SELECT @@session.session_track_system_variables;
+--echo
+
+--echo # via INFORMATION_SCHEMA.GLOBAL_VARIABLES
+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'session_track_system_variables' ORDER BY VARIABLE_NAME;
+
+--echo # via INFORMATION_SCHEMA.SESSION_VARIABLES
+SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE 'session_track_system_variables' ORDER BY VARIABLE_NAME;
+
+# Save the global value to be used to restore the original value.
+SET @global_saved_tmp = @@global.session_track_system_variables;
+--echo
+
+--echo # Altering global variable's value
+SET @@global.session_track_system_variables='autocommit';
+SELECT @@global.session_track_system_variables;
+SELECT @@session.session_track_system_variables;
+--echo
+
+--echo # Altering session variable's value
+SET @@session.session_track_system_variables='autocommit';
+SELECT @@global.session_track_system_variables;
+SELECT @@session.session_track_system_variables;
+--echo
+
+--echo # Variables' values in a new session.
+connect (con1,"127.0.0.1",root,,test,$MASTER_MYPORT,);
+
+--echo # Global - expect "autocommit"
+SELECT @@global.session_track_system_variables;
+--echo
+--echo # Session - expect "autocommit"
+SELECT @@session.session_track_system_variables;
+--echo
+
+--echo # Switching to the default connection.
+connection default;
+
+SELECT @@global.session_track_system_variables;
+SELECT @@session.session_track_system_variables;
+--echo
+
+--echo # Test if DEFAULT is working as expected.
+SET @@global.session_track_system_variables = DEFAULT;
+SET @@session.session_track_system_variables = DEFAULT;
+--echo
+
+SELECT @@global.session_track_system_variables;
+SELECT @@session.session_track_system_variables;
+--echo
+
+--echo # Variables' values in a new session (con2).
+connect (con2,"127.0.0.1",root,,test,$MASTER_MYPORT,);
+
+SELECT @@global.session_track_system_variables;
+SELECT @@session.session_track_system_variables;
+--echo
+
+--echo # Altering session should not affect global.
+SET @@session.session_track_system_variables = 'sql_mode';
+SELECT @@global.session_track_system_variables;
+SELECT @@session.session_track_system_variables;
+--echo
+
+--echo # Variables' values in a new session (con3).
+connect (con3,"127.0.0.1",root,,test,$MASTER_MYPORT,);
+
+--echo # Altering global should not affect session.
+SET @@global.session_track_system_variables = 'sql_mode';
+SELECT @@global.session_track_system_variables;
+SELECT @@session.session_track_system_variables;
+--echo
+
+--echo # Switching to the default connection.
+connection default;
+
+--echo # Testing NULL
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.session_track_system_variables = NULL;
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@session.session_track_system_variables = NULL;
+
+--echo # testing with duplicate entries.
+# Lets first set it to some valid value.
+SET @@global.session_track_system_variables= "time_zone";
+SET @@session.session_track_system_variables= "time_zone";
+# Now set with duplicate entries (must pass)
+SET @@global.session_track_system_variables= "sql_mode,sql_mode";
+SET @@session.session_track_system_variables= "sql_mode,sql_mode";
+SELECT @@global.session_track_system_variables;
+SELECT @@session.session_track_system_variables;
+--echo
+
+--echo # testing ordering
+SET @@global.session_track_system_variables= "time_zone,sql_mode";
+SET @@session.session_track_system_variables= "time_zone,sql_mode";
+SELECT @@global.session_track_system_variables;
+SELECT @@session.session_track_system_variables;
+--echo
+
+--echo # special values
+SET @@global.session_track_system_variables= "*";
+SET @@session.session_track_system_variables= "*";
+SELECT @@global.session_track_system_variables;
+SELECT @@session.session_track_system_variables;
+SET @@global.session_track_system_variables= "";
+SET @@session.session_track_system_variables= "";
+SELECT @@global.session_track_system_variables;
+SELECT @@session.session_track_system_variables;
+--echo
+
+--echo # MDEV-22524 SIGABRT in safe_mutex_unlock with session_track_system_variables and max_relay_log_size.
+SET SESSION session_track_system_variables="sql_slave_skip_counter", sql_slave_skip_counter= 0;
+
+--echo # Restoring the original values.
+SET @@global.session_track_system_variables = @global_saved_tmp;
+
+--echo # End of tests.
diff --git a/mysql-test/suite/sys_vars/t/show_vs_valstr.test b/mysql-test/suite/sys_vars/t/show_vs_valstr.test
new file mode 100644
index 00000000..fec5b9c6
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/show_vs_valstr.test
@@ -0,0 +1,12 @@
+# verify that show_status_array and sys_var::val_str print values identically
+
+use information_schema;
+
+select variable_name, s.variable_value, v.global_value
+ from global_variables s join system_variables v using (variable_name)
+ where not (s.variable_value <=> v.global_value);
+
+select variable_name, s.variable_value, v.session_value
+ from session_variables s join system_variables v using (variable_name)
+ where v.variable_scope != 'GLOBAL' and
+ not (s.variable_value <=> v.session_value);
diff --git a/mysql-test/suite/sys_vars/t/skip_external_locking_basic.test b/mysql-test/suite/sys_vars/t/skip_external_locking_basic.test
new file mode 100644
index 00000000..67b58ab8
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/skip_external_locking_basic.test
@@ -0,0 +1,18 @@
+#
+# only global
+#
+select @@global.skip_external_locking;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.skip_external_locking;
+show global variables like 'skip_external_locking';
+show session variables like 'skip_external_locking';
+select * from information_schema.global_variables where variable_name='skip_external_locking';
+select * from information_schema.session_variables where variable_name='skip_external_locking';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global skip_external_locking=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session skip_external_locking=1;
diff --git a/mysql-test/suite/sys_vars/t/skip_name_resolve_basic-master.opt b/mysql-test/suite/sys_vars/t/skip_name_resolve_basic-master.opt
new file mode 100644
index 00000000..ab6ca173
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/skip_name_resolve_basic-master.opt
@@ -0,0 +1 @@
+--skip-name-resolve
diff --git a/mysql-test/suite/sys_vars/t/skip_name_resolve_basic.test b/mysql-test/suite/sys_vars/t/skip_name_resolve_basic.test
new file mode 100644
index 00000000..69006a0f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/skip_name_resolve_basic.test
@@ -0,0 +1,15 @@
+SHOW VARIABLES LIKE 'skip_name_resolve';
+SHOW GLOBAL VARIABLES LIKE 'skip_name_resolve';
+SHOW SESSION VARIABLES LIKE 'skip_name_resolve';
+
+SELECT @@skip_name_resolve;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@LOCAL.skip_name_resolve;
+SELECT @@GLOBAL.skip_name_resolve;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@skip_name_resolve=0;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@LOCAL.skip_name_resolve=0;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.skip_name_resolve=0;
diff --git a/mysql-test/suite/sys_vars/t/skip_networking_basic.test b/mysql-test/suite/sys_vars/t/skip_networking_basic.test
new file mode 100644
index 00000000..09a775cc
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/skip_networking_basic.test
@@ -0,0 +1,18 @@
+#
+# only global
+#
+select @@global.skip_networking;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.skip_networking;
+show global variables like 'skip_networking';
+show session variables like 'skip_networking';
+select * from information_schema.global_variables where variable_name='skip_networking';
+select * from information_schema.session_variables where variable_name='skip_networking';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global skip_networking=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session skip_networking=1;
diff --git a/mysql-test/suite/sys_vars/t/skip_parallel_replication_basic.test b/mysql-test/suite/sys_vars/t/skip_parallel_replication_basic.test
new file mode 100644
index 00000000..3ccac558
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/skip_parallel_replication_basic.test
@@ -0,0 +1,14 @@
+--source include/not_embedded.inc
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@global.skip_parallel_replication;
+
+--error ER_LOCAL_VARIABLE
+SET GLOBAL skip_parallel_replication= 0;
+SELECT @@session.skip_parallel_replication;
+SET SESSION skip_parallel_replication= 1;
+SELECT @@session.skip_parallel_replication;
+SET SESSION skip_parallel_replication= 0;
+SELECT @@session.skip_parallel_replication;
+
+# More testing of the actual functionality in rpl.rpl_parallel_* tests.
diff --git a/mysql-test/suite/sys_vars/t/skip_replication_basic.test b/mysql-test/suite/sys_vars/t/skip_replication_basic.test
new file mode 100644
index 00000000..da1b6c5f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/skip_replication_basic.test
@@ -0,0 +1,30 @@
+# exists as a session only
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@global.skip_replication;
+
+# Check the variable has a valid numeric value (assumed to be less then 10000)
+select @@session.skip_replication between 1 and 10000;
+
+--echo should be empty
+show global variables like 'skip_replication';
+show session variables like 'skip_replication';
+
+# Global I_S variable is empty
+--echo should be empty
+select * from information_schema.global_variables where variable_name='skip_replication';
+
+# Check that I_S value is same as variable
+select @@session.skip_replication = variable_value from information_schema.session_variables where variable_name='skip_replication';
+
+#
+# show that it's writable
+#
+set session skip_replication=0;
+select @@session.skip_replication;
+set session skip_replication=1;
+select @@session.skip_replication;
+select * from information_schema.global_variables where variable_name='skip_replication';
+select variable_value from information_schema.session_variables where variable_name='skip_replication';
+--error ER_LOCAL_VARIABLE
+set global skip_replication=1;
diff --git a/mysql-test/suite/sys_vars/t/skip_show_database_basic.test b/mysql-test/suite/sys_vars/t/skip_show_database_basic.test
new file mode 100644
index 00000000..9e0fddd1
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/skip_show_database_basic.test
@@ -0,0 +1,18 @@
+#
+# only global
+#
+select @@global.skip_show_database;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.skip_show_database;
+show global variables like 'skip_show_database';
+show session variables like 'skip_show_database';
+select * from information_schema.global_variables where variable_name='skip_show_database';
+select * from information_schema.session_variables where variable_name='skip_show_database';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global skip_show_database=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session skip_show_database=1;
diff --git a/mysql-test/suite/sys_vars/t/slave_allow_batching_basic.test b/mysql-test/suite/sys_vars/t/slave_allow_batching_basic.test
new file mode 100644
index 00000000..e8b52259
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_allow_batching_basic.test
@@ -0,0 +1,165 @@
+############## mysql-test\t\slave_allow_batching_basic.test ####################
+# #
+# Variable Name: slave_allow_batching #
+# Scope: GLOBAL & SESSION #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 1 #
+# Range: 1 - 65536 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan Maredia #
+# #
+# Description: Test Cases of Dynamic System Variable slave_allow_batching #
+# that checks the behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+################################################################################
+
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF slave_allow_batching TESTS #
+########################################################################
+
+
+################################################################################
+# Saving initial value of slave_allow_batching in a temporary variable #
+################################################################################
+
+--Error ER_UNKNOWN_SYSTEM_VARIABLE
+SET @global_start_value = @@global.slave_allow_batching;
+
+--echo '#--------------------FN_DYNVARS_145_01------------------------#'
+########################################################################
+# Display the DEFAULT value of slave_allow_batching #
+########################################################################
+
+#SET @@global.slave_allow_batching = 1;
+#SET @@global.slave_allow_batching = DEFAULT;
+#SELECT @@global.slave_allow_batching;
+
+--echo '#---------------------FN_DYNVARS_145_02-------------------------#'
+#############################################################################
+# Check if slave_allow_batching can be accessed with and without @@ sign #
+#############################################################################
+
+#--Error ER_GLOBAL_VARIABLE
+#SET slave_allow_batching = 1;
+#SELECT @@slave_allow_batching;
+#--Error ER_UNKNOWN_TABLE
+#SELECT global.slave_allow_batching;
+#
+#SET global slave_allow_batching = 1;
+#SELECT @@global.slave_allow_batching;
+
+
+--echo '#--------------------FN_DYNVARS_145_03------------------------#'
+########################################################################
+# Change the value of slave_allow_batching to a valid value #
+########################################################################
+
+#SET @@global.slave_allow_batching = 0;
+#SELECT @@global.slave_allow_batching;
+#SET @@global.slave_allow_batching = 1;
+#SELECT @@global.slave_allow_batching;
+
+
+--echo '#--------------------FN_DYNVARS_145_04-------------------------#'
+###########################################################################
+# Change the value of slave_allow_batching to invalid value #
+###########################################################################
+
+#--Error ER_WRONG_VALUE_FOR_VAR
+#SET @@global.slave_allow_batching = -1;
+#--Error ER_WRONG_VALUE_FOR_VAR
+#SET @@global.slave_allow_batching = 2;
+#--Error ER_WRONG_VALUE_FOR_VAR
+#SET @@global.slave_allow_batching = "T";
+#--Error ER_WRONG_VALUE_FOR_VAR
+#SET @@global.slave_allow_batching = "Y";
+#--Error ER_WRONG_VALUE_FOR_VAR
+#SET @@global.slave_allow_batching = YES;
+#--Error ER_WRONG_VALUE_FOR_VAR
+#SET @@global.slave_allow_batching = ONN;
+#--Error ER_WRONG_VALUE_FOR_VAR
+#SET @@global.slave_allow_batching = OOF;
+#--Error ER_WRONG_VALUE_FOR_VAR
+#SET @@global.slave_allow_batching = 0FF;
+#--Error ER_WRONG_VALUE_FOR_VAR
+#SET @@global.slave_allow_batching = ' 1';
+#--Error ER_WRONG_VALUE_FOR_VAR
+#SET @@global.slave_allow_batching = NO;
+
+
+--echo '#-------------------FN_DYNVARS_145_05----------------------------#'
+###########################################################################
+# Test if accessing session slave_allow_batching gives error #
+###########################################################################
+
+#--Error ER_GLOBAL_VARIABLE
+#SET @@session.slave_allow_batching = 0;
+#--Error ER_GLOBAL_VARIABLE
+#SET @@slave_allow_batching = 0;
+#--Error ER_GLOBAL_VARIABLE
+#SET @@local.slave_allow_batching = 0;
+#--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+#SELECT @@session.slave_allow_batching;
+#--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+#SELECT @@local.slave_allow_batching;
+
+--echo '#----------------------FN_DYNVARS_145_06------------------------#'
+#########################################################################
+# Check if the value in SESSION Table contains variable value #
+#########################################################################
+
+#SELECT count(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='slave_allow_batching';
+
+
+--echo '#----------------------FN_DYNVARS_145_07------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#########################################################################
+
+#SELECT IF(@@global.slave_allow_batching, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='slave_allow_batching';
+#SELECT @@global.slave_allow_batching;
+#SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='slave_allow_batching';
+#--echo 'Bug: value in information schema does not match'
+
+--echo '#---------------------FN_DYNVARS_145_08-------------------------#'
+###################################################################
+# Check if ON and OFF values can be used on variable #
+###################################################################
+
+#SET @@global.slave_allow_batching = OFF;
+#SELECT @@global.slave_allow_batching;
+#SET @@global.slave_allow_batching = ON;
+#SELECT @@global.slave_allow_batching;
+
+--echo '#---------------------FN_DYNVARS_145_09----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+#SET @@global.slave_allow_batching = TRUE;
+#SELECT @@global.slave_allow_batching;
+#SET @@global.slave_allow_batching = FALSE;
+#SELECT @@global.slave_allow_batching;
+
+##############################
+# Restore initial value #
+##############################
+
+#SET @@global.slave_allow_batching = @global_start_value;
+#SELECT @@global.slave_allow_batching;
+
+###############################################################
+# END OF slave_allow_batching TESTS #
+###############################################################
diff --git a/mysql-test/suite/sys_vars/t/slave_compressed_protocol_basic.test b/mysql-test/suite/sys_vars/t/slave_compressed_protocol_basic.test
new file mode 100644
index 00000000..25ac8f35
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_compressed_protocol_basic.test
@@ -0,0 +1,167 @@
+############# mysql-test\t\slave_compressed_protocol_basic.test ###############
+# #
+# Variable Name: slave_compressed_protocol #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: boolean #
+# Default Value: FALSE #
+# Range: TRUE, FALSE #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable slave_compressed_protocol#
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/not_embedded.inc
+--source include/load_sysvars.inc
+########################################################################
+# START OF slave_compressed_protocol TESTS #
+########################################################################
+
+
+##############################################################################
+# Saving initial value of slave_compressed_protocol in a temporary variable #
+##############################################################################
+
+SET @global_start_value = @@global.slave_compressed_protocol;
+SELECT @global_start_value;
+
+--echo '#--------------------FN_DYNVARS_147_01------------------------#'
+########################################################################
+# Display the DEFAULT value of slave_compressed_protocol #
+########################################################################
+
+SET @@global.slave_compressed_protocol = 1;
+SET @@global.slave_compressed_protocol = DEFAULT;
+SELECT @@global.slave_compressed_protocol;
+
+--echo '#---------------------FN_DYNVARS_147_02-------------------------#'
+###############################################################################
+# Check if slave_compressed_protocol can be accessed with and without @@ sign #
+###############################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET slave_compressed_protocol = 1;
+SELECT @@slave_compressed_protocol;
+--Error ER_UNKNOWN_TABLE
+SELECT global.slave_compressed_protocol;
+
+SET global slave_compressed_protocol = 1;
+SELECT @@global.slave_compressed_protocol;
+
+
+--echo '#--------------------FN_DYNVARS_147_03------------------------#'
+########################################################################
+# Change the value of slave_compressed_protocol to a valid value #
+########################################################################
+
+SET @@global.slave_compressed_protocol = 0;
+SELECT @@global.slave_compressed_protocol;
+SET @@global.slave_compressed_protocol = 1;
+SELECT @@global.slave_compressed_protocol;
+
+
+--echo '#--------------------FN_DYNVARS_147_04-------------------------#'
+###########################################################################
+# Change the value of slave_compressed_protocol to invalid value #
+###########################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.slave_compressed_protocol = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.slave_compressed_protocol = 2;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.slave_compressed_protocol = "1.00";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.slave_compressed_protocol = "Y";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.slave_compressed_protocol = YES;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.slave_compressed_protocol = ONN;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.slave_compressed_protocol = 0FF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.slave_compressed_protocol = ' 1';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.slave_compressed_protocol = NO;
+
+
+--echo '#-------------------FN_DYNVARS_147_05----------------------------#'
+###########################################################################
+# Test if accessing session slave_compressed_protocol gives error #
+###########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.slave_compressed_protocol = 0;
+--Error ER_GLOBAL_VARIABLE
+SET @@slave_compressed_protocol = 0;
+--Error ER_GLOBAL_VARIABLE
+SET @@local.slave_compressed_protocol = 0;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.slave_compressed_protocol;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@local.slave_compressed_protocol;
+
+--echo '#----------------------FN_DYNVARS_147_06------------------------#'
+#########################################################################
+# Check if the value in SESSION Table contains variable value #
+#########################################################################
+
+SELECT count(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='slave_compressed_protocol';
+
+--echo '#----------------------FN_DYNVARS_147_07------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#########################################################################
+
+SELECT IF(@@global.slave_compressed_protocol, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='slave_compressed_protocol';
+SELECT @@global.slave_compressed_protocol;
+SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='slave_compressed_protocol';
+
+--echo '#---------------------FN_DYNVARS_147_08-------------------------#'
+###################################################################
+# Check if ON and OFF values can be used on variable #
+###################################################################
+
+SET @@global.slave_compressed_protocol = OFF;
+SELECT @@global.slave_compressed_protocol;
+SET @@global.slave_compressed_protocol = ON;
+SELECT @@global.slave_compressed_protocol;
+
+--echo '#---------------------FN_DYNVARS_147_09----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.slave_compressed_protocol = TRUE;
+SELECT @@global.slave_compressed_protocol;
+SET @@global.slave_compressed_protocol = FALSE;
+SELECT @@global.slave_compressed_protocol;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.slave_compressed_protocol = @global_start_value;
+SELECT @@global.slave_compressed_protocol;
+
+###############################################################
+# END OF slave_compressed_protocol TESTS #
+###############################################################
diff --git a/mysql-test/suite/sys_vars/t/slave_compressed_protocol_grant.test b/mysql-test/suite/sys_vars/t/slave_compressed_protocol_grant.test
new file mode 100644
index 00000000..2db1a0f4
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_compressed_protocol_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21966 Bind REPLICATION SLAVE ADMIN to a number of global system variables
+--echo #
+
+--let var = slave_compressed_protocol
+--let grant = REPLICATION SLAVE ADMIN
+--let value = 1
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/slave_ddl_exec_mode_basic.test b/mysql-test/suite/sys_vars/t/slave_ddl_exec_mode_basic.test
new file mode 100644
index 00000000..64f8a75f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_ddl_exec_mode_basic.test
@@ -0,0 +1,67 @@
+############## mysql-test\t\slave_ddl_exec_mode_basic.test ####################
+# #
+# Variable Name: slave_ddl_exec_mode #
+# Scope: GLOBAL & SESSION #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 1 #
+# Range: 1 - 65536 #
+# #
+# #
+# Description: Test Cases of Dynamic System Variable slave_ddl_exec_mode #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+###############################################################################
+
+--source include/not_embedded.inc
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF slave_ddl_exec_mode TESTS #
+########################################################################
+
+SET @start_value = @@global.slave_ddl_exec_mode;
+
+SELECT @@global.slave_ddl_exec_mode;
+
+SELECT @@slave_ddl_exec_mode = @@GLOBAL.slave_ddl_exec_mode;
+--echo 1 Expected
+
+SELECT COUNT(@@slave_ddl_exec_mode);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.slave_ddl_exec_mode);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.slave_ddl_exec_mode);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.slave_ddl_exec_mode);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT slave_ddl_exec_mode = @@SESSION.version;
+--echo Expected error 'Readonly variable'
+
+
+SET @@GLOBAL.slave_ddl_exec_mode=STRICT;
+SELECT @@GLOBAL.slave_ddl_exec_mode;
+
+SET @@GLOBAL.slave_ddl_exec_mode=IDEMPOTENT;
+SELECT @@GLOBAL.slave_ddl_exec_mode;
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@GLOBAL.slave_ddl_exec_mode=XXX;
+SELECT @@GLOBAL.slave_ddl_exec_mode;
+
+SET @@global.slave_ddl_exec_mode= @start_value;
+
+########################################################################
+# END OF slave_ddl_exec_mode TESTS #
+########################################################################
diff --git a/mysql-test/suite/sys_vars/t/slave_ddl_exec_mode_grant.test b/mysql-test/suite/sys_vars/t/slave_ddl_exec_mode_grant.test
new file mode 100644
index 00000000..b6cee5ce
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_ddl_exec_mode_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21966 Bind REPLICATION SLAVE ADMIN to a number of global system variables
+--echo #
+
+--let var = slave_ddl_exec_mode
+--let grant = REPLICATION SLAVE ADMIN
+--let value = STRICT
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/slave_domain_parallel_threads_basic.test b/mysql-test/suite/sys_vars/t/slave_domain_parallel_threads_basic.test
new file mode 100644
index 00000000..7be48fbd
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_domain_parallel_threads_basic.test
@@ -0,0 +1,14 @@
+--source include/not_embedded.inc
+
+SET @save_slave_domain_parallel_threads= @@GLOBAL.slave_domain_parallel_threads;
+
+SELECT @@GLOBAL.slave_domain_parallel_threads as 'must be zero because of default';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@SESSION.slave_domain_parallel_threads as 'no session var';
+
+SET GLOBAL slave_domain_parallel_threads= 0;
+SET GLOBAL slave_domain_parallel_threads= DEFAULT;
+SET GLOBAL slave_domain_parallel_threads= 10;
+SELECT @@GLOBAL.slave_domain_parallel_threads;
+
+SET GLOBAL slave_domain_parallel_threads = @save_slave_domain_parallel_threads;
diff --git a/mysql-test/suite/sys_vars/t/slave_domain_parallel_threads_grant.test b/mysql-test/suite/sys_vars/t/slave_domain_parallel_threads_grant.test
new file mode 100644
index 00000000..138a8bfa
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_domain_parallel_threads_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21966 Bind REPLICATION SLAVE ADMIN to a number of global system variables
+--echo #
+
+--let var = slave_domain_parallel_threads
+--let grant = REPLICATION SLAVE ADMIN
+--let value = 0
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/slave_exec_mode_basic.test b/mysql-test/suite/sys_vars/t/slave_exec_mode_basic.test
new file mode 100644
index 00000000..503fb382
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_exec_mode_basic.test
@@ -0,0 +1,42 @@
+############## mysql-test\t\slave_exec_mode_basic.test #########################
+# #
+# Variable Name: slave_exec_mode #
+# Scope: GLOBAL & SESSION #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 1 #
+# Range: 1 - 65536 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan Maredia #
+# #
+# Description: Test Cases of Dynamic System Variable slave_exec_mode #
+# that checks the behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+################################################################################
+
+--source include/not_embedded.inc
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF slave_exec_mode TESTS #
+########################################################################
+
+
+########################################################################
+# Saving initial value of slave_exec_mode in a temporary variable #
+########################################################################
+SET @start_value = @@global.slave_exec_mode;
+--echo 'This variable is not supported in version 5.1.22. It is introduced in 5.1.24'
+
+########################################################################
+# END OF slave_exec_mode TESTS #
+########################################################################
diff --git a/mysql-test/suite/sys_vars/t/slave_exec_mode_grant.test b/mysql-test/suite/sys_vars/t/slave_exec_mode_grant.test
new file mode 100644
index 00000000..47634ea3
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_exec_mode_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21966 Bind REPLICATION SLAVE ADMIN to a number of global system variables
+--echo #
+
+--let var = slave_exec_mode
+--let grant = REPLICATION SLAVE ADMIN
+--let value = STRICT
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/slave_load_tmpdir_basic.test b/mysql-test/suite/sys_vars/t/slave_load_tmpdir_basic.test
new file mode 100644
index 00000000..4121c881
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_load_tmpdir_basic.test
@@ -0,0 +1,24 @@
+--source include/not_embedded.inc
+#
+# only global
+#
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+select @@global.slave_load_tmpdir;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.slave_load_tmpdir;
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+show global variables like 'slave_load_tmpdir';
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+show session variables like 'slave_load_tmpdir';
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+select * from information_schema.global_variables where variable_name='slave_load_tmpdir';
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+select * from information_schema.session_variables where variable_name='slave_load_tmpdir';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global slave_load_tmpdir=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session slave_load_tmpdir=1;
diff --git a/mysql-test/suite/sys_vars/t/slave_max_allowed_packet_basic.test b/mysql-test/suite/sys_vars/t/slave_max_allowed_packet_basic.test
new file mode 100644
index 00000000..821c1855
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_max_allowed_packet_basic.test
@@ -0,0 +1,173 @@
+############## mysql-test\t\slave_max_allowed_packet_basic.test ##################
+# #
+# Variable Name: slave_max_allowed_packet #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value:1073741824 #
+# Range: 1024 - 1073741824 #
+# #
+# #
+# #
+# Description: Test Cases of Dynamic System Variable slave_max_allowed_packet #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF slave_max_allowed_packet TESTS #
+########################################################################
+
+
+###########################################################################
+# Saving initial value of slave_max_allowed_packet in a temporary variable#
+###########################################################################
+
+SET @start_value = @@global.slave_max_allowed_packet;
+SELECT @start_value;
+
+
+--echo '#--------------------FN_DYNVARS_072_01------------------------#'
+########################################################################
+# Display the DEFAULT value of slave_max_allowed_packet #
+########################################################################
+
+SET @@global.slave_max_allowed_packet = 5000;
+SET @@global.slave_max_allowed_packet = DEFAULT;
+SELECT @@global.slave_max_allowed_packet;
+
+
+--echo '#---------------------FN_DYNVARS_072_02-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@global.slave_max_allowed_packet = @start_value;
+SELECT @@global.slave_max_allowed_packet = 1073741824;
+--echo 'Bug# 34876: Incorrect Default Value is assigned to variable';
+
+--echo '#--------------------FN_DYNVARS_072_03------------------------#'
+########################################################################
+# Change the value of slave_max_allowed_packet to a valid value #
+########################################################################
+
+SET @@global.slave_max_allowed_packet = 1024;
+SELECT @@global.slave_max_allowed_packet;
+SET @@global.slave_max_allowed_packet = 1073741824;
+SELECT @@global.slave_max_allowed_packet;
+SET @@global.slave_max_allowed_packet = 1073741824;
+SELECT @@global.slave_max_allowed_packet;
+SET @@global.slave_max_allowed_packet = 1025;
+SELECT @@global.slave_max_allowed_packet;
+SET @@global.slave_max_allowed_packet = 65535;
+SELECT @@global.slave_max_allowed_packet;
+--echo 'Bug# 34877: Invalid Values are coming in variable on assigning valid values';
+
+
+--echo '#--------------------FN_DYNVARS_072_04-------------------------#'
+###########################################################################
+# Change the value of slave_max_allowed_packet to invalid value #
+###########################################################################
+
+SET @@global.slave_max_allowed_packet = -1;
+SELECT @@global.slave_max_allowed_packet;
+SET @@global.slave_max_allowed_packet = 100000000000;
+SELECT @@global.slave_max_allowed_packet;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.slave_max_allowed_packet = 10000.01;
+SELECT @@global.slave_max_allowed_packet;
+SET @@global.slave_max_allowed_packet = -1024;
+SELECT @@global.slave_max_allowed_packet;
+SET @@global.slave_max_allowed_packet = 4294967296;
+SELECT @@global.slave_max_allowed_packet;
+SET @@global.slave_max_allowed_packet = 1023;
+SELECT @@global.slave_max_allowed_packet;
+
+--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable';
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.slave_max_allowed_packet = ON;
+SELECT @@global.slave_max_allowed_packet;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.slave_max_allowed_packet = 'test';
+SELECT @@global.slave_max_allowed_packet;
+
+
+--echo '#-------------------FN_DYNVARS_072_05----------------------------#'
+###########################################################################
+# Test if accessing session slave_max_allowed_packet gives error #
+###########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.slave_max_allowed_packet = 4096;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.slave_max_allowed_packet;
+
+
+--echo '#----------------------FN_DYNVARS_072_06------------------------#'
+##############################################################################
+# Check if the value in GLOBAL & SESSION Tables matches values in variable #
+##############################################################################
+
+SELECT @@global.slave_max_allowed_packet = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='slave_max_allowed_packet';
+
+SELECT @@slave_max_allowed_packet = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='slave_max_allowed_packet';
+
+
+--echo '#---------------------FN_DYNVARS_072_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.slave_max_allowed_packet = TRUE;
+SELECT @@global.slave_max_allowed_packet;
+SET @@global.slave_max_allowed_packet = FALSE;
+SELECT @@global.slave_max_allowed_packet;
+
+
+--echo '#---------------------FN_DYNVARS_072_08----------------------#'
+########################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
+########################################################################################################
+
+SET @@global.slave_max_allowed_packet = 5000;
+SELECT @@slave_max_allowed_packet = @@global.slave_max_allowed_packet;
+
+
+--echo '#---------------------FN_DYNVARS_072_09----------------------#'
+################################################################################
+# Check if slave_max_allowed_packet can be accessed with and without @@ sign #
+################################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET slave_max_allowed_packet = 6000;
+SELECT @@slave_max_allowed_packet;
+--Error ER_UNKNOWN_TABLE
+SELECT local.slave_max_allowed_packet;
+--Error ER_UNKNOWN_TABLE
+SELECT global.slave_max_allowed_packet;
+--Error ER_BAD_FIELD_ERROR
+SELECT slave_max_allowed_packet = @@session.slave_max_allowed_packet;
+
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.slave_max_allowed_packet = @start_value;
+SELECT @@global.slave_max_allowed_packet;
+
+
+########################################################################
+# END OF slave_max_allowed_packet TESTS #
+########################################################################
diff --git a/mysql-test/suite/sys_vars/t/slave_max_allowed_packet_grant.test b/mysql-test/suite/sys_vars/t/slave_max_allowed_packet_grant.test
new file mode 100644
index 00000000..2a873f11
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_max_allowed_packet_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21966 Bind REPLICATION SLAVE ADMIN to a number of global system variables
+--echo #
+
+--let var = slave_max_allowed_packet
+--let grant = REPLICATION SLAVE ADMIN
+--let value = 65536
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/slave_net_timeout_basic.test b/mysql-test/suite/sys_vars/t/slave_net_timeout_basic.test
new file mode 100644
index 00000000..f534bd2f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_net_timeout_basic.test
@@ -0,0 +1,184 @@
+################## mysql-test\t\slave_net_timeout_basic.test ##################
+# #
+# Variable Name: slave_net_timeout #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 3600 #
+# Range: #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable slave_net_timeout #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/not_embedded.inc
+--source include/load_sysvars.inc
+###########################################################
+# START OF slave_net_timeout TESTS #
+###########################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.slave_net_timeout;
+SELECT @start_global_value;
+
+--echo '#--------------------FN_DYNVARS_146_01-------------------------#'
+###########################################################
+# Display the DEFAULT value of slave_net_timeout #
+###########################################################
+
+SET @@global.slave_net_timeout = 500000;
+SET @@global.slave_net_timeout = DEFAULT;
+SELECT @@global.slave_net_timeout;
+
+--echo '#--------------------FN_DYNVARS_146_02-------------------------#'
+############################################################
+# Check the DEFAULT value of slave_net_timeout #
+############################################################
+
+SET @@global.slave_net_timeout = DEFAULT;
+SELECT @@global.slave_net_timeout = 3600;
+
+--echo '#--------------------FN_DYNVARS_146_03-------------------------#'
+###########################################################################
+# Change the value of slave_net_timeout to a valid value for GLOBAL Scope #
+###########################################################################
+
+SET @@global.slave_net_timeout = 0;
+SELECT @@global.slave_net_timeout;
+SET @@global.slave_net_timeout = 1;
+SELECT @@global.slave_net_timeout;
+SET @@global.slave_net_timeout = 15;
+SELECT @@global.slave_net_timeout;
+SET @@global.slave_net_timeout = 1024;
+SELECT @@global.slave_net_timeout;
+SET @@global.slave_net_timeout = 3600+1;
+SELECT @@global.slave_net_timeout;
+SET @@global.slave_net_timeout = 2147483648;
+SELECT @@global.slave_net_timeout;
+SET @@global.slave_net_timeout = 2147483648*2-1;
+SELECT @@global.slave_net_timeout;
+
+
+--echo '#--------------------FN_DYNVARS_146_04-------------------------#'
+###############################################################################
+# Check if variable can be access with session scope #
+###############################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@slave_net_timeout = 2;
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.slave_net_timeout = 3;
+
+--Error ER_GLOBAL_VARIABLE
+SET @@local.slave_net_timeout = 4;
+
+
+
+--echo '#------------------FN_DYNVARS_146_05-----------------------#'
+#############################################################
+# Change the value of slave_net_timeout to an invalid value #
+#############################################################
+
+SET @@global.slave_net_timeout = -1;
+SELECT @@global.slave_net_timeout;
+
+SET @@global.slave_net_timeout = -2147483648;
+SELECT @@global.slave_net_timeout;
+
+SET @@global.slave_net_timeout = 2147483649*2;
+SELECT @@global.slave_net_timeout;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.slave_net_timeout = 65530.34;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.slave_net_timeout = 100s;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.slave_net_timeout = 7483649.56;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.slave_net_timeout = 0.6;
+
+--echo '#------------------FN_DYNVARS_146_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+SET @@global.slave_net_timeout = 3000;
+SELECT @@global.slave_net_timeout = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='slave_net_timeout';
+
+
+--echo '#------------------FN_DYNVARS_146_07-----------------------#'
+###########################################################################
+# Check if the value is present in INFORMATION_SCHEMA.SESSION_VARIABLES #
+###########################################################################
+
+SELECT count(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='slave_net_timeout';
+
+
+--echo '#------------------FN_DYNVARS_146_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.slave_net_timeout = TRUE;
+SELECT @@global.slave_net_timeout;
+SET @@global.slave_net_timeout = FALSE;
+SELECT @@global.slave_net_timeout;
+
+
+--echo '#---------------------FN_DYNVARS_001_09----------------------#'
+###############################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+###############################################################################
+
+
+SET @@global.slave_net_timeout = 60*60;
+SELECT @@slave_net_timeout = @@global.slave_net_timeout;
+
+
+--echo '#---------------------FN_DYNVARS_001_10----------------------#'
+##########################################################################
+# Check if slave_net_timeout can be accessed without @@ sign and scope #
+##########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET slave_net_timeout = 2048;
+--Error ER_BAD_FIELD_ERROR
+SELECT slave_net_timeout;
+
+SELECT @@slave_net_timeout;
+
+#verifying another another syntax for setting value
+SET global slave_net_timeout = 99;
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.slave_net_timeout = @start_global_value;
+SELECT @@global.slave_net_timeout;
+
+################################################
+# END OF slave_net_timeout TESTS #
+################################################
+
diff --git a/mysql-test/suite/sys_vars/t/slave_net_timeout_grant.test b/mysql-test/suite/sys_vars/t/slave_net_timeout_grant.test
new file mode 100644
index 00000000..3cb6f9a9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_net_timeout_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21966 Bind REPLICATION SLAVE ADMIN to a number of global system variables
+--echo #
+
+--let var = slave_net_timeout
+--let grant = REPLICATION SLAVE ADMIN
+--let value = 60
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/slave_parallel_max_queued_basic.test b/mysql-test/suite/sys_vars/t/slave_parallel_max_queued_basic.test
new file mode 100644
index 00000000..e3d3a936
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_parallel_max_queued_basic.test
@@ -0,0 +1,14 @@
+--source include/not_embedded.inc
+
+SET @save_slave_parallel_max_queued= @@GLOBAL.slave_parallel_max_queued;
+
+SELECT @@GLOBAL.slave_parallel_max_queued as 'Check default';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@SESSION.slave_parallel_max_queued as 'no session var';
+
+SET GLOBAL slave_parallel_max_queued= 0;
+SET GLOBAL slave_parallel_max_queued= DEFAULT;
+SET GLOBAL slave_parallel_max_queued= 65536;
+SELECT @@GLOBAL.slave_parallel_max_queued;
+
+SET GLOBAL slave_parallel_max_queued = @save_slave_parallel_max_queued;
diff --git a/mysql-test/suite/sys_vars/t/slave_parallel_max_queued_grant.test b/mysql-test/suite/sys_vars/t/slave_parallel_max_queued_grant.test
new file mode 100644
index 00000000..e23fe1a3
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_parallel_max_queued_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21966 Bind REPLICATION SLAVE ADMIN to a number of global system variables
+--echo #
+
+--let var = slave_parallel_max_queued
+--let grant = REPLICATION SLAVE ADMIN
+--let value = 65536
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/slave_parallel_mode_basic-master.opt b/mysql-test/suite/sys_vars/t/slave_parallel_mode_basic-master.opt
new file mode 100644
index 00000000..cd2ccb7e
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_parallel_mode_basic-master.opt
@@ -0,0 +1 @@
+--slave-parallel-mode=minimal --m1.slave-parallel-mode=optimistic --m2.slave-parallel-mode=aggressive
diff --git a/mysql-test/suite/sys_vars/t/slave_parallel_mode_basic.test b/mysql-test/suite/sys_vars/t/slave_parallel_mode_basic.test
new file mode 100644
index 00000000..4d233b11
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_parallel_mode_basic.test
@@ -0,0 +1,34 @@
+--source include/not_embedded.inc
+
+# Also tests some command line options, in slave_parallel_mode_basic-master.opt
+
+--error ER_GLOBAL_VARIABLE
+SET SESSION slave_parallel_mode= none;
+
+SELECT @@slave_parallel_mode;
+SELECT @@m1.slave_parallel_mode;
+
+CHANGE MASTER TO master_host='127.0.0.1', master_port=3310, master_user='root';
+SELECT @@``.slave_parallel_mode;
+SELECT @@slave_parallel_mode;
+--let $status_items= Parallel_Mode
+--source include/show_slave_status.inc
+
+SELECT @@m2.slave_parallel_mode;
+SET GLOBAL m2.slave_parallel_mode = none;
+
+CHANGE MASTER 'm1' TO master_host='127.0.0.1', master_port=3311, master_user='root';
+SELECT @@m1.slave_parallel_mode;
+--source include/show_slave_status.inc
+SET GLOBAL m1.slave_parallel_mode= conservative;
+--source include/show_slave_status.inc
+SET default_master_connection= 'm1';
+SELECT @@slave_parallel_mode;
+SET GLOBAL slave_parallel_mode= aggressive;
+SELECT @@slave_parallel_mode;
+--source include/show_slave_status.inc
+SET default_master_connection= '';
+SELECT @@slave_parallel_mode;
+
+RESET SLAVE ALL;
+RESET SLAVE 'm1' ALL;
diff --git a/mysql-test/suite/sys_vars/t/slave_parallel_mode_grant.test b/mysql-test/suite/sys_vars/t/slave_parallel_mode_grant.test
new file mode 100644
index 00000000..a61640ed
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_parallel_mode_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21966 Bind REPLICATION SLAVE ADMIN to a number of global system variables
+--echo #
+
+--let var = slave_parallel_mode
+--let grant = REPLICATION SLAVE ADMIN
+--let value = 1
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/slave_parallel_threads_basic.cnf b/mysql-test/suite/sys_vars/t/slave_parallel_threads_basic.cnf
new file mode 100644
index 00000000..02bdb44e
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_parallel_threads_basic.cnf
@@ -0,0 +1,5 @@
+# Use default setting for mysqld processes
+!include include/default_mysqld.cnf
+
+[mysqld.1]
+slave_parallel_threads=20
diff --git a/mysql-test/suite/sys_vars/t/slave_parallel_threads_basic.test b/mysql-test/suite/sys_vars/t/slave_parallel_threads_basic.test
new file mode 100644
index 00000000..b567b7f8
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_parallel_threads_basic.test
@@ -0,0 +1,21 @@
+--source include/not_embedded.inc
+
+SET @save_slave_parallel_threads= @@GLOBAL.slave_parallel_threads;
+
+# Check that we don't spawn worker threads at server startup, when no
+# slave is configured (MDEV-5289).
+SELECT IF(COUNT(*) < 20, "OK", CONCAT("Found too many system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user";
+
+SELECT @@GLOBAL.slave_parallel_threads as 'must be 20 because of .cnf';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@SESSION.slave_parallel_threads as 'no session var';
+
+SET GLOBAL slave_parallel_threads= 0;
+SET GLOBAL slave_parallel_threads= DEFAULT;
+SELECT @@GLOBAL.slave_parallel_threads as 'must be 0 because of default';
+SET GLOBAL slave_parallel_threads= 10;
+SELECT @@GLOBAL.slave_parallel_threads;
+# Check that we don't spawn worker threads when no slave is started.
+SELECT IF(COUNT(*) < 10, "OK", CONCAT("Found too many system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user";
+
+SET GLOBAL slave_parallel_threads = @save_slave_parallel_threads;
diff --git a/mysql-test/suite/sys_vars/t/slave_parallel_threads_grant.test b/mysql-test/suite/sys_vars/t/slave_parallel_threads_grant.test
new file mode 100644
index 00000000..8a851122
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_parallel_threads_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21966 Bind REPLICATION SLAVE ADMIN to a number of global system variables
+--echo #
+
+--let var = slave_parallel_threads
+--let grant = REPLICATION SLAVE ADMIN
+--let value = 256
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/slave_parallel_workers_grant.test b/mysql-test/suite/sys_vars/t/slave_parallel_workers_grant.test
new file mode 100644
index 00000000..05974560
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_parallel_workers_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21966 Bind REPLICATION SLAVE ADMIN to a number of global system variables
+--echo #
+
+--let var = slave_parallel_workers
+--let grant = REPLICATION SLAVE ADMIN
+--let value = 256
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/slave_run_triggers_for_rbr_grant.test b/mysql-test/suite/sys_vars/t/slave_run_triggers_for_rbr_grant.test
new file mode 100644
index 00000000..91acd1ff
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_run_triggers_for_rbr_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21966 Bind REPLICATION SLAVE ADMIN to a number of global system variables
+--echo #
+
+--let var = slave_run_triggers_for_rbr
+--let grant = REPLICATION SLAVE ADMIN
+--let value = YES
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/slave_skip_errors_basic.test b/mysql-test/suite/sys_vars/t/slave_skip_errors_basic.test
new file mode 100644
index 00000000..c5c8aba7
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_skip_errors_basic.test
@@ -0,0 +1,19 @@
+--source include/not_embedded.inc
+#
+# only global
+#
+select @@global.slave_skip_errors;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.slave_skip_errors;
+show global variables like 'slave_skip_errors';
+show session variables like 'slave_skip_errors';
+select * from information_schema.global_variables where variable_name='slave_skip_errors';
+select * from information_schema.session_variables where variable_name='slave_skip_errors';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global slave_skip_errors=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session slave_skip_errors=1;
diff --git a/mysql-test/suite/sys_vars/t/slave_sql_verify_checksum_basic.test b/mysql-test/suite/sys_vars/t/slave_sql_verify_checksum_basic.test
new file mode 100644
index 00000000..3eb4f4b4
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_sql_verify_checksum_basic.test
@@ -0,0 +1,18 @@
+--source include/not_embedded.inc
+
+# suite/rpl/t/rpl_checksum.test contains similar testing of
+# all checksum related system variables.
+
+set @save_slave_sql_verify_checksum = @@global.slave_sql_verify_checksum;
+
+select @@global.slave_sql_verify_checksum as 'must be one because of default';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.slave_sql_verify_checksum as 'no session var';
+
+set @@global.slave_sql_verify_checksum = 0;
+set @@global.slave_sql_verify_checksum = default;
+--error ER_WRONG_VALUE_FOR_VAR
+set @@global.slave_sql_verify_checksum = 2; # the var is of bool type
+
+# cleanup
+set @@global.slave_sql_verify_checksum = @save_slave_sql_verify_checksum;
diff --git a/mysql-test/suite/sys_vars/t/slave_sql_verify_checksum_grant.test b/mysql-test/suite/sys_vars/t/slave_sql_verify_checksum_grant.test
new file mode 100644
index 00000000..683d53a6
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_sql_verify_checksum_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21966 Bind REPLICATION SLAVE ADMIN to a number of global system variables
+--echo #
+
+--let var = slave_sql_verify_checksum
+--let grant = REPLICATION SLAVE ADMIN
+--let value = 1
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/slave_transaction_retries_basic.test b/mysql-test/suite/sys_vars/t/slave_transaction_retries_basic.test
new file mode 100644
index 00000000..17146f07
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_transaction_retries_basic.test
@@ -0,0 +1,187 @@
+############# mysql-test\t\slave_transaction_retries_basic.test ###############
+# #
+# Variable Name: slave_transaction_retries #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 10 #
+# Range: #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable slave_transaction_retries#
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/not_embedded.inc
+--source include/load_sysvars.inc
+
+###################################################################
+# START OF slave_transaction_retries TESTS #
+###################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.slave_transaction_retries;
+SELECT @start_global_value;
+
+--echo '#--------------------FN_DYNVARS_149_01-------------------------#'
+###################################################################
+# Display the DEFAULT value of slave_transaction_retries #
+###################################################################
+
+SET @@global.slave_transaction_retries = 50;
+SET @@global.slave_transaction_retries = DEFAULT;
+SELECT @@global.slave_transaction_retries;
+
+--echo '#--------------------FN_DYNVARS_149_02-------------------------#'
+###################################################################
+# Check the DEFAULT value of slave_transaction_retries #
+###################################################################
+
+SET @@global.slave_transaction_retries = DEFAULT;
+SELECT @@global.slave_transaction_retries = 10;
+
+--echo '#--------------------FN_DYNVARS_149_03-------------------------#'
+################################################################################
+# Change the value of slave_transaction_retries to a valid value for
+# GLOBAL Scope
+################################################################################
+
+SET @@global.slave_transaction_retries = 0;
+SELECT @@global.slave_transaction_retries;
+SET @@global.slave_transaction_retries = 1;
+SELECT @@global.slave_transaction_retries;
+SET @@global.slave_transaction_retries = 15;
+SELECT @@global.slave_transaction_retries;
+SET @@global.slave_transaction_retries = 1024;
+SELECT @@global.slave_transaction_retries;
+SET @@global.slave_transaction_retries = 2147483648;
+SELECT @@global.slave_transaction_retries;
+SET @@global.slave_transaction_retries = 2147483648*2-1;
+SELECT @@global.slave_transaction_retries;
+SET @@global.slave_transaction_retries = 2147483649*2;
+SELECT @@global.slave_transaction_retries;
+SET @@global.slave_transaction_retries = 4294967295;
+SELECT @@global.slave_transaction_retries;
+
+--echo '#--------------------FN_DYNVARS_149_04-------------------------#'
+###############################################################################
+# Check if variable can be access with session scope #
+###############################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@slave_transaction_retries = 2;
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.slave_transaction_retries = 3;
+
+--Error ER_GLOBAL_VARIABLE
+SET @@local.slave_transaction_retries = 4;
+
+
+
+--echo '#------------------FN_DYNVARS_149_05-----------------------#'
+####################################################################
+# Change the value of slave_transaction_retries to an invalid value#
+####################################################################
+
+SET @@global.slave_transaction_retries = -1;
+SELECT @@global.slave_transaction_retries;
+
+SET @@global.slave_transaction_retries = 2147483649*2147483649;
+SELECT @@global.slave_transaction_retries;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.slave_transaction_retries = 65530.34;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.slave_transaction_retries = '100';
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.slave_transaction_retries = 7483649.56;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.slave_transaction_retries = ON;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.slave_transaction_retries = OFF;
+
+--echo '#------------------FN_DYNVARS_149_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+SET @@global.slave_transaction_retries = 3000;
+SELECT @@global.slave_transaction_retries = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='slave_transaction_retries';
+
+
+--echo '#------------------FN_DYNVARS_149_07-----------------------#'
+###########################################################################
+# Check if the value is present in INFORMATION_SCHEMA.SESSION_VARIABLES #
+###########################################################################
+
+SELECT count(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='slave_transaction_retries';
+
+
+--echo '#------------------FN_DYNVARS_149_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.slave_transaction_retries = TRUE;
+SELECT @@global.slave_transaction_retries;
+SET @@global.slave_transaction_retries = FALSE;
+SELECT @@global.slave_transaction_retries;
+
+
+--echo '#---------------------FN_DYNVARS_149_09----------------------#'
+###############################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+###############################################################################
+
+
+SET @@global.slave_transaction_retries = 60*60;
+SELECT @@slave_transaction_retries = @@global.slave_transaction_retries;
+
+
+--echo '#---------------------FN_DYNVARS_149_10----------------------#'
+###############################################################################
+# Check if slave_transaction_retries can be accessed without @@ sign
+# and scope
+###############################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET slave_transaction_retries = 2048;
+--Error ER_BAD_FIELD_ERROR
+SELECT slave_transaction_retries;
+
+SELECT @@slave_transaction_retries;
+
+#verifying another another syntax for setting value
+SET global slave_transaction_retries = 99;
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.slave_transaction_retries = @start_global_value;
+SELECT @@global.slave_transaction_retries;
+
+########################################################
+# END OF slave_transaction_retries TESTS #
+########################################################
+
diff --git a/mysql-test/suite/sys_vars/t/slave_transaction_retry_errors-master.opt b/mysql-test/suite/sys_vars/t/slave_transaction_retry_errors-master.opt
new file mode 100644
index 00000000..a93f9f02
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_transaction_retry_errors-master.opt
@@ -0,0 +1 @@
+--slave_transaction_retry_errors="10,20, 5000, 400"
diff --git a/mysql-test/suite/sys_vars/t/slave_transaction_retry_errors.test b/mysql-test/suite/sys_vars/t/slave_transaction_retry_errors.test
new file mode 100644
index 00000000..aa2299cf
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_transaction_retry_errors.test
@@ -0,0 +1,19 @@
+--source include/not_embedded.inc
+#
+# only global
+#
+select @@global.slave_transaction_retry_errors;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.slave_transaction_retry_errors;
+show global variables like 'slave_transaction_retry_errors';
+show session variables like 'slave_transaction_retry_errors';
+select * from information_schema.global_variables where variable_name='slave_transaction_retry_errors';
+select * from information_schema.session_variables where variable_name='slave_transaction_retry_errors';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global slave_transaction_retry_errors=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session slave_transaction_retry_errors=1;
diff --git a/mysql-test/suite/sys_vars/t/slave_transaction_retry_interval_basic.test b/mysql-test/suite/sys_vars/t/slave_transaction_retry_interval_basic.test
new file mode 100644
index 00000000..4d8d5590
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_transaction_retry_interval_basic.test
@@ -0,0 +1,190 @@
+--source include/not_embedded.inc
+#
+# only global
+#
+####### mysql-test\t\slave_transaction_retry_interval_basic.test ##############
+# #
+# Variable Name: slave_transaction_retry_interval #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 10 #
+# Range: #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable #
+# slave_transaction_retry_interval #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/not_embedded.inc
+--source include/load_sysvars.inc
+
+###################################################################
+# START OF slave_transaction_retry_interval TESTS #
+###################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.slave_transaction_retry_interval;
+SELECT @start_global_value;
+
+--echo '#--------------------FN_DYNVARS_149_01-------------------------#'
+###################################################################
+# Display the DEFAULT value of slave_transaction_retry_interval #
+###################################################################
+
+SET @@global.slave_transaction_retry_interval = 50;
+SET @@global.slave_transaction_retry_interval = DEFAULT;
+SELECT @@global.slave_transaction_retry_interval;
+
+--echo '#--------------------FN_DYNVARS_149_02-------------------------#'
+###################################################################
+# Check the DEFAULT value of slave_transaction_retry_interval #
+###################################################################
+
+SET @@global.slave_transaction_retry_interval = DEFAULT;
+SELECT @@global.slave_transaction_retry_interval = 10;
+
+--echo '#--------------------FN_DYNVARS_149_03-------------------------#'
+###############################################################################
+# Change the value of slave_transaction_retry_interval to a valid value for
+# GLOBAL Scope
+###############################################################################
+
+SET @@global.slave_transaction_retry_interval = 0;
+SELECT @@global.slave_transaction_retry_interval;
+SET @@global.slave_transaction_retry_interval = 1;
+SELECT @@global.slave_transaction_retry_interval;
+SET @@global.slave_transaction_retry_interval = 15;
+SELECT @@global.slave_transaction_retry_interval;
+SET @@global.slave_transaction_retry_interval = 1024;
+SELECT @@global.slave_transaction_retry_interval;
+SET @@global.slave_transaction_retry_interval = 2147483648;
+SELECT @@global.slave_transaction_retry_interval;
+SET @@global.slave_transaction_retry_interval = 2147483648*2-1;
+SELECT @@global.slave_transaction_retry_interval;
+SET @@global.slave_transaction_retry_interval = 2147483649*2;
+SELECT @@global.slave_transaction_retry_interval;
+SET @@global.slave_transaction_retry_interval = 4294967295;
+SELECT @@global.slave_transaction_retry_interval;
+
+--echo '#--------------------FN_DYNVARS_149_04-------------------------#'
+##############################################################################
+# Check if variable can be access with session scope #
+##############################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@slave_transaction_retry_interval = 2;
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.slave_transaction_retry_interval = 3;
+
+--Error ER_GLOBAL_VARIABLE
+SET @@local.slave_transaction_retry_interval = 4;
+
+
+--echo '#------------------FN_DYNVARS_149_05-----------------------#'
+############################################################################
+# Change the value of slave_transaction_retry_interval to an invalid value #
+############################################################################
+
+SET @@global.slave_transaction_retry_interval = -1;
+SELECT @@global.slave_transaction_retry_interval;
+
+SET @@global.slave_transaction_retry_interval = 2147483649*2147483649;
+SELECT @@global.slave_transaction_retry_interval;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.slave_transaction_retry_interval = 65530.34;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.slave_transaction_retry_interval = '100';
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.slave_transaction_retry_interval = 7483649.56;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.slave_transaction_retry_interval = ON;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.slave_transaction_retry_interval = OFF;
+
+--echo '#------------------FN_DYNVARS_149_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+SET @@global.slave_transaction_retry_interval = 3000;
+SELECT @@global.slave_transaction_retry_interval = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='slave_transaction_retry_interval';
+
+
+--echo '#------------------FN_DYNVARS_149_07-----------------------#'
+###########################################################################
+# Check if the value is present in INFORMATION_SCHEMA.SESSION_VARIABLES #
+###########################################################################
+
+SELECT count(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='slave_transaction_retry_interval';
+
+
+--echo '#------------------FN_DYNVARS_149_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.slave_transaction_retry_interval = TRUE;
+SELECT @@global.slave_transaction_retry_interval;
+SET @@global.slave_transaction_retry_interval = FALSE;
+SELECT @@global.slave_transaction_retry_interval;
+
+
+--echo '#---------------------FN_DYNVARS_149_09----------------------#'
+###############################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+###############################################################################
+
+
+SET @@global.slave_transaction_retry_interval = 60*60;
+SELECT @@slave_transaction_retry_interval = @@global.slave_transaction_retry_interval;
+
+
+--echo '#---------------------FN_DYNVARS_149_10----------------------#'
+###############################################################################
+# Check if slave_transaction_retry_interval can be accessed without @@ sign
+# and scope
+###############################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET slave_transaction_retry_interval = 2048;
+--Error ER_BAD_FIELD_ERROR
+SELECT slave_transaction_retry_interval;
+
+SELECT @@slave_transaction_retry_interval;
+
+#verifying another another syntax for setting value
+SET global slave_transaction_retry_interval = 99;
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.slave_transaction_retry_interval = @start_global_value;
+SELECT @@global.slave_transaction_retry_interval;
+
+########################################################
+# END OF slave_transaction_retry_interval TESTS #
+########################################################
diff --git a/mysql-test/suite/sys_vars/t/slave_transaction_retry_interval_grant.test b/mysql-test/suite/sys_vars/t/slave_transaction_retry_interval_grant.test
new file mode 100644
index 00000000..47a51fc9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_transaction_retry_interval_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21966 Bind REPLICATION SLAVE ADMIN to a number of global system variables
+--echo #
+
+--let var = slave_transaction_retry_interval
+--let grant = REPLICATION SLAVE ADMIN
+--let value = 256
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/slave_type_conversions_basic.test b/mysql-test/suite/sys_vars/t/slave_type_conversions_basic.test
new file mode 100644
index 00000000..c6debb07
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_type_conversions_basic.test
@@ -0,0 +1,24 @@
+
+--source include/not_embedded.inc
+
+set @saved_slave_type_conversions = @@global.slave_type_conversions;
+
+SELECT @@global.slave_type_conversions;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='';
+SELECT @@global.slave_type_conversions;
+
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY';
+SELECT @@global.slave_type_conversions;
+
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY';
+SELECT @@global.slave_type_conversions;
+
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY';
+SELECT @@global.slave_type_conversions;
+
+# checking that setting variable to a non existing value raises error
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY,NONEXISTING_BIT';
+SELECT @@global.slave_type_conversions;
+
+set global slave_type_conversions = @saved_slave_type_conversions;
diff --git a/mysql-test/suite/sys_vars/t/slave_type_conversions_grant.test b/mysql-test/suite/sys_vars/t/slave_type_conversions_grant.test
new file mode 100644
index 00000000..d3c9b239
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slave_type_conversions_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21966 Bind REPLICATION SLAVE ADMIN to a number of global system variables
+--echo #
+
+--let var = slave_type_conversions
+--let grant = REPLICATION SLAVE ADMIN
+--let value = ALL_NON_LOSSY
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/slow_launch_time_func-master.opt b/mysql-test/suite/sys_vars/t/slow_launch_time_func-master.opt
new file mode 100644
index 00000000..e92bb247
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slow_launch_time_func-master.opt
@@ -0,0 +1 @@
+--thread_cache_size=0
diff --git a/mysql-test/suite/sys_vars/t/slow_launch_time_func.test b/mysql-test/suite/sys_vars/t/slow_launch_time_func.test
new file mode 100644
index 00000000..c3725044
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slow_launch_time_func.test
@@ -0,0 +1,97 @@
+############# mysql-test\t\slow_launch_time_func.test ##########################
+# #
+# Variable Name: slow_launch_time #
+# Scope: SESSION #
+# Access Type: Dynamic #
+# Data Type: NUMERIC #
+# Default Value: 2 #
+# Values: - #
+# #
+# #
+# Creation Date: 2008-03-02 #
+# Author: Sharique Abdullah #
+# #
+# Last change: 2008-09-09 mleich Reimplementation of this test #
+# - Fix Bug#36874 : main.slow_launch_time_func test fails #
+# randomly #
+# - Fix other failures and streamline the test #
+# #
+# Description: Test Cases of Dynamic System Variable "slow_launch_time " #
+# that checks behavior of this variable in the following ways #
+# * Functionality based on different values #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# option_mysqld_slow_launch_time #
+# #
+################################################################################
+
+#
+# Setup
+#
+--source include/one_thread_per_connection.inc
+SET @global_slow_launch_time = @@GLOBAL.slow_launch_time;
+
+connection default;
+
+--echo '#--------------------FN_DYNVARS_124_01-------------------------#'
+
+########################################################################
+# Reveal that a new connect gets counted as "slow launched thread" if #
+# @@GLOBAL.slow_launch_time = 0. #
+# The value of slow_launch_threads must be increased by 1. #
+########################################################################
+
+SET @@GLOBAL.slow_launch_time=0;
+SELECT @@GLOBAL.slow_launch_time;
+
+let $value_before=
+ query_get_value(show status like 'slow_launch_threads', Value, 1);
+CONNECT (conn1,localhost,root,,);
+let $value_after=
+ query_get_value(show status like 'slow_launch_threads', Value, 1);
+if (!`SELECT $value_after = $value_before + 1`)
+{
+ --echo ERROR: Subtest FN_DYNVARS_124_01 failed
+ --echo A new connect should be counted as 'slow_launch_thread' if
+ --echo @@GLOBAL.slow_launch_time=0
+ SELECT @@GLOBAL.slow_launch_time;
+ echo Number of slow_launch_threads before new connect: $value_before;
+ echo Number of slow_launch_threads after new connect: $value_after;
+}
+connection default;
+disconnect conn1;
+
+--echo '#--------------------FN_DYNVARS_124_02-------------------------#'
+
+########################################################################
+# Reveal that a new connect gets not counted as "slow launched thread" #
+# if @@GLOBAL.slow_launch_time is sufficient big. #
+# The value of slow_launch_threads must not change. #
+########################################################################
+
+SET @@GLOBAL.slow_launch_time= 1000;
+SELECT @@GLOBAL.slow_launch_time;
+
+let $value_before=
+ query_get_value(show status like 'slow_launch_threads', Value, 1);
+CONNECT (conn2,localhost,root,,);
+let $value_after=
+ query_get_value(show status like 'slow_launch_threads', Value, 1);
+if ($value_after != $value_before)
+{
+ --echo ERROR: Subtest FN_DYNVARS_124_02 failed
+ --echo A new connect must not be counted as 'slow_launch_thread' if
+ --echo @@GLOBAL.slow_launch_time is sufficient big.
+ SELECT @@GLOBAL.slow_launch_time;
+ echo Number of slow_launch_threads before new connect: $value_before;
+ echo Number of slow_launch_threads after new connect: $value_after;
+}
+
+#
+# Cleanup
+#
+
+connection default;
+disconnect conn2;
+SET @@GLOBAL.slow_launch_time = @global_slow_launch_time;
diff --git a/mysql-test/suite/sys_vars/t/slow_launch_time_grant.test b/mysql-test/suite/sys_vars/t/slow_launch_time_grant.test
new file mode 100644
index 00000000..1a819305
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slow_launch_time_grant.test
@@ -0,0 +1,56 @@
+--source include/not_embedded.inc
+
+SET @global=@@global.slow_launch_time;
+
+--echo #
+--echo # MDEV-21961 Bind CONNECTION ADMIN to a number of global system variables
+--echo #
+
+--echo # Test that "SET slow_launch_time" is not allowed without CONNECTION ADMIN or SUPER
+
+CREATE USER user1@localhost;
+GRANT ALL PRIVILEGES ON *.* TO user1@localhost;
+REVOKE CONNECTION ADMIN, SUPER ON *.* FROM user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+SET GLOBAL slow_launch_time=10;
+--error ER_GLOBAL_VARIABLE
+SET slow_launch_time=10;
+--error ER_GLOBAL_VARIABLE
+SET SESSION slow_launch_time=10;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET slow_launch_time" is allowed with CONNECTION ADMIN
+
+CREATE USER user1@localhost;
+GRANT CONNECTION ADMIN ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+SET GLOBAL slow_launch_time=10;
+--error ER_GLOBAL_VARIABLE
+SET slow_launch_time=10;
+--error ER_GLOBAL_VARIABLE
+SET SESSION slow_launch_time=10;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET slow_launch_time" is allowed with SUPER
+
+CREATE USER user1@localhost;
+GRANT SUPER ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+SET GLOBAL slow_launch_time=10;
+--error ER_GLOBAL_VARIABLE
+SET slow_launch_time=10;
+--error ER_GLOBAL_VARIABLE
+SET SESSION slow_launch_time=10;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+SET @@global.slow_launch_time=@global;
diff --git a/mysql-test/suite/sys_vars/t/slow_query_log_file_func-master.opt b/mysql-test/suite/sys_vars/t/slow_query_log_file_func-master.opt
new file mode 100644
index 00000000..e866f016
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slow_query_log_file_func-master.opt
@@ -0,0 +1,2 @@
+--slow-query-log --slow-query-log-file=my_slow_test.log
+
diff --git a/mysql-test/suite/sys_vars/t/slow_query_log_file_func.test b/mysql-test/suite/sys_vars/t/slow_query_log_file_func.test
new file mode 100644
index 00000000..c83c7f18
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slow_query_log_file_func.test
@@ -0,0 +1,40 @@
+########### mysql-test\t\slow_query_log_file_func.test #########################
+# #
+# Variable Name: slow_query_log_file #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: Boolean #
+# Default Value: OFF #
+# Valid Values: ON, OFF #
+# #
+# #
+# Creation Date: 2008-03-17 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable "slow_query_log_file" #
+# that checks functionality of this variable #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_slow_query_log_file #
+# #
+################################################################################
+
+
+--echo '#--------------------FN_DYNVARS_018_01-------------------------#'
+####################################################################
+# Verifying log file after setting it in opt file #
+####################################################################
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+--echo ## Checking if my_slow_test.log exists in servers datadir ##
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--file_exists $MYSQLD_DATADIR/my_slow_test.log
+
+--echo ## This case should pass because we have set this filename in opt file ##
+
+set @oldval= @@global.slow_query_log_file;
+evalp set global log_slow_query_file='$MYSQLTEST_VARDIR/tmp/slow-7567.log';
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+select @@global.log_slow_query_file;
+--file_exists $MYSQLTEST_VARDIR/tmp/slow-7567.log
+set @@global.log_slow_query_file=@oldval;
diff --git a/mysql-test/suite/sys_vars/t/slow_query_log_func.test b/mysql-test/suite/sys_vars/t/slow_query_log_func.test
new file mode 100644
index 00000000..8dcc0279
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/slow_query_log_func.test
@@ -0,0 +1,155 @@
+# save
+SET @global_slow_query_log = @@global.slow_query_log;
+SET @global_log_output = @@global.log_output;
+###############################################################################
+# Begin the functionality testing for slow_query_log #
+###############################################################################
+
+SET @@session.long_query_time=1;
+
+SET @@global.log_output = 'TABLE';
+
+#=========================================
+--echo '----When global.log_slow_query = OFF----'
+#=========================================
+
+SET @@global.log_slow_query = OFF;
+TRUNCATE mysql.slow_log;
+# The sleep is the slow query
+SELECT sleep(2);
+
+SELECT count(*) FROM mysql.slow_log;
+
+#=========================================
+--echo '----When global.slow_query_log = ON-----'
+#=========================================
+
+SET @@global.slow_query_log = ON;
+TRUNCATE mysql.slow_log;
+# The sleep is the slow query
+SELECT sleep(2);
+
+SELECT count(*) > 0 FROM mysql.slow_log;
+
+#=========================================
+--echo '----When local.log_slow_query = OFF-----'
+#=========================================
+
+SET @@local.log_slow_query = OFF;
+TRUNCATE mysql.slow_log;
+# The sleep is the slow query
+SELECT sleep(2);
+
+SELECT count(*) FROM mysql.slow_log;
+SET @@local.slow_query_log = ON;
+
+#==========================================================================
+--echo 'Bug#47905 stored procedures not logged correctly to slow query log'
+#==========================================================================
+# assumes logging to table turned on with long_query_time=1 as above
+
+TRUNCATE mysql.slow_log;
+
+DELIMITER //;
+CREATE PROCEDURE p_test()
+BEGIN
+ select sleep(2);
+ select 1;
+END//
+DELIMITER ;//
+
+CALL p_test();
+SELECT count(*) > 0 FROM mysql.slow_log;
+DROP PROCEDURE p_test;
+
+#==============================================================================
+--echo Bug53191 Lock_time in slow log is negative when logging stored routines
+#==============================================================================
+TRUNCATE mysql.slow_log;
+connect (con2,localhost,root,,);
+connection default;
+
+CREATE TABLE t1 (c0 INT PRIMARY KEY AUTO_INCREMENT, c1 TIMESTAMP, c2 TIMESTAMP);
+delimiter //;
+CREATE FUNCTION f_slow_now() RETURNS TIMESTAMP
+BEGIN
+ DO SLEEP(2);
+ RETURN NOW();
+END//
+
+CREATE FUNCTION f_slow_current_time() RETURNS TIME
+BEGIN
+ DO SLEEP(2);
+ RETURN CURRENT_TIME();
+END
+//
+
+INSERT INTO t1 (c1,c2) VALUES (now(), f_slow_now())//
+
+CREATE TRIGGER tf_before BEFORE INSERT ON t1
+FOR EACH ROW BEGIN
+ SET new.c2 = f_slow_now();
+END//
+
+CREATE PROCEDURE p1()
+BEGIN
+ INSERT INTO t1 (c1,c2) values (now(),now());
+ DO SLEEP(2);
+ INSERT INTO t1 (c1,c2) values (now(),now());
+end//
+
+delimiter ;//
+
+INSERT INTO t1 (c1,c2) VALUES (now(), now());
+CALL p1();
+
+SELECT c1-c2 FROM t1;
+--echo *** There shouldn't less than 1 s difference between each row
+SELECT t1.c1-self.c1 > 1 FROM t1, t1 as self WHERE t1.c0=self.c0+1 ORDER BY t1.c0;
+
+DROP TRIGGER tf_before;
+DROP FUNCTION f_slow_now;
+DROP FUNCTION f_slow_current_time;
+DROP TABLE t1;
+
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(c1 INT) ENGINE=MyISAM;
+DROP PROCEDURE IF EXISTS p1;
+delimiter |;
+CREATE PROCEDURE p1()
+BEGIN
+ INSERT INTO t1 VALUES (1);
+ SELECT COUNT(*) FROM t1 WHERE c1= 1;
+ UPDATE t1 SET c1=c1*2;
+END|
+delimiter ;|
+
+connection con2;
+LOCK TABLE t1 WRITE;
+
+connection default;
+send CALL p1();
+
+--echo Wait three seconds and unlock the table
+connection con2;
+sleep 3;
+UNLOCK TABLES;
+connection default;
+reap;
+--echo Slow log:
+--echo **** 1 == we have slow log entries
+SELECT count(*) > 0 FROM mysql.slow_log;
+--echo **** 0 == None of the entries have a lock time greater than 10 s
+SELECT count(*) FROM mysql.slow_log WHERE lock_time > 10;
+disconnect con2;
+DROP TABLE t1;
+DROP PROCEDURE p1;
+
+
+#================================================================== Restore
+SET @@global.log_output = @global_log_output;
+SET @global.slow_query_log = @global_slow_query_log;
+
+###############################################################################
+# End of the functionality test for slow_query_log #
+###############################################################################
diff --git a/mysql-test/suite/sys_vars/t/socket_basic.test b/mysql-test/suite/sys_vars/t/socket_basic.test
new file mode 100644
index 00000000..f96a863a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/socket_basic.test
@@ -0,0 +1,23 @@
+#
+# only global
+#
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+select @@global.socket;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.socket;
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+show global variables like 'socket';
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+show session variables like 'socket';
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+select * from information_schema.global_variables where variable_name='socket';
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+select * from information_schema.session_variables where variable_name='socket';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global socket=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session socket=1;
diff --git a/mysql-test/suite/sys_vars/t/sort_buffer_size_basic.test b/mysql-test/suite/sys_vars/t/sort_buffer_size_basic.test
new file mode 100644
index 00000000..cf3a13de
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sort_buffer_size_basic.test
@@ -0,0 +1,224 @@
+############## mysql-test\t\sort_buffer_size_basic.test #######################
+# #
+# Variable Name: sort_buffer_size #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 2097144 #
+# Range:max value:4294967295 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable sort_buffer_size #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# Modified: Horst Hunger, 2008-11-28 #
+# disabled warnings as they contain the values of this variable, #
+# modified the check of the value only checking a range. #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+########################################################################
+
+
+######################################################################
+# START OF sort_buffer_size TESTS #
+######################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+--disable_warnings
+
+SET @start_global_value = @@global.sort_buffer_size;
+SET @start_session_value = @@session.sort_buffer_size;
+
+--echo '#--------------------FN_DYNVARS_151_01-------------------------#'
+######################################################################
+# Display the DEFAULT value of sort_buffer_size #
+######################################################################
+
+SET @@global.sort_buffer_size = 1000;
+SET @@global.sort_buffer_size = DEFAULT;
+eval
+SELECT @@global.sort_buffer_size;
+
+SET @@session.sort_buffer_size = 2000;
+SET @@session.sort_buffer_size = DEFAULT;
+eval
+SELECT @@session.sort_buffer_size;
+
+
+--echo '#--------------------FN_DYNVARS_151_02-------------------------#'
+######################################################################
+# Check the DEFAULT value of sort_buffer_size #
+######################################################################
+
+SET @@global.sort_buffer_size = DEFAULT;
+eval
+SELECT @@global.sort_buffer_size;
+
+SET @@session.sort_buffer_size = DEFAULT;
+eval
+SELECT @@session.sort_buffer_size;
+
+
+--echo '#--------------------FN_DYNVARS_151_03-------------------------#'
+################################################################################
+# Change the value of sort_buffer_size to a valid value for GLOBAL Scope #
+################################################################################
+
+SET @@global.sort_buffer_size = 32776;
+eval
+SELECT @@global.sort_buffer_size;
+SET @@global.sort_buffer_size = 32777;
+eval
+SELECT @@global.sort_buffer_size;
+SET @@global.sort_buffer_size = 4294967295;
+SELECT @@global.sort_buffer_size;
+SET @@global.sort_buffer_size = 4294967294;
+SELECT @@global.sort_buffer_size;
+
+--echo '#--------------------FN_DYNVARS_151_04-------------------------#'
+###################################################################################
+# Change the value of sort_buffer_size to a valid value for SESSION Scope #
+###################################################################################
+
+SET @@session.sort_buffer_size = 32776;
+eval
+SELECT @@session.sort_buffer_size;
+SET @@session.sort_buffer_size = 32777;
+eval
+SELECT @@session.sort_buffer_size;
+SET @@session.sort_buffer_size = 4294967295;
+SELECT @@session.sort_buffer_size;
+SET @@session.sort_buffer_size = 4294967294;
+SELECT @@session.sort_buffer_size;
+
+
+--echo '#------------------FN_DYNVARS_151_05-----------------------#'
+##################################################################
+# Change the value of sort_buffer_size to an invalid value #
+##################################################################
+
+SET @@global.sort_buffer_size = 32775;
+eval
+SELECT @@global.sort_buffer_size;
+SET @@global.sort_buffer_size = -1024;
+eval
+SELECT @@global.sort_buffer_size;
+SET @@global.sort_buffer_size = 4294967296;
+--replace_result 4294967296 max_sort_buffer_size 4294967295 max_sort_buffer_size
+SELECT @@global.sort_buffer_size;
+SET @@global.sort_buffer_size = 1024*1024;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.sort_buffer_size = 65530.34;
+SELECT @@global.sort_buffer_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.sort_buffer_size = test;
+SELECT @@global.sort_buffer_size;
+
+SET @@session.sort_buffer_size = 32775;
+eval
+SELECT @@session.sort_buffer_size;
+SET @@session.sort_buffer_size = -2;
+eval
+SELECT @@session.sort_buffer_size;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.sort_buffer_size = 65530.34;
+SET @@session.sort_buffer_size = 4294967295;
+SELECT @@session.sort_buffer_size;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.sort_buffer_size = test;
+
+--echo '#------------------FN_DYNVARS_151_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT @@global.sort_buffer_size = VARIABLE_VALUE FROM
+ INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='sort_buffer_size';
+
+--echo '#------------------FN_DYNVARS_151_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.sort_buffer_size = VARIABLE_VALUE FROM
+INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sort_buffer_size';
+
+
+--echo '#------------------FN_DYNVARS_151_08-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+SET @@global.sort_buffer_size = TRUE;
+eval
+SELECT @@global.sort_buffer_size;
+SET @@global.sort_buffer_size = FALSE;
+eval
+SELECT @@global.sort_buffer_size;
+
+--echo '#---------------------FN_DYNVARS_151_09----------------------#'
+####################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+####################################################################################
+
+SET @@global.sort_buffer_size = 9000;
+SELECT @@sort_buffer_size = @@global.sort_buffer_size;
+
+--echo '#---------------------FN_DYNVARS_151_10----------------------#'
+###################################################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable#
+###################################################################################################
+
+SET @@sort_buffer_size = 9000;
+SELECT @@sort_buffer_size = @@local.sort_buffer_size;
+SELECT @@local.sort_buffer_size = @@session.sort_buffer_size;
+
+
+--echo '#---------------------FN_DYNVARS_151_11----------------------#'
+###################################################################################
+# Check if sort_buffer_size can be accessed with and without @@ sign #
+###################################################################################
+
+SET sort_buffer_size = 9100;
+eval
+SELECT @@sort_buffer_size;
+--Error ER_UNKNOWN_TABLE
+SELECT local.sort_buffer_size;
+--Error ER_UNKNOWN_TABLE
+SELECT session.sort_buffer_size;
+--Error ER_BAD_FIELD_ERROR
+SELECT sort_buffer_size = @@session.sort_buffer_size;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.sort_buffer_size = @start_global_value;
+SET @@session.sort_buffer_size = @start_session_value;
+
+--enable_warnings
+
+#############################################################
+# END OF sort_buffer_size TESTS #
+#############################################################
+
diff --git a/mysql-test/suite/sys_vars/t/sql_auto_is_null_basic.test b/mysql-test/suite/sys_vars/t/sql_auto_is_null_basic.test
new file mode 100644
index 00000000..07bf3877
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sql_auto_is_null_basic.test
@@ -0,0 +1,62 @@
+
+
+################## mysql-test\t\sql_auto_is_null_basic.test ###################
+# #
+# Variable Name: sql_auto_is_null #
+# Scope: Session #
+# Access Type: Static #
+# Data Type: filename #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable sql_auto_is_null #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--echo '#---------------------BS_STVARS_044_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+
+SELECT @@session.sql_auto_is_null;
+
+--echo '#---------------------BS_STVARS_044_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+SET @@session.sql_auto_is_null=1;
+SELECT @@session.sql_auto_is_null;
+
+--echo '#---------------------BS_STVARS_044_03----------------------#'
+#################################################################
+# Check if the value in session Table matches value in variable #
+#################################################################
+
+SELECT IF(@@session.sql_auto_is_null, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='sql_auto_is_null';
+
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='sql_auto_is_null';
+
+--echo '#---------------------BS_STVARS_044_05----------------------#'
+################################################################################
+# Check if sql_auto_is_null can be accessed with and without @@ sign #
+################################################################################
+
+SELECT @@sql_auto_is_null;
+SELECT @@local.sql_auto_is_null;
+SELECT @@session.sql_auto_is_null;
+
+SELECT @@global.sql_auto_is_null;
+
diff --git a/mysql-test/suite/sys_vars/t/sql_big_selects_basic.test b/mysql-test/suite/sys_vars/t/sql_big_selects_basic.test
new file mode 100644
index 00000000..42331d76
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sql_big_selects_basic.test
@@ -0,0 +1,168 @@
+############## mysql-test\t\sql_big_selects_basic.test ########################
+# #
+# Variable Name: sql_big_selects #
+# Scope: SESSION #
+# Access Type: Dynamic #
+# Data Type: boolean #
+# Default Value: #
+# Range: 0,1 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable sql_big_selects #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF sql_big_selects TESTS #
+########################################################################
+
+
+################################################################################
+# Saving initial value of sql_big_selects in a temporary variable #
+################################################################################
+
+SET @session_start_value = @@session.sql_big_selects;
+SELECT @session_start_value;
+
+--echo '#--------------------FN_DYNVARS_153_01------------------------#'
+########################################################################
+# Display the DEFAULT value of sql_big_selects #
+########################################################################
+
+SET @@session.sql_big_selects = 0;
+SET @@session.sql_big_selects = DEFAULT;
+SELECT @@session.sql_big_selects;
+
+
+--echo '#---------------------FN_DYNVARS_153_02-------------------------#'
+#############################################################################
+# Check if sql_big_selects can be accessed with and without @@ sign #
+#############################################################################
+
+SET sql_big_selects = 1;
+SELECT @@sql_big_selects;
+
+--Error ER_UNKNOWN_TABLE
+SELECT session.sql_big_selects;
+
+--Error ER_UNKNOWN_TABLE
+SELECT local.sql_big_selects;
+
+SET session sql_big_selects = 0;
+SELECT @@session.sql_big_selects;
+
+
+--echo '#--------------------FN_DYNVARS_153_03------------------------#'
+#####################################################################
+# change the value of sql_big_selects to a valid value #
+#####################################################################
+
+SET @@session.sql_big_selects = 0;
+SELECT @@session.sql_big_selects;
+SET @@session.sql_big_selects = 1;
+SELECT @@session.sql_big_selects;
+
+
+--echo '#--------------------FN_DYNVARS_153_04-------------------------#'
+########################################################################
+# Change the value of sql_big_selects to invalid value #
+########################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_big_selects = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_big_selects = 2;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_big_selects = "T";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_big_selects = "Y";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_big_selects = TRÜE;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_big_selects = ÕN;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_big_selects = OF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_big_selects = ÓFF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_big_selects = '¹';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_big_selects = NO;
+
+
+--echo '#-------------------FN_DYNVARS_153_05----------------------------#'
+########################################################################
+# Test if accessing global sql_big_selects gives error #
+########################################################################
+
+SET @@global.sql_big_selects = 1-@@global.sql_big_selects;
+SELECT @@global.sql_big_selects;
+SET @@global.sql_big_selects = 1-@@global.sql_big_selects;
+
+--echo '#----------------------FN_DYNVARS_153_06------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table contains variable value #
+#########################################################################
+
+SELECT count(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='sql_big_selects';
+
+--echo '#----------------------FN_DYNVARS_153_07------------------------#'
+########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+########################################################################
+
+SELECT IF(@@session.sql_big_selects, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='sql_big_selects';
+SELECT @@session.sql_big_selects;
+
+SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='sql_big_selects';
+
+--echo '#---------------------FN_DYNVARS_153_08-------------------------#'
+###################################################################
+# Check if ON and OFF values can be used on variable #
+###################################################################
+
+SET @@session.sql_big_selects = OFF;
+SELECT @@session.sql_big_selects;
+SET @@session.sql_big_selects = ON;
+SELECT @@session.sql_big_selects;
+
+--echo '#---------------------FN_DYNVARS_153_09----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@session.sql_big_selects = TRUE;
+SELECT @@session.sql_big_selects;
+SET @@session.sql_big_selects = FALSE;
+SELECT @@session.sql_big_selects;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@session.sql_big_selects = @session_start_value;
+SELECT @@session.sql_big_selects;
+
+############################################################
+# END OF sql_big_selects TESTS #
+############################################################
+
diff --git a/mysql-test/suite/sys_vars/t/sql_big_selects_func.test b/mysql-test/suite/sys_vars/t/sql_big_selects_func.test
new file mode 100644
index 00000000..59d81848
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sql_big_selects_func.test
@@ -0,0 +1,125 @@
+############# mysql-test\t\sql_big_selects_func.test ######################
+# #
+# Variable Name: sql_big_selects #
+# Scope: SESSION #
+# Access Type: Dynamic #
+# Data Type: BOOLEAN #
+# Default Value: 1 TRUE #
+# Values: 1 TRUE, 0 FALSE #
+# #
+# #
+# Creation Date: 2008-02-25 #
+# Author: Sharique Abdullah #
+# #
+# Description: Test Cases of Dynamic System Variable "sql_big_selects" #
+# that checks behavior of this variable in the following ways#
+# * Functionality based on different values #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html #
+# #
+###########################################################################
+
+--echo ** Setup **
+--echo
+#
+# Setup
+#
+
+SET @session_sql_big_selects = @@SESSION.sql_big_selects;
+SET @session_max_join_size = @@SESSION.max_join_size;
+SET @global_max_join_size = @@GLOBAL.max_join_size;
+SET MAX_JOIN_SIZE=9;
+
+#
+# Create tables
+#
+
+CREATE TEMPORARY TABLE t1(a varchar(20) not null, b varchar(20));
+CREATE TEMPORARY TABLE t2(a varchar(20) null, b varchar(20));
+
+INSERT INTO t1 VALUES('aa','bb');
+INSERT INTO t1 VALUES('aa1','bb');
+INSERT INTO t1 VALUES('aa2','bb');
+INSERT INTO t1 VALUES('aa3','bb');
+INSERT INTO t1 VALUES('aa4','bb');
+
+INSERT INTO t2 VALUES('aa','bb');
+INSERT INTO t2 VALUES('aa1','bb');
+INSERT INTO t2 VALUES('aa2','bb');
+INSERT INTO t2 VALUES('aa3','bb');
+INSERT INTO t2 VALUES('aa4','bb');
+
+--echo '#--------------------FN_DYNVARS_154_01-------------------------#'
+#
+# Testing fail condition
+#
+
+--echo Expected error "Too big select"
+--error ER_TOO_BIG_SELECT
+SELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.a;
+--echo Expected error The SELECT would examine more than MAX_JOIN_SIZE rows.
+
+--echo '#--------------------FN_DYNVARS_154_02-------------------------#'
+#
+# Testing pass conditions
+#
+
+SET SESSION SQL_BIG_SELECTS = 1;
+
+SELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.a;
+--echo This should work
+
+SET SESSION SQL_BIG_SELECTS = 0;
+
+DELETE FROM t2 WHERE a = 'aa4';
+SELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.a;
+--echo This should work
+
+--echo '#--------------------FN_DYNVARS_154_03-------------------------#'
+#
+# Session data integrity check
+#
+
+connect (con_int1,localhost,root,,);
+
+connection con_int1;
+
+SELECT @@SESSION.sql_big_selects;
+--echo 1 Expected
+SET SESSION sql_big_selects = 0;
+
+connect (con_int2,localhost,root,,);
+
+connection con_int2;
+
+SELECT @@SESSION.sql_big_selects;
+--echo 1 Expected
+
+SET SESSION sql_big_selects = 1;
+
+connection con_int1;
+
+SELECT @@SESSION.sql_big_selects;
+--echo 0 Expected
+
+connection con_int2;
+
+SELECT @@SESSION.sql_big_selects;
+--echo 1 Expected
+
+connection default;
+
+disconnect con_int1;
+disconnect con_int2;
+
+#
+# Cleanup
+#
+
+
+SET @@SESSION.sql_big_selects = @session_sql_big_selects;
+SET @@SESSION.max_join_size = @session_max_join_size;
+SET @@GLOBAL.max_join_size = @global_max_join_size;
+
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/sys_vars/t/sql_buffer_result_basic.test b/mysql-test/suite/sys_vars/t/sql_buffer_result_basic.test
new file mode 100644
index 00000000..f5f99efe
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sql_buffer_result_basic.test
@@ -0,0 +1,173 @@
+############## mysql-test\t\sql_buffer_result_basic.test ######################
+# #
+# Variable Name: sql_buffer_result #
+# Scope: SESSION #
+# Access Type: Dynamic #
+# Data Type: boolean #
+# Default Value: #
+# Valid Values : 0,1 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable sql_buffer_result #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF sql_buffer_result TESTS #
+########################################################################
+
+
+################################################################################
+# Saving initial value of sql_buffer_result in a temporary variable #
+################################################################################
+
+SET @session_start_value = @@session.sql_buffer_result;
+SELECT @session_start_value;
+
+--echo '#--------------------FN_DYNVARS_155_01------------------------#'
+########################################################################
+# Display the DEFAULT value of sql_buffer_result #
+########################################################################
+
+SET @@session.sql_buffer_result = 0;
+SET @@session.sql_buffer_result = DEFAULT;
+SELECT @@session.sql_buffer_result;
+
+SET @@session.sql_buffer_result = 1;
+SET @@session.sql_buffer_result = DEFAULT;
+SELECT @@session.sql_buffer_result;
+
+
+--echo '#---------------------FN_DYNVARS_155_02-------------------------#'
+#############################################################################
+# Check if sql_buffer_result can be accessed with and without @@ sign #
+#############################################################################
+
+SET sql_buffer_result = 1;
+SELECT @@sql_buffer_result;
+
+--Error ER_UNKNOWN_TABLE
+SELECT session.sql_buffer_result;
+
+--Error ER_UNKNOWN_TABLE
+SELECT local.sql_buffer_result;
+
+SET session sql_buffer_result = 0;
+SELECT @@session.sql_buffer_result;
+
+
+--echo '#--------------------FN_DYNVARS_155_03------------------------#'
+########################################################################
+# change the value of sql_buffer_result to a valid value #
+########################################################################
+
+SET @@session.sql_buffer_result = 0;
+SELECT @@session.sql_buffer_result;
+SET @@session.sql_buffer_result = 1;
+SELECT @@session.sql_buffer_result;
+
+
+--echo '#--------------------FN_DYNVARS_155_04-------------------------#'
+###########################################################################
+# Change the value of sql_buffer_result to invalid value #
+###########################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_buffer_result = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_buffer_result = 2;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_buffer_result = "TRU";
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.sql_buffer_result = 0.4;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_buffer_result = TRÜE;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_buffer_result = ÕN;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_buffer_result = OF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_buffer_result = ÓFF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_buffer_result = '¹';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_buffer_result = NO;
+
+
+--echo '#-------------------FN_DYNVARS_155_05----------------------------#'
+###########################################################################
+# Test if accessing global sql_buffer_result gives error #
+###########################################################################
+
+SET @@global.sql_buffer_result = 1-@@global.sql_buffer_result;
+SELECT @@global.sql_buffer_result;
+SET @@global.sql_buffer_result = 1-@@global.sql_buffer_result;
+SELECT @@global.sql_buffer_result;
+
+--echo '#----------------------FN_DYNVARS_155_06------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table contains variable value #
+#########################################################################
+
+SELECT count(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='sql_buffer_result';
+
+--echo '#----------------------FN_DYNVARS_155_07------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#########################################################################
+
+SELECT IF(@@session.sql_buffer_result, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='sql_buffer_result';
+SELECT @@session.sql_buffer_result;
+SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='sql_buffer_result';
+
+--echo '#---------------------FN_DYNVARS_155_08-------------------------#'
+###################################################################
+# Check if ON and OFF values can be used on variable #
+###################################################################
+
+SET @@session.sql_buffer_result = OFF;
+SELECT @@session.sql_buffer_result;
+SET @@session.sql_buffer_result = ON;
+SELECT @@session.sql_buffer_result;
+
+--echo '#---------------------FN_DYNVARS_155_09----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@session.sql_buffer_result = TRUE;
+SELECT @@session.sql_buffer_result;
+SET @@session.sql_buffer_result = FALSE;
+SELECT @@session.sql_buffer_result;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@session.sql_buffer_result = @session_start_value;
+SELECT @@session.sql_buffer_result;
+
+###############################################################
+# END OF sql_buffer_result TESTS #
+###############################################################
diff --git a/mysql-test/suite/sys_vars/t/sql_buffer_result_func.test b/mysql-test/suite/sys_vars/t/sql_buffer_result_func.test
new file mode 100644
index 00000000..77f947c9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sql_buffer_result_func.test
@@ -0,0 +1,136 @@
+############# mysql-test\t\sql_buffer_result_func.test #####################
+# #
+# Variable Name: sql_buffer_result #
+# Scope: SESSION #
+# Access Type: Dynamic #
+# Data Type: BOOLEAN #
+# Default Value: 0 FALSE #
+# Values: 1 TRUE, 0 FALSE #
+# #
+# #
+# Creation Date: 2008-02-25 #
+# Author: Sharique Abdullah #
+# #
+# Description: Test Cases of Dynamic System Variable "sql_buffer_result" #
+# that checks behavior of this variable in the following ways #
+# * Functionality based on different values #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html #
+# #
+############################################################################
+
+--echo ** Setup **
+--echo
+#
+# Setup
+#
+
+SET @original_sql_buffer_result = @@sql_buffer_result;
+
+#
+# Create tables
+#
+
+CREATE TEMPORARY TABLE t1(a varchar(20), b varchar(20));
+
+INSERT INTO t1 VALUES('aa','bb');
+INSERT INTO t1 VALUES('aa','bb');
+INSERT INTO t1 VALUES('aa','bb');
+INSERT INTO t1 VALUES('aa','bb');
+INSERT INTO t1 VALUES('aa','bb');
+
+--echo '#--------------------FN_DYNVARS_156_01-------------------------#'
+#
+# TRUE mode
+#
+
+SET SESSION sql_buffer_result = 1;
+
+--disable_ps_protocol
+SHOW STATUS LIKE 'Created_tmp_tables';
+--enable_ps_protocol
+--echo Expected value : 0.
+
+--disable_ps2_protocol
+SELECT * FROM t1;
+--enable_ps2_protocol
+
+--disable_ps_protocol
+SHOW STATUS LIKE 'Created_tmp_tables';
+--enable_ps_protocol
+--echo Expected value : 1.
+
+--disable_ps2_protocol
+SELECT * FROM t1;
+--enable_ps2_protocol
+
+--disable_ps_protocol
+SHOW STATUS LIKE 'Created_tmp_tables';
+--enable_ps_protocol
+--echo Expected value : 2.
+
+--echo '#--------------------FN_DYNVARS_156_02-------------------------#'
+#
+# FALSE mode
+#
+
+SET SESSION sql_buffer_result = 0;
+
+--disable_ps_protocol
+SHOW STATUS LIKE 'Created_tmp_tables';
+--enable_ps_protocol
+--echo Expected value : 2.
+
+SELECT * FROM t1;
+
+--disable_ps_protocol
+SHOW STATUS LIKE 'Created_tmp_tables';
+--enable_ps_protocol
+--echo Expected value : 2.
+
+--echo '#--------------------FN_DYNVARS_156_03-------------------------#'
+#
+# Session data integrity check
+#
+connect (con_int1,localhost,root,,);
+
+connection con_int1;
+
+SELECT @@SESSION.sql_buffer_result;
+--echo 0 / FALSE Expected
+
+SET SESSION sql_buffer_result = FALSE;
+
+connect (con_int2,localhost,root,,);
+
+connection con_int2;
+
+SELECT @@SESSION.sql_buffer_result;
+--echo 0 / FALSE Expected
+
+SET SESSION sql_buffer_result = TRUE;
+
+connection con_int1;
+
+SELECT @@SESSION.sql_buffer_result;
+--echo 0 / FALSE Expected
+
+connection con_int2;
+
+SELECT @@SESSION.sql_buffer_result;
+--echo 1 / TRUE Expected
+
+connection default;
+
+disconnect con_int1;
+disconnect con_int2;
+
+
+#
+# Cleanup
+#
+--echo ** Cleanup **
+
+SET @@sql_buffer_result = @original_sql_buffer_result;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/sys_vars/t/sql_log_bin_basic.test b/mysql-test/suite/sys_vars/t/sql_log_bin_basic.test
new file mode 100644
index 00000000..5f5e3920
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sql_log_bin_basic.test
@@ -0,0 +1,172 @@
+####################### mysql-test\t\sql_log_bin_basic.test ###################
+# #
+# Variable Name: sql_log_bin #
+# Scope: SESSION #
+# Access Type: Dynamic #
+# Data Type: boolean #
+# Default Value: #
+# Valid Values: 0,1 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable sql_log_bin #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF sql_log_bin TESTS #
+########################################################################
+
+
+##############################################################################
+# Saving initial value of sql_log_bin in a temporary variable #
+##############################################################################
+
+SET @session_start_value = @@session.sql_log_bin;
+SELECT @session_start_value;
+
+--echo '#--------------------FN_DYNVARS_156_01------------------------#'
+########################################################################
+# Display the DEFAULT value of sql_log_bin #
+########################################################################
+
+SET @@session.sql_log_bin = 0;
+SET @@session.sql_log_bin = DEFAULT;
+SELECT @@session.sql_log_bin;
+
+SET @@session.sql_log_bin = 1;
+SET @@session.sql_log_bin = DEFAULT;
+SELECT @@session.sql_log_bin;
+
+
+--echo '#---------------------FN_DYNVARS_156_02-------------------------#'
+#############################################################################
+# Check if sql_log_bin can be accessed with and without @@ sign #
+#############################################################################
+
+SET sql_log_bin = 1;
+SELECT @@sql_log_bin;
+
+--Error ER_UNKNOWN_TABLE
+SELECT session.sql_log_bin;
+
+--Error ER_UNKNOWN_TABLE
+SELECT local.sql_log_bin;
+
+SET session sql_log_bin = 0;
+SELECT @@session.sql_log_bin;
+
+
+--echo '#--------------------FN_DYNVARS_156_03------------------------#'
+########################################################################
+# change the value of sql_log_bin to a valid value #
+########################################################################
+
+SET @@session.sql_log_bin = 0;
+SELECT @@session.sql_log_bin;
+SET @@session.sql_log_bin = 1;
+SELECT @@session.sql_log_bin;
+
+
+--echo '#--------------------FN_DYNVARS_156_04-------------------------#'
+###########################################################################
+# Change the value of sql_log_bin to invalid value #
+###########################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_log_bin = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_log_bin = 2;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_log_bin = "T";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_log_bin = "Y";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_log_bin = TRÜE;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_log_bin = ÕN;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_log_bin = OF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_log_bin = ÓFF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_log_bin = '¹';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_log_bin = NO;
+
+
+--echo '#-------------------FN_DYNVARS_156_05----------------------------#'
+###########################################################################
+# Test if setting global sql_log_bin gives error, #
+# and there is no error on reading it. #
+###########################################################################
+
+SELECT @@global.sql_log_bin;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.sql_log_bin = 0;
+SELECT @@global.sql_log_bin;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.sql_log_bin = 1;
+
+--echo '#----------------------FN_DYNVARS_156_06------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table contains variable value #
+#########################################################################
+
+SELECT count(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='sql_log_bin';
+
+--echo '#----------------------FN_DYNVARS_156_07------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#########################################################################
+
+SELECT IF(@@session.sql_log_bin, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='sql_log_bin';
+SELECT @@session.sql_log_bin;
+SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='sql_log_bin';
+
+--echo '#---------------------FN_DYNVARS_156_08-------------------------#'
+###################################################################
+# Check if ON and OFF values can be used on variable #
+###################################################################
+
+SET @@session.sql_log_bin = OFF;
+SELECT @@session.sql_log_bin;
+SET @@session.sql_log_bin = ON;
+SELECT @@session.sql_log_bin;
+
+--echo '#---------------------FN_DYNVARS_156_09----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@session.sql_log_bin = TRUE;
+SELECT @@session.sql_log_bin;
+SET @@session.sql_log_bin = FALSE;
+SELECT @@session.sql_log_bin;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@session.sql_log_bin = @session_start_value;
+SELECT @@session.sql_log_bin;
+
+###############################################################
+# END OF sql_log_bin TESTS #
+###############################################################
diff --git a/mysql-test/suite/sys_vars/t/sql_log_bin_grant.test b/mysql-test/suite/sys_vars/t/sql_log_bin_grant.test
new file mode 100644
index 00000000..d7ffc2b6
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sql_log_bin_grant.test
@@ -0,0 +1,51 @@
+source include/have_log_bin.inc;
+
+
+--echo #
+--echo #
+--echo #
+
+--echo # Test that "SET sql_log_bin" is not allowed without BINLOG ADMIN or SUPER
+
+CREATE USER user1@localhost;
+GRANT ALL PRIVILEGES ON *.* TO user1@localhost;
+REVOKE BINLOG ADMIN, SUPER ON *.* FROM user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+SET sql_log_bin=1;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+SET GLOBAL sql_log_bin=1;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+SET SESSION sql_log_bin=1;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET sql_log_bin" is allowed with BINLOG ADMIN
+
+CREATE USER user1@localhost;
+GRANT BINLOG ADMIN ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+SET sql_log_bin=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET GLOBAL sql_log_bin=1;
+SET SESSION sql_log_bin=1;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET sql_log_bin" is allowed with SUPER
+
+CREATE USER user1@localhost;
+GRANT SUPER ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+SET sql_log_bin=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET GLOBAL sql_log_bin=1;
+SET SESSION sql_log_bin=1;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
diff --git a/mysql-test/suite/sys_vars/t/sql_log_off_basic.test b/mysql-test/suite/sys_vars/t/sql_log_off_basic.test
new file mode 100644
index 00000000..38549ac3
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sql_log_off_basic.test
@@ -0,0 +1,170 @@
+################# mysql-test\t\sql_log_off_basic.test #########################
+# #
+# Variable Name: sql_log_off #
+# Scope: SESSION #
+# Access Type: Dynamic #
+# Data Type: boolean #
+# Default Value: #
+# Range: 0,1 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable sql_log_off #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+########################################################################
+# START OF sql_log_off TESTS #
+########################################################################
+
+
+################################################################################
+# Saving initial value of sql_log_off in a temporary variable #
+################################################################################
+
+SET @session_start_value = @@session.sql_log_off;
+SELECT @session_start_value;
+
+--echo '#--------------------FN_DYNVARS_157_01------------------------#'
+########################################################################
+# Display the DEFAULT value of sql_log_off #
+########################################################################
+
+SET @@session.sql_log_off = 0;
+SET @@session.sql_log_off = DEFAULT;
+SELECT @@session.sql_log_off;
+
+SET @@session.sql_log_off = 1;
+SET @@session.sql_log_off = DEFAULT;
+SELECT @@session.sql_log_off;
+
+
+--echo '#---------------------FN_DYNVARS_157_02-------------------------#'
+#############################################################################
+# Check if sql_log_off can be accessed with and without @@ sign #
+#############################################################################
+
+SET sql_log_off = 1;
+SELECT @@sql_log_off;
+
+--Error ER_UNKNOWN_TABLE
+SELECT session.sql_log_off;
+
+--Error ER_UNKNOWN_TABLE
+SELECT local.sql_log_off;
+
+SET session sql_log_off = 0;
+SELECT @@session.sql_log_off;
+
+
+--echo '#--------------------FN_DYNVARS_157_03------------------------#'
+########################################################################
+# change the value of sql_log_off to a valid value #
+########################################################################
+
+SET @@session.sql_log_off = 0;
+SELECT @@session.sql_log_off;
+SET @@session.sql_log_off = 1;
+SELECT @@session.sql_log_off;
+
+
+--echo '#--------------------FN_DYNVARS_157_04-------------------------#'
+###########################################################################
+# Change the value of sql_log_off to invalid value #
+###########################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_log_off = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_log_off = 2;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_log_off = "T";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_log_off = "Y";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_log_off = TRÜE;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_log_off = ÕN;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_log_off = OF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_log_off = ÓFF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_log_off = '¹';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_log_off = NO;
+
+
+--echo '#-------------------FN_DYNVARS_157_05----------------------------#'
+###########################################################################
+# Test if accessing global sql_log_off gives error #
+###########################################################################
+
+SET @@global.sql_log_off = 1-@@global.sql_log_off;
+SELECT @@global.sql_log_off;
+SET @@global.sql_log_off = 1-@@global.sql_log_off;
+SELECT @@global.sql_log_off;
+
+--echo '#----------------------FN_DYNVARS_157_06------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table contains variable value #
+#########################################################################
+
+SELECT count(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='sql_log_off';
+
+--echo '#----------------------FN_DYNVARS_157_07------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#########################################################################
+
+SELECT IF(@@session.sql_log_off, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='sql_log_off';
+SELECT @@session.sql_log_off;
+SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='sql_log_off';
+
+--echo '#---------------------FN_DYNVARS_157_08-------------------------#'
+###################################################################
+# Check if ON and OFF values can be used on variable #
+###################################################################
+
+SET @@session.sql_log_off = OFF;
+SELECT @@session.sql_log_off;
+SET @@session.sql_log_off = ON;
+SELECT @@session.sql_log_off;
+
+--echo '#---------------------FN_DYNVARS_157_09----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@session.sql_log_off = TRUE;
+SELECT @@session.sql_log_off;
+SET @@session.sql_log_off = FALSE;
+SELECT @@session.sql_log_off;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@session.sql_log_off = @session_start_value;
+SELECT @@session.sql_log_off;
+
+###############################################################
+# END OF sql_log_off TESTS #
+###############################################################
diff --git a/mysql-test/suite/sys_vars/t/sql_log_off_func-master.opt b/mysql-test/suite/sys_vars/t/sql_log_off_func-master.opt
new file mode 100644
index 00000000..875ecc54
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sql_log_off_func-master.opt
@@ -0,0 +1 @@
+--general-log --log-output=TABLE,FILE
diff --git a/mysql-test/suite/sys_vars/t/sql_log_off_func.test b/mysql-test/suite/sys_vars/t/sql_log_off_func.test
new file mode 100644
index 00000000..3c5c189b
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sql_log_off_func.test
@@ -0,0 +1,107 @@
+############# mysql-test\t\sql_log_off_func.test ##########################
+# #
+# Variable Name: sql_log_off #
+# Scope: SESSION #
+# Access Type: Dynamic #
+# Data Type: BOOLEAN #
+# Default Value: 0 FALSE #
+# Values: 1 TRUE, 0 FALSE #
+# #
+# #
+# Creation Date: 2008-02-25 #
+# Author: Sharique Abdullah #
+# #
+# Description: Test Cases of Dynamic System Variable "sql_log_off" #
+# that checks behavior of this variable in the following ways#
+# * Functionality based on different values #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html #
+# #
+###########################################################################
+
+--echo ** Setup **
+--echo
+#
+# Setup
+#
+
+SET @default_sql_log_off = @@sql_log_off;
+
+#
+# Create tables
+#
+
+CREATE TEMPORARY TABLE t1(a varchar(20), b varchar(20));
+
+INSERT INTO t1 VALUES('aa1','bb');
+INSERT INTO t1 VALUES('aa2','bb');
+INSERT INTO t1 VALUES('aa3','bb');
+INSERT INTO t1 VALUES('aa4','bb');
+INSERT INTO t1 VALUES('aa5','bb');
+
+--echo '#--------------------FN_DYNVARS_158_01-------------------------#'
+#
+# Value ON
+#
+
+SET SESSION sql_log_off = ON;
+
+UPDATE t1 SET a = 'aa1-updated' WHERE a = 'aa1';
+
+--echo Checking if log contains the executed statement
+SELECT argument FROM mysql.general_log WHERE argument = 'UPDATE t1 SET a = \'aa1-updated\' WHERE a = \'aa1\'';
+
+--echo '#--------------------FN_DYNVARS_158_02-------------------------#'
+#
+# Value OFF
+#
+
+SET SESSION sql_log_off = OFF;
+
+# With ps-protocol the UPDATE is executed twice
+--disable_ps_protocol
+UPDATE t1 SET a = 'aa1' WHERE a = 'aa1-updated';
+--enable_ps_protocol
+
+--echo Checking if log contains the executed statement
+SELECT argument FROM mysql.general_log WHERE argument = 'UPDATE t1 SET a = \'aa1\' WHERE a = \'aa1-updated\'';
+
+--echo '#--------------------FN_DYNVARS_158_03--------------------------#'
+#
+# Session data integrity check
+#
+connect (con_int1,localhost,root,,);
+
+connection con_int1;
+SELECT @@SESSION.sql_log_off;
+--echo 0 / FALSE Expected
+
+SET SESSION sql_log_off = FALSE;
+connect (con_int2,localhost,root,,);
+
+connection con_int2;
+SELECT @@SESSION.sql_log_off;
+--echo 0 / FALSE Expected
+
+SET SESSION sql_log_off = TRUE;
+
+connection con_int2;
+SELECT @@SESSION.sql_log_off;
+--echo 1 / TRUE Expected
+
+connection con_int1;
+SELECT @@SESSION.sql_log_off;
+--echo 0 / FALSE Expected
+
+connection default;
+disconnect con_int1;
+disconnect con_int2;
+
+
+#
+# Cleanup
+#
+
+SET SESSION sql_log_off = @default_sql_log_off;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/sys_vars/t/sql_low_priority_updates_func.test b/mysql-test/suite/sys_vars/t/sql_low_priority_updates_func.test
new file mode 100644
index 00000000..b8f6d955
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sql_low_priority_updates_func.test
@@ -0,0 +1,224 @@
+################################################################################
+# #
+# Variable Name: sql_low_priority_updates #
+# Scope: GLOBAL & SESSION #
+# Access Type: Dynamic #
+# Data Type: BOOLEAN #
+# Default Value: 1 TRUE #
+# Values: 1 TRUE, 0 FALSE #
+# #
+# #
+# Creation Date: 2008-02-25 #
+# Author: Sharique Abdullah #
+# #
+# Description: Test Cases of Dynamic System Variable sql_low_priority_updates #
+# that checks behavior of this variable in the following ways #
+# * Functionality based on different values #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html #
+# #
+################################################################################
+
+--source include/not_embedded.inc
+
+################################################################
+# sql_low_priority_updates was renamed to low_priority_updates #
+################################################################
+
+--echo ** Setup **
+--echo
+#
+# Setup
+#
+connect (con0,localhost,root,,);
+connect (con1,localhost,root,,);
+
+connection default;
+
+SET @global_low_priority_updates = @@GLOBAL.low_priority_updates;
+SET @session_low_priority_updates = @@SESSION.low_priority_updates;
+
+#
+# Create Table
+#
+
+CREATE TABLE t1 (a varchar(100));
+create view v1 as select * from t1;
+
+--echo '#--------------------FN_DYNVARS_160_01-------------------------#'
+#
+# Value ON
+#
+
+connection con0;
+SET SESSION low_priority_updates = ON;
+connection con1;
+SET SESSION low_priority_updates = ON;
+connection default;
+SET SESSION low_priority_updates = ON;
+
+INSERT INTO t1 VALUES('1');
+INSERT INTO t1 VALUES('2');
+INSERT INTO t1 VALUES('3');
+INSERT INTO t1 VALUES('4');
+INSERT INTO t1 VALUES('5');
+INSERT INTO t1 VALUES('6');
+
+LOCK TABLE v1 WRITE CONCURRENT;
+
+connection con1;
+
+--echo ** Asynchronous Execution **
+delimiter |;
+
+send
+UPDATE t1 SET a = CONCAT(a,"-updated");|
+
+delimiter ;|
+
+connection con0;
+
+let $wait_condition = SELECT COUNT(*) > 0 FROM information_schema.processlist
+ WHERE state='Waiting for table level lock' AND
+ info LIKE 'UPDATE t1 SET a = CONCAT(a,"-updated")';
+--source include/wait_condition.inc
+
+--echo ** Asynchronous Execution **
+delimiter |;
+
+send
+LOCK TABLE t1 READ;
+SELECT * FROM t1;
+UNLOCK TABLES;|
+
+delimiter ;|
+
+connection default;
+
+let $wait_condition= SELECT count(*) = 2 FROM information_schema.processlist
+ WHERE state LIKE 'Waiting for table level lock';
+--source include/wait_condition.inc
+UNLOCK TABLES;
+
+connection con0;
+--echo ** Asynchronous Result **
+reap;
+
+--echo Expected values of a without -updated;
+
+connection default;
+
+DELETE FROM t1;
+
+--echo '#--------------------FN_DYNVARS_160_02-------------------------#'
+#
+# Value ON
+#
+
+connection con0;
+SET SESSION low_priority_updates = OFF;
+connection con1;
+reap;
+SET SESSION low_priority_updates = OFF;
+connection default;
+SET SESSION low_priority_updates = OFF;
+
+INSERT INTO t1 VALUES('1');
+INSERT INTO t1 VALUES('2');
+INSERT INTO t1 VALUES('3');
+INSERT INTO t1 VALUES('4');
+INSERT INTO t1 VALUES('5');
+INSERT INTO t1 VALUES('6');
+
+LOCK TABLE v1 READ;
+
+connection con1;
+
+--echo ** Asynchronous Execution **
+delimiter |;
+
+send
+UPDATE t1 SET a = CONCAT(a,"-updated");|
+
+delimiter ;|
+
+connection con0;
+
+let $wait_condition = SELECT COUNT(*) > 0 FROM information_schema.processlist
+ WHERE state='Waiting for table level lock' AND
+ info LIKE 'UPDATE t1 SET a = CONCAT(a,"-updated")';
+--source include/wait_condition.inc
+
+--echo ** Asynchronous Execution **
+delimiter |;
+
+send
+LOCK TABLE t1 READ;
+SELECT * FROM t1;
+UNLOCK TABLES;|
+
+delimiter ;|
+
+connection default;
+
+let $wait_condition= SELECT count(*) = 2 FROM information_schema.processlist
+ WHERE state LIKE 'Waiting for table level lock';
+--source include/wait_condition.inc
+UNLOCK TABLES;
+
+connection con0;
+--echo ** Asynchronous Result **
+reap;
+--echo Expected values of a with -updated;
+
+connection default;
+
+DELETE FROM t1;
+
+--echo '#--------------------FN_DYNVARS_160_03-------------------------#'
+#
+# Session data integrity check & GLOBAL Value check
+#
+
+connect (con_int1,localhost,root,,);
+
+connection con_int1;
+SELECT @@SESSION.low_priority_updates;
+--echo 1 / TRUE Expected
+
+SET SESSION low_priority_updates = FALSE;
+
+connect (con_int2,localhost,root,,);
+
+connection con_int2;
+SELECT @@SESSION.low_priority_updates;
+--echo 1 / TRUE Expected
+
+SET SESSION low_priority_updates = TRUE;
+
+connection con_int1;
+SELECT @@SESSION.low_priority_updates;
+--echo 0 / FALSE Expected
+
+connection con_int2;
+SELECT @@SESSION.low_priority_updates;
+--echo 1 / TRUE Expected
+
+connection default;
+
+disconnect con_int1;
+disconnect con_int2;
+
+#
+# Cleanup
+#
+
+connection default;
+disconnect con0;
+disconnect con1;
+
+drop view v1;
+DROP TABLE t1;
+
+SET @@GLOBAL.low_priority_updates = @global_low_priority_updates;
+SET @@SESSION.low_priority_updates = @session_low_priority_updates;
diff --git a/mysql-test/suite/sys_vars/t/sql_mode_basic.test b/mysql-test/suite/sys_vars/t/sql_mode_basic.test
new file mode 100644
index 00000000..68be8ba9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sql_mode_basic.test
@@ -0,0 +1,388 @@
+#################### mysql-test\t\sql_mode_basic.test #########################
+# #
+# Variable Name: sql_mode #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: enumeration #
+# Default Value: YES #
+# Valid Values : ANSI, STRICT_TRANS_TABLES, TRADITIONAL, #
+# ERROR_FOR_DIVISION_BY_ZERO, ANSI_QUOTES, HIGH_NOT_PRECEDENCE,#
+# IGNORE_SPACE, NO_AUTO_CREATE_USER, ONLY_FULL_GROUP_BY, #
+# NO_AUTO_VALUE_ON_ZERO,NO_BACKSLASH_ESCAPES, #
+# NO_UNSIGNED_SUBTRACTION, OFF #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable sql_mode #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+################################################################
+# START OF sql_mode TESTS #
+################################################################
+
+
+###################################################################
+# Saving initial value of sql_mode in a temporary variable #
+###################################################################
+
+SET @global_start_value = @@global.sql_mode;
+SELECT @global_start_value;
+
+SET @session_start_value = @@session.sql_mode;
+SELECT @session_start_value;
+
+--echo '#--------------------FN_DYNVARS_152_01------------------------#'
+################################################################
+# Display the DEFAULT value of sql_mode #
+################################################################
+
+SET @@global.sql_mode = ANSI;
+SET @@global.sql_mode = DEFAULT;
+SELECT @@global.sql_mode;
+
+SET @@session.sql_mode = ANSI;
+SET @@session.sql_mode = DEFAULT;
+SELECT @@session.sql_mode;
+
+--echo '#---------------------FN_DYNVARS_152_02-------------------------#'
+#########################################################
+# Check if NULL or empty value is accepeted #
+#########################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.sql_mode = NULL;
+
+# resets sql mode to nothing
+SET @@global.sql_mode = '';
+SELECT @@global.sql_mode;
+
+SET @@global.sql_mode = ' ';
+SELECT @@global.sql_mode;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_mode = NULL;
+
+SET @@session.sql_mode = '';
+SELECT @@session.sql_mode;
+
+SET @@session.sql_mode = ' ';
+SELECT @@session.sql_mode;
+
+
+--echo '#--------------------FN_DYNVARS_152_03------------------------#'
+########################################################################
+# Change the value of sql_mode to a valid value #
+########################################################################
+
+# sql modes ref: http://dev.mysql.com/doc/refman/5.1/en/server-sql-mode.html
+
+# check valid values for global
+
+SET @@global.sql_mode = ANSI;
+SELECT @@global.sql_mode;
+SET @@global.sql_mode = STRICT_TRANS_TABLES;
+SELECT @@global.sql_mode;
+SET @@global.sql_mode = TRADITIONAL;
+SELECT @@global.sql_mode;
+SET @@global.sql_mode = ALLOW_INVALID_DATES;
+SELECT @@global.sql_mode;
+SET @@global.sql_mode = ANSI_QUOTES;
+SELECT @@global.sql_mode;
+SET @@global.sql_mode = ERROR_FOR_DIVISION_BY_ZERO;
+SELECT @@global.sql_mode;
+SET @@global.sql_mode = HIGH_NOT_PRECEDENCE;
+SELECT @@global.sql_mode;
+SET @@global.sql_mode = IGNORE_SPACE;
+SELECT @@global.sql_mode;
+SET @@global.sql_mode = NO_AUTO_CREATE_USER;
+SELECT @@global.sql_mode;
+SET @@global.sql_mode = NO_AUTO_VALUE_ON_ZERO;
+SELECT @@global.sql_mode;
+SET @@global.sql_mode = NO_BACKSLASH_ESCAPES;
+SELECT @@global.sql_mode;
+SET @@global.sql_mode = NO_DIR_IN_CREATE;
+SELECT @@global.sql_mode;
+SET @@global.sql_mode = NO_ENGINE_SUBSTITUTION;
+SELECT @@global.sql_mode;
+SET @@global.sql_mode = NO_FIELD_OPTIONS;
+SELECT @@global.sql_mode;
+SET @@global.sql_mode = NO_KEY_OPTIONS;
+SELECT @@global.sql_mode;
+SET @@global.sql_mode = NO_TABLE_OPTIONS;
+SELECT @@global.sql_mode;
+SET @@global.sql_mode = NO_UNSIGNED_SUBTRACTION;
+SELECT @@global.sql_mode;
+SET @@global.sql_mode = NO_ZERO_DATE;
+SELECT @@global.sql_mode;
+SET @@global.sql_mode = NO_ZERO_IN_DATE;
+SELECT @@global.sql_mode;
+SET @@global.sql_mode = ONLY_FULL_GROUP_BY;
+SELECT @@global.sql_mode;
+SET @@global.sql_mode = PIPES_AS_CONCAT;
+SELECT @@global.sql_mode;
+SET @@global.sql_mode = REAL_AS_FLOAT;
+SELECT @@global.sql_mode;
+SET @@global.sql_mode = STRICT_ALL_TABLES;
+SELECT @@global.sql_mode;
+SET @@global.sql_mode = STRICT_TRANS_TABLES;
+SELECT @@global.sql_mode;
+SET @@global.sql_mode = DB2;
+SELECT @@global.sql_mode;
+SET @@global.sql_mode = MAXDB;
+SELECT @@global.sql_mode;
+SET @@global.sql_mode = MSSQL;
+SELECT @@global.sql_mode;
+SET @@global.sql_mode = MYSQL323;
+SELECT @@global.sql_mode;
+SET @@global.sql_mode = MYSQL40;
+SELECT @@global.sql_mode;
+SET @@global.sql_mode = ORACLE;
+SELECT @@global.sql_mode;
+SET @@global.sql_mode = POSTGRESQL;
+SELECT @@global.sql_mode;
+SET @@global.sql_mode = TRADITIONAL;
+SELECT @@global.sql_mode;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.sql_mode = OFF;
+
+#check valid values for session
+SET @@session.sql_mode = ANSI;
+SELECT @@session.sql_mode;
+SET @@session.sql_mode = STRICT_TRANS_TABLES;
+SELECT @@session.sql_mode;
+SET @@session.sql_mode = TRADITIONAL;
+SELECT @@session.sql_mode;
+SET @@session.sql_mode = ALLOW_INVALID_DATES;
+SELECT @@session.sql_mode;
+SET @@session.sql_mode = ANSI_QUOTES;
+SELECT @@session.sql_mode;
+SET @@session.sql_mode = ERROR_FOR_DIVISION_BY_ZERO;
+SELECT @@session.sql_mode;
+SET @@session.sql_mode = HIGH_NOT_PRECEDENCE;
+SELECT @@session.sql_mode;
+SET @@session.sql_mode = IGNORE_SPACE;
+SELECT @@session.sql_mode;
+SET @@session.sql_mode = NO_AUTO_CREATE_USER;
+SELECT @@session.sql_mode;
+SET @@session.sql_mode = NO_AUTO_VALUE_ON_ZERO;
+SELECT @@session.sql_mode;
+SET @@session.sql_mode = NO_BACKSLASH_ESCAPES;
+SELECT @@session.sql_mode;
+SET @@session.sql_mode = NO_DIR_IN_CREATE;
+SELECT @@session.sql_mode;
+SET @@session.sql_mode = NO_ENGINE_SUBSTITUTION;
+SELECT @@session.sql_mode;
+SET @@session.sql_mode = NO_FIELD_OPTIONS;
+SELECT @@session.sql_mode;
+SET @@session.sql_mode = NO_KEY_OPTIONS;
+SELECT @@session.sql_mode;
+SET @@session.sql_mode = NO_TABLE_OPTIONS;
+SELECT @@session.sql_mode;
+SET @@session.sql_mode = NO_UNSIGNED_SUBTRACTION;
+SELECT @@session.sql_mode;
+SET @@session.sql_mode = NO_ZERO_DATE;
+SELECT @@session.sql_mode;
+SET @@session.sql_mode = NO_ZERO_IN_DATE;
+SELECT @@session.sql_mode;
+SET @@session.sql_mode = ONLY_FULL_GROUP_BY;
+SELECT @@session.sql_mode;
+SET @@session.sql_mode = PIPES_AS_CONCAT;
+SELECT @@session.sql_mode;
+SET @@session.sql_mode = REAL_AS_FLOAT;
+SELECT @@session.sql_mode;
+SET @@session.sql_mode = STRICT_ALL_TABLES;
+SELECT @@session.sql_mode;
+SET @@session.sql_mode = STRICT_TRANS_TABLES;
+SELECT @@session.sql_mode;
+SET @@session.sql_mode = DB2;
+SELECT @@session.sql_mode;
+SET @@session.sql_mode = MAXDB;
+SELECT @@session.sql_mode;
+SET @@session.sql_mode = MSSQL;
+SELECT @@session.sql_mode;
+SET @@session.sql_mode = MYSQL323;
+SELECT @@session.sql_mode;
+SET @@session.sql_mode = MYSQL40;
+SELECT @@session.sql_mode;
+SET @@session.sql_mode = ORACLE;
+SELECT @@session.sql_mode;
+SET @@session.sql_mode = POSTGRESQL;
+SELECT @@session.sql_mode;
+SET @@session.sql_mode = TRADITIONAL;
+SELECT @@session.sql_mode;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_mode = OFF;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.sql_mode = '?';
+SELECT @@global.sql_mode;
+
+--echo '#--------------------FN_DYNVARS_152_04-------------------------#'
+###########################################################################
+# Change the value of sql_mode to invalid value #
+###########################################################################
+
+# invalid values for global
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.sql_mode = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.sql_mode = ASCII;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.sql_mode = NON_TRADITIONAL;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.sql_mode = 'OF';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.sql_mode = NONE;
+--Error ER_WRONG_VALUE_FOR_VAR
+
+#invalid values for session
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_mode = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_mode = ANSI_SINGLE_QUOTES;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_mode = 'ON';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_mode = 'OF';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_mode = DISABLE;
+
+
+--echo '#-------------------FN_DYNVARS_152_05----------------------------#'
+#########################################################################
+# Check if the value in session Table matches value in variable #
+#########################################################################
+
+SELECT @@session.sql_mode = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='sql_mode';
+
+--echo '#----------------------FN_DYNVARS_152_06------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#########################################################################
+
+SELECT @@global.sql_mode = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='sql_mode';
+
+
+--echo '#---------------------FN_DYNVARS_152_07-------------------------#'
+###################################################################
+# Check if numbers can be used on variable #
+###################################################################
+
+# test if variable accepts 0,1,2
+SET @@global.sql_mode = 0;
+SELECT @@global.sql_mode;
+
+SET @@global.sql_mode = 1;
+SELECT @@global.sql_mode;
+
+SET @@global.sql_mode = 2;
+SELECT @@global.sql_mode;
+
+SET @@global.sql_mode = 3;
+SELECT @@global.sql_mode;
+
+SET @@global.sql_mode = 50000;
+SELECT @@global.sql_mode;
+
+SET @@global.sql_mode = 500000;
+SELECT @@global.sql_mode;
+
+SET @@global.sql_mode = 17179869183;
+SELECT @@global.sql_mode;
+
+SET @@global.sql_mode = 17179869184;
+SELECT @@global.sql_mode;
+
+SET @@global.sql_mode = 34359738367;
+SELECT @@global.sql_mode;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.sql_mode = 34359738368;
+
+# use of decimal values
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.sql_mode = 0.4;
+
+--echo '#---------------------FN_DYNVARS_152_08----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.sql_mode = TRUE;
+SELECT @@global.sql_mode;
+SET @@global.sql_mode = FALSE;
+SELECT @@global.sql_mode;
+
+--echo '#---------------------FN_DYNVARS_152_09----------------------#'
+#########################################################################
+# Check if sql_mode can be accessed with and without @@ sign #
+#########################################################################
+
+
+SET sql_mode = 'ANSI';
+
+SET session sql_mode = 1;
+SELECT @@sql_mode;
+
+SET global sql_mode = 0;
+SELECT @@global.sql_mode;
+
+--echo '#---------------------FN_DYNVARS_152_10----------------------#'
+#######################################################################
+# Check if sql_mode values can be combined as specified #
+#######################################################################
+
+SET @@session.sql_mode = 'TRADITIONAL,ALLOW_INVALID_DATES,ANSI_QUOTES';
+SELECT @@session.sql_mode;
+
+SET @@global.sql_mode = 'ONLY_FULL_GROUP_BY,PIPES_AS_CONCAT,REAL_AS_FLOAT,ORACLE,POSTGRESQL';
+SELECT @@global.sql_mode;
+
+#try combining invalid mode with correct mode
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_mode = 'ERROR_FOR_DIVISION_BY_ZERO,FOOBAR,IGNORE_SPACE';
+
+#zero-length values are ok
+SET @@sql_mode=',';
+SELECT @@sql_mode;
+SET @@sql_mode=',,,,ANSI_QUOTES,,,';
+SELECT @@sql_mode;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@sql_mode=',,,,FOOBAR,,,,,';
+SELECT @@sql_mode;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.sql_mode = @global_start_value;
+SELECT @@global.sql_mode;
+
+SET @@session.sql_mode = @session_start_value;
+SELECT @@session.sql_mode;
+
+################################################################
+# END OF sql_mode TESTS #
+################################################################
+
diff --git a/mysql-test/suite/sys_vars/t/sql_mode_func.test b/mysql-test/suite/sys_vars/t/sql_mode_func.test
new file mode 100644
index 00000000..5a5aca91
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sql_mode_func.test
@@ -0,0 +1,192 @@
+############# mysql-test\t\sql_mode_func.test ######################################
+# #
+# Variable Name: sql_mode #
+# Scope: GLOBAL & SESSION #
+# Access Type: Dynamic #
+# Data Type: enumeration #
+# Values: ALLOW_INVALID_DATES, ANSI_QUOTES, ERROR_FOR_DIVISION_BY_ZERO, #
+# HIGH_NOT_PRECEDENCE, IGNORE_SPACE, NO_AUTO_CREATE_USER, #
+# NO_AUTO_VALUE_ON_ZERO, NO_BACKSLASH_ESCAPES, NO_DIR_IN_CREATE, #
+# NO_ENGINE_SUBSTITUTION, NO_FIELD_OPTIONS, NO_KEY_OPTIONS, #
+# NO_TABLE_OPTIONS, NO_UNSIGNED_SUBTRACTION, NO_ZERO_DATE, #
+# NO_ZERO_IN_DATE, ONLY_FULL_GROUP_BY, PIPES_AS_CONCAT, REAL_AS_FLOAT#
+# STRICT_ALL_TABLES, STRICT_TRANS_TABLES, OFF #
+# #
+# #
+# Creation Date: 2008-02-22 #
+# Author: Sharique Abdullah #
+# #
+# Description: Test Cases of Dynamic System Variable "sql_mode" #
+# that checks behavior of this variable in the following ways #
+# * Functionality based on different values #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_sql_mode #
+# #
+####################################################################################
+
+--echo ** Setup **
+--echo
+#
+# Setup
+#
+
+#
+# Save initial value
+#
+
+SET @sql_mode_session = @@SESSION.sql_mode;
+SET @sql_mode_global = @@GLOBAL.sql_mode;
+
+#
+# Create tables
+#
+
+CREATE TEMPORARY TABLE t1(a varchar(20) not null, b varchar(20));
+CREATE TEMPORARY TABLE t2(a varchar(20) null, b varchar(20));
+
+--echo '#--------------------FN_DYNVARS_153_01-------------------------#'
+#
+#ANSI mode
+#
+--echo ANSI mode
+
+
+SET SESSION sql_mode = ANSI;
+
+SELECT @@SESSION.sql_mode;
+
+INSERT INTO t1 VALUES('t1a1','t1b1');
+INSERT INTO t1 VALUES('t1a2','t1b2');
+INSERT INTO t1 VALUES('t1a3','t1b3');
+INSERT INTO t1 VALUES('t1a4','t1b4');
+
+INSERT INTO t2 VALUES('t2a1','t2b1');
+INSERT INTO t2 VALUES('t2a2','t2b2');
+INSERT INTO t2 VALUES('t2a3','t2b3');
+INSERT INTO t2 VALUES('t2a4','t2b4');
+
+--error ER_INVALID_GROUP_FUNC_USE
+SELECT * FROM t1 WHERE t1.a IN (SELECT MAX(t1.b) FROM t2);
+--echo Expected error for invalid group function
+
+#
+# Reset
+#
+
+SET SESSION sql_mode = @sql_mode_session;
+SET GLOBAL sql_mode = @sql_mode_global;
+
+--echo '#--------------------FN_DYNVARS_153_02-------------------------#'
+#
+#STRICT_TRANS_TABLES mode
+#
+--echo STRICT_TRANS_TABLES mode
+
+DELETE FROM t1;
+DELETE FROM t2;
+
+SET SESSION sql_mode = STRICT_TRANS_TABLES;
+
+SELECT @@SESSION.sql_mode;
+
+INSERT INTO t1 VALUES('t1a1','t1b1');
+INSERT INTO t1 VALUES('t1a2','t1b2');
+INSERT INTO t1 VALUES('t1a3','t1b3');
+INSERT INTO t1 VALUES('t1a4','t1b4');
+
+INSERT INTO t2 VALUES(NULL,'t2b1');
+INSERT INTO t2 VALUES('t2a2','t2b2');
+INSERT INTO t2 VALUES('t2a3','t2b3');
+INSERT INTO t2 VALUES('t2a4','t2b4');
+
+--error ER_BAD_NULL_ERROR
+INSERT INTO t1 SELECT * FROM t2;
+--echo Expected error Bad NULL value
+
+SELECT * FROM t1 WHERE a = 't2a2';
+--echo Should return no rows in columns a,b;
+
+#
+# Reset
+#
+
+SET SESSION sql_mode = @sql_mode_session;
+SET GLOBAL sql_mode = @sql_mode_global;
+
+--echo '#--------------------FN_DYNVARS_153_03-------------------------#'
+#
+#TRADITIONAL mode
+#
+--echo TRADITIONAL mode
+
+SET SESSION sql_mode = TRADITIONAL;
+
+SELECT @@SESSION.sql_mode;
+
+INSERT INTO t1 VALUES('t1a1','t1b1');
+INSERT INTO t1 VALUES('t1a2','t1b2');
+INSERT INTO t1 VALUES('t1a3','t1b3');
+INSERT INTO t1 VALUES('t1a4','t1b4');
+
+INSERT INTO t2 VALUES(NULL,'t2b1');
+INSERT INTO t2 VALUES('t2a2','t2b2');
+INSERT INTO t2 VALUES('t2a3','t2b3');
+INSERT INTO t2 VALUES('t2a4','t2b4');
+
+--error ER_BAD_NULL_ERROR
+INSERT INTO t1 SELECT * FROM t2;
+--echo Expected error Bad NULL value
+
+SELECT * FROM t1 WHERE a = 't2a2';
+--echo Should return no rows in columns a,b;
+
+
+--echo '#-------------------FN_DYNVARS_153_04-------------------------#'
+#
+# Session data integrity check & GLOBAL Value check
+#
+
+SET GLOBAL sql_mode = '';
+connect (con_int1,localhost,root,,);
+
+connection con_int1;
+SELECT @@SESSION.sql_mode;
+--echo '' Expected
+
+SET SESSION sql_mode = 'TRADITIONAL';
+
+connect (con_int2,localhost,root,,);
+
+connection con_int2;
+SELECT @@SESSION.sql_mode;
+--echo '' Expected
+
+SET SESSION sql_mode = 'ANSI';
+
+connection con_int2;
+SELECT @@SESSION.sql_mode;
+--echo 'REAL_AS_FLOAT, PIPES_AS_CONCAT, ANSI_QUOTES, IGNORE_SPACE, ANSI' Expected
+
+connection con_int1;
+SELECT @@SESSION.sql_mode;
+--echo 'STRICT_TRANS_TABLES, STRICT_ALL_TABLES, NO_ZERO_IN_DATE, NO_ZERO_DATE, ERROR_FOR_DIVISION_BY_ZERO, NO_AUTO_CREATE_USER, TRADITIONAL' Expected
+
+
+SELECT @@GLOBAL.sql_mode;
+--echo '' Expected
+
+connection default;
+
+disconnect con_int1;
+disconnect con_int2;
+
+#
+# Cleanup
+#
+
+SET SESSION sql_mode = @sql_mode_session;
+SET GLOBAL sql_mode = @sql_mode_global;
+
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/sys_vars/t/sql_notes_basic.test b/mysql-test/suite/sys_vars/t/sql_notes_basic.test
new file mode 100644
index 00000000..9af5fa35
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sql_notes_basic.test
@@ -0,0 +1,171 @@
+################### mysql-test\t\sql_notes_basic.test #########################
+# #
+# Variable Name: sql_notes #
+# Scope: SESSION #
+# Access Type: Dynamic #
+# Data Type: boolean #
+# Default Value: #
+# Valid Values: 0,1 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable sql_notes #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF sql_notes TESTS #
+########################################################################
+
+
+##############################################################################
+# Saving initial value of sql_notes in a temporary variable #
+##############################################################################
+
+SET @session_start_value = @@session.sql_notes;
+SELECT @session_start_value;
+
+
+--echo '#--------------------FN_DYNVARS_161_01------------------------#'
+######################################################################
+# Display the DEFAULT value of sql_notes #
+######################################################################
+
+SET @@session.sql_notes = 0;
+SET @@session.sql_notes = DEFAULT;
+SELECT @@session.sql_notes;
+
+SET @@session.sql_notes = 1;
+SET @@session.sql_notes = DEFAULT;
+SELECT @@session.sql_notes;
+
+
+--echo '#---------------------FN_DYNVARS_161_02-------------------------#'
+###########################################################################
+# Check if sql_notes can be accessed with and without @@ sign #
+###########################################################################
+
+SET sql_notes = 1;
+SELECT @@sql_notes;
+
+--Error ER_UNKNOWN_TABLE
+SELECT session.sql_notes;
+
+--Error ER_UNKNOWN_TABLE
+SELECT local.sql_notes;
+
+SET session sql_notes = 0;
+SELECT @@session.sql_notes;
+
+
+--echo '#--------------------FN_DYNVARS_161_03------------------------#'
+######################################################################
+# change the value of sql_notes to a valid value #
+######################################################################
+
+SET @@session.sql_notes = 0;
+SELECT @@session.sql_notes;
+SET @@session.sql_notes = 1;
+SELECT @@session.sql_notes;
+
+
+--echo '#--------------------FN_DYNVARS_161_04-------------------------#'
+#########################################################################
+# Change the value of sql_notes to invalid value #
+#########################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_notes = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_notes = 2;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_notes = "T";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_notes = "Y";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_notes = TRÜE;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_notes = ÕN;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_notes = OF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_notes = ÓFF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_notes = '¹';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_notes = NO;
+
+
+--echo '#-------------------FN_DYNVARS_161_05----------------------------#'
+#########################################################################
+# Test if accessing global sql_notes gives error #
+#########################################################################
+
+SET @@global.sql_notes = 1-@@global.sql_notes;
+SELECT @@global.sql_notes;
+SET @@global.sql_notes = 1-@@global.sql_notes;
+SELECT @@global.sql_notes;
+
+--echo '#----------------------FN_DYNVARS_161_06------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table contains variable value #
+#########################################################################
+
+SELECT count(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='sql_notes';
+
+--echo '#----------------------FN_DYNVARS_161_07------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#########################################################################
+
+SELECT IF(@@session.sql_notes, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='sql_notes';
+SELECT @@session.sql_notes;
+SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='sql_notes';
+
+--echo '#---------------------FN_DYNVARS_161_08-------------------------#'
+###################################################################
+# Check if ON and OFF values can be used on variable #
+###################################################################
+
+SET @@session.sql_notes = OFF;
+SELECT @@session.sql_notes;
+SET @@session.sql_notes = ON;
+SELECT @@session.sql_notes;
+
+--echo '#---------------------FN_DYNVARS_161_09----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@session.sql_notes = TRUE;
+SELECT @@session.sql_notes;
+SET @@session.sql_notes = FALSE;
+SELECT @@session.sql_notes;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@session.sql_notes = @session_start_value;
+SELECT @@session.sql_notes;
+
+#############################################################
+# END OF sql_notes TESTS #
+#############################################################
+
diff --git a/mysql-test/suite/sys_vars/t/sql_notes_func.test b/mysql-test/suite/sys_vars/t/sql_notes_func.test
new file mode 100644
index 00000000..737bd044
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sql_notes_func.test
@@ -0,0 +1,125 @@
+############# mysql-test\t\sql_notes_func.test ############################
+# #
+# Variable Name: sql_notes #
+# Scope: SESSION #
+# Access Type: Dynamic #
+# Data Type: BOOLEAN #
+# Default Value: 1 TRUE #
+# Values: 1 TRUE, 0 FALSE #
+# #
+# #
+# Creation Date: 2008-02-25 #
+# Author: Sharique Abdullah #
+# #
+# Description: Test Cases of Dynamic System Variable "sql_notes" #
+# that checks behavior of this variable in the following ways#
+# * Functionality based on different values #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html #
+# #
+###########################################################################
+
+# Due to suppressed warnings the pc-protocol is disabled
+--disable_ps_protocol
+
+--echo ** Setup **
+--echo
+#
+# Setup
+#
+
+SET @default_sql_notes = @@sql_notes;
+
+--echo '#--------------------FN_DYNVARS_162_01-------------------------#'
+#
+# Value ON
+#
+
+SET SESSION sql_notes = ON;
+
+--echo creating a temporary table
+CREATE TEMPORARY TABLE t1(a varchar(20), b varchar(20));
+--echo conditionally dropping the table twice so that a note generates
+
+DROP TABLE IF EXISTS t1;
+
+SELECT @@warning_count;
+--echo 0 Expected
+
+#
+#This line generates A Note warning
+#
+DROP TABLE IF EXISTS t1;
+
+SELECT @@warning_count;
+--echo 1 Expected
+
+--echo '#--------------------FN_DYNVARS_162_02-------------------------#'
+#
+# Value OFF
+#
+
+SET SESSION sql_notes = OFF;
+
+--echo creating a temporary table
+CREATE TEMPORARY TABLE t1(a varchar(20), b varchar(20));
+--echo conditionally dropping the table twice so that a note generates
+
+DROP TABLE IF EXISTS t1;
+
+SELECT @@warning_count;
+--echo 0 Expected
+
+#
+#This line generates A Note warning
+#
+DROP TABLE IF EXISTS t1;
+
+SELECT @@warning_count;
+--echo 0 Expected
+
+--echo '#------------------FN_DYNVARS_162_03---------------------------#'
+#
+# Session data integrity check & GLOBAL Value check
+#
+
+connect (con_int1,localhost,root,,);
+
+connection con_int1;
+SELECT @@SESSION.sql_notes;
+--echo 1 / TRUE Expected
+
+SET SESSION sql_notes = FALSE;
+
+connect (con_int2,localhost,root,,);
+
+connection con_int2;
+SELECT @@SESSION.sql_notes;
+--echo 1 / TRUE Expected
+
+SET SESSION sql_notes = TRUE;
+
+connection con_int2;
+SELECT @@SESSION.sql_notes;
+--echo 1 / TRUE Expected
+
+connection con_int1;
+SELECT @@SESSION.sql_notes;
+--echo 0 / FALSE Expected
+
+connection default;
+disconnect con_int1;
+disconnect con_int2;
+
+
+#
+# Cleanup
+#
+
+SET SESSION sql_notes = @default_sql_notes;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--enable_ps_protocol
diff --git a/mysql-test/suite/sys_vars/t/sql_quote_show_create_basic.test b/mysql-test/suite/sys_vars/t/sql_quote_show_create_basic.test
new file mode 100644
index 00000000..020b5f51
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sql_quote_show_create_basic.test
@@ -0,0 +1,171 @@
+############## mysql-test\t\sql_quote_show_create_basic.test ##################
+# #
+# Variable Name: sql_quote_show_create #
+# Scope: SESSION #
+# Access Type: Dynamic #
+# Data Type: boolean #
+# Default Value: #
+# Valid Values: 0,1 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable sql_quote_show_create #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+#######################################################################
+# START OF sql_quote_show_create TESTS #
+#######################################################################
+
+
+##############################################################################
+# Saving initial value of sql_quote_show_create in a temporary variable #
+##############################################################################
+
+SET @session_start_value = @@session.sql_quote_show_create;
+SELECT @session_start_value;
+
+--echo '#--------------------FN_DYNVARS_162_01------------------------#'
+######################################################################
+# Display the DEFAULT value of sql_quote_show_create #
+######################################################################
+
+SET @@session.sql_quote_show_create = 0;
+SET @@session.sql_quote_show_create = DEFAULT;
+SELECT @@session.sql_quote_show_create;
+
+SET @@session.sql_quote_show_create = 1;
+SET @@session.sql_quote_show_create = DEFAULT;
+SELECT @@session.sql_quote_show_create;
+
+
+--echo '#---------------------FN_DYNVARS_162_02-------------------------#'
+#############################################################################
+# Check if sql_quote_show_create can be accessed with and without @@ sign #
+#############################################################################
+
+SET sql_quote_show_create = 1;
+SELECT @@sql_quote_show_create;
+
+--Error ER_UNKNOWN_TABLE
+SELECT session.sql_quote_show_create;
+
+--Error ER_UNKNOWN_TABLE
+SELECT local.sql_quote_show_create;
+
+SET session sql_quote_show_create = 0;
+SELECT @@session.sql_quote_show_create;
+
+
+--echo '#--------------------FN_DYNVARS_162_03------------------------#'
+########################################################################
+# change the value of sql_quote_show_create to a valid value #
+########################################################################
+
+SET @@session.sql_quote_show_create = 0;
+SELECT @@session.sql_quote_show_create;
+SET @@session.sql_quote_show_create = 1;
+SELECT @@session.sql_quote_show_create;
+
+
+--echo '#--------------------FN_DYNVARS_162_04-------------------------#'
+##########################################################################
+# Change the value of sql_quote_show_create to invalid value #
+##########################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_quote_show_create = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_quote_show_create = 2;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_quote_show_create = "T";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_quote_show_create = "Y";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_quote_show_create = TRÜE;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_quote_show_create = ÕN;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_quote_show_create = OF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_quote_show_create = ÓFF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_quote_show_create = '¹';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_quote_show_create = NO;
+
+
+--echo '#-------------------FN_DYNVARS_162_05----------------------------#'
+##########################################################################
+# Test if accessing global sql_quote_show_create gives error #
+##########################################################################
+
+SET @@global.sql_quote_show_create = 1-@@global.sql_quote_show_create;
+SELECT @@global.sql_quote_show_create;
+SET @@global.sql_quote_show_create = 1-@@global.sql_quote_show_create;
+SELECT @@global.sql_quote_show_create;
+
+--echo '#----------------------FN_DYNVARS_162_06------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table contains variable value #
+#########################################################################
+
+SELECT count(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='sql_quote_show_create';
+
+--echo '#----------------------FN_DYNVARS_162_07------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#########################################################################
+
+SELECT IF(@@session.sql_quote_show_create, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='sql_quote_show_create';
+SELECT @@session.sql_quote_show_create;
+SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='sql_quote_show_create';
+
+--echo '#---------------------FN_DYNVARS_162_08-------------------------#'
+###################################################################
+# Check if ON and OFF values can be used on variable #
+###################################################################
+
+SET @@session.sql_quote_show_create = OFF;
+SELECT @@session.sql_quote_show_create;
+SET @@session.sql_quote_show_create = ON;
+SELECT @@session.sql_quote_show_create;
+
+--echo '#---------------------FN_DYNVARS_162_09----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@session.sql_quote_show_create = TRUE;
+SELECT @@session.sql_quote_show_create;
+SET @@session.sql_quote_show_create = FALSE;
+SELECT @@session.sql_quote_show_create;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@session.sql_quote_show_create = @session_start_value;
+SELECT @@session.sql_quote_show_create;
+
+###############################################################
+# END OF sql_quote_show_create TESTS #
+###############################################################
diff --git a/mysql-test/suite/sys_vars/t/sql_quote_show_create_func.test b/mysql-test/suite/sys_vars/t/sql_quote_show_create_func.test
new file mode 100644
index 00000000..28000618
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sql_quote_show_create_func.test
@@ -0,0 +1,106 @@
+############# mysql-test\t\sql_quote_show_create_func.test #################
+# #
+# Variable Name: sql_quote_show_create #
+# Scope: SESSION #
+# Access Type: Dynamic #
+# Data Type: BOOLEAN #
+# Default Value: 1 TRUE #
+# Values: 1 TRUE, 0 FALSE #
+# #
+# #
+# Creation Date: 2008-02-25 #
+# Author: Sharique Abdullah #
+# #
+# Description: Test Cases of Dynamic System Variable sql_quote_show_create#
+# that checks behavior of this variable in the following ways #
+# * Functionality based on different values #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html #
+# #
+############################################################################
+
+--echo ** Setup **
+--echo
+#
+# Setup
+#
+
+SET @default_sql_quote_show_create = @@sql_quote_show_create;
+
+#
+# Creating tables
+#
+
+CREATE TEMPORARY TABLE t1(a varchar(20), b varchar(20));
+
+--echo '#-----------------------------FN_DYNVARS_163_01------------------------------------#'
+#
+# Value TRUE
+#
+
+SET SESSION sql_quote_show_create = TRUE;
+
+SHOW CREATE DATABASE test;
+--echo EXPECTING identifiers test TO BE quoted like 'test'
+
+SHOW CREATE TABLE t1;
+--echo EXPECTING identifiers a, b, t1 TO BE quoted like 'a','b','t1'
+
+
+--echo '#-----------------------------FN_DYNVARS_163_02------------------------------------#'
+#
+# Value FALSE
+#
+
+SET SESSION sql_quote_show_create = FALSE;
+
+SHOW CREATE DATABASE test;
+--echo EXPECTING identifiers test NOT TO BE quoted like 'test'
+
+SHOW CREATE TABLE t1;
+--echo EXPECTING identifiers a, b, t1 NOT TO BE quoted like 'a','b','t1'
+
+--echo '#----------------------------FN_DYNVARS_163_03--------------------------------------#'
+#
+# Session data integrity check
+#
+
+connect (con_int1,localhost,root,,);
+
+connection con_int1;
+SELECT @@SESSION.sql_quote_show_create;
+--echo 1 / TRUE Expected
+
+SET SESSION sql_quote_show_create = FALSE;
+
+connect (con_int2,localhost,root,,);
+
+connection con_int2;
+SELECT @@SESSION.sql_quote_show_create;
+--echo 1 / TRUE Expected
+
+SET SESSION sql_quote_show_create = TRUE;
+
+connection con_int2;
+SELECT @@SESSION.sql_quote_show_create;
+--echo 1 / TRUE Expected
+
+connection con_int1;
+SELECT @@SESSION.sql_quote_show_create;
+--echo 0 / FALSE Expected
+
+connection default;
+
+disconnect con_int1;
+disconnect con_int2;
+
+
+#
+# Cleanup
+#
+--echo
+--echo Cleanup
+
+SET @@sql_quote_show_create = @default_sql_quote_show_create;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/sys_vars/t/sql_safe_updates_basic.test b/mysql-test/suite/sys_vars/t/sql_safe_updates_basic.test
new file mode 100644
index 00000000..66148b65
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sql_safe_updates_basic.test
@@ -0,0 +1,170 @@
+############## mysql-test\t\sql_safe_updates_basic.test #######################
+# #
+# Variable Name: sql_safe_updates #
+# Scope: SESSION #
+# Access Type: Dynamic #
+# Data Type: boolean #
+# Default Value: #
+# Range: 0,1 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable sql_safe_updates #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+########################################################################
+# START OF sql_safe_updates TESTS #
+########################################################################
+
+
+################################################################################
+# Saving initial value of sql_safe_updates in a temporary variable #
+################################################################################
+
+SET @session_start_value = @@session.sql_safe_updates;
+SELECT @session_start_value;
+
+--echo '#--------------------FN_DYNVARS_163_01------------------------#'
+########################################################################
+# Display the DEFAULT value of sql_safe_updates #
+########################################################################
+
+SET @@session.sql_safe_updates = 0;
+SET @@session.sql_safe_updates = DEFAULT;
+SELECT @@session.sql_safe_updates;
+
+SET @@session.sql_safe_updates = 1;
+SET @@session.sql_safe_updates = DEFAULT;
+SELECT @@session.sql_safe_updates;
+
+
+--echo '#---------------------FN_DYNVARS_163_02-------------------------#'
+#############################################################################
+# Check if sql_safe_updates can be accessed with and without @@ sign #
+#############################################################################
+
+SET sql_safe_updates = 1;
+SELECT @@sql_safe_updates;
+
+--Error ER_UNKNOWN_TABLE
+SELECT session.sql_safe_updates;
+
+--Error ER_UNKNOWN_TABLE
+SELECT local.sql_safe_updates;
+
+SET session sql_safe_updates = 0;
+SELECT @@session.sql_safe_updates;
+
+
+--echo '#--------------------FN_DYNVARS_163_03------------------------#'
+########################################################################
+# change the value of sql_safe_updates to a valid value #
+########################################################################
+
+SET @@session.sql_safe_updates = 0;
+SELECT @@session.sql_safe_updates;
+SET @@session.sql_safe_updates = 1;
+SELECT @@session.sql_safe_updates;
+
+
+--echo '#--------------------FN_DYNVARS_163_04-------------------------#'
+###########################################################################
+# Change the value of sql_safe_updates to invalid value #
+###########################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_safe_updates = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_safe_updates = 2;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_safe_updates = "T";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_safe_updates = "Y";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_safe_updates = TRÜE;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_safe_updates = ÕN;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_safe_updates = OF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_safe_updates = ÓFF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_safe_updates = '¹';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_safe_updates = NO;
+
+
+--echo '#-------------------FN_DYNVARS_163_05----------------------------#'
+###########################################################################
+# Test if accessing global sql_safe_updates gives error #
+###########################################################################
+
+SET @@global.sql_safe_updates = 1-@@global.sql_safe_updates;
+SELECT @@global.sql_safe_updates;
+SET @@global.sql_safe_updates = 1-@@global.sql_safe_updates;
+SELECT @@global.sql_safe_updates;
+
+--echo '#----------------------FN_DYNVARS_163_06------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table contains variable value #
+#########################################################################
+
+SELECT count(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='sql_safe_updates';
+
+--echo '#----------------------FN_DYNVARS_163_07------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#########################################################################
+
+SELECT IF(@@session.sql_safe_updates, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='sql_safe_updates';
+SELECT @@session.sql_safe_updates;
+SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='sql_safe_updates';
+
+--echo '#---------------------FN_DYNVARS_163_08-------------------------#'
+###################################################################
+# Check if ON and OFF values can be used on variable #
+###################################################################
+
+SET @@session.sql_safe_updates = OFF;
+SELECT @@session.sql_safe_updates;
+SET @@session.sql_safe_updates = ON;
+SELECT @@session.sql_safe_updates;
+
+--echo '#---------------------FN_DYNVARS_163_09----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@session.sql_safe_updates = TRUE;
+SELECT @@session.sql_safe_updates;
+SET @@session.sql_safe_updates = FALSE;
+SELECT @@session.sql_safe_updates;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@session.sql_safe_updates = @session_start_value;
+SELECT @@session.sql_safe_updates;
+
+###############################################################
+# END OF sql_safe_updates TESTS #
+###############################################################
diff --git a/mysql-test/suite/sys_vars/t/sql_safe_updates_func.test b/mysql-test/suite/sys_vars/t/sql_safe_updates_func.test
new file mode 100644
index 00000000..5643fb5c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sql_safe_updates_func.test
@@ -0,0 +1,194 @@
+############# mysql-test\t\sql_safe_updates_func.test #####################
+# #
+# Variable Name: sql_safe_updates #
+# Scope: SESSION #
+# Access Type: Dynamic #
+# Data Type: BOOLEAN #
+# Default Value: 1 TRUE #
+# Values: 1 TRUE, 0 FALSE #
+# #
+# #
+# Creation Date: 2008-02-25 #
+# Author: Sharique Abdullah #
+# #
+# Description: Test Cases of Dynamic System Variable "sql_safe_updates" #
+# that checks behavior of this variable in the following ways#
+# * Functionality based on different values #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html #
+# #
+###########################################################################
+
+--echo ** Setup **
+--echo
+#
+# Setup
+#
+
+SET @default_sql_safe_updates = @@sql_safe_updates;
+
+#
+# Creating tables
+#
+
+CREATE TEMPORARY TABLE t1(a int PRIMARY KEY, b varchar(20));
+
+INSERT INTO t1 VALUES(1, 'val1');
+INSERT INTO t1 VALUES(2, 'val2');
+INSERT INTO t1 VALUES(3, 'val3');
+INSERT INTO t1 VALUES(4, 'val4');
+INSERT INTO t1 VALUES(5, 'val5');
+INSERT INTO t1 VALUES(6, 'val6');
+INSERT INTO t1 VALUES(7, 'val7');
+INSERT INTO t1 VALUES(8, 'val8');
+INSERT INTO t1 VALUES(9, 'val9');
+
+
+
+--echo '#-----------------------------FN_DYNVARS_164_01------------------------------------#'
+--echo
+--echo Value ON
+--echo
+#
+# Value ON
+#
+
+SET SESSION sql_safe_updates = ON;
+
+--echo '#-----------------------------FN_DYNVARS_164_02------------------------------------#'
+#
+# Without WHERE Clause
+#
+--echo Expected error : Update without key in safe mode
+--error ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE
+DELETE FROM t1;
+SELECT * FROM t1;
+
+PREPARE stmt FROM 'DELETE FROM t1;';
+--echo Expected error : Update without key in safe mode
+--error ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+
+--echo '#-----------------------------FN_DYNVARS_164_03------------------------------------#'
+#
+# With a LIMIT Clause
+#
+--echo Expected error : Update without key in safe mode
+--error ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE
+DELETE FROM t1 LIMIT 2;
+SELECT * FROM t1;
+
+--echo '#-----------------------------FN_DYNVARS_164_04------------------------------------#'
+#
+# With a no key WHERE Clause
+#
+--echo Expected error : Update without key in safe mode
+--error ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE
+DELETE FROM t1 WHERE b='val1';
+SELECT * FROM t1;
+
+--echo '#-----------------------------FN_DYNVARS_164_05------------------------------------#'
+#
+# With a key WHERE Clause
+#
+--echo This one should work
+DELETE FROM t1 WHERE a=1;
+SELECT * FROM t1;
+
+--echo
+--echo Value OFF
+--echo
+#
+# Value OFF
+#
+
+SET SESSION sql_safe_updates = OFF;
+
+--echo '#-----------------------------FN_DYNVARS_164_06------------------------------------#'
+#
+# With a no key WHERE Clause
+#
+--echo This one should work
+DELETE FROM t1 WHERE b='val1';
+SELECT * FROM t1;
+
+--echo '#-----------------------------FN_DYNVARS_164_07------------------------------------#'
+#
+# With a key WHERE Clause
+#
+--echo This one should work
+DELETE FROM t1 WHERE a=1;
+SELECT * FROM t1;
+
+--echo '#-----------------------------FN_DYNVARS_164_08------------------------------------#'
+#
+# With a LIMIT Clause
+#
+--echo This one should work
+DELETE FROM t1 LIMIT 2;
+SELECT * FROM t1;
+
+--echo '#-----------------------------FN_DYNVARS_164_09------------------------------------#'
+#
+# Without WHERE Clause
+#
+--echo This one should work
+--echo DELETE FROM t1;
+--error ER_MIXING_NOT_ALLOWED
+#DELETE FROM t1;
+--echo Bug#35392 Unexpected error occurs in this statement Can't change size of the file
+--echo statement is remarked because the error is uncatchable by testing framework
+SELECT * FROM t1;
+
+PREPARE stmt FROM 'DELETE FROM t1;';
+--echo Expected error : Update without key in safe mode
+--error ER_MIXING_NOT_ALLOWED
+#EXECUTE stmt;
+--echo Bug#35392 Unexpected error occurs in this statement Can't change size of the file
+--echo statement is remarked because the error is uncatchable by testing framework
+DEALLOCATE PREPARE stmt;
+
+
+--echo '#----------------------------FN_DYNVARS_164_10--------------------------------------#'
+#
+# Session data integrity check
+#
+
+connect (con_int1,localhost,root,,);
+
+connection con_int1;
+SELECT @@SESSION.sql_safe_updates;
+--echo 0 / FALSE Expected
+
+SET SESSION sql_safe_updates = FALSE;
+
+connect (con_int2,localhost,root,,);
+
+connection con_int2;
+SELECT @@SESSION.sql_safe_updates;
+--echo 0 / FALSE Expected
+
+SET SESSION sql_safe_updates = TRUE;
+
+connection con_int2;
+SELECT @@SESSION.sql_safe_updates;
+--echo 1 / TRUE Expected
+
+connection con_int1;
+SELECT @@SESSION.sql_safe_updates;
+--echo 0 / FALSE Expected
+
+connection default;
+
+disconnect con_int1;
+disconnect con_int2;
+
+
+#
+# Cleanup
+#
+
+SET SESSION sql_safe_updates = @default_sql_safe_updates;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/sys_vars/t/sql_select_limit_basic.test b/mysql-test/suite/sys_vars/t/sql_select_limit_basic.test
new file mode 100644
index 00000000..c6bc5962
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sql_select_limit_basic.test
@@ -0,0 +1,42 @@
+
+#
+# 2010-01-10 OBN - Added check for I_S values after change of variable value
+#
+
+SET @start_global_value = @@global.sql_select_limit;
+SELECT @start_global_value;
+
+#
+# exists as global and session
+#
+select @@global.sql_select_limit;
+select @@session.sql_select_limit;
+show global variables like 'sql_select_limit';
+show session variables like 'sql_select_limit';
+select * from information_schema.global_variables where variable_name='sql_select_limit';
+select * from information_schema.session_variables where variable_name='sql_select_limit';
+
+#
+# show that it's writable
+#
+set global sql_select_limit=10;
+set session sql_select_limit=20;
+select @@global.sql_select_limit;
+select @@session.sql_select_limit;
+show global variables like 'sql_select_limit';
+show session variables like 'sql_select_limit';
+select * from information_schema.global_variables where variable_name='sql_select_limit';
+select * from information_schema.session_variables where variable_name='sql_select_limit';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global sql_select_limit=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global sql_select_limit=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global sql_select_limit="foo";
+
+SET @@global.sql_select_limit = @start_global_value;
+SELECT @@global.sql_select_limit;
diff --git a/mysql-test/suite/sys_vars/t/sql_select_limit_func.test b/mysql-test/suite/sys_vars/t/sql_select_limit_func.test
new file mode 100644
index 00000000..c818a4ce
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sql_select_limit_func.test
@@ -0,0 +1,209 @@
+############# mysql-test\t\sql_select_limit_func.test #####################
+# #
+# Variable Name: sql_select_limit #
+# Scope: GLOBAL, SESSION #
+# Access Type: Dynamic #
+# Data Type: NUMERIC #
+# Default Value: 4294967295 #
+# Values: 1-4294967295 #
+# #
+# #
+# Creation Date: 2008-02-25 #
+# Author: Sharique Abdullah #
+# #
+# Description: Test Cases of Dynamic System Variable "sql_select_limit" #
+# that checks behavior of this variable in the following ways#
+# * Functionality based on different values #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html #
+# #
+###########################################################################
+
+--echo ** Setup **
+--echo
+#
+# Setup
+#
+
+SET @session_sql_select_limit = @@SESSION.sql_select_limit;
+SET @global_sql_select_limit = @@GLOBAL.sql_select_limit;
+
+#
+# Creating tables
+#
+
+CREATE TEMPORARY TABLE t1(a int PRIMARY KEY, b varchar(20));
+CREATE TEMPORARY TABLE t2(a int PRIMARY KEY, b varchar(20));
+CREATE TEMPORARY TABLE t3(a int PRIMARY KEY, b varchar(20));
+
+INSERT INTO t1 VALUES(1, 'val1');
+INSERT INTO t1 VALUES(2, 'val2');
+INSERT INTO t1 VALUES(3, 'val3');
+INSERT INTO t1 VALUES(4, 'val4');
+INSERT INTO t1 VALUES(5, 'val5');
+INSERT INTO t1 VALUES(6, 'val6');
+INSERT INTO t1 VALUES(7, 'val7');
+INSERT INTO t1 VALUES(8, 'val8');
+INSERT INTO t1 VALUES(9, 'val9');
+
+INSERT INTO t2 VALUES(5, 'val5');
+INSERT INTO t2 VALUES(6, 'val6');
+INSERT INTO t2 VALUES(7, 'val7');
+INSERT INTO t2 VALUES(8, 'val8');
+INSERT INTO t2 VALUES(9, 'val9');
+
+
+
+--echo '#-----------------------------FN_DYNVARS_165_01-----------------#'
+--echo
+--echo Value DEFAULT
+--echo
+#
+# Value DEFAULT
+#
+
+--enable_info
+
+SET SESSION sql_select_limit = DEFAULT;
+
+SELECT * FROM t1;
+--echo Expecting affected rows: 9
+
+SELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.a;
+--echo Expecting affected rows: 5
+
+
+--echo '#-----------------------------FN_DYNVARS_165_02---------------#'
+#
+# Small value
+#
+
+SET SESSION sql_select_limit = 2;
+
+SELECT * FROM t1;
+--echo Expecting affected rows: 2
+
+SELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.a;
+--echo Expecting affected rows: 2
+
+SET SESSION sql_select_limit = 0;
+
+SELECT * FROM t1;
+--echo Expecting affected rows: 0
+
+SELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.a;
+--echo Expecting affected rows: 0
+
+--echo '#-----------------------------FN_DYNVARS_165_03---------------#'
+#
+# Small value with LIMIT Clause
+#
+
+SET SESSION sql_select_limit = 2;
+
+SELECT * FROM t1 LIMIT 4;
+--echo Expecting affected rows: 4
+
+SELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.a LIMIT 3;
+--echo Expecting affected rows: 3
+
+--echo '#-----------------------------FN_DYNVARS_165_04----------------#'
+#
+# Small value with Store procedure
+#
+
+SET SESSION sql_select_limit = 2;
+
+delimiter |;
+
+CREATE PROCEDURE TestProc()
+BEGIN
+ SELECT * FROM t1;
+END|
+delimiter ;|
+
+call TestProc();
+--echo Expecting affected rows: 9
+
+DROP PROCEDURE TestProc;
+
+delimiter |;
+
+CREATE PROCEDURE TestProc()
+BEGIN
+ SELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.a;
+END|
+delimiter ;|
+
+call TestProc();
+--echo Expecting affected rows: 5
+
+DROP PROCEDURE TestProc;
+
+--echo '#-----------------------------FN_DYNVARS_165_05-----------------#'
+#
+# Small value with Non result producing SELECT statements
+#
+
+SET SESSION sql_select_limit = 2;
+
+CREATE TEMPORARY TABLE t4(a int PRIMARY KEY, b varchar(20)) SELECT * FROM t2;
+--echo Expecting Records: 5
+
+INSERT INTO t3 SELECT * FROM t1;
+--echo Expecting Records: 9
+
+--echo '#-----------------------------FN_DYNVARS_165_06---------------------#'
+#
+# Session data integrity check & GLOBAL Value check
+#
+--disable_info
+
+SET GLOBAL sql_select_limit = 2;
+
+connect (con_int1,localhost,root,,);
+
+connection con_int1;
+SELECT @@SESSION.sql_select_limit;
+--echo 2 Expected
+
+SET SESSION sql_select_limit = 10;
+
+connect (con_int2,localhost,root,,);
+
+connection con_int2;
+SELECT @@SESSION.sql_select_limit;
+--echo 2 Expected
+
+SET SESSION sql_select_limit = 12;
+
+connection con_int2;
+SELECT @@SESSION.sql_select_limit;
+--echo 12 Expected
+
+connection con_int1;
+SELECT @@SESSION.sql_select_limit;
+--echo 10 Expected
+
+SELECT @@GLOBAL.sql_select_limit;
+--echo 2 Expected
+
+connection default;
+
+disconnect con_int1;
+disconnect con_int2;
+
+
+#
+# Cleanup
+#
+
+--disable_info
+
+SET @@SESSION.sql_select_limit = @session_sql_select_limit;
+SET @@GLOBAL.sql_select_limit = @global_sql_select_limit;
+
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
diff --git a/mysql-test/suite/sys_vars/t/sql_slave_skip_counter_basic.test b/mysql-test/suite/sys_vars/t/sql_slave_skip_counter_basic.test
new file mode 100644
index 00000000..e1ea74f3
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sql_slave_skip_counter_basic.test
@@ -0,0 +1,104 @@
+############## mysql-test\t\sql_slave_skip_counter_basic.test #################
+# #
+# Variable Name: sql_slave_skip_counter #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: #
+# Range: #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable sql_slave_skip_counter #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+# #
+# Modification date: 2012-09-30 #
+# With implementation of MDEV-253, the variable scope can be session #
+# #
+###############################################################################
+
+--source include/not_embedded.inc
+--source include/load_sysvars.inc
+
+################################################################
+# START OF sql_slave_skip_counter TESTS #
+################################################################
+
+--echo '#--------------------FN_DYNVARS_165_01-------------------------#'
+#############################################################
+# Try accessing initial value #
+#############################################################
+
+SET @start_global_value = @@global.sql_slave_skip_counter;
+SELECT @@global.sql_slave_skip_counter;
+
+--echo '#--------------------FN_DYNVARS_165_02-------------------------#'
+###################################################################
+# Try setting DEFAULT value to variable #
+###################################################################
+
+SET @@global.sql_slave_skip_counter = DEFAULT;
+
+--echo '#--------------------FN_DYNVARS_165_03-------------------------#'
+###################################################################
+# Try setting any valid value to variable #
+###################################################################
+
+SET @@global.sql_slave_skip_counter = 0;
+SET @@global.sql_slave_skip_counter = 5;
+SET @@global.sql_slave_skip_counter = 1024;
+SET @@global.sql_slave_skip_counter = 2147483648;
+SET @@global.sql_slave_skip_counter = 2147483648*2;
+SET @@global.sql_slave_skip_counter = 2147483648*2-1;
+SET @@global.sql_slave_skip_counter = 18446744065119617025;
+
+--echo '#--------------------FN_DYNVARS_165_03-------------------------#'
+###################################################################
+# Checking invalid value for variable #
+###################################################################
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.sql_slave_skip_counter = '5';
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.sql_slave_skip_counter = 5.5;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.sql_slave_skip_counter = -.5;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.sql_slave_skip_counter = -.0;
+
+
+--echo '#--------------------FN_DYNVARS_165_03-------------------------#'
+###################################################################
+# Try retrieving value from Information Schema #
+###################################################################
+
+SET @@global.sql_slave_skip_counter = 1024;
+SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='sql_slave_skip_counter';
+
+--echo '#--------------------FN_DYNVARS_165_03-------------------------#'
+###################################################################
+# Checking if variable is accessible with session scope #
+###################################################################
+
+SET @@sql_slave_skip_counter = 10;
+SET @@session.sql_slave_skip_counter = 12;
+SET @@local.sql_slave_skip_counter = 13;
+
+SET @@global.sql_slave_skip_counter = 0;
+########################################################
+# END OF sql_slave_skip_counter TESTS #
+########################################################
+
diff --git a/mysql-test/suite/sys_vars/t/sql_warnings_basic.test b/mysql-test/suite/sys_vars/t/sql_warnings_basic.test
new file mode 100644
index 00000000..ced58f96
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sql_warnings_basic.test
@@ -0,0 +1,174 @@
+################# mysql-test\t\sql_warnings_basic.test ########################
+# #
+# Variable Name: sql_warnings #
+# Scope: SESSION #
+# Access Type: Dynamic #
+# Data Type: boolean #
+# Default Value: #
+# Valid Values:0,1 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable sql_warnings #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+
+########################################################################
+# START OF sql_warnings TESTS #
+########################################################################
+
+
+##############################################################################
+# Saving initial value of sql_warnings in a temporary variable #
+##############################################################################
+
+SET @session_start_value = @@session.sql_warnings;
+SELECT @session_start_value;
+
+
+--echo '#--------------------FN_DYNVARS_166_01------------------------#'
+########################################################################
+# Display the DEFAULT value of sql_warnings #
+########################################################################
+
+SET @@session.sql_warnings = 0;
+SET @@session.sql_warnings = DEFAULT;
+SELECT @@session.sql_warnings;
+
+SET @@session.sql_warnings = 1;
+SET @@session.sql_warnings = DEFAULT;
+SELECT @@session.sql_warnings;
+
+
+--echo '#---------------------FN_DYNVARS_166_02-------------------------#'
+#############################################################################
+# Check if sql_warnings can be accessed with and without @@ sign #
+#############################################################################
+
+SET sql_warnings = 1;
+SELECT @@sql_warnings;
+
+--Error ER_UNKNOWN_TABLE
+SELECT session.sql_warnings;
+
+--Error ER_UNKNOWN_TABLE
+SELECT local.sql_warnings;
+
+SET session sql_warnings = 0;
+SELECT @@session.sql_warnings;
+
+
+--echo '#--------------------FN_DYNVARS_166_03------------------------#'
+########################################################################
+# change the value of sql_warnings to a valid value #
+########################################################################
+
+SET @@session.sql_warnings = 0;
+SELECT @@session.sql_warnings;
+SET @@session.sql_warnings = 1;
+SELECT @@session.sql_warnings;
+
+
+--echo '#--------------------FN_DYNVARS_166_04-------------------------#'
+###########################################################################
+# Change the value of sql_warnings to invalid value #
+###########################################################################
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.sql_warnings = 0.6;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_warnings = "T";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_warnings = "Y";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_warnings = TRÜE;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_warnings = ÕN;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_warnings = OF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_warnings = ÓFF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_warnings = '¹';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.sql_warnings = NO;
+
+
+--echo '#-------------------FN_DYNVARS_166_05----------------------------#'
+###########################################################################
+# Test if accessing global sql_warnings gives error #
+###########################################################################
+
+SET @@global.sql_warnings = 1-@@global.sql_warnings;
+SELECT @@global.sql_warnings;
+SET @@global.sql_warnings = 1-@@global.sql_warnings;
+SELECT @@global.sql_warnings;
+
+
+--echo '#----------------------FN_DYNVARS_166_06------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table contains variable value #
+#########################################################################
+
+SELECT count(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='sql_warnings';
+
+
+--echo '#----------------------FN_DYNVARS_166_07------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#########################################################################
+
+SELECT IF(@@session.sql_warnings, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='sql_warnings';
+SELECT @@session.sql_warnings;
+SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='sql_warnings';
+
+--echo '#---------------------FN_DYNVARS_166_08-------------------------#'
+###################################################################
+# Check if ON and OFF values can be used on variable #
+###################################################################
+
+SET @@session.sql_warnings = OFF;
+SELECT @@session.sql_warnings;
+SET @@session.sql_warnings = ON;
+SELECT @@session.sql_warnings;
+
+--echo '#---------------------FN_DYNVARS_166_09----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@session.sql_warnings = TRUE;
+SELECT @@session.sql_warnings;
+SET @@session.sql_warnings = FALSE;
+SELECT @@session.sql_warnings;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@session.sql_warnings = @session_start_value;
+SELECT @@session.sql_warnings;
+
+
+###############################################################
+# END OF sql_warnings TESTS #
+###############################################################
diff --git a/mysql-test/suite/sys_vars/t/sql_warnings_func.test b/mysql-test/suite/sys_vars/t/sql_warnings_func.test
new file mode 100644
index 00000000..8d6fafd1
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sql_warnings_func.test
@@ -0,0 +1,112 @@
+############# mysql-test\t\sql_warnings_func.test #########################
+# #
+# Variable Name: sql_warnings #
+# Scope: SESSION #
+# Access Type: Dynamic #
+# Data Type: BOOLEAN #
+# Default Value: FALSE 0 #
+# Values: TRUE 1, FALSE 0 #
+# #
+# #
+# Creation Date: 2008-03-02 #
+# Author: Sharique Abdullah #
+# #
+# Description: Test Cases of Dynamic System Variable "sql_warnings" #
+# that checks behavior of this variable in the following ways#
+# * Functionality based on different values #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html #
+# #
+###########################################################################
+
+--echo ** Setup **
+--echo
+#
+# Setup
+#
+
+SET @default_sql_warnings = @@sql_warnings;
+
+#
+# Creating tables
+#
+
+CREATE TEMPORARY TABLE t1(a varchar(5), b varchar(20));
+
+--enable_info
+--disable_warnings
+
+--echo '#-----------------------------FN_DYNVARS_167_01------------#'
+#
+# Value DEFAULT
+#
+SET @@sql_warnings = DEFAULT;
+
+INSERT IGNORE INTO t1 VALUES('abcdef', 'val1');
+
+--echo '#-----------------------------FN_DYNVARS_167_02------------------#'
+#
+# OFF value
+#
+
+SET @@sql_warnings = 0;
+
+INSERT IGNORE INTO t1 VALUES('abcdef', 'val1');
+
+--echo '#-----------------------------FN_DYNVARS_167_03---------------#'
+#
+# ON value
+#
+
+SET @@sql_warnings = 1;
+
+INSERT IGNORE INTO t1 VALUES('abcdef', 'val1');
+
+
+--echo '#----------------------------FN_DYNVARS_167_04---------------#'
+#
+# Session data integrity check Value check
+#
+
+--disable_info
+
+connect (con_int1,localhost,root,,);
+
+connection con_int1;
+SELECT @@SESSION.sql_warnings;
+--echo 0 / FALSE Expected
+
+SET SESSION sql_warnings = FALSE;
+
+connect (con_int2,localhost,root,,);
+
+connection con_int2;
+SELECT @@SESSION.sql_warnings;
+--echo 0 / FALSE Expected
+
+SET SESSION sql_warnings = TRUE;
+
+connection con_int2;
+SELECT @@SESSION.sql_warnings;
+--echo 1 / TRUE Expected
+
+connection con_int1;
+SELECT @@SESSION.sql_warnings;
+--echo 0 / FALSE Expected
+
+connection default;
+
+disconnect con_int1;
+disconnect con_int2;
+
+
+#
+# Cleanup
+#
+
+DROP TABLE t1;
+
+SET @@sql_warnings = @default_sql_warnings;
+
+--disable_info
+--enable_warnings
diff --git a/mysql-test/suite/sys_vars/t/ssl_ca_basic.test b/mysql-test/suite/sys_vars/t/ssl_ca_basic.test
new file mode 100644
index 00000000..e7a7d6f6
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/ssl_ca_basic.test
@@ -0,0 +1,102 @@
+
+
+################## mysql-test\t\ssl_ca_basic.test #############################
+# #
+# Variable Name: ssl_ca #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: filename #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable ssl_ca #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+-- source include/have_ssl_communication.inc
+
+--echo '#---------------------BS_STVARS_045_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.ssl_ca);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_045_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.ssl_ca=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.ssl_ca);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_045_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+SELECT @@GLOBAL.ssl_ca = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='ssl_ca';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.ssl_ca);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='ssl_ca';
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_045_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@ssl_ca = @@GLOBAL.ssl_ca;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_045_05----------------------#'
+################################################################################
+# Check if ssl_ca can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@ssl_ca);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.ssl_ca);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.ssl_ca);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.ssl_ca);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT ssl_ca = @@SESSION.ssl_ca;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/ssl_capath_basic.test b/mysql-test/suite/sys_vars/t/ssl_capath_basic.test
new file mode 100644
index 00000000..ece9fe99
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/ssl_capath_basic.test
@@ -0,0 +1,100 @@
+
+
+################## mysql-test\t\ssl_capath_basic.test #########################
+# #
+# Variable Name: ssl_capath #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: filename #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable ssl_capath #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--echo '#---------------------BS_STVARS_046_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.ssl_capath);
+--echo 0 Expected
+
+
+--echo '#---------------------BS_STVARS_046_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.ssl_capath=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.ssl_capath);
+--echo 0 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_046_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+SELECT @@GLOBAL.ssl_capath = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='ssl_capath';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.ssl_capath);
+--echo 0 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='ssl_capath';
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_046_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@ssl_capath = @@GLOBAL.ssl_capath;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_046_05----------------------#'
+################################################################################
+# Check if ssl_capath can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@ssl_capath);
+--echo 0 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.ssl_capath);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.ssl_capath);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.ssl_capath);
+--echo 0 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT ssl_capath = @@SESSION.ssl_capath;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/ssl_cert_basic.test b/mysql-test/suite/sys_vars/t/ssl_cert_basic.test
new file mode 100644
index 00000000..56d24c11
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/ssl_cert_basic.test
@@ -0,0 +1,102 @@
+
+
+################## mysql-test\t\ssl_cert_basic.test ###########################
+# #
+# Variable Name: ssl_cert #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: filename #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable ssl_cert #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+-- source include/have_ssl_communication.inc
+
+--echo '#---------------------BS_STVARS_047_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.ssl_cert);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_047_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.ssl_cert=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.ssl_cert);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_047_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+SELECT @@GLOBAL.ssl_cert = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='ssl_cert';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.ssl_cert);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='ssl_cert';
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_047_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@ssl_cert = @@GLOBAL.ssl_cert;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_047_05----------------------#'
+################################################################################
+# Check if ssl_cert can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@ssl_cert);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.ssl_cert);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.ssl_cert);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.ssl_cert);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT ssl_cert = @@SESSION.ssl_cert;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/ssl_cipher_basic.test b/mysql-test/suite/sys_vars/t/ssl_cipher_basic.test
new file mode 100644
index 00000000..c58b22da
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/ssl_cipher_basic.test
@@ -0,0 +1,100 @@
+
+
+################## mysql-test\t\ssl_cipher_basic.test #########################
+# #
+# Variable Name: ssl_cipher #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: filename #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable ssl_cipher #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--echo '#---------------------BS_STVARS_048_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.ssl_cipher);
+--echo 0 Expected
+
+
+--echo '#---------------------BS_STVARS_048_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.ssl_cipher=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.ssl_cipher);
+--echo 0 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_048_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+SELECT @@GLOBAL.ssl_cipher = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='ssl_cipher';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.ssl_cipher);
+--echo 0 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='ssl_cipher';
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_048_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@ssl_cipher = @@GLOBAL.ssl_cipher;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_048_05----------------------#'
+################################################################################
+# Check if ssl_cipher can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@ssl_cipher);
+--echo 0 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.ssl_cipher);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.ssl_cipher);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.ssl_cipher);
+--echo 0 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT ssl_cipher = @@SESSION.ssl_cipher;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/ssl_crl_basic.test b/mysql-test/suite/sys_vars/t/ssl_crl_basic.test
new file mode 100644
index 00000000..ec156491
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/ssl_crl_basic.test
@@ -0,0 +1,3 @@
+--echo # a simplified test to keep the suite happy.
+--echo # the real test is in main.
+select @@ssl_crl;
diff --git a/mysql-test/suite/sys_vars/t/ssl_crlpath_basic.test b/mysql-test/suite/sys_vars/t/ssl_crlpath_basic.test
new file mode 100644
index 00000000..c0d86010
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/ssl_crlpath_basic.test
@@ -0,0 +1,3 @@
+--echo # a simplified test to keep the suite happy.
+--echo # the real test is in main.
+select @@ssl_crlpath;
diff --git a/mysql-test/suite/sys_vars/t/ssl_key_basic.test b/mysql-test/suite/sys_vars/t/ssl_key_basic.test
new file mode 100644
index 00000000..8d755b46
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/ssl_key_basic.test
@@ -0,0 +1,102 @@
+
+
+################## mysql-test\t\ssl_key_basic.test ############################
+# #
+# Variable Name: ssl_key #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: filename #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable ssl_key #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+-- source include/have_ssl_communication.inc
+
+--echo '#---------------------BS_STVARS_049_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.ssl_key);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_049_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.ssl_key=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.ssl_key);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_049_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+SELECT @@GLOBAL.ssl_key = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='ssl_key';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.ssl_key);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='ssl_key';
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_049_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@ssl_key = @@GLOBAL.ssl_key;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_049_05----------------------#'
+################################################################################
+# Check if ssl_key can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@ssl_key);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.ssl_key);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.ssl_key);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.ssl_key);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT ssl_key = @@SESSION.ssl_key;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/storage_engine_basic-master.opt b/mysql-test/suite/sys_vars/t/storage_engine_basic-master.opt
new file mode 100644
index 00000000..48457b17
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/storage_engine_basic-master.opt
@@ -0,0 +1 @@
+--loose-innodb
diff --git a/mysql-test/suite/sys_vars/t/storage_engine_basic.test b/mysql-test/suite/sys_vars/t/storage_engine_basic.test
new file mode 100644
index 00000000..964166da
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/storage_engine_basic.test
@@ -0,0 +1,182 @@
+############## mysql-test\t\storage_engine_basic.test ##################
+# #
+# #
+# Creation Date: 2008-02-14 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable #
+# storage_engine that check behavior of this #
+# variable with valid values, invalid values, accessing #
+# variable with scope that is allowed and with scope that #
+# is now allowed. #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_storage_engine #
+# #
+########################################################################
+
+--source include/not_embedded.inc
+--source include/have_innodb.inc
+--source include/load_sysvars.inc
+
+######################################################################
+# START OF storage_engine TESTS #
+######################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.storage_engine;
+SET @start_session_value = @@session.storage_engine;
+
+
+--echo '#--------------------FN_DYNVARS_005_01-------------------------#'
+######################################################################
+# Display the DEFAULT value of storage_engine #
+######################################################################
+
+SET @@global.storage_engine = INNODB;
+SET @@global.storage_engine = DEFAULT;
+--replace_result MyISAM InnoDB
+SELECT @@global.storage_engine;
+
+SET @@session.storage_engine = INNODB;
+SET @@session.storage_engine = DEFAULT;
+--replace_result MyISAM InnoDB
+SELECT @@session.storage_engine;
+
+
+--echo '#--------------------FN_DYNVARS_005_02-------------------------#'
+########################################################################
+# Change the value of storage_engine to a valid value for GLOBAL Scope #
+########################################################################
+
+SET @@global.storage_engine = MYISAM;
+SELECT @@global.storage_engine;
+SET @@global.storage_engine = MERGE;
+SELECT @@global.storage_engine;
+SET @@global.storage_engine = MEMORY;
+SELECT @@global.storage_engine;
+SET @@global.storage_engine = INNODB;
+SELECT @@global.storage_engine;
+
+
+--echo '#--------------------FN_DYNVARS_005_03-------------------------#'
+#########################################################################
+# Change the value of storage_engine to a valid value for SESSION Scope #
+#########################################################################
+
+SET @@session.storage_engine = MYISAM;
+SELECT @@session.storage_engine;
+SET @@session.storage_engine = MERGE;
+SELECT @@session.storage_engine;
+SET @@session.storage_engine = MEMORY;
+SELECT @@session.storage_engine;
+SET @@session.storage_engine = INNODB;
+SELECT @@session.storage_engine;
+
+
+--echo '#------------------FN_DYNVARS_005_04-----------------------#'
+##################################################################
+# Change the value of storage_engine to an invalid value #
+##################################################################
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.storage_engine = 8199;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.storage_engine = NULL;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.storage_engine = -1024;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.storage_engine = 65530.34;
+
+--Error ER_UNKNOWN_STORAGE_ENGINE
+SET @@global.storage_engine = FILE;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.storage_engine = 8199;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.storage_engine = 65530.34;
+
+--Error ER_UNKNOWN_STORAGE_ENGINE
+SET @@session.storage_engine = RECORD;
+
+
+--echo '#------------------FN_DYNVARS_005_05-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT @@global.storage_engine =
+ VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='storage_engine';
+
+--echo '#------------------FN_DYNVARS_005_06-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.storage_engine =
+ VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+ WHERE VARIABLE_NAME='storage_engine';
+
+
+--echo '#------------------FN_DYNVARS_005_07-----------------------#'
+####################################################################
+# Check if TRUE and FALSE values can be used on variable #
+####################################################################
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.storage_engine = TRUE;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.storage_engine = FALSE;
+
+
+--echo '#---------------------FN_DYNVARS_001_8----------------------#'
+###############################################################
+# Check if accessing variable with SESSION,LOCAL and without #
+# SCOPE points to same session variable #
+###############################################################
+
+SET @@storage_engine = MYISAM;
+SELECT @@storage_engine = @@local.storage_engine;
+SELECT @@local.storage_engine = @@session.storage_engine;
+
+
+--echo '#---------------------FN_DYNVARS_001_9----------------------#'
+#########################################################################
+# Check if storage_engine can be accessed with and without @@ sign #
+#########################################################################
+
+SET storage_engine = MEMORY;
+SELECT @@storage_engine;
+--Error ER_UNKNOWN_TABLE
+SELECT local.storage_engine;
+--Error ER_UNKNOWN_TABLE
+SELECT session.storage_engine;
+--Error ER_BAD_FIELD_ERROR
+SELECT storage_engine = @@session.storage_engine;
+
+# check the old obsolete name
+SET @@storage_engine = @start_global_value;
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.storage_engine = @start_global_value;
+SET @@session.storage_engine = @start_session_value;
+
+
+#############################################################
+# END OF storage_engine TESTS #
+#############################################################
+
diff --git a/mysql-test/suite/sys_vars/t/stored_program_cache_basic.test b/mysql-test/suite/sys_vars/t/stored_program_cache_basic.test
new file mode 100644
index 00000000..9a9ba2eb
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/stored_program_cache_basic.test
@@ -0,0 +1,59 @@
+# Variable Name: stored_program_cache
+# Scope: GLOBAL
+# Access Type: Dynamic
+# Data Type: numeric
+# Default Value: 256
+# Range: 256-524288
+
+--source include/load_sysvars.inc
+
+--echo # Saving initial value of stored_program_cache in a temporary variable
+SET @start_value = @@global.stored_program_cache;
+SELECT @start_value;
+
+--echo # Display the DEFAULT value of stored_program_cache
+SET @@global.stored_program_cache = DEFAULT;
+SELECT @@global.stored_program_cache;
+
+--echo # Verify default value of variable
+SELECT @@global.stored_program_cache = 256;
+
+--echo # Change the value of stored_program_cache to a valid value
+SET @@global.stored_program_cache = 512;
+SELECT @@global.stored_program_cache;
+
+--echo # Change the value of stored_program_cache to invalid value
+SET @@global.stored_program_cache = -1;
+SELECT @@global.stored_program_cache;
+
+SET @@global.stored_program_cache =100000000000;
+SELECT @@global.stored_program_cache;
+
+SET @@global.stored_program_cache = 0;
+SELECT @@global.stored_program_cache;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.stored_program_cache = 10000.01;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.stored_program_cache = ON;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.stored_program_cache= 'test';
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.stored_program_cache = '';
+
+--echo # Test if accessing session stored_program_cache gives error
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.stored_program_cache = 0;
+
+--echo # Check if accessing variable without SCOPE points to same global variable
+
+SET @@global.stored_program_cache = 512;
+SELECT @@stored_program_cache = @@global.stored_program_cache;
+
+--echo # Restore initial value
+
+SET @@global.stored_program_cache = @start_value;
+SELECT @@global.stored_program_cache;
diff --git a/mysql-test/suite/sys_vars/t/stored_program_cache_func.test b/mysql-test/suite/sys_vars/t/stored_program_cache_func.test
new file mode 100644
index 00000000..611c33b5
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/stored_program_cache_func.test
@@ -0,0 +1,45 @@
+--source include/protocol.inc
+
+create procedure p1() select 1;
+
+flush status;
+show status like 'handler_read_key';
+call p1;
+show status like 'handler_read_key';
+call p1;
+show status like 'handler_read_key';
+
+set global stored_program_cache=0;
+
+call p1;
+show status like 'handler_read_key';
+call p1;
+show status like 'handler_read_key';
+
+drop procedure p1;
+set global stored_program_cache=default;
+
+# Test for missing SP automatic reparsing.
+# when MDEV-5816 is implemented, it should be removed.
+
+--delimiter |
+create procedure pr(i int) begin
+ create table t1 (a int, b int);
+ if (i = 1) then alter table t1 drop a;
+ else alter table t1 drop b;
+ end if;
+ select * from t1;
+ drop table t1;
+end |
+--delimiter ;
+call pr(1);
+--error ER_BAD_FIELD_ERROR
+call pr(2);
+drop table t1;
+
+set global stored_program_cache=0;
+call pr(1);
+call pr(2);
+drop procedure pr;
+set global stored_program_cache=default;
+
diff --git a/mysql-test/suite/sys_vars/t/sync_binlog_basic.test b/mysql-test/suite/sys_vars/t/sync_binlog_basic.test
new file mode 100644
index 00000000..4b5cc379
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sync_binlog_basic.test
@@ -0,0 +1,127 @@
+#################### mysql-test\t\sync_binlog_basic.test ######################
+# #
+# Variable Name: sync_binlog #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 0 #
+# Range: 0 - 4294967295 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable sync_binlog #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/not_embedded.inc
+--source include/load_sysvars.inc
+
+##################################################################
+# START OF sync_binlog TESTS #
+##################################################################
+
+
+##################################################################
+# Saving initial value of sync_binlog in a temporary variable #
+##################################################################
+
+SET @start_value = @@global.sync_binlog;
+
+--echo '#--------------------FN_DYNVARS_168_03------------------------#'
+###################################################################
+# Change the value of sync_binlog to a valid value #
+###################################################################
+
+SET @@global.sync_binlog = 0;
+SELECT @@global.sync_binlog;
+SET @@global.sync_binlog = 1;
+SELECT @@global.sync_binlog;
+SET @@global.sync_binlog = 4294967295;
+SELECT @@global.sync_binlog;
+SET @@global.sync_binlog = 4294967294;
+SELECT @@global.sync_binlog;
+SET @@global.sync_binlog = 65536;
+SELECT @@global.sync_binlog;
+
+
+--echo '#--------------------FN_DYNVARS_168_04-------------------------#'
+######################################################################
+# Change the value of sync_binlog to invalid value #
+######################################################################
+
+SET @@global.sync_binlog = -1;
+SELECT @@global.sync_binlog;
+SET @@global.sync_binlog = 4294967296;
+SELECT @@global.sync_binlog;
+SET @@global.sync_binlog = 10240022115;
+SELECT @@global.sync_binlog;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.sync_binlog = 10000.01;
+SELECT @@global.sync_binlog;
+SET @@global.sync_binlog = -1024;
+SELECT @@global.sync_binlog;
+SET @@global.sync_binlog = 42949672950;
+SELECT @@global.sync_binlog;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.sync_binlog = ON;
+SELECT @@global.sync_binlog;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.sync_binlog = 'test';
+SELECT @@global.sync_binlog;
+
+
+--echo '#-------------------FN_DYNVARS_168_05----------------------------#'
+###########################################################################
+# Test if accessing session sync_binlog gives error #
+###########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.sync_binlog = 0;
+SELECT @@sync_binlog;
+
+
+--echo '#----------------------FN_DYNVARS_168_06------------------------#'
+##############################################################################
+# Check if the value in GLOBAL & SESSION Tables matches values in variable #
+##############################################################################
+
+SELECT @@global.sync_binlog = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='sync_binlog';
+
+--echo '#---------------------FN_DYNVARS_168_07----------------------#'
+##########################################################################
+# Check if sync_binlog can be accessed with and without @@ sign #
+##########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET sync_binlog = 1;
+SELECT @@sync_binlog;
+--Error ER_UNKNOWN_TABLE
+SELECT local.sync_binlog;
+--Error ER_UNKNOWN_TABLE
+SELECT global.sync_binlog;
+--Error ER_BAD_FIELD_ERROR
+SELECT sync_binlog = @@session.sync_binlog;
+
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.sync_binlog = @start_value;
+
+########################################################################
+# END OF sync_binlog TESTS #
+########################################################################
diff --git a/mysql-test/suite/sys_vars/t/sync_binlog_grant.test b/mysql-test/suite/sys_vars/t/sync_binlog_grant.test
new file mode 100644
index 00000000..114be48e
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sync_binlog_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21963 Bind BINLOG ADMIN to a number of global system variables
+--echo #
+
+--let var = sync_binlog
+--let grant = BINLOG ADMIN
+--let value = 10
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/sync_frm_basic.test b/mysql-test/suite/sys_vars/t/sync_frm_basic.test
new file mode 100644
index 00000000..6fb9e03d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sync_frm_basic.test
@@ -0,0 +1,163 @@
+############## mysql-test\t\sync_frm_basic.test ###############################
+# #
+# Variable Name: sync_frm #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: boolean #
+# Default Value: TRUE #
+# Range: #
+# #
+# #
+# Creation Date: 2008-02-14 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable sync_frm #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+##############################################################
+# START OF sync_frm TESTS #
+##############################################################
+
+
+################################################################
+# Saving initial value of sync_frm in a temporary variable #
+################################################################
+
+SET @start_value = @@global.sync_frm;
+# In some cases the server may have been started with --disable-sync-frm
+--replace_column 1 VAL
+SELECT @start_value;
+
+
+--echo '#--------------------FN_DYNVARS_169_01------------------------#'
+######################################################
+# Display the DEFAULT value of sync_frm #
+######################################################
+
+SET @@global.sync_frm = FALSE;
+SET @@global.sync_frm = DEFAULT;
+SELECT @@global.sync_frm;
+
+
+--echo '#---------------------FN_DYNVARS_169_02-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@global.sync_frm = DEFAULT;
+SELECT @@global.sync_frm = TRUE;
+
+
+--echo '#--------------------FN_DYNVARS_169_03------------------------#'
+######################################################
+# Change the value of sync_frm to a valid value #
+######################################################
+
+SET @@global.sync_frm = ON;
+SELECT @@global.sync_frm;
+SET @@global.sync_frm = OFF;
+SELECT @@global.sync_frm;
+SET @@global.sync_frm = 0;
+SELECT @@global.sync_frm;
+SET @@global.sync_frm = 1;
+SELECT @@global.sync_frm;
+SET @@global.sync_frm = TRUE;
+SELECT @@global.sync_frm;
+SET @@global.sync_frm = FALSE;
+SELECT @@global.sync_frm;
+
+--echo '#--------------------FN_DYNVARS_169_04-------------------------#'
+####################################################################
+# Change the value of sync_frm to invalid value #
+####################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.sync_frm = 2;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.sync_frm = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.sync_frm = TRUEF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.sync_frm = TRUE_F;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.sync_frm = FALSE0;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.sync_frm = OON;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.sync_frm = ONN;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.sync_frm = OOFF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.sync_frm = 0FF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.sync_frm = ' ';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.sync_frm = " ";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.sync_frm = '';
+
+
+--echo '#-------------------FN_DYNVARS_169_05----------------------------#'
+####################################################################
+# Test if accessing session sync_frm gives error #
+####################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.sync_frm = 1;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.sync_frm;
+
+
+--echo '#----------------------FN_DYNVARS_169_06------------------------#'
+####################################################################
+# Check if the value in GLOBAL Tables matches values in variable #
+####################################################################
+
+SELECT IF(@@global.sync_frm, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='sync_frm';
+
+--echo '#---------------------FN_DYNVARS_169_07----------------------#'
+###############################################################################
+# Check if accessing variable without SCOPE points to same session variable #
+###############################################################################
+
+SET @@global.sync_frm = 1;
+SELECT @@sync_frm = @@global.sync_frm;
+
+
+--echo '#---------------------FN_DYNVARS_169_08----------------------#'
+###################################################################
+# Check if sync_frm can be accessed with and without @@ sign #
+###################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET sync_frm = 1;
+SELECT @@sync_frm;
+--Error ER_UNKNOWN_TABLE
+SELECT global.sync_frm;
+--Error ER_BAD_FIELD_ERROR
+SELECT sync_frm = @@session.sync_frm;
+
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.sync_frm = @start_value;
+--replace_column 1 VAL
+SELECT @@global.sync_frm;
+
+######################################################
+# END OF sync_frm TESTS #
+######################################################
diff --git a/mysql-test/suite/sys_vars/t/sync_master_info_basic.test b/mysql-test/suite/sys_vars/t/sync_master_info_basic.test
new file mode 100644
index 00000000..a080aa4c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sync_master_info_basic.test
@@ -0,0 +1,43 @@
+
+SET @start_global_value = @@global.sync_master_info;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+select @@global.sync_master_info;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.sync_master_info;
+show global variables like 'sync_master_info';
+show session variables like 'sync_master_info';
+select * from information_schema.global_variables where variable_name='sync_master_info';
+select * from information_schema.session_variables where variable_name='sync_master_info';
+
+#
+# show that it's writable
+#
+set global sync_master_info=1;
+select @@global.sync_master_info;
+--error ER_GLOBAL_VARIABLE
+set session sync_master_info=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global sync_master_info=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global sync_master_info=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global sync_master_info="foo";
+
+#
+# min/max values
+#
+set global sync_master_info=0;
+select @@global.sync_master_info;
+set global sync_master_info=cast(-1 as unsigned int);
+select @@global.sync_master_info;
+
+SET @@global.sync_master_info = @start_global_value;
+SELECT @@global.sync_master_info;
diff --git a/mysql-test/suite/sys_vars/t/sync_master_info_grant.test b/mysql-test/suite/sys_vars/t/sync_master_info_grant.test
new file mode 100644
index 00000000..c46979e4
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sync_master_info_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21969 Bind REPLICATION SLAVE ADMIN to relay_log_*, sync_master_info, sync_relay_log, sync_relay_log_info
+--echo #
+
+--let var = sync_master_info
+--let grant = REPLICATION SLAVE ADMIN
+--let value = 20000
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/sync_relay_log_basic.test b/mysql-test/suite/sys_vars/t/sync_relay_log_basic.test
new file mode 100644
index 00000000..112eaca7
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sync_relay_log_basic.test
@@ -0,0 +1,44 @@
+--source include/not_embedded.inc
+
+SET @start_global_value = @@global.sync_relay_log;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+select @@global.sync_relay_log;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.sync_relay_log;
+show global variables like 'sync_relay_log';
+show session variables like 'sync_relay_log';
+select * from information_schema.global_variables where variable_name='sync_relay_log';
+select * from information_schema.session_variables where variable_name='sync_relay_log';
+
+#
+# show that it's writable
+#
+set global sync_relay_log=1;
+select @@global.sync_relay_log;
+--error ER_GLOBAL_VARIABLE
+set session sync_relay_log=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global sync_relay_log=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global sync_relay_log=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global sync_relay_log="foo";
+
+#
+# min/max values
+#
+set global sync_relay_log=0;
+select @@global.sync_relay_log;
+set global sync_relay_log=cast(-1 as unsigned int);
+select @@global.sync_relay_log;
+
+SET @@global.sync_relay_log = @start_global_value;
+SELECT @@global.sync_relay_log;
diff --git a/mysql-test/suite/sys_vars/t/sync_relay_log_grant.test b/mysql-test/suite/sys_vars/t/sync_relay_log_grant.test
new file mode 100644
index 00000000..6812885a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sync_relay_log_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21969 Bind REPLICATION SLAVE ADMIN to relay_log_*, sync_master_info, sync_relay_log, sync_relay_log_info
+--echo #
+
+--let var = sync_relay_log
+--let grant = REPLICATION SLAVE ADMIN
+--let value = 20000
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/sync_relay_log_info_basic.test b/mysql-test/suite/sys_vars/t/sync_relay_log_info_basic.test
new file mode 100644
index 00000000..2ef4b3c0
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sync_relay_log_info_basic.test
@@ -0,0 +1,44 @@
+--source include/not_embedded.inc
+
+SET @start_global_value = @@global.sync_relay_log_info;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+select @@global.sync_relay_log_info;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.sync_relay_log_info;
+show global variables like 'sync_relay_log_info';
+show session variables like 'sync_relay_log_info';
+select * from information_schema.global_variables where variable_name='sync_relay_log_info';
+select * from information_schema.session_variables where variable_name='sync_relay_log_info';
+
+#
+# show that it's writable
+#
+set global sync_relay_log_info=1;
+select @@global.sync_relay_log_info;
+--error ER_GLOBAL_VARIABLE
+set session sync_relay_log_info=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global sync_relay_log_info=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global sync_relay_log_info=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global sync_relay_log_info="foo";
+
+#
+# min/max values
+#
+set global sync_relay_log_info=0;
+select @@global.sync_relay_log_info;
+set global sync_relay_log_info=cast(-1 as unsigned int);
+select @@global.sync_relay_log_info;
+
+SET @@global.sync_relay_log_info = @start_global_value;
+SELECT @@global.sync_relay_log_info;
diff --git a/mysql-test/suite/sys_vars/t/sync_relay_log_info_grant.test b/mysql-test/suite/sys_vars/t/sync_relay_log_info_grant.test
new file mode 100644
index 00000000..1b563b5d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sync_relay_log_info_grant.test
@@ -0,0 +1,9 @@
+--echo #
+--echo # MDEV-21969 Bind REPLICATION SLAVE ADMIN to relay_log_*, sync_master_info, sync_relay_log, sync_relay_log_info
+--echo #
+
+--let var = sync_relay_log_info
+--let grant = REPLICATION SLAVE ADMIN
+--let value = 20000
+
+--source suite/sys_vars/inc/sysvar_global_grant.inc
diff --git a/mysql-test/suite/sys_vars/t/system_time_zone_basic.test b/mysql-test/suite/sys_vars/t/system_time_zone_basic.test
new file mode 100644
index 00000000..0dfc850d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/system_time_zone_basic.test
@@ -0,0 +1,100 @@
+
+
+################## mysql-test\t\system_time_zone_basic.test ###################
+# #
+# Variable Name: system_time_zone #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: string #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable system_time_zone #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--echo '#---------------------BS_STVARS_050_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.system_time_zone);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_050_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.system_time_zone=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.system_time_zone);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_050_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+SELECT @@GLOBAL.system_time_zone = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='system_time_zone';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.system_time_zone);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='system_time_zone';
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_050_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@system_time_zone = @@GLOBAL.system_time_zone;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_050_05----------------------#'
+################################################################################
+# Check if system_time_zone can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@system_time_zone);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.system_time_zone);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.system_time_zone);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.system_time_zone);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT system_time_zone = @@SESSION.system_time_zone;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/sysvars_aria.opt b/mysql-test/suite/sys_vars/t/sysvars_aria.opt
new file mode 100644
index 00000000..cff8aa5b
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sysvars_aria.opt
@@ -0,0 +1 @@
+--loose-aria-log-file-size=100M
diff --git a/mysql-test/suite/sys_vars/t/sysvars_aria.test b/mysql-test/suite/sys_vars/t/sysvars_aria.test
new file mode 100644
index 00000000..b042f101
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sysvars_aria.test
@@ -0,0 +1,12 @@
+--source include/have_aria.inc
+--source include/have_aria_used_for_temp_tables.inc
+--source include/word_size.inc
+
+let datadir=`select @@datadir`;
+
+--vertical_results
+
+--replace_result $datadir DATADIR
+select VARIABLE_NAME, SESSION_VALUE, DEFAULT_VALUE, VARIABLE_SCOPE, VARIABLE_TYPE, VARIABLE_COMMENT, NUMERIC_MIN_VALUE, NUMERIC_MAX_VALUE, NUMERIC_BLOCK_SIZE, ENUM_VALUE_LIST, READ_ONLY, COMMAND_LINE_ARGUMENT from information_schema.system_variables
+ where variable_name like 'aria%'
+ order by variable_name;
diff --git a/mysql-test/suite/sys_vars/t/sysvars_debug.opt b/mysql-test/suite/sys_vars/t/sysvars_debug.opt
new file mode 100644
index 00000000..016d0f9b
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sysvars_debug.opt
@@ -0,0 +1 @@
+--loose-debug-binlog-fsync-sleep=314
diff --git a/mysql-test/suite/sys_vars/t/sysvars_debug.test b/mysql-test/suite/sys_vars/t/sysvars_debug.test
new file mode 100644
index 00000000..6e64d48c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sysvars_debug.test
@@ -0,0 +1,8 @@
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+--source include/word_size.inc
+
+--vertical_results
+select * from information_schema.system_variables
+ where variable_name like 'debug%'
+ order by variable_name;
diff --git a/mysql-test/suite/sys_vars/t/sysvars_innodb.opt b/mysql-test/suite/sys_vars/t/sysvars_innodb.opt
new file mode 100644
index 00000000..c3eec59b
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sysvars_innodb.opt
@@ -0,0 +1,2 @@
+--loose-innodb-flush-log-at-timeout=3
+--table_open_cache=200
diff --git a/mysql-test/suite/sys_vars/t/sysvars_innodb.test b/mysql-test/suite/sys_vars/t/sysvars_innodb.test
new file mode 100644
index 00000000..2680e442
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sysvars_innodb.test
@@ -0,0 +1,16 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/not_valgrind.inc
+--source include/word_size.inc
+
+--vertical_results
+--replace_regex /^\/\S+/PATH/ /\.\//PATH/
+select VARIABLE_NAME, SESSION_VALUE, DEFAULT_VALUE, VARIABLE_SCOPE, VARIABLE_TYPE, VARIABLE_COMMENT, NUMERIC_MIN_VALUE, NUMERIC_MAX_VALUE, NUMERIC_BLOCK_SIZE, ENUM_VALUE_LIST, READ_ONLY, COMMAND_LINE_ARGUMENT from information_schema.system_variables
+ where variable_name like 'innodb%' and
+ variable_name not in (
+ 'innodb_numa_interleave', # only available WITH_NUMA
+ 'innodb_evict_tables_on_commit_debug', # one may want to override this
+ 'innodb_use_native_aio', # default value depends on OS
+ 'innodb_log_file_buffering', # only available on Linux and Windows
+ 'innodb_buffer_pool_load_pages_abort') # debug build only, and is only for testing
+ order by variable_name;
diff --git a/mysql-test/suite/sys_vars/t/sysvars_server_embedded.test b/mysql-test/suite/sys_vars/t/sysvars_server_embedded.test
new file mode 100644
index 00000000..adc71925
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sysvars_server_embedded.test
@@ -0,0 +1,2 @@
+source include/is_embedded.inc;
+source inc/sysvars_server.inc;
diff --git a/mysql-test/suite/sys_vars/t/sysvars_server_notembedded.test b/mysql-test/suite/sys_vars/t/sysvars_server_notembedded.test
new file mode 100644
index 00000000..55f97f9b
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sysvars_server_notembedded.test
@@ -0,0 +1,2 @@
+source include/not_embedded.inc;
+source inc/sysvars_server.inc;
diff --git a/mysql-test/suite/sys_vars/t/sysvars_star.cnf b/mysql-test/suite/sys_vars/t/sysvars_star.cnf
new file mode 100644
index 00000000..d1dacd8c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sysvars_star.cnf
@@ -0,0 +1,5 @@
+!include include/default_my.cnf
+
+[server]
+loose-sql-error-log-rotations=5
+plugin-maturity=alpha
diff --git a/mysql-test/suite/sys_vars/t/sysvars_star.opt b/mysql-test/suite/sys_vars/t/sysvars_star.opt
new file mode 100644
index 00000000..58af6ade
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sysvars_star.opt
@@ -0,0 +1,2 @@
+--column-compression-threshold=120
+--loose-sql-error-log-rate=100
diff --git a/mysql-test/suite/sys_vars/t/sysvars_star.test b/mysql-test/suite/sys_vars/t/sysvars_star.test
new file mode 100644
index 00000000..8d0aefdc
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sysvars_star.test
@@ -0,0 +1,43 @@
+#
+# MDEV-12684 Show what config file a sysvar got a value from
+#
+
+source include/not_embedded.inc;
+if (!$SQL_ERRLOG_SO) {
+ skip No sql_errlog plugin;
+}
+
+#system_versioning_alter_history
+#binlog_format
+set completion_type=CHAIN;
+set global low_priority_updates=1;
+
+install soname 'sql_errlog';
+
+vertical_results;
+replace_regex /\/.*\//var\//;
+select * from information_schema.system_variables
+ where variable_name in (
+ 'completion_type', #session!=global, origin=compile-time
+ 'low_priority_updates', #global!=default, origin=sql
+ 'column_compression_threshold', #origin=command-line
+ 'plugin_maturity', #origin=config
+ 'sql_error_log_rate', #plugin, origin=command-line
+ 'sql_error_log_rotations' #plugin, origin=config
+ )
+ order by variable_name;
+
+create user foo@localhost;
+
+connect foo,localhost,foo;
+select global_value_path from information_schema.system_variables where variable_name='plugin_maturity';
+connection default;
+replace_regex /\/.*\//var\//;
+select global_value_path from information_schema.system_variables where variable_name='plugin_maturity';
+disconnect foo;
+drop user foo@localhost;
+set global low_priority_updates=default;
+disable_warnings;
+uninstall soname 'sql_errlog';
+let $count_sessions= 1;
+source include/wait_until_count_sessions.inc;
diff --git a/mysql-test/suite/sys_vars/t/sysvars_wsrep.test b/mysql-test/suite/sys_vars/t/sysvars_wsrep.test
new file mode 100644
index 00000000..c127115e
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sysvars_wsrep.test
@@ -0,0 +1,13 @@
+--source include/have_wsrep.inc
+--source include/word_size.inc
+--let $datadir = `SELECT @@datadir`
+--let $hostname = `SELECT @@hostname`
+
+--replace_result $datadir DATADIR
+--let $hostname_regex=/^$hostname\$/HOSTNAME/
+--replace_regex $hostname_regex /wsrep_[0-9]{2}\.[0-9]{1,2}/wsrep_MAJVER.MINVER/
+--vertical_results
+select * from information_schema.system_variables
+ where variable_name like 'wsrep%'
+ order by variable_name;
+
diff --git a/mysql-test/suite/sys_vars/t/table_definition_cache_basic.test b/mysql-test/suite/sys_vars/t/table_definition_cache_basic.test
new file mode 100644
index 00000000..c887608b
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/table_definition_cache_basic.test
@@ -0,0 +1,143 @@
+############## mysql-test\t\table_definition_cache_basic.test #################
+# #
+# Variable Name: table_definition_cache #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 400 #
+# Range: 1 - 524288 #
+# #
+# #
+# Creation Date: 2008-03-16 #
+# Author: Salman Rawala #
+# #
+# Description: Test Cases of Dynamic System Variable "table_definition_cache" #
+# that checks behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity . #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_table_definition_cache #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+###############################################################
+# START OF table_definition_cache TESTS #
+###############################################################
+
+##############################################################################
+# Saving initial value of table_definition_cache in a temporary variable #
+##############################################################################
+
+SET @start_value = @@global.table_definition_cache;
+
+--echo '#--------------------FN_DYNVARS_019_01------------------------#'
+#######################################################################
+# Display the DEFAULT value of table_definition_cache #
+#######################################################################
+
+SET @@global.table_definition_cache = 100;
+SET @@global.table_definition_cache = DEFAULT;
+SELECT @@global.table_definition_cache > 0;
+
+
+--echo '#--------------------FN_DYNVARS_019_03------------------------#'
+##############################################################################
+# Change the value of table_definition_cache to a valid value #
+##############################################################################
+
+SET @@global.table_definition_cache = 1;
+SELECT @@global.table_definition_cache;
+SET @@global.table_definition_cache = 2;
+SELECT @@global.table_definition_cache;
+SET @@global.table_definition_cache = 2097151;
+SELECT @@global.table_definition_cache;
+SET @@global.table_definition_cache = 2097152;
+SELECT @@global.table_definition_cache;
+
+
+--echo '#--------------------FN_DYNVARS_019_04-------------------------#'
+#################################################################################
+# Change the value of table_definition_cache to invalid value #
+#################################################################################
+
+SET @@global.table_definition_cache = 0;
+SELECT @@global.table_definition_cache;
+SET @@global.table_definition_cache = -1024;
+SELECT @@global.table_definition_cache;
+SET @@global.table_definition_cache = 2097153;
+SELECT @@global.table_definition_cache;
+SET @@global.table_definition_cache = 42949672950;
+SELECT @@global.table_definition_cache;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.table_definition_cache = 21221204.10;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.table_definition_cache = ON;
+
+
+--echo '#-------------------FN_DYNVARS_019_05----------------------------#'
+#################################################################################
+# Test if accessing session table_definition_cache gives error #
+#################################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.table_definition_cache = 0;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.table_definition_cache;
+
+
+--echo '#----------------------FN_DYNVARS_019_06------------------------#'
+####################################################################
+# Check if the value in GLOBAL Tables matches values in variable #
+####################################################################
+
+SELECT @@global.table_definition_cache = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='table_definition_cache';
+
+
+--echo '#---------------------FN_DYNVARS_019_07----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.table_definition_cache = TRUE;
+SELECT @@global.table_definition_cache;
+SET @@global.table_definition_cache = FALSE;
+SELECT @@global.table_definition_cache;
+
+
+--echo '#---------------------FN_DYNVARS_019_08----------------------#'
+###############################################################################
+# Check if accessing variable without SCOPE points to same global variable #
+###############################################################################
+
+SET @@global.table_definition_cache = 5;
+SELECT @@table_definition_cache = @@global.table_definition_cache;
+
+--echo '#---------------------FN_DYNVARS_019_09----------------------#'
+################################################################################
+# Check if table_definition_cache can be accessed with and without @@ sign #
+################################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET table_definition_cache = 1;
+--Error ER_UNKNOWN_TABLE
+SELECT global.table_definition_cache;
+--Error ER_BAD_FIELD_ERROR
+SELECT table_definition_cache = @@session.table_definition_cache;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.table_definition_cache = @start_value;
+
+################################################################
+# END OF table_definition_cache TESTS #
+################################################################
diff --git a/mysql-test/suite/sys_vars/t/table_open_cache_basic.test b/mysql-test/suite/sys_vars/t/table_open_cache_basic.test
new file mode 100644
index 00000000..fc838d1a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/table_open_cache_basic.test
@@ -0,0 +1,157 @@
+############## mysql-test\t\table_open_cache_basic.test #######################
+# #
+# Variable Name: table_open_cache #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 400 #
+# Range: 64-524288 #
+# #
+# #
+# Creation Date: 2008-02-13 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable table_open_cache #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_table_open_cache #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF table_open_cache TESTS #
+########################################################################
+
+
+##########################################################################
+# Saving initial value of table_open_cache in a temporary variable #
+##########################################################################
+
+SET @start_value = @@global.table_open_cache ;
+
+--echo '#---------------------FN_DYNVARS_001_02-------------------------#'
+###############################################
+# Verify default value of variable #
+###############################################
+
+SET @@global.table_open_cache = Default;
+SELECT @@global.table_open_cache > 0;
+
+--echo '#--------------------FN_DYNVARS_001_03------------------------#'
+########################################################################
+# Change the value of table_open_cache to a valid value #
+########################################################################
+
+
+SET @@global.table_open_cache = 8;
+SELECT @@global.table_open_cache ;
+
+SET @@global.table_open_cache = 1;
+SELECT @@global.table_open_cache ;
+
+SET @@global.table_open_cache = 1073741824;
+SELECT @@global.table_open_cache ;
+
+SET @@global.table_open_cache = 18000;
+SELECT @@global.table_open_cache ;
+SET @@global.table_open_cache = 65535;
+SELECT @@global.table_open_cache ;
+
+
+
+--echo '#--------------------FN_DYNVARS_001_04-------------------------#'
+#######################################################################
+# Change the value of table_open_cache to invalid value #
+#######################################################################
+
+SET @@global.table_open_cache = -1;
+SELECT @@global.table_open_cache ;
+
+SET @@global.table_open_cache = 100000000000;
+SELECT @@global.table_open_cache ;
+
+SET @@global.table_open_cache = -1024;
+SELECT @@global.table_open_cache ;
+
+SET @@global.table_open_cache = 0;
+SELECT @@global.table_open_cache ;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.table_open_cache = 10000.01;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.table_open_cache = ON;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.table_open_cache= 'test';
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.table_open_cache = '';
+
+
+--echo '#-------------------FN_DYNVARS_001_05----------------------------#'
+###########################################################################
+# Test if accessing session table_open_cache gives error #
+###########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.table_open_cache = 0;
+
+
+--echo '#----------------------FN_DYNVARS_001_06------------------------#'
+####################################################################
+# Check if the value in GLOBAL Tables matches values in variable #
+####################################################################
+
+SELECT @@global.table_open_cache = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='table_open_cache ';
+
+
+--echo '#---------------------FN_DYNVARS_001_09----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.table_open_cache = TRUE;
+SELECT @@global.table_open_cache ;
+
+SET @@global.table_open_cache = FALSE;
+SELECT @@global.table_open_cache ;
+
+
+--echo '#---------------------FN_DYNVARS_001_10----------------------#'
+##############################################################################
+# Check if accessing variable without SCOPE points to same session variable #
+##############################################################################
+
+SET @@global.table_open_cache = 10;
+SELECT @@table_open_cache = @@global.table_open_cache ;
+
+
+--echo '#---------------------FN_DYNVARS_001_11----------------------#'
+##########################################################################
+# Check if table_open_cache can be accessed with and without @@ sign #
+##########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET table_open_cache = 8;
+--Error ER_UNKNOWN_TABLE
+SELECT global.table_open_cache ;
+--Error ER_BAD_FIELD_ERROR
+SELECT table_open_cache = @@session.table_open_cache ;
+
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.table_open_cache = @start_value;
+
+##################################################################
+# END OF table_open_cache TESTS #
+##################################################################
diff --git a/mysql-test/suite/sys_vars/t/tcp_keepalive_time.test b/mysql-test/suite/sys_vars/t/tcp_keepalive_time.test
new file mode 100644
index 00000000..6b40c3d6
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/tcp_keepalive_time.test
@@ -0,0 +1,11 @@
+--source include/not_embedded.inc
+# A smoke test for TCP keepalive options
+set global tcp_keepalive_time = 1;
+set global tcp_keepalive_interval =1;
+set global tcp_keepalive_probes=1;
+connect(con1,"127.0.0.1",root,,test,$MASTER_MYPORT,);
+disconnect con1;
+connection default;
+set global tcp_keepalive_time= default;
+set global tcp_keepalive_interval= default;
+set global tcp_keepalive_probes=default;
diff --git a/mysql-test/suite/sys_vars/t/tcp_nodelay.test b/mysql-test/suite/sys_vars/t/tcp_nodelay.test
new file mode 100644
index 00000000..780bad68
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/tcp_nodelay.test
@@ -0,0 +1,7 @@
+--source include/not_embedded.inc
+# A smoke test for tcp_nodelay option
+SET tcp_nodelay=0;
+SET tcp_nodelay=1;
+SET tcp_nodelay=default;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET GLOBAL tcp_nodelay=0;
diff --git a/mysql-test/suite/sys_vars/t/thread_cache_size_basic-master.opt b/mysql-test/suite/sys_vars/t/thread_cache_size_basic-master.opt
new file mode 100644
index 00000000..f28fc33b
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/thread_cache_size_basic-master.opt
@@ -0,0 +1 @@
+--max-connections=1024
diff --git a/mysql-test/suite/sys_vars/t/thread_cache_size_basic.test b/mysql-test/suite/sys_vars/t/thread_cache_size_basic.test
new file mode 100644
index 00000000..22aaff6d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/thread_cache_size_basic.test
@@ -0,0 +1,49 @@
+
+#
+# 2010-01-20 OBN - Added check of I_S values after variable value change
+#
+
+SET @start_global_value = @@global.thread_cache_size;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+select @@global.thread_cache_size;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.thread_cache_size;
+show global variables like 'thread_cache_size';
+show session variables like 'thread_cache_size';
+select * from information_schema.global_variables where variable_name='thread_cache_size';
+select * from information_schema.session_variables where variable_name='thread_cache_size';
+
+#
+# show that it's writable
+#
+set global thread_cache_size=1;
+select @@global.thread_cache_size;
+select * from information_schema.global_variables where variable_name='thread_cache_size';
+select * from information_schema.session_variables where variable_name='thread_cache_size';
+--error ER_GLOBAL_VARIABLE
+set session thread_cache_size=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global thread_cache_size=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global thread_cache_size=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global thread_cache_size="foo";
+
+#
+# min/max values
+#
+set global thread_cache_size=0;
+select @@global.thread_cache_size;
+set global thread_cache_size=cast(-1 as unsigned int);
+select @@global.thread_cache_size;
+
+SET @@global.thread_cache_size = @start_global_value;
+SELECT @@global.thread_cache_size;
diff --git a/mysql-test/suite/sys_vars/t/thread_cache_size_func-master.opt b/mysql-test/suite/sys_vars/t/thread_cache_size_func-master.opt
new file mode 100644
index 00000000..b8c19e1b
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/thread_cache_size_func-master.opt
@@ -0,0 +1 @@
+--thread-cache-size=0
diff --git a/mysql-test/suite/sys_vars/t/thread_cache_size_func.test b/mysql-test/suite/sys_vars/t/thread_cache_size_func.test
new file mode 100644
index 00000000..9f4a45ec
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/thread_cache_size_func.test
@@ -0,0 +1,109 @@
+############# mysql-test\t\thread_cache_size_func.test ##########################
+# #
+# Variable Name: thread_cache_size #
+# Scope: SESSION #
+# Access Type: Dynamic #
+# Data Type: Enumeration #
+# Default Value: 0 #
+# Values: 0-16384 #
+# #
+# #
+# Creation Date: 2008-03-02 #
+# Author: Sharique Abdullah #
+# #
+# Modified: HHunger 2008-08-27 Reduced test to needed function and inserted #
+# wait-loops #
+# #
+# Description: Test Cases of Dynamic System Variable "thread_cache_size" #
+# that checks behavior of this variable in the following ways #
+# * Functionality based on different values #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# #
+#################################################################################
+
+#
+# Setup
+#
+
+
+--source include/one_thread_per_connection.inc
+SET @global_thread_cache_size = @@GLOBAL.thread_cache_size;
+
+FLUSH STATUS;
+
+-- ECHO '# Test1#'
+SET @@GLOBAL.thread_cache_size=3;
+SHOW STATUS LIKE 'Threads_cached';
+--echo 0 Expected
+
+##################################
+# Make 4 connections #
+##################################
+
+CONNECT (conn1,localhost,root,,);
+CONNECT (conn2,localhost,root,,);
+CONNECT (conn3,localhost,root,,);
+CONNECT (conn4,localhost,root,,);
+
+CONNECTION default;
+
+# Wait until all connections done
+let $wait_condition= SELECT COUNT(*)= 5 FROM INFORMATION_SCHEMA.PROCESSLIST;
+--source include/wait_condition.inc
+
+SHOW STATUS LIKE 'Threads_cached';
+--echo 0 Expected
+
+####################################
+#Disconnecting all the connections #
+####################################
+
+DISCONNECT conn1;
+DISCONNECT conn2;
+DISCONNECT conn3;
+DISCONNECT conn4;
+
+#
+# Checking the status
+#
+
+# Wait until all disconnects ready
+let $wait_condition= SELECT COUNT(*)= 1 FROM INFORMATION_SCHEMA.PROCESSLIST;
+--source include/wait_condition.inc
+
+# Wait until thread cache becomes 3
+let $wait_condition= SELECT variable_value = 3 FROM INFORMATION_SCHEMA.global_status where variable_name="Threads_cached";
+--source include/wait_condition.inc
+
+#
+# Decreasing cache size to 1
+#
+SET @@GLOBAL.thread_cache_size= 1;
+
+CONNECT (conn1,localhost,root,,);
+CONNECT (conn2,localhost,root,,);
+
+CONNECTION default;
+
+# Wait until all connects ready
+let $wait_condition= SELECT COUNT(*)= 3 FROM INFORMATION_SCHEMA.PROCESSLIST;
+--source include/wait_condition.inc
+
+DISCONNECT conn1;
+DISCONNECT conn2;
+
+# Wait until all disconnects ready
+let $wait_condition= SELECT COUNT(*)= 1 FROM INFORMATION_SCHEMA.PROCESSLIST;
+--source include/wait_condition.inc
+
+# Wait until thread cache becomes 1
+let $wait_condition= SELECT variable_value = 1 FROM INFORMATION_SCHEMA.global_status where variable_name="Threads_cached";
+--source include/wait_condition.inc
+
+#
+# Cleanup
+#
+
+SET @@GLOBAL.thread_cache_size = @global_thread_cache_size;
diff --git a/mysql-test/suite/sys_vars/t/thread_handling_basic.test b/mysql-test/suite/sys_vars/t/thread_handling_basic.test
new file mode 100644
index 00000000..bcad003c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/thread_handling_basic.test
@@ -0,0 +1,107 @@
+
+
+################## mysql-test\t\thread_handling_basic.test ####################
+# #
+# Variable Name: thread_handling #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: enumeration #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable thread_handling #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--echo '#---------------------BS_STVARS_051_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.thread_handling);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_051_02----------------------#'
+#
+# Test case for Bug #35433
+#
+####################################################################
+# Check if Value can set #
+####################################################################
+
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.thread_handling=1;
+
+--ECHO Expected error ER_INCORRECT_GLOBAL_LOCAL_VAR
+
+SELECT COUNT(@@GLOBAL.thread_handling);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_051_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+SELECT @@GLOBAL.thread_handling = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='thread_handling';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.thread_handling);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='thread_handling';
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_051_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@thread_handling = @@GLOBAL.thread_handling;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_051_05----------------------#'
+################################################################################
+# Check if thread_handling can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@thread_handling);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.thread_handling);
+--echo Bug:Variable is global so it can not be accessed by local there should be error ER_INCORRECT_GLOBAL_LOCAL_VAR
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.thread_handling);
+--ECHO Bug:Variable is global so it can not be accessed by session there should be error ER_INCORRECT_GLOBAL_LOCAL_VAR
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.thread_handling);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT thread_handling = @@SESSION.thread_handling;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/thread_pool_idle_timeout_basic.test b/mysql-test/suite/sys_vars/t/thread_pool_idle_timeout_basic.test
new file mode 100644
index 00000000..b06a5069
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/thread_pool_idle_timeout_basic.test
@@ -0,0 +1,44 @@
+# uint global
+--source include/not_windows.inc
+--source include/not_embedded.inc
+--source include/not_aix.inc
+SET @start_global_value = @@global.thread_pool_idle_timeout;
+
+#
+# exists as global only
+#
+select @@global.thread_pool_idle_timeout;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.thread_pool_idle_timeout;
+show global variables like 'thread_pool_idle_timeout';
+show session variables like 'thread_pool_idle_timeout';
+select * from information_schema.global_variables where variable_name='thread_pool_idle_timeout';
+select * from information_schema.session_variables where variable_name='thread_pool_idle_timeout';
+
+#
+# show that it's writable
+#
+set global thread_pool_idle_timeout=60;
+select @@global.thread_pool_idle_timeout;
+set global thread_pool_idle_timeout=4294967295;
+select @@global.thread_pool_idle_timeout;
+--error ER_GLOBAL_VARIABLE
+set session thread_pool_idle_timeout=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global thread_pool_idle_timeout=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global thread_pool_idle_timeout=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global thread_pool_idle_timeout="foo";
+
+
+set global thread_pool_idle_timeout=-1;
+select @@global.thread_pool_idle_timeout;
+set global thread_pool_idle_timeout=10000000000;
+select @@global.thread_pool_idle_timeout;
+
+SET @@global.thread_pool_idle_timeout = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/thread_pool_idle_timeout_grant.test b/mysql-test/suite/sys_vars/t/thread_pool_idle_timeout_grant.test
new file mode 100644
index 00000000..8f5f2491
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/thread_pool_idle_timeout_grant.test
@@ -0,0 +1,58 @@
+--source include/not_windows.inc
+--source include/not_embedded.inc
+--source include/not_aix.inc
+
+SET @global=@@global.thread_pool_idle_timeout;
+
+--echo #
+--echo # MDEV-21961 Bind CONNECTION ADMIN to a number of global system variables
+--echo #
+
+--echo # Test that "SET thread_pool_idle_timeout" is not allowed without CONNECTION ADMIN or SUPER
+
+CREATE USER user1@localhost;
+GRANT ALL PRIVILEGES ON *.* TO user1@localhost;
+REVOKE CONNECTION ADMIN, SUPER ON *.* FROM user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+SET GLOBAL thread_pool_idle_timeout=10;
+--error ER_GLOBAL_VARIABLE
+SET thread_pool_idle_timeout=10;
+--error ER_GLOBAL_VARIABLE
+SET SESSION thread_pool_idle_timeout=10;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET thread_pool_idle_timeout" is allowed with CONNECTION ADMIN
+
+CREATE USER user1@localhost;
+GRANT CONNECTION ADMIN ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+SET GLOBAL thread_pool_idle_timeout=10;
+--error ER_GLOBAL_VARIABLE
+SET thread_pool_idle_timeout=10;
+--error ER_GLOBAL_VARIABLE
+SET SESSION thread_pool_idle_timeout=10;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET thread_pool_idle_timeout" is allowed with SUPER
+
+CREATE USER user1@localhost;
+GRANT SUPER ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+SET GLOBAL thread_pool_idle_timeout=10;
+--error ER_GLOBAL_VARIABLE
+SET thread_pool_idle_timeout=10;
+--error ER_GLOBAL_VARIABLE
+SET SESSION thread_pool_idle_timeout=10;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+SET @@global.thread_pool_idle_timeout=@global;
diff --git a/mysql-test/suite/sys_vars/t/thread_pool_max_threads_basic.test b/mysql-test/suite/sys_vars/t/thread_pool_max_threads_basic.test
new file mode 100644
index 00000000..392dbd3a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/thread_pool_max_threads_basic.test
@@ -0,0 +1,43 @@
+# uint global
+--source include/not_embedded.inc
+--source include/not_aix.inc
+SET @start_global_value = @@global.thread_pool_max_threads;
+
+#
+# exists as global only
+#
+select @@global.thread_pool_max_threads;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.thread_pool_max_threads;
+show global variables like 'thread_pool_max_threads';
+show session variables like 'thread_pool_max_threads';
+select * from information_schema.global_variables where variable_name='thread_pool_max_threads';
+select * from information_schema.session_variables where variable_name='thread_pool_max_threads';
+
+#
+# show that it's writable
+#
+set global thread_pool_max_threads=1;
+select @@global.thread_pool_max_threads;
+set global thread_pool_max_threads=65536;
+select @@global.thread_pool_max_threads;
+--error ER_GLOBAL_VARIABLE
+set session thread_pool_max_threads=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global thread_pool_max_threads=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global thread_pool_max_threads=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global thread_pool_max_threads="foo";
+
+
+set global thread_pool_max_threads=0;
+select @@global.thread_pool_max_threads;
+set global thread_pool_max_threads=10000000000;
+select @@global.thread_pool_max_threads;
+
+SET @@global.thread_pool_max_threads = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/thread_pool_max_threads_grant.test b/mysql-test/suite/sys_vars/t/thread_pool_max_threads_grant.test
new file mode 100644
index 00000000..299d5ff4
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/thread_pool_max_threads_grant.test
@@ -0,0 +1,58 @@
+# uint global
+--source include/not_embedded.inc
+--source include/not_aix.inc
+
+SET @global=@@global.thread_pool_max_threads;
+
+--echo #
+--echo # MDEV-21961 Bind CONNECTION ADMIN to a number of global system variables
+--echo #
+
+--echo # Test that "SET thread_pool_max_threads" is not allowed without CONNECTION ADMIN or SUPER
+
+CREATE USER user1@localhost;
+GRANT ALL PRIVILEGES ON *.* TO user1@localhost;
+REVOKE CONNECTION ADMIN, SUPER ON *.* FROM user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+SET GLOBAL thread_pool_max_threads=10;
+--error ER_GLOBAL_VARIABLE
+SET thread_pool_max_threads=10;
+--error ER_GLOBAL_VARIABLE
+SET SESSION thread_pool_max_threads=10;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET thread_pool_max_threads" is allowed with CONNECTION ADMIN
+
+CREATE USER user1@localhost;
+GRANT CONNECTION ADMIN ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+SET GLOBAL thread_pool_max_threads=10;
+--error ER_GLOBAL_VARIABLE
+SET thread_pool_max_threads=10;
+--error ER_GLOBAL_VARIABLE
+SET SESSION thread_pool_max_threads=10;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET thread_pool_max_threads" is allowed with SUPER
+
+CREATE USER user1@localhost;
+GRANT SUPER ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+SET GLOBAL thread_pool_max_threads=10;
+--error ER_GLOBAL_VARIABLE
+SET thread_pool_max_threads=10;
+--error ER_GLOBAL_VARIABLE
+SET SESSION thread_pool_max_threads=10;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+SET @@global.thread_pool_max_threads=@global;
diff --git a/mysql-test/suite/sys_vars/t/thread_pool_min_threads_basic.test b/mysql-test/suite/sys_vars/t/thread_pool_min_threads_basic.test
new file mode 100644
index 00000000..1447c83d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/thread_pool_min_threads_basic.test
@@ -0,0 +1,44 @@
+# uint global
+--source include/not_embedded.inc
+--source include/windows.inc
+--source include/not_aix.inc
+SET @start_global_value = @@global.thread_pool_min_threads;
+
+#
+# exists as global only
+#
+select @@global.thread_pool_min_threads;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.thread_pool_min_threads;
+show global variables like 'thread_pool_min_threads';
+show session variables like 'thread_pool_min_threads';
+select * from information_schema.global_variables where variable_name='thread_pool_min_threads';
+select * from information_schema.session_variables where variable_name='thread_pool_min_threads';
+
+#
+# show that it's writable
+#
+set global thread_pool_min_threads=1;
+select @@global.thread_pool_min_threads;
+set global thread_pool_min_threads=65536;
+select @@global.thread_pool_min_threads;
+--error ER_GLOBAL_VARIABLE
+set session thread_pool_min_threads=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global thread_pool_min_threads=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global thread_pool_min_threads=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global thread_pool_min_threads="foo";
+
+
+set global thread_pool_min_threads=0;
+select @@global.thread_pool_min_threads;
+set global thread_pool_min_threads=10000000000;
+select @@global.thread_pool_min_threads;
+
+SET @@global.thread_pool_min_threads = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/thread_pool_oversubscribe_basic.test b/mysql-test/suite/sys_vars/t/thread_pool_oversubscribe_basic.test
new file mode 100644
index 00000000..43817feb
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/thread_pool_oversubscribe_basic.test
@@ -0,0 +1,44 @@
+# uint global
+--source include/not_windows.inc
+--source include/not_embedded.inc
+--source include/not_aix.inc
+SET @start_global_value = @@global.thread_pool_oversubscribe;
+
+#
+# exists as global only
+#
+select @@global.thread_pool_oversubscribe;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.thread_pool_oversubscribe;
+show global variables like 'thread_pool_oversubscribe';
+show session variables like 'thread_pool_oversubscribe';
+select * from information_schema.global_variables where variable_name='thread_pool_oversubscribe';
+select * from information_schema.session_variables where variable_name='thread_pool_oversubscribe';
+
+#
+# show that it's writable
+#
+set global thread_pool_oversubscribe=60;
+select @@global.thread_pool_oversubscribe;
+set global thread_pool_oversubscribe=1000;
+select @@global.thread_pool_oversubscribe;
+--error ER_GLOBAL_VARIABLE
+set session thread_pool_oversubscribe=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global thread_pool_oversubscribe=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global thread_pool_oversubscribe=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global thread_pool_oversubscribe="foo";
+
+
+set global thread_pool_oversubscribe=-1;
+select @@global.thread_pool_oversubscribe;
+set global thread_pool_oversubscribe=10000000000;
+select @@global.thread_pool_oversubscribe;
+
+set @@global.thread_pool_oversubscribe = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/thread_pool_oversubscribe_grant.test b/mysql-test/suite/sys_vars/t/thread_pool_oversubscribe_grant.test
new file mode 100644
index 00000000..f3a96c69
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/thread_pool_oversubscribe_grant.test
@@ -0,0 +1,58 @@
+--source include/not_windows.inc
+--source include/not_embedded.inc
+--source include/not_aix.inc
+
+SET @global=@@global.thread_pool_oversubscribe;
+
+--echo #
+--echo # MDEV-21961 Bind CONNECTION ADMIN to a number of global system variables
+--echo #
+
+--echo # Test that "SET thread_pool_oversubscribe" is not allowed without CONNECTION ADMIN or SUPER
+
+CREATE USER user1@localhost;
+GRANT ALL PRIVILEGES ON *.* TO user1@localhost;
+REVOKE CONNECTION ADMIN, SUPER ON *.* FROM user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+SET GLOBAL thread_pool_oversubscribe=10;
+--error ER_GLOBAL_VARIABLE
+SET thread_pool_oversubscribe=10;
+--error ER_GLOBAL_VARIABLE
+SET SESSION thread_pool_oversubscribe=10;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET thread_pool_oversubscribe" is allowed with CONNECTION ADMIN
+
+CREATE USER user1@localhost;
+GRANT CONNECTION ADMIN ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+SET GLOBAL thread_pool_oversubscribe=10;
+--error ER_GLOBAL_VARIABLE
+SET thread_pool_oversubscribe=10;
+--error ER_GLOBAL_VARIABLE
+SET SESSION thread_pool_oversubscribe=10;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET thread_pool_oversubscribe" is allowed with SUPER
+
+CREATE USER user1@localhost;
+GRANT SUPER ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+SET GLOBAL thread_pool_oversubscribe=10;
+--error ER_GLOBAL_VARIABLE
+SET thread_pool_oversubscribe=10;
+--error ER_GLOBAL_VARIABLE
+SET SESSION thread_pool_oversubscribe=10;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+SET @@global.thread_pool_oversubscribe=@global;
diff --git a/mysql-test/suite/sys_vars/t/thread_pool_size_basic.opt b/mysql-test/suite/sys_vars/t/thread_pool_size_basic.opt
new file mode 100644
index 00000000..b680d0c4
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/thread_pool_size_basic.opt
@@ -0,0 +1 @@
+--loose-thread-handling=pool-of-threads --loose-thread-pool-mode=generic \ No newline at end of file
diff --git a/mysql-test/suite/sys_vars/t/thread_pool_size_basic.test b/mysql-test/suite/sys_vars/t/thread_pool_size_basic.test
new file mode 100644
index 00000000..3d17f3be
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/thread_pool_size_basic.test
@@ -0,0 +1,47 @@
+# uint global
+--source include/not_embedded.inc
+--source include/have_pool_of_threads.inc
+SET @start_global_value = @@global.thread_pool_size;
+
+#
+# exists as global only
+#
+--replace_column 1 #
+select @@global.thread_pool_size;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.thread_pool_size;
+--replace_column 2 #
+show global variables like 'thread_pool_size';
+--replace_column 2 #
+show session variables like 'thread_pool_size';
+--replace_column 2 #
+select * from information_schema.global_variables where variable_name='thread_pool_size';
+--replace_column 2 #
+select * from information_schema.session_variables where variable_name='thread_pool_size';
+--replace_column 2 #
+
+#
+# show that it's writable
+#
+set global thread_pool_size=1;
+select @@global.thread_pool_size;
+set global thread_pool_size=128;
+select @@global.thread_pool_size;
+--error ER_GLOBAL_VARIABLE
+set session thread_pool_size=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global thread_pool_size=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global thread_pool_size=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global thread_pool_size="foo";
+
+set global thread_pool_size=-1;
+
+set global thread_pool_size=100000;
+
+SET @@global.thread_pool_size = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/thread_pool_size_high.opt b/mysql-test/suite/sys_vars/t/thread_pool_size_high.opt
new file mode 100644
index 00000000..fe54a37c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/thread_pool_size_high.opt
@@ -0,0 +1 @@
+--loose-thread-handling=pool-of-threads --loose-thread-pool-size=200
diff --git a/mysql-test/suite/sys_vars/t/thread_pool_size_high.test b/mysql-test/suite/sys_vars/t/thread_pool_size_high.test
new file mode 100644
index 00000000..d1e68f02
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/thread_pool_size_high.test
@@ -0,0 +1,15 @@
+--source include/not_windows.inc
+--source include/not_embedded.inc
+--source include/have_pool_of_threads.inc
+call mtr.add_suppression("Could not increase number of max_open_files to more than");
+
+SELECT @@global.thread_pool_size;
+
+# Set lower value
+SET @@global.thread_pool_size=150;
+# Set original value
+SET @@global.thread_pool_size=200;
+# Try higher value
+SET @@global.thread_pool_size=201;
+
+SELECT @@global.thread_pool_size;
diff --git a/mysql-test/suite/sys_vars/t/thread_pool_stall_limit_basic.test b/mysql-test/suite/sys_vars/t/thread_pool_stall_limit_basic.test
new file mode 100644
index 00000000..2d1dc594
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/thread_pool_stall_limit_basic.test
@@ -0,0 +1,43 @@
+# uint global
+--source include/not_embedded.inc
+--source include/not_aix.inc
+SET @start_global_value = @@global.thread_pool_stall_limit;
+
+#
+# exists as global only
+#
+select @@global.thread_pool_stall_limit;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.thread_pool_stall_limit;
+show global variables like 'thread_pool_stall_limit';
+show session variables like 'thread_pool_stall_limit';
+select * from information_schema.global_variables where variable_name='thread_pool_stall_limit';
+select * from information_schema.session_variables where variable_name='thread_pool_stall_limit';
+
+#
+# show that it's writable
+#
+set global thread_pool_stall_limit=60;
+select @@global.thread_pool_stall_limit;
+set global thread_pool_stall_limit=4294967295;
+select @@global.thread_pool_stall_limit;
+--error ER_GLOBAL_VARIABLE
+set session thread_pool_stall_limit=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global thread_pool_stall_limit=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global thread_pool_stall_limit=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global thread_pool_stall_limit="foo";
+
+
+set global thread_pool_stall_limit=-1;
+select @@global.thread_pool_stall_limit;
+set global thread_pool_stall_limit=10000000000;
+select @@global.thread_pool_stall_limit;
+
+set @@global.thread_pool_stall_limit = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/thread_pool_stall_limit_grant.test b/mysql-test/suite/sys_vars/t/thread_pool_stall_limit_grant.test
new file mode 100644
index 00000000..ae0ed8a7
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/thread_pool_stall_limit_grant.test
@@ -0,0 +1,58 @@
+# uint global
+--source include/not_embedded.inc
+--source include/not_aix.inc
+
+SET @global=@@global.thread_pool_stall_limit;
+
+--echo #
+--echo # MDEV-21961 Bind CONNECTION ADMIN to a number of global system variables
+--echo #
+
+--echo # Test that "SET thread_pool_stall_limit" is not allowed without CONNECTION ADMIN or SUPER
+
+CREATE USER user1@localhost;
+GRANT ALL PRIVILEGES ON *.* TO user1@localhost;
+REVOKE CONNECTION ADMIN, SUPER ON *.* FROM user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+SET GLOBAL thread_pool_stall_limit=400;
+--error ER_GLOBAL_VARIABLE
+SET thread_pool_stall_limit=400;
+--error ER_GLOBAL_VARIABLE
+SET SESSION thread_pool_stall_limit=400;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET thread_pool_stall_limit" is allowed with CONNECTION ADMIN
+
+CREATE USER user1@localhost;
+GRANT CONNECTION ADMIN ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+SET GLOBAL thread_pool_stall_limit=400;
+--error ER_GLOBAL_VARIABLE
+SET thread_pool_stall_limit=400;
+--error ER_GLOBAL_VARIABLE
+SET SESSION thread_pool_stall_limit=400;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+--echo # Test that "SET thread_pool_stall_limit" is allowed with SUPER
+
+CREATE USER user1@localhost;
+GRANT SUPER ON *.* TO user1@localhost;
+--connect(user1,localhost,user1,,)
+--connection user1
+SET GLOBAL thread_pool_stall_limit=400;
+--error ER_GLOBAL_VARIABLE
+SET thread_pool_stall_limit=400;
+--error ER_GLOBAL_VARIABLE
+SET SESSION thread_pool_stall_limit=400;
+--disconnect user1
+--connection default
+DROP USER user1@localhost;
+
+SET @@global.thread_pool_stall_limit=@global;
diff --git a/mysql-test/suite/sys_vars/t/thread_stack_basic.test b/mysql-test/suite/sys_vars/t/thread_stack_basic.test
new file mode 100644
index 00000000..39f120e0
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/thread_stack_basic.test
@@ -0,0 +1,25 @@
+#
+# only global
+#
+--source include/not_asan.inc
+--source include/not_ubsan.inc
+--replace_result 392192 299008
+select @@global.thread_stack;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.thread_stack;
+--replace_result 392192 299008
+show global variables like 'thread_stack';
+--replace_result 392192 299008
+show session variables like 'thread_stack';
+--replace_result 392192 299008
+select * from information_schema.global_variables where variable_name='thread_stack';
+--replace_result 392192 299008
+select * from information_schema.session_variables where variable_name='thread_stack';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global thread_stack=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session thread_stack=1;
diff --git a/mysql-test/suite/sys_vars/t/time_format_basic.test b/mysql-test/suite/sys_vars/t/time_format_basic.test
new file mode 100644
index 00000000..ec737b8c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/time_format_basic.test
@@ -0,0 +1,18 @@
+#
+# only global
+#
+select @@global.time_format;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.time_format;
+show global variables like 'time_format';
+show session variables like 'time_format';
+select * from information_schema.global_variables where variable_name='time_format';
+select * from information_schema.session_variables where variable_name='time_format';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global time_format=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session time_format=1;
diff --git a/mysql-test/suite/sys_vars/t/time_zone_basic.test b/mysql-test/suite/sys_vars/t/time_zone_basic.test
new file mode 100644
index 00000000..32616e97
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/time_zone_basic.test
@@ -0,0 +1,325 @@
+################### mysql-test\t\time_zone_basic.test #########################
+# #
+# Variable Name: time_zone #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: string #
+# Default Value: SYSTEM #
+# Range: #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable time_zone #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+#######################################################################
+# START OF time_zone TESTS #
+#######################################################################
+
+
+#######################################################################
+# Saving initial value of time_zone in a temporary variable #
+#######################################################################
+
+SET @global_start_value = @@global.time_zone;
+SELECT @global_start_value;
+
+SET @session_start_value = @@session.time_zone;
+SELECT @session_start_value;
+
+
+--echo '#--------------------FN_DYNVARS_001_01------------------------#'
+########################################################################
+# Display the DEFAULT value of time_zone #
+########################################################################
+
+SET @@time_zone = "+02:00";
+SET @@time_zone = DEFAULT;
+SELECT @@time_zone;
+
+SET @@global.time_zone = "-00:30";
+SET @@global.time_zone = DEFAULT;
+SELECT @@global.time_zone;
+
+
+--echo '#---------------------FN_DYNVARS_001_02-------------------------#'
+##############################################################################
+# see if setting global value changes session value and vice versa #
+##############################################################################
+
+SET @@session.time_zone = "+02:00";
+SELECT @@session.time_zone;
+SET @@global.time_zone = "+05:00";
+SELECT @@global.time_zone;
+SELECT @@session.time_zone AS res_is_02_00;
+
+SET @@session.time_zone = "-02:00";
+SELECT @@session.time_zone;
+SELECT @@global.time_zone AS res_is_05_00;
+# composite check
+SELECT @@global.time_zone=@@session.time_zone AS res_is_false;
+
+
+--echo '#--------------------FN_DYNVARS_001_03------------------------#'
+########################################################################
+# Change the value of time_zone to a valid value #
+########################################################################
+
+# for session scope
+
+SET @@time_zone = "+13:00";
+SELECT @@time_zone;
+SET @@time_zone = "-12:00";
+SELECT @@time_zone;
+SET @@time_zone = "+12:59";
+SELECT @@time_zone;
+SET @@time_zone = "-11:30";
+SELECT @@time_zone;
+SET @@time_zone = "+00:00";
+SELECT @@time_zone;
+SET @@time_zone = "-12:59";
+SELECT @@time_zone;
+SET @@time_zone = "-00:00";
+SELECT @@time_zone;
+SET @@time_zone = "+10:00";
+SELECT @@time_zone;
+SET @@time_zone = "+0:0";
+SELECT @@time_zone;
+SET @@time_zone = "-10:00";
+SELECT @@time_zone;
+SET @@time_zone = "+2:00";
+SELECT @@time_zone;
+
+# for global scope
+
+SET @@global.time_zone = "+13:00";
+SELECT @@global.time_zone;
+SET @@global.time_zone = "-12:00";
+SELECT @@global.time_zone;
+SET @@global.time_zone = "+12:59";
+SELECT @@global.time_zone;
+SET @@global.time_zone = "-11:30";
+SELECT @@global.time_zone;
+SET @@global.time_zone = "+00:00";
+SELECT @@global.time_zone;
+SET @@global.time_zone = "-12:59";
+SELECT @@global.time_zone;
+SET @@global.time_zone = "-00:00";
+SELECT @@global.time_zone;
+SET @@global.time_zone = "+10:00";
+SELECT @@global.time_zone;
+SET @@global.time_zone = "+0:0";
+SELECT @@global.time_zone;
+SET @@global.time_zone = "-10:00";
+SELECT @@global.time_zone;
+SET @@global.time_zone = "+2:00";
+SELECT @@global.time_zone;
+
+
+# these test are dependant on values stored in mysql.time_zone_name
+
+#SET @@time_zone = "africa/cairo";
+#SELECT @@time_zone;
+#SET @@time_zone = "America/Aruba";
+#SELECT @@time_zone;
+#
+#SET @@time_zone = "Etc/GMT-14";
+#SELECT @@time_zone;
+#
+#SET @@time_zone = "GMT-0";
+#SELECT @@time_zone;
+#
+#SET @@time_zone = "UTC";
+#SELECT @@time_zone;
+
+#--echo 'Bug: Region and zone values cant be set in time_zone. Although values are loaded in mysql.time_zone_name'
+
+--echo '#--------------------FN_DYNVARS_001_04-------------------------#'
+###########################################################################
+# Change the value of time_zone to invalid value #
+###########################################################################
+
+# for session scope
+
+--Error ER_UNKNOWN_TIME_ZONE
+SET @@time_zone = "+24:00";
+
+--Error ER_UNKNOWN_TIME_ZONE
+SET @@time_zone = "+23:59";
+
+--Error ER_UNKNOWN_TIME_ZONE
+SET @@time_zone = "+13:01";
+
+--Error ER_UNKNOWN_TIME_ZONE
+SET @@time_zone = "-13:01";
+
+# for global scope
+
+--Error ER_UNKNOWN_TIME_ZONE
+SET @@global.time_zone = "+24:00";
+
+--Error ER_UNKNOWN_TIME_ZONE
+SET @@global.time_zone = "+23:59";
+
+--Error ER_UNKNOWN_TIME_ZONE
+SET @@global.time_zone = "+13:01";
+
+--Error ER_UNKNOWN_TIME_ZONE
+SET @@global.time_zone = "-13:01";
+
+
+#checking time zone names not in mysql.time_zone_name. These test may succeed
+#depending on timezone stored
+
+#SET @@time_zone = "london";
+#SELECT @@time_zone;
+#
+#SET @@time_zone = "GMT+14";
+#SELECT @@time_zone;
+
+
+--echo '#-------------------FN_DYNVARS_001_05----------------------------#'
+###########################################################################
+# Assign System time zone to variable for session and global #
+###########################################################################
+
+SET @@global.time_zone = 'SYSTEM';
+SELECT @@global.time_zone;
+
+SET @@time_zone = 'SYSTEM';
+SELECT @@time_zone;
+
+--echo '#----------------------FN_DYNVARS_001_06------------------------#'
+#########################################################################
+# Check if the value in SESSION Table matches value in variable #
+#########################################################################
+
+SELECT @@time_zone = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='time_zone';
+
+
+--echo '#----------------------FN_DYNVARS_001_07------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#########################################################################
+
+SELECT @@global.time_zone = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='time_zone';
+
+
+--echo '#---------------------FN_DYNVARS_001_08-------------------------#'
+#############################################################################
+# Check if ON, OFF, TRUE and FALSE values can be used on variable #
+#############################################################################
+# for session scope
+--Error ER_UNKNOWN_TIME_ZONE
+SET @@time_zone = OFF;
+
+--Error ER_UNKNOWN_TIME_ZONE
+SET @@time_zone = ON;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@time_zone = TRUE;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@time_zone = FALSE;
+
+# for global scope
+--Error ER_UNKNOWN_TIME_ZONE
+SET @@global.time_zone = OFF;
+
+--Error ER_UNKNOWN_TIME_ZONE
+SET @@global.time_zone = ON;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.time_zone = TRUE;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.time_zone = FALSE;
+
+
+--echo '#---------------------FN_DYNVARS_001_09----------------------#'
+#####################################################################
+# Check if Numbers and empty values can be used on variable #
+#####################################################################
+# for session scope
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@time_zone = 1;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@time_zone = +0200;
+
+--Error ER_PARSE_ERROR
+SET @@time_zone = GMT+;
+
+--Error ER_UNKNOWN_TIME_ZONE
+SET @@time_zone = "";
+
+# for global scope
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.time_zone = 1;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.time_zone = +0200;
+
+--Error ER_PARSE_ERROR
+SET @@global.time_zone = GMT+;
+
+--Error ER_UNKNOWN_TIME_ZONE
+SET @@global.time_zone = "";
+
+
+--echo '#---------------------FN_DYNVARS_001_10----------------------#'
+##############################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points
+# to same session variable
+##############################################################################
+
+SET @@time_zone = '+02:30';
+SELECT @@time_zone = @@local.time_zone and @@time_zone = @@session.time_zone;
+SET @@time_zone = '-01:30';
+SELECT @@time_zone = @@local.time_zone and @@time_zone = @@session.time_zone;
+
+
+--echo '#---------------------FN_DYNVARS_001_11----------------------#'
+####################################################################
+# Check if time_zone can be accessed with and without @@ sign #
+####################################################################
+
+SET time_zone = "+01:00";
+SELECT @@time_zone;
+--Error ER_UNKNOWN_TABLE
+SELECT local.time_zone;
+--Error ER_UNKNOWN_TABLE
+SELECT session.time_zone;
+--Error ER_BAD_FIELD_ERROR
+SELECT time_zone = @@session.time_zone;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@time_zone = @session_start_value;
+SELECT @@time_zone;
+
+SET @@global.time_zone = @global_start_value;
+SELECT @@global.time_zone;
+
+#######################################################################
+# END OF time_zone TESTS #
+#######################################################################
diff --git a/mysql-test/suite/sys_vars/t/time_zone_func.test b/mysql-test/suite/sys_vars/t/time_zone_func.test
new file mode 100644
index 00000000..f9d062ba
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/time_zone_func.test
@@ -0,0 +1,180 @@
+############# mysql-test\t\time_zone_func.test #############################
+# #
+# Variable Name: time_zone #
+# Scope: GLOBAL, SESSION #
+# Access Type: Dynamic #
+# Data Type: STRING #
+# Default Value: TRUE 1, FALSE 0 #
+# Values: FALSE 0 #
+# #
+# #
+# Creation Date: 2008-02-25 #
+# Author: Sharique Abdullah #
+# #
+# Description: Test Cases of Dynamic System Variable "time_zone" #
+# that checks behavior of this variable in the following ways #
+# * Functionality based on different values #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html #
+# #
+############################################################################
+
+--echo ** Setup **
+--echo
+#
+# Setup
+#
+
+SET @session_time_zone = @@SESSION.time_zone;
+SET @global_time_zone = @@GLOBAL.time_zone;
+
+CREATE TABLE t1 (a datetime);
+CREATE TABLE t2 (a timestamp);
+
+--echo '#-----------------------------FN_DYNVARS_177_01--------------------#'
+#
+# Value DEFAULT
+#
+SET @@time_zone = DEFAULT;
+
+SELECT @@time_zone;
+--echo SYSTEM Expected
+
+--echo '#-----------------------------FN_DYNVARS_177_02-------------------#'
+#
+# Testing difference values
+#
+
+SET @@time_zone = '+05:00';
+
+SELECT @@time_zone;
+--echo +05:00 Expected
+
+SET @@time_zone = '-01:00';
+
+SELECT @@time_zone;
+--echo -01:00 Expected
+
+SET @@time_zone = '+00:00';
+
+SELECT @@time_zone;
+--echo +00:00 Expected
+
+SET @@time_zone = '-00:00';
+
+SELECT @@time_zone;
+--echo -00:00 Expected
+
+--echo '#-----------------------------FN_DYNVARS_177_03----------------#'
+#
+# Setting possible values
+#
+
+SET @@time_zone = '+00:00';
+
+INSERT INTO t1 VALUES('2008-03-05 16:28:00');
+INSERT INTO t1 VALUES('1970-01-01 00:05:00'),('1970-01-01 01:05:00');
+INSERT INTO t2 VALUES(20080305162800);
+INSERT INTO t2 VALUES(19730101235900);
+INSERT INTO t2 VALUES('1970-01-01 00:05:00'),('1970-01-01 01:05:00');
+INSERT INTO t2 VALUES(19700101000500);
+
+SELECT a,UNIX_TIMESTAMP(a) FROM t1;
+SELECT a,UNIX_TIMESTAMP(a) FROM t2;
+
+SET @@time_zone = 'MET';
+
+SELECT a,UNIX_TIMESTAMP(a) FROM t1;
+SELECT a,UNIX_TIMESTAMP(a) FROM t2;
+
+SET @@time_zone = '+05:00';
+
+SELECT a,UNIX_TIMESTAMP(a) FROM t1;
+SELECT a,UNIX_TIMESTAMP(a) FROM t2;
+
+SET @@time_zone = '+06:00';
+SELECT a,UNIX_TIMESTAMP(a) FROM t1;
+SELECT a,UNIX_TIMESTAMP(a) FROM t2;
+
+SET @@time_zone = '+01:00';
+
+SELECT a,UNIX_TIMESTAMP(a) FROM t1;
+SELECT a,UNIX_TIMESTAMP(a) FROM t2;
+
+SET @@time_zone = '+02:00';
+
+SELECT a,UNIX_TIMESTAMP(a) FROM t1;
+SELECT a,UNIX_TIMESTAMP(a) FROM t2;
+
+SET @@time_zone = '+00:00';
+
+SELECT a,UNIX_TIMESTAMP(a) FROM t1;
+SELECT a,UNIX_TIMESTAMP(a) FROM t2;
+
+SET @@time_zone = '+06:00';
+
+SELECT a,UNIX_TIMESTAMP(a) FROM t1;
+SELECT a,UNIX_TIMESTAMP(a) FROM t2;
+
+--echo Potential Feature: upon recovery of timezone,
+--echo the original value of the timestamp should be recovered.
+
+--echo '#-----------------------------FN_DYNVARS_177_04--------------------#'
+#
+# Testing invalid values
+#
+--error ER_UNKNOWN_TIME_ZONE
+SET @@time_zone = '6';
+
+
+--echo '#-----------------------------FN_DYNVARS_177_05---------------#'
+#
+# Session data integrity check & GLOBAL Value check
+#
+
+SET GLOBAL time_zone = 'SYSTEM';
+
+connect (con_int1,localhost,root,,);
+
+connection con_int1;
+SELECT @@SESSION.time_zone;
+--echo SYSTEM Expected
+
+SET SESSION time_zone = '+05:00';
+
+connect (con_int2,localhost,root,,);
+
+connection con_int2;
+SELECT @@SESSION.time_zone;
+--echo SYSTEM Expected
+
+SET SESSION time_zone = '-10:00';
+
+connection con_int2;
+SELECT @@SESSION.time_zone;
+--echo -10:00 Expected
+
+connection con_int1;
+SELECT @@SESSION.time_zone;
+--echo +05:00 Expected
+
+
+SELECT @@GLOBAL.time_zone;
+--echo SYSTEM Expected
+
+connection default;
+
+disconnect con_int1;
+disconnect con_int2;
+
+
+#
+# Cleanup
+#
+
+
+SET @@SESSION.time_zone = @session_time_zone;
+SET @@GLOBAL.time_zone = @global_time_zone;
+
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/sys_vars/t/timestamp_basic.test b/mysql-test/suite/sys_vars/t/timestamp_basic.test
new file mode 100644
index 00000000..5f780e7a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/timestamp_basic.test
@@ -0,0 +1,153 @@
+################## mysql-test/t/timestamp_basic.test ##########################
+# #
+# Variable Name: timestamp #
+# Scope: SESSION #
+# Access Type: Dynamic #
+# Data Type: string #
+# Default Value: #
+# Range: #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable timestamp #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+#######################################################################
+# START OF timestamp TESTS #
+#######################################################################
+
+
+#######################################################################
+# Saving initial value of timestamp in a temporary variable #
+#######################################################################
+
+SET @session_start_value = @@session.timestamp;
+
+--echo '#--------------------FN_DYNVARS_001_01------------------------#'
+########################################################################
+# Display the DEFAULT value of timestamp #
+########################################################################
+
+
+SET @@timestamp = DEFAULT;
+SELECT floor(@@timestamp) = UNIX_TIMESTAMP(), @@timestamp = UNIX_TIMESTAMP(NOW(6));
+
+--echo '#---------------------FN_DYNVARS_001_02-------------------------#'
+##############################################################
+# see if accessible using global scope #
+##############################################################
+
+--Error ER_LOCAL_VARIABLE
+SET @@global.timestamp = "1000";
+
+--echo '#--------------------FN_DYNVARS_001_03------------------------#'
+########################################################################
+# Change the value of timestamp to a valid value #
+########################################################################
+
+SET @@timestamp = 0;
+SELECT floor(@@timestamp) = UNIX_TIMESTAMP(), @@timestamp = UNIX_TIMESTAMP(NOW(6));
+
+--echo 'Setting 0 resets timestamp to session default timestamp'
+
+SET @@timestamp = -1000000000;
+SELECT floor(@@timestamp) = UNIX_TIMESTAMP(), @@timestamp = UNIX_TIMESTAMP(NOW(6));
+
+SET @temp_ts = @@timestamp - @@timestamp;
+SELECT @temp_ts;
+
+SET @@timestamp = 1.1;
+SELECT @@timestamp;
+
+SET @@timestamp = 9999999999999999999999;
+SELECT @@timestamp;
+
+--echo '#--------------------FN_DYNVARS_001_04-------------------------#'
+###########################################################################
+# Change the value of timestamp to invalid value #
+###########################################################################
+
+# for session scope
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@timestamp = "100";
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@timestamp = " ";
+
+--echo '#----------------------FN_DYNVARS_001_06------------------------#'
+#########################################################################
+# Check if the value in SESSION Table matches value in variable #
+#########################################################################
+
+# disabled due to bug#41584
+#SELECT @@timestamp = VARIABLE_VALUE
+#FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+#WHERE VARIABLE_NAME='timestamp';
+
+--echo '#---------------------FN_DYNVARS_001_08-------------------------#'
+#############################################################################
+# Check if ON, OFF, TRUE and FALSE values can be used on variable #
+#############################################################################
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@timestamp = OFF;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@timestamp = ON;
+
+SET @@timestamp = TRUE;
+SELECT @@timestamp;
+
+SET @@timestamp = FALSE;
+#SELECT @@timestamp;
+
+
+
+--echo '#---------------------FN_DYNVARS_001_10----------------------#'
+#############################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE points
+# to same session variable
+#############################################################################
+
+SET @@timestamp = 123456;
+SELECT @@timestamp = @@local.timestamp and @@timestamp = @@session.timestamp;
+SET @@timestamp = 654321;
+SELECT @@timestamp = @@local.timestamp and @@timestamp = @@session.timestamp;
+
+
+--echo '#---------------------FN_DYNVARS_001_11----------------------#'
+#####################################################################
+# Check if timestamp can be accessed with and without @@ sign #
+#####################################################################
+
+SET timestamp = 1;
+SELECT @@timestamp;
+--Error ER_UNKNOWN_TABLE
+SELECT local.timestamp;
+--Error ER_UNKNOWN_TABLE
+SELECT session.timestamp;
+--Error ER_BAD_FIELD_ERROR
+SELECT timestamp = @@session.timestamp;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@timestamp = @session_start_value;
+
+#######################################################################
+# END OF timestamp TESTS #
+#######################################################################
+
diff --git a/mysql-test/suite/sys_vars/t/timestamp_func.test b/mysql-test/suite/sys_vars/t/timestamp_func.test
new file mode 100644
index 00000000..6157a1bc
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/timestamp_func.test
@@ -0,0 +1,44 @@
+############################################################################
+# #
+# Variable Name: timestamp #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: INTEGER #
+# #
+# #
+# Creation Date: 2008-02-25 #
+# Author: Sharique Abdullah #
+# #
+# Modified: HHunger 2008-08-28 Reimplemented the test completely. #
+# #
+# Description: Test Cases of Dynamic System Variable "timestamp" #
+# that checks behavior of this variable in the following ways #
+# * Functionality based on different values #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html #
+# #
+############################################################################
+
+# Change timestamp which must have an effect on now(), but not on sysdate().
+# Use Unix epoch timestamp
+# All comparisons must deliver true(1)
+# Exception: --sysdate-is-now switches off this behaviour and must not be set.
+
+connect (con1,localhost,root,,);
+SELECT date(now()) = date(sysdate());
+SET @@session.timestamp = 1100000000;
+SELECT date(now()) != date(sysdate());
+
+# Assure that setting of the variable has no effect on other session.
+connect (con0,localhost,root,,);
+SELECT @@session.timestamp != 1100000000;
+SET @@session.timestamp = 1000000000;
+SELECT date(now()) != date(sysdate());
+
+connection con1;
+SELECT @@session.timestamp != 1000000000;
+SELECT @@session.timestamp = 1100000000;
+
+connection default;
+disconnect con0;
+disconnect con1;
diff --git a/mysql-test/suite/sys_vars/t/timestamp_sysdate_is_now_func-master.opt b/mysql-test/suite/sys_vars/t/timestamp_sysdate_is_now_func-master.opt
new file mode 100644
index 00000000..97a58d28
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/timestamp_sysdate_is_now_func-master.opt
@@ -0,0 +1 @@
+--sysdate-is-now
diff --git a/mysql-test/suite/sys_vars/t/timestamp_sysdate_is_now_func.test b/mysql-test/suite/sys_vars/t/timestamp_sysdate_is_now_func.test
new file mode 100644
index 00000000..80457f3c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/timestamp_sysdate_is_now_func.test
@@ -0,0 +1,41 @@
+############################################################################
+# #
+# Variable Name: timestamp with sysdate-is-now #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: INTEGER #
+# #
+# #
+# Creation Date: 2008-11-25 #
+# Author: Horst Hunger #
+# #
+# Description: Test Cases of Dynamic System Variable "timestamp" #
+# that checks behavior of this variable in the following ways #
+# * Like timstamp_func, but with set "sysdate-is-now". #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html #
+# #
+############################################################################
+
+# Use Unix epoch timestamp
+# Due to "--sysdate-is-now" timestamp must have an effect on both.
+# See also timestamp_func.test.
+
+connect (con1,localhost,root,,);
+SELECT date(now()) = date(sysdate());
+SET @@session.timestamp = 1100000000;
+SELECT date(now()) != date(sysdate());
+
+# Assure that setting of the variable has no effect on other session.
+connect (con0,localhost,root,,);
+SELECT @@session.timestamp != 1100000000;
+SET @@session.timestamp = 1000000000;
+SELECT date(now()) != date(sysdate());
+
+connection con1;
+SELECT @@session.timestamp != 1000000000;
+SELECT @@session.timestamp = 1100000000;
+
+connection default;
+disconnect con0;
+disconnect con1;
diff --git a/mysql-test/suite/sys_vars/t/tmp_disk_table_size_basic.test b/mysql-test/suite/sys_vars/t/tmp_disk_table_size_basic.test
new file mode 100644
index 00000000..099be354
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/tmp_disk_table_size_basic.test
@@ -0,0 +1,223 @@
+###################### tmp_disk_table_size_basic.test ######################
+# #
+# Variable Name: tmp_disk_table_size #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: system dependend #
+# Range: 1024-system dependend #
+# #
+# #
+# Creation Date: 2008-02-13 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable tmp_table_size #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# Modified: 2008-12-04 HHunger #
+# removed the differences between 64 and 32 bit platforms #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+##############################################################
+# START OF tmp_disk_table_size TESTS #
+##############################################################
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.tmp_disk_table_size;
+SET @start_session_value = @@session.tmp_disk_table_size;
+
+--echo '#--------------------FN_DYNVARS_005_01-------------------------#'
+##############################################################
+# Display the DEFAULT value of tmp_disk_table_size #
+##############################################################
+
+SET @@global.tmp_disk_table_size = 100;
+SET @@global.tmp_disk_table_size = DEFAULT;
+
+SET @@session.tmp_disk_table_size = 200;
+SET @@session.tmp_disk_table_size = DEFAULT;
+
+--echo '#--------------------FN_DYNVARS_005_02-------------------------#'
+########################################################################
+# Check the DEFAULT value of tmp_disk_table_size #
+########################################################################
+# The DEFAULT value is system dependend.
+# Therefore we have only a plausibility check here
+SELECT @@global.tmp_disk_table_size >= 16777216;
+SELECT @@session.tmp_disk_table_size >= 16777216;
+
+--echo '#--------------------FN_DYNVARS_005_03-------------------------#'
+########################################################################
+# Change the value of tmp_disk_table_size to a valid value for GLOBAL Scope #
+########################################################################
+
+SET @@global.tmp_disk_table_size = 1024;
+SELECT @@global.tmp_disk_table_size;
+SET @@global.tmp_disk_table_size = 60020;
+SELECT @@global.tmp_disk_table_size;
+SET @@global.tmp_disk_table_size = 4294967295;
+SELECT @@global.tmp_disk_table_size;
+
+
+--echo '#--------------------FN_DYNVARS_005_04-------------------------#'
+#########################################################################
+# Change the value of tmp_disk_table_size to a valid value for SESSION Scope #
+#########################################################################
+
+SET @@session.tmp_disk_table_size = 1024;
+SELECT @@session.tmp_disk_table_size;
+
+SET @@session.tmp_disk_table_size = 4294967295;
+SELECT @@session.tmp_disk_table_size;
+SET @@session.tmp_disk_table_size = 65535;
+SELECT @@session.tmp_disk_table_size;
+
+
+--echo '#------------------FN_DYNVARS_005_05-----------------------#'
+##########################################################
+# Change the value of tmp_disk_table_size to an invalid value #
+##########################################################
+
+SET @@global.tmp_disk_table_size = 0;
+SELECT @@global.tmp_disk_table_size;
+
+SET @@global.tmp_disk_table_size = -1024;
+SELECT @@global.tmp_disk_table_size;
+
+SET @@global.tmp_disk_table_size = 1000;
+SELECT @@global.tmp_disk_table_size;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.tmp_disk_table_size = ON;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.tmp_disk_table_size = OFF;
+
+SET @@global.tmp_disk_table_size = True;
+SELECT @@global.tmp_disk_table_size;
+
+SET @@global.tmp_disk_table_size = False;
+SELECT @@global.tmp_disk_table_size;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.tmp_disk_table_size = 65530.34;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.tmp_disk_table_size ="Test";
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.tmp_disk_table_size = ON;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.tmp_disk_table_size = OFF;
+
+SET @@session.tmp_disk_table_size = True;
+SELECT @@session.tmp_disk_table_size;
+
+SET @@session.tmp_disk_table_size = False;
+SELECT @@session.tmp_disk_table_size;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.tmp_disk_table_size = "Test";
+
+--disable_warnings
+SET @@session.tmp_disk_table_size = 12345678901;
+--enable_warnings
+# With a 64 bit mysqld:12345678901,with a 32 bit mysqld: 4294967295
+SELECT @@session.tmp_disk_table_size IN (12345678901,4294967295);
+
+--echo '#------------------FN_DYNVARS_005_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+SELECT @@global.tmp_disk_table_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='tmp_disk_table_size';
+
+--echo '#------------------FN_DYNVARS_005_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.tmp_disk_table_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='tmp_disk_table_size';
+
+--echo '#---------------------FN_DYNVARS_001_09----------------------#'
+########################################################################
+# Check if global and session variables are independent of each other #
+########################################################################
+
+SET @@global.tmp_disk_table_size = 1024;
+SET @@tmp_disk_table_size = 4294967295;
+SELECT @@tmp_disk_table_size = @@global.tmp_disk_table_size;
+
+--echo '#---------------------FN_DYNVARS_001_10----------------------#'
+##################################################################
+# Check if accessing variable with SESSION,LOCAL and without #
+# SCOPE points to same session variable #
+##################################################################
+
+SET @@tmp_disk_table_size = 100;
+SELECT @@tmp_disk_table_size = @@local.tmp_disk_table_size;
+SELECT @@local.tmp_disk_table_size = @@session.tmp_disk_table_size;
+
+
+--echo '#---------------------FN_DYNVARS_001_11----------------------#'
+#########################################################################
+# Check if tmp_disk_table_size can be accessed with and without @@ sign #
+#########################################################################
+
+SET tmp_disk_table_size = 1027;
+SELECT @@tmp_disk_table_size;
+
+--Error ER_UNKNOWN_TABLE
+SELECT local.tmp_disk_table_size;
+
+--Error ER_UNKNOWN_TABLE
+SELECT global.tmp_disk_table_size;
+
+--Error ER_BAD_FIELD_ERROR
+SELECT tmp_disk_table_size = @@session.tmp_disk_table_size;
+
+--echo #
+--echo # Beginning of 10.4 test
+--echo #
+--echo # Diagnostics_area::sql_errno() const: Assertion `m_status == DA_ERROR'
+--echo # failed on SELECT after setting tmp_disk_table_size.
+--echo #
+
+SET @@tmp_disk_table_size=16384;
+CREATE VIEW v AS SELECT 'a';
+
+--error ER_RECORD_FILE_FULL
+SELECT table_name FROM INFORMATION_SCHEMA.views;
+
+DROP VIEW v;
+
+--echo # End of 10.4 test
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.tmp_disk_table_size = @start_global_value;
+SET @@session.tmp_disk_table_size = @start_session_value;
+
+###################################################
+# END OF tmp_disk_table_size TESTS #
+###################################################
+
diff --git a/mysql-test/suite/sys_vars/t/tmp_disk_table_size_func.test b/mysql-test/suite/sys_vars/t/tmp_disk_table_size_func.test
new file mode 100644
index 00000000..c78eac19
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/tmp_disk_table_size_func.test
@@ -0,0 +1,29 @@
+###################### tmp_memory_table_size_func.test ########################
+
+--source include/have_aria_used_for_temp_tables.inc
+
+--source include/load_sysvars.inc
+--source include/have_sequence.inc
+
+--echo
+--echo "Ensure that we get an error if we exceed tmp_disk_table_size"
+--echo
+
+SET @start_tmp_memory_table_size=@@session.tmp_memory_table_size;
+SET @start_tmp_disk_table_size=@@session.tmp_disk_table_size;
+
+set @@session.tmp_memory_table_size=1000;
+set @@session.tmp_disk_table_size=3000000;
+
+--disable_ps2_protocol
+create table t1 (a int primary key, b varchar(2000));
+insert into t1 select seq,repeat(char(mod(seq,62)+64),seq) from seq_1_to_2000;
+insert into t1 values (20000,"A");
+select count(*) as c from t1 group by b having c>1;
+show status like "created_tmp_disk%";
+set @@session.tmp_disk_table_size=1000000;
+--error ER_RECORD_FILE_FULL
+select count(*) as c from t1 group by b having c>1;
+show status like "created_tmp_disk%";
+drop table t1;
+--enable_ps2_protocol
diff --git a/mysql-test/suite/sys_vars/t/tmpdir_basic.test b/mysql-test/suite/sys_vars/t/tmpdir_basic.test
new file mode 100644
index 00000000..5e9d08c4
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/tmpdir_basic.test
@@ -0,0 +1,100 @@
+
+
+################## mysql-test\t\tmpdir_basic.test #############################
+# #
+# Variable Name: tmpdir #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: filename #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable tmpdir #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--echo '#---------------------BS_STVARS_052_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.tmpdir);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_052_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.tmpdir=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.tmpdir);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_052_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+SELECT @@GLOBAL.tmpdir = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='tmpdir';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.tmpdir);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='tmpdir';
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_052_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@tmpdir = @@GLOBAL.tmpdir;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_052_05----------------------#'
+################################################################################
+# Check if tmpdir can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@tmpdir);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.tmpdir);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.tmpdir);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.tmpdir);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT tmpdir = @@SESSION.tmpdir;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/transaction_alloc_block_size_basic.test b/mysql-test/suite/sys_vars/t/transaction_alloc_block_size_basic.test
new file mode 100644
index 00000000..0faa95c8
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/transaction_alloc_block_size_basic.test
@@ -0,0 +1,228 @@
+############## mysql-test\t\transaction_alloc_block_size_basic.test ###########
+# #
+# Variable Name: transaction_alloc_block_size #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 8192 #
+# Range: 1024-134217728 #
+# #
+# #
+# Creation Date: 2008-02-14 #
+# Author: Salman #
+# #
+# Description: Test Cases of Dynamic System Variable #
+# transaction_alloc_block_size #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF transaction_alloc_block_size TESTS #
+########################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.transaction_alloc_block_size;
+SELECT @start_global_value;
+SET @start_session_value = @@session.transaction_alloc_block_size;
+SELECT @start_session_value;
+
+
+--echo '#--------------------FN_DYNVARS_005_01-------------------------#'
+########################################################################
+# Display the DEFAULT value of transaction_alloc_block_size #
+########################################################################
+
+SET @@global.transaction_alloc_block_size = 100;
+SET @@global.transaction_alloc_block_size = DEFAULT;
+SELECT @@global.transaction_alloc_block_size;
+
+
+SET @@session.transaction_alloc_block_size = 200;
+SET @@session.transaction_alloc_block_size = DEFAULT;
+SELECT @@session.transaction_alloc_block_size;
+
+
+
+--echo '#--------------------FN_DYNVARS_005_02-------------------------#'
+########################################################################
+# Check the DEFAULT value of transaction_alloc_block_size #
+########################################################################
+
+SET @@global.transaction_alloc_block_size = DEFAULT;
+SELECT @@global.transaction_alloc_block_size = 8192;
+
+SET @@session.transaction_alloc_block_size = DEFAULT;
+SELECT @@session.transaction_alloc_block_size = 8192;
+
+
+--echo '#--------------------FN_DYNVARS_005_03-------------------------#'
+##################################################################
+# Change the value of variable to a valid value for GLOBAL Scope #
+##################################################################
+
+SET @@global.transaction_alloc_block_size = 1024;
+SELECT @@global.transaction_alloc_block_size;
+
+SET @@global.transaction_alloc_block_size = 60020;
+SELECT @@global.transaction_alloc_block_size;
+
+--echo '#--------------------FN_DYNVARS_005_04-------------------------#'
+###################################################################
+# Change the value of variable to a valid value for SESSION Scope #
+###################################################################
+
+SET @@session.transaction_alloc_block_size = 1024;
+SELECT @@session.transaction_alloc_block_size;
+
+SET @@session.transaction_alloc_block_size = 65535;
+SELECT @@session.transaction_alloc_block_size;
+
+
+--echo '#------------------FN_DYNVARS_005_05-----------------------#'
+########################################################################
+# Change the value of transaction_alloc_block_size to an invalid value #
+########################################################################
+
+SET @@global.transaction_alloc_block_size = 0;
+SELECT @@global.transaction_alloc_block_size;
+
+SET @@global.transaction_alloc_block_size = -1024;
+SELECT @@global.transaction_alloc_block_size;
+
+
+SET @@global.transaction_alloc_block_size = 135217728;
+SELECT @@global.transaction_alloc_block_size;
+
+-- Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.transaction_alloc_block_size = ON;
+
+-- Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.transaction_alloc_block_size = OFF;
+
+
+SET @@global.transaction_alloc_block_size = True;
+SELECT @@global.transaction_alloc_block_size;
+
+SET @@global.transaction_alloc_block_size = False;
+SELECT @@global.transaction_alloc_block_size;
+
+
+-- Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.transaction_alloc_block_size = 65530.34;
+
+-- Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.transaction_alloc_block_size ="Test";
+
+SET @@global.transaction_alloc_block_size = 1000;
+SELECT @@global.transaction_alloc_block_size;
+
+SET @@session.transaction_alloc_block_size = 135217728;
+SELECT @@session.transaction_alloc_block_size;
+
+-- Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.transaction_alloc_block_size = ON;
+
+-- Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.transaction_alloc_block_size = OFF;
+
+SET @@session.transaction_alloc_block_size = True;
+SELECT @@session.transaction_alloc_block_size;
+
+SET @@session.transaction_alloc_block_size = False;
+SELECT @@session.transaction_alloc_block_size;
+
+
+-- Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.transaction_alloc_block_size = "Test";
+
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.transaction_alloc_block_size = 'test';
+
+--echo '#------------------FN_DYNVARS_005_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT @@global.transaction_alloc_block_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='transaction_alloc_block_size';
+
+--echo '#------------------FN_DYNVARS_005_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.transaction_alloc_block_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='transaction_alloc_block_size';
+
+
+--echo '#---------------------FN_DYNVARS_001_08----------------------#'
+###########################################################################
+# Check if global and session variable are independent of each other #
+###########################################################################
+
+SET @@transaction_alloc_block_size = 1024;
+SET @@global.transaction_alloc_block_size = 134217728;
+SELECT @@transaction_alloc_block_size = @@global.transaction_alloc_block_size;
+
+
+--echo '#---------------------FN_DYNVARS_001_09----------------------#'
+########################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE #
+# points to same session variable #
+########################################################################
+
+SET @@transaction_alloc_block_size = 100;
+SELECT @@transaction_alloc_block_size = @@local.transaction_alloc_block_size;
+SELECT @@local.transaction_alloc_block_size = @@session.transaction_alloc_block_size;
+
+
+--echo '#---------------------FN_DYNVARS_001_10----------------------#'
+################################################################
+# Check if variable can be accessed with and without @@ sign #
+################################################################
+
+SET transaction_alloc_block_size = 1027;
+SELECT @@transaction_alloc_block_size;
+
+--Error ER_UNKNOWN_TABLE
+SELECT local.transaction_alloc_block_size;
+
+--Error ER_UNKNOWN_TABLE
+SELECT session.transaction_alloc_block_size;
+
+--Error ER_BAD_FIELD_ERROR
+SELECT transaction_alloc_block_size = @@session.transaction_alloc_block_size;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.transaction_alloc_block_size = @start_global_value;
+SELECT @@global.transaction_alloc_block_size;
+SET @@session.tmp_table_size = @start_session_value;
+SELECT @@session.transaction_alloc_block_size;
+
+
+#############################################################
+# END OF transaction_alloc_block_size TESTS #
+#############################################################
+
diff --git a/mysql-test/suite/sys_vars/t/transaction_prealloc_size_basic.test b/mysql-test/suite/sys_vars/t/transaction_prealloc_size_basic.test
new file mode 100644
index 00000000..9d0c20a3
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/transaction_prealloc_size_basic.test
@@ -0,0 +1,214 @@
+############## mysql-test\t\transaction_prealloc_size_basic.test ##############
+# #
+# Variable Name: transaction_prealloc_size #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: 4096 #
+# Range: 1024-134217728 #
+# #
+# #
+# Creation Date: 2008-02-14 #
+# Author: Sharique Abdullah #
+# #
+# Description: Test Cases of Dynamic System Variable transaction_prealloc_size#
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_transaction_prealloc_size #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF transaction_prealloc_size TESTS #
+########################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.transaction_prealloc_size;
+SELECT @start_global_value;
+SET @start_session_value = @@session.transaction_prealloc_size;
+SELECT @start_session_value;
+
+--echo '#--------------------FN_DYNVARS_005_01-------------------------#'
+########################################################################
+# Display the DEFAULT value of transaction_prealloc_size #
+########################################################################
+
+SET @@global.transaction_prealloc_size = 100;
+SET @@global.transaction_prealloc_size = DEFAULT;
+SELECT @@global.transaction_prealloc_size;
+
+
+SET @@session.transaction_prealloc_size = 200;
+SET @@session.transaction_prealloc_size = DEFAULT;
+SELECT @@session.transaction_prealloc_size;
+
+--echo '#--------------------FN_DYNVARS_005_02-------------------------#'
+########################################################################
+# Check the DEFAULT value of transaction_prealloc_size #
+########################################################################
+
+SET @@global.transaction_prealloc_size = DEFAULT;
+SELECT @@global.transaction_prealloc_size = 4096;
+
+SET @@session.transaction_prealloc_size = DEFAULT;
+SELECT @@session.transaction_prealloc_size = 4096;
+
+--echo '#--------------------FN_DYNVARS_005_03-------------------------#'
+##################################################################
+# Change the value of variable to a valid value for GLOBAL Scope #
+##################################################################
+
+SET @@global.transaction_prealloc_size = 1024;
+SELECT @@global.transaction_prealloc_size;
+
+SET @@global.transaction_prealloc_size = 60020;
+SELECT @@global.transaction_prealloc_size;
+
+--echo '#--------------------FN_DYNVARS_005_04-------------------------#'
+###################################################################
+# Change the value of variable to a valid value for SESSION Scope #
+###################################################################
+
+SET @@session.transaction_prealloc_size = 1024;
+SELECT @@session.transaction_prealloc_size;
+
+SET @@session.transaction_prealloc_size = 65535;
+SELECT @@session.transaction_prealloc_size;
+
+--echo '#------------------FN_DYNVARS_005_05-----------------------#'
+#####################################################################
+# Change the value of transaction_prealloc_size to an invalid value #
+#####################################################################
+
+SET @@global.transaction_prealloc_size = 0;
+SELECT @@global.transaction_prealloc_size;
+
+SET @@global.transaction_prealloc_size = -1024;
+SELECT @@global.transaction_prealloc_size;
+
+-- Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.transaction_prealloc_size = ON;
+
+
+-- Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.transaction_prealloc_size = OFF;
+
+
+SET @@global.transaction_prealloc_size = True;
+SELECT @@global.transaction_prealloc_size;
+
+SET @@global.transaction_prealloc_size = False;
+SELECT @@global.transaction_prealloc_size;
+
+
+-- Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.transaction_prealloc_size = 65530.34;
+
+-- Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.transaction_prealloc_size ="Test";
+
+SET @@global.transaction_prealloc_size = 1000;
+SELECT @@global.transaction_prealloc_size;
+
+-- Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.transaction_prealloc_size = ON;
+
+
+-- Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.transaction_prealloc_size = OFF;
+
+SET @@session.transaction_prealloc_size = True;
+SELECT @@session.transaction_prealloc_size;
+
+SET @@session.transaction_prealloc_size = False;
+SELECT @@session.transaction_prealloc_size;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.transaction_prealloc_size = "Test";
+
+SET @@session.transaction_prealloc_size = 135217728;
+SELECT @@session.transaction_prealloc_size;
+
+
+--echo '#------------------FN_DYNVARS_005_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT @@global.transaction_prealloc_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='transaction_prealloc_size';
+
+--echo '#------------------FN_DYNVARS_005_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.transaction_prealloc_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='transaction_prealloc_size';
+
+--echo '#---------------------FN_DYNVARS_001_09----------------------#'
+###########################################################################
+# Check if global and session variable are independent of each other #
+###########################################################################
+
+SET @@global.transaction_prealloc_size = 1024;
+SET @@global.transaction_prealloc_size = 10;
+
+SELECT @@transaction_prealloc_size = @@global.transaction_prealloc_size;
+
+--echo '#---------------------FN_DYNVARS_001_10----------------------#'
+########################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE #
+# points to same session variable #
+########################################################################
+
+SET @@transaction_prealloc_size = 100;
+SELECT @@transaction_prealloc_size = @@local.transaction_prealloc_size;
+SELECT @@local.transaction_prealloc_size = @@session.transaction_prealloc_size;
+
+
+--echo '#---------------------FN_DYNVARS_001_11----------------------#'
+###############################################################################
+# Check if transaction_prealloc_size can be accessed with and without @@ sign #
+###############################################################################
+
+SET transaction_prealloc_size = 1027;
+SELECT @@transaction_prealloc_size;
+
+--Error ER_UNKNOWN_TABLE
+SELECT local.transaction_prealloc_size;
+
+--Error ER_UNKNOWN_TABLE
+SELECT session.transaction_prealloc_size;
+
+--Error ER_BAD_FIELD_ERROR
+SELECT transaction_prealloc_size = @@session.transaction_prealloc_size;
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.transaction_prealloc_size = @start_global_value;
+SELECT @@global.transaction_prealloc_size;
+SET @@session.transaction_prealloc_size = @start_session_value;
+SELECT @@session.transaction_prealloc_size;
+
+
+#############################################################
+# END OF transaction_prealloc_size TESTS #
+#############################################################
+
diff --git a/mysql-test/suite/sys_vars/t/transaction_prealloc_size_bug27322.test b/mysql-test/suite/sys_vars/t/transaction_prealloc_size_bug27322.test
new file mode 100644
index 00000000..6e3c330c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/transaction_prealloc_size_bug27322.test
@@ -0,0 +1,66 @@
+#
+# test variables big
+#
+
+--source include/big_test.inc
+# The test would allocate and initialize 5GB of memory
+# if compiled with debug. It can take a lot of time
+# of for paging/swapping.
+--source include/not_debug.inc
+
+#
+# Bug#27322 failure to allocate transaction_prealloc_size causes crash
+#
+#
+# Manual (6.0):
+# Platform Bit Size Range Default
+# 32 1024-4294967295 (4 Gi - 1) 4096
+# 64 1024-18446744073709547520 4096
+#
+# Observation(mleich):
+# 1. - Linux 64 Bit, MySQL 64 Bit, 4 GiB RAM, 8 GiB swap
+# - SET SESSION transaction_prealloc_size=1099511627776;
+# SHOW PROCESSLIST;
+# Id User ... Info
+# <Id> root ... SHOW PROCESSLIST
+# SELECT @@session.transaction_prealloc_size;
+# @@session.transaction_prealloc_size
+# 1099511627776
+# very short runtime in 5.0
+# excessive resource consumption + long runtime in 5.1 and 6.0
+# 2. - Win in VM, slightly older version of this test, MySQL 5.0
+# - testcase timeout after 900s
+# analyze-timeout-mysqld.1.err :
+# Id User ... Time Info
+# 83 root ... 542 set session transaction_prealloc_size=1024*1024*1024*2
+# 84 root ... 1 SHOW PROCESSLIST
+#
+# There is a significant probablitity that this tests fails with testcase
+# timeout if the testing box is not powerful enough.
+#
+SET @def_var= @@session.transaction_prealloc_size;
+
+--disable_warnings
+SET SESSION transaction_prealloc_size=1024*1024*1024*1;
+# Embedded server is shows "cleaning up" as STATE, while non-embedded shows "init"
+--replace_column 1 <Id> 3 <Host> 6 <Time> 7 <State>
+--replace_result Execute Query
+SHOW PROCESSLIST;
+SET SESSION transaction_prealloc_size=1024*1024*1024*2;
+--replace_column 1 <Id> 3 <Host> 6 <Time> 7 <State>
+--replace_result Execute Query
+SHOW PROCESSLIST;
+SET SESSION transaction_prealloc_size=1024*1024*1024*3;
+--replace_column 1 <Id> 3 <Host> 6 <Time> 7 <State>
+--replace_result Execute Query
+SHOW PROCESSLIST;
+SET SESSION transaction_prealloc_size=1024*1024*1024*4;
+--replace_column 1 <Id> 3 <Host> 6 <Time> 7 <State>
+--replace_result Execute Query
+SHOW PROCESSLIST;
+SET SESSION transaction_prealloc_size=1024*1024*1024*5;
+--replace_column 1 <Id> 3 <Host> 6 <Time> 7 <State>
+--replace_result Execute Query
+SHOW PROCESSLIST;
+--enable_warnings
+
diff --git a/mysql-test/suite/sys_vars/t/tx_isolation_basic.test b/mysql-test/suite/sys_vars/t/tx_isolation_basic.test
new file mode 100644
index 00000000..5b484cb9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/tx_isolation_basic.test
@@ -0,0 +1,212 @@
+################# mysql-test\t\tx_isolation_basic.test ########################
+# #
+# Variable Name: tx_isolation #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: enumeration #
+# Default Value: REPEATABLE-READ #
+# Valid Values: READ-UNCOMMITTED, READCOMMITTED, REPEATABLE-READ,SERIALIZABLE #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable tx_isolation #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF tx_isolation TESTS #
+########################################################################
+
+
+#########################################################################
+# Saving initial value of tx_isolation in a temporary variable #
+#########################################################################
+
+SET @global_start_value = @@global.tx_isolation;
+SELECT @global_start_value;
+
+SET @session_start_value = @@session.tx_isolation;
+SELECT @session_start_value;
+
+--echo '#--------------------FN_DYNVARS_183_01------------------------#'
+####################################################################
+# Display the DEFAULT value of tx_isolation #
+####################################################################
+
+SET @@global.tx_isolation = 'READ-UNCOMMITTED';
+SET @@global.tx_isolation = DEFAULT;
+SELECT @@global.tx_isolation;
+
+SET @@session.tx_isolation = DEFAULT;
+SELECT @@session.tx_isolation;
+
+--echo '#---------------------FN_DYNVARS_183_02-------------------------#'
+#########################################################
+# Check if NULL or empty value is accepeted #
+#########################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.tx_isolation = NULL;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.tx_isolation = '';
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.tx_isolation = NULL;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.tx_isolation = '';
+
+--echo '#--------------------FN_DYNVARS_183_03------------------------#'
+#####################################################################
+# Change the value of tx_isolation to a valid value #
+#####################################################################
+
+SET @@global.tx_isolation = 'READ-UNCOMMITTED';
+SELECT @@global.tx_isolation;
+
+SET @@global.tx_isolation = 'read-COMMITTED';
+SELECT @@global.tx_isolation;
+
+SET @@global.tx_isolation = 'REPEATABLE-READ';
+SELECT @@global.tx_isolation;
+
+SET @@global.tx_isolation = 'SERIALIZable';
+SELECT @@global.tx_isolation;
+
+
+SET @@session.tx_isolation = 'READ-UNCOMMITTED';
+SELECT @@session.tx_isolation;
+
+SET @@session.tx_isolation = 'READ-COMMITTED';
+SELECT @@session.tx_isolation;
+
+SET @@session.tx_isolation = 'REPEATABLE-READ';
+SELECT @@session.tx_isolation;
+
+SET @@session.tx_isolation = 'serializable';
+SELECT @@session.tx_isolation;
+
+
+--echo '#--------------------FN_DYNVARS_183_04-------------------------#'
+#######################################################################
+# Change the value of tx_isolation to invalid value #
+#######################################################################
+
+# for global scope
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.tx_isolation = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.tx_isolation = READUNCOMMITTED;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.tx_isolation = 'REPEATABLE';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.tx_isolation = OFF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.tx_isolation = ON;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.tx_isolation = 'NON-SERIALIZABLE';
+
+# for session scope
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@tx_isolation = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@tx_isolation = READUNCOMMITTED;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@tx_isolation = 'REPEATABLE';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@tx_isolation = 'NONE';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@tx_isolation = 'ALL';
+
+--echo '#-------------------FN_DYNVARS_183_05----------------------------#'
+#########################################################################
+# Check if the value in session Table matches value in variable #
+#########################################################################
+
+SELECT @@session.tx_isolation = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='tx_isolation';
+
+--echo '#----------------------FN_DYNVARS_183_06------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#########################################################################
+
+SELECT @@global.tx_isolation = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='tx_isolation';
+
+
+--echo '#---------------------FN_DYNVARS_183_07-------------------------#'
+###################################################################
+# Check if numbers can be used on variable #
+###################################################################
+
+# test if variable accepts 0,1,2
+SET @@global.tx_isolation = 0;
+SELECT @@global.tx_isolation;
+
+SET @@global.tx_isolation = 1;
+SELECT @@global.tx_isolation;
+
+SET @@global.tx_isolation = 2;
+SELECT @@global.tx_isolation;
+
+SET @@global.tx_isolation = 3;
+SELECT @@global.tx_isolation;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.tx_isolation = 0.4;
+
+--echo '#---------------------FN_DYNVARS_183_08----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@global.tx_isolation = TRUE;
+SELECT @@global.tx_isolation;
+SET @@global.tx_isolation = FALSE;
+SELECT @@global.tx_isolation;
+
+--echo '#---------------------FN_DYNVARS_183_09----------------------#'
+########################################################################
+# Check if tx_isolation can be accessed with and without @@ sign #
+########################################################################
+
+SET tx_isolation = 'REPEATABLE-READ';
+
+#using SET SESSION|GLOBAL syntax
+SET session tx_isolation = 'REPEATABLE-READ';
+SELECT @@tx_isolation;
+
+SET global tx_isolation = 'REPEATABLE-READ';
+SELECT @@global.tx_isolation;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@global.tx_isolation = @global_start_value;
+SELECT @@global.tx_isolation;
+
+SET @@session.tx_isolation = @session_start_value;
+SELECT @@session.tx_isolation;
+
+####################################################################
+# END OF tx_isolation TESTS #
+####################################################################
+
diff --git a/mysql-test/suite/sys_vars/t/tx_isolation_func-master.opt b/mysql-test/suite/sys_vars/t/tx_isolation_func-master.opt
new file mode 100644
index 00000000..67166a46
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/tx_isolation_func-master.opt
@@ -0,0 +1,3 @@
+--loose-innodb
+--loose-innodb_lock_wait_timeout=2
+--binlog-format=row \ No newline at end of file
diff --git a/mysql-test/suite/sys_vars/t/tx_isolation_func.test b/mysql-test/suite/sys_vars/t/tx_isolation_func.test
new file mode 100644
index 00000000..164422be
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/tx_isolation_func.test
@@ -0,0 +1,369 @@
+############# mysql-test\t\tx_isolation_func.test #######################################
+# #
+# Variable Name: tx_isolation #
+# Scope: GLOBAL & SESSION #
+# Access Type: Dynamic #
+# Data Type: ENUMERATION #
+# Default Value: REPEATABLE-READ #
+# Values: READ-UNCOMMITTED, READ-COMMITTED, REPEATABLE-READ, SERIALIZABLE #
+# #
+# #
+# Creation Date: 2008-02-25 #
+# Author: Sharique Abdullah #
+# #
+# Description: Test Cases of Dynamic System Variable "tx_isolation" #
+# that checks behavior of this variable in the following ways #
+# * Functionality based on different values #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html #
+# #
+#########################################################################################
+
+--source include/have_innodb.inc
+
+--echo ** Setup **
+#
+# Setup
+#
+
+SET @session_tx_isolation = @@SESSION.tx_isolation;
+SET @global_tx_isolation = @@GLOBAL.tx_isolation;
+
+#
+# Creating connections
+#
+
+connect (con0,localhost,root,,);
+
+connection con0;
+
+SET SESSION AUTOCOMMIT = OFF;
+
+connect (con1, localhost, root,,);
+
+connection con1;
+
+SET SESSION AUTOCOMMIT = OFF;
+
+connection default;
+
+#
+# Creating tables
+#
+
+CREATE TABLE t1 (a int PRIMARY KEY, b int) ENGINE=INNODB;
+
+INSERT INTO t1 VALUES(2, 2);
+INSERT INTO t1 VALUES(4, 4);
+INSERT INTO t1 VALUES(6, 6);
+INSERT INTO t1 VALUES(8, 8);
+INSERT INTO t1 VALUES(16, 16);
+INSERT INTO t1 VALUES(18, 18);
+INSERT INTO t1 VALUES(20, 20);
+INSERT INTO t1 VALUES(22, 22);
+INSERT INTO t1 VALUES(24, 24);
+
+--echo '#----------------------------FN_DYNVARS_184_01--------------------------------------#'
+#
+# Testing for value READ-UNCOMMITTED
+#
+connection con0;
+SET SESSION tx_isolation = 'READ-UNCOMMITTED';
+set binlog_format=mixed;
+
+connection con1;
+SET SESSION tx_isolation = 'READ-UNCOMMITTED';
+set binlog_format=mixed;
+
+#
+# Testing WHERE on keys using IN clause
+#
+connection con0;
+
+START TRANSACTION;
+
+SELECT * FROM t1 WHERE a IN (2,4,6,8) FOR UPDATE;
+UPDATE t1 SET b = 10 WHERE a IN (2,4,6,8);
+
+connection con1;
+
+START TRANSACTION;
+
+SELECT * FROM t1;
+
+INSERT INTO t1 VALUES(1, 1);
+INSERT INTO t1 VALUES(3, 3);
+
+SELECT * FROM t1;
+
+COMMIT;
+
+connection con0;
+
+DELETE FROM t1 WHERE a = 1 OR a = 3;
+
+COMMIT;
+
+--echo '#----------------------------FN_DYNVARS_184_02--------------------------------------#'
+#
+# Testing WHERE on keys using # on even rows
+#
+
+connection con0;
+
+START TRANSACTION;
+
+SELECT * FROM t1 WHERE a % 2 = 0 FOR UPDATE;
+UPDATE t1 SET b = 10 WHERE a % 2 = 0;
+
+connection con1;
+
+START TRANSACTION;
+
+SELECT * FROM t1;
+
+INSERT INTO t1 VALUES(23, 23);
+
+INSERT INTO t1 VALUES(25, 25);
+
+SELECT * FROM t1;
+
+COMMIT;
+
+connection con0;
+
+COMMIT;
+
+--echo '#----------------------------FN_DYNVARS_184_03--------------------------------------#'
+#
+# Testing for value READ-COMMITTED
+#
+connection con0;
+SET SESSION tx_isolation = 'READ-COMMITTED';
+
+connection con1;
+SET SESSION tx_isolation = 'READ-COMMITTED';
+
+#
+# Testing WHERE on keys using % on even rows
+#
+connection con0;
+
+START TRANSACTION;
+
+SELECT * FROM t1 WHERE a % 2 = 0 FOR UPDATE;
+UPDATE t1 SET b = 11 WHERE a % 2 = 0;
+
+connection con1;
+
+START TRANSACTION;
+
+SELECT * FROM t1;
+
+INSERT INTO t1 VALUES(5, 5);
+INSERT INTO t1 VALUES(7, 7);
+
+SELECT * FROM t1;
+
+COMMIT;
+
+connection con0;
+
+COMMIT;
+
+
+--echo '#----------------------------FN_DYNVARS_184_04--------------------------------------#'
+#
+# Testing for value REPEATABLE-READ
+#
+connection con0;
+SET SESSION tx_isolation = 'REPEATABLE-READ';
+
+connection con1;
+SET SESSION tx_isolation = 'REPEATABLE-READ';
+
+#
+# Testing WHERE on keys using % on even rows
+#
+connection con0;
+
+START TRANSACTION;
+
+SELECT * FROM t1 WHERE a % 2 = 0 FOR UPDATE;
+UPDATE t1 SET b = 12 WHERE a % 2 = 0;
+
+connection con1;
+
+START TRANSACTION;
+
+SELECT * FROM t1;
+
+--error ER_LOCK_WAIT_TIMEOUT
+INSERT INTO t1 VALUES(9, 9);
+--error ER_LOCK_WAIT_TIMEOUT
+INSERT INTO t1 VALUES(13, 13);
+--echo Expected error "Lock wait timeout"
+
+SELECT * FROM t1;
+
+COMMIT;
+
+connection con0;
+
+COMMIT;
+
+--echo '#----------------------------FN_DYNVARS_184_05--------------------------------------#'
+#
+# Testing WHERE on keys using IN clause
+#
+connection con0;
+
+START TRANSACTION;
+
+SELECT * FROM t1 WHERE a IN (2,4,6,8,10,12,14,16,18,20,22,24,26) = 0 FOR UPDATE;
+UPDATE t1 SET b = 13 WHERE a IN (2,4,6,8,10,12,14,16,18,20,22,24,26) = 0;
+
+connection con1;
+
+START TRANSACTION;
+
+SELECT * FROM t1;
+
+--error ER_LOCK_WAIT_TIMEOUT
+INSERT INTO t1 VALUES(9, 9);
+--error ER_LOCK_WAIT_TIMEOUT
+INSERT INTO t1 VALUES(13, 13);
+--echo Expected error "Lock wait timeout"
+
+SELECT * FROM t1;
+
+COMMIT;
+
+connection con0;
+
+COMMIT;
+
+--echo '#----------------------------FN_DYNVARS_184_06--------------------------------------#'
+#
+# Testing WHERE on keys using IN clause
+#
+connection con0;
+
+START TRANSACTION;
+
+SELECT * FROM t1 WHERE a IN (2,4,6,8) = 0 FOR UPDATE;
+UPDATE t1 SET b = 14 WHERE a IN (2,4,6,8) = 0;
+
+connection con1;
+
+START TRANSACTION;
+
+SELECT * FROM t1;
+
+--error ER_LOCK_WAIT_TIMEOUT
+INSERT INTO t1 VALUES(9, 9);
+--error ER_LOCK_WAIT_TIMEOUT
+INSERT INTO t1 VALUES(13, 13);
+--echo Expected error "Lock wait timeout"
+
+SELECT * FROM t1;
+
+COMMIT;
+
+connection con0;
+
+COMMIT;
+
+--echo '#----------------------------FN_DYNVARS_184_07--------------------------------------#'
+#
+# Testing for value SERIALIZABLE
+#
+connection con0;
+SET SESSION tx_isolation = 'SERIALIZABLE';
+
+connection con1;
+SET SESSION tx_isolation = 'SERIALIZABLE';
+
+#
+# Testing WHERE on keys using # on even rows
+#
+connection con0;
+
+START TRANSACTION;
+
+SELECT * FROM t1 WHERE a % 2 = 0 FOR UPDATE;
+UPDATE t1 SET b = 15 WHERE a % 2 = 0;
+
+connection con1;
+
+START TRANSACTION;
+
+--error ER_LOCK_WAIT_TIMEOUT
+SELECT * FROM t1;
+
+--error ER_LOCK_WAIT_TIMEOUT
+INSERT INTO t1 VALUES(15, 15);
+--error ER_LOCK_WAIT_TIMEOUT
+INSERT INTO t1 VALUES(17, 17);
+
+--error ER_LOCK_WAIT_TIMEOUT
+SELECT * FROM t1;
+
+COMMIT;
+
+connection con0;
+
+COMMIT;
+
+
+--echo '#----------------------------FN_DYNVARS_184_08--------------------------------------#'
+#
+# Session data integrity check & GLOBAL Value check
+#
+
+SET GLOBAL tx_isolation = 'READ-UNCOMMITTED';
+connect (con_int1,localhost,root,,);
+
+connection con_int1;
+SELECT @@SESSION.tx_isolation;
+--echo READ-UNCOMMITTED Expected
+
+SET SESSION tx_isolation = 'SERIALIZABLE';
+
+connect (con_int2,localhost,root,,);
+
+connection con_int2;
+SELECT @@SESSION.tx_isolation;
+--echo READ-UNCOMMITTED Expected
+
+SET SESSION tx_isolation = 'REPEATABLE-READ';
+
+connection con_int2;
+SELECT @@SESSION.tx_isolation;
+--echo REPEATABLE-READ Expected
+
+connection con_int1;
+SELECT @@SESSION.tx_isolation;
+--echo SERIALIZABLE Expected
+
+
+SELECT @@GLOBAL.tx_isolation;
+--echo READ-UNCOMMITTED Expected
+
+connection default;
+
+disconnect con_int1;
+disconnect con_int2;
+
+#
+# Cleanup
+#
+
+SET @@SESSION.tx_isolation = @session_tx_isolation;
+SET @@GLOBAL.tx_isolation = @global_tx_isolation;
+
+connection default;
+disconnect con0;
+disconnect con1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/sys_vars/t/tx_read_only_basic.test b/mysql-test/suite/sys_vars/t/tx_read_only_basic.test
new file mode 100644
index 00000000..0ebfcc31
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/tx_read_only_basic.test
@@ -0,0 +1,199 @@
+############## mysql-test\t\tx_read_only_basic.test ###########################
+# #
+# Variable Name: tx_read_only #
+# Scope: GLOBAL & SESSION #
+# Access Type: Dynamic #
+# Data Type: boolean #
+# Default Value: OFF #
+# Range: #
+# #
+# #
+# Creation Date: 2012-01-12 #
+# Author: joh #
+# #
+# Description: Test Cases of Dynamic System Variable tx_read_only #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.6/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+--echo ####################################################################
+--echo # START OF tx_read_only TESTS #
+--echo ####################################################################
+
+
+--echo #############################################################
+--echo # Save initial value #
+--echo #############################################################
+
+SET @start_global_value = @@global.tx_read_only;
+SELECT @start_global_value;
+SET @start_session_value = @@session.tx_read_only;
+SELECT @start_session_value;
+
+
+--echo ########################################################################
+--echo # Display the DEFAULT value of tx_read_only #
+--echo ########################################################################
+
+SET @@global.tx_read_only = ON;
+SET @@global.tx_read_only = DEFAULT;
+SELECT @@global.tx_read_only;
+
+SET @@session.tx_read_only = ON;
+SET @@session.tx_read_only = DEFAULT;
+SELECT @@session.tx_read_only;
+
+
+--echo ##############################################################################
+--echo # Change the value of tx_read_only to a valid value for GLOBAL Scope #
+--echo ##############################################################################
+
+SET @@global.tx_read_only = ON;
+SELECT @@global.tx_read_only;
+SET @@global.tx_read_only = OFF;
+SELECT @@global.tx_read_only;
+SET @@global.tx_read_only = 0;
+SELECT @@global.tx_read_only;
+SET @@global.tx_read_only = 1;
+SELECT @@global.tx_read_only;
+SET @@global.tx_read_only = TRUE;
+SELECT @@global.tx_read_only;
+SET @@global.tx_read_only = FALSE;
+SELECT @@global.tx_read_only;
+
+
+
+--echo ###############################################################################
+--echo # Change the value of tx_read_only to a valid value for SESSION Scope #
+--echo ###############################################################################
+
+SET @@session.tx_read_only = ON;
+SELECT @@session.tx_read_only;
+SET @@session.tx_read_only = OFF;
+SELECT @@session.tx_read_only;
+SET @@session.tx_read_only = 0;
+SELECT @@session.tx_read_only;
+SET @@session.tx_read_only = 1;
+SELECT @@session.tx_read_only;
+SET @@session.tx_read_only = TRUE;
+SELECT @@session.tx_read_only;
+SET @@session.tx_read_only = FALSE;
+SELECT @@session.tx_read_only;
+
+
+--echo ################################################################
+--echo # Change the value of tx_read_only to an invalid value #
+--echo ################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.tx_read_only = 'ONN';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.tx_read_only = "OFFF";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.tx_read_only = TTRUE;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.tx_read_only = FELSE;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.tx_read_only = -1024;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.tx_read_only = 65536;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.tx_read_only = 65530.34;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.tx_read_only = test;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.tx_read_only = ONN;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.tx_read_only = ONF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.tx_read_only = OF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.tx_read_only = 'OFN';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.tx_read_only = -2;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.tx_read_only = 65530.34;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.tx_read_only = 65550;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.tx_read_only = test;
+SELECT @@session.tx_read_only;
+
+
+--echo ####################################################################
+--echo # Check if the value in GLOBAL Table matches value in variable #
+--echo ####################################################################
+
+
+SELECT IF(@@global.tx_read_only, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='tx_read_only';
+
+--echo ####################################################################
+--echo # Check if the value in SESSION Table matches value in variable #
+--echo ####################################################################
+
+SELECT IF(@@session.tx_read_only, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='tx_read_only';
+
+
+--echo ###############################################################################
+--echo # Check if accessing variable with and without GLOBAL point to same variable #
+--echo ###############################################################################
+
+SET @@tx_read_only = OFF;
+SET @@global.tx_read_only = ON;
+SELECT @@tx_read_only = @@global.tx_read_only;
+
+
+--echo ##############################################################################
+--echo # Check if accessing variable with SESSION,LOCAL and without SCOPE points #
+--echo # to same session variable #
+--echo ##############################################################################
+
+SET @@tx_read_only = ON;
+SELECT @@tx_read_only = @@local.tx_read_only;
+SELECT @@local.tx_read_only = @@session.tx_read_only;
+
+
+--echo ###############################################################################
+--echo # Check if tx_read_only can be accessed with and without @@ sign #
+--echo ###############################################################################
+
+--echo # @@session is synonym for SESSION
+SET @@session.tx_read_only= 0;
+
+--echo # Without modifier, SET changes session variable
+SET tx_read_only = 1;
+SELECT @@tx_read_only;
+
+--echo # name1.name2 refers to database_name.table_name
+--Error ER_UNKNOWN_TABLE
+SELECT session.tx_read_only;
+
+--echo ####################################
+--echo # Restore initial value #
+--echo ####################################
+
+SET @@global.tx_read_only = @start_global_value;
+SELECT @@global.tx_read_only;
+SET @@session.tx_read_only = @start_session_value;
+SELECT @@session.tx_read_only;
+
+
+--echo #########################################################
+--echo # END OF tx_read_only TESTS #
+--echo #########################################################
+
diff --git a/mysql-test/suite/sys_vars/t/unique_checks_basic.test b/mysql-test/suite/sys_vars/t/unique_checks_basic.test
new file mode 100644
index 00000000..af2ab6e5
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/unique_checks_basic.test
@@ -0,0 +1,160 @@
+############## mysql-test\t\unique_checks_basic.test ##########################
+# #
+# Variable Name: unique_checks #
+# Scope: SESSION #
+# Access Type: Dynamic #
+# Data Type: boolean #
+# Default Value: 1 #
+# Range: #
+# #
+# #
+# Creation Date: 2008-02-14 #
+# Author: Sharique Abdullah #
+# #
+# Description: Test Cases of Dynamic System Variable unique_checks #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_UNIQUE_CHECKS #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+########################################################################
+# START OF transaction_allow_batching TESTS #
+########################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_session_value = @@session.unique_checks;
+SELECT @start_session_value;
+
+--echo '#--------------------FN_DYNVARS_005_01-------------------------#'
+############################################################
+# Display the DEFAULT value of unique_checks #
+############################################################
+
+
+SET @@session.unique_checks= 1;
+SET @@session.unique_checks= DEFAULT;
+SELECT @@session.unique_checks;
+
+--echo '#--------------------FN_DYNVARS_005_04-------------------------#'
+########################################################################
+# Change the value of unique_checks to a valid value for SESSION Scope #
+########################################################################
+
+SET @@session.unique_checks =1;
+SELECT @@session.unique_checks;
+
+SET @@session.unique_checks = 0;
+SELECT @@session.unique_checks;
+
+SET @@session.unique_checks = True;
+SELECT @@session.unique_checks;
+
+SET @@session.unique_checks = False;
+SELECT @@session.unique_checks;
+
+SET @@session.unique_checks = "ON";
+SELECT @@session.unique_checks;
+
+SET @@session.unique_checks = "OFF";
+SELECT @@session.unique_checks;
+
+
+
+--echo '#------------------FN_DYNVARS_005_05-----------------------#'
+###########################################################
+# Change the value of 'unique_checks' to an invalid value #
+###########################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.unique_checks = 'No';
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.unique_checks = "yes";
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.unique_checks = yes;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.unique_checks = NO;
+
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.unique_checks = "True";
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.unique_checks = "False";
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.unique_checks = "Test";
+
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.unique_checks = 'test';
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.unique_checks = 123456789031;
+
+
+--echo '#------------------FN_DYNVARS_005_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT IF(@@session.unique_checks, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='unique_checks';
+
+
+--echo '#---------------------FN_DYNVARS_001_08----------------------#'
+########################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE #
+# points to same session variable #
+########################################################################
+SET @@unique_checks = 1;
+SELECT @@unique_checks = @@local.unique_checks;
+SELECT @@local.unique_checks = @@session.unique_checks;
+
+
+--echo '#---------------------FN_DYNVARS_001_09----------------------#'
+########################################################################
+# Check if unique_checks can be accessed with and without @@ sign #
+########################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET unique_checks = 1027;
+SELECT @@unique_checks;
+
+--Error ER_UNKNOWN_TABLE
+SELECT local.unique_checks;
+
+--Error ER_UNKNOWN_TABLE
+SELECT session.unique_checks;
+
+--Error ER_BAD_FIELD_ERROR
+SELECT unique_checks = @@session.unique_checks;
+
+
+####################################
+# Restore initial value #
+####################################
+
+
+SET @@session.unique_checks = @start_session_value;
+SELECT @@session.unique_checks;
+
+
+##################################################
+# END OF unique_checks TESTS #
+##################################################
+
diff --git a/mysql-test/suite/sys_vars/t/updatable_views_with_limit_basic.test b/mysql-test/suite/sys_vars/t/updatable_views_with_limit_basic.test
new file mode 100644
index 00000000..941eb1db
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/updatable_views_with_limit_basic.test
@@ -0,0 +1,275 @@
+############## mysql-test\t\updatable_views_with_limit_basic.test #############
+# #
+# Variable Name: updatable_views_with_limit #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: boolean #
+# Default Value: 1 #
+# Range: #
+# #
+# #
+# Creation Date: 2008-02-14 #
+# Author: Sharique Abdullah #
+# #
+# Description: Test Case of Dynamic System Variable updatable_views_with_limit#
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_updatable_views_with_limit #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF updatable_views_with_limit TESTS #
+########################################################################
+
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.updatable_views_with_limit;
+SELECT @start_global_value;
+SET @start_session_value = @@session.updatable_views_with_limit;
+SELECT @start_session_value;
+
+
+
+--echo '#--------------------FN_DYNVARS_005_01-------------------------#'
+########################################################################
+# Display the DEFAULT value of updatable_views_with_limit #
+########################################################################
+
+SET @@global.updatable_views_with_limit = 'NO';
+SET @@global.updatable_views_with_limit = DEFAULT;
+SELECT @@global.updatable_views_with_limit;
+
+
+SET @@session.updatable_views_with_limit = 'NO';
+SET @@session.updatable_views_with_limit = DEFAULT;
+SELECT @@session.updatable_views_with_limit;
+
+
+
+--echo '#--------------------FN_DYNVARS_005_02-------------------------#'
+########################################################################
+# Check the DEFAULT value of updatable_views_with_limit #
+########################################################################
+
+SET @@global.updatable_views_with_limit = DEFAULT;
+SELECT @@global.updatable_views_with_limit = 'Yes';
+
+SET @@session.updatable_views_with_limit = DEFAULT;
+SELECT @@session.updatable_views_with_limit ='Yes';
+
+
+
+--echo '#--------------------FN_DYNVARS_005_03-------------------------#'
+##################################################################
+# Change the value of variable to a valid value for GLOBAL Scope #
+##################################################################
+
+SET @@global.updatable_views_with_limit = NO;
+SELECT @@global.updatable_views_with_limit;
+
+SET @@global.updatable_views_with_limit = 'NO';
+SELECT @@global.updatable_views_with_limit;
+
+SET @@global.updatable_views_with_limit = YES;
+SELECT @@global.updatable_views_with_limit;
+
+SET @@global.updatable_views_with_limit = 'YES';
+SELECT @@global.updatable_views_with_limit;
+
+SET @@global.updatable_views_with_limit = "NO";
+SELECT @@global.updatable_views_with_limit;
+
+SET @@global.updatable_views_with_limit = "YES";
+SELECT @@global.updatable_views_with_limit;
+
+SET @@global.updatable_views_with_limit = 1;
+SELECT @@global.updatable_views_with_limit;
+
+SET @@global.updatable_views_with_limit = 0;
+SELECT @@global.updatable_views_with_limit;
+
+SET @@global.updatable_views_with_limit = TRUE;
+SELECT @@global.updatable_views_with_limit;
+
+SET @@global.updatable_views_with_limit = False;
+SELECT @@global.updatable_views_with_limit;
+
+
+--echo '#--------------------FN_DYNVARS_005_04-------------------------#'
+###################################################################
+# Change the value of variable to a valid value for SESSION Scope #
+###################################################################
+
+SET @@session.updatable_views_with_limit = NO;
+SELECT @@session.updatable_views_with_limit;
+
+SET @@session.updatable_views_with_limit = 'NO';
+SELECT @@session.updatable_views_with_limit;
+
+SET @@session.updatable_views_with_limit = YES;
+SELECT @@session.updatable_views_with_limit;
+
+SET @@session.updatable_views_with_limit = 'YES';
+SELECT @@session.updatable_views_with_limit;
+
+SET @@session.updatable_views_with_limit = "YES";
+SELECT @@session.updatable_views_with_limit;
+
+SET @@session.updatable_views_with_limit = "NO";
+SELECT @@session.updatable_views_with_limit;
+
+
+
+SET @@session.updatable_views_with_limit =1;
+SELECT @@session.updatable_views_with_limit;
+
+SET @@session.updatable_views_with_limit = 0;
+SELECT @@session.updatable_views_with_limit;
+
+SET @@session.updatable_views_with_limit = True;
+SELECT @@session.updatable_views_with_limit;
+
+SET @@session.updatable_views_with_limit = False;
+SELECT @@session.updatable_views_with_limit;
+
+
+
+--echo '#------------------FN_DYNVARS_005_05-----------------------#'
+########################################################################
+# Change the value of 'updatable_views_with_limit' to an invalid value #
+########################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.updatable_views_with_limit = "TRUE";
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.updatable_views_with_limit = -1024;
+
+
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.updatable_views_with_limit = 2345;
+
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.updatable_views_with_limit = "FALSE";
+
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.updatable_views_with_limit = 65530.34;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.updatable_views_with_limit ="Testing";
+
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.updatable_views_with_limit = "ON";
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.updatable_views_with_limit = "OFF";
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.updatable_views_with_limit = "True";
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.updatable_views_with_limit = "False";
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.updatable_views_with_limit = "Test";
+
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.updatable_views_with_limit = 'test';
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.updatable_views_with_limit = 123456789031;
+
+
+--echo '#------------------FN_DYNVARS_005_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+
+SELECT @@global.updatable_views_with_limit = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='updatable_views_with_limit';
+
+--echo '#------------------FN_DYNVARS_005_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.updatable_views_with_limit = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='updatable_views_with_limit';
+
+
+
+
+--echo '#---------------------FN_DYNVARS_001_08----------------------#'
+###########################################################################
+# Check if global and session variable are independent of each other #
+###########################################################################
+
+SET @@global.updatable_views_with_limit = NO;
+SET @@session.updatable_views_with_limit = YES;
+SELECT @@updatable_views_with_limit = @@global.updatable_views_with_limit;
+
+
+--echo '#---------------------FN_DYNVARS_001_09----------------------#'
+########################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE #
+# points to same session variable #
+########################################################################
+
+SET @@updatable_views_with_limit = YES;
+SELECT @@updatable_views_with_limit = @@local.updatable_views_with_limit;
+SELECT @@local.updatable_views_with_limit = @@session.updatable_views_with_limit;
+
+
+--echo '#---------------------FN_DYNVARS_001_10----------------------#'
+################################################################
+# Check if variable can be accessed with and without @@ sign #
+################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET updatable_views_with_limit = 1027;
+SELECT @@updatable_views_with_limit;
+
+
+--Error ER_UNKNOWN_TABLE
+SELECT local.updatable_views_with_limit;
+
+--Error ER_UNKNOWN_TABLE
+SELECT session.updatable_views_with_limit;
+
+--Error ER_BAD_FIELD_ERROR
+SELECT updatable_views_with_limit = @@session.updatable_views_with_limit;
+
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.updatable_views_with_limit = @start_global_value;
+SELECT @@global.updatable_views_with_limit;
+SET @@session.updatable_views_with_limit = @start_session_value;
+SELECT @@session.updatable_views_with_limit;
+
+
+#############################################################
+# END OF updatable_views_with_limit TESTS #
+#############################################################
+
diff --git a/mysql-test/suite/sys_vars/t/updatable_views_with_limit_func.test b/mysql-test/suite/sys_vars/t/updatable_views_with_limit_func.test
new file mode 100644
index 00000000..a2cd1e55
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/updatable_views_with_limit_func.test
@@ -0,0 +1,136 @@
+############ mysql-test\t\updatable_views_with_limit_func.test #################
+# #
+#Variable Name: updatable_views_with_limit #
+#Scope: SESSION #
+#Access Type: Dynamic #
+#Data Type: Enumeration #
+#Default Value: - #
+#Values: - #
+# #
+# #
+#Creation Date: 2008-03-02 #
+#Author: Sharique Abdullah #
+# #
+#Description: Test Cases of Dynamic System Variable "updatable_views_with_limit#
+# that checks behavior of this variable in the following ways #
+# * Functionality based on different values #
+# #
+#Reference: http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html#
+#option_mysqld_updatable_views_with_limit #
+# #
+################################################################################
+
+#
+# Setup
+#
+
+SET @session_updatable_views_with_limit = @@Session.UPDATABLE_VIEWS_WITH_LIMIT;
+
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+################################
+# Creating table #
+################################
+
+CREATE TABLE t1 (a INT, b INT, c INT, PRIMARY KEY(a,b));
+
+##################################
+# Inserting values in the table #
+##################################
+
+
+INSERT INTO t1 VALUES (10,2,-1), (20,3,-2),
+ (30,4,-3), (40,5,-4);
+
+
+####################################
+# Creating views #
+####################################
+CREATE VIEW v1 (x,y) AS SELECT a, c FROM t1;
+
+
+CONNECT (test_con1,localhost,root,,);
+CONNECTION test_con1;
+
+SET @@Session.UPDATABLE_VIEWS_WITH_LIMIT=YES;
+
+#
+# Testing WITH a limit clause
+#
+
+--echo Warning expected, 'View does not contain complete key of the table'
+UPDATE v1 SET x=x+6 LIMIT 1;
+
+SELECT * FROM t1;
+
+#
+# Testing WITHOUT a limit clause
+#
+
+UPDATE v1 SET x=x+5;
+
+SELECT * FROM t1;
+
+CONNECT (test_con2,localhost,root,,);
+CONNECTION test_con2;
+
+SET @@Session.UPDATABLE_VIEWS_WITH_LIMIT=NO;
+
+SELECT @@SESSION.UPDATABLE_VIEWS_WITH_LIMIT;
+
+--ERROR ER_NON_UPDATABLE_TABLE
+UPDATE v1 SET x=x+10 LIMIT 1;
+--echo Expected error 'Non updatable table'
+
+SELECT * FROM t1;
+
+
+--echo '#---------------------FN_DYNVARS_039_01----------------------#'
+######################################
+# Setting value to NO #
+######################################
+
+SET UPDATABLE_VIEWS_WITH_LIMIT=NO;
+
+-- error ER_NON_UPDATABLE_TABLE
+UPDATE v1 SET x=x+1 LIMIT 1;
+--echo Expected error 'Non updatable table'
+
+SET UPDATABLE_VIEWS_WITH_LIMIT=0;
+
+-- error ER_NON_UPDATABLE_TABLE
+UPDATE v1 SET x=x+1 LIMIT 1;
+--echo Expected error 'Non updatable table'
+
+--echo '#---------------------FN_DYNVARS_039_02----------------------#'
+######################################
+# Setting value to Default #
+######################################
+
+--echo Warning expected, 'View does not contain complete key of the table'
+SET UPDATABLE_VIEWS_WITH_LIMIT=DEFAULT;
+UPDATE v1 SET x=x+1 LIMIT 1;
+
+
+--echo Warning expected, 'View does not contain complete key of the table'
+SET UPDATABLE_VIEWS_WITH_LIMIT=YES;
+UPDATE v1 SET x=x+2 LIMIT 1;
+
+#
+# Cleanup
+#
+
+connection default;
+
+disconnect test_con1;
+disconnect test_con2;
+
+SET @@SESSION.updatable_views_with_limit = @session_updatable_views_with_limit;
+
+--disable_warnings
+DROP VIEW IF EXISTS v1;
+DROP TABLE IF EXISTS t1;
+--enable_warnings
diff --git a/mysql-test/suite/sys_vars/t/use_stat_tables_basic.test b/mysql-test/suite/sys_vars/t/use_stat_tables_basic.test
new file mode 100644
index 00000000..7f526edf
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/use_stat_tables_basic.test
@@ -0,0 +1,100 @@
+--source include/load_sysvars.inc
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.use_stat_tables;
+SELECT @start_global_value;
+SET @start_session_value = @@session.use_stat_tables;
+SELECT @start_session_value;
+
+###############################################################
+# Display the DEFAULT value of use_stat_tables #
+###############################################################
+
+SET @@global.use_stat_tables = 2;
+SET @@global.use_stat_tables = DEFAULT;
+SELECT @@global.use_stat_tables;
+
+
+##################################################################################
+# Change the value of use_stat_tables to a valid value for GLOBAL Scope #
+##################################################################################
+
+SET @@global.use_stat_tables = 0;
+SELECT @@global.use_stat_tables;
+SET @@global.use_stat_tables = 1;
+SELECT @@global.use_stat_tables;
+SET @@global.use_stat_tables = 2;
+SELECT @@global.use_stat_tables;
+
+SET @@global.use_stat_tables = NEVER;
+SELECT @@global.use_stat_tables;
+SET @@global.use_stat_tables = COMPLEMENTARY;
+SELECT @@global.use_stat_tables;
+SET @@global.use_stat_tables = PREFERABLY;
+SELECT @@global.use_stat_tables;
+
+####################################################################################
+# Change the value of use_stat_tables to a valid value for SESSION Scope #
+####################################################################################
+
+SET @@session.use_stat_tables = 0;
+SELECT @@session.use_stat_tables;
+SET @@session.use_stat_tables = 1;
+SELECT @@session.use_stat_tables;
+SET @@session.use_stat_tables = 2;
+SELECT @@session.use_stat_tables;
+
+SET @@session.use_stat_tables = NEVER;
+SELECT @@session.use_stat_tables;
+SET @@session.use_stat_tables = PREFERABLY;
+SELECT @@session.use_stat_tables;
+SET @@session.use_stat_tables = COMPLEMENTARY;
+SELECT @@session.use_stat_tables;
+
+#####################################################################
+# Change the value of use_stat_tables to an invalid value #
+#####################################################################
+set sql_mode=TRADITIONAL;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.use_stat_tables = 10;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.use_stat_tables = -1024;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.use_stat_tables = 2.4;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.use_stat_tables = OFF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.use_stat_tables = 10;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.use_stat_tables = -2;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.use_stat_tables = 1.2;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.use_stat_tables = ON;
+
+###############################################################################
+# Check if the value in GLOBAL & SESSION Tables matches value in variable #
+###############################################################################
+
+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='use_stat_tables';
+
+SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='use_stat_tables';
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.use_stat_tables = @start_global_value;
+SELECT @@global.use_stat_tables;
+SET @@session.use_stat_tables = @start_session_value;
+SELECT @@session.use_stat_tables;
+set sql_mode='';
+
+######################################################
+# END OF use_stat_tables TESTS #
+###################################################### \ No newline at end of file
diff --git a/mysql-test/suite/sys_vars/t/userstat_basic.test b/mysql-test/suite/sys_vars/t/userstat_basic.test
new file mode 100644
index 00000000..cd227b7c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/userstat_basic.test
@@ -0,0 +1,39 @@
+# bool global
+
+SET @start_global_value = @@global.userstat;
+#
+# exists as global only
+#
+select @@global.userstat = 0 or @@global.userstat = 1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.userstat;
+
+SET @@global.userstat=0;
+show global variables like 'userstat';
+show session variables like 'userstat';
+select * from information_schema.global_variables where variable_name='userstat';
+select * from information_schema.session_variables where variable_name='userstat';
+
+#
+# show that it's writable
+#
+set global userstat=ON;
+select @@global.userstat;
+set global userstat=OFF;
+select @@global.userstat;
+set global userstat=1;
+select @@global.userstat;
+--error ER_GLOBAL_VARIABLE
+set session userstat=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global userstat=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global userstat=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global userstat="foo";
+
+SET @@global.userstat = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/t/version.opt b/mysql-test/suite/sys_vars/t/version.opt
new file mode 100644
index 00000000..9b6be9b7
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/version.opt
@@ -0,0 +1 @@
+--version="my_favorite_version"
diff --git a/mysql-test/suite/sys_vars/t/version.test b/mysql-test/suite/sys_vars/t/version.test
new file mode 100644
index 00000000..35067a43
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/version.test
@@ -0,0 +1,7 @@
+SELECT @@version;
+perl;
+ $cnt= $ENV{MYSQL_TEST} =~ /mysqltest_embedded / ? 1 :
+ grep /my_favorite_version/, `$ENV{MYSQL} -e status`;
+ print "$cnt\n";
+EOF
+query_vertical select * from information_schema.system_variables where variable_name='version';
diff --git a/mysql-test/suite/sys_vars/t/version_basic.test b/mysql-test/suite/sys_vars/t/version_basic.test
new file mode 100644
index 00000000..0a22713c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/version_basic.test
@@ -0,0 +1,100 @@
+
+
+################## mysql-test\t\version_basic.test ############################
+# #
+# Variable Name: version #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: String #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable version #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--echo '#---------------------BS_STVARS_053_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.version);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_053_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.version=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.version);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_053_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+SELECT @@GLOBAL.version = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='version';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.version);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='version';
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_053_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@version = @@GLOBAL.version;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_053_05----------------------#'
+################################################################################
+# Check if version can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@version);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.version);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.version);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.version);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT version = @@SESSION.version;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/version_comment_basic.test b/mysql-test/suite/sys_vars/t/version_comment_basic.test
new file mode 100644
index 00000000..3ae6daa1
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/version_comment_basic.test
@@ -0,0 +1,100 @@
+
+
+################## mysql-test\t\version_comment_basic.test ####################
+# #
+# Variable Name: version_comment #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: String #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable version_comment #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--echo '#---------------------BS_STVARS_054_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.version_comment);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_054_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.version_comment=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.version_comment);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_054_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+SELECT @@GLOBAL.version_comment = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='version_comment';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.version_comment);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='version_comment';
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_054_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@version_comment = @@GLOBAL.version_comment;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_054_05----------------------#'
+################################################################################
+# Check if version_comment can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@version_comment);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.version_comment);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.version_comment);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.version_comment);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT version_comment = @@SESSION.version_comment;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/version_compile_machine_basic.test b/mysql-test/suite/sys_vars/t/version_compile_machine_basic.test
new file mode 100644
index 00000000..30742436
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/version_compile_machine_basic.test
@@ -0,0 +1,100 @@
+
+
+################## mysql-test\t\version_compile_machine_basic.test ############
+# #
+# Variable Name: version_compile_machine #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: String #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable version_compile_machine #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--echo '#---------------------BS_STVARS_055_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.version_compile_machine);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_055_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.version_compile_machine=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.version_compile_machine);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_055_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+SELECT @@GLOBAL.version_compile_machine = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='version_compile_machine';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.version_compile_machine);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='version_compile_machine';
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_055_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@version_compile_machine = @@GLOBAL.version_compile_machine;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_055_05----------------------#'
+################################################################################
+# Check if version_compile_machine can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@version_compile_machine);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.version_compile_machine);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.version_compile_machine);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.version_compile_machine);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT version_compile_machine = @@SESSION.version_compile_machine;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/version_compile_os_basic.test b/mysql-test/suite/sys_vars/t/version_compile_os_basic.test
new file mode 100644
index 00000000..8858f248
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/version_compile_os_basic.test
@@ -0,0 +1,100 @@
+
+
+################## mysql-test\t\version_compile_os_basic.test #################
+# #
+# Variable Name: version_compile_os #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: String #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable version_compile_os #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--echo '#---------------------BS_STVARS_056_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.version_compile_os);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_056_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.version_compile_os=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.version_compile_os);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_056_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+SELECT @@GLOBAL.version_compile_os = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='version_compile_os';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.version_compile_os);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='version_compile_os';
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_056_04----------------------#'
+################################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+################################################################################
+SELECT @@version_compile_os = @@GLOBAL.version_compile_os;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_056_05----------------------#'
+################################################################################
+# Check if version_compile_os can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@version_compile_os);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.version_compile_os);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.version_compile_os);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.version_compile_os);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT version_compile_os = @@SESSION.version_compile_os;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/version_malloc_library_basic.test b/mysql-test/suite/sys_vars/t/version_malloc_library_basic.test
new file mode 100644
index 00000000..6318ca4a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/version_malloc_library_basic.test
@@ -0,0 +1,90 @@
+################## mysql-test\t\version_malloc_library.test ###################
+# #
+# Variable Name: version_malloc_library #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: String #
+# #
+# Description:Test Cases of Dynamic System Variable version #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+###############################################################################
+
+--echo '#---------------------BS_STVARS_053_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.version_malloc_library);
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_053_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.version_malloc_library=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.version_malloc_library);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_053_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+SELECT @@GLOBAL.version_malloc_library = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='version_malloc_library';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.version_malloc_library);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='version_malloc_library';
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_053_04----------------------#'
+###############################################################################
+# Check if accessing variable with and without GLOBAL point to same variable #
+###############################################################################
+SELECT @@version_malloc_library = @@GLOBAL.version_malloc_library;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_053_05----------------------#'
+###############################################################################
+# Check if version_malloc_library can be accessed with and without @@ sign #
+###############################################################################
+
+SELECT COUNT(@@version_malloc_library);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.version_malloc_library);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.version_malloc_library);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.version_malloc_library);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT version_malloc_library = @@SESSION.version;
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/version_ssl_library_basic.test b/mysql-test/suite/sys_vars/t/version_ssl_library_basic.test
new file mode 100644
index 00000000..3a244084
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/version_ssl_library_basic.test
@@ -0,0 +1,2 @@
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set @@global.version_malloc_library=1;
diff --git a/mysql-test/suite/sys_vars/t/wait_timeout_basic.test b/mysql-test/suite/sys_vars/t/wait_timeout_basic.test
new file mode 100644
index 00000000..598f6cb4
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wait_timeout_basic.test
@@ -0,0 +1,230 @@
+############## mysql-test\t\wait_timeout_basic.test ###########################
+# #
+# Variable Name: wait_timeout #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: #
+# Range: #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Sharique Abdullah #
+# #
+# Description: Test Cases of Dynamic System Variable wait_timeout #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html#option_mysqld_wait_timeouts #
+# #
+###############################################################################
+# Due to differnces between linux and windows in the results
+
+--source include/not_windows.inc
+--source include/load_sysvars.inc
+
+############################################################
+# START OF wait_timeout TESTS #
+############################################################
+
+#############################################################
+# Save initial value #
+#############################################################
+
+SET @start_global_value = @@global.wait_timeout;
+SET @start_session_value = @@session.wait_timeout;
+
+--echo '#--------------------FN_DYNVARS_005_01-------------------------#'
+############################################################
+# Display the DEFAULT value of wait_timeout #
+############################################################
+
+SET @@global.wait_timeout = 100;
+SET @@global.wait_timeout = DEFAULT;
+SELECT @@global.wait_timeout;
+
+SET @@session.wait_timeout = 200;
+SET @@session.wait_timeout = DEFAULT;
+SELECT @@session.wait_timeout;
+
+
+--echo '#--------------------FN_DYNVARS_005_02-------------------------#'
+############################################################
+# Check the DEFAULT value of wait_timeout #
+############################################################
+
+SET @@global.wait_timeout = DEFAULT;
+SELECT @@global.wait_timeout = @default_wait_timeout;
+
+SET @@session.wait_timeout = DEFAULT;
+SELECT @@session.wait_timeout = @default_wait_timeout;
+
+
+
+--echo '#--------------------FN_DYNVARS_005_03-------------------------#'
+######################################################################
+# Change the value of wait_timeout to a valid value for GLOBAL Scope #
+######################################################################
+
+#SET @@global.wait_timeout= @min_wait_timeout;
+SET @@global.wait_timeout= 1;
+SELECT @@global.wait_timeout;
+
+SET @@global.wait_timeout = 60020;
+SELECT @@global.wait_timeout;
+
+#SET @@global.wait_timeout = @max_wait_timeout;
+SET @@global.wait_timeout = 31536000;
+SELECT @@global.wait_timeout = @max_wait_timeout;
+
+
+--echo '#--------------------FN_DYNVARS_005_04-------------------------#'
+#######################################################################
+# Change the value of wait_timeout to a valid value for SESSION Scope #
+#######################################################################
+#SET @@session.wait_timeout = @min_wait_timeout;
+#SELECT @@session.wait_timeout;
+
+SET @@session.wait_timeout =6000;
+SELECT @@session.wait_timeout;
+
+#SET @@session.wait_timeout = @max_wait_timeout;
+#SELECT @@session.wait_timeout = @max_wait_timeout;
+
+
+--echo '#------------------FN_DYNVARS_005_05-----------------------#'
+########################################################
+# Change the value of wait_timeout to an invalid value #
+########################################################
+
+SET @@global.wait_timeout = 0;
+SET @@global.wait_timeout = -1024;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.wait_timeout = ON;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.wait_timeout = OFF;
+
+SET @@global.wait_timeout = True;
+SELECT @@global.wait_timeout;
+
+SET @@global.wait_timeout = False;
+SELECT @@global.wait_timeout;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.wait_timeout = 65530.34;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.wait_timeout ="Test";
+
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.wait_timeout = ON;
+
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.wait_timeout = OFF;
+
+SET @@session.wait_timeout = True;
+SELECT @@session.wait_timeout;
+
+SET @@session.wait_timeout = False;
+SELECT @@session.wait_timeout;
+
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.wait_timeout = "Test";
+
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.wait_timeout = 'test';
+
+SET @@session.wait_timeout = 123456789031;
+SELECT @@session.wait_timeout = @max_wait_timeout;
+
+
+--echo '#------------------FN_DYNVARS_005_06-----------------------#'
+####################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+####################################################################
+
+SELECT @@global.wait_timeout = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='wait_timeout';
+
+--echo '#------------------FN_DYNVARS_005_07-----------------------#'
+####################################################################
+# Check if the value in SESSION Table matches value in variable #
+####################################################################
+
+SELECT @@session.wait_timeout = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='wait_timeout';
+
+--echo '#---------------------FN_DYNVARS_001_09----------------------#'
+###########################################################################
+# Check if global and session variable are independent of each other #
+###########################################################################
+
+SET @@global.wait_timeout = 30000;
+SET @@global.wait_timeout = 40000;
+SELECT @@wait_timeout = @@global.wait_timeout;
+
+--echo '#---------------------FN_DYNVARS_001_10----------------------#'
+########################################################################
+# Check if accessing variable with SESSION,LOCAL and without SCOPE #
+# points to same session variable #
+########################################################################
+
+SET @@wait_timeout = 100;
+SELECT @@wait_timeout = @@local.wait_timeout;
+SELECT @@local.wait_timeout = @@session.wait_timeout;
+
+--echo '#---------------------FN_DYNVARS_001_11----------------------#'
+#######################################################################
+# Check if wait_timeout can be accessed with and without @@ sign #
+#######################################################################
+
+SET wait_timeout = 1027;
+SELECT @@wait_timeout;
+
+
+--Error ER_UNKNOWN_TABLE
+SELECT local.wait_timeout;
+
+--Error ER_UNKNOWN_TABLE
+SELECT session.wait_timeout;
+
+--Error ER_BAD_FIELD_ERROR
+SELECT wait_timeout = @@session.wait_timeout;
+
+--echo #
+--echo # MDEV-9516 type error when setting session variable
+--echo #
+
+SET SESSION wait_timeout= 28000;
+SET SESSION wait_timeout= GREATEST(28000, @@wait_timeout);
+SET SESSION wait_timeout= COALESCE(28000, @@wait_timeout);
+SET SESSION wait_timeout= IFNULL(28000, @@wait_timeout);
+SET SESSION wait_timeout= CASE WHEN TRUE THEN 28000 ELSE @@wait_timeout END;
+
+--error ER_WRONG_TYPE_FOR_VAR
+SET SESSION wait_timeout= 28000.0;
+--error ER_WRONG_TYPE_FOR_VAR
+SET SESSION wait_timeout= 28000.1;
+
+####################################
+# Restore initial value #
+####################################
+
+SET @@global.wait_timeout = @start_global_value;
+SET @@session.wait_timeout = @start_session_value;
+
+#################################################
+# END OF wait_timeout TESTS #
+#################################################
diff --git a/mysql-test/suite/sys_vars/t/wait_timeout_func.test b/mysql-test/suite/sys_vars/t/wait_timeout_func.test
new file mode 100644
index 00000000..d388fc9f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wait_timeout_func.test
@@ -0,0 +1,91 @@
+###############################################################################
+# #
+# Variable Name: wait_timeout #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: numeric #
+# Default Value: #
+# Range: #
+# #
+# #
+# Creation Date: 2008-03-07 #
+# Author: Salman Rawala #
+# #
+# Modified: HHunger 2008-08-27 Simplified the test and replaced the sleeps. #
+# #
+# Description: Test Cases of Dynamic System Variable wait_timeout #
+# that checks the functionality of this variable #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# #
+###############################################################################
+
+--source include/not_embedded.inc
+
+SET @start_value= @@global.wait_timeout;
+
+
+--echo '#--------------------FN_DYNVARS_186_01-------------------------#'
+#######################################################################
+# 1. test of scope session
+#######################################################################
+
+SET @start_time= UNIX_TIMESTAMP();
+connect (test_con1, localhost, root,,);
+connection test_con1;
+
+# If not explicitly changed, @@session.wait_timeout equals @@global.wait_timeout.
+SELECT @@session.wait_timeout = @@global.wait_timeout AS 'Expect 1';
+
+# Find a small value <> @@global.wait_timeout.
+let $session_value =
+`SELECT IF(@@global.wait_timeout <> 2 OR @@global.wait_timeout IS NULL, 2, 3)`;
+--replace_result $session_value <session_value>
+eval SET @@session.wait_timeout = $session_value;
+
+connect (test_con2, localhost, root,,);
+connection test_con2;
+
+--replace_result $session_value <session_value>
+eval SET @@session.wait_timeout = $session_value - 1;
+
+connection default;
+
+--echo wait until connections ready
+let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist;
+--source include/wait_condition.inc
+SELECT info FROM information_schema.processlist;
+
+--echo '#--------------------FN_DYNVARS_186_03-------------------------#'
+#######################################################################
+# 2. test of scope global
+#######################################################################
+
+# Find a small value <> @@global.wait_timeout.
+let $global_value = $session_value + 1;
+--replace_result $global_value <global_value>
+eval SET @@global.wait_timeout= $global_value;
+
+# Changing the @@global.wait_timeout has no influence on the
+# @@session.wait_timeout of already established sessions.
+SELECT @@session.wait_timeout = @start_value AS 'Expect 1';
+
+connect (test_con3, localhost, root,,);
+connection test_con3;
+
+# If not explicitly changed, @@session.wait_timeout equals @@global.wait_timeout.
+SELECT @@session.wait_timeout = @@global.wait_timeout AS 'Expect 1';
+
+connection default;
+# We can be sure that the connections test_con1 and test_con2 must be
+# established because both have already executed a SET @@session.wait_timeout.
+# This means they are or at least were visible within the processlist.
+# Therefore we can now simply wait till both disappear from the processlist.
+let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist;
+--source include/wait_condition.inc
+SELECT info FROM information_schema.processlist;
+
+--replace_result $global_value <global_value> $session_value <session_value>;
+eval SELECT UNIX_TIMESTAMP() - @start_time >= $global_value + $session_value;
+SET @@global.wait_timeout= @start_value;
diff --git a/mysql-test/suite/sys_vars/t/warning_count_basic.test b/mysql-test/suite/sys_vars/t/warning_count_basic.test
new file mode 100644
index 00000000..64539e28
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/warning_count_basic.test
@@ -0,0 +1,97 @@
+
+
+################## mysql-test\t\warning_count_basic.test ######################
+# #
+# Variable Name: warning_count #
+# Scope: Session #
+# Access Type: Static #
+# Data Type: numeric #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author : Sharique Abdullah #
+# #
+# #
+# Description:Test Cases of Dynamic System Variable warning_count #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--echo '#---------------------BS_STVARS_057_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+
+SELECT COUNT(@@SESSION.warning_count);
+--echo 1 Expected
+
+--echo '#---------------------BS_STVARS_057_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@SESSION.warning_count=1;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@SESSION.warning_count);
+--echo 1 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_057_03----------------------#'
+#################################################################
+# Check if the value in SESSION Table matches value in variable #
+#################################################################
+
+SELECT @@SESSION.warning_count = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='warning_count';
+--echo 1 Expected
+
+SELECT COUNT(@@SESSION.warning_count);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='warning_count';
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_057_04----------------------#'
+################################################################################
+# Check if accessing variable with and without SESSION point to same variable #
+################################################################################
+SELECT @@warning_count = @@SESSION.warning_count;
+--echo 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_057_05----------------------#'
+################################################################################
+# Check if warning_count can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@warning_count);
+--echo 1 Expected
+SELECT COUNT(@@local.warning_count);
+--echo 1 Expected
+SELECT COUNT(@@SESSION.warning_count);
+--echo 1 Expected
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@GLOBAL.warning_count);
+--echo Expected error 'Variable is a SESSION variable'
+
+--error ER_BAD_FIELD_ERROR
+SELECT COUNT(warning_count = @@GLOBAL.warning_count);
+--echo Expected error 'Readonly variable'
+
+
diff --git a/mysql-test/suite/sys_vars/t/wsrep_auto_increment_control_basic.test b/mysql-test/suite/sys_vars/t/wsrep_auto_increment_control_basic.test
new file mode 100644
index 00000000..5dc23cf2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wsrep_auto_increment_control_basic.test
@@ -0,0 +1,42 @@
+--source include/have_wsrep.inc
+
+--echo #
+--echo # wsrep_auto_increment_control
+--echo #
+
+--echo # save the initial value
+SET @wsrep_auto_increment_control_global_saved = @@global.wsrep_auto_increment_control;
+
+--echo # default
+SELECT @@global.wsrep_auto_increment_control;
+
+--echo
+--echo # scope
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.wsrep_auto_increment_control;
+SET @@global.wsrep_auto_increment_control=OFF;
+SELECT @@global.wsrep_auto_increment_control;
+SET @@global.wsrep_auto_increment_control=ON;
+SELECT @@global.wsrep_auto_increment_control;
+
+--echo
+--echo # valid values
+SET @@global.wsrep_auto_increment_control='OFF';
+SELECT @@global.wsrep_auto_increment_control;
+SET @@global.wsrep_auto_increment_control=ON;
+SELECT @@global.wsrep_auto_increment_control;
+SET @@global.wsrep_auto_increment_control=default;
+SELECT @@global.wsrep_auto_increment_control;
+
+--echo
+--echo # invalid values
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_auto_increment_control=NULL;
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_auto_increment_control='junk';
+
+--echo
+--echo # restore the initial value
+SET @@global.wsrep_auto_increment_control = @wsrep_auto_increment_control_global_saved;
+
+--echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_causal_reads_basic.test b/mysql-test/suite/sys_vars/t/wsrep_causal_reads_basic.test
new file mode 100644
index 00000000..6539e5cb
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wsrep_causal_reads_basic.test
@@ -0,0 +1,45 @@
+--source include/have_wsrep.inc
+
+--echo #
+--echo # wsrep_causal_reads
+--echo #
+
+--echo # save the initial values
+SET @wsrep_causal_reads_global_saved = @@global.wsrep_causal_reads;
+SET @wsrep_causal_reads_session_saved = @@session.wsrep_causal_reads;
+
+--echo # default
+SELECT @@global.wsrep_causal_reads;
+SELECT @@session.wsrep_causal_reads;
+
+--echo
+--echo # scope and valid values
+SET @@global.wsrep_causal_reads=OFF;
+SELECT @@global.wsrep_causal_reads;
+SET @@global.wsrep_causal_reads=ON;
+SELECT @@global.wsrep_causal_reads;
+
+SET @@session.wsrep_causal_reads=OFF;
+SELECT @@session.wsrep_causal_reads;
+SET @@session.wsrep_causal_reads=ON;
+SELECT @@session.wsrep_causal_reads;
+SET @@session.wsrep_causal_reads=default;
+SELECT @@session.wsrep_causal_reads;
+
+--echo
+--echo # invalid values
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_causal_reads=NULL;
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_causal_reads='junk';
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@session.wsrep_causal_reads=NULL;
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@session.wsrep_causal_reads='junk';
+
+--echo
+--echo # restore the initial values
+SET @@global.wsrep_causal_reads = @wsrep_causal_reads_global_saved;
+SET @@session.wsrep_causal_reads = @wsrep_causal_reads_session_saved;
+
+--echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_certify_nonpk_basic.test b/mysql-test/suite/sys_vars/t/wsrep_certify_nonpk_basic.test
new file mode 100644
index 00000000..a2c690e5
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wsrep_certify_nonpk_basic.test
@@ -0,0 +1,42 @@
+--source include/have_wsrep.inc
+
+--echo #
+--echo # wsrep_certify_nonpk
+--echo #
+
+--echo # save the initial value
+SET @wsrep_certify_nonpk_global_saved = @@global.wsrep_certify_nonpk;
+
+--echo # default
+SELECT @@global.wsrep_certify_nonpk;
+
+--echo
+--echo # scope
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.wsrep_certify_nonpk;
+SET @@global.wsrep_certify_nonpk=OFF;
+SELECT @@global.wsrep_certify_nonpk;
+SET @@global.wsrep_certify_nonpk=ON;
+SELECT @@global.wsrep_certify_nonpk;
+
+--echo
+--echo # valid values
+SET @@global.wsrep_certify_nonpk='OFF';
+SELECT @@global.wsrep_certify_nonpk;
+SET @@global.wsrep_certify_nonpk=ON;
+SELECT @@global.wsrep_certify_nonpk;
+SET @@global.wsrep_certify_nonpk=default;
+SELECT @@global.wsrep_certify_nonpk;
+
+--echo
+--echo # invalid values
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_certify_nonpk=NULL;
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_certify_nonpk='junk';
+
+--echo
+--echo # restore the initial value
+SET @@global.wsrep_certify_nonpk = @wsrep_certify_nonpk_global_saved;
+
+--echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_cluster_address_basic.test b/mysql-test/suite/sys_vars/t/wsrep_cluster_address_basic.test
new file mode 100644
index 00000000..6e0767ce
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wsrep_cluster_address_basic.test
@@ -0,0 +1,47 @@
+--source include/have_wsrep.inc
+
+--echo #
+--echo # wsrep_cluster_address
+--echo #
+
+--echo # save the initial value
+SET @wsrep_cluster_address_global_saved = @@global.wsrep_cluster_address;
+
+--echo # default
+SELECT @@global.wsrep_cluster_address;
+
+--echo
+--echo # scope
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.wsrep_cluster_address;
+SELECT @@global.wsrep_cluster_address;
+
+--echo
+--echo # valid values
+SET @@global.wsrep_cluster_address='127.0.0.1';
+SELECT @@global.wsrep_cluster_address;
+SET @@global.wsrep_cluster_address=AUTO;
+SELECT @@global.wsrep_cluster_address;
+SET @@global.wsrep_cluster_address=default;
+SELECT @@global.wsrep_cluster_address;
+
+--echo
+--echo # invalid values
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_node_address=NULL;
+SELECT @@global.wsrep_node_address;
+# The values being assigned to wsrep_node_address are not verified so the
+# following alues are currently valid too.
+SET @@global.wsrep_cluster_address=ON;
+SELECT @@global.wsrep_cluster_address;
+SET @@global.wsrep_cluster_address='OFF';
+SELECT @@global.wsrep_cluster_address;
+SET @@global.wsrep_cluster_address='junk';
+SELECT @@global.wsrep_cluster_address;
+
+--echo
+--echo # restore the initial value
+--error 0,ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_cluster_address = @wsrep_cluster_address_global_saved;
+
+--echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_cluster_name_basic.test b/mysql-test/suite/sys_vars/t/wsrep_cluster_name_basic.test
new file mode 100644
index 00000000..a6fc3ef7
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wsrep_cluster_name_basic.test
@@ -0,0 +1,40 @@
+--source include/have_wsrep.inc
+
+--echo #
+--echo # wsrep_cluster_name
+--echo #
+
+--echo # save the initial value
+SET @wsrep_cluster_name_global_saved = @@global.wsrep_cluster_name;
+
+--echo # default
+SELECT @@global.wsrep_cluster_name;
+
+--echo
+--echo # scope
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.wsrep_cluster_name;
+SET @@global.wsrep_cluster_name='my_galera_cluster';
+SELECT @@global.wsrep_cluster_name;
+
+--echo
+--echo # valid values
+SET @@global.wsrep_cluster_name='my_quoted_galera_cluster';
+SELECT @@global.wsrep_cluster_name;
+SET @@global.wsrep_cluster_name=my_unquoted_cluster;
+SELECT @@global.wsrep_cluster_name;
+SET @@global.wsrep_cluster_name=OFF;
+SELECT @@global.wsrep_cluster_name;
+SET @@global.wsrep_cluster_name=default;
+SELECT @@global.wsrep_cluster_name;
+
+--echo
+--echo # invalid values
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_cluster_name=NULL;
+
+--echo
+--echo # restore the initial value
+SET @@global.wsrep_cluster_name = @wsrep_cluster_name_global_saved;
+
+--echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_convert_lock_to_trx_basic.test b/mysql-test/suite/sys_vars/t/wsrep_convert_lock_to_trx_basic.test
new file mode 100644
index 00000000..486832fb
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wsrep_convert_lock_to_trx_basic.test
@@ -0,0 +1,42 @@
+--source include/have_wsrep.inc
+
+--echo #
+--echo # wsrep_convert_lock_to_trx
+--echo #
+
+--echo # save the initial value
+SET @wsrep_convert_lock_to_trx_global_saved = @@global.wsrep_convert_lock_to_trx;
+
+--echo # default
+SELECT @@global.wsrep_convert_lock_to_trx;
+
+--echo
+--echo # scope
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.wsrep_convert_lock_to_trx;
+SET @@global.wsrep_convert_lock_to_trx=OFF;
+SELECT @@global.wsrep_convert_lock_to_trx;
+SET @@global.wsrep_convert_lock_to_trx=ON;
+SELECT @@global.wsrep_convert_lock_to_trx;
+
+--echo
+--echo # valid values
+SET @@global.wsrep_convert_lock_to_trx='OFF';
+SELECT @@global.wsrep_convert_lock_to_trx;
+SET @@global.wsrep_convert_lock_to_trx=ON;
+SELECT @@global.wsrep_convert_lock_to_trx;
+SET @@global.wsrep_convert_lock_to_trx=default;
+SELECT @@global.wsrep_convert_lock_to_trx;
+
+--echo
+--echo # invalid values
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_convert_lock_to_trx=NULL;
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_convert_lock_to_trx='junk';
+
+--echo
+--echo # restore the initial value
+SET @@global.wsrep_convert_lock_to_trx = @wsrep_convert_lock_to_trx_global_saved;
+
+--echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_data_home_dir_basic.test b/mysql-test/suite/sys_vars/t/wsrep_data_home_dir_basic.test
new file mode 100644
index 00000000..646600c7
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wsrep_data_home_dir_basic.test
@@ -0,0 +1,28 @@
+--source include/have_wsrep.inc
+--let $datadir = `SELECT @@datadir`
+
+--echo #
+--echo # wsrep_data_home_dir (readonly)
+--echo #
+
+--echo # default
+--replace_result $datadir DATADIR
+SELECT @@global.wsrep_data_home_dir;
+
+--echo
+--echo # scope
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.wsrep_data_home_dir;
+
+--echo
+--echo # valid values
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.wsrep_data_home_dir='/tmp/data';
+--replace_result $datadir DATADIR
+SELECT @@global.wsrep_data_home_dir;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.wsrep_data_home_dir=default;
+--replace_result $datadir DATADIR
+SELECT @@global.wsrep_data_home_dir;
+
+--echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_dbug_option_basic.test b/mysql-test/suite/sys_vars/t/wsrep_dbug_option_basic.test
new file mode 100644
index 00000000..80ce190a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wsrep_dbug_option_basic.test
@@ -0,0 +1,42 @@
+--source include/have_wsrep.inc
+
+--echo #
+--echo # wsrep_dbug_option
+--echo #
+
+--echo # save the initial value
+SET @wsrep_dbug_option_global_saved = @@global.wsrep_dbug_option;
+
+--echo # default
+SELECT @@global.wsrep_dbug_option;
+
+--echo
+--echo # scope
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.wsrep_dbug_option;
+SET @@global.wsrep_dbug_option='test-dbug-string';
+SELECT @@global.wsrep_dbug_option;
+
+--echo
+--echo # valid values
+SET @@global.wsrep_dbug_option='quoted-dbug-string';
+SELECT @@global.wsrep_dbug_option;
+SET @@global.wsrep_dbug_option=unquoted_dbug_string;
+SELECT @@global.wsrep_dbug_option;
+SET @@global.wsrep_dbug_option=OFF;
+SELECT @@global.wsrep_dbug_option;
+SET @@global.wsrep_dbug_option=NULL;
+SELECT @@global.wsrep_dbug_option;
+SET @@global.wsrep_dbug_option=default;
+SELECT @@global.wsrep_dbug_option;
+
+--echo
+--echo # invalid values
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@global.wsrep_dbug_option=1;
+
+--echo
+--echo # restore the initial value
+SET @@global.wsrep_dbug_option = @wsrep_dbug_option_global_saved;
+
+--echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_debug_basic.test b/mysql-test/suite/sys_vars/t/wsrep_debug_basic.test
new file mode 100644
index 00000000..165560bb
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wsrep_debug_basic.test
@@ -0,0 +1,44 @@
+--source include/have_wsrep.inc
+
+--echo #
+--echo # wsrep_debug
+--echo #
+
+--echo # save the initial value
+SET @wsrep_debug_global_saved = @@global.wsrep_debug;
+
+--echo # default
+SELECT @@global.wsrep_debug;
+
+--echo
+--echo # scope
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.wsrep_debug;
+SET @@global.wsrep_debug=0;
+SELECT @@global.wsrep_debug;
+SET @@global.wsrep_debug=1;
+SELECT @@global.wsrep_debug;
+
+--echo
+--echo # valid values
+SET @@global.wsrep_debug=NONE;
+SELECT @@global.wsrep_debug;
+SET @@global.wsrep_debug=SERVER;
+SELECT @@global.wsrep_debug;
+SET @@global.wsrep_debug=default;
+SELECT @@global.wsrep_debug;
+
+--echo
+--echo # invalid values
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_debug=NULL;
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_debug='junk';
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_debug=ON;
+
+--echo
+--echo # restore the initial value
+SET @@global.wsrep_debug = @wsrep_debug_global_saved;
+
+--echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_desync_basic.test b/mysql-test/suite/sys_vars/t/wsrep_desync_basic.test
new file mode 100644
index 00000000..e386004b
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wsrep_desync_basic.test
@@ -0,0 +1,57 @@
+--source include/have_wsrep.inc
+
+--echo #
+--echo # wsrep_desync
+--echo #
+
+# expected as no wsrep provider is currently loaded
+call mtr.add_suppression("WSREP: SET desync failed 9 for schema: test, query: SET @@global.wsrep_desync=ON");
+
+--echo # save the initial value
+SET @wsrep_desync_global_saved = @@global.wsrep_desync;
+
+--echo # default
+SELECT @@global.wsrep_desync;
+
+--echo
+--echo # scope
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.wsrep_desync;
+--disable_warnings
+--error 0,ER_WRONG_ARGUMENTS
+SET @@global.wsrep_desync=OFF;
+--enable_warnings
+SELECT @@global.wsrep_desync;
+# expected as no wsrep provider is currently loaded
+--error ER_CANNOT_USER,ER_WRONG_ARGUMENTS
+SET @@global.wsrep_desync=ON;
+SELECT @@global.wsrep_desync;
+
+--echo
+--echo # valid values
+--error 0,ER_WRONG_ARGUMENTS
+SET @@global.wsrep_desync='OFF';
+SELECT @@global.wsrep_desync;
+# expected as no wsrep provider is currently loaded
+--error ER_CANNOT_USER,ER_WRONG_ARGUMENTS
+SET @@global.wsrep_desync=ON;
+SELECT @@global.wsrep_desync;
+--error 0,ER_WRONG_ARGUMENTS
+SET @@global.wsrep_desync=default;
+SELECT @@global.wsrep_desync;
+
+--echo
+--echo # invalid values
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_desync=NULL;
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_desync='junk';
+
+--echo
+--echo # restore the initial value
+--disable_warnings
+--error 0,ER_WRONG_ARGUMENTS
+SET @@global.wsrep_desync = @wsrep_desync_global_saved;
+--enable_warnings
+
+--echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_dirty_reads_basic.test b/mysql-test/suite/sys_vars/t/wsrep_dirty_reads_basic.test
new file mode 100644
index 00000000..ffe767a0
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wsrep_dirty_reads_basic.test
@@ -0,0 +1,48 @@
+--source include/have_wsrep.inc
+
+--echo #
+--echo # wsrep_dirty_reads
+--echo #
+
+--echo # save the initial value
+SET @wsrep_dirty_reads_session_saved = @@session.wsrep_dirty_reads;
+
+--echo # default
+
+SELECT @@global.wsrep_dirty_reads;
+SELECT @@session.wsrep_dirty_reads;
+
+--echo
+--echo # valid values for session
+SET @@session.wsrep_dirty_reads=OFF;
+SELECT @@session.wsrep_dirty_reads;
+SET @@session.wsrep_dirty_reads=ON;
+SELECT @@session.wsrep_dirty_reads;
+SET @@session.wsrep_dirty_reads=default;
+SELECT @@session.wsrep_dirty_reads;
+
+--echo
+--echo # valid values for global
+SET @@global.wsrep_dirty_reads=OFF;
+SELECT @@global.wsrep_dirty_reads;
+SET @@global.wsrep_dirty_reads=ON;
+SELECT @@global.wsrep_dirty_reads;
+SET @@global.wsrep_dirty_reads=default;
+SELECT @@global.wsrep_dirty_reads;
+
+--echo
+--echo # invalid values
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@session.wsrep_dirty_reads=NULL;
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@session.wsrep_dirty_reads='junk';
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_dirty_reads=NULL;
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_dirty_reads='junk';
+
+--echo
+--echo # restore the initial values
+SET @@session.wsrep_dirty_reads = @wsrep_dirty_reads_session_saved;
+
+--echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_drupal_282555_workaround_basic.test b/mysql-test/suite/sys_vars/t/wsrep_drupal_282555_workaround_basic.test
new file mode 100644
index 00000000..e24f6a15
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wsrep_drupal_282555_workaround_basic.test
@@ -0,0 +1,42 @@
+--source include/have_wsrep.inc
+
+--echo #
+--echo # wsrep_drupal_282555_workaround
+--echo #
+
+--echo # save the initial value
+SET @wsrep_drupal_282555_workaround_global_saved = @@global.wsrep_drupal_282555_workaround;
+
+--echo # default
+SELECT @@global.wsrep_drupal_282555_workaround;
+
+--echo
+--echo # scope
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.wsrep_drupal_282555_workaround;
+SET @@global.wsrep_drupal_282555_workaround=OFF;
+SELECT @@global.wsrep_drupal_282555_workaround;
+SET @@global.wsrep_drupal_282555_workaround=ON;
+SELECT @@global.wsrep_drupal_282555_workaround;
+
+--echo
+--echo # valid values
+SET @@global.wsrep_drupal_282555_workaround='OFF';
+SELECT @@global.wsrep_drupal_282555_workaround;
+SET @@global.wsrep_drupal_282555_workaround=ON;
+SELECT @@global.wsrep_drupal_282555_workaround;
+SET @@global.wsrep_drupal_282555_workaround=default;
+SELECT @@global.wsrep_drupal_282555_workaround;
+
+--echo
+--echo # invalid values
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_drupal_282555_workaround=NULL;
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_drupal_282555_workaround='junk';
+
+--echo
+--echo # restore the initial value
+SET @@global.wsrep_drupal_282555_workaround = @wsrep_drupal_282555_workaround_global_saved;
+
+--echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_forced_binlog_format_basic.test b/mysql-test/suite/sys_vars/t/wsrep_forced_binlog_format_basic.test
new file mode 100644
index 00000000..455034bb
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wsrep_forced_binlog_format_basic.test
@@ -0,0 +1,46 @@
+--source include/have_wsrep.inc
+
+--echo #
+--echo # wsrep_forced_binlog_format
+--echo #
+
+--echo # save the initial value
+SET @wsrep_forced_binlog_format_global_saved = @@global.wsrep_forced_binlog_format;
+
+--echo # default
+SELECT @@global.wsrep_forced_binlog_format;
+
+--echo
+--echo # scope
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.wsrep_forced_binlog_format;
+SET @@global.wsrep_forced_binlog_format=STATEMENT;
+SELECT @@global.wsrep_forced_binlog_format;
+
+--echo
+--echo # valid values
+SET @@global.wsrep_forced_binlog_format=STATEMENT;
+SELECT @@global.wsrep_forced_binlog_format;
+SET @@global.wsrep_forced_binlog_format=ROW;
+SELECT @@global.wsrep_forced_binlog_format;
+SET @@global.wsrep_forced_binlog_format=MIXED;
+SELECT @@global.wsrep_forced_binlog_format;
+SET @@global.wsrep_forced_binlog_format=NONE;
+SELECT @@global.wsrep_forced_binlog_format;
+SET @@global.wsrep_forced_binlog_format=default;
+SELECT @@global.wsrep_forced_binlog_format;
+
+--echo
+--echo # invalid values
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_forced_binlog_format=NULL;
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_forced_binlog_format='junk';
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_forced_binlog_format=ON;
+
+--echo
+--echo # restore the initial value
+SET @@global.wsrep_forced_binlog_format = @wsrep_forced_binlog_format_global_saved;
+
+--echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_gtid_domain_id_basic.test b/mysql-test/suite/sys_vars/t/wsrep_gtid_domain_id_basic.test
new file mode 100644
index 00000000..5608e46e
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wsrep_gtid_domain_id_basic.test
@@ -0,0 +1,43 @@
+--source include/have_wsrep.inc
+
+--echo #
+--echo # wsrep_gtid_domain_id
+--echo #
+
+--echo # save the initial value
+SET @wsrep_gtid_domain_id_global_saved = @@global.wsrep_gtid_domain_id;
+
+--echo # default
+SELECT @@global.wsrep_gtid_domain_id;
+
+--echo
+--echo # scope
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.wsrep_gtid_domain_id;
+SET @@global.wsrep_gtid_domain_id=1;
+SELECT @@global.wsrep_gtid_domain_id;
+
+--echo
+--echo # valid values
+SET @@global.wsrep_gtid_domain_id=10;
+SELECT @@global.wsrep_gtid_domain_id;
+SET @@global.wsrep_gtid_domain_id=0;
+SELECT @@global.wsrep_gtid_domain_id;
+SET @@global.wsrep_gtid_domain_id=default;
+SELECT @global.wsrep_gtid_domain_id;
+
+--echo
+--echo # invalid values
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@global.wsrep_gtid_domain_id=NULL;
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@global.wsrep_gtid_domain_id='junk';
+# expect warning : Truncated incorrect wsrep_gtid_domain_id value: '-1'
+SET @@global.wsrep_gtid_domain_id=-1;
+SELECT @global.wsrep_gtid_domain_id;
+
+--echo
+--echo # restore the initial value
+SET @@global.wsrep_gtid_domain_id = @wsrep_gtid_domain_id_global_saved;
+
+--echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_gtid_mode_basic.test b/mysql-test/suite/sys_vars/t/wsrep_gtid_mode_basic.test
new file mode 100644
index 00000000..1a749e18
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wsrep_gtid_mode_basic.test
@@ -0,0 +1,33 @@
+--source include/have_wsrep.inc
+
+--echo #
+--echo # wsrep_gtid_mode
+--echo #
+
+--echo # save the initial value
+SET @wsrep_gtid_mode_global_saved = @@global.wsrep_gtid_mode;
+
+--echo # default
+SELECT @@global.wsrep_gtid_mode;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.wsrep_gtid_mode;
+
+--echo
+--echo # scope and valid values
+SET @@global.wsrep_gtid_mode=OFF;
+SELECT @@global.wsrep_gtid_mode;
+SET @@global.wsrep_gtid_mode=ON;
+SELECT @@global.wsrep_gtid_mode;
+
+--echo
+--echo # invalid values
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_gtid_mode=NULL;
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_gtid_mode='junk';
+
+--echo
+--echo # restore the initial value
+SET @@global.wsrep_gtid_mode = @wsrep_gtid_mode_global_saved;
+
+--echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_load_data_splitting_basic.test b/mysql-test/suite/sys_vars/t/wsrep_load_data_splitting_basic.test
new file mode 100644
index 00000000..d52e388f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wsrep_load_data_splitting_basic.test
@@ -0,0 +1,42 @@
+--source include/have_wsrep.inc
+
+--echo #
+--echo # wsrep_load_data_splitting
+--echo #
+
+--echo # save the initial value
+SET @wsrep_load_data_splitting_global_saved = @@global.wsrep_load_data_splitting;
+
+--echo # default
+SELECT @@global.wsrep_load_data_splitting;
+
+--echo
+--echo # scope
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.wsrep_load_data_splitting;
+SET @@global.wsrep_load_data_splitting=OFF;
+SELECT @@global.wsrep_load_data_splitting;
+SET @@global.wsrep_load_data_splitting=ON;
+SELECT @@global.wsrep_load_data_splitting;
+
+--echo
+--echo # valid values
+SET @@global.wsrep_load_data_splitting='OFF';
+SELECT @@global.wsrep_load_data_splitting;
+SET @@global.wsrep_load_data_splitting=ON;
+SELECT @@global.wsrep_load_data_splitting;
+SET @@global.wsrep_load_data_splitting=default;
+SELECT @@global.wsrep_load_data_splitting;
+
+--echo
+--echo # invalid values
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_load_data_splitting=NULL;
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_load_data_splitting='junk';
+
+--echo
+--echo # restore the initial value
+SET @@global.wsrep_load_data_splitting = @wsrep_load_data_splitting_global_saved;
+
+--echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_log_conflicts_basic.test b/mysql-test/suite/sys_vars/t/wsrep_log_conflicts_basic.test
new file mode 100644
index 00000000..eee4d966
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wsrep_log_conflicts_basic.test
@@ -0,0 +1,42 @@
+--source include/have_wsrep.inc
+
+--echo #
+--echo # wsrep_log_conflicts
+--echo #
+
+--echo # save the initial value
+SET @wsrep_log_conflicts_global_saved = @@global.wsrep_log_conflicts;
+
+--echo # default
+SELECT @@global.wsrep_log_conflicts;
+
+--echo
+--echo # scope
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.wsrep_log_conflicts;
+SET @@global.wsrep_log_conflicts=OFF;
+SELECT @@global.wsrep_log_conflicts;
+SET @@global.wsrep_log_conflicts=ON;
+SELECT @@global.wsrep_log_conflicts;
+
+--echo
+--echo # valid values
+SET @@global.wsrep_log_conflicts='OFF';
+SELECT @@global.wsrep_log_conflicts;
+SET @@global.wsrep_log_conflicts=ON;
+SELECT @@global.wsrep_log_conflicts;
+SET @@global.wsrep_log_conflicts=default;
+SELECT @@global.wsrep_log_conflicts;
+
+--echo
+--echo # invalid values
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_log_conflicts=NULL;
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_log_conflicts='junk';
+
+--echo
+--echo # restore the initial value
+SET @@global.wsrep_log_conflicts = @wsrep_log_conflicts_global_saved;
+
+--echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_max_ws_rows_basic.test b/mysql-test/suite/sys_vars/t/wsrep_max_ws_rows_basic.test
new file mode 100644
index 00000000..ed78662c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wsrep_max_ws_rows_basic.test
@@ -0,0 +1,45 @@
+--source include/have_wsrep.inc
+
+--echo #
+--echo # wsrep_max_ws_rows
+--echo #
+
+--echo # save the initial value
+SET @wsrep_max_ws_rows_global_saved = @@global.wsrep_max_ws_rows;
+
+--echo # default
+SELECT @@global.wsrep_max_ws_rows;
+
+--echo
+--echo # scope
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.wsrep_max_ws_rows;
+SET @@global.wsrep_max_ws_rows=1;
+SELECT @@global.wsrep_max_ws_rows;
+
+--echo
+--echo # valid values
+SET @@global.wsrep_max_ws_rows=131072;
+SELECT @@global.wsrep_max_ws_rows;
+SET @@global.wsrep_max_ws_rows=131073;
+SELECT @@global.wsrep_max_ws_rows;
+SET @@global.wsrep_max_ws_rows=0;
+SELECT @@global.wsrep_max_ws_rows;
+SET @@global.wsrep_max_ws_rows=default;
+SELECT @global.wsrep_max_ws_rows;
+
+--echo
+--echo # invalid values
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@global.wsrep_max_ws_rows=NULL;
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@global.wsrep_max_ws_rows='junk';
+# expect warnings (Truncated incorrect wsrep_max_ws_rows value: '-1')
+SET @@global.wsrep_max_ws_rows=-1;
+SELECT @global.wsrep_max_ws_rows;
+
+--echo
+--echo # restore the initial value
+SET @@global.wsrep_max_ws_rows = @wsrep_max_ws_rows_global_saved;
+
+--echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_max_ws_size_basic.test b/mysql-test/suite/sys_vars/t/wsrep_max_ws_size_basic.test
new file mode 100644
index 00000000..50506ed1
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wsrep_max_ws_size_basic.test
@@ -0,0 +1,44 @@
+--source include/have_wsrep.inc
+
+--echo #
+--echo # wsrep_max_ws_size
+--echo #
+
+--echo # default
+SELECT @@global.wsrep_max_ws_size;
+
+--echo
+--echo # scope
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.wsrep_max_ws_size;
+--error ER_WRONG_ARGUMENTS
+SET @@global.wsrep_max_ws_size=1;
+SELECT @@global.wsrep_max_ws_size;
+
+--echo
+--echo # valid values
+--error ER_WRONG_ARGUMENTS
+SET @@global.wsrep_max_ws_size=1073741824;
+SELECT @@global.wsrep_max_ws_size;
+--error ER_WRONG_ARGUMENTS
+SET @@global.wsrep_max_ws_size=1073741825;
+SELECT @@global.wsrep_max_ws_size;
+--error ER_WRONG_ARGUMENTS
+SET @@global.wsrep_max_ws_size=0;
+SELECT @@global.wsrep_max_ws_size;
+--error ER_WRONG_ARGUMENTS
+SET @@global.wsrep_max_ws_size=default;
+SELECT @global.wsrep_max_ws_size;
+
+--echo
+--echo # invalid values
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@global.wsrep_max_ws_size=NULL;
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@global.wsrep_max_ws_size='junk';
+SELECT @global.wsrep_max_ws_size;
+--error ER_WRONG_ARGUMENTS
+SET @@global.wsrep_max_ws_size=-1;
+SELECT @global.wsrep_max_ws_size;
+
+--echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_mysql_replication_bundle_basic.test b/mysql-test/suite/sys_vars/t/wsrep_mysql_replication_bundle_basic.test
new file mode 100644
index 00000000..c293048c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wsrep_mysql_replication_bundle_basic.test
@@ -0,0 +1,45 @@
+--source include/have_wsrep.inc
+
+--echo #
+--echo # wsrep_mysql_replication_bundle
+--echo #
+
+--echo # save the initial value
+SET @wsrep_mysql_replication_bundle_global_saved = @@global.wsrep_mysql_replication_bundle;
+
+--echo # default
+SELECT @@global.wsrep_mysql_replication_bundle;
+
+--echo
+--echo # scope
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.wsrep_mysql_replication_bundle;
+SELECT @@global.wsrep_mysql_replication_bundle;
+
+--echo
+--echo # valid values
+SET @@global.wsrep_mysql_replication_bundle=0;
+SELECT @@global.wsrep_mysql_replication_bundle;
+SET @@global.wsrep_mysql_replication_bundle=1000;
+SELECT @@global.wsrep_mysql_replication_bundle;
+SET @@global.wsrep_mysql_replication_bundle=default;
+SELECT @@global.wsrep_mysql_replication_bundle;
+
+--echo
+--echo # invalid values
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@global.wsrep_mysql_replication_bundle=NULL;
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@global.wsrep_mysql_replication_bundle='junk';
+# expect warning (truncated incorrect value)
+SET @@global.wsrep_mysql_replication_bundle=-1;
+SELECT @@global.wsrep_mysql_replication_bundle;
+# expect warning (truncated incorrect value)
+SET @@global.wsrep_mysql_replication_bundle=1001;
+SELECT @@global.wsrep_mysql_replication_bundle;
+
+--echo
+--echo # restore the initial value
+SET @@global.wsrep_mysql_replication_bundle = @wsrep_mysql_replication_bundle_global_saved;
+
+--echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_node_address_basic.test b/mysql-test/suite/sys_vars/t/wsrep_node_address_basic.test
new file mode 100644
index 00000000..fccb40de
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wsrep_node_address_basic.test
@@ -0,0 +1,45 @@
+--source include/have_wsrep.inc
+
+--echo #
+--echo # wsrep_node_address
+--echo #
+
+--echo # save the initial value
+SET @wsrep_node_address_global_saved = @@global.wsrep_node_address;
+
+--echo # default
+SELECT @@global.wsrep_node_address;
+
+--echo
+--echo # scope
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.wsrep_node_address;
+SELECT @@global.wsrep_node_address;
+
+--echo
+--echo # valid values
+SET @@global.wsrep_node_address='127.0.0.1';
+SELECT @@global.wsrep_node_address;
+# default == ''
+SET @@global.wsrep_node_address=default;
+SELECT @@global.wsrep_node_address;
+
+--echo
+--echo # invalid values
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_node_address=NULL;
+SELECT @@global.wsrep_node_address;
+# The values being assigned to wsrep_node_address are not verified so the
+# following alues are currently valid too.
+SET @@global.wsrep_node_address=ON;
+SELECT @@global.wsrep_node_address;
+SET @@global.wsrep_node_address='OFF';
+SELECT @@global.wsrep_node_address;
+SET @@global.wsrep_node_address='junk';
+SELECT @@global.wsrep_node_address;
+
+--echo
+--echo # restore the initial value
+SET @@global.wsrep_node_address = @wsrep_node_address_global_saved;
+
+--echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_node_incoming_address_basic.test b/mysql-test/suite/sys_vars/t/wsrep_node_incoming_address_basic.test
new file mode 100644
index 00000000..9ab9525d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wsrep_node_incoming_address_basic.test
@@ -0,0 +1,47 @@
+--source include/have_wsrep.inc
+
+--echo #
+--echo # wsrep_node_incoming_address
+--echo #
+
+--echo # save the initial value
+SET @wsrep_node_incoming_address_global_saved = @@global.wsrep_node_incoming_address;
+
+--echo # default
+SELECT @@global.wsrep_node_incoming_address;
+
+--echo
+--echo # scope
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.wsrep_node_incoming_address;
+SELECT @@global.wsrep_node_incoming_address;
+
+--echo
+--echo # valid values
+SET @@global.wsrep_node_incoming_address='127.0.0.1:4444';
+SELECT @@global.wsrep_node_incoming_address;
+SET @@global.wsrep_node_incoming_address='127.0.0.1';
+SELECT @@global.wsrep_node_incoming_address;
+SET @@global.wsrep_node_incoming_address=AUTO;
+SELECT @@global.wsrep_node_incoming_address;
+SET @@global.wsrep_node_incoming_address=default;
+SELECT @@global.wsrep_node_incoming_address;
+
+--echo
+--echo # invalid values
+# The values being assigned to wsrep_node_incoming_address are not verified so
+# the following values are currently valid too.
+SET @@global.wsrep_node_incoming_address=ON;
+SELECT @@global.wsrep_node_incoming_address;
+SET @@global.wsrep_node_incoming_address='OFF';
+SELECT @@global.wsrep_node_incoming_address;
+SET @@global.wsrep_node_incoming_address=NULL;
+SELECT @@global.wsrep_node_incoming_address;
+SET @@global.wsrep_node_incoming_address='junk';
+SELECT @@global.wsrep_node_incoming_address;
+
+--echo
+--echo # restore the initial value
+SET @@global.wsrep_node_incoming_address = @wsrep_node_incoming_address_global_saved;
+
+--echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_node_name_basic.test b/mysql-test/suite/sys_vars/t/wsrep_node_name_basic.test
new file mode 100644
index 00000000..7bc9bec8
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wsrep_node_name_basic.test
@@ -0,0 +1,54 @@
+--source include/have_wsrep.inc
+
+--echo #
+--echo # wsrep_node_name
+--echo #
+
+call mtr.add_suppression("WSREP: Failed to get provider options");
+
+--echo # save the initial value
+SET @wsrep_node_name_global_saved = @@global.wsrep_node_name;
+
+--echo # default (expect 1)
+SELECT COUNT(@@global.wsrep_node_name);
+
+--echo
+--echo # scope
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.wsrep_node_name;
+SET @@global.wsrep_node_name='node_name';
+SELECT @@global.wsrep_node_name;
+
+--echo
+--echo # valid values
+SET @@global.wsrep_node_name='my_node';
+SELECT @@global.wsrep_node_name;
+SET @@global.wsrep_node_name='hyphenated-node-name';
+SELECT @@global.wsrep_node_name;
+SET @@global.wsrep_node_name=default;
+--echo # default (expect 1)
+SELECT COUNT(@@global.wsrep_node_name);
+
+--echo
+--echo # invalid values
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_node_name=NULL;
+SELECT COUNT(@@global.wsrep_node_name);
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@global.wsrep_node_name=1;
+SELECT COUNT(@@global.wsrep_node_name);
+
+--echo #
+--echo # MDEV-6699 : wsrep_node_name not automaticly set to hostname
+--echo #
+SET @@global.wsrep_node_name=default;
+SELECT @@GLOBAL.wsrep_node_name = VARIABLE_VALUE FROM
+INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='hostname';
+SELECT @@GLOBAL.wsrep_node_name = VARIABLE_VALUE FROM
+INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='wsrep_node_name';
+
+--echo
+--echo # restore the initial value
+SET @@global.wsrep_node_name = @wsrep_node_name_global_saved;
+
+--echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_on_without_provider.test b/mysql-test/suite/sys_vars/t/wsrep_on_without_provider.test
new file mode 100644
index 00000000..9b325524
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wsrep_on_without_provider.test
@@ -0,0 +1,10 @@
+--source include/not_embedded.inc
+--source include/have_wsrep.inc
+
+#
+# @@global.wsrep_on is not allowed if there
+# is no wsrep_provider
+#
+--error ER_WRONG_ARGUMENTS
+SET GLOBAL wsrep_on=ON;
+SELECT @@global.wsrep_on; \ No newline at end of file
diff --git a/mysql-test/suite/sys_vars/t/wsrep_osu_method_basic.test b/mysql-test/suite/sys_vars/t/wsrep_osu_method_basic.test
new file mode 100644
index 00000000..ce3a3def
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wsrep_osu_method_basic.test
@@ -0,0 +1,49 @@
+--source include/have_wsrep.inc
+
+--echo #
+--echo # wsrep_osu_method
+--echo #
+
+--echo # save the initial value
+SET @wsrep_osu_method_global_saved = @@global.wsrep_osu_method;
+
+--echo # default
+SELECT @@global.wsrep_osu_method;
+
+--echo
+--echo # scope
+SELECT @@session.wsrep_osu_method;
+SET @@global.wsrep_osu_method=TOI;
+SELECT @@global.wsrep_osu_method;
+
+--echo
+--echo # valid values
+SET @@global.wsrep_osu_method=TOI;
+SELECT @@global.wsrep_osu_method;
+SET @@global.wsrep_osu_method=RSU;
+SELECT @@global.wsrep_osu_method;
+SET @@global.wsrep_osu_method="RSU";
+SELECT @@global.wsrep_osu_method;
+SET @@global.wsrep_osu_method=default;
+SELECT @@global.wsrep_osu_method;
+# numeric value
+SET @@global.wsrep_osu_method=1;
+SELECT @@global.wsrep_osu_method;
+
+--echo
+--echo # invalid values
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_osu_method=4;
+SELECT @@global.wsrep_osu_method;
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_osu_method=NULL;
+SELECT @@global.wsrep_osu_method;
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_osu_method='junk';
+SELECT @@global.wsrep_osu_method;
+
+--echo
+--echo # restore the initial value
+SET @@global.wsrep_osu_method = @wsrep_osu_method_global_saved;
+
+--echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_recover_basic.test b/mysql-test/suite/sys_vars/t/wsrep_recover_basic.test
new file mode 100644
index 00000000..f935e12e
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wsrep_recover_basic.test
@@ -0,0 +1,26 @@
+--source include/have_wsrep.inc
+
+--echo #
+--echo # wsrep_recover
+--echo #
+
+--echo # default
+SELECT @@global.wsrep_recover;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.wsrep_recover;
+
+--echo
+--echo # scope and valid values
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.wsrep_recover=OFF;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.wsrep_recover=ON;
+
+--echo
+--echo # invalid values
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.wsrep_recover=NULL;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.wsrep_recover='junk';
+
+--echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_restart_slave_basic.test b/mysql-test/suite/sys_vars/t/wsrep_restart_slave_basic.test
new file mode 100644
index 00000000..c656111a
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wsrep_restart_slave_basic.test
@@ -0,0 +1,36 @@
+--source include/have_wsrep.inc
+
+--echo #
+--echo # wsrep_restart_slave
+--echo #
+
+--echo # save the initial value
+SET @wsrep_restart_slave_global_saved = @@global.wsrep_restart_slave;
+
+--echo # default
+SELECT @@global.wsrep_restart_slave;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.wsrep_restart_slave;
+
+--echo
+--echo # scope and valid values
+#--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+#TODO: check if it is expected for variable to be dynamic?
+SET @@global.wsrep_restart_slave=OFF;
+SELECT @@global.wsrep_restart_slave;
+#--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.wsrep_restart_slave=ON;
+SELECT @@global.wsrep_restart_slave;
+
+--echo
+--echo # invalid values
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_restart_slave=NULL;
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_restart_slave='junk';
+
+--echo
+--echo # restore the initial value
+SET @@global.wsrep_restart_slave = @wsrep_restart_slave_global_saved;
+
+--echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_retry_autocommit_basic.test b/mysql-test/suite/sys_vars/t/wsrep_retry_autocommit_basic.test
new file mode 100644
index 00000000..aa6f27f8
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wsrep_retry_autocommit_basic.test
@@ -0,0 +1,52 @@
+--source include/have_wsrep.inc
+
+--echo #
+--echo # wsrep_retry_autocommit
+--echo #
+
+--echo # save the initial values
+SET @wsrep_retry_autocommit_global_saved = @@global.wsrep_retry_autocommit;
+SET @wsrep_retry_autocommit_session_saved = @@session.wsrep_retry_autocommit;
+
+--echo # default
+SELECT @@global.wsrep_retry_autocommit;
+
+--echo
+--echo # scope
+SET @@session.wsrep_retry_autocommit=1;
+SELECT @@session.wsrep_retry_autocommit;
+SET @@global.wsrep_retry_autocommit=1;
+SELECT @@global.wsrep_retry_autocommit;
+
+--echo
+--echo # valid values
+SET @@global.wsrep_retry_autocommit=10;
+SELECT @@global.wsrep_retry_autocommit;
+SET @@global.wsrep_retry_autocommit=0;
+SELECT @@global.wsrep_retry_autocommit;
+SET @@global.wsrep_retry_autocommit=default;
+SELECT @global.wsrep_retry_autocommit;
+
+SET @@session.wsrep_retry_autocommit=10;
+SELECT @@session.wsrep_retry_autocommit;
+SET @@session.wsrep_retry_autocommit=0;
+SELECT @@session.wsrep_retry_autocommit;
+SET @@session.wsrep_retry_autocommit=default;
+SELECT @session.wsrep_retry_autocommit;
+
+--echo
+--echo # invalid values
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@global.wsrep_retry_autocommit=NULL;
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@global.wsrep_retry_autocommit='junk';
+# expect warning : Truncated incorrect wsrep_retry_autocommit value: '-1'
+SET @@global.wsrep_retry_autocommit=-1;
+SELECT @global.wsrep_retry_autocommit;
+
+--echo
+--echo # restore the initial value
+SET @@global.wsrep_retry_autocommit = @wsrep_retry_autocommit_global_saved;
+SET @@session.wsrep_retry_autocommit = @wsrep_retry_autocommit_session_saved;
+
+--echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_slave_fk_checks_basic.test b/mysql-test/suite/sys_vars/t/wsrep_slave_fk_checks_basic.test
new file mode 100644
index 00000000..dd60eb86
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wsrep_slave_fk_checks_basic.test
@@ -0,0 +1,42 @@
+--source include/have_wsrep.inc
+
+--echo #
+--echo # wsrep_slave_fk_checks
+--echo #
+
+--echo # save the initial value
+SET @wsrep_slave_fk_checks_global_saved = @@global.wsrep_slave_fk_checks;
+
+--echo # default
+SELECT @@global.wsrep_slave_fk_checks;
+
+--echo
+--echo # scope
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.wsrep_slave_fk_checks;
+SET @@global.wsrep_slave_fk_checks=OFF;
+SELECT @@global.wsrep_slave_fk_checks;
+SET @@global.wsrep_slave_fk_checks=ON;
+SELECT @@global.wsrep_slave_fk_checks;
+
+--echo
+--echo # valid values
+SET @@global.wsrep_slave_fk_checks='OFF';
+SELECT @@global.wsrep_slave_fk_checks;
+SET @@global.wsrep_slave_fk_checks=ON;
+SELECT @@global.wsrep_slave_fk_checks;
+SET @@global.wsrep_slave_fk_checks=default;
+SELECT @@global.wsrep_slave_fk_checks;
+
+--echo
+--echo # invalid values
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_slave_fk_checks=NULL;
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_slave_fk_checks='junk';
+
+--echo
+--echo # restore the initial value
+SET @@global.wsrep_slave_fk_checks = @wsrep_slave_fk_checks_global_saved;
+
+--echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_slave_uk_checks_basic.test b/mysql-test/suite/sys_vars/t/wsrep_slave_uk_checks_basic.test
new file mode 100644
index 00000000..c9012954
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wsrep_slave_uk_checks_basic.test
@@ -0,0 +1,42 @@
+--source include/have_wsrep.inc
+
+--echo #
+--echo # wsrep_slave_uk_checks
+--echo #
+
+--echo # save the initial value
+SET @wsrep_slave_uk_checks_global_saved = @@global.wsrep_slave_uk_checks;
+
+--echo # default
+SELECT @@global.wsrep_slave_uk_checks;
+
+--echo
+--echo # scope
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.wsrep_slave_uk_checks;
+SET @@global.wsrep_slave_uk_checks=OFF;
+SELECT @@global.wsrep_slave_uk_checks;
+SET @@global.wsrep_slave_uk_checks=ON;
+SELECT @@global.wsrep_slave_uk_checks;
+
+--echo
+--echo # valid values
+SET @@global.wsrep_slave_uk_checks='OFF';
+SELECT @@global.wsrep_slave_uk_checks;
+SET @@global.wsrep_slave_uk_checks=ON;
+SELECT @@global.wsrep_slave_uk_checks;
+SET @@global.wsrep_slave_uk_checks=default;
+SELECT @@global.wsrep_slave_uk_checks;
+
+--echo
+--echo # invalid values
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_slave_uk_checks=NULL;
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_slave_uk_checks='junk';
+
+--echo
+--echo # restore the initial value
+SET @@global.wsrep_slave_uk_checks = @wsrep_slave_uk_checks_global_saved;
+
+--echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_sst_auth_basic.test b/mysql-test/suite/sys_vars/t/wsrep_sst_auth_basic.test
new file mode 100644
index 00000000..aa901ef9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wsrep_sst_auth_basic.test
@@ -0,0 +1,45 @@
+--source include/have_wsrep.inc
+
+--echo #
+--echo # wsrep_sst_auth
+--echo #
+
+--echo # save the initial value
+SET @wsrep_sst_auth_global_saved = @@global.wsrep_sst_auth;
+
+--echo # default
+SELECT @@global.wsrep_sst_auth;
+
+--echo
+--echo # scope
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.wsrep_sst_auth;
+SET @@global.wsrep_sst_auth='user:pass';
+SELECT @@global.wsrep_sst_auth;
+
+--echo
+--echo # valid values
+SET @@global.wsrep_sst_auth=user;
+SELECT @@global.wsrep_sst_auth;
+SET @@global.wsrep_sst_auth='user:1234';
+SELECT @@global.wsrep_sst_auth;
+SET @@global.wsrep_sst_auth='hyphenated-user-name:';
+SELECT @@global.wsrep_sst_auth;
+SET @@global.wsrep_sst_auth=default;
+SELECT @@global.wsrep_sst_auth;
+SET @@global.wsrep_sst_auth=NULL;
+SELECT @@global.wsrep_sst_auth;
+
+--echo
+--echo # invalid values
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@global.wsrep_sst_auth=1;
+SELECT @@global.wsrep_sst_auth;
+--error ER_PARSE_ERROR
+SET @@global.wsrep_sst_auth=user:pass;
+
+--echo
+--echo # restore the initial value
+SET @@global.wsrep_sst_auth = @wsrep_sst_auth_global_saved;
+
+--echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_sst_donor_basic.test b/mysql-test/suite/sys_vars/t/wsrep_sst_donor_basic.test
new file mode 100644
index 00000000..c4b32bb8
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wsrep_sst_donor_basic.test
@@ -0,0 +1,46 @@
+--source include/have_wsrep.inc
+
+--echo #
+--echo # wsrep_sst_donor
+--echo #
+
+--echo # save the initial value
+SET @wsrep_sst_donor_global_saved = @@global.wsrep_sst_donor;
+
+--echo # default
+SELECT @@global.wsrep_sst_donor;
+
+--echo
+--echo # scope
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.wsrep_sst_donor;
+SET @@global.wsrep_sst_donor=rsync;
+SELECT @@global.wsrep_sst_donor;
+
+--echo
+--echo # valid values
+SET @@global.wsrep_sst_donor=node1;
+SELECT @@global.wsrep_sst_donor;
+SET @@global.wsrep_sst_donor='node1,node2';
+SELECT @@global.wsrep_sst_donor;
+SET @@global.wsrep_sst_donor='hyphenated-donor-name';
+SELECT @@global.wsrep_sst_donor;
+SET @@global.wsrep_sst_donor=default;
+SELECT @@global.wsrep_sst_donor;
+SET @@global.wsrep_sst_donor='';
+SELECT @@global.wsrep_sst_donor;
+
+--echo
+--echo # invalid values
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@global.wsrep_sst_donor=1;
+SELECT @@global.wsrep_sst_donor;
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_sst_donor=NULL;
+SELECT @@global.wsrep_sst_donor;
+
+--echo
+--echo # restore the initial value
+SET @@global.wsrep_sst_donor = @wsrep_sst_donor_global_saved;
+
+--echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_sst_donor_rejects_queries_basic.test b/mysql-test/suite/sys_vars/t/wsrep_sst_donor_rejects_queries_basic.test
new file mode 100644
index 00000000..bd34e23c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wsrep_sst_donor_rejects_queries_basic.test
@@ -0,0 +1,42 @@
+--source include/have_wsrep.inc
+
+--echo #
+--echo # wsrep_sst_donor_rejects_queries
+--echo #
+
+--echo # save the initial value
+SET @wsrep_sst_donor_rejects_queries_global_saved = @@global.wsrep_sst_donor_rejects_queries;
+
+--echo # default
+SELECT @@global.wsrep_sst_donor_rejects_queries;
+
+--echo
+--echo # scope
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.wsrep_sst_donor_rejects_queries;
+SET @@global.wsrep_sst_donor_rejects_queries=OFF;
+SELECT @@global.wsrep_sst_donor_rejects_queries;
+SET @@global.wsrep_sst_donor_rejects_queries=ON;
+SELECT @@global.wsrep_sst_donor_rejects_queries;
+
+--echo
+--echo # valid values
+SET @@global.wsrep_sst_donor_rejects_queries='OFF';
+SELECT @@global.wsrep_sst_donor_rejects_queries;
+SET @@global.wsrep_sst_donor_rejects_queries=ON;
+SELECT @@global.wsrep_sst_donor_rejects_queries;
+SET @@global.wsrep_sst_donor_rejects_queries=default;
+SELECT @@global.wsrep_sst_donor_rejects_queries;
+
+--echo
+--echo # invalid values
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_sst_donor_rejects_queries=NULL;
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_sst_donor_rejects_queries='junk';
+
+--echo
+--echo # restore the initial value
+SET @@global.wsrep_sst_donor_rejects_queries = @wsrep_sst_donor_rejects_queries_global_saved;
+
+--echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_sst_method_basic.test b/mysql-test/suite/sys_vars/t/wsrep_sst_method_basic.test
new file mode 100644
index 00000000..be038eb4
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wsrep_sst_method_basic.test
@@ -0,0 +1,52 @@
+--source include/have_wsrep.inc
+
+--echo #
+--echo # wsrep_sst_method
+--echo #
+
+--echo # save the initial value
+SET @wsrep_sst_method_global_saved = @@global.wsrep_sst_method;
+
+--echo # default
+SELECT @@global.wsrep_sst_method;
+
+--echo
+--echo # scope
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.wsrep_sst_method;
+SET @@global.wsrep_sst_method=rsync;
+SELECT @@global.wsrep_sst_method;
+
+--echo
+--echo # valid values
+SET @@global.wsrep_sst_method=rsync;
+SELECT @@global.wsrep_sst_method;
+SET @@global.wsrep_sst_method=mysqldump;
+SELECT @@global.wsrep_sst_method;
+# The xtrabackup and xtrabackup-v2 methods are obsolete,
+# but we can still select them (they will be automatically
+# replaced to mariabackup):
+SET @@global.wsrep_sst_method=xtrabackup;
+SELECT @@global.wsrep_sst_method;
+SET @@global.wsrep_sst_method="xtrabackup-v2";
+SELECT @@global.wsrep_sst_method;
+SET @@global.wsrep_sst_method="mariabackup";
+SELECT @@global.wsrep_sst_method;
+SET @@global.wsrep_sst_method=default;
+SELECT @@global.wsrep_sst_method;
+
+# Its a valid name for an SST method
+SET @@global.wsrep_sst_method='junk';
+SELECT @@global.wsrep_sst_method;
+
+--echo
+--echo # invalid values
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_sst_method=NULL;
+SELECT @@global.wsrep_sst_method;
+
+--echo
+--echo # restore the initial value
+SET @@global.wsrep_sst_method = @wsrep_sst_method_global_saved;
+
+--echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_sst_receive_address_basic.test b/mysql-test/suite/sys_vars/t/wsrep_sst_receive_address_basic.test
new file mode 100644
index 00000000..59f69c14
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wsrep_sst_receive_address_basic.test
@@ -0,0 +1,49 @@
+--source include/have_wsrep.inc
+
+--echo #
+--echo # wsrep_sst_receive_address
+--echo #
+
+--echo # save the initial value
+SET @wsrep_sst_receive_address_global_saved = @@global.wsrep_sst_receive_address;
+
+--echo # default
+SELECT @@global.wsrep_sst_receive_address;
+
+--echo
+--echo # scope
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.wsrep_sst_receive_address;
+SELECT @@global.wsrep_sst_receive_address;
+
+--echo
+--echo # valid values
+SET @@global.wsrep_sst_receive_address=AUTO;
+SELECT @@global.wsrep_sst_receive_address;
+SET @@global.wsrep_sst_receive_address=default;
+SELECT @@global.wsrep_sst_receive_address;
+SET @@global.wsrep_sst_receive_address='192.168.2.254';
+SELECT @@global.wsrep_sst_receive_address;
+
+--echo
+--echo # invalid values
+SELECT @@global.wsrep_sst_receive_address;
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_sst_receive_address=NULL;
+SELECT @@global.wsrep_sst_receive_address;
+# Currently there is no strict checking performed for wsrep_sst_receive_address
+# so following values jusr pass through.
+SET @@global.wsrep_sst_receive_address='OFF';
+SELECT @@global.wsrep_sst_receive_address;
+SET @@global.wsrep_sst_receive_address=ON;
+SELECT @@global.wsrep_sst_receive_address;
+SET @@global.wsrep_sst_receive_address='';
+SELECT @@global.wsrep_sst_receive_address;
+SET @@global.wsrep_sst_receive_address='junk';
+SELECT @@global.wsrep_sst_receive_address;
+
+--echo
+--echo # restore the initial value
+SET @@global.wsrep_sst_receive_address = @wsrep_sst_receive_address_global_saved;
+
+--echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_sync_wait_basic.test b/mysql-test/suite/sys_vars/t/wsrep_sync_wait_basic.test
new file mode 100644
index 00000000..cd0d545f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wsrep_sync_wait_basic.test
@@ -0,0 +1,47 @@
+--source include/have_wsrep.inc
+
+--echo #
+--echo # wsrep_sync_wait
+--echo #
+
+--echo # save the initial values
+SET @wsrep_sync_wait_global_saved = @@global.wsrep_sync_wait;
+SET @wsrep_sync_wait_session_saved = @@session.wsrep_sync_wait;
+
+--echo # default
+SELECT @@global.wsrep_sync_wait;
+SELECT @@session.wsrep_sync_wait;
+
+--echo
+--echo # scope and valid values
+SET @@global.wsrep_sync_wait=0;
+SELECT @@global.wsrep_sync_wait;
+SET @@global.wsrep_sync_wait=7;
+SELECT @@global.wsrep_sync_wait;
+
+SET @@session.wsrep_sync_wait=0;
+SELECT @@session.wsrep_sync_wait;
+SET @@session.wsrep_sync_wait=7;
+SELECT @@session.wsrep_sync_wait;
+SET @@session.wsrep_sync_wait=default;
+SELECT @@session.wsrep_sync_wait;
+SET @@session.wsrep_sync_wait=8;
+SELECT @@session.wsrep_sync_wait;
+
+--echo
+--echo # invalid values
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@global.wsrep_sync_wait=NULL;
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@global.wsrep_sync_wait='junk';
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@session.wsrep_sync_wait=NULL;
+--error ER_WRONG_TYPE_FOR_VAR
+SET @@session.wsrep_sync_wait='junk';
+
+--echo
+--echo # restore the initial values
+SET @@global.wsrep_sync_wait = @wsrep_sync_wait_global_saved;
+SET @@session.wsrep_sync_wait = @wsrep_sync_wait_session_saved;
+
+--echo # End of test