############################################################################## ## WL#9053 : Group Replication: Push Group Replication Plugin to mysql-trunk ## ## This test checks the basic functionality(CRUD operations on doc) of group ## replication plugin along with mysqlx plugin. ## ## NOTE : All the queries through mysqlx plugin is passed using mysqlxtest. ## ## Steps involved in this test : ## 0. This test requires 3 servers. ## 1. Start 3 servers loaded with both mysqlx and group replication plugin. ## 2. Start group replication on server1 as bootstrap server through mysqlx ## 3. Start group replication on other two servers as non bootstrap server. ## 4. Wait until all three servers come online. ## 5. Perform ddl and dml operations on all the three servers. ## a) server1 : Create Collection "characters" and perform CRUD on it. ## b) server2 : Perform CRUD operation on "characters" ## c) server3 : Perform CRUD operation on "characters" ## 6. Print the Collection onto result file so that it can be verified. ## 7. Stop group replication on all the servers through mysqlx # 8. Uninstall mysqlx plugin # 9. clean-up ############################################################################## --source include/big_test.inc --source include/have_mysqlx_plugin.inc --source include/have_group_replication_plugin_base.inc --let plugins= GROUP_REPLICATION --source include/check_plugin_dir.inc ## This initial setup starts three servers with all the prerequisites required ## for GR to start --source include/have_group_replication_plugin.inc --let $rpl_skip_group_replication_start= 1 --let $rpl_server_count= 3 --source include/group_replication.inc ## Install Mysqlx plugin on all servers. --let $rpl_connection_name= server1 --source include/rpl_connection.inc --source include/xplugin_wait_for_interfaces.inc --let $rpl_connection_name= server2 --source include/rpl_connection.inc --source include/xplugin_wait_for_interfaces.inc --let $rpl_connection_name= server3 --source include/rpl_connection.inc --source include/xplugin_wait_for_interfaces.inc # File for starting GR through mysqlx # Bootstrap-server --write_file $MYSQL_TMP_DIR/bootstrap_server.tmp -->sql SET GLOBAL GROUP_REPLICATION_GROUP_NAME = 'aaaaaaaa-bbbb-aaaa-aaaa-aaaaaaaaaaaa'; SET GLOBAL GROUP_REPLICATION_BOOTSTRAP_GROUP=1; START GROUP_REPLICATION; SET GLOBAL GROUP_REPLICATION_BOOTSTRAP_GROUP=0; -->endsql EOF # Temp file for starting group replication as non bootstrap server. --write_file $MYSQL_TMP_DIR/non_bootstrap_server.tmp -->sql SET GLOBAL GROUP_REPLICATION_GROUP_NAME = 'aaaaaaaa-bbbb-aaaa-aaaa-aaaaaaaaaaaa'; CHANGE REPLICATION SOURCE TO SOURCE_USER='root' FOR CHANNEL 'group_replication_recovery'; START GROUP_REPLICATION; -->endsql EOF # Starting GR on all the servers through mysqlx --echo Starting GR on server 1 --exec $MYSQLXTEST --ssl-cipher='ECDHE-RSA-AES128-GCM-SHA256' -u root --port=$MASTER_X_MYPORT_1 --file=$MYSQL_TMP_DIR/bootstrap_server.tmp 2>&1 --echo Starting GR on server 2 --exec $MYSQLXTEST --ssl-cipher='ECDHE-RSA-AES128-GCM-SHA256' -u root --port=$MASTER_X_MYPORT_2 --file=$MYSQL_TMP_DIR/non_bootstrap_server.tmp 2>&1 --echo Starting GR on server 3 --exec $MYSQLXTEST --ssl-cipher='ECDHE-RSA-AES128-GCM-SHA256' -u root --port=$MASTER_X_MYPORT_3 --file=$MYSQL_TMP_DIR/non_bootstrap_server.tmp 2>&1 --echo Waiting for GR members to come online. --let $wait_condition=SELECT COUNT(*)=3 FROM performance_schema.replication_group_members where MEMBER_STATE="ONLINE" --source include/wait_condition.inc ## Temp file for performing crud operation on collection "characters" from ## server1 --write_file $MYSQL_TMP_DIR/crud_on_server1.tmp -->stmtadmin list_objects {"schema":"test"} -->recvresult -->stmtadmin create_collection {"schema":"test","name":"characters"} -->recvresult Mysqlx.Crud.Insert { collection { name: "characters" schema: "test" } data_model: DOCUMENT row { field { type: OBJECT object { fld { key: "House" value { type: LITERAL literal { type: V_OCTETS v_octets { value: "Stark" } } } } fld { key: "_id" value { type: LITERAL literal { type: V_OCTETS v_octets { value: "6c706242055ae611fd36b86b23c1b9b9" } } } } fld { key: "name" value { type: LITERAL literal { type: V_OCTETS v_octets { value: "John Snow" } } } } } } } } -->recvresult Mysqlx.Crud.Insert { collection { name: "characters" schema: "test" } data_model: DOCUMENT row { field { type: OBJECT object { fld { key: "House" value { type: LITERAL literal { type: V_OCTETS v_octets { value: "Stark" } } } } fld { key: "_id" value { type: LITERAL literal { type: V_OCTETS v_octets { value: "ac1fc3b0055ae611fd36b86b23c1b9b9" } } } } fld { key: "name" value { type: LITERAL literal { type: V_OCTETS v_octets { value: "Rob Stark" } } } } } } } row { field { type: OBJECT object { fld { key: "House" value { type: LITERAL literal { type: V_OCTETS v_octets { value: "Stark" } } } } fld { key: "_id" value { type: LITERAL literal { type: V_OCTETS v_octets { value: "4261c3b0055ae611fd36b86b23c1b9b9" } } } } fld { key: "name" value { type: LITERAL literal { type: V_OCTETS v_octets { value: "Arya Stark" } } } } } } } row { field { type: OBJECT object { fld { key: "House" value { type: LITERAL literal { type: V_OCTETS v_octets { value: "Stark" } } } } fld { key: "_id" value { type: LITERAL literal { type: V_OCTETS v_octets { value: "6e62c3b0055ae611fd36b86b23c1b9b9" } } } } fld { key: "name" value { type: LITERAL literal { type: V_OCTETS v_octets { value: "Brandon Stark" } } } } } } } } -->recvresult Mysqlx.Crud.Update { collection { name: "characters" schema: "test" } data_model: DOCUMENT criteria { type: OPERATOR operator { name: "==" param { type: IDENT identifier { document_path { type: MEMBER value: "name" } } } param { type: LITERAL literal { type: V_OCTETS v_octets { value: "John Snow" } } } } } operation { source { document_path { type: MEMBER value: "House" } } operation: ITEM_SET value { type: LITERAL literal { type: V_STRING v_string { value: "Targaryen" } } } } } -->recvresult Mysqlx.Crud.Find { collection { name: "characters" schema: "test" } data_model: DOCUMENT } -->recvresult EOF # Crud operations for collection characters --exec $MYSQLXTEST --ssl-cipher='ECDHE-RSA-AES128-GCM-SHA256' -u root --port=$MASTER_X_MYPORT_1 --file=$MYSQL_TMP_DIR/crud_on_server1.tmp 2>&1 ## Wait for synchronization between the nodes. --source include/rpl_sync.inc ## Temp file for performing crud operation on collection "characters" from server2 --write_file $MYSQL_TMP_DIR/crud_on_server2.tmp Mysqlx.Crud.Update { collection { name: "characters" schema: "test" } data_model: DOCUMENT criteria { type: OPERATOR operator { name: "&&" param { type: OPERATOR operator { name: "==" param { type: IDENT identifier { document_path { type: MEMBER value: "House" } } } param { type: LITERAL literal { type: V_OCTETS v_octets { value: "Targaryen" } } } } } param { type: OPERATOR operator { name: "==" param { type: IDENT identifier { document_path { type: MEMBER value: "name" } } } param { type: LITERAL literal { type: V_OCTETS v_octets { value: "John Snow" } } } } } } } operation { source { document_path { type: MEMBER value: "House" } } operation: ARRAY_APPEND value { type: LITERAL literal { type: V_STRING v_string { value: "Stark" } } } } } -->recvresult Mysqlx.Crud.Insert { collection { name: "characters" schema: "test" } data_model: DOCUMENT row { field { type: OBJECT object { fld { key: "House" value { type: LITERAL literal { type: V_OCTETS v_octets { value: "Stark " } } } } fld { key: "_id" value { type: LITERAL literal { type: V_OCTETS v_octets { value: "1616f2480b5ae611c319b86b23c1b9b9" } } } } fld { key: "name" value { type: LITERAL literal { type: V_OCTETS v_octets { value: "Sansa Stark" } } } } } } } } -->recvresult Mysqlx.Crud.Delete { collection { name: "characters" schema: "test" } data_model: DOCUMENT criteria { type: OPERATOR operator { name: "like" param { type: IDENT identifier { document_path { type: MEMBER value: "name" } } } param { type: LITERAL literal { type: V_OCTETS v_octets { value: "Robb%" } } } } } } -->recvresult Mysqlx.Crud.Find { collection { name: "characters" schema: "test" } data_model: DOCUMENT } -->recvresult EOF --exec $MYSQLXTEST --ssl-cipher='ECDHE-RSA-AES128-GCM-SHA256' -u root --port=$MASTER_X_MYPORT_2 --file=$MYSQL_TMP_DIR/crud_on_server2.tmp 2>&1 ## Wait for synchronization between the nodes. --source include/rpl_sync.inc ## Temp file for performing crud operation on collection "characters" from server3 --write_file $MYSQL_TMP_DIR/crud_on_server3.tmp Mysqlx.Crud.Insert { collection { name: "characters" schema: "test" } data_model: DOCUMENT row { field { type: OBJECT object { fld { key: "House" value { type: LITERAL literal { type: V_OCTETS v_octets { value: "Stark" } } } } fld { key: "_id" value { type: LITERAL literal { type: V_OCTETS v_octets { value: "8cd5d2d90e5ae611e325b86b23c1b9b9" } } } } fld { key: "name" value { type: LITERAL literal { type: V_OCTETS v_octets { value: "Benjen Stark" } } } } } } } row { field { type: OBJECT object { fld { key: "House" value { type: LITERAL literal { type: V_OCTETS v_octets { value: "Stark" } } } } fld { key: "_id" value { type: LITERAL literal { type: V_OCTETS v_octets { value: "b2d7d2d90e5ae611e325b86b23c1b9b9" } } } } fld { key: "name" value { type: LITERAL literal { type: V_OCTETS v_octets { value: "Ned Stark" } } } } } } } } -->recvresult Mysqlx.Crud.Update { collection { name: "characters" schema: "test" } data_model: DOCUMENT criteria { type: OPERATOR operator { name: "==" param { type: IDENT identifier { document_path { type: MEMBER value: "name" } } } param { type: LITERAL literal { type: V_OCTETS v_octets { value: "Arya Stark" } } } } } operation { source { document_path { type: MEMBER value: "name" } } operation: ITEM_SET value { type: LITERAL literal { type: V_STRING v_string { value: "A girl has NoName" } } } } } -->recvresult Mysqlx.Crud.Delete { collection { name: "characters" schema: "test" } data_model: DOCUMENT limit { row_count: 3 } } -->recvresult Mysqlx.Crud.Find { collection { name: "characters" schema: "test" } data_model: DOCUMENT } -->recvresult -->stmtadmin drop_collection {"schema":"test", "name":"characters"} -->recvresult EOF --exec $MYSQLXTEST --ssl-cipher='ECDHE-RSA-AES128-GCM-SHA256' -u root --port=$MASTER_X_MYPORT_3 --file=$MYSQL_TMP_DIR/crud_on_server3.tmp 2>&1 ## Cannot use diff_tables.inc because of the following warning. ## Warning 1235 This version of MySQL doesn't yet support 'sorting of ## non-scalar JSON values' ## Wait for synchronization between the nodes. --source include/rpl_sync.inc # Creating temp file to stop GR. --write_file $MYSQL_TMP_DIR/stop_group_replication.tmp -->stmtsql STOP GROUP_REPLICATION; -->recvresult EOF # Stopping GR on all the servers --echo Stopping GR on server 1 --exec $MYSQLXTEST --ssl-cipher='ECDHE-RSA-AES128-GCM-SHA256' -u root --port=$MASTER_X_MYPORT_1 --file=$MYSQL_TMP_DIR/stop_group_replication.tmp 2>&1 --echo Stopping GR on server 2 --exec $MYSQLXTEST --ssl-cipher='ECDHE-RSA-AES128-GCM-SHA256' -u root --port=$MASTER_X_MYPORT_2 --file=$MYSQL_TMP_DIR/stop_group_replication.tmp 2>&1 --echo Stopping GR on server 3 --exec $MYSQLXTEST --ssl-cipher='ECDHE-RSA-AES128-GCM-SHA256' -u root --port=$MASTER_X_MYPORT_3 --file=$MYSQL_TMP_DIR/stop_group_replication.tmp 2>&1 # Uninstall mysqlx --let $rpl_connection_name= server1 --source include/rpl_connection.inc --let $group_replication_member_state= OFFLINE --source include/gr_wait_for_member_state.inc --source include/assert_and_disable_read_only.inc --let $rpl_connection_name= server2 --source include/rpl_connection.inc --let $group_replication_member_state= OFFLINE --source include/gr_wait_for_member_state.inc --source include/assert_and_disable_read_only.inc --let $rpl_connection_name= server3 --source include/rpl_connection.inc --let $group_replication_member_state= OFFLINE --source include/gr_wait_for_member_state.inc --source include/assert_and_disable_read_only.inc # clean-up --remove_file $MYSQL_TMP_DIR/bootstrap_server.tmp --remove_file $MYSQL_TMP_DIR/non_bootstrap_server.tmp --remove_file $MYSQL_TMP_DIR/crud_on_server1.tmp --remove_file $MYSQL_TMP_DIR/crud_on_server2.tmp --remove_file $MYSQL_TMP_DIR/crud_on_server3.tmp --remove_file $MYSQL_TMP_DIR/stop_group_replication.tmp --source include/group_replication_end.inc