EVOLUTION-MANAGER
Edit File: 2pc_group_commit.test
--source include/have_rocksdb.inc --source include/have_log_bin.inc --source include/not_windows.inc --echo # Disable for valgrind because this takes too long --source include/not_valgrind.inc --disable_warnings DROP DATABASE IF EXISTS mysqlslap; --enable_warnings CREATE DATABASE mysqlslap; USE mysqlslap; CREATE TABLE t1(id BIGINT AUTO_INCREMENT, value BIGINT, PRIMARY KEY(id)) ENGINE=rocksdb; SET @save_rocksdb_enable_2pc= @@rocksdb_enable_2pc; SET @save_rocksdb_flush_log_at_trx_commit= @@rocksdb_flush_log_at_trx_commit; # # In MariaDB, regular group commit operation does not cause increment of # rocksdb_wal_group_syncs. # --echo # 2PC enabled, MyRocks durability enabled SET GLOBAL rocksdb_enable_2pc=1; SET GLOBAL rocksdb_flush_log_at_trx_commit=1; --echo ## --echo ## 2PC + durability + single thread --echo ## select variable_value into @b1 from information_schema.global_status where variable_name='Binlog_commits'; select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits'; select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced'; --exec $MYSQL_SLAP --silent --concurrency=1 --number-of-queries=1000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)" select IF(variable_value - @b1 = 1000, 'OK', variable_value - @b1) as Binlog_commits from information_schema.global_status where variable_name='Binlog_commits'; select IF(variable_value - @b2 = 1000, 'OK', variable_value - @b2) as Binlog_group_commits from information_schema.global_status where variable_name='Binlog_group_commits'; --echo # Prepare operations sync, commits don't. We expect slightly more than 1K syncs: select IF(variable_value - @b3 between 1000 and 1500, 'OK', variable_value - @b3) as Rocksdb_wal_synced from information_schema.global_status where variable_name='Rocksdb_wal_synced'; --echo ## --echo ## 2PC + durability + group commit --echo ## select variable_value into @b1 from information_schema.global_status where variable_name='Binlog_commits'; select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits'; select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced'; --exec $MYSQL_SLAP --silent --concurrency=50 --number-of-queries=10000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)" select IF(variable_value - @b1 = 10000, 'OK', variable_value - @b1) as Binlog_commits from information_schema.global_status where variable_name='Binlog_commits'; select IF(variable_value - @b2 between 100 and 5000, 'OK', variable_value - @b2) as Binlog_group_commits from information_schema.global_status where variable_name='Binlog_group_commits'; select IF(variable_value - @b3 between 1 and 9000, 'OK', variable_value - @b3) from information_schema.global_status where variable_name='Rocksdb_wal_synced'; --echo ## --echo # 2PC enabled, MyRocks durability disabled, single thread --echo ## SET GLOBAL rocksdb_enable_2pc=1; SET GLOBAL rocksdb_flush_log_at_trx_commit=0; select variable_value into @b1 from information_schema.global_status where variable_name='Binlog_commits'; select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits'; select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced'; --exec $MYSQL_SLAP --silent --concurrency=1 --number-of-queries=1000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)" select IF(variable_value - @b1 = 1000, 'OK', variable_value - @b1) as Binlog_commits from information_schema.global_status where variable_name='Binlog_commits'; select IF(variable_value - @b2 = 1000, 'OK', variable_value - @b2) as Binlog_group_commits from information_schema.global_status where variable_name='Binlog_group_commits'; select IF(variable_value - @b3 < 10, 'OK', variable_value - @b3) from information_schema.global_status where variable_name='Rocksdb_wal_synced'; --echo ## --echo # 2PC enabled, MyRocks durability disabled, concurrent workload --echo ## select variable_value into @b1 from information_schema.global_status where variable_name='Binlog_commits'; select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits'; select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced'; --exec $MYSQL_SLAP --silent --concurrency=50 --number-of-queries=10000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)" select IF(variable_value - @b1 = 10000, 'OK', variable_value - @b1) as Binlog_commits from information_schema.global_status where variable_name='Binlog_commits'; select IF(variable_value - @b2 < 8000, 'OK', variable_value - @b2) as Binlog_group_commits from information_schema.global_status where variable_name='Binlog_group_commits'; select IF(variable_value - @b3 < 10, 'OK', variable_value - @b3) from information_schema.global_status where variable_name='Rocksdb_wal_synced'; ## ## The next two are disabled because they don't add any test coverage in ## MariaDB. @@rocksdb_enable_2pc=0 is a MyRocks-internal setting, binlog ## [group] commit still happens, and syncing RocksDB WAL too. ## --disable_parsing --echo ## --echo # 2PC disabled, MyRocks durability enabled, one thread --echo ## SET GLOBAL rocksdb_enable_2pc=0; SET GLOBAL rocksdb_flush_log_at_trx_commit=1; select variable_value into @b1 from information_schema.global_status where variable_name='Binlog_commits'; select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits'; select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced'; --exec $MYSQL_SLAP --silent --concurrency=1 --number-of-queries=1000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)" select variable_value - @b1 as Binlog_commits from information_schema.global_status where variable_name='Binlog_commits'; select variable_value - @b2 as Binlog_group_commits from information_schema.global_status where variable_name='Binlog_group_commits'; select variable_value - @b3 as Rocksdb_wal_synced from information_schema.global_status where variable_name='Rocksdb_wal_synced'; --echo ## --echo # 2PC disabled, MyRocks durability enabled, concurrent workload --echo ## select variable_value into @b1 from information_schema.global_status where variable_name='Binlog_commits'; select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits'; select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced'; --exec $MYSQL_SLAP --silent --concurrency=50 --number-of-queries=10000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)" select variable_value - @b1 as Binlog_commits from information_schema.global_status where variable_name='Binlog_commits'; select variable_value - @b2 as Binlog_group_commits from information_schema.global_status where variable_name='Binlog_group_commits'; select variable_value - @b3 as Rocksdb_wal_synced from information_schema.global_status where variable_name='Rocksdb_wal_synced'; --enable_parsing SET GLOBAL rocksdb_enable_2pc= @save_rocksdb_enable_2pc; SET GLOBAL rocksdb_flush_log_at_trx_commit= @save_rocksdb_flush_log_at_trx_commit; DROP TABLE t1; DROP DATABASE mysqlslap;