|
| 1 | +# ==== Purpose ==== |
| 2 | +# |
| 3 | +# This test will initialize a new instance of a mysql server enabling binary |
| 4 | +# logging and GTID features. After the server initialization, the test case |
| 5 | +# will connect to the new server and no GTIDs are expected to be generated |
| 6 | +# during the initialization (GTID_EXECUTED should be empty) except from the |
| 7 | +# statements in the initialization file. |
| 8 | +# |
| 9 | +# ==== Related Bugs and Worklogs ==== |
| 10 | +# |
| 11 | +# Bug#22102456 ENABLING GTID AT STARTUP RESULTS IN UNNECESSARY GTID SETS |
| 12 | +# |
| 13 | + |
| 14 | +--source include/not_embedded.inc |
| 15 | +--source include/have_no_undo_tablespaces.inc |
| 16 | + |
| 17 | +--let BASEDIR= `select @@basedir` |
| 18 | +--let DDIR=$MYSQL_TMP_DIR/installdb_test |
| 19 | +--let MYSQLD_LOG=$MYSQL_TMP_DIR/server.log |
| 20 | +--let extra_args=--no-defaults --console --log-syslog=0 --loose-skip-auto_generate_certs --loose-skip-sha256_password_auto_generate_rsa_keys --skip-ssl --basedir=$BASEDIR --lc-messages-dir=$MYSQL_SHAREDIR |
| 21 | +--let init_args=--explicit_defaults_for_timestamp --gtid-mode=on --enforce-gtid-consistency=on --log-bin=mysql-bin --server-id=1 |
| 22 | +--let BOOTSTRAP_SQL=$MYSQL_TMP_DIR/tiny_bootstrap.sql |
| 23 | + |
| 24 | +# We don't care about innodb warnings at this point |
| 25 | +CALL mtr.add_suppression("InnoDB:"); |
| 26 | +USE mysql; |
| 27 | + |
| 28 | +--echo # Create bootstrap file |
| 29 | +write_file $BOOTSTRAP_SQL; |
| 30 | +CREATE DATABASE test; |
| 31 | +CREATE TABLE test.t1(a INT) ENGINE=innodb; |
| 32 | +BEGIN; |
| 33 | +INSERT INTO test.t1 VALUES (1); |
| 34 | +COMMIT; |
| 35 | +DROP TABLE test.t1; |
| 36 | +DROP DATABASE test; |
| 37 | +EOF |
| 38 | + |
| 39 | +--echo # Shut server down |
| 40 | +--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 41 | +--shutdown_server |
| 42 | +--source include/wait_until_disconnected.inc |
| 43 | +--echo # Server is down |
| 44 | + |
| 45 | +--echo # Run the server with: |
| 46 | +--echo # --initialize-insecure |
| 47 | +--echo # $init_args |
| 48 | +--exec $MYSQLD $extra_args --initialize-insecure --datadir=$DDIR $init_args --init-file=$BOOTSTRAP_SQL > $MYSQLD_LOG 2>&1 |
| 49 | + |
| 50 | +--echo # Restart the server against DDIR |
| 51 | +--exec echo "restart:--datadir=$DDIR $init_args" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 52 | +--enable_reconnect |
| 53 | +--source include/wait_until_connected_again.inc |
| 54 | + |
| 55 | +--echo # Connect as root |
| 56 | +connect(root_con,localhost,root,,mysql); |
| 57 | + |
| 58 | +--let $master_uuid= `SELECT @@GLOBAL.SERVER_UUID` |
| 59 | +--let $assert_text= GTID_EXECUTED should have only the 5 GTIDs from the init-file |
| 60 | +--let $assert_cond= @@GLOBAL.GTID_EXECUTED = "$master_uuid:1-5" |
| 61 | +--source include/assert.inc |
| 62 | + |
| 63 | +--echo # Clean up |
| 64 | +# Shut server down |
| 65 | +--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 66 | +--shutdown_server |
| 67 | +--source include/wait_until_disconnected.inc |
| 68 | + |
| 69 | +# Delete mysqld log and init file |
| 70 | +remove_file $MYSQLD_LOG; |
| 71 | +# Delete datadir |
| 72 | +--perl |
| 73 | +use File::Path 'rmtree'; |
| 74 | +$DDIR=$ENV{"DDIR"}; |
| 75 | +rmtree([ "$DDIR" ]); |
| 76 | +EOF |
| 77 | + |
| 78 | +remove_file $BOOTSTRAP_SQL; |
| 79 | + |
| 80 | +--echo # Restarting the server after cleaning it up |
| 81 | +--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 82 | +--enable_reconnect |
| 83 | +--source include/wait_until_connected_again.inc |
0 commit comments