polardbxengine/mysql-test/suite/group_replication/t/gr_single_primary_ro.test

53 lines
1.8 KiB
Plaintext

################################################################################
# WL#9426: Single Primary Mode in Group Replication
#
# Validate that the leader will switch the RO mode off when
# becoming a primary.
#
# This is a simple test that sets super read only before we
# start the group and thus before the server becomes PRIMARY.
# Once it becomes primary, it will automatically switch
# super read only off.
################################################################################
--source include/have_group_replication_plugin.inc
--let $rpl_skip_group_replication_start= 1
--let $rpl_group_replication_single_primary_mode=1
--source include/group_replication.inc
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--let $saved_super_read_only= `SELECT @@GLOBAL.super_read_only`
--let $saved_read_only= `SELECT @@GLOBAL.read_only`
--let $primary_server_uuid= `SELECT @@server_uuid`
# set RO to true
SET GLOBAL super_read_only= TRUE;
--let $assert_cond= "[SELECT @@GLOBAL.super_read_only]" = 1
--let $assert_text= Assert that server is running in super RO.
--source include/assert.inc
# lets start the group
--source include/start_and_bootstrap_group_replication.inc
# wait to be primary
--let $group_replication_expected_uuid=$primary_server_uuid
--source include/gr_wait_primary_member_uuid.inc
# assert that the primary will switch to RW mode.
--let $assert_cond= "[SELECT @@GLOBAL.super_read_only]" = 0
--let $assert_text= Assert that PRIMARY switches out of super RO.
--source include/assert.inc
--source include/stop_group_replication.inc
--replace_result $saved_super_read_only SAVED_SUPER_READ_ONLY
--eval SET GLOBAL super_read_only= $saved_super_read_only
--replace_result $saved_read_only SAVED_READ_ONLY
--eval SET GLOBAL read_only= $saved_read_only
--source include/group_replication_end.inc