diff options
Diffstat (limited to '')
-rw-r--r-- | storage/rocksdb/mysql-test/rocksdb/t/2pc_group_commit.test | 168 |
1 files changed, 168 insertions, 0 deletions
diff --git a/storage/rocksdb/mysql-test/rocksdb/t/2pc_group_commit.test b/storage/rocksdb/mysql-test/rocksdb/t/2pc_group_commit.test new file mode 100644 index 00000000..aeadf538 --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/t/2pc_group_commit.test @@ -0,0 +1,168 @@ +--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 + +# MariaDB: tooling to slowdown commits (also when running on ramdisk, we need +# write_prepared for some reason, this is set in the .opt file) +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/have_write_prepared.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'; + +# SQL layer solution is sufficient for Binlog counts but not RocksDB. +#set @tmp_bcwc= @@binlog_commit_wait_count; +#set @tmp_bcwu= @@binlog_commit_wait_usec; +#set global binlog_commit_wait_count=30; +#set global binlog_commit_wait_usec=500*1000; + +# RocksDB-side solution: + +set debug_dbug='+d,rocksdb_enable_delay_commits'; +create table dummy10(a int) engine=rocksdb; +drop table dummy10; +set debug_dbug='-d,rocksdb_enable_delay_commits'; + +--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'; + +#set global binlog_commit_wait_count= @tmp_bcwc; +#set global binlog_commit_wait_usec= @tmp_bcwu; + +set debug_dbug='+d,rocksdb_disable_delay_commits'; +create table dummy10(a int) engine=rocksdb; +drop table dummy10; +set debug_dbug='-d,rocksdb_disable_delay_commits'; + +--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; |