# MDEV#5534: mysql_tzinfo_to_sql generates wrong query
#
# Testing wsrep_replicate_myisam variable.
SELECT @@session.wsrep_replicate_myisam;
ERROR HY000: Variable 'wsrep_replicate_myisam' is a GLOBAL variable
SELECT @@global.wsrep_replicate_myisam;
@@global.wsrep_replicate_myisam
0
SET SESSION wsrep_replicate_myisam= ON;
ERROR HY000: Variable 'wsrep_replicate_myisam' is a GLOBAL variable and should be set with SET GLOBAL
SET GLOBAL wsrep_replicate_myisam= ON;
SET GLOBAL wsrep_replicate_myisam= OFF;
SET GLOBAL wsrep_provider=none;
#
# MDEV#5790: SHOW GLOBAL STATUS LIKE does not show the correct list of
# variables when using "_"
#
CALL mtr.add_suppression("WSREP: Could not open saved state file for reading.*");
SHOW GLOBAL STATUS LIKE 'wsrep%';
Variable_name	Value
wsrep_local_state_uuid	#
wsrep_protocol_version	#
wsrep_last_committed	#
wsrep_replicated	#
wsrep_replicated_bytes	#
wsrep_repl_keys	#
wsrep_repl_keys_bytes	#
wsrep_repl_data_bytes	#
wsrep_repl_other_bytes	#
wsrep_received	#
wsrep_received_bytes	#
wsrep_local_commits	#
wsrep_local_cert_failures	#
wsrep_local_replays	#
wsrep_local_send_queue	#
wsrep_local_send_queue_avg	#
wsrep_local_recv_queue	#
wsrep_local_recv_queue_avg	#
wsrep_local_cached_downto	#
wsrep_flow_control_paused_ns	#
wsrep_flow_control_paused	#
wsrep_flow_control_sent	#
wsrep_flow_control_recv	#
wsrep_cert_deps_distance	#
wsrep_apply_oooe	#
wsrep_apply_oool	#
wsrep_apply_window	#
wsrep_commit_oooe	#
wsrep_commit_oool	#
wsrep_commit_window	#
wsrep_local_state	#
wsrep_local_state_comment	#
wsrep_cert_index_size	#
wsrep_causal_reads	#
wsrep_cert_interval	#
wsrep_incoming_addresses	#
wsrep_cluster_conf_id	#
wsrep_cluster_size	#
wsrep_cluster_state_uuid	#
wsrep_cluster_status	#
wsrep_connected	#
wsrep_local_bf_aborts	#
wsrep_local_index	#
wsrep_provider_name	#
wsrep_provider_vendor	#
wsrep_provider_version	#
wsrep_ready	#
wsrep_thread_count	#

SHOW GLOBAL STATUS LIKE 'wsrep_%';
Variable_name	Value
wsrep_local_state_uuid	#
wsrep_protocol_version	#
wsrep_last_committed	#
wsrep_replicated	#
wsrep_replicated_bytes	#
wsrep_repl_keys	#
wsrep_repl_keys_bytes	#
wsrep_repl_data_bytes	#
wsrep_repl_other_bytes	#
wsrep_received	#
wsrep_received_bytes	#
wsrep_local_commits	#
wsrep_local_cert_failures	#
wsrep_local_replays	#
wsrep_local_send_queue	#
wsrep_local_send_queue_avg	#
wsrep_local_recv_queue	#
wsrep_local_recv_queue_avg	#
wsrep_local_cached_downto	#
wsrep_flow_control_paused_ns	#
wsrep_flow_control_paused	#
wsrep_flow_control_sent	#
wsrep_flow_control_recv	#
wsrep_cert_deps_distance	#
wsrep_apply_oooe	#
wsrep_apply_oool	#
wsrep_apply_window	#
wsrep_commit_oooe	#
wsrep_commit_oool	#
wsrep_commit_window	#
wsrep_local_state	#
wsrep_local_state_comment	#
wsrep_cert_index_size	#
wsrep_causal_reads	#
wsrep_cert_interval	#
wsrep_incoming_addresses	#
wsrep_cluster_conf_id	#
wsrep_cluster_size	#
wsrep_cluster_state_uuid	#
wsrep_cluster_status	#
wsrep_connected	#
wsrep_local_bf_aborts	#
wsrep_local_index	#
wsrep_provider_name	#
wsrep_provider_vendor	#
wsrep_provider_version	#
wsrep_ready	#
wsrep_thread_count	#
SHOW GLOBAL STATUS LIKE 'wsrep_local_state_comment';
Variable_name	Value
wsrep_local_state_comment	#
# Should show nothing.
SHOW STATUS LIKE 'x';
Variable_name	Value
SET GLOBAL wsrep_provider=none;
#
# MDEV#6079: xtrabackup SST failing with maria-10.0-galera
#

