summaryrefslogtreecommitdiff
path: root/storage/rocksdb
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2017-10-27 17:48:17 +0300
committerSergei Petrunia <psergey@askmonty.org>2017-10-27 17:48:17 +0300
commit3d46ebbc89eb59e76398f1147c7fc317c204cb95 (patch)
tree25294d4f7aa6be8b96fe32faac60e84a6a4ccb18 /storage/rocksdb
parent6cfbffad5bd4178fbe4be2f535f2c6f0a9231f47 (diff)
downloadmariadb-git-3d46ebbc89eb59e76398f1147c7fc317c204cb95.tar.gz
MDEV-11934: MariaRocks: Group Commit with binlog
Adjust and enable rocksdb.2pc_group_commit test
Diffstat (limited to 'storage/rocksdb')
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/2pc_group_commit.result105
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/t/2pc_group_commit.test119
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/t/disabled.def1
3 files changed, 172 insertions, 53 deletions
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/2pc_group_commit.result b/storage/rocksdb/mysql-test/rocksdb/r/2pc_group_commit.result
index 7b15ed47d44..a9e80f1562e 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/2pc_group_commit.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/2pc_group_commit.result
@@ -3,42 +3,87 @@ DROP DATABASE IF EXISTS mysqlslap;
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;
# 2PC enabled, MyRocks durability enabled
SET GLOBAL rocksdb_enable_2pc=1;
SET GLOBAL rocksdb_flush_log_at_trx_commit=1;
+##
## 2PC + durability + single thread
-select variable_value into @c from information_schema.global_status where variable_name='rocksdb_wal_group_syncs';
-select case when variable_value-@c = 1000 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_wal_group_syncs';
-case when variable_value-@c = 1000 then 'true' else 'false' end
-true
+##
+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';
+select IF(variable_value - @b1 = 1000, 'OK', 'FAIL') as Binlog_commits
+from information_schema.global_status where variable_name='Binlog_commits';
+Binlog_commits
+OK
+select IF(variable_value - @b2 = 1000, 'OK', 'FAIL') as Binlog_group_commits
+from information_schema.global_status where variable_name='Binlog_group_commits';
+Binlog_group_commits
+OK
+# Prepare operations sync, commits don't. We expect slightly more than 1K syncs:
+select IF(variable_value - @b3 between 1000 and 1500, 'OK', 'FAIL') as Rocksdb_wal_synced
+from information_schema.global_status where variable_name='Rocksdb_wal_synced';
+Rocksdb_wal_synced
+OK
+##
## 2PC + durability + group commit
-select variable_value into @c from information_schema.global_status where variable_name='rocksdb_wal_group_syncs';
-select case when variable_value-@c > 0 and variable_value-@c < 10000 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_wal_group_syncs';
-case when variable_value-@c > 0 and variable_value-@c < 10000 then 'true' else 'false' end
-true
-# 2PC enabled, MyRocks durability disabled
+##
+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';
+select IF(variable_value - @b1 = 10000, 'OK', 'FAIL') as Binlog_commits
+from information_schema.global_status where variable_name='Binlog_commits';
+Binlog_commits
+OK
+select IF(variable_value - @b2 between 100 and 5000, 'OK', 'FAIL') as Binlog_group_commits
+from information_schema.global_status where variable_name='Binlog_group_commits';
+Binlog_group_commits
+OK
+select IF(variable_value - @b3 between 1 and 9000, 'OK', 'FAIL')
+from information_schema.global_status where variable_name='Rocksdb_wal_synced';
+IF(variable_value - @b3 between 1 and 9000, 'OK', 'FAIL')
+OK
+##
+# 2PC enabled, MyRocks durability disabled, single thread
+##
SET GLOBAL rocksdb_enable_2pc=1;
SET GLOBAL rocksdb_flush_log_at_trx_commit=0;
-select variable_value into @c from information_schema.global_status where variable_name='rocksdb_wal_group_syncs';
-select case when variable_value-@c = 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_wal_group_syncs';
-case when variable_value-@c = 0 then 'true' else 'false' end
-true
-select variable_value into @c from information_schema.global_status where variable_name='rocksdb_wal_group_syncs';
-select case when variable_value-@c = 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_wal_group_syncs';
-case when variable_value-@c = 0 then 'true' else 'false' end
-true
-# 2PC disabled, MyRocks durability enabled
-SET GLOBAL rocksdb_enable_2pc=0;
-SET GLOBAL rocksdb_flush_log_at_trx_commit=1;
-select variable_value into @c from information_schema.global_status where variable_name='rocksdb_wal_group_syncs';
-select case when variable_value-@c = 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_wal_group_syncs';
-case when variable_value-@c = 0 then 'true' else 'false' end
-true
-select variable_value into @c from information_schema.global_status where variable_name='rocksdb_wal_group_syncs';
-select case when variable_value-@c = 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_wal_group_syncs';
-case when variable_value-@c = 0 then 'true' else 'false' end
-true
-SET GLOBAL rocksdb_enable_2pc=1;
-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';
+select IF(variable_value - @b1 = 1000, 'OK', 'FAIL') as Binlog_commits
+from information_schema.global_status where variable_name='Binlog_commits';
+Binlog_commits
+OK
+select IF(variable_value - @b2 = 1000, 'OK', 'FAIL') as Binlog_group_commits
+from information_schema.global_status where variable_name='Binlog_group_commits';
+Binlog_group_commits
+OK
+select IF(variable_value - @b3 < 10, 'OK', 'FAIL')
+from information_schema.global_status where variable_name='Rocksdb_wal_synced';
+IF(variable_value - @b3 < 10, 'OK', 'FAIL')
+OK
+##
+# 2PC enabled, MyRocks durability disabled, concurrent workload
+##
+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';
+select IF(variable_value - @b1 = 10000, 'OK', 'FAIL') as Binlog_commits
+from information_schema.global_status where variable_name='Binlog_commits';
+Binlog_commits
+OK
+select IF(variable_value - @b2 < 8000, 'OK', 'FAIL') as Binlog_group_commits
+from information_schema.global_status where variable_name='Binlog_group_commits';
+Binlog_group_commits
+OK
+select IF(variable_value - @b3 < 10, 'OK', 'FAIL')
+from information_schema.global_status where variable_name='Rocksdb_wal_synced';
+IF(variable_value - @b3 < 10, 'OK', 'FAIL')
+OK
+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;
diff --git a/storage/rocksdb/mysql-test/rocksdb/t/2pc_group_commit.test b/storage/rocksdb/mysql-test/rocksdb/t/2pc_group_commit.test
index 923c9db17f2..124d700d51d 100644
--- a/storage/rocksdb/mysql-test/rocksdb/t/2pc_group_commit.test
+++ b/storage/rocksdb/mysql-test/rocksdb/t/2pc_group_commit.test
@@ -12,53 +12,128 @@ 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
-select variable_value into @c from information_schema.global_status where variable_name='rocksdb_wal_group_syncs';
+--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 case when variable_value-@c = 1000 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_wal_group_syncs';
-
+select IF(variable_value - @b1 = 1000, 'OK', 'FAIL') as Binlog_commits
+from information_schema.global_status where variable_name='Binlog_commits';
+select IF(variable_value - @b2 = 1000, 'OK', 'FAIL') 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', 'FAIL') as Rocksdb_wal_synced
+from information_schema.global_status where variable_name='Rocksdb_wal_synced';
+
+--echo ##
--echo ## 2PC + durability + group commit
-select variable_value into @c from information_schema.global_status where variable_name='rocksdb_wal_group_syncs';
+--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 case when variable_value-@c > 0 and variable_value-@c < 10000 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_wal_group_syncs';
+select IF(variable_value - @b1 = 10000, 'OK', 'FAIL') as Binlog_commits
+from information_schema.global_status where variable_name='Binlog_commits';
+select IF(variable_value - @b2 between 100 and 5000, 'OK', 'FAIL') 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', 'FAIL')
+from information_schema.global_status where variable_name='Rocksdb_wal_synced';
---echo # 2PC enabled, MyRocks durability disabled
+--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 @c from information_schema.global_status where variable_name='rocksdb_wal_group_syncs';
+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 case when variable_value-@c = 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_wal_group_syncs';
-select variable_value into @c from information_schema.global_status where variable_name='rocksdb_wal_group_syncs';
---exec $MYSQL_SLAP --silent --concurrency=50 --number-of-queries=10000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)"
-select case when variable_value-@c = 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_wal_group_syncs';
+select IF(variable_value - @b1 = 1000, 'OK', 'FAIL') as Binlog_commits
+from information_schema.global_status where variable_name='Binlog_commits';
+select IF(variable_value - @b2 = 1000, 'OK', 'FAIL') as Binlog_group_commits
+from information_schema.global_status where variable_name='Binlog_group_commits';
+select IF(variable_value - @b3 < 10, 'OK', 'FAIL')
+from information_schema.global_status where variable_name='Rocksdb_wal_synced';
+--echo ##
+--echo # 2PC enabled, MyRocks durability disabled, concurrent workload
+--echo ##
---echo # 2PC disabled, MyRocks durability enabled
-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';
-select variable_value into @c from information_schema.global_status where variable_name='rocksdb_wal_group_syncs';
---exec $MYSQL_SLAP --silent --concurrency=1 --number-of-queries=1000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)"
-select case when variable_value-@c = 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_wal_group_syncs';
-
-select variable_value into @c from information_schema.global_status where variable_name='rocksdb_wal_group_syncs';
--exec $MYSQL_SLAP --silent --concurrency=50 --number-of-queries=10000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)"
-select case when variable_value-@c = 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_wal_group_syncs';
+select IF(variable_value - @b1 = 10000, 'OK', 'FAIL') as Binlog_commits
+from information_schema.global_status where variable_name='Binlog_commits';
+select IF(variable_value - @b2 < 8000, 'OK', 'FAIL') as Binlog_group_commits
+from information_schema.global_status where variable_name='Binlog_group_commits';
+select IF(variable_value - @b3 < 10, 'OK', 'FAIL')
+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;
-SET GLOBAL rocksdb_enable_2pc=1;
-SET GLOBAL rocksdb_flush_log_at_trx_commit=1;
DROP TABLE t1;
DROP DATABASE mysqlslap;
diff --git a/storage/rocksdb/mysql-test/rocksdb/t/disabled.def b/storage/rocksdb/mysql-test/rocksdb/t/disabled.def
index 6a352e9511b..d160ce46ebc 100644
--- a/storage/rocksdb/mysql-test/rocksdb/t/disabled.def
+++ b/storage/rocksdb/mysql-test/rocksdb/t/disabled.def
@@ -40,7 +40,6 @@ read_only_tx : MariaRocks: requires GTIDs
rpl_row_triggers : MariaRocks: requires GTIDs
trx_info_rpl : MariaRocks: @@rpl_skip_tx_api doesn't work, yet.
-2pc_group_commit : MariaRocks: Group Commit is not functional yet
mysqldump : MariaRocks: MariaDB's mysqldump doesn't support --print-ordering-key
mysqldump2 : MariaRocks: MariaDB's mysqldump doesn't support --print-ordering-key