#!/bin/bash # Remove other sandboxes if present /home/ec2-user/sandboxes/msb_8_0_28/stop /home/ec2-user/sandboxes/msb_8_0_30/stop rm -rf /home/ec2-user/sandboxes/msb_8_0_28 rm -rf /home/ec2-user/sandboxes/msb_8_0_30 # Make sure all mysqld processes are killed sudo kill -9 `pidof mysqld` # Create two mysql deployments, one on 8.0.28 and another on 8.0.30. dbdeployer deploy single 8.0.30 --force dbdeployer deploy single 8.0.28 --force /home/ec2-user/sandboxes/msb_8_0_28/use -e "create database sysbench_2" /home/ec2-user/sandboxes/msb_8_0_28/use -e "create database sysbench" # Load data into our sysbench schema. We will use this data to seed our DDL test tables ~/sysbench/src/sysbench ~/sysbench/src/lua/oltp_read_write.lua --db-driver=mysql --mysql-user=root --mysql-password=msandbox --mysql-db=sysbench --threads=10 --rand-type=uniform --db-ps-mode=disable --tables=10 --table-size=25000 --mysql-socket=/tmp/mysql_sandbox8028.sock --mysql-port=8028 --time=0 --report-interval=1 prepare # In our second schema, create a table called sysbench_2.sbtest1 without the default sysbench pad column and seed the db with data from sysbench.sbtest1 /home/ec2-user/sandboxes/msb_8_0_28/use -e "CREATE TABLE sysbench_2.sbtest1 ( id int NOT NULL AUTO_INCREMENT, k int NOT NULL DEFAULT '0', c char(120) NOT NULL DEFAULT '', PRIMARY KEY (id), KEY k_1 (k)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci" /home/ec2-user/sandboxes/msb_8_0_28/use -e "insert into sysbench_2.sbtest1 ( k,c) select k,c from sysbench.sbtest1;" /home/ec2-user/sandboxes/msb_8_0_28/use -e "insert into sysbench_2.sbtest1 ( k,c) select k,c from sysbench.sbtest1;" /home/ec2-user/sandboxes/msb_8_0_28/use -e "insert into sysbench_2.sbtest1 ( k,c) select k,c from sysbench.sbtest1;" # Execute three instant DDLs to add columns to the end of the table. At the start and end check the INSTANT_COLS column in innodb_tables to verify our tables have instant DDLs /home/ec2-user/sandboxes/msb_8_0_28/use -e "select * from information_schema.innodb_tables where INSTANT_COLS>0;" /home/ec2-user/sandboxes/msb_8_0_28/use -e "alter table sysbench_2.sbtest1 add column pad varchar(60) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci DEFAULT NULL, ALGORITHM=instant;" /home/ec2-user/sandboxes/msb_8_0_28/use -e "alter table sysbench_2.sbtest1 add column pad_2 varchar(60) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci DEFAULT NULL, ALGORITHM=instant;" /home/ec2-user/sandboxes/msb_8_0_28/use -e "alter table sysbench_2.sbtest1 add column pad_3 varchar(60) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci DEFAULT NULL, ALGORITHM=instant;" /home/ec2-user/sandboxes/msb_8_0_28/use -e "select * from information_schema.innodb_tables where INSTANT_COLS>0;" # Should have this output: # +----------+--------------------+------+--------+-------+------------+---------------+------------+--------------+--------------------+ # | TABLE_ID | NAME | FLAG | N_COLS | SPACE | ROW_FORMAT | ZIP_PAGE_SIZE | SPACE_TYPE | INSTANT_COLS | TOTAL_ROW_VERSIONS | # +----------+--------------------+------+--------+-------+------------+---------------+------------+--------------+--------------------+ # | 1073 | sysbench_2/sbtest1 | 33 | 9 | 12 | Dynamic | 0 | Single | 3 | 0 | # +----------+--------------------+------+--------+-------+------------+---------------+------------+--------------+--------------------+ # We can now upgrade from 8.0.28 to 8.0.30. In 8.0.30 instant DDL is default and there are some new page/redo formats- which is what we were originally suspicious about. dbdeployer admin upgrade msb_8_0_28 msb_8_0_30 # Now that we are upgraded we can reproduce some crashes. Here I have four different combinations on 8.0.30 DDLs that will produce different stack. # Now that we are upgraded let’s add some new columns to the table. Here I’m adding a column to the end of the table and to the middle of the table. /home/ec2-user/sandboxes/msb_8_0_30/use -e "select * from information_schema.innodb_tables where INSTANT_COLS>0;" /home/ec2-user/sandboxes/msb_8_0_30/use -e "alter table sysbench_2.sbtest1 add column pad_4 varchar(60) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci DEFAULT NULL, ALGORITHM=instant;" /home/ec2-user/sandboxes/msb_8_0_30/use -e "alter table sysbench_2.sbtest1 add column pad_middle varchar(60) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci DEFAULT NULL after k, ALGORITHM=instant;" echo "Sleeping for 10 seconds, run tail -F /home/ec2-user/sandboxes/msb_8_0_30/data/msandbox.err in another terminal" sleep 10; # Now run sysbench against 8.0.30 and you will crash immediately getting stuck in a crash loop. see attached repr_1.log for stacks # run tail -F data/msandbox.err in another terminal ~/sysbench/src/sysbench ~/sysbench/src/lua/oltp_read_write.lua --db-driver=mysql --mysql-user=root --mysql-password=msandbox --mysql-db=sysbench_2 --threads=10 --rand-type=uniform --db-ps-mode=disable --tables=1 --table-size=10000 --mysql-socket=/tmp/mysql_sandbox8030.sock --mysql-port=8030 --time=0 --report-interval=1 run