SHOW STATUS LIKE 'wsrep_local_state_uuid';
Variable_name	Value
wsrep_local_state_uuid	#

SHOW STATUS LIKE 'wsrep_last_committed';
Variable_name	Value
wsrep_last_committed	#
SET GLOBAL wsrep_provider=none;

#
# MDEV#6206: wsrep_slave_threads subtracts from max_connections
#
call mtr.add_suppression("safe_mutex: Found wrong usage of mutex 'LOCK_wsrep_slave_threads' and 'LOCK_global_system_variables'");
call mtr.add_suppression("WSREP: Failed to get provider options");
SELECT @@global.wsrep_provider;
@@global.wsrep_provider
libgalera_smm.so
SELECT @@global.wsrep_slave_threads;
@@global.wsrep_slave_threads
1
SELECT @@global.wsrep_cluster_address;
@@global.wsrep_cluster_address
NULL
SHOW STATUS LIKE 'threads_connected';
Variable_name	Value
Threads_connected	1
SHOW STATUS LIKE 'wsrep_thread_count';
Variable_name	Value
wsrep_thread_count	0

SELECT @@global.wsrep_provider;
@@global.wsrep_provider
libgalera_smm.so
SELECT @@global.wsrep_cluster_address;
@@global.wsrep_cluster_address
NULL
SHOW STATUS LIKE 'threads_connected';
Variable_name	Value
Threads_connected	1
SHOW STATUS LIKE 'wsrep_thread_count';
Variable_name	Value
wsrep_thread_count	0

# Setting wsrep_cluster_address triggers the creation of
# applier/rollbacker threads.
SET GLOBAL wsrep_cluster_address= 'gcomm://';
# Wait for applier threads to get created.
SELECT @@global.wsrep_provider;
@@global.wsrep_provider
libgalera_smm.so
SELECT @@global.wsrep_cluster_address;
@@global.wsrep_cluster_address
gcomm://
SHOW STATUS LIKE 'threads_connected';
Variable_name	Value
Threads_connected	1
SHOW STATUS LIKE 'wsrep_thread_count';
Variable_name	Value
wsrep_thread_count	2

SET @wsrep_slave_threads_saved= @@global.wsrep_slave_threads;
SET GLOBAL wsrep_slave_threads= 10;
# Wait for applier threads to get created.
SHOW STATUS LIKE 'threads_connected';
Variable_name	Value
Threads_connected	1
SHOW STATUS LIKE 'wsrep_thread_count';
Variable_name	Value
wsrep_thread_count	11
SET GLOBAL wsrep_slave_threads= @wsrep_slave_threads_saved;
SET GLOBAL wsrep_provider= none;
SET GLOBAL wsrep_cluster_address= '';
SET GLOBAL wsrep_provider_options= '';
#
# MDEV#6411: Setting set @@global.wsrep_sst_auth=NULL causes crash
#
SET @wsrep_sst_auth_saved= @@global.wsrep_sst_auth;
SET @@global.wsrep_sst_auth= 'user:pass';
SELECT @@global.wsrep_sst_auth;
@@global.wsrep_sst_auth
********
SET @@global.wsrep_sst_auth= '';
SELECT @@global.wsrep_sst_auth;
@@global.wsrep_sst_auth

SET @@global.wsrep_sst_auth= NULL;
SELECT @@global.wsrep_sst_auth;
@@global.wsrep_sst_auth
NULL
SET @@global.wsrep_sst_auth= @wsrep_sst_auth_saved;
# End of test.