Server IP : 172.67.216.182 / Your IP : 162.158.88.163 Web Server : Apache System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /www/server/mysql/mysql-test/suite/group_replication/r/ |
Upload File : |
include/group_replication.inc [rpl_server_count=3] Warnings: Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information. [connection server1] ############################################################ # 1. Bootstrap start GR on server1 (Primary). # Start GR on server2 and server3 (Secondaries). [connection server1] include/start_and_bootstrap_group_replication.inc [connection server2] SET GLOBAL group_replication_member_weight= 70; include/start_group_replication.inc [connection server3] include/start_group_replication.inc include/assert.inc [Verify group_replication_primary_member is SERVER_UUID] ############################################################ # 2. Create a table on group. [connection server1] CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT, KEY(c2)); include/rpl_sync.inc ############################################################ # 3. Stop applier on server2 in order to transaction TX to # be delayed. [connection server2] include/gr_stop_applier_sql_thread.inc STOP SLAVE SQL_THREAD FOR CHANNEL "group_replication_applier"; ############################################################ # 4. Execute transaction TX on server1. # It will be executed on server1 and server3 but will be # delayed on server2. [connection server1] INSERT INTO t1 VALUES (1,1); [connection server2] [connection server3] ############################################################ # 5. Stop GR on server1, this will trigger a new primary election. [connection server1] include/stop_group_replication.inc [connection server2] include/rpl_gr_wait_for_number_of_members.inc include/assert.inc [Verify group_replication_primary_member is SERVER_UUID] ############################################################ # 6. Since the new primary is server2 and it has relay logs # to apply, the conflict detection will be enabled on all # members and transaction TY will conflict with TX. INSERT INTO t1 VALUES (1,1); ERROR HY000: Plugin instructed the server to rollback the current transaction. ############################################################ # 7. Start applier on server2 in order to transaction TX to # be applied (and wait until it is applied). include/gr_start_applier_sql_thread.inc START SLAVE SQL_THREAD FOR CHANNEL "group_replication_applier"; INSERT INTO t1 VALUES (1,1); ERROR 23000: Duplicate entry '1' for key 'PRIMARY' ############################################################ # 8. On future transactions, the new primary will detect that # it did applied all relay logs and will inform the group # that conflict detection can be disabled. INSERT INTO t1 VALUES (2,2); INSERT INTO t1 VALUES (3,3); ############################################################ # 9. Rejoin server1 to the group. [connection server1] include/start_group_replication.inc ############################################################ # 10. Check data consistency. include/rpl_sync.inc include/diff_tables.inc [server1:test.t1, server2:test.t1, server3:test.t1] ############################################################ # 11. Create one more table with foreign keys to validate # that there are no fake foreign keys conflicts on Group # Replication while it is operating in single primary mode. [connection server2] CREATE TABLE t2 (c1 INT PRIMARY KEY, c2 INT, FOREIGN KEY (c2) REFERENCES t1(c2)); ############################################################ # 12. Set a debug sync before broadcast message to group. [connection server2] SET @debug_save= @@GLOBAL.DEBUG; SET @@GLOBAL.DEBUG='d,group_replication_before_message_broadcast'; ############################################################ # 13. Commit transaction T1 that will be blocked before broadcast. [connection server_2] BEGIN; INSERT INTO t2 VALUES (1,1); COMMIT; ############################################################ # 14. Wait until transaction T1 reaches the # group_replication_before_message_broadcast debug sync point. [connection server2] ############################################################ # 15. Commit transaction T2 that will be blocked before broadcast. [connection server_2_1] BEGIN; INSERT INTO t2 VALUES (2,1); COMMIT; ############################################################ # 16. Wait until both transactions reach the # group_replication_before_message_broadcast debug sync point. # Signal both transactions to resume the its path. [connection server2] SET DEBUG_SYNC='now SIGNAL waiting'; SET DEBUG_SYNC='now SIGNAL waiting'; SET @@GLOBAL.DEBUG= @debug_save; ############################################################ # 17. Fetch outcome of transaction T1. [connection server_2] ############################################################ # 18. Fetch outcome of transaction T2. [connection server_2_1] ############################################################ # 19. Check data consistency. [connection server2] include/rpl_sync.inc include/assert.inc [Table t2 contains one row with c1=1] include/assert.inc [Table t2 contains one row with c1=2] include/diff_tables.inc [server1:test.t1, server2:test.t1, server3:test.t1] include/diff_tables.inc [server1:test.t2, server2:test.t2, server3:test.t2] ############################################################ # 20. Clean up. DROP TABLE t2; DROP TABLE t1; SET GLOBAL group_replication_member_weight= DEFAULT; include/group_replication_end.inc